@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.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.cjs +282 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +240 -0
- package/dist/index.js.map +1 -0
- package/filerobot.css +1669 -0
- package/node_modules/@media-editor/client/LICENSE +21 -0
- package/node_modules/@media-editor/client/README.md +27 -0
- package/node_modules/@media-editor/client/dist/index.cjs +60 -0
- package/node_modules/@media-editor/client/dist/index.cjs.map +1 -0
- package/node_modules/@media-editor/client/dist/index.d.cts +24 -0
- package/node_modules/@media-editor/client/dist/index.d.ts +24 -0
- package/node_modules/@media-editor/client/dist/index.js +35 -0
- package/node_modules/@media-editor/client/dist/index.js.map +1 -0
- package/node_modules/@media-editor/client/package.json +23 -0
- package/node_modules/@media-editor/core/LICENSE +21 -0
- package/node_modules/@media-editor/core/README.md +14 -0
- package/node_modules/@media-editor/core/dist/browser.cjs +505 -0
- package/node_modules/@media-editor/core/dist/browser.cjs.map +1 -0
- package/node_modules/@media-editor/core/dist/browser.d.cts +100 -0
- package/node_modules/@media-editor/core/dist/browser.d.ts +100 -0
- package/node_modules/@media-editor/core/dist/browser.js +883 -0
- package/node_modules/@media-editor/core/dist/browser.js.map +1 -0
- package/node_modules/@media-editor/core/dist/chunk-MGKYVYOH.js +371 -0
- package/node_modules/@media-editor/core/dist/chunk-MGKYVYOH.js.map +1 -0
- package/node_modules/@media-editor/core/dist/chunk-USY6UDGL.js +87 -0
- package/node_modules/@media-editor/core/dist/chunk-USY6UDGL.js.map +1 -0
- package/node_modules/@media-editor/core/dist/chunk-XCBM7P7N.js +592 -0
- package/node_modules/@media-editor/core/dist/chunk-XCBM7P7N.js.map +1 -0
- package/node_modules/@media-editor/core/dist/engine.cjs +540 -0
- package/node_modules/@media-editor/core/dist/engine.cjs.map +1 -0
- package/node_modules/@media-editor/core/dist/engine.d.cts +325 -0
- package/node_modules/@media-editor/core/dist/engine.d.ts +359 -0
- package/node_modules/@media-editor/core/dist/engine.js +315 -0
- package/node_modules/@media-editor/core/dist/engine.js.map +1 -0
- package/node_modules/@media-editor/core/dist/filerobot.cjs +818 -0
- package/node_modules/@media-editor/core/dist/filerobot.cjs.map +1 -0
- package/node_modules/@media-editor/core/dist/filerobot.d.cts +88 -0
- package/node_modules/@media-editor/core/dist/filerobot.d.ts +88 -0
- package/node_modules/@media-editor/core/dist/filerobot.js +473 -0
- package/node_modules/@media-editor/core/dist/filerobot.js.map +1 -0
- package/node_modules/@media-editor/core/dist/index.cjs +1276 -0
- package/node_modules/@media-editor/core/dist/index.cjs.map +1 -0
- package/node_modules/@media-editor/core/dist/index.d.cts +242 -0
- package/node_modules/@media-editor/core/dist/index.d.ts +264 -0
- package/node_modules/@media-editor/core/dist/index.js +682 -0
- package/node_modules/@media-editor/core/dist/index.js.map +1 -0
- package/node_modules/@media-editor/core/dist/platform-presets-B-o4C6uY.d.cts +80 -0
- package/node_modules/@media-editor/core/dist/platform-presets-B-o4C6uY.d.ts +80 -0
- package/node_modules/@media-editor/core/dist/state-B85vkf7_.d.cts +936 -0
- package/node_modules/@media-editor/core/dist/state-B85vkf7_.d.ts +1027 -0
- package/node_modules/@media-editor/core/node_modules/zod/LICENSE +21 -0
- package/node_modules/@media-editor/core/node_modules/zod/README.md +208 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.cjs +33 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/index.js +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/package.json +118 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/external.js +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/index.js +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.cjs +111 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.cjs +3775 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.d.ts +1031 -0
- package/node_modules/@media-editor/core/node_modules/zod/v3/types.js +3693 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.cjs +32 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.cjs +57 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.d.cts +46 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.d.ts +46 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/compat.js +27 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.cjs +67 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/errors.js +41 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.cjs +70 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.d.cts +13 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.d.ts +13 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/external.js +18 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.cjs +32 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.d.cts +23 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.d.ts +23 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/parse.js +6 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.cjs +1109 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.d.cts +630 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.d.ts +630 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/classic/schemas.js +1006 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.cjs +1039 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.d.cts +284 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.d.ts +284 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/api.js +906 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.cjs +591 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/checks.js +565 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.cjs +67 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.d.cts +49 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.d.ts +49 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/core.js +61 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.cjs +226 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.d.cts +208 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.d.ts +208 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/errors.js +195 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.cjs +102 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.d.cts +52 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.d.ts +52 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/function.js +75 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.cjs +44 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.d.cts +15 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.d.ts +15 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/index.js +15 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.d.cts +87 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.d.ts +87 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.cjs +87 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.d.cts +25 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.d.ts +25 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/parse.js +57 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.cjs +103 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.d.cts +62 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.d.ts +62 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/regexes.js +95 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.cjs +1748 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.d.cts +1041 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.d.ts +1041 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/schemas.js +1717 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/to-json-schema.js +849 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.cjs +539 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.d.cts +183 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.d.ts +183 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/util.js +493 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/index.js +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.cjs +141 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.cjs +190 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.cjs +144 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.cjs +161 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.cjs +145 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/en.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/es.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.cjs +148 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.cjs +148 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/he.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.cjs +84 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.d.cts +39 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.d.ts +39 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/index.js +39 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.cjs +141 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/kh.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.cjs +147 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.cjs +144 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.cjs +148 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.cjs +190 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.cjs +144 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ua.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.cjs +62 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.d.cts +11 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.d.ts +11 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/external.js +13 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.cjs +8 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.cjs +839 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.d.cts +356 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.d.ts +356 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4/mini/schemas.js +732 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/@media-editor/core/node_modules/zod/v4-mini/index.js +1 -0
- package/node_modules/@media-editor/core/package.json +42 -0
- package/node_modules/@media-editor/image/LICENSE +21 -0
- package/node_modules/@media-editor/image/README.md +48 -0
- package/node_modules/@media-editor/image/dist/chunk-5TBO732O.js +1 -0
- package/node_modules/@media-editor/image/dist/index-CU3vkvDR.d.ts +44 -0
- package/node_modules/@media-editor/image/dist/index.css +1 -0
- package/node_modules/@media-editor/image/dist/index.d.ts +2 -0
- package/node_modules/@media-editor/image/dist/index.js +364 -0
- package/node_modules/@media-editor/image/dist/lazy.css +1 -0
- package/node_modules/@media-editor/image/dist/lazy.d.ts +8 -0
- package/node_modules/@media-editor/image/dist/lazy.js +1 -0
- package/node_modules/@media-editor/image/package.json +29 -0
- package/node_modules/@media-editor/video/LICENSE +21 -0
- package/node_modules/@media-editor/video/README.md +55 -0
- package/node_modules/@media-editor/video/dist/chunk-EK7ODJWE.js +1 -0
- package/node_modules/@media-editor/video/dist/index-CX2iAapm.d.ts +51 -0
- package/node_modules/@media-editor/video/dist/index.d.ts +4 -0
- package/node_modules/@media-editor/video/dist/index.js +16919 -0
- package/node_modules/@media-editor/video/dist/lazy.d.ts +10 -0
- package/node_modules/@media-editor/video/dist/lazy.js +1 -0
- package/node_modules/@media-editor/video/dist/legacy.js +65 -0
- package/node_modules/@media-editor/video/package.json +29 -0
- package/package.json +48 -0
- package/style.css +1 -0
- package/theme.css +1214 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/overlay-render.ts
|
|
4
|
+
var DEG2RAD = Math.PI / 180;
|
|
5
|
+
function strokeStyle(ctx, color, width) {
|
|
6
|
+
ctx.strokeStyle = color;
|
|
7
|
+
ctx.lineWidth = width;
|
|
8
|
+
ctx.lineCap = "round";
|
|
9
|
+
ctx.lineJoin = "round";
|
|
10
|
+
}
|
|
11
|
+
function drawArrowHead(ctx, x1, y1, x2, y2, width) {
|
|
12
|
+
const angle = Math.atan2(y2 - y1, x2 - x1);
|
|
13
|
+
const len = Math.max(12, width * 3.5);
|
|
14
|
+
ctx.beginPath();
|
|
15
|
+
ctx.moveTo(x2, y2);
|
|
16
|
+
ctx.lineTo(x2 - len * Math.cos(angle - Math.PI / 7), y2 - len * Math.sin(angle - Math.PI / 7));
|
|
17
|
+
ctx.moveTo(x2, y2);
|
|
18
|
+
ctx.lineTo(x2 - len * Math.cos(angle + Math.PI / 7), y2 - len * Math.sin(angle + Math.PI / 7));
|
|
19
|
+
ctx.stroke();
|
|
20
|
+
}
|
|
21
|
+
function normalizeOverlayRotation(deg) {
|
|
22
|
+
if (!Number.isFinite(deg)) return 0;
|
|
23
|
+
let next = deg % 360;
|
|
24
|
+
if (next > 180) next -= 360;
|
|
25
|
+
if (next < -180) next += 360;
|
|
26
|
+
return Math.abs(next) < 1e-3 ? 0 : next;
|
|
27
|
+
}
|
|
28
|
+
function getOverlayRotation(o) {
|
|
29
|
+
return normalizeOverlayRotation(o.rotation ?? 0);
|
|
30
|
+
}
|
|
31
|
+
function overlayBBox(o) {
|
|
32
|
+
switch (o.type) {
|
|
33
|
+
case "pen": {
|
|
34
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
35
|
+
for (let i = 0; i < o.points.length; i += 2) {
|
|
36
|
+
minX = Math.min(minX, o.points[i]);
|
|
37
|
+
maxX = Math.max(maxX, o.points[i]);
|
|
38
|
+
minY = Math.min(minY, o.points[i + 1]);
|
|
39
|
+
maxY = Math.max(maxY, o.points[i + 1]);
|
|
40
|
+
}
|
|
41
|
+
return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
|
|
42
|
+
}
|
|
43
|
+
case "line":
|
|
44
|
+
case "arrow":
|
|
45
|
+
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) };
|
|
46
|
+
case "rect":
|
|
47
|
+
case "ellipse":
|
|
48
|
+
case "sticker":
|
|
49
|
+
return { x: o.x, y: o.y, w: o.w, h: o.h };
|
|
50
|
+
case "text":
|
|
51
|
+
return { x: o.x, y: o.y, w: o.text.length * o.fontSize * 0.6, h: o.fontSize * 1.2 };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function overlayCenter(o) {
|
|
55
|
+
const b = overlayBBox(o);
|
|
56
|
+
return { x: b.x + b.w / 2, y: b.y + b.h / 2 };
|
|
57
|
+
}
|
|
58
|
+
function rotatePoint(x, y, cx, cy, deg) {
|
|
59
|
+
const rad = deg * DEG2RAD;
|
|
60
|
+
const cos = Math.cos(rad);
|
|
61
|
+
const sin = Math.sin(rad);
|
|
62
|
+
const dx = x - cx;
|
|
63
|
+
const dy = y - cy;
|
|
64
|
+
return { x: cx + dx * cos - dy * sin, y: cy + dx * sin + dy * cos };
|
|
65
|
+
}
|
|
66
|
+
function scalePoint(x, y, cx, cy, ratio) {
|
|
67
|
+
return { x: cx + (x - cx) * ratio, y: cy + (y - cy) * ratio };
|
|
68
|
+
}
|
|
69
|
+
function drawOverlay(ctx, o, imageCache) {
|
|
70
|
+
const rotation = getOverlayRotation(o);
|
|
71
|
+
if (rotation) {
|
|
72
|
+
const c = overlayCenter(o);
|
|
73
|
+
ctx.save();
|
|
74
|
+
ctx.translate(c.x, c.y);
|
|
75
|
+
ctx.rotate(rotation * DEG2RAD);
|
|
76
|
+
ctx.translate(-c.x, -c.y);
|
|
77
|
+
drawOverlayBase(ctx, o, imageCache);
|
|
78
|
+
ctx.restore();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
drawOverlayBase(ctx, o, imageCache);
|
|
82
|
+
}
|
|
83
|
+
function drawOverlayBase(ctx, o, imageCache) {
|
|
84
|
+
switch (o.type) {
|
|
85
|
+
case "pen": {
|
|
86
|
+
strokeStyle(ctx, o.color, o.width);
|
|
87
|
+
ctx.beginPath();
|
|
88
|
+
ctx.moveTo(o.points[0], o.points[1]);
|
|
89
|
+
for (let i = 2; i < o.points.length; i += 2) ctx.lineTo(o.points[i], o.points[i + 1]);
|
|
90
|
+
ctx.stroke();
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "line":
|
|
94
|
+
case "arrow": {
|
|
95
|
+
strokeStyle(ctx, o.color, o.width);
|
|
96
|
+
ctx.beginPath();
|
|
97
|
+
ctx.moveTo(o.x1, o.y1);
|
|
98
|
+
ctx.lineTo(o.x2, o.y2);
|
|
99
|
+
ctx.stroke();
|
|
100
|
+
if (o.type === "arrow") drawArrowHead(ctx, o.x1, o.y1, o.x2, o.y2, o.width);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case "rect": {
|
|
104
|
+
strokeStyle(ctx, o.color, o.width);
|
|
105
|
+
ctx.strokeRect(o.x, o.y, o.w, o.h);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case "ellipse": {
|
|
109
|
+
strokeStyle(ctx, o.color, o.width);
|
|
110
|
+
ctx.beginPath();
|
|
111
|
+
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);
|
|
112
|
+
ctx.stroke();
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
case "text": {
|
|
116
|
+
ctx.fillStyle = o.color;
|
|
117
|
+
ctx.font = `bold ${o.fontSize}px -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif`;
|
|
118
|
+
ctx.textBaseline = "top";
|
|
119
|
+
ctx.strokeStyle = "rgba(0,0,0,0.45)";
|
|
120
|
+
ctx.lineWidth = Math.max(2, o.fontSize / 16);
|
|
121
|
+
ctx.lineJoin = "round";
|
|
122
|
+
ctx.strokeText(o.text, o.x, o.y);
|
|
123
|
+
ctx.fillText(o.text, o.x, o.y);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case "sticker": {
|
|
127
|
+
if (o.emoji) {
|
|
128
|
+
ctx.font = `${Math.min(o.w, o.h)}px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif`;
|
|
129
|
+
ctx.textBaseline = "top";
|
|
130
|
+
ctx.fillText(o.emoji, o.x, o.y);
|
|
131
|
+
} else if (o.src) {
|
|
132
|
+
const img = imageCache?.get(o.src);
|
|
133
|
+
if (img) ctx.drawImage(img, o.x, o.y, o.w, o.h);
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function drawOverlays(ctx, overlays, imageCache) {
|
|
140
|
+
for (const o of overlays) drawOverlay(ctx, o, imageCache);
|
|
141
|
+
}
|
|
142
|
+
async function loadOverlayImages(overlays) {
|
|
143
|
+
const cache = /* @__PURE__ */ new Map();
|
|
144
|
+
const srcs = [...new Set(overlays.filter((o) => o.type === "sticker" && o.src).map((o) => o.src))];
|
|
145
|
+
await Promise.all(
|
|
146
|
+
srcs.map(
|
|
147
|
+
(src) => new Promise((resolve) => {
|
|
148
|
+
const img = new Image();
|
|
149
|
+
img.onload = () => {
|
|
150
|
+
cache.set(src, img);
|
|
151
|
+
resolve();
|
|
152
|
+
};
|
|
153
|
+
img.onerror = () => resolve();
|
|
154
|
+
img.src = src;
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
return cache;
|
|
159
|
+
}
|
|
160
|
+
async function renderOverlaysToPng(overlays, width, height) {
|
|
161
|
+
if (!overlays?.length) return null;
|
|
162
|
+
const canvas = document.createElement("canvas");
|
|
163
|
+
canvas.width = width;
|
|
164
|
+
canvas.height = height;
|
|
165
|
+
const ctx = canvas.getContext("2d");
|
|
166
|
+
if (!ctx) return null;
|
|
167
|
+
const cache = await loadOverlayImages(overlays);
|
|
168
|
+
drawOverlays(ctx, overlays, cache);
|
|
169
|
+
return new Promise((resolve) => canvas.toBlob((b) => resolve(b), "image/png"));
|
|
170
|
+
}
|
|
171
|
+
function hitTestOverlay(overlays, x, y, tolerance = 12) {
|
|
172
|
+
for (let i = overlays.length - 1; i >= 0; i--) {
|
|
173
|
+
const o = overlays[i];
|
|
174
|
+
if (hitOne(o, x, y, tolerance)) return i;
|
|
175
|
+
}
|
|
176
|
+
return -1;
|
|
177
|
+
}
|
|
178
|
+
function near(px, py, x, y, tol) {
|
|
179
|
+
return Math.abs(px - x) <= tol && Math.abs(py - y) <= tol;
|
|
180
|
+
}
|
|
181
|
+
function nearSegment(x, y, x1, y1, x2, y2, tol) {
|
|
182
|
+
const dx = x2 - x1;
|
|
183
|
+
const dy = y2 - y1;
|
|
184
|
+
const len2 = dx * dx + dy * dy || 1;
|
|
185
|
+
const t = Math.max(0, Math.min(1, ((x - x1) * dx + (y - y1) * dy) / len2));
|
|
186
|
+
const cx = x1 + t * dx;
|
|
187
|
+
const cy = y1 + t * dy;
|
|
188
|
+
return (x - cx) ** 2 + (y - cy) ** 2 <= tol * tol;
|
|
189
|
+
}
|
|
190
|
+
function hitOne(o, x, y, tol) {
|
|
191
|
+
const rotation = getOverlayRotation(o);
|
|
192
|
+
if (rotation) {
|
|
193
|
+
const c = overlayCenter(o);
|
|
194
|
+
const p = rotatePoint(x, y, c.x, c.y, -rotation);
|
|
195
|
+
return hitOneBase(o, p.x, p.y, tol);
|
|
196
|
+
}
|
|
197
|
+
return hitOneBase(o, x, y, tol);
|
|
198
|
+
}
|
|
199
|
+
function hitOneBase(o, x, y, tol) {
|
|
200
|
+
switch (o.type) {
|
|
201
|
+
case "pen": {
|
|
202
|
+
for (let i = 0; i + 3 < o.points.length; i += 2) {
|
|
203
|
+
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;
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
case "line":
|
|
208
|
+
case "arrow":
|
|
209
|
+
return nearSegment(x, y, o.x1, o.y1, o.x2, o.y2, tol + o.width / 2);
|
|
210
|
+
case "rect":
|
|
211
|
+
case "ellipse":
|
|
212
|
+
return x >= o.x - tol && x <= o.x + o.w + tol && y >= o.y - tol && y <= o.y + o.h + tol;
|
|
213
|
+
case "text":
|
|
214
|
+
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;
|
|
215
|
+
case "sticker":
|
|
216
|
+
return near(x, y, o.x + o.w / 2, o.y + o.h / 2, Math.max(o.w, o.h) / 2 + tol);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function fitStickerBox(natW, natH, boxSide) {
|
|
220
|
+
const side = Math.max(8, boxSide);
|
|
221
|
+
if (!(natW > 0) || !(natH > 0)) return { w: side, h: side };
|
|
222
|
+
const k = side / Math.max(natW, natH);
|
|
223
|
+
return { w: Math.max(8, Math.round(natW * k)), h: Math.max(8, Math.round(natH * k)) };
|
|
224
|
+
}
|
|
225
|
+
function scaleOverlay(o, ratio) {
|
|
226
|
+
const r = Math.max(0.05, ratio);
|
|
227
|
+
const c = overlayCenter(o);
|
|
228
|
+
switch (o.type) {
|
|
229
|
+
case "pen":
|
|
230
|
+
return { ...o, points: o.points.map((v, i) => i % 2 === 0 ? c.x + (v - c.x) * r : c.y + (v - c.y) * r) };
|
|
231
|
+
case "line":
|
|
232
|
+
case "arrow": {
|
|
233
|
+
const p1 = scalePoint(o.x1, o.y1, c.x, c.y, r);
|
|
234
|
+
const p2 = scalePoint(o.x2, o.y2, c.x, c.y, r);
|
|
235
|
+
return { ...o, x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
|
|
236
|
+
}
|
|
237
|
+
case "rect":
|
|
238
|
+
case "ellipse":
|
|
239
|
+
case "sticker":
|
|
240
|
+
return { ...o, w: Math.max(8, o.w * r), h: Math.max(8, o.h * r) };
|
|
241
|
+
case "text":
|
|
242
|
+
return { ...o, fontSize: Math.min(512, Math.max(8, o.fontSize * r)) };
|
|
243
|
+
default:
|
|
244
|
+
return o;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function rotateOverlay(o, deg) {
|
|
248
|
+
return { ...o, rotation: normalizeOverlayRotation(deg) };
|
|
249
|
+
}
|
|
250
|
+
function translateOverlay(o, dx, dy) {
|
|
251
|
+
switch (o.type) {
|
|
252
|
+
case "pen": {
|
|
253
|
+
const points = o.points.map((v, i) => i % 2 === 0 ? v + dx : v + dy);
|
|
254
|
+
return { ...o, points };
|
|
255
|
+
}
|
|
256
|
+
case "line":
|
|
257
|
+
case "arrow":
|
|
258
|
+
return { ...o, x1: o.x1 + dx, y1: o.y1 + dy, x2: o.x2 + dx, y2: o.y2 + dy };
|
|
259
|
+
case "rect":
|
|
260
|
+
case "ellipse":
|
|
261
|
+
case "sticker":
|
|
262
|
+
return { ...o, x: o.x + dx, y: o.y + dy };
|
|
263
|
+
case "text":
|
|
264
|
+
return { ...o, x: o.x + dx, y: o.y + dy };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/transform.ts
|
|
269
|
+
var DEG2RAD2 = Math.PI / 180;
|
|
270
|
+
function rotatedSize(w, h, deg) {
|
|
271
|
+
const norm = normalizeDeg(deg);
|
|
272
|
+
if (norm === 0 || norm === 180) return { w, h };
|
|
273
|
+
if (norm === 90 || norm === 270) return { w: h, h: w };
|
|
274
|
+
const rad = norm * DEG2RAD2;
|
|
275
|
+
return {
|
|
276
|
+
w: Math.round(Math.abs(w * Math.cos(rad)) + Math.abs(h * Math.sin(rad))),
|
|
277
|
+
h: Math.round(Math.abs(w * Math.sin(rad)) + Math.abs(h * Math.cos(rad)))
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function normalizeDeg(deg) {
|
|
281
|
+
return (deg % 360 + 360) % 360;
|
|
282
|
+
}
|
|
283
|
+
function evenize(n) {
|
|
284
|
+
const v = Math.round(n);
|
|
285
|
+
return v - v % 2;
|
|
286
|
+
}
|
|
287
|
+
function centeredMaxRect(bounds, aspect) {
|
|
288
|
+
let width = bounds.w;
|
|
289
|
+
let height = width / aspect;
|
|
290
|
+
if (height > bounds.h) {
|
|
291
|
+
height = bounds.h;
|
|
292
|
+
width = height * aspect;
|
|
293
|
+
}
|
|
294
|
+
return {
|
|
295
|
+
x: Math.round((bounds.w - width) / 2),
|
|
296
|
+
y: Math.round((bounds.h - height) / 2),
|
|
297
|
+
width: Math.round(width),
|
|
298
|
+
height: Math.round(height)
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function fitRects(crop, out, fit) {
|
|
302
|
+
const fullSrc = { x: 0, y: 0, width: crop.width, height: crop.height };
|
|
303
|
+
const fullDst = { x: 0, y: 0, width: out.w, height: out.h };
|
|
304
|
+
if (fit === "cover") {
|
|
305
|
+
return { src: centeredMaxRect({ w: crop.width, h: crop.height }, out.w / out.h), dst: fullDst };
|
|
306
|
+
}
|
|
307
|
+
if (fit === "contain") {
|
|
308
|
+
return { src: fullSrc, dst: centeredMaxRect({ w: out.w, h: out.h }, crop.width / crop.height) };
|
|
309
|
+
}
|
|
310
|
+
return { src: fullSrc, dst: fullDst };
|
|
311
|
+
}
|
|
312
|
+
function outputSize(source, state) {
|
|
313
|
+
if (state.scale) return { w: evenize(state.scale.width), h: evenize(state.scale.height) };
|
|
314
|
+
if (state.crop) return { w: evenize(state.crop.width), h: evenize(state.crop.height) };
|
|
315
|
+
const r = rotatedSize(source.w, source.h, state.rotation);
|
|
316
|
+
return { w: evenize(r.w), h: evenize(r.h) };
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/export-form.ts
|
|
320
|
+
async function buildVideoExportFormData(engine, videoFiles, audioFiles = []) {
|
|
321
|
+
const plan = engine.getExportPlan();
|
|
322
|
+
const fd = new FormData();
|
|
323
|
+
plan.videoSrcOrder.forEach((srcIdx, slot) => {
|
|
324
|
+
const f = videoFiles[srcIdx];
|
|
325
|
+
if (f) fd.append(`video_${slot}`, f, f.name || `video_${slot}.mp4`);
|
|
326
|
+
});
|
|
327
|
+
plan.audioSrcOrder.forEach((srcIdx, slot) => {
|
|
328
|
+
const f = audioFiles[srcIdx];
|
|
329
|
+
if (f) fd.append(`audio_${slot}`, f, f.name || `audio_${slot}`);
|
|
330
|
+
});
|
|
331
|
+
const out = outputSize(plan.state.canvas, plan.state);
|
|
332
|
+
const overlay = await renderOverlaysToPng(plan.state.overlays, out.w, out.h);
|
|
333
|
+
if (overlay) fd.append("overlay", overlay, "overlay.png");
|
|
334
|
+
fd.append("editState", JSON.stringify(plan.state));
|
|
335
|
+
return fd;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// src/filters.ts
|
|
339
|
+
var FILTER_PRESETS = [
|
|
340
|
+
{ id: "bw", label: "\u9ED1\u767D", vf: "hue=s=0", css: "grayscale(1)" },
|
|
341
|
+
{
|
|
342
|
+
id: "sepia",
|
|
343
|
+
label: "\u590D\u53E4",
|
|
344
|
+
vf: "colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131",
|
|
345
|
+
css: "sepia(0.85)"
|
|
346
|
+
},
|
|
347
|
+
{ id: "warm", label: "\u6696\u9633", vf: "colorbalance=rs=.15:gs=.04:bs=-.15", css: "sepia(0.25) saturate(1.25) brightness(1.03)" },
|
|
348
|
+
{ id: "cool", label: "\u51B7\u8C03", vf: "colorbalance=rs=-.14:bs=.16", css: "hue-rotate(12deg) saturate(0.95) brightness(1.02)" },
|
|
349
|
+
{ id: "vivid", label: "\u9C9C\u8273", vf: "eq=saturation=1.45:contrast=1.08", css: "saturate(1.45) contrast(1.08)" }
|
|
350
|
+
];
|
|
351
|
+
function findFilterPreset(id) {
|
|
352
|
+
return id ? FILTER_PRESETS.find((p) => p.id === id) : void 0;
|
|
353
|
+
}
|
|
354
|
+
function buildFilterCss(filters, presetId) {
|
|
355
|
+
const presetCss = findFilterPreset(presetId)?.css ?? "";
|
|
356
|
+
return [
|
|
357
|
+
`brightness(${1 + filters.brightness})`,
|
|
358
|
+
`contrast(${1 + filters.contrast})`,
|
|
359
|
+
`saturate(${1 + filters.saturation})`,
|
|
360
|
+
presetCss
|
|
361
|
+
].filter(Boolean).join(" ");
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// src/frame-compositor.ts
|
|
365
|
+
function drawVideoFrame(canvas, source, srcDims, canvasDims, state, k = 1, imageCache, withOverlays = true) {
|
|
366
|
+
const out = outputSize(canvasDims, state);
|
|
367
|
+
canvas.width = Math.max(2, Math.round(out.w * k));
|
|
368
|
+
canvas.height = Math.max(2, Math.round(out.h * k));
|
|
369
|
+
const ctx = canvas.getContext("2d");
|
|
370
|
+
if (!ctx) return;
|
|
371
|
+
const rb = rotatedSize(canvasDims.w, canvasDims.h, state.rotation);
|
|
372
|
+
const crop = state.crop ?? { x: 0, y: 0, width: rb.w, height: rb.h };
|
|
373
|
+
const fit = state.scale?.fit ?? "force";
|
|
374
|
+
const { src, dst } = fitRects({ width: crop.width, height: crop.height }, out, fit);
|
|
375
|
+
if (fit === "contain") {
|
|
376
|
+
ctx.fillStyle = "#000";
|
|
377
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
378
|
+
}
|
|
379
|
+
ctx.filter = buildFilterCss(state.filters, state.filterPreset);
|
|
380
|
+
ctx.save();
|
|
381
|
+
if (fit === "contain") {
|
|
382
|
+
ctx.beginPath();
|
|
383
|
+
ctx.rect(k * dst.x, k * dst.y, k * dst.width, k * dst.height);
|
|
384
|
+
ctx.clip();
|
|
385
|
+
}
|
|
386
|
+
ctx.translate(k * dst.x, k * dst.y);
|
|
387
|
+
ctx.scale(k * dst.width / src.width, k * dst.height / src.height);
|
|
388
|
+
ctx.translate(-(crop.x + src.x), -(crop.y + src.y));
|
|
389
|
+
ctx.translate(rb.w / 2, rb.h / 2);
|
|
390
|
+
ctx.rotate(state.rotation * DEG2RAD2);
|
|
391
|
+
ctx.scale(state.flipX ? -1 : 1, state.flipY ? -1 : 1);
|
|
392
|
+
const cov = fitRects({ width: srcDims.w, height: srcDims.h }, { w: canvasDims.w, h: canvasDims.h }, "cover");
|
|
393
|
+
ctx.drawImage(
|
|
394
|
+
source,
|
|
395
|
+
cov.src.x,
|
|
396
|
+
cov.src.y,
|
|
397
|
+
cov.src.width,
|
|
398
|
+
cov.src.height,
|
|
399
|
+
-canvasDims.w / 2,
|
|
400
|
+
-canvasDims.h / 2,
|
|
401
|
+
canvasDims.w,
|
|
402
|
+
canvasDims.h
|
|
403
|
+
);
|
|
404
|
+
ctx.restore();
|
|
405
|
+
ctx.filter = "none";
|
|
406
|
+
if (withOverlays && state.overlays?.length) {
|
|
407
|
+
ctx.setTransform(k, 0, 0, k, 0, 0);
|
|
408
|
+
drawOverlays(ctx, state.overlays, imageCache);
|
|
409
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function seekVideo(el, t) {
|
|
413
|
+
return new Promise((resolve) => {
|
|
414
|
+
const onSeeked = () => {
|
|
415
|
+
el.removeEventListener("seeked", onSeeked);
|
|
416
|
+
resolve();
|
|
417
|
+
};
|
|
418
|
+
el.addEventListener("seeked", onSeeked);
|
|
419
|
+
el.currentTime = Math.min(Math.max(0, t), el.duration || t);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
async function generateThumbnails(videoEl, count, maxW = 160) {
|
|
423
|
+
const dur = videoEl.duration;
|
|
424
|
+
if (!dur || !isFinite(dur) || count <= 0) return [];
|
|
425
|
+
const natW = videoEl.videoWidth || 16;
|
|
426
|
+
const natH = videoEl.videoHeight || 9;
|
|
427
|
+
const w = Math.min(maxW, natW);
|
|
428
|
+
const h = Math.max(1, Math.round(w * natH / natW));
|
|
429
|
+
const canvas = document.createElement("canvas");
|
|
430
|
+
canvas.width = w;
|
|
431
|
+
canvas.height = h;
|
|
432
|
+
const ctx = canvas.getContext("2d");
|
|
433
|
+
if (!ctx) return [];
|
|
434
|
+
const out = [];
|
|
435
|
+
for (let i = 0; i < count; i++) {
|
|
436
|
+
await seekVideo(videoEl, dur * (i + 0.5) / count);
|
|
437
|
+
ctx.drawImage(videoEl, 0, 0, w, h);
|
|
438
|
+
out.push(canvas.toDataURL("image/jpeg", 0.6));
|
|
439
|
+
}
|
|
440
|
+
return out;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// src/fullscreen.ts
|
|
444
|
+
function createFullscreenToggle(host, options = {}) {
|
|
445
|
+
const mode = options.mode ?? "overlay";
|
|
446
|
+
const btn = document.createElement("button");
|
|
447
|
+
btn.type = "button";
|
|
448
|
+
btn.className = ["me-fullscreen-toggle", options.className].filter(Boolean).join(" ");
|
|
449
|
+
btn.dataset.meFullscreenToggle = "true";
|
|
450
|
+
btn.dataset.mode = mode;
|
|
451
|
+
btn.title = "\u5168\u5C4F / \u9000\u51FA\u5168\u5C4F";
|
|
452
|
+
btn.style.cssText = [
|
|
453
|
+
mode === "overlay" ? "position:absolute;left:8px;bottom:8px;z-index:30;" : "position:static;",
|
|
454
|
+
"width:32px;height:32px;padding:0;",
|
|
455
|
+
"display:inline-flex;align-items:center;justify-content:center;",
|
|
456
|
+
"border:1px solid var(--me-border,#26262b);border-radius:6px;",
|
|
457
|
+
"background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);",
|
|
458
|
+
"cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;"
|
|
459
|
+
].join("");
|
|
460
|
+
host.classList.add("me-fullscreen-host");
|
|
461
|
+
const sync = () => {
|
|
462
|
+
const isFullscreen = document.fullscreenElement === host;
|
|
463
|
+
btn.textContent = isFullscreen ? "\xD7" : "\u26F6";
|
|
464
|
+
btn.setAttribute("aria-label", isFullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F");
|
|
465
|
+
host.classList.toggle("me-is-fullscreen", isFullscreen);
|
|
466
|
+
host.dataset.meFullscreen = isFullscreen ? "true" : "false";
|
|
467
|
+
};
|
|
468
|
+
sync();
|
|
469
|
+
const onChange = () => sync();
|
|
470
|
+
const onClick = () => {
|
|
471
|
+
const action = document.fullscreenElement === host ? document.exitFullscreen?.() : host.requestFullscreen?.();
|
|
472
|
+
void action?.catch?.(() => {
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
btn.addEventListener("click", onClick);
|
|
476
|
+
document.addEventListener("fullscreenchange", onChange);
|
|
477
|
+
return {
|
|
478
|
+
button: btn,
|
|
479
|
+
dispose: () => {
|
|
480
|
+
document.removeEventListener("fullscreenchange", onChange);
|
|
481
|
+
btn.removeEventListener("click", onClick);
|
|
482
|
+
btn.remove();
|
|
483
|
+
host.classList.remove("me-fullscreen-host", "me-is-fullscreen");
|
|
484
|
+
delete host.dataset.meFullscreen;
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
exports.buildVideoExportFormData = buildVideoExportFormData;
|
|
490
|
+
exports.createFullscreenToggle = createFullscreenToggle;
|
|
491
|
+
exports.drawOverlay = drawOverlay;
|
|
492
|
+
exports.drawOverlays = drawOverlays;
|
|
493
|
+
exports.drawVideoFrame = drawVideoFrame;
|
|
494
|
+
exports.fitStickerBox = fitStickerBox;
|
|
495
|
+
exports.generateThumbnails = generateThumbnails;
|
|
496
|
+
exports.getOverlayRotation = getOverlayRotation;
|
|
497
|
+
exports.hitTestOverlay = hitTestOverlay;
|
|
498
|
+
exports.loadOverlayImages = loadOverlayImages;
|
|
499
|
+
exports.overlayBBox = overlayBBox;
|
|
500
|
+
exports.renderOverlaysToPng = renderOverlaysToPng;
|
|
501
|
+
exports.rotateOverlay = rotateOverlay;
|
|
502
|
+
exports.scaleOverlay = scaleOverlay;
|
|
503
|
+
exports.translateOverlay = translateOverlay;
|
|
504
|
+
//# sourceMappingURL=browser.cjs.map
|
|
505
|
+
//# sourceMappingURL=browser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/overlay-render.ts","../src/transform.ts","../src/export-form.ts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BAAA,GAAS,cAAI,CAAA;AAC3D,IAAA,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,kBAAA,EAAoB,YAAY,CAAA;AACtD,IAAA,IAAA,CAAK,OAAA,CAAQ,YAAA,GAAe,YAAA,GAAe,MAAA,GAAS,OAAA;AAAA,EACtD,CAAA;AACA,EAAA,IAAA,EAAK;AACL,EAAA,MAAM,QAAA,GAAW,MAAM,IAAA,EAAK;AAC5B,EAAA,MAAM,UAAU,MAAM;AACpB,IAAA,MAAM,MAAA,GACJ,SAAS,iBAAA,KAAsB,IAAA,GAAO,SAAS,cAAA,IAAiB,GAAI,KAAK,iBAAA,IAAoB;AAC/F,IAAA,KAAK,MAAA,EAAQ,QAAQ,MAAM;AAAA,IAAC,CAAC,CAAA;AAAA,EAC/B,CAAA;AACA,EAAA,GAAA,CAAI,gBAAA,CAAiB,SAAS,OAAO,CAAA;AACrC,EAAA,QAAA,CAAS,gBAAA,CAAiB,oBAAoB,QAAQ,CAAA;AAEtD,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,GAAA;AAAA,IACR,SAAS,MAAM;AACb,MAAA,QAAA,CAAS,mBAAA,CAAoB,oBAAoB,QAAQ,CAAA;AACzD,MAAA,GAAA,CAAI,mBAAA,CAAoB,SAAS,OAAO,CAAA;AACxC,MAAA,GAAA,CAAI,MAAA,EAAO;AACX,MAAA,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,oBAAA,EAAsB,kBAAkB,CAAA;AAC9D,MAAA,OAAO,KAAK,OAAA,CAAQ,YAAA;AAAA,IACtB;AAAA,GACF;AACF","file":"browser.cjs","sourcesContent":["/**\n * editor-core/overlay-render —— 标注/贴纸绘制(浏览器环境,Canvas 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 * 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 * 把引擎导出计划 + 浏览器端 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 * 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","/**\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"]}
|