@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,883 @@
|
|
|
1
|
+
import { outputSize, rotatedSize, fitRects, buildFilterCss, DEG2RAD, findFilterPreset } from './chunk-USY6UDGL.js';
|
|
2
|
+
|
|
3
|
+
// src/overlay-render.ts
|
|
4
|
+
var DEG2RAD2 = 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
|
+
var EMOJI_STICKER_VISUAL_SCALE = 0.84;
|
|
29
|
+
function emojiStickerDrawBox(o) {
|
|
30
|
+
const width = Math.max(8, Number(o?.w) || 0);
|
|
31
|
+
const height = Math.max(8, Number(o?.h) || 0);
|
|
32
|
+
const size = Math.max(8, Math.min(width, height) * EMOJI_STICKER_VISUAL_SCALE);
|
|
33
|
+
return {
|
|
34
|
+
x: (Number(o?.x) || 0) + (width - size) / 2,
|
|
35
|
+
y: (Number(o?.y) || 0) + (height - size) / 2,
|
|
36
|
+
size
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
var textMeasureCanvas = null;
|
|
40
|
+
function getTextMeasureContext() {
|
|
41
|
+
if (typeof document === "undefined") return null;
|
|
42
|
+
textMeasureCanvas ?? (textMeasureCanvas = document.createElement("canvas"));
|
|
43
|
+
return textMeasureCanvas.getContext("2d");
|
|
44
|
+
}
|
|
45
|
+
function getTextFontSize(o) {
|
|
46
|
+
return Math.min(512, Math.max(8, Number(o.fontSize) || 24));
|
|
47
|
+
}
|
|
48
|
+
function getTextPaddingX(o, fontSize) {
|
|
49
|
+
return Number.isFinite(o.paddingX) ? Math.max(0, o.paddingX) : Math.max(8, Math.round(fontSize * 0.18));
|
|
50
|
+
}
|
|
51
|
+
function getTextPaddingY(o, fontSize) {
|
|
52
|
+
return Number.isFinite(o.paddingY) ? Math.max(0, o.paddingY) : Math.max(6, Math.round(fontSize * 0.14));
|
|
53
|
+
}
|
|
54
|
+
function getTextLineHeight(o, fontSize) {
|
|
55
|
+
return (Number.isFinite(o.lineHeight) ? Math.max(0.9, o.lineHeight) : 1.1) * fontSize;
|
|
56
|
+
}
|
|
57
|
+
function getTextAlign(o) {
|
|
58
|
+
return o.textAlign === "center" || o.textAlign === "right" ? o.textAlign : "left";
|
|
59
|
+
}
|
|
60
|
+
function getTextFont(o) {
|
|
61
|
+
const fontSize = getTextFontSize(o);
|
|
62
|
+
const fontStyle = o.fontStyle || "normal";
|
|
63
|
+
const fontWeight = o.fontWeight || "700";
|
|
64
|
+
const fontFamily = o.fontFamily || '-apple-system, "PingFang SC", "Microsoft YaHei", sans-serif';
|
|
65
|
+
return `${fontStyle} ${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
66
|
+
}
|
|
67
|
+
function applyTextTransform(text, textTransform) {
|
|
68
|
+
const value = text == null ? "" : String(text);
|
|
69
|
+
switch (textTransform) {
|
|
70
|
+
case "uppercase":
|
|
71
|
+
return value.toUpperCase();
|
|
72
|
+
case "lowercase":
|
|
73
|
+
return value.toLowerCase();
|
|
74
|
+
case "capitalize":
|
|
75
|
+
return value.toLowerCase().replace(/(^|\s)(\S)/g, (match, prefix, char) => `${prefix}${char.toUpperCase()}`);
|
|
76
|
+
default:
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function splitTextLines(text, textTransform) {
|
|
81
|
+
const value = applyTextTransform(text, textTransform);
|
|
82
|
+
const lines = value.replace(/\r\n/g, "\n").split("\n");
|
|
83
|
+
return lines.length ? lines : [""];
|
|
84
|
+
}
|
|
85
|
+
function isFiniteOverlayTime(value) {
|
|
86
|
+
return Number.isFinite(value) && value >= 0;
|
|
87
|
+
}
|
|
88
|
+
function overlayWindow(o) {
|
|
89
|
+
if (!isRenderableExportOverlay(o)) return null;
|
|
90
|
+
const startAt = isFiniteOverlayTime(o.startAt) ? Number(o.startAt) : null;
|
|
91
|
+
const endAt = isFiniteOverlayTime(o.endAt) ? Number(o.endAt) : null;
|
|
92
|
+
if (startAt == null && endAt == null) return null;
|
|
93
|
+
const start = Math.max(0, startAt ?? 0);
|
|
94
|
+
const end = Math.max(start, endAt ?? start);
|
|
95
|
+
return { start, end };
|
|
96
|
+
}
|
|
97
|
+
function isTimedTextOverlay(o) {
|
|
98
|
+
const window = overlayWindow(o);
|
|
99
|
+
return !!window && window.end > window.start;
|
|
100
|
+
}
|
|
101
|
+
function isRenderableExportOverlay(o) {
|
|
102
|
+
return o?.type === "pen" || o?.type === "line" || o?.type === "arrow" || o?.type === "rect" || o?.type === "ellipse" || o?.type === "text" || o?.type === "sticker";
|
|
103
|
+
}
|
|
104
|
+
function previewOverlayWindow(o) {
|
|
105
|
+
if (!isRenderableExportOverlay(o) && o?.type !== "filter" && o?.type !== "adjust") return null;
|
|
106
|
+
const startAt = isFiniteOverlayTime(o.startAt) ? Number(o.startAt) : null;
|
|
107
|
+
const endAt = isFiniteOverlayTime(o.endAt) ? Number(o.endAt) : null;
|
|
108
|
+
if (startAt == null && endAt == null) return null;
|
|
109
|
+
const start = Math.max(0, startAt ?? 0);
|
|
110
|
+
const end = Math.max(start, endAt ?? start);
|
|
111
|
+
return { start, end };
|
|
112
|
+
}
|
|
113
|
+
function isOverlayVisibleAtTime(o, time) {
|
|
114
|
+
const window = previewOverlayWindow(o);
|
|
115
|
+
if (!window) return true;
|
|
116
|
+
if (!Number.isFinite(time)) return false;
|
|
117
|
+
return time >= window.start && time <= window.end;
|
|
118
|
+
}
|
|
119
|
+
function visibleOverlaysAtTime(overlays, time) {
|
|
120
|
+
if (!overlays?.length) return [];
|
|
121
|
+
if (!Number.isFinite(time)) return overlays;
|
|
122
|
+
return overlays.filter((overlay) => isOverlayVisibleAtTime(overlay, time));
|
|
123
|
+
}
|
|
124
|
+
function isTimelinePreviewOverlay(o) {
|
|
125
|
+
return o?.type === "text" || o?.type === "sticker" || o?.type === "filter" || o?.type === "adjust";
|
|
126
|
+
}
|
|
127
|
+
function getTimelinePreviewTrack(o) {
|
|
128
|
+
return Number.isFinite(o?.timelineTrack) ? Math.max(0, Math.round(Number(o.timelineTrack))) : 0;
|
|
129
|
+
}
|
|
130
|
+
function getTimelinePreviewStartAt(o) {
|
|
131
|
+
return isFiniteOverlayTime(o?.startAt) ? Number(o.startAt) : 0;
|
|
132
|
+
}
|
|
133
|
+
function measureTextOverlay(o) {
|
|
134
|
+
const fontSize = getTextFontSize(o);
|
|
135
|
+
const paddingX = getTextPaddingX(o, fontSize);
|
|
136
|
+
const paddingY = getTextPaddingY(o, fontSize);
|
|
137
|
+
const lineHeight = getTextLineHeight(o, fontSize);
|
|
138
|
+
const lines = splitTextLines(o.text, o.textTransform);
|
|
139
|
+
const ctx = getTextMeasureContext();
|
|
140
|
+
const font = getTextFont(o);
|
|
141
|
+
if (ctx) ctx.font = font;
|
|
142
|
+
const widths = lines.map((line) => {
|
|
143
|
+
const sample = line === "" ? " " : line;
|
|
144
|
+
return ctx ? ctx.measureText(sample).width : Math.max(1, sample.length) * fontSize * 0.6;
|
|
145
|
+
});
|
|
146
|
+
const contentWidth = widths.length ? Math.max(...widths) : fontSize * 0.6;
|
|
147
|
+
const contentHeight = Math.max(fontSize, lines.length * lineHeight);
|
|
148
|
+
const boxWidth = Math.max(Number.isFinite(o.width) ? o.width : 0, contentWidth + paddingX * 2);
|
|
149
|
+
const boxHeight = contentHeight + paddingY * 2;
|
|
150
|
+
return {
|
|
151
|
+
font,
|
|
152
|
+
fontSize,
|
|
153
|
+
paddingX,
|
|
154
|
+
paddingY,
|
|
155
|
+
lineHeight,
|
|
156
|
+
lines,
|
|
157
|
+
widths,
|
|
158
|
+
boxWidth,
|
|
159
|
+
boxHeight,
|
|
160
|
+
align: getTextAlign(o)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function resolveTextLineX(o, layout, lineWidth) {
|
|
164
|
+
if (layout.align === "center") return o.x + layout.boxWidth / 2 - lineWidth / 2;
|
|
165
|
+
if (layout.align === "right") return o.x + layout.boxWidth - layout.paddingX - lineWidth;
|
|
166
|
+
return o.x + layout.paddingX;
|
|
167
|
+
}
|
|
168
|
+
function drawTextDecorations(ctx, o, layout, x, y, width) {
|
|
169
|
+
if (!o.textDecoration || width <= 0) return;
|
|
170
|
+
const fontSize = layout.fontSize;
|
|
171
|
+
const hasUnderline = String(o.textDecoration).includes("underline");
|
|
172
|
+
const hasLineThrough = String(o.textDecoration).includes("line-through");
|
|
173
|
+
if (!hasUnderline && !hasLineThrough) return;
|
|
174
|
+
ctx.save();
|
|
175
|
+
ctx.strokeStyle = o.color || "#fff";
|
|
176
|
+
ctx.lineWidth = Math.max(1, fontSize / 18);
|
|
177
|
+
if (hasUnderline) {
|
|
178
|
+
const lineY = y + fontSize + Math.max(1, fontSize * 0.08);
|
|
179
|
+
ctx.beginPath();
|
|
180
|
+
ctx.moveTo(x, lineY);
|
|
181
|
+
ctx.lineTo(x + width, lineY);
|
|
182
|
+
ctx.stroke();
|
|
183
|
+
}
|
|
184
|
+
if (hasLineThrough) {
|
|
185
|
+
const lineY = y + fontSize * 0.56;
|
|
186
|
+
ctx.beginPath();
|
|
187
|
+
ctx.moveTo(x, lineY);
|
|
188
|
+
ctx.lineTo(x + width, lineY);
|
|
189
|
+
ctx.stroke();
|
|
190
|
+
}
|
|
191
|
+
ctx.restore();
|
|
192
|
+
}
|
|
193
|
+
function getOverlayRotation(o) {
|
|
194
|
+
return normalizeOverlayRotation(o.rotation ?? 0);
|
|
195
|
+
}
|
|
196
|
+
function overlayBBox(o) {
|
|
197
|
+
switch (o.type) {
|
|
198
|
+
case "pen": {
|
|
199
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
200
|
+
for (let i = 0; i < o.points.length; i += 2) {
|
|
201
|
+
minX = Math.min(minX, o.points[i]);
|
|
202
|
+
maxX = Math.max(maxX, o.points[i]);
|
|
203
|
+
minY = Math.min(minY, o.points[i + 1]);
|
|
204
|
+
maxY = Math.max(maxY, o.points[i + 1]);
|
|
205
|
+
}
|
|
206
|
+
return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
|
|
207
|
+
}
|
|
208
|
+
case "line":
|
|
209
|
+
case "arrow":
|
|
210
|
+
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) };
|
|
211
|
+
case "rect":
|
|
212
|
+
case "ellipse":
|
|
213
|
+
case "sticker":
|
|
214
|
+
return { x: o.x, y: o.y, w: o.w, h: o.h };
|
|
215
|
+
case "text": {
|
|
216
|
+
const layout = measureTextOverlay(o);
|
|
217
|
+
return { x: o.x, y: o.y, w: layout.boxWidth, h: layout.boxHeight };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function overlayCenter(o) {
|
|
222
|
+
const b = overlayBBox(o);
|
|
223
|
+
return { x: b.x + b.w / 2, y: b.y + b.h / 2 };
|
|
224
|
+
}
|
|
225
|
+
function rotatePoint(x, y, cx, cy, deg) {
|
|
226
|
+
const rad = deg * DEG2RAD2;
|
|
227
|
+
const cos = Math.cos(rad);
|
|
228
|
+
const sin = Math.sin(rad);
|
|
229
|
+
const dx = x - cx;
|
|
230
|
+
const dy = y - cy;
|
|
231
|
+
return { x: cx + dx * cos - dy * sin, y: cy + dx * sin + dy * cos };
|
|
232
|
+
}
|
|
233
|
+
function scalePoint(x, y, cx, cy, ratio) {
|
|
234
|
+
return { x: cx + (x - cx) * ratio, y: cy + (y - cy) * ratio };
|
|
235
|
+
}
|
|
236
|
+
function drawOverlay(ctx, o, imageCache) {
|
|
237
|
+
const rotation = getOverlayRotation(o);
|
|
238
|
+
if (rotation) {
|
|
239
|
+
const c = overlayCenter(o);
|
|
240
|
+
ctx.save();
|
|
241
|
+
ctx.translate(c.x, c.y);
|
|
242
|
+
ctx.rotate(rotation * DEG2RAD2);
|
|
243
|
+
ctx.translate(-c.x, -c.y);
|
|
244
|
+
drawOverlayBase(ctx, o, imageCache);
|
|
245
|
+
ctx.restore();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
drawOverlayBase(ctx, o, imageCache);
|
|
249
|
+
}
|
|
250
|
+
function drawOverlayBase(ctx, o, imageCache) {
|
|
251
|
+
switch (o.type) {
|
|
252
|
+
case "pen": {
|
|
253
|
+
strokeStyle(ctx, o.color, o.width);
|
|
254
|
+
ctx.beginPath();
|
|
255
|
+
ctx.moveTo(o.points[0], o.points[1]);
|
|
256
|
+
for (let i = 2; i < o.points.length; i += 2) ctx.lineTo(o.points[i], o.points[i + 1]);
|
|
257
|
+
ctx.stroke();
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case "line":
|
|
261
|
+
case "arrow": {
|
|
262
|
+
strokeStyle(ctx, o.color, o.width);
|
|
263
|
+
ctx.beginPath();
|
|
264
|
+
ctx.moveTo(o.x1, o.y1);
|
|
265
|
+
ctx.lineTo(o.x2, o.y2);
|
|
266
|
+
ctx.stroke();
|
|
267
|
+
if (o.type === "arrow") drawArrowHead(ctx, o.x1, o.y1, o.x2, o.y2, o.width);
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case "rect": {
|
|
271
|
+
strokeStyle(ctx, o.color, o.width);
|
|
272
|
+
ctx.strokeRect(o.x, o.y, o.w, o.h);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case "ellipse": {
|
|
276
|
+
strokeStyle(ctx, o.color, o.width);
|
|
277
|
+
ctx.beginPath();
|
|
278
|
+
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);
|
|
279
|
+
ctx.stroke();
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case "text": {
|
|
283
|
+
const layout = measureTextOverlay(o);
|
|
284
|
+
const opacity = Number.isFinite(o.opacity) ? Math.min(1, Math.max(0, o.opacity / 100)) : 1;
|
|
285
|
+
const borderWidth = Number.isFinite(o.borderWidth) ? Math.max(0, o.borderWidth) : 0;
|
|
286
|
+
const autoOutline = o.autoOutline !== false;
|
|
287
|
+
ctx.save();
|
|
288
|
+
ctx.globalAlpha *= opacity;
|
|
289
|
+
if (o.backgroundColor && o.backgroundColor !== "transparent") {
|
|
290
|
+
ctx.fillStyle = o.backgroundColor;
|
|
291
|
+
ctx.fillRect(o.x, o.y, layout.boxWidth, layout.boxHeight);
|
|
292
|
+
}
|
|
293
|
+
ctx.fillStyle = o.color || "#fff";
|
|
294
|
+
ctx.font = layout.font;
|
|
295
|
+
ctx.textBaseline = "top";
|
|
296
|
+
ctx.lineJoin = "round";
|
|
297
|
+
const shadow = o.boxShadow;
|
|
298
|
+
if (shadow) {
|
|
299
|
+
ctx.shadowColor = shadow.color || "transparent";
|
|
300
|
+
ctx.shadowOffsetX = shadow.x || 0;
|
|
301
|
+
ctx.shadowOffsetY = shadow.y || 0;
|
|
302
|
+
ctx.shadowBlur = shadow.blur || 0;
|
|
303
|
+
}
|
|
304
|
+
layout.lines.forEach((line, index) => {
|
|
305
|
+
const lineWidth = layout.widths[index] ?? 0;
|
|
306
|
+
const lineX = resolveTextLineX(o, layout, lineWidth);
|
|
307
|
+
const lineY = o.y + layout.paddingY + index * layout.lineHeight;
|
|
308
|
+
if (borderWidth > 0 || autoOutline) {
|
|
309
|
+
ctx.strokeStyle = borderWidth > 0 ? o.borderColor || "#000" : o.strokeColor || "rgba(0,0,0,0.45)";
|
|
310
|
+
ctx.lineWidth = borderWidth > 0 ? borderWidth : Math.max(1, layout.fontSize / 18);
|
|
311
|
+
ctx.strokeText(line, lineX, lineY);
|
|
312
|
+
}
|
|
313
|
+
ctx.fillText(line, lineX, lineY);
|
|
314
|
+
drawTextDecorations(ctx, o, layout, lineX, lineY, lineWidth);
|
|
315
|
+
});
|
|
316
|
+
ctx.restore();
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
case "sticker": {
|
|
320
|
+
if (o.emoji) {
|
|
321
|
+
const box = emojiStickerDrawBox(o);
|
|
322
|
+
ctx.save();
|
|
323
|
+
ctx.font = `${box.size}px -apple-system, "Apple Color Emoji", "Segoe UI Emoji", sans-serif`;
|
|
324
|
+
ctx.textAlign = "center";
|
|
325
|
+
ctx.textBaseline = "middle";
|
|
326
|
+
ctx.fillText(o.emoji, box.x + box.size / 2, box.y + box.size / 2);
|
|
327
|
+
ctx.restore();
|
|
328
|
+
} else if (o.src) {
|
|
329
|
+
const img = imageCache?.get(o.src);
|
|
330
|
+
if (img) ctx.drawImage(img, o.x, o.y, o.w, o.h);
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function drawOverlays(ctx, overlays, imageCache) {
|
|
337
|
+
for (const o of overlays) drawOverlay(ctx, o, imageCache);
|
|
338
|
+
}
|
|
339
|
+
async function loadOverlayImages(overlays) {
|
|
340
|
+
const cache = /* @__PURE__ */ new Map();
|
|
341
|
+
const srcs = [...new Set(overlays.filter((o) => o.type === "sticker" && o.src).map((o) => o.src))];
|
|
342
|
+
await Promise.all(
|
|
343
|
+
srcs.map(
|
|
344
|
+
(src) => new Promise((resolve) => {
|
|
345
|
+
const img = new Image();
|
|
346
|
+
img.onload = () => {
|
|
347
|
+
cache.set(src, img);
|
|
348
|
+
resolve();
|
|
349
|
+
};
|
|
350
|
+
img.onerror = () => resolve();
|
|
351
|
+
img.src = src;
|
|
352
|
+
})
|
|
353
|
+
)
|
|
354
|
+
);
|
|
355
|
+
return cache;
|
|
356
|
+
}
|
|
357
|
+
async function renderOverlaysToPng(overlays, width, height) {
|
|
358
|
+
if (!overlays?.length) return null;
|
|
359
|
+
const canvas = document.createElement("canvas");
|
|
360
|
+
canvas.width = width;
|
|
361
|
+
canvas.height = height;
|
|
362
|
+
const ctx = canvas.getContext("2d");
|
|
363
|
+
if (!ctx) return null;
|
|
364
|
+
const cache = await loadOverlayImages(overlays);
|
|
365
|
+
drawOverlays(ctx, overlays, cache);
|
|
366
|
+
return new Promise((resolve) => canvas.toBlob((b) => resolve(b), "image/png"));
|
|
367
|
+
}
|
|
368
|
+
function hitTestOverlay(overlays, x, y, tolerance = 12) {
|
|
369
|
+
for (let i = overlays.length - 1; i >= 0; i--) {
|
|
370
|
+
const o = overlays[i];
|
|
371
|
+
if (hitOne(o, x, y, tolerance)) return i;
|
|
372
|
+
}
|
|
373
|
+
return -1;
|
|
374
|
+
}
|
|
375
|
+
function near(px, py, x, y, tol) {
|
|
376
|
+
return Math.abs(px - x) <= tol && Math.abs(py - y) <= tol;
|
|
377
|
+
}
|
|
378
|
+
function nearSegment(x, y, x1, y1, x2, y2, tol) {
|
|
379
|
+
const dx = x2 - x1;
|
|
380
|
+
const dy = y2 - y1;
|
|
381
|
+
const len2 = dx * dx + dy * dy || 1;
|
|
382
|
+
const t = Math.max(0, Math.min(1, ((x - x1) * dx + (y - y1) * dy) / len2));
|
|
383
|
+
const cx = x1 + t * dx;
|
|
384
|
+
const cy = y1 + t * dy;
|
|
385
|
+
return (x - cx) ** 2 + (y - cy) ** 2 <= tol * tol;
|
|
386
|
+
}
|
|
387
|
+
function hitOne(o, x, y, tol) {
|
|
388
|
+
const rotation = getOverlayRotation(o);
|
|
389
|
+
if (rotation) {
|
|
390
|
+
const c = overlayCenter(o);
|
|
391
|
+
const p = rotatePoint(x, y, c.x, c.y, -rotation);
|
|
392
|
+
return hitOneBase(o, p.x, p.y, tol);
|
|
393
|
+
}
|
|
394
|
+
return hitOneBase(o, x, y, tol);
|
|
395
|
+
}
|
|
396
|
+
function hitOneBase(o, x, y, tol) {
|
|
397
|
+
switch (o.type) {
|
|
398
|
+
case "pen": {
|
|
399
|
+
for (let i = 0; i + 3 < o.points.length; i += 2) {
|
|
400
|
+
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;
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
case "line":
|
|
405
|
+
case "arrow":
|
|
406
|
+
return nearSegment(x, y, o.x1, o.y1, o.x2, o.y2, tol + o.width / 2);
|
|
407
|
+
case "rect":
|
|
408
|
+
case "ellipse":
|
|
409
|
+
return x >= o.x - tol && x <= o.x + o.w + tol && y >= o.y - tol && y <= o.y + o.h + tol;
|
|
410
|
+
case "text": {
|
|
411
|
+
const layout = measureTextOverlay(o);
|
|
412
|
+
return x >= o.x - tol && x <= o.x + layout.boxWidth + tol && y >= o.y - tol && y <= o.y + layout.boxHeight + tol;
|
|
413
|
+
}
|
|
414
|
+
case "sticker":
|
|
415
|
+
return near(x, y, o.x + o.w / 2, o.y + o.h / 2, Math.max(o.w, o.h) / 2 + tol);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function fitStickerBox(natW, natH, boxSide) {
|
|
419
|
+
const side = Math.max(8, boxSide);
|
|
420
|
+
if (!(natW > 0) || !(natH > 0)) return { w: side, h: side };
|
|
421
|
+
const k = side / Math.max(natW, natH);
|
|
422
|
+
return { w: Math.max(8, Math.round(natW * k)), h: Math.max(8, Math.round(natH * k)) };
|
|
423
|
+
}
|
|
424
|
+
function scaleOverlay(o, ratio) {
|
|
425
|
+
const r = Math.max(0.05, ratio);
|
|
426
|
+
const c = overlayCenter(o);
|
|
427
|
+
switch (o.type) {
|
|
428
|
+
case "pen":
|
|
429
|
+
return { ...o, points: o.points.map((v, i) => i % 2 === 0 ? c.x + (v - c.x) * r : c.y + (v - c.y) * r) };
|
|
430
|
+
case "line":
|
|
431
|
+
case "arrow": {
|
|
432
|
+
const p1 = scalePoint(o.x1, o.y1, c.x, c.y, r);
|
|
433
|
+
const p2 = scalePoint(o.x2, o.y2, c.x, c.y, r);
|
|
434
|
+
return { ...o, x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
|
|
435
|
+
}
|
|
436
|
+
case "rect":
|
|
437
|
+
case "ellipse":
|
|
438
|
+
case "sticker":
|
|
439
|
+
return { ...o, w: Math.max(8, o.w * r), h: Math.max(8, o.h * r) };
|
|
440
|
+
case "text":
|
|
441
|
+
return {
|
|
442
|
+
...o,
|
|
443
|
+
fontSize: Math.min(512, Math.max(8, o.fontSize * r)),
|
|
444
|
+
width: Number.isFinite(o.width) ? Math.max(80, o.width * r) : o.width,
|
|
445
|
+
paddingX: Number.isFinite(o.paddingX) ? Math.max(0, o.paddingX * r) : o.paddingX,
|
|
446
|
+
paddingY: Number.isFinite(o.paddingY) ? Math.max(0, o.paddingY * r) : o.paddingY,
|
|
447
|
+
borderWidth: Number.isFinite(o.borderWidth) ? Math.max(0, o.borderWidth * r) : o.borderWidth,
|
|
448
|
+
boxShadow: o.boxShadow ? {
|
|
449
|
+
...o.boxShadow,
|
|
450
|
+
x: (o.boxShadow.x || 0) * r,
|
|
451
|
+
y: (o.boxShadow.y || 0) * r,
|
|
452
|
+
blur: (o.boxShadow.blur || 0) * r
|
|
453
|
+
} : o.boxShadow
|
|
454
|
+
};
|
|
455
|
+
default:
|
|
456
|
+
return o;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function rotateOverlay(o, deg) {
|
|
460
|
+
return { ...o, rotation: normalizeOverlayRotation(deg) };
|
|
461
|
+
}
|
|
462
|
+
function translateOverlay(o, dx, dy) {
|
|
463
|
+
switch (o.type) {
|
|
464
|
+
case "pen": {
|
|
465
|
+
const points = o.points.map((v, i) => i % 2 === 0 ? v + dx : v + dy);
|
|
466
|
+
return { ...o, points };
|
|
467
|
+
}
|
|
468
|
+
case "line":
|
|
469
|
+
case "arrow":
|
|
470
|
+
return { ...o, x1: o.x1 + dx, y1: o.y1 + dy, x2: o.x2 + dx, y2: o.y2 + dy };
|
|
471
|
+
case "rect":
|
|
472
|
+
case "ellipse":
|
|
473
|
+
case "sticker":
|
|
474
|
+
return { ...o, x: o.x + dx, y: o.y + dy };
|
|
475
|
+
case "text":
|
|
476
|
+
return { ...o, x: o.x + dx, y: o.y + dy };
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// src/export-form.ts
|
|
481
|
+
function evenizeExportDimension(value, fallback) {
|
|
482
|
+
const normalized = Math.min(8192, Math.max(2, Math.round(Number(value) || fallback)));
|
|
483
|
+
return normalized % 2 === 0 ? normalized : normalized - 1;
|
|
484
|
+
}
|
|
485
|
+
function getExportOutputSize(state) {
|
|
486
|
+
const base = outputSize(state.canvas, state);
|
|
487
|
+
const settings = state?.exportSettings ?? null;
|
|
488
|
+
if (!settings) return base;
|
|
489
|
+
const hasWidth = Number.isFinite(Number(settings.width)) && Number(settings.width) > 0;
|
|
490
|
+
const hasHeight = Number.isFinite(Number(settings.height)) && Number(settings.height) > 0;
|
|
491
|
+
if (!hasWidth && !hasHeight) return base;
|
|
492
|
+
const aspect = base.w > 0 && base.h > 0 ? base.w / base.h : 1;
|
|
493
|
+
if (hasWidth && hasHeight) {
|
|
494
|
+
return {
|
|
495
|
+
w: evenizeExportDimension(settings.width, base.w),
|
|
496
|
+
h: evenizeExportDimension(settings.height, base.h)
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
if (hasWidth) {
|
|
500
|
+
const width = evenizeExportDimension(settings.width, base.w);
|
|
501
|
+
return {
|
|
502
|
+
w: width,
|
|
503
|
+
h: evenizeExportDimension(width / aspect, base.h)
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
const height = evenizeExportDimension(settings.height, base.h);
|
|
507
|
+
return {
|
|
508
|
+
w: evenizeExportDimension(height * aspect, base.w),
|
|
509
|
+
h: height
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
async function buildVideoExportFormData(engine, videoFiles, audioFiles = []) {
|
|
513
|
+
const plan = engine.getExportPlan();
|
|
514
|
+
const fd = new FormData();
|
|
515
|
+
plan.videoSrcOrder.forEach((srcIdx, slot) => {
|
|
516
|
+
const f = videoFiles[srcIdx];
|
|
517
|
+
if (f) fd.append(`video_${slot}`, f, f.name || `video_${slot}.mp4`);
|
|
518
|
+
});
|
|
519
|
+
plan.audioSrcOrder.forEach((srcIdx, slot) => {
|
|
520
|
+
const f = audioFiles[srcIdx];
|
|
521
|
+
if (f) fd.append(`audio_${slot}`, f, f.name || `audio_${slot}`);
|
|
522
|
+
});
|
|
523
|
+
const out = outputSize(plan.state.canvas, plan.state);
|
|
524
|
+
const overlays = plan.state.overlays ?? [];
|
|
525
|
+
const timedTextOverlays = overlays.filter((overlay) => isTimedTextOverlay(overlay));
|
|
526
|
+
const staticOverlays = overlays.filter((overlay) => !isTimedTextOverlay(overlay) && isRenderableExportOverlay(overlay));
|
|
527
|
+
const overlay = await renderOverlaysToPng(staticOverlays, out.w, out.h);
|
|
528
|
+
if (overlay) fd.append("overlay", overlay, "overlay.png");
|
|
529
|
+
for (let index = 0; index < timedTextOverlays.length; index++) {
|
|
530
|
+
const image = await renderOverlaysToPng([timedTextOverlays[index]], out.w, out.h);
|
|
531
|
+
if (image) fd.append(`textOverlay_${index}`, image, `text-overlay-${index}.png`);
|
|
532
|
+
}
|
|
533
|
+
fd.append("editState", JSON.stringify(plan.state));
|
|
534
|
+
return fd;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function clampColorAdjustment(value) {
|
|
538
|
+
return Math.max(-1, Math.min(1, Number(value) || 0));
|
|
539
|
+
}
|
|
540
|
+
function clampEffectIntensity(value) {
|
|
541
|
+
return Math.max(0, Math.min(1, Number(value) || 0));
|
|
542
|
+
}
|
|
543
|
+
function clampColorChannel(value) {
|
|
544
|
+
return Math.max(0, Math.min(1, value));
|
|
545
|
+
}
|
|
546
|
+
function clampColorByte(value) {
|
|
547
|
+
return Math.max(0, Math.min(255, value));
|
|
548
|
+
}
|
|
549
|
+
function smoothstep(edge0, edge1, value) {
|
|
550
|
+
if (edge0 === edge1) return value < edge0 ? 0 : 1;
|
|
551
|
+
const t = Math.max(0, Math.min(1, (value - edge0) / (edge1 - edge0)));
|
|
552
|
+
return t * t * (3 - 2 * t);
|
|
553
|
+
}
|
|
554
|
+
function midtoneWeight(value) {
|
|
555
|
+
const rise = smoothstep(0.08, 0.4, value);
|
|
556
|
+
const fall = 1 - smoothstep(0.6, 0.92, value);
|
|
557
|
+
return clampColorChannel(rise * fall * 2.2);
|
|
558
|
+
}
|
|
559
|
+
function randomGrain(x, y, seed = 0) {
|
|
560
|
+
const value = Math.sin(x * 12.9898 + y * 78.233 + seed * 37.719) * 43758.5453;
|
|
561
|
+
return value - Math.floor(value);
|
|
562
|
+
}
|
|
563
|
+
var effectBufferCanvas = null;
|
|
564
|
+
function getEffectBufferCanvas(width, height) {
|
|
565
|
+
if (typeof document === "undefined") return null;
|
|
566
|
+
effectBufferCanvas ?? (effectBufferCanvas = document.createElement("canvas"));
|
|
567
|
+
if (effectBufferCanvas.width !== width) effectBufferCanvas.width = width;
|
|
568
|
+
if (effectBufferCanvas.height !== height) effectBufferCanvas.height = height;
|
|
569
|
+
return effectBufferCanvas;
|
|
570
|
+
}
|
|
571
|
+
function applyCanvasCssFilter(ctx, width, height, cssFilter) {
|
|
572
|
+
if (!cssFilter || cssFilter === "none") return;
|
|
573
|
+
const buffer = getEffectBufferCanvas(width, height);
|
|
574
|
+
const bufferCtx = buffer?.getContext("2d");
|
|
575
|
+
if (!buffer || !bufferCtx) return;
|
|
576
|
+
bufferCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
577
|
+
bufferCtx.clearRect(0, 0, width, height);
|
|
578
|
+
bufferCtx.drawImage(ctx.canvas, 0, 0, width, height);
|
|
579
|
+
ctx.save();
|
|
580
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
581
|
+
ctx.clearRect(0, 0, width, height);
|
|
582
|
+
ctx.filter = cssFilter;
|
|
583
|
+
ctx.drawImage(buffer, 0, 0, width, height);
|
|
584
|
+
ctx.restore();
|
|
585
|
+
ctx.filter = "none";
|
|
586
|
+
}
|
|
587
|
+
function applyTimelinePreviewFilter(ctx, width, height, overlay) {
|
|
588
|
+
const presetCss = findFilterPreset(overlay?.filterPreset)?.css ?? "";
|
|
589
|
+
applyCanvasCssFilter(ctx, width, height, presetCss);
|
|
590
|
+
}
|
|
591
|
+
function applyTimelinePreviewAdjust(ctx, width, height, overlay) {
|
|
592
|
+
applyCanvasCssFilter(ctx, width, height, buildFilterCss(overlay ?? {}, ""));
|
|
593
|
+
applyAdvancedColorAdjustments(ctx, width, height, overlay ?? {});
|
|
594
|
+
}
|
|
595
|
+
function hasAdvancedColorAdjustments(filters = {}) {
|
|
596
|
+
const signedKeys = ["temperature", "tint", "vibrance", "gamma", "highlights", "shadows", "whites", "blacks", "lightSense"];
|
|
597
|
+
if (signedKeys.some((key) => Math.abs(clampColorAdjustment(filters[key])) > 1e-4)) return true;
|
|
598
|
+
return ["sharpen", "clarity", "grain", "fade", "vignette"].some((key) => clampEffectIntensity(filters[key]) > 1e-4);
|
|
599
|
+
}
|
|
600
|
+
function applyAdvancedColorAdjustments(ctx, width, height, filters = {}) {
|
|
601
|
+
if (!hasAdvancedColorAdjustments(filters)) return;
|
|
602
|
+
let imageData;
|
|
603
|
+
try {
|
|
604
|
+
imageData = ctx.getImageData(0, 0, width, height);
|
|
605
|
+
} catch {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const temperature = clampColorAdjustment(filters.temperature);
|
|
609
|
+
const tint = clampColorAdjustment(filters.tint);
|
|
610
|
+
const vibrance = clampColorAdjustment(filters.vibrance);
|
|
611
|
+
const gamma = clampColorAdjustment(filters.gamma);
|
|
612
|
+
const highlights = clampColorAdjustment(filters.highlights);
|
|
613
|
+
const shadows = clampColorAdjustment(filters.shadows);
|
|
614
|
+
const whites = clampColorAdjustment(filters.whites);
|
|
615
|
+
const blacks = clampColorAdjustment(filters.blacks);
|
|
616
|
+
const lightSense = clampColorAdjustment(filters.lightSense);
|
|
617
|
+
const sharpen = clampEffectIntensity(filters.sharpen);
|
|
618
|
+
const clarity = clampEffectIntensity(filters.clarity);
|
|
619
|
+
const grain = clampEffectIntensity(filters.grain);
|
|
620
|
+
const fade = clampEffectIntensity(filters.fade);
|
|
621
|
+
const vignette = clampEffectIntensity(filters.vignette);
|
|
622
|
+
const gammaFactor = 1 + gamma * (gamma > 0 ? 1 : 0.5);
|
|
623
|
+
const gammaExponent = gamma === 0 ? 1 : 1 / Math.max(0.01, gammaFactor);
|
|
624
|
+
const tempRed = temperature * 0.18;
|
|
625
|
+
const tempGreen = temperature * 0.02;
|
|
626
|
+
const tempBlue = -temperature * 0.18;
|
|
627
|
+
const tintRedBlue = tint * 0.1;
|
|
628
|
+
const tintGreen = -tint * 0.12;
|
|
629
|
+
const data = imageData.data;
|
|
630
|
+
for (let index = 0; index < data.length; index += 4) {
|
|
631
|
+
let r = data[index] / 255;
|
|
632
|
+
let g = data[index + 1] / 255;
|
|
633
|
+
let b = data[index + 2] / 255;
|
|
634
|
+
if (temperature !== 0 || tint !== 0) {
|
|
635
|
+
r = clampColorChannel(r + tempRed + tintRedBlue);
|
|
636
|
+
g = clampColorChannel(g + tempGreen + tintGreen);
|
|
637
|
+
b = clampColorChannel(b + tempBlue + tintRedBlue);
|
|
638
|
+
}
|
|
639
|
+
if (vibrance !== 0) {
|
|
640
|
+
const max = Math.max(r, g, b);
|
|
641
|
+
const min = Math.min(r, g, b);
|
|
642
|
+
const saturation = max - min;
|
|
643
|
+
const average = (r + g + b) / 3;
|
|
644
|
+
const boost = vibrance > 0 ? vibrance * (1 - saturation) : vibrance * (0.35 + saturation * 0.65);
|
|
645
|
+
r = clampColorChannel(average + (r - average) * (1 + boost));
|
|
646
|
+
g = clampColorChannel(average + (g - average) * (1 + boost));
|
|
647
|
+
b = clampColorChannel(average + (b - average) * (1 + boost));
|
|
648
|
+
}
|
|
649
|
+
if (gamma !== 0) {
|
|
650
|
+
r = clampColorChannel(Math.pow(r, gammaExponent));
|
|
651
|
+
g = clampColorChannel(Math.pow(g, gammaExponent));
|
|
652
|
+
b = clampColorChannel(Math.pow(b, gammaExponent));
|
|
653
|
+
}
|
|
654
|
+
if (highlights !== 0 || shadows !== 0 || whites !== 0 || blacks !== 0 || lightSense !== 0 || fade !== 0) {
|
|
655
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
656
|
+
const shadowWeight = 1 - smoothstep(0.18, 0.62, luminance);
|
|
657
|
+
const blackWeight = 1 - smoothstep(0.04, 0.32, luminance);
|
|
658
|
+
const highlightWeight = smoothstep(0.38, 0.84, luminance);
|
|
659
|
+
const whiteWeight = smoothstep(0.7, 0.98, luminance);
|
|
660
|
+
const midWeight = midtoneWeight(luminance);
|
|
661
|
+
const luminanceDelta = shadows * shadowWeight * 0.28 + highlights * highlightWeight * 0.24 + blacks * blackWeight * 0.2 + whites * whiteWeight * 0.2 + lightSense * midWeight * 0.18 + fade * (0.12 + shadowWeight * 0.06);
|
|
662
|
+
r = clampColorChannel(r + luminanceDelta);
|
|
663
|
+
g = clampColorChannel(g + luminanceDelta);
|
|
664
|
+
b = clampColorChannel(b + luminanceDelta);
|
|
665
|
+
if (fade > 0) {
|
|
666
|
+
const average = (r + g + b) / 3;
|
|
667
|
+
const fadeMix = fade * 0.16;
|
|
668
|
+
r = clampColorChannel(r * (1 - fadeMix) + average * fadeMix);
|
|
669
|
+
g = clampColorChannel(g * (1 - fadeMix) + average * fadeMix);
|
|
670
|
+
b = clampColorChannel(b * (1 - fadeMix) + average * fadeMix);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
data[index] = Math.round(r * 255);
|
|
674
|
+
data[index + 1] = Math.round(g * 255);
|
|
675
|
+
data[index + 2] = Math.round(b * 255);
|
|
676
|
+
}
|
|
677
|
+
if (sharpen > 1e-4 || clarity > 1e-4) {
|
|
678
|
+
const base = new Uint8ClampedArray(data);
|
|
679
|
+
const rowStride = width * 4;
|
|
680
|
+
for (let y = 1; y < height - 1; y++) {
|
|
681
|
+
for (let x = 1; x < width - 1; x++) {
|
|
682
|
+
const index = y * rowStride + x * 4;
|
|
683
|
+
const blurR = (base[index - 4] + base[index + 4] + base[index - rowStride] + base[index + rowStride] + base[index] * 4) / 8;
|
|
684
|
+
const blurG = (base[index - 3] + base[index + 5] + base[index - rowStride + 1] + base[index + rowStride + 1] + base[index + 1] * 4) / 8;
|
|
685
|
+
const blurB = (base[index - 2] + base[index + 6] + base[index - rowStride + 2] + base[index + rowStride + 2] + base[index + 2] * 4) / 8;
|
|
686
|
+
const luminance = (0.2126 * base[index] + 0.7152 * base[index + 1] + 0.0722 * base[index + 2]) / 255;
|
|
687
|
+
const amount = Math.min(1.8, sharpen * 1.45 + clarity * 0.9 * midtoneWeight(luminance));
|
|
688
|
+
data[index] = clampColorByte(base[index] + (base[index] - blurR) * amount);
|
|
689
|
+
data[index + 1] = clampColorByte(base[index + 1] + (base[index + 1] - blurG) * amount);
|
|
690
|
+
data[index + 2] = clampColorByte(base[index + 2] + (base[index + 2] - blurB) * amount);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (grain > 1e-4) {
|
|
695
|
+
const grainAmount = grain * 26;
|
|
696
|
+
for (let y = 0; y < height; y++) {
|
|
697
|
+
for (let x = 0; x < width; x++) {
|
|
698
|
+
const index = (y * width + x) * 4;
|
|
699
|
+
const luminance = (0.2126 * data[index] + 0.7152 * data[index + 1] + 0.0722 * data[index + 2]) / 255;
|
|
700
|
+
const weight = 0.4 + midtoneWeight(luminance) * 0.9;
|
|
701
|
+
const mono = (randomGrain(x, y) - 0.5) * grainAmount * weight;
|
|
702
|
+
const chroma = (randomGrain(x, y, 1) - 0.5) * grainAmount * 0.22 * grain;
|
|
703
|
+
data[index] = clampColorByte(data[index] + mono + chroma);
|
|
704
|
+
data[index + 1] = clampColorByte(data[index + 1] + mono * 0.88);
|
|
705
|
+
data[index + 2] = clampColorByte(data[index + 2] + mono - chroma);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
if (vignette > 1e-4) {
|
|
710
|
+
const centerX = (width - 1) / 2;
|
|
711
|
+
const centerY = (height - 1) / 2;
|
|
712
|
+
const maxDistance = Math.sqrt(centerX * centerX + centerY * centerY) || 1;
|
|
713
|
+
for (let y = 0; y < height; y++) {
|
|
714
|
+
for (let x = 0; x < width; x++) {
|
|
715
|
+
const index = (y * width + x) * 4;
|
|
716
|
+
const dx = x - centerX;
|
|
717
|
+
const dy = y - centerY;
|
|
718
|
+
const distance = Math.sqrt(dx * dx + dy * dy) / maxDistance;
|
|
719
|
+
const edgeStrength = smoothstep(0.32, 1, distance) * vignette * 0.62;
|
|
720
|
+
const multiplier = 1 - edgeStrength;
|
|
721
|
+
data[index] = clampColorByte(data[index] * multiplier);
|
|
722
|
+
data[index + 1] = clampColorByte(data[index + 1] * multiplier);
|
|
723
|
+
data[index + 2] = clampColorByte(data[index + 2] * multiplier);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
ctx.putImageData(imageData, 0, 0);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// src/frame-compositor.ts
|
|
731
|
+
function drawVideoFrame(canvas, source, srcDims, canvasDims, state, k = 1, imageCache, withOverlays = true) {
|
|
732
|
+
const out = outputSize(canvasDims, state);
|
|
733
|
+
canvas.width = Math.max(2, Math.round(out.w * k));
|
|
734
|
+
canvas.height = Math.max(2, Math.round(out.h * k));
|
|
735
|
+
const ctx = canvas.getContext("2d");
|
|
736
|
+
if (!ctx) return;
|
|
737
|
+
const rb = rotatedSize(canvasDims.w, canvasDims.h, state.rotation);
|
|
738
|
+
const crop = state.crop ?? { x: 0, y: 0, width: rb.w, height: rb.h };
|
|
739
|
+
const fit = state.scale?.fit ?? "force";
|
|
740
|
+
const { src, dst } = fitRects({ width: crop.width, height: crop.height }, out, fit);
|
|
741
|
+
if (fit === "contain") {
|
|
742
|
+
ctx.fillStyle = "#000";
|
|
743
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
744
|
+
}
|
|
745
|
+
ctx.filter = buildFilterCss(state.filters, state.filterPreset);
|
|
746
|
+
ctx.save();
|
|
747
|
+
if (fit === "contain") {
|
|
748
|
+
ctx.beginPath();
|
|
749
|
+
ctx.rect(k * dst.x, k * dst.y, k * dst.width, k * dst.height);
|
|
750
|
+
ctx.clip();
|
|
751
|
+
}
|
|
752
|
+
ctx.translate(k * dst.x, k * dst.y);
|
|
753
|
+
ctx.scale(k * dst.width / src.width, k * dst.height / src.height);
|
|
754
|
+
ctx.translate(-(crop.x + src.x), -(crop.y + src.y));
|
|
755
|
+
ctx.translate(rb.w / 2, rb.h / 2);
|
|
756
|
+
ctx.rotate(state.rotation * DEG2RAD);
|
|
757
|
+
ctx.scale(state.flipX ? -1 : 1, state.flipY ? -1 : 1);
|
|
758
|
+
const cov = fitRects({ width: srcDims.w, height: srcDims.h }, { w: canvasDims.w, h: canvasDims.h }, "cover");
|
|
759
|
+
ctx.drawImage(
|
|
760
|
+
source,
|
|
761
|
+
cov.src.x,
|
|
762
|
+
cov.src.y,
|
|
763
|
+
cov.src.width,
|
|
764
|
+
cov.src.height,
|
|
765
|
+
-canvasDims.w / 2,
|
|
766
|
+
-canvasDims.h / 2,
|
|
767
|
+
canvasDims.w,
|
|
768
|
+
canvasDims.h
|
|
769
|
+
);
|
|
770
|
+
ctx.restore();
|
|
771
|
+
ctx.filter = "none";
|
|
772
|
+
applyAdvancedColorAdjustments(ctx, canvas.width, canvas.height, state.filters);
|
|
773
|
+
if (withOverlays && state.overlays?.length) {
|
|
774
|
+
const overlayTime = Number.isFinite(state?.__mePreviewTimelineTime) ? Number(state.__mePreviewTimelineTime) : null;
|
|
775
|
+
const visible = overlayTime == null ? state.overlays : visibleOverlaysAtTime(state.overlays, overlayTime);
|
|
776
|
+
const timelineOverlays = visible.map((overlay, index) => ({ overlay, index })).filter((item) => isTimelinePreviewOverlay(item.overlay)).sort((left, right) => {
|
|
777
|
+
const trackDelta = getTimelinePreviewTrack(right.overlay) - getTimelinePreviewTrack(left.overlay);
|
|
778
|
+
if (trackDelta !== 0) return trackDelta;
|
|
779
|
+
const startDelta = getTimelinePreviewStartAt(left.overlay) - getTimelinePreviewStartAt(right.overlay);
|
|
780
|
+
if (Math.abs(startDelta) > 1e-6) return startDelta;
|
|
781
|
+
return left.index - right.index;
|
|
782
|
+
});
|
|
783
|
+
const floatingOverlays = visible.filter((overlay) => !isTimelinePreviewOverlay(overlay));
|
|
784
|
+
ctx.setTransform(k, 0, 0, k, 0, 0);
|
|
785
|
+
timelineOverlays.forEach((item) => {
|
|
786
|
+
if (item.overlay?.type === "filter") {
|
|
787
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
788
|
+
applyTimelinePreviewFilter(ctx, canvas.width, canvas.height, item.overlay);
|
|
789
|
+
ctx.setTransform(k, 0, 0, k, 0, 0);
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
if (item.overlay?.type === "adjust") {
|
|
793
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
794
|
+
applyTimelinePreviewAdjust(ctx, canvas.width, canvas.height, item.overlay);
|
|
795
|
+
ctx.setTransform(k, 0, 0, k, 0, 0);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
drawOverlay(ctx, item.overlay, imageCache);
|
|
799
|
+
});
|
|
800
|
+
drawOverlays(ctx, floatingOverlays, imageCache);
|
|
801
|
+
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
function seekVideo(el, t) {
|
|
805
|
+
return new Promise((resolve) => {
|
|
806
|
+
const onSeeked = () => {
|
|
807
|
+
el.removeEventListener("seeked", onSeeked);
|
|
808
|
+
resolve();
|
|
809
|
+
};
|
|
810
|
+
el.addEventListener("seeked", onSeeked);
|
|
811
|
+
el.currentTime = Math.min(Math.max(0, t), el.duration || t);
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
async function generateThumbnails(videoEl, count, maxW = 160) {
|
|
815
|
+
const dur = videoEl.duration;
|
|
816
|
+
if (!dur || !isFinite(dur) || count <= 0) return [];
|
|
817
|
+
const natW = videoEl.videoWidth || 16;
|
|
818
|
+
const natH = videoEl.videoHeight || 9;
|
|
819
|
+
const w = Math.min(maxW, natW);
|
|
820
|
+
const h = Math.max(1, Math.round(w * natH / natW));
|
|
821
|
+
const canvas = document.createElement("canvas");
|
|
822
|
+
canvas.width = w;
|
|
823
|
+
canvas.height = h;
|
|
824
|
+
const ctx = canvas.getContext("2d");
|
|
825
|
+
if (!ctx) return [];
|
|
826
|
+
const out = [];
|
|
827
|
+
for (let i = 0; i < count; i++) {
|
|
828
|
+
await seekVideo(videoEl, dur * (i + 0.5) / count);
|
|
829
|
+
ctx.drawImage(videoEl, 0, 0, w, h);
|
|
830
|
+
out.push(canvas.toDataURL("image/jpeg", 0.6));
|
|
831
|
+
}
|
|
832
|
+
return out;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// src/fullscreen.ts
|
|
836
|
+
function createFullscreenToggle(host, options = {}) {
|
|
837
|
+
const mode = options.mode ?? "overlay";
|
|
838
|
+
const btn = document.createElement("button");
|
|
839
|
+
btn.type = "button";
|
|
840
|
+
btn.className = ["me-fullscreen-toggle", options.className].filter(Boolean).join(" ");
|
|
841
|
+
btn.dataset.meFullscreenToggle = "true";
|
|
842
|
+
btn.dataset.mode = mode;
|
|
843
|
+
btn.title = "\u5168\u5C4F / \u9000\u51FA\u5168\u5C4F";
|
|
844
|
+
btn.style.cssText = [
|
|
845
|
+
mode === "overlay" ? "position:absolute;left:8px;bottom:8px;z-index:30;" : "position:static;",
|
|
846
|
+
"width:32px;height:32px;padding:0;",
|
|
847
|
+
"display:inline-flex;align-items:center;justify-content:center;",
|
|
848
|
+
"border:1px solid var(--me-border,#26262b);border-radius:6px;",
|
|
849
|
+
"background:var(--me-chip,#1c1c20);color:var(--me-fg,#e7e7ee);",
|
|
850
|
+
"cursor:pointer;font-size:15px;line-height:1;opacity:0.9;font:inherit;"
|
|
851
|
+
].join("");
|
|
852
|
+
host.classList.add("me-fullscreen-host");
|
|
853
|
+
const sync = () => {
|
|
854
|
+
const isFullscreen = document.fullscreenElement === host;
|
|
855
|
+
btn.textContent = isFullscreen ? "\xD7" : "\u26F6";
|
|
856
|
+
btn.setAttribute("aria-label", isFullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F");
|
|
857
|
+
host.classList.toggle("me-is-fullscreen", isFullscreen);
|
|
858
|
+
host.dataset.meFullscreen = isFullscreen ? "true" : "false";
|
|
859
|
+
};
|
|
860
|
+
sync();
|
|
861
|
+
const onChange = () => sync();
|
|
862
|
+
const onClick = () => {
|
|
863
|
+
const action = document.fullscreenElement === host ? document.exitFullscreen?.() : host.requestFullscreen?.();
|
|
864
|
+
void action?.catch?.(() => {
|
|
865
|
+
});
|
|
866
|
+
};
|
|
867
|
+
btn.addEventListener("click", onClick);
|
|
868
|
+
document.addEventListener("fullscreenchange", onChange);
|
|
869
|
+
return {
|
|
870
|
+
button: btn,
|
|
871
|
+
dispose: () => {
|
|
872
|
+
document.removeEventListener("fullscreenchange", onChange);
|
|
873
|
+
btn.removeEventListener("click", onClick);
|
|
874
|
+
btn.remove();
|
|
875
|
+
host.classList.remove("me-fullscreen-host", "me-is-fullscreen");
|
|
876
|
+
delete host.dataset.meFullscreen;
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export { buildVideoExportFormData, createFullscreenToggle, drawOverlay, drawOverlays, drawVideoFrame, fitStickerBox, generateThumbnails, getOverlayRotation, hitTestOverlay, loadOverlayImages, overlayBBox, renderOverlaysToPng, rotateOverlay, scaleOverlay, translateOverlay };
|
|
882
|
+
//# sourceMappingURL=browser.js.map
|
|
883
|
+
//# sourceMappingURL=browser.js.map
|