@imgly/codesign-mcp 0.7.2 → 0.7.3-next.20261125135902.gfdc6ee3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (539) hide show
  1. package/README.md +35 -17
  2. package/dist/cli/license.js +1 -1
  3. package/dist/runtime/cli/commands.d.ts +2 -0
  4. package/dist/runtime/cli/commands.d.ts.map +1 -1
  5. package/dist/runtime/cli/commands.js +56 -1
  6. package/dist/runtime/cli/commands.js.map +1 -1
  7. package/dist/runtime/cli/main.d.ts.map +1 -1
  8. package/dist/runtime/cli/main.js +5 -0
  9. package/dist/runtime/cli/main.js.map +1 -1
  10. package/dist/runtime/codesign-shim/codesign-router/protocol/types.mjs +1 -0
  11. package/dist/runtime/codesign-shim/codesign-router/release-build.generated.mjs +1 -1
  12. package/dist/server-client-types/protocol/types.d.ts +25 -3
  13. package/dist/server-client.mjs +1 -0
  14. package/dist/server.d.ts +2 -0
  15. package/dist/server.d.ts.map +1 -1
  16. package/dist/server.js +4 -2
  17. package/dist/server.js.map +1 -1
  18. package/node_modules/@imgly/codesign-billing/README.md +138 -0
  19. package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.d.ts +30 -5
  20. package/node_modules/@imgly/codesign-billing/dist/charge.d.ts.map +1 -0
  21. package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.js +16 -1
  22. package/node_modules/@imgly/codesign-billing/dist/charge.js.map +1 -0
  23. package/node_modules/@imgly/codesign-billing/dist/charges.d.ts +71 -0
  24. package/node_modules/@imgly/codesign-billing/dist/charges.d.ts.map +1 -0
  25. package/node_modules/@imgly/codesign-billing/dist/charges.js +198 -0
  26. package/node_modules/@imgly/codesign-billing/dist/charges.js.map +1 -0
  27. package/node_modules/@imgly/codesign-billing/dist/index.d.ts +6 -0
  28. package/node_modules/@imgly/codesign-billing/dist/index.d.ts.map +1 -0
  29. package/node_modules/@imgly/codesign-billing/dist/index.js +6 -0
  30. package/node_modules/@imgly/codesign-billing/dist/index.js.map +1 -0
  31. package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts +55 -0
  32. package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts.map +1 -0
  33. package/node_modules/@imgly/codesign-billing/dist/ledger.js +80 -0
  34. package/node_modules/@imgly/codesign-billing/dist/ledger.js.map +1 -0
  35. package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.d.ts +9 -1
  36. package/node_modules/@imgly/codesign-billing/dist/metering.d.ts.map +1 -0
  37. package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.js +77 -21
  38. package/node_modules/@imgly/codesign-billing/dist/metering.js.map +1 -0
  39. package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts +20 -0
  40. package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts.map +1 -0
  41. package/node_modules/@imgly/codesign-billing/dist/refusal.js +13 -0
  42. package/node_modules/@imgly/codesign-billing/dist/refusal.js.map +1 -0
  43. package/node_modules/@imgly/codesign-billing/package.json +30 -0
  44. package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts +13 -5
  45. package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts.map +1 -1
  46. package/node_modules/@imgly/codesign-router/dist/config/unit-config.js +18 -12
  47. package/node_modules/@imgly/codesign-router/dist/config/unit-config.js.map +1 -1
  48. package/node_modules/@imgly/codesign-router/dist/consent.d.ts +6 -2
  49. package/node_modules/@imgly/codesign-router/dist/consent.d.ts.map +1 -1
  50. package/node_modules/@imgly/codesign-router/dist/consent.js +65 -9
  51. package/node_modules/@imgly/codesign-router/dist/consent.js.map +1 -1
  52. package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts +25 -3
  53. package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts.map +1 -1
  54. package/node_modules/@imgly/codesign-router/dist/protocol/types.js +1 -0
  55. package/node_modules/@imgly/codesign-router/dist/protocol/types.js.map +1 -1
  56. package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts +1 -1
  57. package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts.map +1 -1
  58. package/node_modules/@imgly/codesign-router/dist/release-build.generated.js +1 -1
  59. package/node_modules/@imgly/codesign-router/dist/release-build.generated.js.map +1 -1
  60. package/node_modules/@imgly/codesign-router/dist/router/channels-v2.d.ts.map +1 -1
  61. package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js +14 -4
  62. package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js.map +1 -1
  63. package/node_modules/@imgly/codesign-router/dist/router/main.d.ts.map +1 -1
  64. package/node_modules/@imgly/codesign-router/dist/router/main.js +9 -1
  65. package/node_modules/@imgly/codesign-router/dist/router/main.js.map +1 -1
  66. package/node_modules/@imgly/codesign-sdk/CHANGELOG.md +24 -0
  67. package/node_modules/@imgly/codesign-sdk/README.md +8 -7
  68. package/node_modules/@imgly/codesign-sdk/dist/abort.d.ts +1 -0
  69. package/node_modules/@imgly/codesign-sdk/dist/abort.js +18 -0
  70. package/node_modules/@imgly/codesign-sdk/dist/assets/inline.generated.js +12 -12
  71. package/node_modules/@imgly/codesign-sdk/dist/browser/index.d.ts +1 -1
  72. package/node_modules/@imgly/codesign-sdk/dist/browser/worker.d.ts +1 -1
  73. package/node_modules/@imgly/codesign-sdk/dist/browser/worker.js +15 -8
  74. package/node_modules/@imgly/codesign-sdk/dist/cesdk-utils/index.js +2 -0
  75. package/node_modules/@imgly/codesign-sdk/dist/codesign-error.d.ts +38 -1
  76. package/node_modules/@imgly/codesign-sdk/dist/codesign-error.js +9 -0
  77. package/node_modules/@imgly/codesign-sdk/dist/codesign.d.ts +19 -12
  78. package/node_modules/@imgly/codesign-sdk/dist/codesign.js +268 -43
  79. package/node_modules/@imgly/codesign-sdk/dist/design/animatable.generated.js +3 -0
  80. package/node_modules/@imgly/codesign-sdk/dist/design/capabilities.generated.js +1 -0
  81. package/node_modules/@imgly/codesign-sdk/dist/design/facade.d.ts +1 -1
  82. package/node_modules/@imgly/codesign-sdk/dist/design/facade.js +128 -36
  83. package/node_modules/@imgly/codesign-sdk/dist/design/keyframes.js +2 -1
  84. package/node_modules/@imgly/codesign-sdk/dist/design/lint.d.ts +1 -1
  85. package/node_modules/@imgly/codesign-sdk/dist/design/lint.js +82 -5
  86. package/node_modules/@imgly/codesign-sdk/dist/design/props.generated.js +3 -0
  87. package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.d.ts +10 -0
  88. package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.js +26 -0
  89. package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.d.ts +23 -1
  90. package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.js +194 -3
  91. package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.d.ts +8 -0
  92. package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.js +53 -0
  93. package/node_modules/@imgly/codesign-sdk/dist/design/variables.d.ts +14 -0
  94. package/node_modules/@imgly/codesign-sdk/dist/design/variables.js +250 -37
  95. package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.d.ts +50 -0
  96. package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.js +116 -0
  97. package/node_modules/@imgly/codesign-sdk/dist/designs/types.d.ts +79 -3
  98. package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.d.ts +12 -1
  99. package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.js +20 -4
  100. package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.d.ts +20 -7
  101. package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.js +31 -14
  102. package/node_modules/@imgly/codesign-sdk/dist/engine/headless.d.ts +4 -0
  103. package/node_modules/@imgly/codesign-sdk/dist/engine/headless.js +20 -0
  104. package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.d.ts +1 -14
  105. package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.js +2 -7
  106. package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.d.ts +1 -2
  107. package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.js +120 -91
  108. package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.d.ts +2 -2
  109. package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.js +10 -4
  110. package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.d.ts +1 -1
  111. package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.js +13 -3
  112. package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.d.ts +6 -7
  113. package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.js +14 -7
  114. package/node_modules/@imgly/codesign-sdk/dist/executor/handler.d.ts +47 -2
  115. package/node_modules/@imgly/codesign-sdk/dist/executor/handler.js +519 -8
  116. package/node_modules/@imgly/codesign-sdk/dist/executor/node.d.ts +42 -6
  117. package/node_modules/@imgly/codesign-sdk/dist/executor/node.js +231 -9
  118. package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.d.ts +13 -0
  119. package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.js +28 -0
  120. package/node_modules/@imgly/codesign-sdk/dist/exporters/html.d.ts +18 -2
  121. package/node_modules/@imgly/codesign-sdk/dist/exporters/html.js +129 -15
  122. package/node_modules/@imgly/codesign-sdk/dist/exporters/index.d.ts +5 -2
  123. package/node_modules/@imgly/codesign-sdk/dist/exporters/index.js +2 -2
  124. package/node_modules/@imgly/codesign-sdk/dist/exporters/node.d.ts +1 -1
  125. package/node_modules/@imgly/codesign-sdk/dist/exporters/node.js +4 -3
  126. package/node_modules/@imgly/codesign-sdk/dist/exporters/psd.js +1 -1
  127. package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.d.ts +2 -0
  128. package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.js +1 -1
  129. package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.d.ts +3 -1
  130. package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.js +7 -0
  131. package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.d.ts +1 -1
  132. package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.js +4 -2
  133. package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.d.ts +5 -0
  134. package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.js +31 -0
  135. package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.d.ts +15 -0
  136. package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.js +26 -0
  137. package/node_modules/@imgly/codesign-sdk/dist/formats/mime.d.ts +6 -0
  138. package/node_modules/@imgly/codesign-sdk/dist/formats/mime.js +37 -0
  139. package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.d.ts +7 -0
  140. package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.js +46 -0
  141. package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.d.ts +6 -0
  142. package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.js +20 -0
  143. package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.d.ts +3 -0
  144. package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.js +25 -0
  145. package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.d.ts +2 -0
  146. package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.js +1 -0
  147. package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.d.ts +10 -4
  148. package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.js +205 -79
  149. package/node_modules/@imgly/codesign-sdk/dist/gateway/client.d.ts +23 -2
  150. package/node_modules/@imgly/codesign-sdk/dist/gateway/client.js +40 -41
  151. package/node_modules/@imgly/codesign-sdk/dist/gateway/index.d.ts +3 -0
  152. package/node_modules/@imgly/codesign-sdk/dist/gateway/index.js +4 -0
  153. package/node_modules/@imgly/codesign-sdk/dist/gateway/types.d.ts +18 -3
  154. package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.d.ts +3 -0
  155. package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.js +5 -0
  156. package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.d.ts +2 -0
  157. package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.js +8 -1
  158. package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.d.ts +4 -2
  159. package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.js +7 -4
  160. package/node_modules/@imgly/codesign-sdk/dist/host.d.ts +34 -5
  161. package/node_modules/@imgly/codesign-sdk/dist/host.js +6 -0
  162. package/node_modules/@imgly/codesign-sdk/dist/importers/fig.d.ts +4 -0
  163. package/node_modules/@imgly/codesign-sdk/dist/importers/fig.js +57 -0
  164. package/node_modules/@imgly/codesign-sdk/dist/importers/index.d.ts +2 -2
  165. package/node_modules/@imgly/codesign-sdk/dist/importers/index.js +38 -25
  166. package/node_modules/@imgly/codesign-sdk/dist/importers/node.d.ts +5 -0
  167. package/node_modules/@imgly/codesign-sdk/dist/importers/node.js +8 -0
  168. package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.d.ts +20 -0
  169. package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.js +76 -0
  170. package/node_modules/@imgly/codesign-sdk/dist/importers/shared.d.ts +14 -0
  171. package/node_modules/@imgly/codesign-sdk/dist/importers/shared.js +18 -0
  172. package/node_modules/@imgly/codesign-sdk/dist/index.d.ts +5 -4
  173. package/node_modules/@imgly/codesign-sdk/dist/index.js +2 -1
  174. package/node_modules/@imgly/codesign-sdk/dist/internal/index.d.ts +24 -17
  175. package/node_modules/@imgly/codesign-sdk/dist/internal/index.js +19 -10
  176. package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.d.ts +5 -0
  177. package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.js +73 -0
  178. package/node_modules/@imgly/codesign-sdk/dist/node/engine-child.js +18 -2
  179. package/node_modules/@imgly/codesign-sdk/dist/node/engine-http.js +8 -2
  180. package/node_modules/@imgly/codesign-sdk/dist/node/index.d.ts +1 -0
  181. package/node_modules/@imgly/codesign-sdk/dist/node/index.js +1 -0
  182. package/node_modules/@imgly/codesign-sdk/dist/node/media-probe.js +1 -1
  183. package/node_modules/@imgly/codesign-sdk/dist/sdk-version.generated.js +2 -2
  184. package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.d.ts +59 -13
  185. package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.js +19 -0
  186. package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.d.ts +1 -14
  187. package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.js +15 -4
  188. package/node_modules/@imgly/codesign-sdk/dist/session/file-formats.d.ts +5 -0
  189. package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.d.ts +2 -0
  190. package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.js +18 -7
  191. package/node_modules/@imgly/codesign-sdk/dist/session/local-engine-session.js +247 -68
  192. package/node_modules/@imgly/codesign-sdk/dist/session/local-engine.js +2 -2
  193. package/node_modules/@imgly/codesign-sdk/dist/session/multipart.js +10 -2
  194. package/node_modules/@imgly/codesign-sdk/dist/session/pending-video.js +2 -3
  195. package/node_modules/@imgly/codesign-sdk/dist/session/read-resolved.js +93 -6
  196. package/node_modules/@imgly/codesign-sdk/dist/session/remote.d.ts +34 -10
  197. package/node_modules/@imgly/codesign-sdk/dist/session/remote.js +377 -87
  198. package/node_modules/@imgly/codesign-sdk/dist/session/render-id.js +11 -2
  199. package/node_modules/@imgly/codesign-sdk/dist/session/session.d.ts +67 -6
  200. package/node_modules/@imgly/codesign-sdk/dist/session/session.js +213 -32
  201. package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.d.ts +18 -0
  202. package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.js +47 -0
  203. package/node_modules/@imgly/codesign-sdk/dist/session/transfers.d.ts +85 -0
  204. package/node_modules/@imgly/codesign-sdk/dist/session/transfers.js +80 -0
  205. package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.d.ts +30 -0
  206. package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.js +187 -0
  207. package/node_modules/@imgly/codesign-sdk/dist/session/url-source.d.ts +21 -0
  208. package/node_modules/@imgly/codesign-sdk/dist/session/url-source.js +163 -0
  209. package/node_modules/@imgly/codesign-sdk/dist/session/wire.d.ts +8 -1
  210. package/node_modules/@imgly/codesign-sdk/dist/session/wire.js +2 -1
  211. package/node_modules/@imgly/codesign-sdk/dist/session-instructions.js +2 -2
  212. package/node_modules/@imgly/codesign-sdk/dist/sessions/state.d.ts +3 -1
  213. package/node_modules/@imgly/codesign-sdk/dist/sessions/state.js +5 -1
  214. package/node_modules/@imgly/codesign-sdk/dist/signed-urls.d.ts +3 -0
  215. package/node_modules/@imgly/codesign-sdk/dist/signed-urls.js +30 -0
  216. package/node_modules/@imgly/codesign-sdk/dist/skill-tool.js +12 -12
  217. package/node_modules/@imgly/codesign-sdk/dist/sources/handshake.d.ts +2 -0
  218. package/node_modules/@imgly/codesign-sdk/dist/sources/mime.js +0 -1
  219. package/node_modules/@imgly/codesign-sdk/dist/sources/route.d.ts +8 -1
  220. package/node_modules/@imgly/codesign-sdk/dist/sources/route.js +17 -2
  221. package/node_modules/@imgly/codesign-sdk/dist/sources/search.js +9 -2
  222. package/node_modules/@imgly/codesign-sdk/dist/sources/types.d.ts +8 -1
  223. package/node_modules/@imgly/codesign-sdk/dist/testing/conformance.js +11 -6
  224. package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.d.ts +1 -1
  225. package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.js +11 -4
  226. package/node_modules/@imgly/codesign-sdk/dist/tools/edit.js +11 -4
  227. package/node_modules/@imgly/codesign-sdk/dist/tools/errors.js +2 -2
  228. package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.d.ts +4 -4
  229. package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.js +8 -0
  230. package/node_modules/@imgly/codesign-sdk/dist/tools/export.d.ts +3 -1
  231. package/node_modules/@imgly/codesign-sdk/dist/tools/export.js +75 -12
  232. package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.d.ts +3 -0
  233. package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.js +7 -0
  234. package/node_modules/@imgly/codesign-sdk/dist/tools/preview.js +42 -19
  235. package/node_modules/@imgly/codesign-sdk/dist/tools/source-tools.js +11 -4
  236. package/node_modules/@imgly/codesign-sdk/package.json +18 -10
  237. package/node_modules/@imgly/codesign-server/assets/ai-plugins/apps.mjs +5 -5
  238. package/node_modules/@imgly/codesign-server/assets/ai-plugins/image-gateway.mjs +5 -5
  239. package/node_modules/@imgly/codesign-server/assets/ai-plugins/version.json +1 -1
  240. package/node_modules/@imgly/codesign-server/dist/catalog/link.d.ts.map +1 -1
  241. package/node_modules/@imgly/codesign-server/dist/catalog/link.js +2 -1
  242. package/node_modules/@imgly/codesign-server/dist/catalog/link.js.map +1 -1
  243. package/node_modules/@imgly/codesign-server/dist/catalog/local-server.d.ts.map +1 -1
  244. package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js +1 -0
  245. package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js.map +1 -1
  246. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts +59 -1
  247. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts.map +1 -1
  248. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js +127 -23
  249. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js.map +1 -1
  250. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts +7 -0
  251. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts.map +1 -1
  252. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js +65 -15
  253. package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js.map +1 -1
  254. package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts +2 -0
  255. package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts.map +1 -1
  256. package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js +15 -5
  257. package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js.map +1 -1
  258. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts +1 -1
  259. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts.map +1 -1
  260. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js +7 -6
  261. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js.map +1 -1
  262. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts +2 -2
  263. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts.map +1 -1
  264. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js +14 -4
  265. package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js.map +1 -1
  266. package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts +10 -0
  267. package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts.map +1 -1
  268. package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js +106 -22
  269. package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js.map +1 -1
  270. package/node_modules/@imgly/codesign-server/dist/cli/connectors.js +1 -1
  271. package/node_modules/@imgly/codesign-server/dist/cli/connectors.js.map +1 -1
  272. package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js +1 -1
  273. package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js.map +1 -1
  274. package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts +1 -1
  275. package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts.map +1 -1
  276. package/node_modules/@imgly/codesign-server/dist/cli/pack.js +24 -18
  277. package/node_modules/@imgly/codesign-server/dist/cli/pack.js.map +1 -1
  278. package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js +1 -1
  279. package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js.map +1 -1
  280. package/node_modules/@imgly/codesign-server/dist/conversation/main.d.ts.map +1 -1
  281. package/node_modules/@imgly/codesign-server/dist/conversation/main.js +4 -3
  282. package/node_modules/@imgly/codesign-server/dist/conversation/main.js.map +1 -1
  283. package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts +4 -0
  284. package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts.map +1 -1
  285. package/node_modules/@imgly/codesign-server/dist/conversation/stage.js +13 -0
  286. package/node_modules/@imgly/codesign-server/dist/conversation/stage.js.map +1 -1
  287. package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts +0 -6
  288. package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts.map +1 -1
  289. package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js +0 -58
  290. package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js.map +1 -1
  291. package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts +10 -0
  292. package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts.map +1 -0
  293. package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js +84 -0
  294. package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js.map +1 -0
  295. package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts +1 -3
  296. package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts.map +1 -1
  297. package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js +3 -23
  298. package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js.map +1 -1
  299. package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts +59 -8
  300. package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts.map +1 -1
  301. package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js +317 -40
  302. package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js.map +1 -1
  303. package/node_modules/@imgly/codesign-server/dist/design/engine.js +4 -9
  304. package/node_modules/@imgly/codesign-server/dist/design/engine.js.map +1 -1
  305. package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts +5 -0
  306. package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts.map +1 -1
  307. package/node_modules/@imgly/codesign-server/dist/design/engines.js +49 -0
  308. package/node_modules/@imgly/codesign-server/dist/design/engines.js.map +1 -1
  309. package/node_modules/@imgly/codesign-server/dist/design/host.d.ts +2 -0
  310. package/node_modules/@imgly/codesign-server/dist/design/host.d.ts.map +1 -1
  311. package/node_modules/@imgly/codesign-server/dist/design/host.js +10 -6
  312. package/node_modules/@imgly/codesign-server/dist/design/host.js.map +1 -1
  313. package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.d.ts.map +1 -1
  314. package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js +34 -5
  315. package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js.map +1 -1
  316. package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts +42 -5
  317. package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts.map +1 -1
  318. package/node_modules/@imgly/codesign-server/dist/design/local-design.js +175 -38
  319. package/node_modules/@imgly/codesign-server/dist/design/local-design.js.map +1 -1
  320. package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts +27 -1
  321. package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts.map +1 -1
  322. package/node_modules/@imgly/codesign-server/dist/design/local-tools.js +65 -7
  323. package/node_modules/@imgly/codesign-server/dist/design/local-tools.js.map +1 -1
  324. package/node_modules/@imgly/codesign-server/dist/design/main.d.ts.map +1 -1
  325. package/node_modules/@imgly/codesign-server/dist/design/main.js +23 -10
  326. package/node_modules/@imgly/codesign-server/dist/design/main.js.map +1 -1
  327. package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts +4 -0
  328. package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts.map +1 -0
  329. package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js +13 -0
  330. package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js.map +1 -0
  331. package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts +2 -0
  332. package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts.map +1 -0
  333. package/node_modules/@imgly/codesign-server/dist/design/probe-media.js +16 -0
  334. package/node_modules/@imgly/codesign-server/dist/design/probe-media.js.map +1 -0
  335. package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts +22 -3
  336. package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts.map +1 -1
  337. package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js +123 -32
  338. package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js.map +1 -1
  339. package/node_modules/@imgly/codesign-server/dist/design/save.d.ts +5 -0
  340. package/node_modules/@imgly/codesign-server/dist/design/save.d.ts.map +1 -1
  341. package/node_modules/@imgly/codesign-server/dist/design/save.js +9 -0
  342. package/node_modules/@imgly/codesign-server/dist/design/save.js.map +1 -1
  343. package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts +33 -4
  344. package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts.map +1 -1
  345. package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js +121 -43
  346. package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js.map +1 -1
  347. package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts +8 -0
  348. package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts.map +1 -1
  349. package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js +50 -61
  350. package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js.map +1 -1
  351. package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts +24 -2
  352. package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts.map +1 -1
  353. package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js +132 -17
  354. package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js.map +1 -1
  355. package/node_modules/@imgly/codesign-server/dist/services/archives/create.d.ts.map +1 -1
  356. package/node_modules/@imgly/codesign-server/dist/services/archives/create.js +19 -6
  357. package/node_modules/@imgly/codesign-server/dist/services/archives/create.js.map +1 -1
  358. package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.d.ts.map +1 -1
  359. package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js +10 -7
  360. package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js.map +1 -1
  361. package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts +3 -1
  362. package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts.map +1 -1
  363. package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js +5 -4
  364. package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js.map +1 -1
  365. package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts +56 -0
  366. package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts.map +1 -0
  367. package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js +218 -0
  368. package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js.map +1 -0
  369. package/node_modules/@imgly/codesign-server/dist/services/archives/seed.d.ts.map +1 -1
  370. package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js +33 -124
  371. package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js.map +1 -1
  372. package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts +1 -0
  373. package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts.map +1 -1
  374. package/node_modules/@imgly/codesign-server/dist/services/archives/template.js +1 -1
  375. package/node_modules/@imgly/codesign-server/dist/services/archives/template.js.map +1 -1
  376. package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.d.ts.map +1 -1
  377. package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js +2 -1
  378. package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js.map +1 -1
  379. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts +9 -5
  380. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts.map +1 -1
  381. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js +14 -19
  382. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js.map +1 -1
  383. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts +2 -0
  384. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts.map +1 -1
  385. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js +1 -0
  386. package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js.map +1 -1
  387. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.d.ts.map +1 -1
  388. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js +4 -1
  389. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js.map +1 -1
  390. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts +5 -1
  391. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts.map +1 -1
  392. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js +67 -6
  393. package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js.map +1 -1
  394. package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js +2 -2
  395. package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js.map +1 -1
  396. package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts +3 -3
  397. package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts.map +1 -1
  398. package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js +3 -3
  399. package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js.map +1 -1
  400. package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts +15 -0
  401. package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts.map +1 -0
  402. package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js +14 -0
  403. package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js.map +1 -0
  404. package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.d.ts.map +1 -1
  405. package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js +36 -0
  406. package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js.map +1 -1
  407. package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts +2 -2
  408. package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts.map +1 -1
  409. package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js +3 -5
  410. package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js.map +1 -1
  411. package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.d.ts.map +1 -1
  412. package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js +5 -4
  413. package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js.map +1 -1
  414. package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.d.ts.map +1 -1
  415. package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js +0 -64
  416. package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js.map +1 -1
  417. package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts +4 -0
  418. package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts.map +1 -1
  419. package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js +4 -0
  420. package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js.map +1 -1
  421. package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.d.ts.map +1 -1
  422. package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js +2 -24
  423. package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js.map +1 -1
  424. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts +4 -2
  425. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts.map +1 -1
  426. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js +15 -14
  427. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js.map +1 -1
  428. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts +12 -2
  429. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts.map +1 -1
  430. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js +42 -12
  431. package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js.map +1 -1
  432. package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.d.ts.map +1 -1
  433. package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js +1 -2
  434. package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js.map +1 -1
  435. package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.d.ts.map +1 -1
  436. package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js +24 -2
  437. package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js.map +1 -1
  438. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts +47 -0
  439. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts.map +1 -0
  440. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js +167 -0
  441. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js.map +1 -0
  442. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts +2 -0
  443. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts.map +1 -1
  444. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js +2 -0
  445. package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js.map +1 -1
  446. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts +32 -0
  447. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts.map +1 -0
  448. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js +79 -0
  449. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js.map +1 -0
  450. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts +35 -0
  451. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts.map +1 -0
  452. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js +185 -0
  453. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js.map +1 -0
  454. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts +74 -0
  455. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts.map +1 -0
  456. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js +82 -0
  457. package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js.map +1 -0
  458. package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts +10 -0
  459. package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts.map +1 -1
  460. package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js +1 -0
  461. package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js.map +1 -1
  462. package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.d.ts.map +1 -1
  463. package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js +5 -0
  464. package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js.map +1 -1
  465. package/node_modules/@imgly/codesign-server/package.json +13 -11
  466. package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts +2 -1
  467. package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts.map +1 -1
  468. package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js +5 -1
  469. package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js.map +1 -1
  470. package/node_modules/@imgly/design-lint/package.json +2 -2
  471. package/node_modules/@imgly/figma-exporter/CHANGELOG.md +79 -0
  472. package/node_modules/@imgly/figma-exporter/LICENSE.md +137 -0
  473. package/node_modules/@imgly/figma-exporter/README.md +201 -0
  474. package/node_modules/@imgly/figma-exporter/THIRD_PARTY_NOTICES.md +475 -0
  475. package/node_modules/@imgly/figma-exporter/dist/index.cjs +1 -0
  476. package/node_modules/@imgly/figma-exporter/dist/index.d.cts +8833 -0
  477. package/node_modules/@imgly/figma-exporter/dist/index.d.ts +8833 -0
  478. package/node_modules/@imgly/figma-exporter/dist/index.js +1 -0
  479. package/node_modules/@imgly/figma-exporter/package.json +92 -0
  480. package/node_modules/@imgly/figma-importer/CHANGELOG.md +84 -0
  481. package/node_modules/@imgly/figma-importer/LICENSE.md +137 -0
  482. package/node_modules/@imgly/figma-importer/README.md +256 -0
  483. package/node_modules/@imgly/figma-importer/THIRD_PARTY_NOTICES.md +446 -0
  484. package/node_modules/@imgly/figma-importer/dist/index.cjs +2 -0
  485. package/node_modules/@imgly/figma-importer/dist/index.d.cts +12831 -0
  486. package/node_modules/@imgly/figma-importer/dist/index.d.ts +12831 -0
  487. package/node_modules/@imgly/figma-importer/dist/index.js +2 -0
  488. package/node_modules/@imgly/figma-importer/package.json +85 -0
  489. package/node_modules/@imgly/html-exporter/CHANGELOG.md +35 -0
  490. package/node_modules/@imgly/html-exporter/README.md +45 -4
  491. package/node_modules/@imgly/html-exporter/dist/index.cjs +610 -493
  492. package/node_modules/@imgly/html-exporter/dist/index.d.cts +235 -216
  493. package/node_modules/@imgly/html-exporter/dist/index.d.ts +235 -216
  494. package/node_modules/@imgly/html-exporter/dist/index.js +610 -493
  495. package/node_modules/@imgly/html-exporter/package.json +15 -10
  496. package/node_modules/@imgly/idml-exporter/CHANGELOG.md +10 -0
  497. package/node_modules/@imgly/idml-exporter/README.md +17 -18
  498. package/node_modules/@imgly/idml-exporter/dist/harfbuzz.browser.js +1 -1
  499. package/node_modules/@imgly/idml-exporter/dist/index.cjs +8 -11
  500. package/node_modules/@imgly/idml-exporter/dist/index.d.cts +14480 -10275
  501. package/node_modules/@imgly/idml-exporter/dist/index.d.ts +14480 -10275
  502. package/node_modules/@imgly/idml-exporter/dist/index.js +8 -10
  503. package/node_modules/@imgly/idml-exporter/dist/woff2.browser.js +14 -14
  504. package/node_modules/@imgly/idml-exporter/package.json +17 -12
  505. package/node_modules/@imgly/idml-importer/CHANGELOG.md +37 -0
  506. package/node_modules/@imgly/idml-importer/README.md +148 -17
  507. package/node_modules/@imgly/idml-importer/dist/index.cjs +6 -5
  508. package/node_modules/@imgly/idml-importer/dist/index.d.cts +1003 -632
  509. package/node_modules/@imgly/idml-importer/dist/index.d.ts +1003 -632
  510. package/node_modules/@imgly/idml-importer/dist/index.js +6 -5
  511. package/node_modules/@imgly/idml-importer/package.json +9 -9
  512. package/node_modules/@imgly/pdf-importer/CHANGELOG.md +59 -0
  513. package/node_modules/@imgly/pdf-importer/README.md +71 -7
  514. package/node_modules/@imgly/pdf-importer/dist/browser.d.ts +940 -788
  515. package/node_modules/@imgly/pdf-importer/dist/browser.js +17 -15
  516. package/node_modules/@imgly/pdf-importer/dist/node.cjs +17 -16
  517. package/node_modules/@imgly/pdf-importer/dist/node.d.cts +940 -788
  518. package/node_modules/@imgly/pdf-importer/dist/node.d.ts +940 -788
  519. package/node_modules/@imgly/pdf-importer/dist/node.js +17 -15
  520. package/node_modules/@imgly/pdf-importer/dist/pdf.worker.mjs +80265 -61990
  521. package/node_modules/@imgly/pdf-importer/package.json +13 -13
  522. package/node_modules/@imgly/psd-exporter/CHANGELOG.md +12 -0
  523. package/node_modules/@imgly/psd-exporter/README.md +50 -7
  524. package/node_modules/@imgly/psd-exporter/dist/index.cjs +5 -7
  525. package/node_modules/@imgly/psd-exporter/dist/index.d.cts +14332 -10063
  526. package/node_modules/@imgly/psd-exporter/dist/index.d.ts +14332 -10063
  527. package/node_modules/@imgly/psd-exporter/dist/index.js +5 -6
  528. package/node_modules/@imgly/psd-exporter/dist/wawoff2-LICENSE.txt +19 -0
  529. package/node_modules/@imgly/psd-exporter/dist/woff2.browser.js +19 -0
  530. package/node_modules/@imgly/psd-exporter/package.json +26 -9
  531. package/node_modules/@imgly/psd-importer/CHANGELOG.md +29 -1
  532. package/node_modules/@imgly/psd-importer/README.md +22 -30
  533. package/node_modules/@imgly/psd-importer/dist/index.cjs +11 -11
  534. package/node_modules/@imgly/psd-importer/dist/index.d.cts +10479 -12978
  535. package/node_modules/@imgly/psd-importer/dist/index.d.ts +10479 -12978
  536. package/node_modules/@imgly/psd-importer/dist/index.js +11 -11
  537. package/node_modules/@imgly/psd-importer/package.json +8 -11
  538. package/package.json +28 -17
  539. package/node_modules/@imgly/pdf-importer/dist/browser.d.cts +0 -941
@@ -1,18 +1,15 @@
1
- var Zt={silent:0,error:1,warn:2,info:3},pr="silent";function Qt(t,e="info"){Zt[pr]>=Zt[e]&&console.error(t)}var Ct=class extends Error{name="AbortError";constructor(e="Operation aborted"){super(e)}};function z(t){if(t?.aborted)throw new Ct(t.reason instanceof Error?t.reason.message:String(t.reason??"Operation aborted"))}function mr(t,e){return t.replace(/\{(\w+)\}/g,(r,n)=>{if(!(n in e))throw new Error(`Missing param "${n}" for warning template: ${t}`);return String(e[n])})}var Jt=class{constructor(t){this.registry=t}messages=[];emit(t,e={}){let r=this.registry[t];this.messages.push({code:t,type:r.severity,message:mr(r.template,e),params:e})}getMessages(){return this.messages}},fr="0.1.0",rn=`https://staticimgly.com/imgly/gfonts/${fr}/dist`;var te={SVG_SHAPE_RASTERIZED_EFFECTS:{severity:"info",template:'Shape "{name}" has effects and will be rasterized.'},SVG_SHAPE_ID_INVALID:{severity:"warning",template:'Shape ID is invalid for block "{name}". Will be rasterized.'},SVG_SHAPE_TYPE_UNSUPPORTED:{severity:"info",template:'Shape type "{shapeType}" is not supported for SVG. Will be rasterized.'},SVG_VECTOR_PATH_READ_FAILED:{severity:"warning",template:'Could not read vector path for "{name}". Will be rasterized.'},SVG_STROKE_POSITION_DEFAULTED:{severity:"info",template:'Stroke position "{strokePosition}" on "{name}" rendered as Center (SVG default).'},SVG_FILL_INVALID:{severity:"warning",template:'Fill is invalid for shape "{name}". Will be rasterized.'},SVG_GRADIENT_CONICAL_UNSUPPORTED:{severity:"warning",template:'Conical gradient on "{name}" is unsupported in SVG. Will be rasterized.'},SVG_FILL_TYPE_UNSUPPORTED:{severity:"info",template:'Fill type "{fillType}" on "{name}" is not supported for SVG. Will be rasterized.'},SVG_IMAGE_URI_MISSING:{severity:"warning",template:'Could not read image URI for "{name}". Will be rasterized.'},SVG_IMAGE_URI_EMPTY:{severity:"warning",template:'Empty image URI for "{name}". Will be rasterized.'},SVG_IMAGE_RESOLVE_FAILED:{severity:"warning",template:'Failed to resolve image "{imageUri}" for "{name}". Will be rasterized.'},RESOURCE_LOAD_FAILED:{severity:"warning",template:"Could not load resource data: {originalUri}"},RESOURCE_FILE_COLLECTED:{severity:"info",template:"Collected resource file: {relativePath}"},TEXT_LINE_HEIGHT_FALLBACK:{severity:"warning",template:"Block {blockId}: missing font URI or zero font size, line-height will use raw CE.SDK value"},TEXT_BAKE_MULTI_COLOR_SKIPPED:{severity:"warning",template:'Cannot vectorize multi-color text block "{name}" (ID: {blockId}). Skipping vectorization.'},TEXT_BAKE_VECTORIZED:{severity:"info",template:'Vectorized text block "{name}" (ID: {blockId} -> {vectorizedBlockId})'},TEXT_BAKE_FAILED:{severity:"warning",template:'Failed to vectorize text block "{name}" (ID: {blockId})'},COLOR_CONVERTED_TO_SRGB:{severity:"warning",template:"{colorType} color encountered and will be converted to sRGB. HTML5 does not support {colorType} colors."},SCENE_DESIGN_UNIT_CONVERTED:{severity:"info",template:"Converted design unit from {originalDesignUnit} to Pixel"},SCENE_NO_PAGES:{severity:"error",template:"No pages found in scene to export"},SCENE_PAGE_FILL_INVALID:{severity:"warning",template:"Page fill is enabled but fill block is invalid. Skipping background injection."},SCENE_PAGE_FILL_DUPLICATE_FAILED:{severity:"warning",template:"Failed to duplicate page fill. Skipping background injection."},GROUP_BLEND_MODE_UNSUPPORTED:{severity:"error",template:'Group "{groupName}" has unsupported blend mode "{blendMode}". CSS only supports PassThrough and Normal.'},GROUP_OPACITY_UNSUPPORTED:{severity:"error",template:`Group "{groupName}" has opacity {opacity}. CSS groups don't support opacity on group elements.`},GROUP_NESTED_BLEND_MODE_UNSUPPORTED:{severity:"error",template:'Group "{groupName}" contains nested group "{childName}" with unsupported blend mode "{childBlend}".'},HTML_PAGE_PROCESSED:{severity:"info",template:"Processed page {page}: {textCount} text, {svgCount} SVGs, {groupCount} groups, {fontCount} fonts"},METADATA_NON_DATA_ATTR:{severity:"info",template:'Block {blockId}: metadata key "{key}" maps to non-data attribute "{attrName}". Consider using "html5-exporter-data-{attrName}" instead for safety.'}};var vt=class extends Jt{constructor(){super(te)}},K=vt;function ee(t){let e=t.scene.getDesignUnit();return e!=="Pixel"?(t.scene.setDesignUnit("Pixel"),{originalDesignUnit:e,converted:!0}):{originalDesignUnit:e,converted:!1}}function d(t){try{return t()}catch{return}}function re(t,e,r,n,o){if(t.block.supportsFill(e)&&t.block.isFillEnabled(e)){let i=t.block.getFill(e);if(!t.block.isValid(i))return o?.emit("SCENE_PAGE_FILL_INVALID"),{injected:!1};let a=t.block.create("graphic"),l=t.block.createShape("rect");t.block.setShape(a,l),t.block.setWidth(a,r),t.block.setHeight(a,n),t.block.setPositionX(a,0),t.block.setPositionY(a,0),t.block.setName(a,"page-background");let s;try{s=t.block.duplicate(i)}catch{return o?.emit("SCENE_PAGE_FILL_DUPLICATE_FAILED"),d(()=>t.block.destroy(a)),{injected:!1}}return t.block.setFill(a,s),t.block.setFillEnabled(a,!0),t.block.setAlwaysOnBottom(a,!0),t.block.insertChild(e,a,0),t.block.setFillEnabled(e,!1),t.block.supportsStroke(e)&&t.block.isStrokeEnabled(e)&&(t.block.setStrokeEnabled(a,!0),t.block.setStrokeColor(a,t.block.getStrokeColor(e)),t.block.setStrokeWidth(a,t.block.getStrokeWidth(e)),t.block.setStrokeStyle(a,t.block.getStrokeStyle(e)),t.block.setStrokePosition(a,t.block.getStrokePosition(e)),t.block.setStrokeCornerGeometry(a,t.block.getStrokeCornerGeometry(e)),t.block.setStrokeEnabled(e,!1)),{injected:!0,backgroundBlockId:a}}return t.block.supportsFill(e)&&!t.block.isFillEnabled(e)?{injected:!1,transparentBackground:!0}:{injected:!1}}function dr(t,e){let r=d(()=>t.block.getString(e,"text/text"));return!r||r.length===0?!1:(d(()=>t.block.getTextColors(e,0,r.length))?.length??0)>1}function gr(t,e){return d(()=>{let r=t.block.getName(e)||"",n=t.block.getBlendMode(e),o=t.block.getFrameX(e),i=t.block.getFrameY(e),a=t.block.getFrameWidth(e),l=t.block.getFrameHeight(e),s=t.block.getRotation(e),c=t.block.getParent(e);if(!c)return null;let p=t.block.create("graphic"),u=t.block.createShape("rect");t.block.setShape(p,u),t.block.setWidth(p,a),t.block.setHeight(p,l),t.block.setRotation(p,s),t.block.setPositionX(p,o),t.block.setPositionY(p,i),t.block.appendChild(c,p);let m=t.block.combine([e,p],"Intersection");return d(()=>t.block.isValid(p))&&d(()=>t.block.destroy(p)),d(()=>t.block.isValid(m))?(t.block.setName(m,r),t.block.setBlendMode(m,n),m):null})??null}function ne(t,e,r){let n=[],o=t.block.getChildren(e);for(let i of o){if(!t.block.isValid(i)||!(t.block.getType(i)==="//ly.img.ubq/text")||!t.block.isVisible(i))continue;let s=t.block.getName(i)||"";if(dr(t,i)){r?.emit("TEXT_BAKE_MULTI_COLOR_SKIPPED",{name:s,blockId:i});continue}let c=gr(t,i);c!==null?(n.push({originalId:i,bakedId:c,name:s,originalType:"text",reason:"vector-text"}),r?.emit("TEXT_BAKE_VECTORIZED",{name:s,blockId:i,vectorizedBlockId:c})):r?.emit("TEXT_BAKE_FAILED",{name:s,blockId:i})}return n}function oe(t,e){let r=e.logger??new K;z(e.abortSignal);let{originalDesignUnit:n,converted:o}=ee(t);o&&r.emit("SCENE_DESIGN_UNIT_CONVERTED",{originalDesignUnit:n});let i=t.block.findByType("page");if(i.length===0)throw r.emit("SCENE_NO_PAGES"),new Error("No pages found to export");let a=[];for(let l=0;l<i.length;l++){z(e.abortSignal);let s=i[l],c=t.block.getWidth(s),p=t.block.getHeight(s),u=re(t,s,c,p,r),m=[];e.textMode==="vector"&&(m=ne(t,s,r)),a.push({pageId:s,pageIndex:l,width:c,height:p,backgroundInjected:u.injected,bakedBlocks:m})}return{pages:a,originalDesignUnit:n,designUnitConverted:o}}function hr(t){return"r"in t&&"a"in t&&t.r!==void 0&&t.a!==void 0}function yr(t){return"c"in t&&"m"in t&&"y"in t&&"k"in t&&t.c!==void 0&&t.m!==void 0&&t.y!==void 0&&t.k!==void 0}function _(t,e,r){if(hr(t))return t;let n=yr(t)?"CMYK":"Spot";return r.emit("COLOR_CONVERTED_TO_SRGB",{colorType:n}),e.editor.convertColorToColorSpace(t,"sRGB")}function B(t){let e=Math.round(t.r*255),r=Math.round(t.g*255),n=Math.round(t.b*255);return t.a===1?`rgb(${e}, ${r}, ${n})`:`rgba(${e}, ${r}, ${n}, ${t.a.toFixed(2)})`}function kt(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a}var br={Normal:"normal",Multiply:"multiply",Screen:"screen",Overlay:"overlay",Darken:"darken",Lighten:"lighten",ColorDodge:"color-dodge",ColorBurn:"color-burn",HardLight:"hard-light",SoftLight:"soft-light",Difference:"difference",Exclusion:"exclusion",Hue:"hue",Saturation:"saturation",Color:"color",Luminosity:"luminosity"};function H(t){let e=br[t];return e&&e!=="normal"?e:void 0}function ht(t){return t==="PassThrough"||t==="Normal"}var xr={thin:100,extraLight:200,light:300,normal:400,medium:500,semiBold:600,bold:700,extraBold:800,heavy:900};function N(t){return xr[t]??400}function Pt(t,e){return d(()=>t.block.isAlwaysOnTop(e))?1:d(()=>t.block.isAlwaysOnBottom(e))?-1:0}function pt(t,e){let r=t.sortingOrder??0,n=e.sortingOrder??0;return r!==n?r-n:(t.originalIndex??0)-(e.originalIndex??0)}function ie(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ft(t){switch(t){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#039;";default:return t}}function Z(t){return!t||Object.keys(t).length===0?"":Object.entries(t).map(([e,r])=>`${e}="${ie(r)}"`).join(" ")}function Q(t){let{defaultId:e,defaultClass:r,style:n,defaults:o={},htmlAttributes:i={}}=t,a={id:e,class:r,...o,style:n};for(let[l,s]of Object.entries(i))a[l]=s;return a}function ae(t){let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return n}function se(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function le(t=0){return new Uint8Array(t)}async function ce(t){let e=new ArrayBuffer(t.length);new Uint8Array(e).set(t);let r=await crypto.subtle.digest("SHA-256",e),n=new Uint8Array(r);return Array.from(n).map(o=>o.toString(16).padStart(2,"0")).join("")}function g(t,e=2){return parseFloat(t.toFixed(e)).toString()}var yt="html5-exporter-";function mt(t,e,r){return r==="Center"?{x:t.x-e/2,y:t.y-e/2,width:t.width+e,height:t.height+e}:r==="Outside"?{x:t.x-e,y:t.y-e,width:t.width+e*2,height:t.height+e*2}:t}function ft(t,e,r,n,o,i,a){if(!(Math.abs(o)>.001||i||a))return{x:t,y:e};let s=Math.cos(o),c=Math.sin(o),p=i?r/2:-r/2,u=a?n/2:-n/2,m=t-p*s+u*c,h=e-p*c-u*s;return{x:m-r/2,y:h-n/2}}function Dt(t,e,r,n,o){let i=t-r,a=e-n;if(Math.abs(o)<.001)return{x:i,y:a};let l=Math.cos(o),s=Math.sin(o);return{x:i*l+a*s,y:-i*s+a*l}}function F(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function J(t,e,r,n,o){let i=o?St(o):"",a=n?` fill="${F(n)}"`:' fill="none"';if(r&&(r.tl>0||r.tr>0||r.bl>0||r.br>0)){let{tl:l,tr:s,br:c,bl:p}=r;if(l===s&&s===c&&c===p)return`<rect width="${g(t)}" height="${g(e)}" rx="${g(l)}" ry="${g(l)}"${a}${i}/>`;let u=Sr(t,e,l,s,c,p);return`<path d="${F(u)}"${a}${i}/>`}return`<rect width="${g(t)}" height="${g(e)}"${a}${i}/>`}function bt(t,e,r,n){let o=t/2,i=e/2,a=t/2,l=e/2,s=n?St(n):"",c=r?` fill="${F(r)}"`:' fill="none"';return`<ellipse cx="${g(o)}" cy="${g(i)}" rx="${g(a)}" ry="${g(l)}"${c}${s}/>`}function xt(t,e,r){let n=r?St(r):"",o=e?` fill="${F(e)}"`:' fill="none"';return`<path d="${F(t)}"${o}${n}/>`}function Ot(t,e,r,n,o,i,a,l){let s=i.map(h=>`<stop offset="${h.stop}" stop-color="${F(h.color)}"/>`).join(""),c=e*a,p=r*l,u=n*a,m=o*l;return`<linearGradient id="${F(t)}" gradientUnits="userSpaceOnUse" x1="${g(c)}" y1="${g(p)}" x2="${g(u)}" y2="${g(m)}">${s}</linearGradient>`}function Lt(t,e,r,n,o,i,a){let l=o.map(u=>`<stop offset="${u.stop}" stop-color="${F(u.color)}"/>`).join(""),s=e*i,c=r*a,p=n*Math.max(i,a);return`<radialGradient id="${F(t)}" gradientUnits="userSpaceOnUse" cx="${g(s)}" cy="${g(c)}" r="${g(p)}">${l}</radialGradient>`}function Mt(t,e,r,n,o,i,a,l,s,c){let p=`clip-${t}`,u=`<clipPath id="${F(p)}">${r}</clipPath>`,m="";if(Math.abs(l)>.001){let f=s/2,x=c/2;m=` transform="rotate(${l.toFixed(2)}, ${g(f)}, ${g(x)})"`}let h=`<g clip-path="url(#${F(p)})"><g class="element-content"><image href="${F(e)}" x="${g(n)}" y="${g(o)}" width="${g(i)}" height="${g(a)}" preserveAspectRatio="none"${m}/></g></g>`;return{defs:u,body:h}}function St(t){let e=` stroke="${F(t.color)}" stroke-width="${g(t.width,1)}"`;switch(t.style){case"Dashed":case"DashedRound":e+=` stroke-dasharray="${g(t.width*3,1)} ${g(t.width*2,1)}"`,t.style==="DashedRound"&&(e+=' stroke-linecap="round"');break;case"LongDashed":case"LongDashedRound":e+=` stroke-dasharray="${g(t.width*6,1)} ${g(t.width*3,1)}"`,t.style==="LongDashedRound"&&(e+=' stroke-linecap="round"');break;case"Dotted":e+=` stroke-dasharray="${g(t.width,1)} ${g(t.width,1)}"`,e+=' stroke-linecap="round"';break}return e}function Sr(t,e,r,n,o,i){let a=e/2,l=t/2;r=Math.min(r,a,l),n=Math.min(n,a,l),o=Math.min(o,a,l),i=Math.min(i,a,l);let s=g;return[`M ${s(r)} 0`,`L ${s(t-n)} 0`,`Q ${s(t)} 0 ${s(t)} ${s(n)}`,`L ${s(t)} ${s(e-o)}`,`Q ${s(t)} ${s(e)} ${s(t-o)} ${s(e)}`,`L ${s(i)} ${s(e)}`,`Q 0 ${s(e)} 0 ${s(e-i)}`,`L 0 ${s(r)}`,`Q 0 0 ${s(r)} 0`,"Z"].join(" ")}var ue={"image/webp":".webp","image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/svg+xml":".svg","image/bmp":".bmp","image/tiff":".tiff","font/ttf":".ttf","font/otf":".otf","font/woff":".woff","font/woff2":".woff2","font/truetype":".ttf","font/opentype":".otf","application/x-font-ttf":".ttf","application/x-font-otf":".otf","application/font-woff":".woff","application/font-woff2":".woff2","video/mp4":".mp4","video/webm":".webm","video/ogg":".ogv","audio/mpeg":".mp3","audio/wav":".wav","audio/ogg":".ogg","audio/webm":".weba","text/html":".html","text/css":".css","application/javascript":".js","application/json":".json"},pe=Object.fromEntries(Object.entries(ue).map(([t,e])=>[e,t]));function _t(t){return ue[t]||".bin"}function $t(t){let e=t.slice(t.lastIndexOf(".")).toLowerCase();return pe[e]}function Gt(t){let e=t.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);if(!e)return"font/ttf";let r=`.${e[1].toLowerCase()}`;return pe[r]||"font/ttf"}function V(t){return t.startsWith("buffer://")?t.slice(9):t}function Ut(t){return t.startsWith("data:")}function tt(t){return t.startsWith("http://")||t.startsWith("https://")}function At(t){return t.startsWith("buffer://")}function me(t){if(!t.startsWith("data:"))return;let e=t.match(/^data:([^;,]+)/);return e?e[1]:void 0}async function Bt(t,e,r,n){let o=t.block.getName(e)||`Block ${e}`;if(!t.block.supportsShape(e))return null;let i=t.block.getEffects(e);if(i&&i.length>0)return n.emit("SVG_SHAPE_RASTERIZED_EFFECTS",{name:o}),null;let a=t.block.getShape(e);if(!t.block.isValid(a))return n.emit("SVG_SHAPE_ID_INVALID",{name:o}),null;let l=t.block.getType(a),s;if(l==="//ly.img.ubq/shape/rect")s="rect";else if(l==="//ly.img.ubq/shape/ellipse")s="ellipse";else if(l==="//ly.img.ubq/shape/line")s="line";else if(l==="//ly.img.ubq/shape/vector_path")s="vector_path";else return n.emit("SVG_SHAPE_TYPE_UNSUPPORTED",{shapeType:l}),null;let c=t.block.getFrameWidth(e),p=t.block.getFrameHeight(e),u=c,m=p,h;if(s==="vector_path")try{u=t.block.getFloat(a,"shape/vector_path/width"),m=t.block.getFloat(a,"shape/vector_path/height"),h=t.block.getString(a,"shape/vector_path/path")}catch{return n.emit("SVG_VECTOR_PATH_READ_FAILED",{name:o}),null}let f=await Ar(t,e,s,a,u,m,r,n);if(f===null)return null;let x;if(t.block.supportsStroke(e)&&t.block.isStrokeEnabled(e)){let L=t.block.getStrokeColor(e),j=t.block.getStrokeWidth(e),I=t.block.getStrokePosition(e),Y=t.block.getStrokeStyle(e);(I==="Inner"||I==="Outer")&&n.emit("SVG_STROKE_POSITION_DEFAULTED",{strokePosition:I,name:o}),x={color:B(_(L,t,n)),width:j,style:Y}}let S;if(s==="rect"){let L=d(()=>t.block.getFloat(a,"shape/rect/cornerRadiusTL"))??0,j=d(()=>t.block.getFloat(a,"shape/rect/cornerRadiusTR"))??0,I=d(()=>t.block.getFloat(a,"shape/rect/cornerRadiusBL"))??0,Y=d(()=>t.block.getFloat(a,"shape/rect/cornerRadiusBR"))??0;(L>0||j>0||I>0||Y>0)&&(S={tl:L,tr:j,bl:I,br:Y})}let y;switch(s){case"rect":y=J(u,m,S,f.fillAttr,x);break;case"ellipse":y=bt(u,m,f.fillAttr,x);break;case"line":y=J(u,m,void 0,f.fillAttr,x);break;case"vector_path":y=xt(h,f.fillAttr,x);break}let b;f.type==="image"?b=f.defs+f.body:b=(f.defs?`<defs>${f.defs}</defs>`:"")+y;let A=t.block.getRotation(e),R={x:t.block.getFrameX(e),y:t.block.getFrameY(e),width:c,height:p},{x:k,y:T,width:v,height:P}=x?mt(R,x.width,"Center"):R,$=d(()=>t.block.getOpacity(e))??1,O=H(t.block.getBlendMode(e)),G=X(t,e,n),W=`0 0 ${g(u)} ${g(m)}`;return{type:"svg",id:e,name:o,x:k,y:T,width:v,height:P,rotation:A,viewBox:W,svgContent:b,opacity:$,blendMode:O,htmlAttributes:G}}async function Ar(t,e,r,n,o,i,a,l){if(!t.block.supportsFill(e)||!t.block.isFillEnabled(e))return{type:"none",defs:"",body:""};let s=t.block.getFill(e);if(!t.block.isValid(s)){let u=t.block.getName(e)||`Block ${e}`;return l.emit("SVG_FILL_INVALID",{name:u}),null}let c=t.block.getType(s);if(c==="//ly.img.ubq/fill/color"){let u=t.block.getColor(s,"fill/color/value");return{type:"solid",fillAttr:B(_(u,t,l)),defs:"",body:""}}if(c==="//ly.img.ubq/fill/gradient/linear"){let u=`grad-${e}`,m=t.block.getFloat(s,"fill/gradient/linear/startPointX"),h=t.block.getFloat(s,"fill/gradient/linear/startPointY"),f=t.block.getFloat(s,"fill/gradient/linear/endPointX"),x=t.block.getFloat(s,"fill/gradient/linear/endPointY"),y=t.block.getGradientColorStops(s,"fill/gradient/colors").map(A=>({color:B(_(A.color,t,l)),stop:A.stop})),b=Ot(u,m,h,f,x,y,o,i);return{type:"gradient",fillAttr:`url(#${u})`,defs:`<defs>${b}</defs>`,body:""}}if(c==="//ly.img.ubq/fill/gradient/radial"){let u=`grad-${e}`,m=t.block.getFloat(s,"fill/gradient/radial/centerPointX"),h=t.block.getFloat(s,"fill/gradient/radial/centerPointY"),f=t.block.getFloat(s,"fill/gradient/radial/radius"),S=t.block.getGradientColorStops(s,"fill/gradient/colors").map(b=>({color:B(_(b.color,t,l)),stop:b.stop})),y=Lt(u,m,h,f,S,o,i);return{type:"gradient",fillAttr:`url(#${u})`,defs:`<defs>${y}</defs>`,body:""}}if(c==="//ly.img.ubq/fill/gradient/conical"){let u=t.block.getName(e)||`Block ${e}`;return l.emit("SVG_GRADIENT_CONICAL_UNSUPPORTED",{name:u}),null}if(c==="//ly.img.ubq/fill/image")return Er(t,e,r,n,o,i,s,a,l);let p=t.block.getName(e)||`Block ${e}`;return l.emit("SVG_FILL_TYPE_UNSUPPORTED",{fillType:c,name:p}),null}async function Er(t,e,r,n,o,i,a,l,s){let c=t.block.getName(e)||`Block ${e}`,p;try{p=t.block.getString(a,"fill/image/imageFileURI")}catch{return s.emit("SVG_IMAGE_URI_MISSING",{name:c}),null}if(!p)return s.emit("SVG_IMAGE_URI_EMPTY",{name:c}),null;let u=await t.editor.getMimeType(p),m;try{m=await l.getUrl(p,"image",u)}catch{return s.emit("SVG_IMAGE_RESOLVE_FAILED",{imageUri:p,name:c}),null}let h=t.block.getCropScaleX(e),f=t.block.getCropScaleY(e),x=t.block.getCropTranslationX(e),S=t.block.getCropTranslationY(e),y=t.block.getCropRotation(e),b=o*h,A=i*f,R=x*o,k=S*i,T=y*180/Math.PI,v;switch(r){case"rect":{let O,G=d(()=>t.block.getFloat(n,"shape/rect/cornerRadiusTL"))??0,W=d(()=>t.block.getFloat(n,"shape/rect/cornerRadiusTR"))??0,L=d(()=>t.block.getFloat(n,"shape/rect/cornerRadiusBL"))??0,j=d(()=>t.block.getFloat(n,"shape/rect/cornerRadiusBR"))??0;(G>0||W>0||L>0||j>0)&&(O={tl:G,tr:W,bl:L,br:j}),v=J(o,i,O);break}case"ellipse":v=bt(o,i);break;case"vector_path":{let O=t.block.getString(n,"shape/vector_path/path");v=xt(O);break}case"line":v=J(o,i);break;default:v=J(o,i);break}let{defs:P,body:$}=Mt(String(e),V(m),v,R,k,b,A,T,o,i);return{type:"image",defs:`<defs>${P}</defs>`,body:$,fillAttr:void 0}}function fe(t,e){if(t.length===0)return null;let r=t[0],n=Math.abs(N(r.weight||"normal")-e);for(let o=1;o<t.length;o++){let i=Math.abs(N(t[o].weight||"normal")-e);i<n&&(n=i,r=t[o])}return r}function Tr(t,e,r,n,o){if(t?.fonts?.length){let i=N(e);if(r===null){let p=t.fonts.find(h=>h.uri===n),m=(p?N(p.weight||"normal"):-1)!==i;if(o||m){let h=t.fonts.filter(f=>f.uri!==n);if(h.length>0){let f=fe(h,i);return{uri:f.uri,fontStyle:f.style||"normal"}}}else if(p)return{uri:p.uri,fontStyle:p.style||"normal"}}let a=r||"normal",l=t.fonts.filter(p=>(p.style||"normal")===a),s=fe(l,i);if(s)return{uri:s.uri,fontStyle:s.style||"normal"};let c=t.fonts.find(p=>p.uri===n);if(c)return{uri:c.uri,fontStyle:c.style||"normal"};if(t.fonts.length>0)return{uri:t.fonts[0].uri,fontStyle:t.fonts[0].style||"normal"}}return{uri:n,fontStyle:r||"normal"}}function de(t,e,r,n,o){let i=t.block.getString(e,"text/text");if(i.length===0)return[];let l=[...new Intl.Segmenter("en",{granularity:"grapheme"}).segment(i)],s=l.length,c=!1;for(let m=0;m<s;m++)if(t.block.getTextFontStyles(e,m,m+1).length>0){c=!0;break}let p=[],u=null;for(let m=0;m<s;m++){let h=t.block.getTextColors(e,m,m+1),f=t.block.getTextFontWeights(e,m,m+1),x=t.block.getTextFontStyles(e,m,m+1),S=t.block.getTextFontSizes(e,{from:m,to:m+1,unit:"Pixel"}),y=t.block.getTextCases(e,m,m+1),b=[];try{b=t.block.getTypefaces(e,m,m+1)}catch{r&&(b=[r])}let A=h[0]?_(h[0],t,o):{r:0,g:0,b:0,a:1},R=f[0]||"normal",k=x.length>0?x[0]||"normal":null,T=S[0]||16,v=y[0]||"Normal",P=b[0]||r,$=P?.name||"sans-serif",O=Tr(P,R,k,n,c),G=O.uri,W=O.fontStyle,L=l[m].segment;u&&kt(u.color,A)&&u.fontSize===T&&u.fontWeight===R&&u.fontStyle===W&&u.fontFamily===$&&u.resolvedFontFileUri===G&&u.textCase===v?(u.text+=L,u.to=m+1):(u&&p.push(u),u={from:m,to:m+1,text:L,color:A,fontSize:T,fontWeight:R,fontStyle:W,textCase:v,typeface:P,resolvedFontFileUri:G,fontFamily:$})}return u&&p.push(u),p}function wr(t,e){if(!t.block.getBool(e,"text/automaticFontSizeEnabled"))return{enabled:!1};let n=t.scene.get(),o=t.block.getFloat(e,"text/minAutomaticFontSize"),i=t.block.getFloat(e,"text/maxAutomaticFontSize"),l=t.block.getFloat(n,"scene/dpi")/72;return{enabled:!0,minFontSize:o>0?o*l:void 0,maxFontSize:i>0?i*l:void 0}}async function jt(t,e,r,n){let o=n.logger,a=t.block.getString(e,"text/text").length,l=t.block.getFrameX(e),s=t.block.getFrameY(e),c=t.block.getFrameWidth(e),p=t.block.getFrameHeight(e),u=t.block.getRotation(e),m=t.block.getName(e)||"",h=t.block.getEnum(e,"width/mode"),f=t.block.getEnum(e,"height/mode"),x=t.block.getFloat(e,"text/lineHeight"),S=d(()=>t.block.getString(e,"text/fontFileUri"))??"",y=d(()=>t.block.getTypeface(e))??null;!S&&y&&y.fonts.length>0&&(S=(y.fonts.find(C=>C.weight==="normal"&&C.style==="normal")||y.fonts[0])?.uri||"");let b=x,A=1;if(t.block.getFloat(e,"text/fontSize")>0&&S){let D=await t.editor.getFontMetrics(S),C=(D.ascender-D.descender)/D.unitsPerEm;b=x*C,A=C}else o?.emit("TEXT_LINE_HEIGHT_FALLBACK",{blockId:e});let k=t.block.getEnum(e,"text/horizontalAlignment"),T=t.block.getEnum(e,"text/verticalAlignment"),v=t.block.getFloat(e,"text/letterSpacing"),P=wr(t,e),$={shadowEnabled:t.block.supportsDropShadow(e)&&t.block.isDropShadowEnabled(e),shadowColor:t.block.supportsDropShadow(e)&&t.block.isDropShadowEnabled(e)?_(t.block.getDropShadowColor(e),t,o):null,shadowOffsetX:t.block.supportsDropShadow(e)?t.block.getDropShadowOffsetX(e):0,shadowOffsetY:t.block.supportsDropShadow(e)?t.block.getDropShadowOffsetY(e):0,shadowBlurX:t.block.supportsDropShadow(e)?t.block.getDropShadowBlurRadiusX(e):0,shadowBlurY:t.block.supportsDropShadow(e)?t.block.getDropShadowBlurRadiusY(e):0,strokeEnabled:t.block.supportsStroke(e)&&t.block.isStrokeEnabled(e),strokeColor:t.block.supportsStroke(e)&&t.block.isStrokeEnabled(e)?_(t.block.getStrokeColor(e),t,o):null,strokeWidth:t.block.supportsStroke(e)?t.block.getStrokeWidth(e):0},O=t.block.supportsOpacity(e)?t.block.getOpacity(e):1,G;d(()=>t.block.getBool(e,"backgroundColor/enabled"))&&(G={enabled:!0,color:_(t.block.getColor(e,"backgroundColor/color"),t,o),paddingLeft:t.block.getFloat(e,"backgroundColor/paddingLeft"),paddingTop:t.block.getFloat(e,"backgroundColor/paddingTop"),paddingRight:t.block.getFloat(e,"backgroundColor/paddingRight"),paddingBottom:t.block.getFloat(e,"backgroundColor/paddingBottom"),cornerRadius:t.block.getFloat(e,"backgroundColor/cornerRadius")});let L=(d(()=>t.block.supportsFill(e))&&d(()=>t.block.isFillEnabled(e)))??!0,j=H(t.block.getBlendMode(e));if(a===0){let D=X(t,e,o);return{type:"text",id:e,name:m,x:l,y:s,width:c,height:p,rotation:u,runs:[],horizontalAlignment:k,verticalAlignment:T,lineHeight:b,letterSpacing:v,effects:$,widthMode:h,heightMode:f,opacity:O,backgroundColor:G,lineBreakIndices:[],blendMode:j,fillEnabled:L,emRatio:A,htmlAttributes:D,autoFontSizeEnabled:P.enabled,minAutoFontSize:P.minFontSize,maxAutoFontSize:P.maxFontSize}}let I=de(t,e,y,S,o),Y=[];for(let D of I){let{resolvedFontFileUri:C,fontFamily:U,fontWeight:q,fontStyle:rt}=D,nt=C;if(C&&n.resourceMap){let ut=Gt(C);nt=await n.resourceMap.getUrl(C,"font",ut),r.has(C)||r.set(C,{uri:nt,data:new Uint8Array(0),filename:"",fontFamily:U,fontWeight:q,fontStyle:rt})}else C&&!r.has(C)&&r.set(C,{uri:C,data:new Uint8Array(0),filename:"",fontFamily:U,fontWeight:q,fontStyle:rt});Y.push({text:D.text,color:D.color,fontSize:D.fontSize,fontWeight:q,fontStyle:rt,fontFamily:U,fontUri:C,textCase:D.textCase})}let Kt=[];if(n.insertExplicitLineBreaks){let D=d(()=>t.block.getTextVisibleLineCount(e));if(D!==void 0){let C=t.block.getString(e,"text/text"),U=0;for(let q=0;q<D-1;q++){let rt=t.block.getTextVisibleLineContent(e,q),nt=0;for(;nt<rt.length&&U<C.length;){let cr=C[U],ur=rt[nt];cr.toUpperCase()===ur.toUpperCase()&&nt++,U++}let ut=U>0?C[U-1]:"";ut!==`
2
- `&&ut!=="\u2028"&&ut!=="\u2029"&&Kt.push(U)}}}let lr=X(t,e,o);return{type:"text",id:e,name:m,x:l,y:s,width:c,height:p,rotation:u,runs:Y,horizontalAlignment:k,verticalAlignment:T,lineHeight:b,letterSpacing:v,effects:$,widthMode:h,heightMode:f,opacity:O,backgroundColor:G,lineBreakIndices:Kt,blendMode:j,fillEnabled:L,emRatio:A,insertExplicitLineBreaks:n.insertExplicitLineBreaks,htmlAttributes:lr,autoFontSizeEnabled:P.enabled,minAutoFontSize:P.minFontSize,maxAutoFontSize:P.maxFontSize}}var ot=class extends Error{constructor(r,n,o,i){super(`Cannot convert group "${n}" (ID: ${r}) to HTML: ${i}`);this.groupId=r;this.groupName=n;this.reason=o;this.details=i;this.name="GroupConversionError"}};function Rr(t,e,r){let n=t.block.getName(e)||`Group ${e}`,o=t.block.getBlendMode(e);if(!ht(o))throw r?.emit("GROUP_BLEND_MODE_UNSUPPORTED",{groupName:n,blendMode:o}),new ot(e,n,"blend-mode",`Blend mode "${o}" cannot be represented in CSS. Only "PassThrough" and "Normal" are supported for groups.`);let i=t.block.getOpacity(e);if(i<.999)throw r?.emit("GROUP_OPACITY_UNSUPPORTED",{groupName:n,opacity:i.toFixed(2)}),new ot(e,n,"opacity",`Group opacity (${i.toFixed(2)}) cannot be represented in CSS. CSS opacity cascades multiplicatively to children, which differs from CE.SDK behavior.`);let a=t.block.getChildren(e);for(let l of a)if(t.block.getType(l)==="//ly.img.ubq/group"){let c=t.block.getBlendMode(l);if(!ht(c)){let p=t.block.getName(l)||`Group ${l}`;throw r?.emit("GROUP_NESTED_BLEND_MODE_UNSUPPORTED",{groupName:n,childName:p,childBlend:c}),new ot(e,n,"nested-blend",`Nested group "${p}" has blend mode "${c}" which cannot be represented in CSS when nested inside another group.`)}}}async function ge(t,e,r,n,o,i,a,l){Rr(t,e,n.logger);let s=t.block.getChildren(e),c=[],p=t.block.getRotation(e),u=t.block.getFrameX(e),m=t.block.getFrameY(e);for(let S=0;S<s.length;S++){let y=s[S],b=await a(t,y,r,n,S,l);if(b){let A=Dt(b.x,b.y,u,m,p),R=b.rotation-p,k=t.block.getFlipHorizontal(y),T=t.block.getFlipVertical(y),v=ft(A.x,A.y,b.width,b.height,R,k,T);b.x=v.x,b.y=v.y,b.rotation=R,c.push(b)}}c.sort(pt);let h=X(t,e,n.logger),f=t.block.getFrameWidth(e),x=t.block.getFrameHeight(e);return{type:"group",id:e,name:t.block.getName(e)||"",x:u,y:m,width:f,height:x,rotation:p,blendMode:H(t.block.getBlendMode(e)),sortingOrder:o,originalIndex:i,opacity:1,children:c,htmlAttributes:h}}var he="//ly.img.ubq/animation/",Cr="animation/",vr=new Set(["animationEasing","duration","type","playback/timeOffset","playback/duration","textAnimationWritingStyle","textAnimationOverlap"]);function ye(t,e,r=!1){if(!d(()=>t.block.supportsAnimation(e)))return;let n=Nt(t,e,"in"),o=Nt(t,e,"loop"),i=Nt(t,e,"out");if(!n&&!o&&!i)return;let a={...n&&{inAnimation:n.config},...o&&{loopAnimation:o.config},...i&&{outAnimation:i.config}};if(r){let l=n?.animBlockId??i?.animBlockId??o?.animBlockId;if(l!==void 0){let s=d(()=>t.block.getEnum(l,"textAnimationWritingStyle"));if(s&&s!=="Block"){a.textWritingStyle=s;let c=d(()=>t.block.getFloat(l,"textAnimationOverlap"));c!==void 0&&c!==0&&(a.textOverlap=c)}}}return a}function Nt(t,e,r){let n;if(r==="in"?n=d(()=>t.block.getInAnimation(e)):r==="loop"?n=d(()=>t.block.getLoopAnimation(e)):n=d(()=>t.block.getOutAnimation(e)),!(n===void 0||!t.block.isValid(n)))return{config:kr(t,n),animBlockId:n}}function kr(t,e){let r=t.block.getType(e),n=r.startsWith(he)?r.slice(he.length):r,o=t.block.getDuration(e),i=d(()=>t.block.getEnum(e,"animationEasing"))??"Linear",a=Pr(t,e,n);return{type:n,duration:o,easing:i,properties:a}}function Pr(t,e,r){let n={},o=d(()=>t.block.findAllProperties(e));if(o){let i=`${Cr}${r}/`;for(let a of o){if(!a.startsWith(i)||vr.has(a))continue;let l=a.slice(i.length),s=d(()=>t.block.getPropertyType(a));if(!s)continue;let c;s==="Bool"?c=d(()=>t.block.getBool(e,a)):s==="Float"?c=d(()=>t.block.getFloat(e,a)):s==="Enum"?c=d(()=>t.block.getEnum(e,a)):s==="String"&&(c=d(()=>t.block.getString(e,a))),c!==void 0&&(n[l]=c)}}return n}function Fr(t,e){let r=d(()=>t.block.getTimeOffset(e)),n=d(()=>t.block.getDuration(e));if(!(r===void 0||n===void 0)&&!(r===0&&!Number.isFinite(n))&&!(n<=0))return{timeOffset:r,duration:n}}function X(t,e,r){let n=t.block.getName(e)||"",o={"data-block-id":String(e),"data-block-name":n},i=d(()=>t.block.findAllMetadata(e));if(i){for(let a of i)if(a.startsWith(yt)){let l=a.slice(yt.length),s=t.block.getMetadata(e,a);!l.startsWith("data-")&&!l.startsWith("aria-")&&r?.emit("METADATA_NON_DATA_ATTR",{blockId:e,key:a,attrName:l}),o[l]=s}}return o}async function be(t,e,r,n,o,i,a){let l=t.block.getRotation(e),s=t.block.getName(e)||"",c=H(t.block.getBlendMode(e)),p=Math.ceil(t.block.getFrameWidth(e)),u=Math.ceil(t.block.getFrameHeight(e)),m=d(()=>t.block.getOpacity(e))??1;m<1&&t.block.setOpacity(e,1);let h=await t.block.export(e,{mimeType:"image/webp",webpQuality:r,targetWidth:p,targetHeight:u});m<1&&t.block.setOpacity(e,m);let f=await h.arrayBuffer(),x=new Uint8Array(f),S=`temp://export/${e}.webp`,y=await i.registerWithData(S,"image","image/webp",x),b={x:t.block.getFrameX(e),y:t.block.getFrameY(e),width:t.block.getFrameWidth(e),height:t.block.getFrameHeight(e)},{x:A,y:R}=b,{width:k,height:T}=b;t.block.supportsStroke(e)&&t.block.isStrokeEnabled(e)&&({x:A,y:R,width:k,height:T}=mt({x:A,y:R,width:k,height:T},t.block.getStrokeWidth(e),t.block.getStrokePosition(e)));let v=X(t,e,a),P=d(()=>t.block.getOpacity(e))??1,$=V(y),O=`<image href="${F($)}" width="${g(k)}" height="${g(T)}" preserveAspectRatio="none"/>`;return{type:"svg",id:e,name:s,x:A,y:R,width:k,height:T,rotation:l,viewBox:`0 0 ${g(k)} ${g(T)}`,svgContent:O,opacity:P,blendMode:c,sortingOrder:n,originalIndex:o,htmlAttributes:v}}function xe(t,e,r){return t.sortingOrder=e,t.originalIndex=r,t}async function Se(t,e,r,n,o,i){if(!d(()=>t.block.isValid(e))||!d(()=>t.block.isVisible(e)))return null;let a=t.block.getType(e),l=a==="//ly.img.ubq/group",s=a==="//ly.img.ubq/text",c=a==="//ly.img.ubq/graphic",p=Pt(t,e),u=null;if(l)u=await ge(t,e,r,n,p,o,Se,i);else if(s){let m=await jt(t,e,r,{insertExplicitLineBreaks:n.insertExplicitLineBreaks,logger:n.logger,resourceMap:i});u=xe(m,p,o)}else if(c){let m=await Bt(t,e,i,n.logger);m?u=xe(m,p,o):u=await be(t,e,n.quality,p,o,i,n.logger)}else u=await be(t,e,n.quality,p,o,i,n.logger);return u&&n.animated&&t.block.getName(e)!=="page-background"&&(u.timeline=Fr(t,e),u.animation=ye(t,e,s)),u}async function Ae(t,e,r,n,o){let{pageId:i}=e,a=t.block.getChildren(i),l=[];for(let c of a)t.block.getType(c)==="//ly.img.ubq/track"?l.push(...t.block.getChildren(c)):l.push(c);if(a=l,n.animated){let c=d(()=>t.block.getDuration(i));c!==void 0&&d(()=>t.block.setPlaybackTime(i,c/2))}let s=[];for(let c=0;c<a.length;c++){z(n.abortSignal);let p=a[c],u=await Se(t,p,r,n,c,o);if(u){let m=t.block.getFlipHorizontal(p),h=t.block.getFlipVertical(p),f=ft(u.x,u.y,u.width,u.height,u.rotation,m,h);u.x=f.x,u.y=f.y,s.push(u)}}return s}async function Ee(t,e,r,n){let o=r.logger??new K,i=r.logger?r:{...r,logger:o},a=[];for(let l of e.pages){if(l.pageIndex!==r.pageIndex)continue;z(r.abortSignal);let s=new Map,c=await Ae(t,l,s,i,n);c.sort(pt),i.useSyntheticIds&&Or(c);let p,u=l.pageId;t.block.isValid(u)&&t.block.supportsFill(u)&&!t.block.isFillEnabled(u)&&(p="transparent");let m;if(r.animated&&c.some(y=>y.timeline)){let y;try{y=t.block.getDuration(u)}catch{y=c.reduce((b,A)=>A.timeline?Math.max(b,A.timeline.timeOffset+A.timeline.duration):b,0)}y>0&&(m={totalDuration:y})}a.push({pageIndex:l.pageIndex,width:l.width,height:l.height,elements:c,fonts:s,backgroundColor:p,timeline:m});let h=c.filter(S=>S.type==="text").length,f=c.filter(S=>S.type==="svg").length,x=c.filter(S=>S.type==="group").length;o.emit("HTML_PAGE_PROCESSED",{page:l.pageIndex+1,textCount:h,svgCount:f,groupCount:x,fontCount:s.size})}return{pages:a}}function Dr(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Or(t){let e=new Map;n(t,e);let r=0;function n(i,a){for(let l of i)l.name&&a.set(l.name,(a.get(l.name)||0)+1),l.type==="group"&&l.children&&n(l.children,a)}function o(i){for(let a of i){let l=r++;a.id=l;let s;a.name&&e.get(a.name)===1?s=Dr(a.name):(s=`element-${l}`,a.name||(a.name=s)),a.htmlAttributes&&(a.htmlAttributes.id=s,a.htmlAttributes["data-block-id"]=String(l)),a.type==="group"&&a.children&&o(a.children)}}o(t)}var dt=null;function Lr(){if(dt)return dt;dt=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;dt[t]=e}return dt}function Te(t){let e=4294967295,r=Lr();for(let n=0;n<t.length;n++)e=e>>>8^r[(e^t[n])&255];return(e^4294967295)>>>0}function zt(t){return new TextEncoder().encode(t)}function Mr(t){let e=t.reduce((o,i)=>o+i.length,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function w(t,e,r){t[e]=r&255,t[e+1]=r>>>8&255}function M(t,e,r){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24&255}async function we(t){let e=[],r=[],n=0;for(let[l,s]of t){let c=typeof s=="string"?zt(s):s,p=zt(l),u=new Uint8Array(30+p.length);M(u,0,67324752),w(u,4,20),w(u,6,0),w(u,8,0),w(u,10,0),w(u,12,0),M(u,14,Te(c)),M(u,18,c.length),M(u,22,c.length),w(u,26,p.length),w(u,28,0),u.set(p,30),e.push({name:l,data:c,offset:n}),r.push(u,c),n+=u.length+c.length}let o=n;for(let l of e){let s=zt(l.name),c=new Uint8Array(46+s.length);M(c,0,33639248),w(c,4,20),w(c,6,20),w(c,8,0),w(c,10,0),w(c,12,0),w(c,14,0),M(c,16,Te(l.data)),M(c,20,l.data.length),M(c,24,l.data.length),w(c,28,s.length),w(c,30,0),w(c,32,0),w(c,34,0),w(c,36,0),M(c,38,0),M(c,42,l.offset),c.set(s,46),r.push(c),n+=c.length}let i=n-o,a=new Uint8Array(22);return M(a,0,101010256),w(a,4,0),w(a,6,0),w(a,8,e.length),w(a,10,e.length),M(a,12,i),M(a,16,o),w(a,20,0),r.push(a),Mr(r)}var et=class extends Map{async toZip(){let e=new Map;for(let[r,n]of this)e.set(r,n.content);return we(e)}};function Et(t,e,r,n,o){t.push(`left: ${Math.round(e)}px`),t.push(`top: ${Math.round(r)}px`),t.push(`width: ${Math.round(n)}px`),t.push(`height: ${Math.round(o)}px`)}function it(t,e){if(e!==0){let r=e*180/Math.PI;t.push(`transform: rotate(${r.toFixed(2)}deg)`),t.push("transform-origin: center")}}function at(t,e){e&&t.push(`mix-blend-mode: ${e}`)}function Tt(t,e){e<1&&t.push(`opacity: ${e.toFixed(2)}`)}function st(t){return t.timeline?` data-timeline-offset="${g(t.timeline.timeOffset,3)}" data-timeline-duration="${g(t.timeline.duration,3)}"`:""}function lt(t){return t?` data-animation='${JSON.stringify(t)}'`:""}var _r={Linear:"none",EaseIn:"power1.in",EaseOut:"power1.out",EaseInOut:"power1.inOut",EaseInQuart:"power3.in",EaseOutQuart:"power3.out",EaseInOutQuart:"power3.inOut",EaseInQuint:"power4.in",EaseOutQuint:"power4.out",EaseInOutQuint:"power4.inOut",EaseInBack:"back.in(1.7)",EaseOutBack:"back.out(1.7)",EaseInOutBack:"back.inOut(1.7)",EaseInSpring:"elastic.in(1, 0.3)",EaseOutSpring:"elastic.out(1, 0.3)",EaseInOutSpring:"elastic.inOut(1, 0.3)"};function E(t){return _r[t]??"none"}function Re(t,e){let r=E(t.easing),n=t.duration;return e==="in"?{from:{opacity:0},ease:r,duration:n}:e==="out"?{to:{opacity:0},ease:r,duration:n}:null}function $r(t,e){let r=e.elementX+e.elementWidth/2,n=e.elementY+e.elementHeight/2,o=e.elementWidth/2,i=e.elementHeight/2,a=-o,l=e.pageWidth+o,s=-i,c=e.pageHeight+i,p=Math.cos(t),u=Math.sin(t),m=1/0;if(p!==0){let h=(l-r)/p,f=(a-r)/p;h>0&&(m=Math.min(m,h)),f>0&&(m=Math.min(m,f))}if(u!==0){let h=(c-n)/u,f=(s-n)/u;h>0&&(m=Math.min(m,h)),f>0&&(m=Math.min(m,f))}return isFinite(m)?{x:Math.round(p*m)||0,y:Math.round(u*m)||0}:{x:0,y:0}}function Ce(t,e,r){let n=E(t.easing),o=t.duration,i=t.properties.direction??0,a=t.properties.fade,l=$r(i,r);return e==="in"?{from:{x:-l.x||0,y:-l.y||0,...a?{opacity:0}:{}},ease:n,duration:o}:e==="out"?{to:{x:l.x||0,y:l.y||0,...a?{opacity:0}:{}},ease:n,duration:o}:null}function ve(t,e,r){let n=E(t.easing),o=t.duration,i=t.properties.direction??0,a=t.properties.distance??.5,l=t.properties.fade,s=Math.max(r.pageWidth,r.pageHeight)*a,c=-Math.round(Math.cos(i)*s)||0,p=-Math.round(Math.sin(i)*s)||0;return e==="in"?{from:{x:c,y:p,...l?{opacity:0}:{}},ease:n,duration:o}:e==="out"?{to:{x:-c||0,y:-p||0,...l?{opacity:0}:{}},ease:n,duration:o}:null}function ke(t,e){let r=E(t.easing),n=t.duration,o=t.properties.intensity??.5,i=Math.round(o*20),a=t.properties.fade;return e==="in"?{from:{filter:`blur(${i}px)`,...a?{opacity:0}:{}},ease:r,duration:n}:e==="out"?{to:{filter:`blur(${i}px)`,...a?{opacity:0}:{}},ease:r,duration:n}:null}var Gr={All:"center",Horizontal:"center",Vertical:"center",TopLeft:"top left",TopRight:"top right",BottomLeft:"bottom left",BottomRight:"bottom right"};function Ur(t,e){let r=Gr[t]??"center";switch(t){case"Horizontal":return{scaleX:e,scaleY:1,transformOrigin:r};case"Vertical":return{scaleX:1,scaleY:e,transformOrigin:r};default:return{scaleX:e,scaleY:e,transformOrigin:r}}}function Pe(t,e){let r=E(t.easing),n=t.duration,o=t.properties.direction??"All",i=t.properties.scaleFactor??0,a=Ur(o,i);return e==="in"?{from:a,ease:r,duration:n}:e==="out"?{to:a,ease:r,duration:n}:null}function Fe(t,e){let r=E(t.easing),n=t.duration,o=t.properties.fade;return e==="in"?{from:{scale:2.5,...o?{opacity:0}:{}},ease:r,duration:n}:e==="out"?{to:{scale:2.5,...o?{opacity:0}:{}},ease:r,duration:n}:null}function De(t,e){let r=t.duration;return e==="in"?{from:{scale:0},ease:"none",duration:r,customEase:"springOut",extraTweens:[{from:{opacity:0},ease:"none",duration:r/2,relativeOffset:0}]}:e==="out"?{to:{scale:0},ease:"none",duration:r,customEase:"springIn",extraTweens:[{to:{opacity:0},ease:"none",duration:r/2,relativeOffset:r/2}]}:null}var Oe={Right:"inset(0 100% 0 0)",Left:"inset(0 0 0 100%)",Down:"inset(0 0 100% 0)",Up:"inset(100% 0 0 0)"},Le={Right:"inset(0 0 0 100%)",Left:"inset(0 100% 0 0)",Down:"inset(100% 0 0 0)",Up:"inset(0 0 100% 0)"};function Me(t,e){let r=E(t.easing),n=t.duration,o=t.properties.direction??"Right";return e==="in"?{from:{clipPath:Oe[o]??Oe.Right},ease:r,duration:n}:e==="out"?{to:{clipPath:Le[o]??Le.Right},ease:r,duration:n}:null}function Br(t,e){switch(t){case"Up":return{clipPath:"inset(0 0 100% 0)",y:e.elementHeight};case"Down":return{clipPath:"inset(100% 0 0 0)",y:-e.elementHeight};case"Left":return{clipPath:"inset(0 100% 0 0)",x:e.elementWidth};case"Right":return{clipPath:"inset(0 0 0 100%)",x:-e.elementWidth};default:return{clipPath:"inset(0 0 100% 0)",y:e.elementHeight}}}function jr(t,e){switch(t){case"Up":return{clipPath:"inset(100% 0 0 0)",y:-e.elementHeight};case"Down":return{clipPath:"inset(0 0 100% 0)",y:e.elementHeight};case"Left":return{clipPath:"inset(0 0 0 100%)",x:-e.elementWidth};case"Right":return{clipPath:"inset(0 100% 0 0)",x:e.elementWidth};default:return{clipPath:"inset(100% 0 0 0)",y:-e.elementHeight}}}function _e(t,e,r){let n=E(t.easing),o=t.duration,i=t.properties.direction??"Up";return e==="in"?{from:Br(i,r),ease:n,duration:o}:e==="out"?{to:jr(i,r),ease:n,duration:o}:null}function $e(t,e){let r=E(t.easing),n=t.duration,o=t.properties.scale??1.5,i=t.properties.fade;return e==="in"?{from:{scale:o,...i?{opacity:0}:{}},ease:r,duration:n,target:"content"}:e==="out"?{to:{scale:o,...i?{opacity:0}:{}},ease:r,duration:n,target:"content"}:null}function Ge(t,e){let r=E(t.easing),n=t.duration,o=t.properties.direction!=="CounterClockwise",i=t.properties.intensity??1,a=t.properties.fade,l=i*360;return e==="in"?{from:{rotation:o?-l:l,...a?{opacity:0}:{}},ease:r,duration:n}:e==="out"?{to:{rotation:o?l:-l,...a?{opacity:0}:{}},ease:r,duration:n}:null}var Ue={Up:t=>({yPercent:t}),Down:t=>({yPercent:-t}),Right:t=>({xPercent:-t}),Left:t=>({xPercent:t})};function Be(t,e){let r=E(t.easing),n=t.duration,o=t.properties.direction??"Right",i=(t.properties.travelDistanceRatio??.1)*100,a=t.properties.zoomIntensity??1.2,l=a>=0?1+a:1/(1-a),s=t.properties.fade,p=(Ue[o]??Ue.Right)(i);if(e==="in")return{from:{scale:l,...p,...s?{opacity:0}:{}},ease:r,duration:n,target:"content"};if(e==="out"){let u={};for(let[m,h]of Object.entries(p))u[m]=-h;return{to:{scale:l,...u,...s?{opacity:0}:{}},ease:r,duration:n,target:"content"}}return null}function je(t,e){if(e!=="loop")return null;let r=t.duration;return{to:{rotation:t.properties.direction==="CounterClockwise"?-360:360},ease:"none",duration:r,noYoyo:!0}}function Ne(t,e){if(e!=="loop")return null;let r=t.duration;return{from:{opacity:0},to:{opacity:1},ease:"power1.inOut",duration:r}}function ze(t,e){if(e!=="loop")return null;let r=t.duration,n=t.properties.intensity??.5;return{to:{filter:`blur(${Math.round(n*20)}px)`},ease:"power1.inOut",duration:r}}function He(t,e){if(e!=="loop")return null;let r=t.duration,n=Math.max(0,Math.min(1,t.properties.intensity??.5)),o=1.25+(2.5-1.25)*n,i=r/3,a=r*2/3;return{to:{scale:o},ease:"power1.out",duration:i,noYoyo:!0,extraTweens:[{to:{scale:1},ease:"power1.out",duration:a,relativeOffset:i}]}}function We(t,e){if(e!=="loop")return null;let r=t.duration,n=Math.max(0,Math.min(1,t.properties.intensity??.5));return{to:{scale:1.25+(2.5-1.25)*n},ease:"power1.inOut",duration:r}}function Ie(t,e){if(e!=="loop")return null;let r=t.duration,n=t.properties.direction??"Up",i=Math.max(0,Math.min(1,t.properties.intensity??.5))*100,a={Up:{yPercent:i},Down:{yPercent:-i},Right:{xPercent:-i},Left:{xPercent:i}},l={Up:{yPercent:-i},Down:{yPercent:i},Right:{xPercent:i},Left:{xPercent:-i}};return{from:a[n]??a.Up,to:l[n]??l.Up,ease:"power1.inOut",duration:r}}function Ve(t,e){if(e!=="loop")return null;let r=t.duration;return{from:{scaleX:1,scaleY:.7},to:{scaleX:.7,scaleY:1},ease:"power1.inOut",duration:r}}function Xe(t,e){if(e!=="loop")return null;let r=t.duration,o=15+30*Math.max(0,Math.min(1,t.properties.intensity??.5));return{from:{rotation:-o},to:{rotation:o},ease:"power1.inOut",duration:r}}function Ye(t,e){let r=E(t.easing),n=t.duration;return e==="in"?{from:{opacity:0},ease:r,duration:n}:e==="out"?{to:{opacity:0},ease:r,duration:n}:null}function qe(t,e){return console.warn("[html5-exporter] Animation handler 'block_swipe_text' not yet implemented."),null}function Ke(t,e){let r=E(t.easing),n=t.duration,o=t.properties.fade!==!1;return e==="in"?{from:o?{opacity:0}:void 0,ease:r,duration:n}:e==="out"?{to:o?{opacity:0}:void 0,ease:r,duration:n}:null}function Ze(t,e){let r=E(t.easing),n=t.duration;return e==="in"?{from:{opacity:0},ease:r,duration:n}:e==="out"?{to:{opacity:0},ease:r,duration:n}:null}var Qe=new Map([["fade",Re],["slide",Ce],["pan",ve],["blur",ke],["grow",Pe],["zoom",Fe],["pop",De],["wipe",Me],["baseline",_e],["crop_zoom",$e],["spin",Ge],["ken_burns",Be],["spin_loop",je],["fade_loop",Ne],["blur_loop",ze],["pulsating_loop",He],["breathing_loop",We],["jump_loop",Ie],["squeeze_loop",Ve],["sway_loop",Xe],["typewriter_text",Ye],["block_swipe_text",qe],["spread_text",Ke],["merge_text",Ze]]);function wt(t,e,r){let n=Qe.get(t.type);return n?n(t,e,r):(console.warn(`[html5-exporter] No animation handler registered for type "${t.type}". Element will be static.`),null)}function ct(t,e,r,n,o,i,a){if(!t)return;let l={elementX:e,elementY:r,elementWidth:n,elementHeight:o,pageWidth:i,pageHeight:a},s={};if(t.inAnimation){let p=wt(t.inAnimation,"in",l);p&&(s.in=p)}if(t.loopAnimation){let p=wt(t.loopAnimation,"loop",l);p&&(s.loop=p)}if(t.outAnimation){let p=wt(t.outAnimation,"out",l);p&&(s.out=p)}t.textWritingStyle&&(s.textWritingStyle=t.textWritingStyle,t.textOverlap!==void 0&&(s.textOverlap=t.textOverlap));let c=t.inAnimation??t.outAnimation;if(c?.type==="spread_text"){let p=c.properties.intensity??1;s.spread={intensity:p,blockWidth:n},s.textWritingStyle="Character",s.textOverlap=1}if(c?.type==="merge_text"){let p=c.properties.intensity??1,u=c.properties.direction??"Left",m=Math.max(i,a)*.1*p;s.merge={distance:m,direction:u},s.textWritingStyle="Word",s.textOverlap=.4}return Object.keys(s).length>0?s:void 0}function Nr(t){let e=[];return Et(e,t.x,t.y,t.width,t.height),it(e,t.rotation),at(e,t.blendMode),e.join("; ")}function Je(t,e,r,n,o){let i=t.children.map((s,c)=>r(s,c,e,n,o)).join(`
3
- `),a=Q({defaultId:`el-${e}-${t.id}`,defaultClass:"group-element",style:Nr(t),htmlAttributes:t.htmlAttributes}),l=ct(t.animation,t.x,t.y,t.width,t.height,n,o);return` <div ${Z(a)}${st(t)}${lt(l)}>
4
- ${i}
5
- </div>`}function zr(t){let e=[];return Et(e,t.x,t.y,t.width,t.height),e.push("overflow: hidden"),Tt(e,t.opacity),it(e,t.rotation),at(e,t.blendMode),e.join("; ")}function tr(t,e,r,n){let o=Q({defaultId:`el-${e}-${t.id}`,defaultClass:"element",style:zr(t),htmlAttributes:t.htmlAttributes}),i=ct(t.animation,t.x,t.y,t.width,t.height,r,n),a=Z(o),l=`viewBox="${t.viewBox}"`;return` <svg ${a} ${l} preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"${st(t)}${lt(i)}>
6
- ${t.svgContent}
7
- </svg>`}function er(t,e,r,n){let o=[],i=t.backgroundColor?.enabled?t.backgroundColor.paddingLeft:0,a=t.backgroundColor?.enabled?t.backgroundColor.paddingTop:0;o.push(`left: ${Math.round(t.x-i)}px`),o.push(`top: ${Math.round(t.y-a)}px`);let l=t.backgroundColor?.enabled?t.backgroundColor.paddingRight:0,s=t.backgroundColor?.enabled?t.backgroundColor.paddingBottom:0,c=t.horizontalAlignment!=="Left";t.widthMode==="Auto"?(o.push("white-space: nowrap"),(t.rotation!==0||c)&&o.push(`width: ${Math.ceil(t.width+i+l)}px`)):(o.push(`width: ${Math.ceil(t.width+i+l)}px`),t.autoFontSizeEnabled?(o.push("white-space: pre-wrap"),o.push("overflow-wrap: break-word")):t.insertExplicitLineBreaks?o.push("white-space: nowrap"):(o.push("white-space: pre-wrap"),o.push("overflow-wrap: break-word"))),(t.heightMode!=="Auto"||t.rotation!==0)&&o.push(`height: ${Math.ceil(t.height+a+s)}px`);let p={Left:"left",Center:"center",Right:"right"};if(o.push(`text-align: ${p[t.horizontalAlignment]||"left"}`),t.verticalAlignment!=="Top"&&(o.push("display: flex"),o.push("flex-direction: column"),t.verticalAlignment==="Center"?o.push("justify-content: center"):t.verticalAlignment==="Bottom"&&o.push("justify-content: flex-end")),it(o,t.rotation),t.effects.shadowEnabled&&t.effects.shadowColor){let m=(t.effects.shadowBlurX+t.effects.shadowBlurY)/2*.56,h=`${g(t.effects.shadowOffsetX,1)}px ${g(t.effects.shadowOffsetY,1)}px ${m.toFixed(1)}px ${B(t.effects.shadowColor)}`;o.push(`text-shadow: ${h}`)}if(t.effects.strokeEnabled&&t.effects.strokeColor&&o.push(`-webkit-text-stroke: ${g(t.effects.strokeWidth,1)}px ${B(t.effects.strokeColor)}`),Tt(o,t.opacity),t.backgroundColor?.enabled){let u=t.backgroundColor;o.push(`background: ${B(u.color)}`),o.push(`padding: ${g(u.paddingTop,1)}px ${g(u.paddingRight,1)}px ${g(u.paddingBottom,1)}px ${g(u.paddingLeft,1)}px`),u.cornerRadius>0&&o.push(`border-radius: ${g(u.cornerRadius,1)}px`)}return at(o,t.blendMode),Hr(t,e,o,r,n)}function Hr(t,e,r,n,o){let i=t.insertExplicitLineBreaks&&!t.autoFontSizeEnabled?new Set(t.lineBreakIndices):null,a=0,l=t.runs.map(f=>{let x=[];x.push(`font-family: '${f.fontFamily}', sans-serif`),x.push(`font-size: ${g(f.fontSize)}px`),t.lineHeight>0&&x.push(`line-height: ${g(t.lineHeight,4)}`),t.letterSpacing!==0&&x.push(`letter-spacing: ${g(t.letterSpacing,4)}em`);let S=N(f.fontWeight);if(S!==400&&x.push(`font-weight: ${S}`),f.fontStyle==="italic"&&x.push("font-style: italic"),t.fillEnabled?x.push(`color: ${B(f.color)}`):x.push("color: transparent"),f.textCase&&f.textCase!=="Normal"){let b={Uppercase:"uppercase",Lowercase:"lowercase",Titlecase:"capitalize"};b[f.textCase]&&x.push(`text-transform: ${b[f.textCase]}`)}let y="";for(let b=0;b<f.text.length;b++){let A=f.text[b],R=A===`
8
- `||A==="\u2028"||A==="\u2029";i?.has(a)&&!R&&(y+="<br>"),R?y+="<br>":y+=Ft(A),a++}return y=y.replaceAll(" <br>","&nbsp;<br>"),`<span style="${x.join("; ")}">${y}</span>`}).join(""),c=t.autoFontSizeEnabled&&t.widthMode==="Absolute"&&t.heightMode==="Absolute"?{...t.htmlAttributes,"data-auto-size":"true",...t.minAutoFontSize!=null&&{"data-min-font-size":String(t.minAutoFontSize)},...t.maxAutoFontSize!=null&&{"data-max-font-size":String(t.maxAutoFontSize)}}:t.htmlAttributes,p=Q({defaultId:`el-${e}-${t.id}`,defaultClass:"text-element",style:r.join("; "),htmlAttributes:c}),u=ct(t.animation,t.x,t.y,t.width,t.height,n,o),m=["font-size: 0"];if(t.lineHeight>0&&t.runs.length>0&&t.emRatio>0){let f=Math.max(...t.runs.map(y=>y.fontSize)),S=(t.lineHeight-t.emRatio)*f/2;Math.abs(S)>.5&&(m.push(`margin-top: ${(-S).toFixed(1)}px`),m.push(`margin-bottom: ${(-S).toFixed(1)}px`))}let h=m.length>0?` style="${m.join("; ")}"`:"";return` <div ${Z(p)}${st(t)}${lt(u)}><div${h}>${l}</div></div>`}function Wr(t){if(t.startsWith("data:")){let e=me(t);return e?.includes("woff2")?"woff2":e?.includes("woff")?"woff":e?.includes("opentype")||e?.includes("otf")?"opentype":"truetype"}return t.endsWith(".woff2")?"woff2":t.endsWith(".woff")?"woff":t.endsWith(".otf")?"opentype":"truetype"}function rr(t){let e=[];for(let[,r]of t){let n=tt(r.uri),o=At(r.uri),i=Ut(r.uri)||n||o;if(r.data.length===0&&!i)continue;let a=V(r.uri),l;Ut(r.uri)?l=`url(${r.uri})`:n?l=`url('${r.uri}')`:l=`url('${a}')`;let s=Wr(r.uri);e.push(` @font-face {
9
- font-family: '${r.fontFamily}';
10
- font-weight: ${N(r.fontWeight)};
11
- font-style: ${r.fontStyle};
12
- src: ${l} format('${s}');
13
- }`)}return e.join(`
14
- `)}var Rt;function nr(){return Rt!=null||(Rt=`
15
- (function() {
1
+ const e={silent:0,error:1,warn:2,info:3};function t(t,n=`info`){e.silent>=e[n]&&console.error(t)}function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}function a(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=class extends Error{constructor(e=`Operation aborted`){super(e),a(this,`name`,`AbortError`)}};function s(e){if(e?.aborted)throw new o(e.reason instanceof Error?e.reason.message:String(e.reason??`Operation aborted`))}function c(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>{if(!(r in t))throw Error(`Missing param "${r}" for warning template: ${e}`);return String(t[r])})}var l=class{constructor(e){a(this,`registry`,void 0),a(this,`messages`,[]),this.registry=e}emit(e,t={}){let n=this.registry[e];this.messages.push({code:e,type:n.severity,message:c(n.template,t),params:t})}getMessages(){return this.messages}};function u(e){return e.scene.get()!==null&&e.scene.getAngleUnit?.()===`Degree`}function d(e,t){return u(e)?t*Math.PI/180:t}function f(e){return Number.isFinite(e)&&e>=0?e:0}const p={id:void 0,exportOptions:e=>e,end:()=>{},cancel:()=>{}};function m(e,t){let n=e.editor;if(typeof n.beginExportTransaction!=`function`||typeof n.endExportTransaction!=`function`||typeof n.cancelExportTransaction!=`function`)return p;let r;try{r=n.beginExportTransaction(t.type,t.format,t.producer,t.block)}catch{return p}let i=t.warn??(e=>console.warn(e)),a=()=>{try{n.cancelExportTransaction(r)}catch(e){i(`The export transaction of a ${t.type} export did not cancel: ${e}`)}};return{id:r,exportOptions:e=>({...e,transactionId:r}),end:(e,o)=>{try{n.endExportTransaction(r,f(e),f(o))}catch(e){i(`The ${t.type} export is complete, but its export transaction did not end: ${e}`),a()}},cancel:a}}const h={SVG_SHAPE_RASTERIZED_EFFECTS:{severity:`info`,template:`Shape "{name}" has effects and will be rasterized.`},SVG_SHAPE_ID_INVALID:{severity:`warning`,template:`Shape ID is invalid for block "{name}". Will be rasterized.`},SVG_SHAPE_TYPE_UNSUPPORTED:{severity:`info`,template:`Shape type "{shapeType}" is not supported for SVG. Will be rasterized.`},SVG_VECTOR_PATH_READ_FAILED:{severity:`warning`,template:`Could not read vector path for "{name}". Will be rasterized.`},SVG_STROKE_POSITION_DEFAULTED:{severity:`info`,template:`Stroke position "{strokePosition}" on "{name}" rendered as Center (SVG default).`},SVG_FILL_INVALID:{severity:`warning`,template:`Fill is invalid for shape "{name}". Will be rasterized.`},SVG_STROKE_ROUND_DASH_RASTERIZED:{severity:`info`,template:`Shape "{name}" has a dashed {strokePosition} stroke, whose dashes SVG cannot place as CE.SDK does. Will be rasterized.`},SVG_STROKE_CAPS_RASTERIZED:{severity:`info`,template:`Shape "{name}" has different caps on its ends or dashes, or a dash pattern that draws no length, and SVG cannot draw its caps as CE.SDK does. Will be rasterized.`},SVG_STROKE_FILL_RASTERIZED:{severity:`info`,template:`Shape "{name}" has a stroke with a fill other than a single color, which SVG cannot draw as CE.SDK does. Will be rasterized.`},SVG_LINE_FILL_RASTERIZED:{severity:`info`,template:`Line "{name}" paints its image or gradient fill along its stroke, which SVG cannot draw. Will be rasterized.`},SVG_FILL_TYPE_UNSUPPORTED:{severity:`info`,template:`Fill type "{fillType}" on "{name}" is not supported for SVG. Will be rasterized.`},SVG_IMAGE_URI_MISSING:{severity:`warning`,template:`Could not read image URI for "{name}". Will be rasterized.`},SVG_IMAGE_URI_EMPTY:{severity:`warning`,template:`Empty image URI for "{name}". Will be rasterized.`},SVG_IMAGE_RESOLVE_FAILED:{severity:`warning`,template:`Failed to resolve image "{imageUri}" for "{name}". Will be rasterized.`},RESOURCE_LOAD_FAILED:{severity:`warning`,template:`Could not load resource data: {originalUri}`},RESOURCE_FILE_COLLECTED:{severity:`info`,template:`Collected resource file: {relativePath}`},TEXT_LINE_HEIGHT_FALLBACK:{severity:`warning`,template:`Block {blockId}: missing font URI or zero font size, line-height will use raw CE.SDK value`},TEXT_BAKE_MULTI_COLOR_SKIPPED:{severity:`warning`,template:`Cannot vectorize multi-color text block "{name}" (ID: {blockId}). Skipping vectorization.`},TEXT_BAKE_VECTORIZED:{severity:`info`,template:`Vectorized text block "{name}" (ID: {blockId} -> {vectorizedBlockId})`},TEXT_BAKE_FAILED:{severity:`warning`,template:`Failed to vectorize text block "{name}" (ID: {blockId})`},COLOR_CONVERTED_TO_SRGB:{severity:`warning`,template:`{colorType} color encountered and will be converted to sRGB. HTML5 does not support {colorType} colors.`},SCENE_DESIGN_UNIT_CONVERTED:{severity:`info`,template:`Converted design unit from {originalDesignUnit} to Pixel`},SCENE_NO_PAGES:{severity:`error`,template:`No pages found in scene to export`},SCENE_PAGE_FILL_INVALID:{severity:`warning`,template:`Page fill is enabled but fill block is invalid. Skipping background injection.`},SCENE_PAGE_FILL_DUPLICATE_FAILED:{severity:`warning`,template:`Failed to duplicate page fill. Skipping background injection.`},GROUP_BLEND_MODE_UNSUPPORTED:{severity:`info`,template:`Group "{groupName}" has blend mode "{blendMode}", which CSS does not have. "{bakedName}" is exported as an image that the engine draws.`},GROUP_BAKED_ANIMATION_UNSUPPORTED:{severity:`warning`,template:`The animations of group "{name}" are not exported: it blends with the page under it in a way CSS cannot draw, so it is exported as a still image of that blend.`},HTML_PAGE_PROCESSED:{severity:`info`,template:`Processed page {page}: {textCount} text, {svgCount} SVGs, {groupCount} groups, {fontCount} fonts`},ANIMATION_KEYFRAME_UNSUPPORTED:{severity:`warning`,template:`Keyframe track "{property}" on "{name}" cannot be expressed in HTML and is not exported.`},METADATA_NON_DATA_ATTR:{severity:`info`,template:`Block {blockId}: metadata key "{key}" maps to non-data attribute "{attrName}". Consider using "html5-exporter-data-{attrName}" instead for safety.`}},g=class extends l{constructor(){super(h)}};function _(e){let t=e.scene.getDesignUnit();return t===`Pixel`?{originalDesignUnit:t,converted:!1}:(e.scene.setDesignUnit(`Pixel`),{originalDesignUnit:t,converted:!0})}function v(e){try{return e()}catch{return}}function y(e,t,n,r,i){if(e.block.supportsFill(t)&&e.block.isFillEnabled(t)){let a=e.block.getFill(t);if(a==null||!e.block.isValid(a))return i?.emit(`SCENE_PAGE_FILL_INVALID`),{injected:!1};let o=e.block.create(`graphic`),s=e.block.createShape(`rect`);e.block.setShape(o,s),e.block.setWidth(o,n),e.block.setHeight(o,r),e.block.setPositionX(o,0),e.block.setPositionY(o,0),e.block.setName(o,`page-background`);let c;try{c=e.block.duplicate(a)}catch{return i?.emit(`SCENE_PAGE_FILL_DUPLICATE_FAILED`),v(()=>e.block.destroy(o)),{injected:!1}}return e.block.setFill(o,c),e.block.setFillEnabled(o,!0),e.block.setAlwaysOnBottom(o,!0),e.block.insertChild(t,o,0),e.block.setFillEnabled(t,!1),e.block.supportsStroke(t)&&e.block.isStrokeEnabled(t)&&(e.block.setStrokeEnabled(o,!0),e.block.setStrokeColor(o,e.block.getStrokeColor(t)),e.block.setStrokeWidth(o,e.block.getStrokeWidth(t)),e.block.setStrokeStyle(o,e.block.getStrokeStyle(t)),e.block.setStrokePosition(o,e.block.getStrokePosition(t)),e.block.setStrokeCornerGeometry(o,e.block.getStrokeCornerGeometry(t)),e.block.setStrokeEnabled(t,!1)),{injected:!0,backgroundBlockId:o}}return e.block.supportsFill(t)&&!e.block.isFillEnabled(t)?{injected:!1,transparentBackground:!0}:{injected:!1}}function b(e,t){let n=v(()=>e.block.getString(t,`text/text`));return!n||n.length===0?!1:(v(()=>e.block.getTextColors(t,0,n.length))?.length??0)>1}function x(e,t){return v(()=>{let n=e.block.getName(t)||``,r=e.block.getBlendMode(t),i=e.block.getFrameX(t),a=e.block.getFrameY(t),o=e.block.getFrameWidth(t),s=e.block.getFrameHeight(t),c=e.block.getRotation(t),l=e.block.getParent(t);if(!l)return null;let u=e.block.create(`graphic`),d=e.block.createShape(`rect`);e.block.setShape(u,d),e.block.setWidth(u,o),e.block.setHeight(u,s),e.block.setRotation(u,c),e.block.setPositionX(u,i),e.block.setPositionY(u,a),e.block.appendChild(l,u);let f=e.block.combine([t,u],`Intersection`);return v(()=>e.block.isValid(u))&&v(()=>e.block.destroy(u)),v(()=>e.block.isValid(f))?(e.block.setName(f,n),e.block.setBlendMode(f,r),f):null})??null}function S(e,t,n){let r=[],i=e.block.getChildren(t);for(let t of i){if(!e.block.isValid(t)||e.block.getType(t)!==`//ly.img.ubq/text`||!e.block.isVisible(t)||!e.block.isIncludedInExport(t))continue;let i=e.block.getName(t)||``;if(b(e,t)){n?.emit(`TEXT_BAKE_MULTI_COLOR_SKIPPED`,{name:i,blockId:t});continue}let a=x(e,t);a===null?n?.emit(`TEXT_BAKE_FAILED`,{name:i,blockId:t}):(r.push({originalId:t,bakedId:a,name:i,originalType:`text`,reason:`vector-text`}),n?.emit(`TEXT_BAKE_VECTORIZED`,{name:i,blockId:t,vectorizedBlockId:a}))}return r}function C(e,t){let n=t.logger??new g;s(t.abortSignal);let{originalDesignUnit:r,converted:i}=_(e);i&&n.emit(`SCENE_DESIGN_UNIT_CONVERTED`,{originalDesignUnit:r});let a=e.block.findByType(`page`);if(a.length===0)throw n.emit(`SCENE_NO_PAGES`),Error(`No pages found to export`);let o=[];for(let r=0;r<a.length;r++){s(t.abortSignal);let i=a[r],c=e.block.getWidth(i),l=e.block.getHeight(i),u=y(e,i,c,l,n),d=[];t.textMode===`vector`&&(d=S(e,i,n)),o.push({pageId:i,pageIndex:r,width:c,height:l,backgroundInjected:u.injected,bakedBlocks:d})}return{pages:o,originalDesignUnit:r,designUnitConverted:i}}function w(e){return`r`in e&&`a`in e&&e.r!==void 0&&e.a!==void 0}function T(e){return`c`in e&&`m`in e&&`y`in e&&`k`in e&&e.c!==void 0&&e.m!==void 0&&e.y!==void 0&&e.k!==void 0}function E(e,t,n){if(w(e))return e;let r=T(e)?`CMYK`:`Spot`;return n.emit(`COLOR_CONVERTED_TO_SRGB`,{colorType:r}),t.editor.convertColorToColorSpace(e,`sRGB`)}function D(e){let t=Math.round(e.r*255),n=Math.round(e.g*255),r=Math.round(e.b*255);return e.a===1?`rgb(${t}, ${n}, ${r})`:`rgba(${t}, ${n}, ${r}, ${e.a.toFixed(2)})`}function O(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function k(e){return e.flatMap((t,n)=>{let r=e[n+1];return!r||r.color.a===t.color.a?[t]:Array.from({length:8},(e,n)=>{let i=n/8,a=e=>t.color[e]+(r.color[e]-t.color[e])*i;return{color:{r:a(`r`),g:a(`g`),b:a(`b`),a:a(`a`)},stop:t.stop+(r.stop-t.stop)*i}})})}const A={Normal:`normal`,Multiply:`multiply`,Screen:`screen`,Overlay:`overlay`,Darken:`darken`,Lighten:`lighten`,ColorDodge:`color-dodge`,ColorBurn:`color-burn`,HardLight:`hard-light`,SoftLight:`soft-light`,Difference:`difference`,Exclusion:`exclusion`,Hue:`hue`,Saturation:`saturation`,Color:`color`,Luminosity:`luminosity`};function j(e){let t=A[e];return t&&t!==`normal`?t:void 0}function M(e){return e===`PassThrough`||e in A}const N={thin:100,extraLight:200,light:300,normal:400,medium:500,semiBold:600,bold:700,extraBold:800,heavy:900};function P(e){return N[e]??400}function F(e,t){return v(()=>e.block.isAlwaysOnTop(t))?1:v(()=>e.block.isAlwaysOnBottom(t))?-1:0}function I(e,t){let n=e.sortingOrder??0,r=t.sortingOrder??0;return n===r?(e.originalIndex??0)-(t.originalIndex??0):n-r}function ee(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`)}function te(e){switch(e){case`&`:return`&amp;`;case`<`:return`&lt;`;case`>`:return`&gt;`;case`"`:return`&quot;`;case`'`:return`&#039;`;default:return e}}function ne(e){return!e||Object.keys(e).length===0?``:Object.entries(e).map(([e,t])=>`${e}="${ee(t)}"`).join(` `)}function re(e){let{defaultId:t,defaultClass:n,style:r,defaults:i={},htmlAttributes:a={}}=e,o={id:t,class:n,...i,style:r};for(let[e,t]of Object.entries(a))o[e]=t;return o}function ie(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r}function ae(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function oe(e=0){return new Uint8Array(e)}async function se(e){let t=new ArrayBuffer(e.length);new Uint8Array(t).set(e);let n=await crypto.subtle.digest(`SHA-256`,t),r=new Uint8Array(n);return Array.from(r).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function L(e,t=2){return parseFloat(e.toFixed(t)).toString()}function ce(e,t,n){return n===`Center`?{x:e.x-t/2,y:e.y-t/2,width:e.width+t,height:e.height+t}:n===`Outside`?{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}:e}function le(e,t,n,r,i,a,o){if(!(Math.abs(i)>.001||a||o))return{x:e,y:t};let s=Math.cos(i),c=Math.sin(i),l=a?n/2:-n/2,u=o?r/2:-r/2,d=e-l*s+u*c,f=t-l*c-u*s;return{x:d-n/2,y:f-r/2}}function ue(e,t,n,r,i){let a=e-n,o=t-r;if(Math.abs(i)<.001)return{x:a,y:o};let s=Math.cos(i),c=Math.sin(i);return{x:a*s+o*c,y:-a*c+o*s}}function R(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function z(e,t,n,r,i){let a=i?B(i):``,o=r?` fill="${R(r)}"`:` fill="none"`;if(n&&(n.tl>0||n.tr>0||n.bl>0||n.br>0)){let{tl:r,tr:i,br:s,bl:c}=n;return r===i&&i===s&&s===c?`<rect width="${L(e)}" height="${L(t)}" rx="${L(r)}" ry="${L(r)}"${o}${a}/>`:`<path d="${R(ye(e,t,r,i,s,c))}"${o}${a}/>`}return`<rect width="${L(e)}" height="${L(t)}"${o}${a}/>`}function de(e,t,n,r){let i=e/2,a=t/2,o=e/2,s=t/2,c=r?B(r):``,l=n?` fill="${R(n)}"`:` fill="none"`;return`<ellipse cx="${L(i)}" cy="${L(a)}" rx="${L(o)}" ry="${L(s)}"${l}${c}/>`}function fe(e,t,n,r){let i=n?B(n):``,a=t?` fill="${R(t)}"`:` fill="none"`,o=r?` ${r}="evenodd"`:``;return`<path d="${R(e)}"${a}${o}${i}/>`}function pe(e){let t=e.viewBoxWidth/e.frameWidth,n=e.viewBoxHeight/e.frameHeight;return t===1&&n===1?``:` gradientTransform="scale(${L(t,6)} ${L(n,6)})"`}function me(e){return e.map(e=>`<stop offset="${e.stop}" stop-color="${R(e.color)}"/>`).join(``)}function he(e,t,n,r,i,a,o){let{frameWidth:s,frameHeight:c}=o;return`<linearGradient id="${R(e)}" gradientUnits="userSpaceOnUse" x1="${L(t*s)}" y1="${L(n*c)}" x2="${L(r*s)}" y2="${L(i*c)}"${pe(o)}>${me(a)}</linearGradient>`}function ge(e,t,n,r,i,a,o,s){let{frameWidth:c,frameHeight:l}=s,u=t*c,d=n*l,f=Math.min(c,l)*r,p=i*c,m=a*l,h=Math.max(f,0)*.99,g=Math.hypot(p,m);g>h&&(p*=h/g,m*=h/g);let _=p!==0||m!==0?` fx="${L(u+p)}" fy="${L(d+m)}"`:``;return`<radialGradient id="${R(e)}" gradientUnits="userSpaceOnUse" cx="${L(u)}" cy="${L(d)}" r="${L(f)}"${_}${pe(s)}>${me(o)}</radialGradient>`}function _e(e,t,n,r,i,a,o,s,c,l){let u=`clip-${e}`,d=`<clipPath id="${R(u)}">${n}</clipPath>`,f=``;if(Math.abs(s)>.001){let e=c/2,t=l/2;f=` transform="rotate(${s.toFixed(2)}, ${L(e)}, ${L(t)})"`}return{defs:d,body:`<g clip-path="url(#${R(u)})"><g class="element-content"><image href="${R(t)}" x="${L(r)}" y="${L(i)}" width="${L(a)}" height="${L(o)}" preserveAspectRatio="none"${f}/></g></g>`}}function ve(e,t,n,r,i,a,o,s,c){let l=`clip-${e}`,u=`<clipPath id="${R(l)}">${t}</clipPath>`,d=i.map(e=>`${e.color} ${L(e.stop*100,3)}%`).join(`, `),f=`conic-gradient(from 90deg at ${L(n*100,3)}% ${L(r*100,3)}%, ${d})`,p=`scale(${L(a/s,6)} ${L(o/c,6)})`;return{defs:u,body:`<g clip-path="url(#${R(l)})"><foreignObject width="${L(s)}" height="${L(c)}" transform="${p}"><div xmlns="http://www.w3.org/1999/xhtml" style="${R(`width: 100%; height: 100%; background: ${f}`)}"></div></foreignObject></g>`}}function B(e){let t=` stroke="${R(e.color)}" stroke-width="${L(e.paintWidth??e.width,3)}" vector-effect="non-scaling-stroke"`;return e.join===`miter`?e.miterLimit!==void 0&&(t+=` stroke-miterlimit="${L(e.miterLimit,3)}"`):t+=` stroke-linejoin="${e.join}"`,e.cap!==`butt`&&(t+=` stroke-linecap="${e.cap}"`),e.dashArray.length>0&&(t+=` stroke-dasharray="${e.dashArray.map(e=>L(e,3)).join(` `)}"`,e.dashOffset!==0&&(t+=` stroke-dashoffset="${L(e.dashOffset,3)}"`)),t}function ye(e,t,n,r,i,a){let o=t/2,s=e/2;n=Math.min(n,o,s),r=Math.min(r,o,s),i=Math.min(i,o,s),a=Math.min(a,o,s);let c=L;return[`M ${c(n)} 0`,`L ${c(e-r)} 0`,`Q ${c(e)} 0 ${c(e)} ${c(r)}`,`L ${c(e)} ${c(t-i)}`,`Q ${c(e)} ${c(t)} ${c(e-i)} ${c(t)}`,`L ${c(a)} ${c(t)}`,`Q 0 ${c(t)} 0 ${c(t-a)}`,`L 0 ${c(n)}`,`Q 0 0 ${c(n)} 0`,`Z`].join(` `)}const be={"image/webp":`.webp`,"image/png":`.png`,"image/jpeg":`.jpg`,"image/gif":`.gif`,"image/svg+xml":`.svg`,"image/bmp":`.bmp`,"image/tiff":`.tiff`,"font/ttf":`.ttf`,"font/otf":`.otf`,"font/woff":`.woff`,"font/woff2":`.woff2`,"font/truetype":`.ttf`,"font/opentype":`.otf`,"application/x-font-ttf":`.ttf`,"application/x-font-otf":`.otf`,"application/font-woff":`.woff`,"application/font-woff2":`.woff2`,"video/mp4":`.mp4`,"video/webm":`.webm`,"video/ogg":`.ogv`,"audio/mpeg":`.mp3`,"audio/wav":`.wav`,"audio/ogg":`.ogg`,"audio/webm":`.weba`,"text/html":`.html`,"text/css":`.css`,"application/javascript":`.js`,"application/json":`.json`},xe=Object.fromEntries(Object.entries(be).map(([e,t])=>[t,e]));function Se(e){return be[e]||`.bin`}function Ce(e){let t=e.slice(e.lastIndexOf(`.`)).toLowerCase();return xe[t]}function we(e){let t=e.match(/\.([a-zA-Z0-9]+)(?:\?|$)/);if(!t)return`font/ttf`;let n=`.${t[1].toLowerCase()}`;return xe[n]||`font/ttf`}function V(e){return e.startsWith(`buffer://`)?e.slice(9):e}function Te(e){return e.startsWith(`data:`)}function H(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}function Ee(e){return e.startsWith(`buffer://`)}function De(e){if(!e.startsWith(`data:`))return;let t=e.match(/^data:([^;,]+)/);return t?t[1]:void 0}async function Oe(e,t,n,r){let i=e.block.getName(t)||`Block ${t}`;if(!e.block.supportsShape(t))return null;let a=e.block.getEffects(t);if(a&&a.length>0)return r.emit(`SVG_SHAPE_RASTERIZED_EFFECTS`,{name:i}),null;let o=e.block.getShape(t);if(o==null||!e.block.isValid(o))return r.emit(`SVG_SHAPE_ID_INVALID`,{name:i}),null;let s=e.block.getType(o),c;if(s===`//ly.img.ubq/shape/rect`)c=`rect`;else if(s===`//ly.img.ubq/shape/ellipse`)c=`ellipse`;else if(s===`//ly.img.ubq/shape/line`)c=`line`;else if(s===`//ly.img.ubq/shape/vector_path`)c=`vector_path`;else return r.emit(`SVG_SHAPE_TYPE_UNSUPPORTED`,{shapeType:s}),null;let l=e.block.getFrameWidth(t),u=e.block.getFrameHeight(t),f=l,p=u,m;if(c===`vector_path`)try{f=e.block.getFloat(o,`shape/vector_path/width`),p=e.block.getFloat(o,`shape/vector_path/height`),m=e.block.getString(o,`shape/vector_path/path`)}catch{return r.emit(`SVG_VECTOR_PATH_READ_FAILED`,{name:i}),null}let h=c===`line`&&typeof e.block.getStrokeStartCap==`function`;if(h&&e.block.supportsFill(t)&&e.block.isFillEnabled(t)&&v(()=>{let n=e.block.getFill(t);return n==null?void 0:e.block.getType(n)})!==`//ly.img.ubq/fill/color`)return r.emit(`SVG_LINE_FILL_RASTERIZED`,{name:i}),null;let g=e.block.supportsStroke(t)&&e.block.isStrokeEnabled(t),_=g&&c!==`line`?e.block.getStrokePosition(t):`Center`,y=g?Me(e,t,c===`line`||je(m)):void 0;if(y===`caps`)return r.emit(`SVG_STROKE_CAPS_RASTERIZED`,{name:i}),null;if(y===`fill`)return r.emit(`SVG_STROKE_FILL_RASTERIZED`,{name:i}),null;if(_!==`Center`&&y?.dashArray.length)return r.emit(`SVG_STROKE_ROUND_DASH_RASTERIZED`,{strokePosition:_,name:i}),null;let b=h?{type:`none`,defs:``,body:``}:await Pe(e,t,c,o,f,p,l,u,n,r);if(b===null)return null;let x;if(g){let n=e.block.getStrokeColor(t),i=y.fillColor&&E(n,e,r).a>0?y.fillColor:n,a=e.block.getStrokeWidth(t);x={color:D(E(i,e,r)),width:a,dashArray:y.dashArray,dashOffset:y.dashOffset,cap:y.cap,join:y.join,miterLimit:y.miterLimit,..._!==`Center`&&{paintWidth:2*a}}}let S=c===`rect`?Fe(e,o):void 0,C=(t,n,r=`fill-rule`)=>{switch(c){case`rect`:return z(f,p,S,t,n);case`ellipse`:return de(f,p,t,n);case`line`:return h?n?fe(`M 0 ${L(p/2)} L ${L(f)} ${L(p/2)}`,void 0,n):``:z(f,p,void 0,t,n);case`vector_path`:return fe(m,t,n,Ne(e,o)?r:void 0)}},w=``,T=n=>{let r=`stroke-${t}`;if(_===`Inner`)return w=`<clipPath id="${r}">${C(void 0,void 0,`clip-rule`)}</clipPath>`,n.replace(/\/>$/,` clip-path="url(#${r})"/>`);let i=4*x.width*f/ke(e,t,`width`,l),a=4*x.width*p/ke(e,t,`height`,u),o=`x="${L(-i,6)}" y="${L(-a,6)}" width="${L(f+2*i,6)}" height="${L(p+2*a,6)}"`;return w=`<mask id="${r}" maskUnits="userSpaceOnUse" ${o}><rect ${o} fill="white"/>${C(`black`,void 0)}</mask>`,n.replace(/\/>$/,` mask="url(#${r})"/>`)},O;if(b.type===`image`||b.type===`conic`){let e=x?_===`Center`?C(void 0,x):T(C(void 0,x)):``;O=b.defs+(w?`<defs>${w}</defs>`:``)+b.body+e}else{let e;e=!x||_===`Center`?C(b.fillAttr,x):(b.fillAttr?C(b.fillAttr,void 0):``)+T(C(void 0,x)),O=(b.defs||w?`<defs>${b.defs}${w}</defs>`:``)+e}let k=d(e,e.block.getRotation(t)),{x:A,y:M,width:N,height:P}={x:e.block.getFrameX(t),y:e.block.getFrameY(t),width:l,height:u},F=v(()=>e.block.getOpacity(t))??1,I=j(e.block.getBlendMode(t)),ee=Y(e,t,r);return{type:`svg`,id:t,name:i,x:A,y:M,width:N,height:P,rotation:k,viewBox:`0 0 ${L(f)} ${L(p)}`,svgContent:O,opacity:F,blendMode:I,htmlAttributes:ee,...x&&_!==`Inner`&&{strokeOutset:_===`Outer`?x.width:x.width/2}}}function ke(e,t,n,r){let i=e.block,a=v(()=>i.getKeyframes?.(t,n))??[],o=v(()=>i.getKeyframeMode?.(t,n))===`Relative`?r:0,s=a.map(e=>e.value.type===`Float`?e.value.value+o:r);return Math.max(1,Math.min(r,...s))}const Ae={Dashed:[2,2],DashedRound:[1,3],Dotted:[0,2],LongDashed:[4,4],LongDashedRound:[3,5]};function je(e){return(e??``).split(/(?=[Mm])/).some(e=>/[Mm]/.test(e)&&!/[Zz]\s*$/.test(e.trim()))}function Me(e,t,n){let r=e.block,i=v(()=>r.getStrokeFill?.(t));if(i!=null&&e.block.getType(i)!==`//ly.img.ubq/fill/color`)return`fill`;let a=i==null?void 0:e.block.getColor(i,`fill/color/value`),o=e.block.getStrokeStyle(t),s=e.block.getStrokeWidth(t),c=v(()=>r.getStrokeDashArray?.(t))??[],l=c.length%2==1?[...c,...c]:c,u=l.length>0?l:(Ae[o]??[]).map(e=>e*s),d=u.some(e=>e>0);if(c.length>0&&!d)return`caps`;let f=o.endsWith(`Round`)||o===`Dotted`?`Round`:`Butt`,p=/* @__PURE__ */ new Set;if(d){let n=u.some((e,t)=>t%2==0&&e===0);for(let i of[r.getStrokeDashStartCap,r.getStrokeDashEndCap]){let r=v(()=>i?.call(e.block,t))??f;p.add(r===`Butt`&&n?`Round`:r)}}if(n)for(let n of[r.getStrokeStartCap,r.getStrokeEndCap])p.add(v(()=>n?.call(e.block,t))??f);return p.size>1?`caps`:{dashArray:d?c.length>0?c:u:[],dashOffset:d&&c.length>0?v(()=>e.block.getFloat(t,`stroke/dashOffset`))??0:0,cap:([...p][0]??`Butt`).toLowerCase(),join:e.block.getStrokeCornerGeometry(t).toLowerCase(),miterLimit:v(()=>e.block.getFloat(t,`stroke/miterLimit`)),...a&&{fillColor:a}}}function Ne(e,t){return(v(()=>e.block.getEnum(t,`shape/vector_path/fillRule`))??`EvenOdd`)===`EvenOdd`}async function Pe(e,t,n,r,i,a,o,s,c,l){let u={frameWidth:o,frameHeight:s,viewBoxWidth:i,viewBoxHeight:a};if(!e.block.supportsFill(t)||!e.block.isFillEnabled(t))return{type:`none`,defs:``,body:``};let d=e.block.getFill(t);if(d==null||!e.block.isValid(d)){let n=e.block.getName(t)||`Block ${t}`;return l.emit(`SVG_FILL_INVALID`,{name:n}),null}let f=e.block.getType(d);if(f===`//ly.img.ubq/fill/color`)return{type:`solid`,fillAttr:D(E(e.block.getColor(d,`fill/color/value`),e,l)),defs:``,body:``};if(f===`//ly.img.ubq/fill/gradient/linear`){let n=`grad-${t}`,r=he(n,e.block.getFloat(d,`fill/gradient/linear/startPointX`),e.block.getFloat(d,`fill/gradient/linear/startPointY`),e.block.getFloat(d,`fill/gradient/linear/endPointX`),e.block.getFloat(d,`fill/gradient/linear/endPointY`),e.block.getGradientColorStops(d,`fill/gradient/colors`).map(t=>({color:D(E(t.color,e,l)),stop:t.stop})),u);return{type:`gradient`,fillAttr:`url(#${n})`,defs:`<defs>${r}</defs>`,body:``}}if(f===`//ly.img.ubq/fill/gradient/radial`){let n=`grad-${t}`,r=ge(n,e.block.getFloat(d,`fill/gradient/radial/centerPointX`),e.block.getFloat(d,`fill/gradient/radial/centerPointY`),e.block.getFloat(d,`fill/gradient/radial/radius`),v(()=>e.block.getFloat(d,`fill/gradient/radial/focalX`))??0,v(()=>e.block.getFloat(d,`fill/gradient/radial/focalY`))??0,e.block.getGradientColorStops(d,`fill/gradient/colors`).map(t=>({color:D(E(t.color,e,l)),stop:t.stop})),u);return{type:`gradient`,fillAttr:`url(#${n})`,defs:`<defs>${r}</defs>`,body:``}}if(f===`//ly.img.ubq/fill/gradient/conical`){let c=e.block.getGradientColorStops(d,`fill/gradient/colors`),{defs:u,body:f}=ve(String(t),Ie(e,n,r,i,a),e.block.getFloat(d,`fill/gradient/conical/centerPointX`),e.block.getFloat(d,`fill/gradient/conical/centerPointY`),k(c.map(t=>({color:E(t.color,e,l),stop:t.stop}))).map(e=>({color:D(e.color),stop:e.stop})),i,a,o,s);return{type:`conic`,defs:`<defs>${u}</defs>`,body:f}}if(f===`//ly.img.ubq/fill/image`)return Le(e,t,n,r,i,a,d,c,l);let p=e.block.getName(t)||`Block ${t}`;return l.emit(`SVG_FILL_TYPE_UNSUPPORTED`,{fillType:f,name:p}),null}function Fe(e,t){let n=n=>v(()=>e.block.getFloat(t,`shape/rect/cornerRadius${n}`))??0,r={tl:n(`TL`),tr:n(`TR`),bl:n(`BL`),br:n(`BR`)};return Object.values(r).some(e=>e>0)?r:void 0}function Ie(e,t,n,r,i){switch(t){case`rect`:return z(r,i,Fe(e,n));case`ellipse`:return de(r,i);case`vector_path`:return fe(e.block.getString(n,`shape/vector_path/path`),void 0,void 0,Ne(e,n)?`clip-rule`:void 0);default:return z(r,i)}}async function Le(e,t,n,r,i,a,o,s,c){let l=e.block.getName(t)||`Block ${t}`,u;try{u=e.block.getString(o,`fill/image/imageFileURI`)}catch{return c.emit(`SVG_IMAGE_URI_MISSING`,{name:l}),null}if(!u)return c.emit(`SVG_IMAGE_URI_EMPTY`,{name:l}),null;let f=await e.editor.getMimeType(u),p;try{p=await s.getUrl(u,`image`,f)}catch{return c.emit(`SVG_IMAGE_RESOLVE_FAILED`,{imageUri:u,name:l}),null}let m=e.block.getCropScaleX(t),h=e.block.getCropScaleY(t),g=e.block.getCropTranslationX(t),_=e.block.getCropTranslationY(t),v=d(e,e.block.getCropRotation(t)),y=i*m,b=a*h,x=g*i,S=_*a,C=v*180/Math.PI,w=Ie(e,n,r,i,a),{defs:T,body:E}=_e(String(t),V(p),w,x,S,y,b,C,i,a);return{type:`image`,defs:`<defs>${T}</defs>`,body:E,fillAttr:void 0}}function Re(e,t){if(e.length===0)return null;let n=e[0],r=Math.abs(P(n.weight||`normal`)-t);for(let i=1;i<e.length;i++){let a=Math.abs(P(e[i].weight||`normal`)-t);a<r&&(r=a,n=e[i])}return n}function ze(e,t,n,r,i){if(e?.fonts?.length){let a=P(t);if(n===null){let t=e.fonts.find(e=>e.uri===r),n=(t?P(t.weight||`normal`):-1)!==a;if(i||n){let t=e.fonts.filter(e=>e.uri!==r);if(t.length>0){let e=Re(t,a);return{uri:e.uri,fontStyle:e.style||`normal`}}}else if(t)return{uri:t.uri,fontStyle:t.style||`normal`}}let o=n||`normal`,s=Re(e.fonts.filter(e=>(e.style||`normal`)===o),a);if(s)return{uri:s.uri,fontStyle:s.style||`normal`};let c=e.fonts.find(e=>e.uri===r);if(c)return{uri:c.uri,fontStyle:c.style||`normal`};if(e.fonts.length>0)return{uri:e.fonts[0].uri,fontStyle:e.fonts[0].style||`normal`}}return{uri:r,fontStyle:n||`normal`}}function Be(e,t,n,r,i){let a=e.block.getString(t,`text/text`);if(a.length===0)return[];let o=[...new Intl.Segmenter(`en`,{granularity:`grapheme`}).segment(a)],s=o.length,c=!1;for(let n=0;n<s;n++)if(e.block.getTextFontStyles(t,n,n+1).length>0){c=!0;break}let l=e.block.getTextScriptStyles?.bind(e.block),u=[],d=null;for(let a=0;a<s;a++){let s=e.block.getTextColors(t,a,a+1),f=e.block.getTextFontWeights(t,a,a+1),p=e.block.getTextFontStyles(t,a,a+1),m=e.block.getTextFontSizes(t,{from:a,to:a+1,unit:`Pixel`}),h=e.block.getTextCases(t,a,a+1),g=[];try{g=e.block.getTypefaces(t,a,a+1)}catch{n&&(g=[n])}let _=s[0]?E(s[0],e,i):{r:0,g:0,b:0,a:1},v=f[0]||`normal`,y=p.length>0?p[0]||`normal`:null,b=m[0]||16,x=h[0]||`Normal`,S=l?.(t,a,a+1)[0]??`Normal`,C=g[0]||n,w=C?.name||`sans-serif`,T=ze(C,v,y,r,c),D=T.uri,k=T.fontStyle,A=o[a].segment;d&&O(d.color,_)&&d.fontSize===b&&d.fontWeight===v&&d.fontStyle===k&&d.fontFamily===w&&d.resolvedFontFileUri===D&&d.textCase===x&&d.scriptStyle===S?(d.text+=A,d.to=a+1):(d&&u.push(d),d={from:a,to:a+1,text:A,color:_,fontSize:b,fontWeight:v,fontStyle:k,textCase:x,typeface:C,resolvedFontFileUri:D,fontFamily:w,scriptStyle:S})}return d&&u.push(d),u}function Ve(e,t){if(!e.block.getBool(t,`text/automaticFontSizeEnabled`))return{enabled:!1};let n=e.scene.get(),r=e.block.getFloat(t,`text/minAutomaticFontSize`),i=e.block.getFloat(t,`text/maxAutomaticFontSize`),a=e.block.getFloat(n,`scene/dpi`)/72;return{enabled:!0,minFontSize:r>0?r*a:void 0,maxFontSize:i>0?i*a:void 0}}function He(e,t,n){if(n===`Normal`)return;let r=n===`Superscript`?`text/superscript`:`text/subscript`;return{style:n,fontScale:e.block.getFloat(t,`${r}FontScale`),verticalShift:e.block.getFloat(t,`${r}VerticalShift`)}}async function Ue(e,t,n,r){let i=r.logger,a=e.block.getString(t,`text/text`).length,o=e.block.getFrameX(t),s=e.block.getFrameY(t),c=e.block.getFrameWidth(t),l=e.block.getFrameHeight(t),u=d(e,e.block.getRotation(t)),f=e.block.getName(t)||``,p=e.block.getEnum(t,`width/mode`),m=e.block.getEnum(t,`height/mode`),h=e.block.getFloat(t,`text/lineHeight`),g=v(()=>e.block.getString(t,`text/fontFileUri`))??``,_=v(()=>e.block.getTypeface(t))??null;!g&&_&&_.fonts.length>0&&(g=(_.fonts.find(e=>e.weight===`normal`&&e.style===`normal`)||_.fonts[0])?.uri||``);let y=h,b=1;if(e.block.getFloat(t,`text/fontSize`)>0&&g){let t=await e.editor.getFontMetrics(g),n=(t.ascender-t.descender)/t.unitsPerEm;y=h*n,b=n}else i?.emit(`TEXT_LINE_HEIGHT_FALLBACK`,{blockId:t});let x=e.block.getEnum(t,`text/horizontalAlignment`),S=e.block.getEnum(t,`text/verticalAlignment`),C=e.block.getFloat(t,`text/letterSpacing`),w=Ve(e,t),T={shadowEnabled:e.block.supportsDropShadow(t)&&e.block.isDropShadowEnabled(t),shadowColor:e.block.supportsDropShadow(t)&&e.block.isDropShadowEnabled(t)?E(e.block.getDropShadowColor(t),e,i):null,shadowOffsetX:e.block.supportsDropShadow(t)?e.block.getDropShadowOffsetX(t):0,shadowOffsetY:e.block.supportsDropShadow(t)?e.block.getDropShadowOffsetY(t):0,shadowBlurX:e.block.supportsDropShadow(t)?e.block.getDropShadowBlurRadiusX(t):0,shadowBlurY:e.block.supportsDropShadow(t)?e.block.getDropShadowBlurRadiusY(t):0,strokeEnabled:e.block.supportsStroke(t)&&e.block.isStrokeEnabled(t),strokeColor:e.block.supportsStroke(t)&&e.block.isStrokeEnabled(t)?E(e.block.getStrokeColor(t),e,i):null,strokeWidth:e.block.supportsStroke(t)?e.block.getStrokeWidth(t):0},D=e.block.supportsOpacity(t)?e.block.getOpacity(t):1,O;v(()=>e.block.getBool(t,`backgroundColor/enabled`))&&(O={enabled:!0,color:E(e.block.getColor(t,`backgroundColor/color`),e,i),paddingLeft:e.block.getFloat(t,`backgroundColor/paddingLeft`),paddingTop:e.block.getFloat(t,`backgroundColor/paddingTop`),paddingRight:e.block.getFloat(t,`backgroundColor/paddingRight`),paddingBottom:e.block.getFloat(t,`backgroundColor/paddingBottom`),cornerRadius:e.block.getFloat(t,`backgroundColor/cornerRadius`)});let k=(v(()=>e.block.supportsFill(t))&&v(()=>e.block.isFillEnabled(t)))??!0,A=j(e.block.getBlendMode(t));if(a===0){let n=Y(e,t,i);return{type:`text`,id:t,name:f,x:o,y:s,width:c,height:l,rotation:u,runs:[],horizontalAlignment:x,verticalAlignment:S,lineHeight:y,letterSpacing:C,effects:T,widthMode:p,heightMode:m,opacity:D,backgroundColor:O,lineBreakIndices:[],blendMode:A,fillEnabled:k,emRatio:b,htmlAttributes:n,autoFontSizeEnabled:w.enabled,minAutoFontSize:w.minFontSize,maxAutoFontSize:w.maxFontSize}}let M=Be(e,t,_,g,i),N=[];for(let i of M){let{resolvedFontFileUri:a,fontFamily:o,fontWeight:s,fontStyle:c}=i,l=a;if(a&&r.resourceMap){let e=we(a);l=await r.resourceMap.getUrl(a,`font`,e),n.has(a)||n.set(a,{uri:l,data:/* @__PURE__ */ new Uint8Array,filename:``,fontFamily:o,fontWeight:s,fontStyle:c})}else a&&!n.has(a)&&n.set(a,{uri:a,data:/* @__PURE__ */ new Uint8Array,filename:``,fontFamily:o,fontWeight:s,fontStyle:c});N.push({text:i.text,color:i.color,fontSize:i.fontSize,fontWeight:s,fontStyle:c,fontFamily:o,fontUri:a,textCase:i.textCase,script:He(e,t,i.scriptStyle)})}let P=[];if(r.insertExplicitLineBreaks){let n=v(()=>e.block.getTextVisibleLineCount(t));if(n!==void 0){let r=e.block.getString(t,`text/text`),i=0;for(let a=0;a<n-1;a++){let n=e.block.getTextVisibleLineContent(t,a),o=0;for(;o<n.length&&i<r.length;){let e=r[i],t=n[o];e.toUpperCase()===t.toUpperCase()&&o++,i++}let s=i>0?r[i-1]:``;s!==`
2
+ `&&s!==`\u2028`&&s!==`\u2029`&&P.push(i)}}}let F=Y(e,t,i);return{type:`text`,id:t,name:f,x:o,y:s,width:c,height:l,rotation:u,runs:N,horizontalAlignment:x,verticalAlignment:S,lineHeight:y,letterSpacing:C,effects:T,widthMode:p,heightMode:m,opacity:D,backgroundColor:O,lineBreakIndices:P,blendMode:A,fillEnabled:k,emRatio:b,insertExplicitLineBreaks:r.insertExplicitLineBreaks,htmlAttributes:F,autoFontSizeEnabled:w.enabled,minAutoFontSize:w.minFontSize,maxAutoFontSize:w.maxFontSize}}function We(e,t){return e.block.getOpacity(t)<1||e.block.getBlendMode(t)!==`PassThrough`}async function Ge(e,t,n,r,i,a,o,s,c){let l=c?[t,...c.outside]:e.block.getChildren(t),u=[],f=d(e,e.block.getRotation(t)),p=e.block.getFrameX(t),m=e.block.getFrameY(t);for(let i=0;i<l.length;i++){let a=l[i],d=c&&a===t?{...c.image,originalIndex:i}:await o(e,a,n,r,i,s);if(d){let t=ue(d.x,d.y,p,m,f),n=d.rotation-f,r=e.block.getFlipHorizontal(a),i=e.block.getFlipVertical(a),o=le(t.x,t.y,d.width,d.height,n,r,i);d.x=o.x,d.y=o.y,d.rotation=n,u.push(d)}}u.sort(I);let h=Y(e,t,r.logger),g=e.block.getFrameWidth(t),_=e.block.getFrameHeight(t);return{type:`group`,id:t,name:e.block.getName(t)||``,x:p,y:m,width:g,height:_,rotation:f,sortingOrder:i,originalIndex:a,...c?.kind===`backdrop`?{opacity:1,isolated:!1}:{blendMode:j(e.block.getBlendMode(t)),opacity:e.block.getOpacity(t),isolated:We(e,t)},children:u,htmlAttributes:h}}const Ke={Linear:`none`,EaseIn:`power1.in`,EaseOut:`power1.out`,EaseInOut:`power1.inOut`,EaseInQuart:`power3.in`,EaseOutQuart:`power3.out`,EaseInOutQuart:`power3.inOut`,EaseInQuint:`power4.in`,EaseOutQuint:`power4.out`,EaseInOutQuint:`power4.inOut`,EaseInBack:`back.in(1.70158)`,EaseOutBack:`back.out(1.70158)`,EaseInOutBack:`back.inOut(2.5949095)`,EaseInSpring:`elastic.in(1, 0.3)`,EaseOutSpring:`elastic.out(1, 0.3)`,EaseInOutSpring:`elastic.inOut(1, 0.3)`};function U(e){return Ke[e]??`none`}function qe(e,t){let n=U(e.easing),r=e.duration;return t===`in`?{from:{opacity:0},ease:n,duration:r}:t===`out`?{to:{opacity:0},ease:n,duration:r}:null}function Je(e,t){let n=t.elementX+t.elementWidth/2,r=t.elementY+t.elementHeight/2,i=t.elementWidth/2,a=t.elementHeight/2,o=-i,s=t.pageWidth+i,c=-a,l=t.pageHeight+a,u=Math.cos(e),d=Math.sin(e),f=1/0;if(u!==0){let e=(s-n)/u,t=(o-n)/u;e>0&&(f=Math.min(f,e)),t>0&&(f=Math.min(f,t))}if(d!==0){let e=(l-r)/d,t=(c-r)/d;e>0&&(f=Math.min(f,e)),t>0&&(f=Math.min(f,t))}return isFinite(f)?{x:Math.round(u*f)||0,y:Math.round(d*f)||0}:{x:0,y:0}}function Ye(e,t,n){let r=U(e.easing),i=e.duration,a=e.properties.direction??0,o=e.properties.fade,s=Je(a,n);return t===`in`?{from:{x:-s.x||0,y:-s.y||0,...o?{opacity:0}:{}},ease:r,duration:i}:t===`out`?{to:{x:s.x||0,y:s.y||0,...o?{opacity:0}:{}},ease:r,duration:i}:null}function Xe(e,t,n){let r=U(e.easing),i=e.duration,a=e.properties.direction??0,o=e.properties.distance??.5,s=e.properties.fade,c=Math.max(n.pageWidth,n.pageHeight)*o,l=-Math.round(Math.cos(a)*c)||0,u=-Math.round(Math.sin(a)*c)||0;return t===`in`?{from:{x:l,y:u,...s?{opacity:0}:{}},ease:r,duration:i}:t===`out`?{to:{x:-l||0,y:-u||0,...s?{opacity:0}:{}},ease:r,duration:i}:null}function Ze(e,t){let n=U(e.easing),r=e.duration,i=e.properties.intensity??.5,a=Math.round(i*20),o=e.properties.fade;return t===`in`?{from:{filter:`blur(${a}px)`,...o?{opacity:0}:{}},ease:n,duration:r}:t===`out`?{to:{filter:`blur(${a}px)`,...o?{opacity:0}:{}},ease:n,duration:r}:null}const Qe={All:`center`,Horizontal:`center`,Vertical:`center`,TopLeft:`top left`,TopRight:`top right`,BottomLeft:`bottom left`,BottomRight:`bottom right`};function $e(e,t){let n=Qe[e]??`center`;switch(e){case`Horizontal`:return{scaleX:t,scaleY:1,transformOrigin:n};case`Vertical`:return{scaleX:1,scaleY:t,transformOrigin:n};default:return{scaleX:t,scaleY:t,transformOrigin:n}}}function et(e,t){let n=U(e.easing),r=e.duration,i=$e(e.properties.direction??`All`,e.properties.scaleFactor??0);return t===`in`?{from:i,ease:n,duration:r}:t===`out`?{to:i,ease:n,duration:r}:null}function tt(e,t){let n=U(e.easing),r=e.duration,i=e.properties.fade;return t===`in`?{from:{scale:2.5,...i?{opacity:0}:{}},ease:n,duration:r}:t===`out`?{to:{scale:2.5,...i?{opacity:0}:{}},ease:n,duration:r}:null}function nt(e,t){let n=e.duration;return t===`in`?{from:{scale:0},ease:`none`,duration:n,customEase:`springOut`,extraTweens:[{from:{opacity:0},ease:`none`,duration:n/2,relativeOffset:0}]}:t===`out`?{to:{scale:0},ease:`none`,duration:n,customEase:`springIn`,extraTweens:[{to:{opacity:0},ease:`none`,duration:n/2,relativeOffset:n/2}]}:null}const rt={Right:[0,1,0,0],Left:[0,0,0,1],Down:[0,0,1,0],Up:[1,0,0,0]},it={Right:[0,0,0,1],Left:[0,1,0,0],Down:[1,0,0,0],Up:[0,0,1,0]};function at(e,t,n){let r=U(e.easing),i=e.duration,a=e.properties.direction??`Right`;return t===`in`?{...W(n,rt[a]??rt.Right,`in`),ease:r,duration:i}:t===`out`?{...W(n,it[a]??it.Right,`out`),ease:r,duration:i}:null}function ot(e,t){switch(e){case`Up`:return{cut:[0,0,1,0],y:t.elementHeight};case`Down`:return{cut:[1,0,0,0],y:-t.elementHeight};case`Left`:return{cut:[0,1,0,0],x:t.elementWidth};case`Right`:return{cut:[0,0,0,1],x:-t.elementWidth};default:return{cut:[0,0,1,0],y:t.elementHeight}}}function st(e,t){switch(e){case`Up`:return{cut:[1,0,0,0],y:-t.elementHeight};case`Down`:return{cut:[0,0,1,0],y:t.elementHeight};case`Left`:return{cut:[0,0,0,1],x:-t.elementWidth};case`Right`:return{cut:[0,1,0,0],x:t.elementWidth};default:return{cut:[1,0,0,0],y:-t.elementHeight}}}function ct(e,t,n){let r=U(e.easing),i=e.duration,a=e.properties.direction??`Up`;if(t===`in`){let{cut:e,...t}=ot(a,n),o=W(n,e,`in`);return{...o,from:{...o.from,...t},ease:r,duration:i}}if(t===`out`){let{cut:e,...t}=st(a,n);return{to:{...W(n,e,`out`).to,...t},ease:r,duration:i}}return null}function lt(e,t){let n=U(e.easing),r=e.duration,i=e.properties.scale??1.5,a=e.properties.fade;return t===`in`?{from:{scale:i,...a?{opacity:0}:{}},ease:n,duration:r,target:`content`}:t===`out`?{to:{scale:i,...a?{opacity:0}:{}},ease:n,duration:r,target:`content`}:null}function ut(e,t){let n=U(e.easing),r=e.duration,i=e.properties.direction!==`CounterClockwise`,a=e.properties.intensity??1,o=e.properties.fade,s=a*360;return t===`in`?{from:{rotation:i?-s:s,...o?{opacity:0}:{}},ease:n,duration:r}:t===`out`?{to:{rotation:i?s:-s,...o?{opacity:0}:{}},ease:n,duration:r}:null}const dt={Up:e=>({yPercent:e}),Down:e=>({yPercent:-e}),Right:e=>({xPercent:-e}),Left:e=>({xPercent:e})};function ft(e,t){let n=U(e.easing),r=e.duration,i=e.properties.direction??`Right`,a=(e.properties.travelDistanceRatio??.1)*100,o=e.properties.zoomIntensity??1.2,s=o>=0?1+o:1/(1-o),c=e.properties.fade,l=(dt[i]??dt.Right)(a);if(t===`in`)return{from:{scale:s,...l,...c?{opacity:0}:{}},ease:n,duration:r,target:`content`};if(t===`out`){let e={};for(let[t,n]of Object.entries(l))e[t]=-n;return{to:{scale:s,...e,...c?{opacity:0}:{}},ease:n,duration:r,target:`content`}}return null}function pt(e,t){if(t!==`loop`)return null;let n=e.duration;return{to:{rotation:e.properties.direction===`CounterClockwise`?-360:360},ease:`none`,duration:n,noYoyo:!0}}function mt(e,t){return t===`loop`?{from:{opacity:0},to:{opacity:1},ease:`power1.inOut`,duration:e.duration}:null}function ht(e,t){if(t!==`loop`)return null;let n=e.duration,r=e.properties.intensity??.5;return{to:{filter:`blur(${Math.round(r*20)}px)`},ease:`power1.inOut`,duration:n}}function gt(e,t){if(t!==`loop`)return null;let n=e.duration,r=1.25+1.25*Math.max(0,Math.min(1,e.properties.intensity??.5)),i=n/3,a=n*2/3;return{to:{scale:r},ease:`power1.out`,duration:i,noYoyo:!0,extraTweens:[{to:{scale:1},ease:`power1.out`,duration:a,relativeOffset:i}]}}function _t(e,t){if(t!==`loop`)return null;let n=e.duration;return{to:{scale:1.25+1.25*Math.max(0,Math.min(1,e.properties.intensity??.5))},ease:`power1.inOut`,duration:n}}function vt(e,t){if(t!==`loop`)return null;let n=e.duration,r=e.properties.direction??`Up`,i=Math.max(0,Math.min(1,e.properties.intensity??.5))*100,a={Up:{yPercent:i},Down:{yPercent:-i},Right:{xPercent:-i},Left:{xPercent:i}},o={Up:{yPercent:-i},Down:{yPercent:i},Right:{xPercent:i},Left:{xPercent:-i}};return{from:a[r]??a.Up,to:o[r]??o.Up,ease:`power1.inOut`,duration:n}}function yt(e,t){return t===`loop`?{from:{scaleX:1,scaleY:.7},to:{scaleX:.7,scaleY:1},ease:`power1.inOut`,duration:e.duration}:null}function bt(e,t){if(t!==`loop`)return null;let n=e.duration,r=15+30*Math.max(0,Math.min(1,e.properties.intensity??.5));return{from:{rotation:-r},to:{rotation:r},ease:`power1.inOut`,duration:n}}function xt(e,t){let n=U(e.easing),r=e.duration;return t===`in`?{from:{opacity:0},ease:n,duration:r}:t===`out`?{to:{opacity:0},ease:n,duration:r}:null}function St(e,t){return console.warn(`[html5-exporter] Animation handler 'block_swipe_text' not yet implemented.`),null}function Ct(e,t){let n=U(e.easing),r=e.duration,i=e.properties.fade!==!1;return t===`in`?{from:i?{opacity:0}:void 0,ease:n,duration:r}:t===`out`?{to:i?{opacity:0}:void 0,ease:n,duration:r}:null}function wt(e,t){let n=U(e.easing),r=e.duration;return t===`in`?{from:{opacity:0},ease:n,duration:r}:t===`out`?{to:{opacity:0},ease:n,duration:r}:null}const Tt=/* @__PURE__ */ new Map([[`fade`,qe],[`slide`,Ye],[`pan`,Xe],[`blur`,Ze],[`grow`,et],[`zoom`,tt],[`pop`,nt],[`wipe`,at],[`baseline`,ct],[`crop_zoom`,lt],[`spin`,ut],[`ken_burns`,ft],[`spin_loop`,pt],[`fade_loop`,mt],[`blur_loop`,ht],[`pulsating_loop`,gt],[`breathing_loop`,_t],[`jump_loop`,vt],[`squeeze_loop`,yt],[`sway_loop`,bt],[`typewriter_text`,xt],[`block_swipe_text`,St],[`spread_text`,Ct],[`merge_text`,wt]]);function Et(e,[t,n,r,i]){let a=e.outset??0,o=e=>a===0?e===0?`0`:`${e*100}%`:`calc(${e*100}% + ${Math.round((2*e-1)*a*1e3)/1e3}px)`;return`inset(${o(t)} ${o(n)} ${o(r)} ${o(i)})`}function W(e,t,n){let r=Et(e,t);if(!e.outset)return n===`in`?{from:{clipPath:r}}:{to:{clipPath:r}};let i=Et(e,[0,0,0,0]);return n===`in`?{to:{clipPath:i,startAt:{clipPath:r},clearProps:`clipPath`}}:{to:{clipPath:r,startAt:{clipPath:i}}}}function G(e,t,n){let r=Tt.get(e.type);return r?r(e,t,n):(console.warn(`[html5-exporter] No animation handler registered for type "${e.type}". Element will be static.`),null)}function K(e,t,n,r,i,a,o,s=0){if(!e)return;let c={elementX:t,elementY:n,elementWidth:r,elementHeight:i,pageWidth:a,pageHeight:o,...s>0&&{outset:s}},l={};if(e.inAnimation){let t=G(e.inAnimation,`in`,Dt(c,e.keyframes,`first`));t&&(l.in=t)}if(e.loopAnimation){let t=G(e.loopAnimation,`loop`,c);t&&(l.loop=t)}if(e.outAnimation){let t=G(e.outAnimation,`out`,Dt(c,e.keyframes,`last`));t&&(l.out=t)}e.keyframes&&(l.keyframes=e.keyframes),e.textWritingStyle&&(l.textWritingStyle=e.textWritingStyle,e.textOverlap!==void 0&&(l.textOverlap=e.textOverlap));let u=e.inAnimation??e.outAnimation;if(u?.type===`spread_text`&&(l.spread={intensity:u.properties.intensity??1,blockWidth:r},l.textWritingStyle=`Character`,l.textOverlap=1),u?.type===`merge_text`){let e=u.properties.intensity??1,t=u.properties.direction??`Left`;l.merge={distance:Math.max(a,o)*.1*e,direction:t},l.textWritingStyle=`Word`,l.textOverlap=.4}return Object.keys(l).length>0?l:void 0}function Dt(e,t,n){if(!t)return e;let r={x:t.origin?.x??0,y:t.origin?.y??0},i={x:0,y:0};for(let e of t.tracks){let t=e.values[n===`first`?0:e.values.length-1];if(e.prop===`xy`){let[e,n]=t;i.x=e-r.x,i.y=n-r.y}else(e.prop===`x`||e.prop===`y`)&&(i[e.prop]=t-r[e.prop])}return{...e,elementX:e.elementX+i.x,elementY:e.elementY+i.y}}function Ot(e,t){let n=/* @__PURE__ */ new Map,r=[t],i=[],a=0;for(;r.length>0||a<i.length;){let t=r.pop()??i[a++];n.set(t,n.size);let o=[],s=[];for(let n of e.block.getChildren(t)){let t=F(e,n);t>0?i.push(n):t<0?s.push(n):o.push(n)}r.push(...o.reverse(),...s.reverse())}return n}function kt(e,t,n){for(let r=e.block.getParent(t);r!==null;r=e.block.getParent(r))if(r===n)return!0;return!1}function At(e,t,n){let r=[...t.keys()],i=/* @__PURE__ */ new Set([n]);for(let a=(t.get(n)??r.length)+1;a<r.length;a++){let t=r[a];if(kt(e,t,n))i.add(t);else if(e.block.isVisible(t)&&e.block.isIncludedInExport(t))break}return i}function jt(e){return e.flatMap(e=>e.type===`group`&&e.children.length>0?jt(e.children):[e.id])}function Mt(e){return e.some(e=>!!(e.blendMode&&e.blendMode!==`normal`)||!!e.htmlAttributes?.style||e.type===`group`&&Mt(e.children))}function Nt(e,t){if(e.htmlAttributes?.style)return!0;let n=K(e.animation,e.x,e.y,e.width,e.height,t.width,t.height);if((e.rotation!==0||n)&&Mt(e.children))return!0;for(let e of[n?.in,n?.loop,n?.out])if(e&&(e.target===`content`||[e,...e.extraTweens??[]].some(({from:e,to:t})=>e?.opacity!==void 0||t?.opacity!==void 0||e?.filter!==void 0||t?.filter!==void 0)))return!0;return!1}function Pt(e,t,n,r){let i=Ot(e,t),a=new Set(jt(n)),o=/* @__PURE__ */ new Map,s=0;for(let e of i.keys())o.set(e,s),a.has(e)&&s++;let c=[],l=!1,u=(e,t)=>{for(let n of e)if(n.type===`group`&&n.children.length>0&&!Nt(n,r))u(n.children,[...t,n]);else{if(n.type===`group`&&n.children.length>0){let e=jt(n.children),t=o.get(n.id)??0;e.reduce((e,t)=>Math.max(e,o.get(t)??0),t)-t+1!==e.length&&(l=!0)}c.push({element:n,groups:t,order:i.get(n.id)??0})}};if(u(n,[]),l)return[...n].sort(I);c.sort((e,t)=>e.order-t.order);let d=[],f=[],p=[],m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map,g=(t,n)=>{if(t.opacity>=1&&!t.blendMode&&!t.isolated)return!0;let r=h.get(t.id);return r||(r=At(e,i,t.id),h.set(t.id,r)),r.has(n)};for(let{element:e,groups:t}of c){let n=0;for(;n<f.length&&n<t.length&&f[n].group===t[n]&&f[n].outside!==g(t[n],e.id);)n++;f.length=n,p.length=n;let r=p.at(-1)?.children??d;for(let i=n;i<t.length;i++){let n=t[i],a=m.get(n.id)??0,o=!g(n,e.id);m.set(n.id,a+1);let s={...n,htmlAttributes:n.htmlAttributes&&{...n.htmlAttributes},children:[],...o&&{opacity:1,blendMode:void 0,isolated:!1}};a>0&&(s.fragmentIndex=a),r.push(s),f.push({group:n,outside:o}),p.push(s),r=s.children}r.push(e)}return d}function Ft(e,t){return e.block.getType(t)===`//ly.img.ubq/group`}function It(e,t){return We(e,t)&&M(e.block.getBlendMode(t))}function Lt(e,t){return Ft(e,t)&&!M(e.block.getBlendMode(t))}function Rt(e,t){let n=e.block.getParent(t);for(;n!==null&&e.block.getType(n)!==`//ly.img.ubq/page`;)n=e.block.getParent(n);if(n===null)throw Error(`Block ${t} is not on a page.`);return n}function zt(e,t){let n=Ot(e,Rt(e,t));for(let r=e.block.getParent(t);r!==null&&Ft(e,r);r=e.block.getParent(r)){if(!At(e,n,r).has(t))return`page`;if(It(e,r))return r}return`page`}function q(e,t){return[t,...e.block.getChildren(t).filter(t=>e.block.isVisible(t)&&e.block.isIncludedInExport(t)).flatMap(t=>q(e,t))]}function Bt(e,t){return Lt(e,t)?zt(e,t)===`page`?`backdrop`:`none`:It(e,t)&&q(e,t).some(n=>n!==t&&Lt(e,n)&&zt(e,n)===t)?`layer`:`none`}function Vt(e,t,n){let r=e.block.getName(t)||`Group ${t}`;for(let i of q(e,t))Lt(e,i)&&n.emit(`GROUP_BLEND_MODE_UNSUPPORTED`,{groupName:e.block.getName(i)||`Group ${i}`,blendMode:e.block.getBlendMode(i),bakedName:r})}async function Ht(e,t,n,r){let i=v(()=>e.editor.getSettingBool(`blockAnimations/enabled`))===!0;i&&e.editor.setSettingBool(`blockAnimations/enabled`,!1);try{let i=await e.block.export(t,{...n,...r===void 0?{}:{transactionId:r}});return new Uint8Array(await i.arrayBuffer())}finally{i&&e.editor.setSettingBool(`blockAnimations/enabled`,!0)}}async function Ut(e,t,n){let r=t.filter(t=>e.block.isIncludedInExport(t));r.forEach(t=>e.block.setIncludedInExport(t,!1));try{return await n()}finally{r.forEach(t=>e.block.setIncludedInExport(t,!0))}}async function Wt(e,t,n,r){let{block:i}=e,a=v(()=>i.getPlaybackTime(t)),o=v(()=>i.getTimeOffset(n))??0,s=v(()=>i.getDuration(n));if(a===void 0||s===void 0||a>=o&&a<o+s)return r();i.setPlaybackTime(t,o+s/2);try{return await r()}finally{i.setPlaybackTime(t,a)}}async function Gt(e,t,n,r,i,a,o,s=0){let{block:c}=e,l=Rt(e,t),u=Math.round(c.getWidth(l)),d=Math.round(c.getHeight(l)),f={targetWidth:u,targetHeight:d},p=Ot(e,l),m=new Set(q(e,t)),h=/* @__PURE__ */ new Set;for(let e=c.getParent(t);e!==null;e=c.getParent(e))h.add(e);let g=At(e,p,t),_=new Set([...m].filter(e=>g.has(e))),v=[...m].filter(e=>{let t=c.getParent(e);return!_.has(e)&&t!==null&&_.has(t)}),y=[...p.keys()].filter(e=>!_.has(e)&&!h.has(e)),b=c.getOpacity(t),x=c.getBlendMode(t),S=[...h].filter(t=>Ft(e,t)).map(e=>({id:e,opacity:c.getOpacity(e),blendMode:c.getBlendMode(e)})),C=c.supportsFill(l)&&c.isFillEnabled(l);c.setOpacity(t,1),c.setBlendMode(t,`Normal`);for(let e of S)c.setOpacity(e.id,1),c.setBlendMode(e.id,`PassThrough`);C&&c.setFillEnabled(l,!1);let w;try{w=await Ut(e,y,()=>Wt(e,l,t,()=>Ht(e,l,{mimeType:n===`layer`?`image/webp`:`image/png`,webpQuality:r,...f},o)))}finally{c.setOpacity(t,b),c.setBlendMode(t,x);for(let e of S)c.setOpacity(e.id,e.opacity),c.setBlendMode(e.id,e.blendMode);C&&c.setFillEnabled(l,!0)}let T=async(e,n,r)=>V(await i.registerWithData(`temp://export/${t}-${e}.${n.split(`/`)[1]}`,`image`,n,r)),E=(e,t=``)=>`<image href="${R(e)}" width="${u}" height="${d}" preserveAspectRatio="none"${t}/>`,D;if(n===`layer`)D=E(await T(`layer`,`image/webp`,w));else{let n=Math.max(...[..._].map(e=>p.get(e)??0)),i=await Ut(e,[...p.keys()].filter(e=>(p.get(e)??0)>n||m.has(e)&&!_.has(e)),()=>Wt(e,l,t,()=>Ht(e,l,{mimeType:`image/webp`,webpQuality:r,...f},o))),a=`bake-mask-${t}`,s=`bake-coverage-${t}`;D=`<defs><filter id="${R(s)}" x="0" y="0" width="1" height="1"><feComponentTransfer><feFuncA type="linear" slope="255" intercept="0"/></feComponentTransfer></filter><mask id="${R(a)}" maskUnits="userSpaceOnUse" x="0" y="0" width="${u}" height="${d}" style="mask-type: alpha">`+E(await T(`mask`,`image/png`,w),` filter="url(#${R(s)})"`)+`</mask></defs>`+E(await T(`backdrop`,`image/webp`,i),` mask="url(#${R(a)})"`)}let O=Y(e,t,a),k=O.id??`el-${s}-${t}`;return{kind:n,image:{type:`svg`,id:t,name:c.getName(t)||``,x:c.getFlipHorizontal(t)?u:0,y:c.getFlipVertical(t)?d:0,width:u,height:d,rotation:0,viewBox:`0 0 ${u} ${d}`,svgContent:D,opacity:1,htmlAttributes:{...O,id:`${k}-image`}},outside:v}}const Kt=/* @__PURE__ */ new Set([`animation/slide/direction`,`animation/pan/direction`]),qt=/* @__PURE__ */ new Set([`animationEasing`,`duration`,`type`,`playback/timeOffset`,`playback/duration`,`textAnimationWritingStyle`,`textAnimationOverlap`]);function Jt(e,t,n=!1){if(!v(()=>e.block.supportsAnimation(t)))return;let r=Yt(e,t,`in`),i=Yt(e,t,`loop`),a=Yt(e,t,`out`);if(!r&&!i&&!a)return;let o={...r&&{inAnimation:r.config},...i&&{loopAnimation:i.config},...a&&{outAnimation:a.config}};if(n){let t=r?.animBlockId??a?.animBlockId??i?.animBlockId;if(t!==void 0){let n=v(()=>e.block.getEnum(t,`textAnimationWritingStyle`));if(n&&n!==`Block`){o.textWritingStyle=n;let r=v(()=>e.block.getFloat(t,`textAnimationOverlap`));r!==void 0&&r!==0&&(o.textOverlap=r)}}}return o}function Yt(e,t,n){let r;if(r=v(n===`in`?()=>e.block.getInAnimation(t):n===`loop`?()=>e.block.getLoopAnimation(t):()=>e.block.getOutAnimation(t)),r!=null&&e.block.isValid(r))return{config:Xt(e,r),animBlockId:r}}function Xt(e,t){let n=e.block.getType(t),r=n.startsWith(`//ly.img.ubq/animation/`)?n.slice(23):n;return{type:r,duration:e.block.getDuration(t),easing:v(()=>e.block.getEnum(t,`animationEasing`))??`Linear`,properties:Zt(e,t,r)}}function Zt(e,t,n){let r={},i=v(()=>e.block.findAllProperties(t));if(i){let a=`animation/${n}/`;for(let n of i){if(!n.startsWith(a)||qt.has(n))continue;let i=n.slice(a.length),o=v(()=>e.block.getPropertyType(n));if(!o)continue;let s;o===`Bool`?s=v(()=>e.block.getBool(t,n)):o===`Float`?(s=v(()=>e.block.getFloat(t,n)),s!==void 0&&Kt.has(n)&&(s=d(e,s))):o===`Enum`?s=v(()=>e.block.getEnum(t,n)):o===`String`&&(s=v(()=>e.block.getString(t,n))),s!==void 0&&(r[i]=s)}}return r}function Qt(e,t){let n=[],r=e.filter(e=>{let r=an(e,t);return r||n.push(e.path),r}),i=tn($t(r),t);if(!i){let e=e=>en.has(e.path);n.push(...r.filter(e).map(e=>e.path)),i=r.filter(t=>!e(t))}let a=i.some(e=>e.path===`rotation`),o=i.some(e=>e.path===`width`||e.path===`height`);if(!t.anchor&&a&&o&&(n.push(`rotation`),i=i.filter(e=>e.path!==`rotation`)),i.length===0)return{unsupported:n};let s=a||o?on(t,i):void 0,c=s?{x:s.x,y:s.y}:{x:0,y:0},l=i.map(e=>sn(e,t,c)),u={...s&&{origin:s},tracks:l.map(e=>e.track)};return l.some(e=>e.motionPath)&&(u.motionPath=!0),{data:u,unsupported:n}}function $t(e){let t=[`x`,`y`].filter(t=>!e.some(e=>e.path===`position/${t}`));return t.length===2?e:e.flatMap(e=>e.path===`position`?t.map(t=>({path:`position/${t}`,mode:e.mode,keyframes:e.keyframes.map(e=>({time:e.time,...e.easing&&{easing:e.easing},value:{type:`Float`,value:fn(e)[t]}}))})):[e])}const en=/* @__PURE__ */ new Set([`position`,`position/x`,`position/y`]);function tn(e,t){if(Math.abs(t.parentRotation??0)<.001)return e;let n=e.filter(e=>e.path===`position/x`||e.path===`position/y`);if(n.length===0)return e;if(n.some(e=>nn(e)!==nn(n[0])))return;let r=(e,r)=>{let i=n.find(t=>t.path===`position/${e}`);if(!i)return 0;let a=dn(i.keyframes[r]);return i.mode===`Relative`?a:a-t.statics[i.path]};return[...e.filter(e=>!n.includes(e)),{path:`position`,mode:`Relative`,keyframes:n[0].keyframes.map((e,t)=>({time:e.time,...e.easing&&{easing:e.easing},value:{type:`Vec2`,value:{x:r(`x`,t),y:r(`y`,t)}}}))}]}function nn(e){let t=e.keyframes.length-1;return JSON.stringify(e.keyframes.map((e,n)=>[e.time,n<t?un(e.easing):null]))}const rn=/* @__PURE__ */ new Set([`position/x`,`position/y`,`rotation`,`opacity`,`width`,`height`,`blur/uniform/intensity`]);function an(e,t){let n=e.keyframes[0]?.value.type;if(n===void 0)return!1;if(rn.has(e.path))return n===`Float`?e.path===`blur/uniform/intensity`?t.target===`svg`||t.target===`text`:e.path===`width`||e.path===`height`?t.target!==`raster`&&t.target!==`group`:!0:!1;switch(e.path){case`position`:return n===`Vec2`;case`fill/color/value`:return n===`Color`&&t.target===`svg`&&t.hasSolidFill;case`stroke/color`:return n===`Color`&&t.target===`svg`&&t.supportsStroke;default:return!1}}function on(e,t){let n=e.statics.width??e.box.width,r=e.statics.height??e.box.height,i=e.inset??{x:(e.box.width-n)/2,y:(e.box.height-r)/2},a=!e.anchor&&t.some(e=>e.path===`rotation`)?{x:n/2,y:r/2}:e.anchor??{x:0,y:0},o={x:i.x+(e.flipH?n-a.x:a.x),y:i.y+(e.flipV?r-a.y:a.y)},s={x:e.box.width/2-o.x,y:e.box.height/2-o.y},c=Math.cos(e.box.rotation),l=Math.sin(e.box.rotation);return{transformOrigin:`${J(o.x)}px ${J(o.y)}px`,x:J(s.x-(c*s.x-l*s.y)),y:J(s.y-(l*s.x+c*s.y))}}function sn(e,t,n){let r=Number.isFinite(t.duration),i=r?e.keyframes:e.keyframes.slice(0,1),a=i.map(e=>r?J(e.time*t.duration):0),o=i.slice(0,-1).map(e=>un(e.easing)),s=e.mode===`Relative`;if(e.path===`position`){let e=e=>ue(e.x,e.y,0,0,t.parentRotation??0),r=r=>{let i=e({x:s?r.x:r.x-t.statics[`position/x`],y:s?r.y:r.y-t.statics[`position/y`]});return[J(n.x+i.x),J(n.y+i.y)]},c=i.map(e=>r(fn(e))),l=i.slice(0,-1).map((t,n)=>{let r=e(t.spatialOut??{x:0,y:0}),i=e(t.spatialIn??{x:0,y:0});if(r.x===0&&r.y===0&&i.x===0&&i.y===0)return null;let[a,o]=c[n],[s,l]=c[n+1];return[a,o,a+r.x,o+r.y,s+i.x,l+i.y,s,l]}),u=l.some(e=>e!==null);return{track:{prop:`xy`,times:a,values:c,eases:o,...u&&{paths:l}},motionPath:u}}if(e.path===`fill/color/value`||e.path===`stroke/color`)return{track:{target:`shape`,prop:e.path===`fill/color/value`?`fill`:`stroke`,times:a,values:i.map(e=>t.colorToCss(pn(e))),eases:o}};let c=n=>dn(n)+(s?t.statics[e.path]??0:0),[l,u]=cn(e.path,t,n);return{track:{prop:l,times:a,values:i.map(e=>u(c(e))),eases:o}}}function cn(e,t,n){switch(e){case`position/x`:case`position/y`:{let r=e===`position/x`?`x`:`y`;return[r,i=>J(n[r]+i-t.statics[e])]}case`rotation`:return[`rotation`,e=>J((e-(t.parentRotation??0))*180/Math.PI)];case`width`:case`height`:return[e,n=>J(t.box[e]+n-t.statics[e])];case`blur/uniform/intensity`:return[`filter`,e=>`blur(${J(e*28.000000000000004)}px)`];default:return[`opacity`,e=>J(e)]}}const ln={EaseIn:{bezier:[.42,0,1,1]},EaseOut:{bezier:[0,0,.58,1]},EaseInOut:{bezier:[.42,0,.58,1]},EaseInSpring:`springIn`,EaseOutSpring:`springOut`,EaseInOutSpring:`springInOut`};function un(e){if(!e)return`none`;switch(e.type){case`Hold`:return`hold`;case`Bezier`:return{bezier:[e.out.x,e.out.y,e.in.x,e.in.y]};default:return ln[e.preset]??U(e.preset)}}function dn(e){return e.value.type===`Float`?e.value.value:0}function fn(e){return e.value.type===`Vec2`?e.value.value:{x:0,y:0}}function pn(e){return e.value.type===`Color`?e.value.value:{r:0,g:0,b:0,a:1}}function J(e){return Math.round(e*1e4)/1e4}function mn(e,t){let n=e.block,{getAnimatedProperties:r,getKeyframes:i,getKeyframeMode:a}=n;if(!r||!i||!a)return[];let o=[t];v(()=>n.supportsFill(t))&&o.push(v(()=>n.getFill(t))??-1),v(()=>n.supportsBlur(t))&&o.push(v(()=>n.getBlur(t))??-1),v(()=>n.supportsShape(t))&&o.push(v(()=>n.getShape(t))??-1),v(()=>n.supportsEffects(t))&&o.push(...v(()=>n.getEffects(t))??[]);let s=[];for(let t of o)if(!(t<0||!v(()=>n.isValid(t))))for(let o of v(()=>r.call(n,t))??[]){let r=v(()=>i.call(n,t,o));if(!r||r.length===0)continue;let c=v(()=>a.call(n,t,o))??`Absolute`;s.push({path:o,mode:c,keyframes:o===`rotation`?r.map(t=>t.value.type===`Float`?{...t,value:{...t.value,value:d(e,t.value.value)}}:t):r})}return s}function hn(e,t){let n=e.block,{getAnimatedProperties:r}=n;if(!r)return[];let i=e.block,a=[];if(v(()=>n.isStrokeEnabled(t))){let e=v(()=>i.getStrokeFill?.(t));e!=null&&a.push({id:e,role:`stroke fill`})}if(v(()=>i.supportsTextAnimators?.(t)))for(let e of v(()=>i.getTextAnimators?.(t))??[])a.push({id:e,role:`text animator`});let o=[];if(v(()=>n.supportsShape(t))){let e=v(()=>n.getShape(t));e!=null&&o.push(e)}if(v(()=>i.supportsMasks?.(t)))for(let e of v(()=>i.getMasks?.(t))??[]){a.push({id:e,role:`mask`});let t=v(()=>n.getShape(e));t!=null&&(a.push({id:t,role:`mask shape`}),o.push(t))}let s=/* @__PURE__ */ new Set;for(let e=0;e<o.length;e++){let t=o[e];if(!s.has(t)){s.add(t);for(let e of v(()=>i.getModifiers?.(t))??[])a.push({id:e,role:`modifier`});for(let e of v(()=>i.getSubshapes?.(t))??[])a.push({id:e,role:`subshape`}),o.push(e)}}let c=[];for(let{id:e,role:t}of a)if(v(()=>n.isValid(e)))for(let i of v(()=>r.call(n,e))??[])c.push(`${i} (${t})`);return c}function gn(e,t,n,r){for(let i of mn(e,t))r.emit(`ANIMATION_KEYFRAME_UNSUPPORTED`,{name:n,property:i.path})}function _n(e,t,n,r,i){let a=e.block,o=!!v(()=>a.isFillEnabled(t)),s=!!v(()=>a.isStrokeEnabled(t)),c=!!v(()=>a.isBlurEnabled(t)),l=v(()=>a.getStrokeFill?.(t)),u=a.getName(t)||`Block ${t}`,f=e=>i.emit(`ANIMATION_KEYFRAME_UNSUPPORTED`,{name:u,property:e}),p=mn(e,t).filter(e=>{if(e.path===`stroke/color`&&l!=null&&s){let t=new Set(e.keyframes.map(e=>e.value.type===`Color`?e.value.value.a:void 0));return(t.size>1||t.has(0))&&f(e.path),!1}let{path:t}=e;return!(t.startsWith(`fill/`)&&!o)&&!(t.startsWith(`stroke/`)&&!s)&&!(t.startsWith(`blur/`)&&!c)});if(hn(e,t).forEach(f),p.length===0)return;if(!n.timeline){p.forEach(e=>f(e.path));return}let m=i,h=t=>{let n=D(E(t,e,m));return`r`in t||(m=new g),n},_=v(()=>a.getFill(t)),y=o&&_!=null?v(()=>a.getType(_)):void 0,b=v(()=>a.getBlur(t)),x=d(e,a.getRotation(t)),S=v(()=>a.getParent(t)),C=S!=null&&v(()=>a.getType(S))===`//ly.img.ubq/group`?d(e,v(()=>a.getRotation(S))??0):0,{hasTransformAnchor:w}=a,T=w?v(()=>w.call(a,t))??!0:!0,O=n.type===`text`&&n.backgroundColor?.enabled?n.backgroundColor:void 0,{data:k,unsupported:A}=Qt(p,{duration:n.timeline.duration,target:r?`raster`:n.type,hasSolidFill:y===`//ly.img.ubq/fill/color`,supportsStroke:s,statics:{"position/x":a.getFrameX(t),"position/y":a.getFrameY(t),rotation:x,opacity:v(()=>a.getOpacity(t))??1,width:a.getFrameWidth(t),height:a.getFrameHeight(t),"blur/uniform/intensity":b!=null&&v(()=>a.getFloat(b,`blur/uniform/intensity`))||0},box:{width:n.width+(O?O.paddingLeft+O.paddingRight:0),height:n.height+(O?O.paddingTop+O.paddingBottom:0),rotation:x-C},...O&&{inset:{x:O.paddingLeft,y:O.paddingTop}},...T&&{anchor:{x:v(()=>a.getFloat(t,`transform/anchor/x`))??0,y:v(()=>a.getFloat(t,`transform/anchor/y`))??0}},flipH:!!v(()=>a.getFlipHorizontal(t)),flipV:!!v(()=>a.getFlipVertical(t)),parentRotation:C,colorToCss:h});return A.forEach(f),k}function vn(e,t){let n=v(()=>e.block.getTimeOffset(t)),r=v(()=>e.block.getDuration(t));if(n!==void 0&&r!==void 0&&(n!==0||Number.isFinite(r))&&!(r<=0))return{timeOffset:n,duration:r}}function Y(e,t,n){let r=e.block.getName(t)||``,i={"data-block-id":String(t),"data-block-name":r},a=v(()=>e.block.findAllMetadata(t));if(a){for(let r of a)if(r.startsWith(`html5-exporter-`)){let a=r.slice(15),o=e.block.getMetadata(t,r);!a.startsWith(`data-`)&&!a.startsWith(`aria-`)&&n?.emit(`METADATA_NON_DATA_ATTR`,{blockId:t,key:r,attrName:a}),i[a]=o}}return i}async function yn(e,t,n,r,i,a,o,s){let c=d(e,e.block.getRotation(t)),l=e.block.getName(t)||``,u=j(e.block.getBlendMode(t)),f=Math.ceil(e.block.getFrameWidth(t)),p=Math.ceil(e.block.getFrameHeight(t)),m=v(()=>e.block.getOpacity(t))??1;m<1&&e.block.setOpacity(t,1);let h;try{h=await Ht(e,t,{mimeType:`image/webp`,webpQuality:n,targetWidth:f,targetHeight:p},s)}finally{m<1&&e.block.setOpacity(t,m)}let g=`temp://export/${t}.webp`,_=await a.registerWithData(g,`image`,`image/webp`,h),y={x:e.block.getFrameX(t),y:e.block.getFrameY(t),width:e.block.getFrameWidth(t),height:e.block.getFrameHeight(t)},{x:b,y:x}=y,{width:S,height:C}=y;e.block.supportsStroke(t)&&e.block.isStrokeEnabled(t)&&({x:b,y:x,width:S,height:C}=ce({x:b,y:x,width:S,height:C},e.block.getStrokeWidth(t),e.block.getStrokePosition(t)));let w=Y(e,t,o),T=v(()=>e.block.getOpacity(t))??1,E=`<image href="${R(V(_))}" width="${L(S)}" height="${L(C)}" preserveAspectRatio="none"/>`;return{type:`svg`,id:t,name:l,x:b,y:x,width:S,height:C,rotation:c,viewBox:`0 0 ${L(S)} ${L(C)}`,svgContent:E,opacity:T,blendMode:u,sortingOrder:r,originalIndex:i,htmlAttributes:w}}function bn(e,t,n){return e.sortingOrder=t,e.originalIndex=n,e}async function xn(e,t,n,r,i,a){if(!v(()=>e.block.isValid(t))||!v(()=>e.block.isVisible(t))||!v(()=>e.block.isIncludedInExport(t)))return null;let o=e.block.getType(t),s=o===`//ly.img.ubq/group`,c=o===`//ly.img.ubq/text`,l=o===`//ly.img.ubq/graphic`,u=F(e,t),d=null,f=!1,p=s?Bt(e,t):`none`;if(p!==`none`)Vt(e,t,r.logger),d=await Ge(e,t,n,r,u,i,xn,a,await Gt(e,t,p,r.quality,a,r.logger,r.transactionId,r.pageIndex));else if(s)d=await Ge(e,t,n,r,u,i,xn,a);else if(c)d=bn(await Ue(e,t,n,{insertExplicitLineBreaks:r.insertExplicitLineBreaks,logger:r.logger,resourceMap:a}),u,i);else if(l){let n=await Oe(e,t,a,r.logger);n?d=bn(n,u,i):(f=!0,d=await yn(e,t,r.quality,u,i,a,r.logger,r.transactionId))}else f=!0,d=await yn(e,t,r.quality,u,i,a,r.logger,r.transactionId);if(d&&r.animated){let n=e.block.getName(t);if(p===`backdrop`){d.timeline=vn(e,t);let i=Jt(e,t,!1);(i?.inAnimation||i?.loopAnimation||i?.outAnimation)&&r.logger.emit(`GROUP_BAKED_ANIMATION_UNSUPPORTED`,{name:n||`Group ${t}`}),gn(e,t,n||`Group ${t}`,r.logger)}else if(n!==`page-background`){d.timeline=vn(e,t),d.animation=Jt(e,t,c);let n=_n(e,t,d,f,r.logger);n&&(d.animation={...d.animation,keyframes:n})}else{let n=e.block.getParent(t);gn(e,t,n!==null&&e.block.getName(n)||`Page`,r.logger)}}return d}async function Sn(e,t,n,r,i){let{pageId:a}=t;if(!v(()=>e.block.isIncludedInExport(a)))return[];let o=e.block.getChildren(a),c=[];for(let t of o)if(e.block.getType(t)===`//ly.img.ubq/track`){if(!v(()=>e.block.isIncludedInExport(t)))continue;c.push(...e.block.getChildren(t))}else c.push(t);if(o=c,r.animated){let t=v(()=>e.block.getDuration(a));t!==void 0&&v(()=>e.block.setPlaybackTime(a,t/2))}let l=[];for(let t=0;t<o.length;t++){s(r.abortSignal);let a=o[t],c=await xn(e,a,n,r,t,i);if(c){let t=e.block.getFlipHorizontal(a),n=e.block.getFlipVertical(a),r=le(c.x,c.y,c.width,c.height,c.rotation,t,n);c.x=r.x,c.y=r.y,l.push(c)}}return Pt(e,a,l,t)}async function Cn(e,t,n,r){let i=n.logger??new g,a=n.logger?n:{...n,logger:i},o=[];for(let c of t.pages){if(c.pageIndex!==n.pageIndex)continue;s(n.abortSignal);let t=/* @__PURE__ */ new Map,l=await Sn(e,c,t,a,r);a.useSyntheticIds&&Tn(l);let u,d=c.pageId;e.block.isValid(d)&&e.block.supportsFill(d)&&!e.block.isFillEnabled(d)&&(u=`transparent`);let f;if(n.animated&&l.some(e=>e.timeline)){let t;try{t=e.block.getDuration(d)}catch{t=l.reduce((e,t)=>t.timeline?Math.max(e,t.timeline.timeOffset+t.timeline.duration):e,0)}t>0&&(f={totalDuration:t})}o.push({pageIndex:c.pageIndex,width:c.width,height:c.height,elements:l,fonts:t,backgroundColor:u,timeline:f});let p=l.filter(e=>e.type===`text`).length,m=l.filter(e=>e.type===`svg`).length,h=l.filter(e=>e.type===`group`).length;i.emit(`HTML_PAGE_PROCESSED`,{page:c.pageIndex+1,textCount:p,svgCount:m,groupCount:h,fontCount:t.size})}return{pages:o}}function wn(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}function Tn(e){let t=/* @__PURE__ */ new Map;a(e,t);let n=new Set([...t].filter(([,e])=>e===1).map(([e])=>wn(e))),r=/* @__PURE__ */ new Set,i=0;function a(e,t){for(let n of e)n.name&&(n.type!==`group`||n.fragmentIndex===void 0)&&t.set(n.name,(t.get(n.name)||0)+1),n.type===`group`&&n.children&&a(n.children,t)}function o(e){for(let a of e){let e=i++;a.id=e;let s=!!(a.name&&t.get(a.name)===1),c=s?wn(a.name):`element-${e}`,l=c;if(r.has(l)||!s&&n.has(l)){let e=1;do l=`${c}-${e++}`;while(r.has(l)||n.has(l))}r.add(l),a.name||=l,a.htmlAttributes&&(a.htmlAttributes.id=l,a.htmlAttributes[`data-block-id`]=String(e)),a.type===`group`&&a.children&&o(a.children)}}o(e)}let X=null;function En(){if(X)return X;X=/* @__PURE__ */ new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;X[e]=t}return X}function Dn(e){let t=4294967295,n=En();for(let r=0;r<e.length;r++)t=t>>>8^n[(t^e[r])&255];return(t^4294967295)>>>0}function On(e){return new TextEncoder().encode(e)}function kn(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Z(e,t,n){e[t]=n&255,e[t+1]=n>>>8&255}function Q(e,t,n){e[t]=n&255,e[t+1]=n>>>8&255,e[t+2]=n>>>16&255,e[t+3]=n>>>24&255}async function An(e){let t=[],n=[],r=0;for(let[i,a]of e){let e=typeof a==`string`?On(a):a,o=On(i),s=new Uint8Array(30+o.length);Q(s,0,67324752),Z(s,4,20),Z(s,6,0),Z(s,8,0),Z(s,10,0),Z(s,12,0),Q(s,14,Dn(e)),Q(s,18,e.length),Q(s,22,e.length),Z(s,26,o.length),Z(s,28,0),s.set(o,30),t.push({name:i,data:e,offset:r}),n.push(s,e),r+=s.length+e.length}let i=r;for(let e of t){let t=On(e.name),i=new Uint8Array(46+t.length);Q(i,0,33639248),Z(i,4,20),Z(i,6,20),Z(i,8,0),Z(i,10,0),Z(i,12,0),Z(i,14,0),Q(i,16,Dn(e.data)),Q(i,20,e.data.length),Q(i,24,e.data.length),Z(i,28,t.length),Z(i,30,0),Z(i,32,0),Z(i,34,0),Z(i,36,0),Q(i,38,0),Q(i,42,e.offset),i.set(t,46),n.push(i),r+=i.length}let a=r-i,o=/* @__PURE__ */ new Uint8Array(22);return Q(o,0,101010256),Z(o,4,0),Z(o,6,0),Z(o,8,t.length),Z(o,10,t.length),Q(o,12,a),Q(o,16,i),Z(o,20,0),n.push(o),kn(n)}var jn=class extends Map{async toZip(){let e=/* @__PURE__ */ new Map;for(let[t,n]of this)e.set(t,n.content);return An(e)}};function Mn(e,t,n,r,i){let[a,o]=$(t,r),[s,c]=$(n,i);e.push(`left: ${a}px`),e.push(`top: ${s}px`),e.push(`width: ${o}px`),e.push(`height: ${c}px`)}function Nn(e,t,n,r){return{x:Number($(e,n)[0]),y:Number($(t,r)[0])}}function $(e,t){let n=Math.round(e),r=Math.round(e+t);return r===n&&t>0?[L(e),L(t)]:[String(n),String(r-n)]}function Pn(e,t){if(t!==0){let n=t*180/Math.PI;e.push(`transform: rotate(${n.toFixed(2)}deg)`),e.push(`transform-origin: center`)}}function Fn(e,t){t&&e.push(`mix-blend-mode: ${t}`)}function In(e,t){t<1&&e.push(`opacity: ${t.toFixed(2)}`)}function Ln(e){return e.timeline?` data-timeline-offset="${L(e.timeline.timeOffset,3)}" data-timeline-duration="${L(e.timeline.duration,3)}"`:``}function Rn(e){return e?` data-animation='${JSON.stringify(e)}'`:``}function zn(e){let t=[];return Mn(t,e.x,e.y,e.width,e.height),Pn(t,e.rotation),In(t,e.opacity),Fn(t,e.blendMode),e.isolated&&t.push(`isolation: isolate`),t.join(`; `)}function Bn(e,t,n,r,i){let a=Nn(e.x,e.y,e.width,e.height),o=e.x-a.x,s=e.y-a.y,c=Math.cos(e.rotation),l=Math.sin(e.rotation),u=e.children.map((e,a)=>n({...e,x:e.x+o*c+s*l,y:e.y-o*l+s*c},a,t,r,i)).join(`
3
+ `),d=re({defaultId:`el-${t}-${e.id}`,defaultClass:`group-element`,style:zn(e),htmlAttributes:e.htmlAttributes});e.fragmentIndex!==void 0&&(d.id=`${d.id}-fragment-${e.fragmentIndex}`);let f=K(e.animation,e.x,e.y,e.width,e.height,r,i);return` <div ${ne(d)}${Ln(e)}${Rn(f)}>
4
+ ${u}
5
+ </div>`}function Vn(e){let t=[];return Mn(t,e.x,e.y,e.width,e.height),t.push(e.strokeOutset?`overflow: visible`:`overflow: hidden`),In(t,e.opacity),Pn(t,e.rotation),Fn(t,e.blendMode),t.join(`; `)}function Hn(e,t,n,r){let i=e.strokeOutset??0,a=K(e.animation,e.x-i,e.y-i,e.width+2*i,e.height+2*i,n,r,i);return` <svg ${ne(re({defaultId:`el-${t}-${e.id}`,defaultClass:`element`,style:Vn(e),htmlAttributes:e.htmlAttributes}))} ${`viewBox="${e.viewBox}"`} preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"${Ln(e)}${Rn(a)}>\n${e.svgContent}\n </svg>`}function Un(e,t,n,r){let i=[],a=e.backgroundColor?.enabled?e.backgroundColor.paddingLeft:0,o=e.backgroundColor?.enabled?e.backgroundColor.paddingTop:0;i.push(`left: ${Math.round(e.x-a)}px`),i.push(`top: ${Math.round(e.y-o)}px`);let s=e.backgroundColor?.enabled?e.backgroundColor.paddingRight:0,c=e.backgroundColor?.enabled?e.backgroundColor.paddingBottom:0,l=e.horizontalAlignment!==`Left`;if(e.widthMode===`Auto`?(i.push(`white-space: nowrap`),(e.rotation!==0||l)&&i.push(`width: ${Math.ceil(e.width+a+s)}px`)):(i.push(`width: ${Math.ceil(e.width+a+s)}px`),e.autoFontSizeEnabled?(i.push(`white-space: pre-wrap`),i.push(`overflow-wrap: break-word`)):e.insertExplicitLineBreaks?i.push(`white-space: nowrap`):(i.push(`white-space: pre-wrap`),i.push(`overflow-wrap: break-word`))),(e.heightMode!==`Auto`||e.rotation!==0)&&i.push(`height: ${Math.ceil(e.height+o+c)}px`),i.push(`text-align: ${{Left:`left`,Center:`center`,Right:`right`}[e.horizontalAlignment]||`left`}`),e.verticalAlignment!==`Top`&&(i.push(`display: flex`),i.push(`flex-direction: column`),e.verticalAlignment===`Center`?i.push(`justify-content: center`):e.verticalAlignment===`Bottom`&&i.push(`justify-content: flex-end`)),Pn(i,e.rotation),e.effects.shadowEnabled&&e.effects.shadowColor){let t=(e.effects.shadowBlurX+e.effects.shadowBlurY)/2*.56,n=`${L(e.effects.shadowOffsetX,1)}px ${L(e.effects.shadowOffsetY,1)}px ${t.toFixed(1)}px ${D(e.effects.shadowColor)}`;i.push(`text-shadow: ${n}`)}if(e.effects.strokeEnabled&&e.effects.strokeColor&&i.push(`-webkit-text-stroke: ${L(e.effects.strokeWidth,1)}px ${D(e.effects.strokeColor)}`),In(i,e.opacity),e.backgroundColor?.enabled){let t=e.backgroundColor;i.push(`background: ${D(t.color)}`),i.push(`padding: ${L(t.paddingTop,1)}px ${L(t.paddingRight,1)}px ${L(t.paddingBottom,1)}px ${L(t.paddingLeft,1)}px`),t.cornerRadius>0&&i.push(`border-radius: ${L(t.cornerRadius,1)}px`)}return Fn(i,e.blendMode),Wn(e,t,i,n,r)}function Wn(e,t,n,r,i){let a=e.insertExplicitLineBreaks&&!e.autoFontSizeEnabled?new Set(e.lineBreakIndices):null,o=0,s=e.runs.map(t=>{let n=[];n.push(`font-family: '${t.fontFamily}', sans-serif`);let r=t.script,i=r?.fontScale??1;if(n.push(`font-size: ${L(t.fontSize*i)}px`),e.lineHeight>0){let t=r?e.emRatio+(e.lineHeight-e.emRatio)/i:e.lineHeight;n.push(`line-height: ${L(t,4)}`)}if(r){let e=r.verticalShift/i,t=r.style===`Superscript`?1:-1;n.push(`vertical-align: ${L(t*e,4)}em`)}e.letterSpacing!==0&&n.push(`letter-spacing: ${L(e.letterSpacing,4)}em`);let s=P(t.fontWeight);if(s!==400&&n.push(`font-weight: ${s}`),t.fontStyle===`italic`&&n.push(`font-style: italic`),e.fillEnabled?n.push(`color: ${D(t.color)}`):n.push(`color: transparent`),t.textCase&&t.textCase!==`Normal`){let e={Uppercase:`uppercase`,Lowercase:`lowercase`,Titlecase:`capitalize`};e[t.textCase]&&n.push(`text-transform: ${e[t.textCase]}`)}let c=``;for(let e=0;e<t.text.length;e++){let n=t.text[e],r=n===`
6
+ `||n===`\u2028`||n===`\u2029`;a?.has(o)&&!r&&(c+=`<br>`),c+=r?`<br>`:te(n),o++}c=c.replaceAll(` <br>`,`&nbsp;<br>`);let l=r?` data-font-scale="${L(i,4)}"`:``;return`<span style="${n.join(`; `)}"${l}>${c}</span>`}).join(``),c=e.autoFontSizeEnabled&&e.widthMode===`Absolute`&&e.heightMode===`Absolute`?{...e.htmlAttributes,"data-auto-size":`true`,...e.minAutoFontSize!=null&&{"data-min-font-size":String(e.minAutoFontSize)},...e.maxAutoFontSize!=null&&{"data-max-font-size":String(e.maxAutoFontSize)}}:e.htmlAttributes,l=re({defaultId:`el-${t}-${e.id}`,defaultClass:`text-element`,style:n.join(`; `),htmlAttributes:c}),u=K(e.animation,e.x,e.y,e.width,e.height,r,i),d=[`font-size: 0`];if(e.lineHeight>0&&e.runs.length>0&&e.emRatio>0){let t=Math.max(...e.runs.map(e=>e.fontSize)),n=(e.lineHeight-e.emRatio)*t/2;Math.abs(n)>.5&&(d.push(`margin-top: ${(-n).toFixed(1)}px`),d.push(`margin-bottom: ${(-n).toFixed(1)}px`))}let f=d.length>0?` style="${d.join(`; `)}"`:``;return` <div ${ne(l)}${Ln(e)}${Rn(u)}><div${f}>${s}</div></div>`}function Gn(e){if(e.startsWith(`data:`)){let t=De(e);return t?.includes(`woff2`)?`woff2`:t?.includes(`woff`)?`woff`:t?.includes(`opentype`)||t?.includes(`otf`)?`opentype`:`truetype`}return e.endsWith(`.woff2`)?`woff2`:e.endsWith(`.woff`)?`woff`:e.endsWith(`.otf`)?`opentype`:`truetype`}function Kn(e){let t=[];for(let[,n]of e){let e=H(n.uri),r=Ee(n.uri),i=Te(n.uri)||e||r;if(n.data.length===0&&!i)continue;let a=V(n.uri),o;o=Te(n.uri)?`url(${n.uri})`:e?`url('${n.uri}')`:`url('${a}')`;let s=Gn(n.uri);t.push(` @font-face {
7
+ font-family: '${n.fontFamily}';
8
+ font-weight: ${P(n.fontWeight)};
9
+ font-style: ${n.fontStyle};
10
+ src: ${o} format('${s}');
11
+ }`)}return t.join(`
12
+ `)}let qn;function Jn(){return qn??=`(function() {
16
13
  function autoSize() {
17
14
  var elements = document.querySelectorAll('[data-auto-size]');
18
15
  for (var i = 0; i < elements.length; i++) {
@@ -26,11 +23,16 @@ ${t.svgContent}
26
23
  var spans = el.querySelectorAll('span');
27
24
  if (spans.length === 0) return;
28
25
 
26
+ // A script span carries its scaled size and its scale. The bounds apply to
27
+ // the unscaled size, as in the engine, so the scale stays fixed.
29
28
  var originalSizes = [];
29
+ var fontScales = [];
30
30
  for (var i = 0; i < spans.length; i++) {
31
31
  var size = parseFloat(spans[i].style.fontSize);
32
32
  if (!size) throw new Error('auto-size: span missing inline font-size');
33
- originalSizes.push(size);
33
+ var fontScale = parseFloat(spans[i].getAttribute('data-font-scale')) || 1;
34
+ originalSizes.push(size / fontScale);
35
+ fontScales.push(fontScale);
34
36
  }
35
37
 
36
38
  var lo = 0.01;
@@ -61,7 +63,7 @@ ${t.svgContent}
61
63
 
62
64
  for (var iter = 0; iter < 30; iter++) {
63
65
  var mid = (lo + hi) / 2;
64
- applyScale(spans, originalSizes, mid, minFontSize, maxFontSize);
66
+ applyScale(spans, originalSizes, fontScales, mid, minFontSize, maxFontSize);
65
67
  if (el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth) {
66
68
  hi = mid;
67
69
  } else {
@@ -69,16 +71,16 @@ ${t.svgContent}
69
71
  }
70
72
  }
71
73
 
72
- applyScale(spans, originalSizes, lo, minFontSize, maxFontSize);
74
+ applyScale(spans, originalSizes, fontScales, lo, minFontSize, maxFontSize);
73
75
  el.style.overflow = prevOverflow;
74
76
  }
75
77
 
76
- function applyScale(spans, originalSizes, scale, minFS, maxFS) {
78
+ function applyScale(spans, originalSizes, fontScales, scale, minFS, maxFS) {
77
79
  for (var i = 0; i < spans.length; i++) {
78
80
  var newSize = originalSizes[i] * scale;
79
81
  if (minFS > 0 && newSize < minFS) newSize = minFS;
80
82
  if (maxFS < Infinity && newSize > maxFS) newSize = maxFS;
81
- spans[i].style.fontSize = newSize + 'px';
83
+ spans[i].style.fontSize = newSize * fontScales[i] + 'px';
82
84
  }
83
85
  }
84
86
 
@@ -88,477 +90,594 @@ ${t.svgContent}
88
90
  } else {
89
91
  autoSize();
90
92
  }
91
- })();`.trim()),Rt}var or={id:"auto-sizing",triggerAttribute:"data-auto-size",getScript:nr};var Ir=[or];function ir(t){let e=[];for(let n of Ir)t.includes(n.triggerAttribute)&&e.push(n.getScript());if(e.length===0)return t;let r=`
92
- <script>${e.join(`
93
- `)}<\/script>`;return t.replace("</body>",`${r}
94
- </body>`)}var Ht=`"use strict";
95
- (() => {
96
- // src/html-export/runtime/easing.ts
97
- function springOutEase(t) {
98
- if (t <= 0) return 0;
99
- if (t >= 1) return 1;
100
- return Math.pow(2, -10 * t) * Math.sin((t * 10 - 0.75) * (2 * Math.PI / 3)) + 1;
101
- }
102
- function springInEase(t) {
103
- return 1 - springOutEase(1 - t);
104
- }
105
- function resolveEase(result) {
106
- if (result.customEase === "springOut") return springOutEase;
107
- if (result.customEase === "springIn") return springInEase;
108
- return result.ease;
109
- }
93
+ })();`,qn}const Yn=[{id:`auto-sizing`,triggerAttribute:`data-auto-size`,getScript:Jn}];function Xn(e){let t=[];for(let n of Yn)e.includes(n.triggerAttribute)&&t.push(n.getScript());if(t.length===0)return e;let n=`\n <script>${t.join(`
94
+ `)}<\/script>`;return e.replace(`</body>`,`${n}\n</body>`)}function Zn(e){return e.type===`text`&&e.animation?.textWritingStyle?!0:e.type===`group`&&e.children.some(e=>Zn(e))}function Qn(e){return e.animation?.keyframes?.motionPath?!0:e.type===`group`&&e.children.some(e=>Qn(e))}function $n(e,t,n,r,i){return e.type===`svg`?Hn(e,n,r,i):e.type===`group`?Bn(e,n,$n,r,i):Un(e,n,r,i)}function er(e){let{width:t,height:n,elements:r,fonts:i,backgroundColor:a,pageIndex:o,timeline:s}=e,c=/* @__PURE__ */ new Set([`container`,`background`,`content`]),l=/* @__PURE__ */ new Set;function u(e){for(let t of e)c.add(t.htmlAttributes?.id??`el-${o}-${t.id}`),t.type===`group`&&u(t.children)}u(r);function d(e,r){if(e.type!==`group`)return $n(e,r,o,t,n);let i=e.htmlAttributes?.id??`el-${o}-${e.id}`,a=e;if(e.fragmentIndex!==void 0){let t=i;if(l.has(i)){let n=e.fragmentIndex;do t=`${i}-fragment-${n++}`;while(c.has(t));c.add(t)}a={...e,fragmentIndex:void 0,htmlAttributes:{...e.htmlAttributes,id:t}}}return l.add(i),Bn(a,o,d,t,n)}let f=[],p=[];for(let e of r)e.name===`page-background`?f.push(e):p.push(e);let m=0,h=f.map(e=>d(e,m++)).join(`
95
+ `),g=p.map(e=>d(e,m++)).join(`
96
+ `),_=a?`background: ${a};`:`background: #fff;`,v=Kn(i),y=Math.round(t),b=Math.round(n),x=s?` data-timeline-duration="${s.totalDuration}"`:``,S=[r.some(e=>Zn(e))&&`SplitText`,r.some(e=>Qn(e))&&`MotionPathPlugin`].filter(Boolean),C=S.length>0?` data-requires-plugins="${S.join(` `)}"`:``,w=s?`
97
+ <script>
98
+ "use strict";
110
99
 
111
- // src/html-export/runtime/stagger.ts
112
- function computeStaggerTiming(totalDur, N, overlap) {
113
- if (N <= 1) return { segDur: totalDur, staggerDelay: 0 };
114
- const segDur = totalDur * ((1 - overlap) / N + overlap);
115
- const staggerDelay = (totalDur - segDur) / Math.max(1, N - 1);
116
- return { segDur, staggerDelay };
117
- }
100
+ (function() {
118
101
 
119
- // src/html-export/runtime/text-animation.ts
120
- function getTextContentTarget(el) {
121
- const inner = el.firstElementChild;
122
- if (inner && inner.tagName === "DIV" && !inner.classList.length) {
123
- return inner;
124
- }
125
- return el;
126
- }
127
- function splitTextElement(el, writingStyle) {
128
- if (typeof SplitText === "undefined") {
129
- throw new Error(
130
- "[html5-exporter] SplitText plugin is required for text animation (writingStyle: " + writingStyle + ") but was not found."
131
- );
132
- }
133
- const typeMap = {
134
- Line: "lines",
135
- Word: "words",
136
- Character: "chars"
137
- };
138
- const splitType = typeMap[writingStyle];
139
- if (!splitType) {
140
- throw new Error("[html5-exporter] Unknown writingStyle: " + writingStyle);
141
- }
142
- const target = getTextContentTarget(el);
143
- const split = new SplitText(target, { type: splitType });
144
- return {
145
- targets: split[splitType],
146
- split,
147
- type: splitType
148
- };
149
- }
150
- function applyTextAnimation(tl, el, animData, phaseResult, phaseOffset, phase) {
151
- const writingStyle = animData.textWritingStyle;
152
- const overlap = animData.textOverlap || 0;
153
- const ease = resolveEase(phaseResult);
154
- if (animData.spread) {
155
- const splitResult = splitTextElement(el, "Character");
156
- const chars = splitResult.targets;
157
- const spreadParams = animData.spread;
158
- const elRect = el.getBoundingClientRect();
159
- const blockCenterX = elRect.width / 2;
160
- const halfWidth = elRect.width / 2;
161
- chars.forEach(function(charEl) {
162
- const charRect = charEl.getBoundingClientRect();
163
- const charCenterX = charRect.left - elRect.left + charRect.width / 2;
164
- const relativeCenterX = halfWidth > 0 ? (charCenterX - blockCenterX) / halfWidth : 0;
165
- const offsetX = spreadParams.blockWidth * relativeCenterX * spreadParams.intensity;
166
- if (phase === "in") {
167
- tl.from(
168
- charEl,
169
- {
170
- x: offsetX,
171
- opacity: phaseResult.from && phaseResult.from.opacity !== void 0 ? phaseResult.from.opacity : 1,
172
- duration: phaseResult.duration,
173
- ease,
174
- immediateRender: false
175
- },
176
- phaseOffset
177
- );
178
- } else {
179
- tl.to(
180
- charEl,
181
- {
182
- x: offsetX,
183
- opacity: phaseResult.to && phaseResult.to.opacity !== void 0 ? phaseResult.to.opacity : 1,
184
- duration: phaseResult.duration,
185
- ease
186
- },
187
- phaseOffset
188
- );
189
- }
190
- });
191
- return;
192
- }
193
- if (animData.merge) {
194
- const splitResult2 = splitTextElement(el, "Word");
195
- const lineSplit = new SplitText(getTextContentTarget(el), {
196
- type: "lines,words"
197
- });
198
- const mergeParams = animData.merge;
199
- const moveFirstLineLeft = mergeParams.direction === "Left";
200
- const timing = computeStaggerTiming(
201
- phaseResult.duration,
202
- splitResult2.targets.length,
203
- overlap
204
- );
205
- splitResult2.targets.forEach(function(wordEl, wordIdx) {
206
- let lineIdx = 0;
207
- if (lineSplit.lines) {
208
- for (let li = 0; li < lineSplit.lines.length; li++) {
209
- if (lineSplit.lines[li].contains(wordEl)) {
210
- lineIdx = li;
211
- break;
212
- }
213
- }
214
- }
215
- const isEvenLine = lineIdx % 2 === 0;
216
- const dirSign = isEvenLine === moveFirstLineLeft ? -1 : 1;
217
- const wordOffset = phaseOffset + wordIdx * timing.staggerDelay;
218
- if (phase === "in") {
219
- tl.from(
220
- wordEl,
221
- {
222
- x: dirSign * mergeParams.distance,
223
- duration: timing.segDur,
224
- ease,
225
- immediateRender: false
226
- },
227
- wordOffset
228
- );
229
- tl.from(
230
- wordEl,
231
- {
232
- opacity: 0,
233
- duration: timing.segDur / 2,
234
- ease: "none",
235
- immediateRender: false
236
- },
237
- wordOffset
238
- );
239
- } else {
240
- tl.to(
241
- wordEl,
242
- {
243
- x: dirSign * mergeParams.distance,
244
- duration: timing.segDur,
245
- ease
246
- },
247
- wordOffset
248
- );
249
- tl.to(
250
- wordEl,
251
- {
252
- opacity: 0,
253
- duration: timing.segDur / 2,
254
- ease: "none"
255
- },
256
- wordOffset + timing.segDur / 2
257
- );
258
- }
259
- });
260
- return;
261
- }
262
- const splitResult3 = splitTextElement(el, writingStyle);
263
- const targets = splitResult3.targets;
264
- const timing2 = computeStaggerTiming(
265
- phaseResult.duration,
266
- targets.length,
267
- overlap
268
- );
269
- if (phase === "in") {
270
- if (phaseResult.from) {
271
- const toState = {};
272
- for (const fk in phaseResult.from) {
273
- toState[fk] = fk === "opacity" || fk === "scale" || fk === "scaleX" || fk === "scaleY" ? 1 : 0;
274
- }
275
- tl.set(
276
- targets,
277
- { ...phaseResult.from, immediateRender: false },
278
- phaseOffset
279
- );
280
- for (let si = 0; si < targets.length; si++) {
281
- const segOffset = phaseOffset + si * timing2.staggerDelay;
282
- tl.to(
283
- targets[si],
284
- {
285
- ...toState,
286
- duration: timing2.segDur,
287
- ease
288
- },
289
- segOffset
290
- );
291
- }
292
- }
293
- if (phaseResult.to) {
294
- tl.to(
295
- targets,
296
- {
297
- ...phaseResult.to,
298
- duration: timing2.segDur,
299
- ease,
300
- stagger: timing2.staggerDelay
301
- },
302
- phaseOffset
303
- );
304
- }
305
- } else {
306
- if (phaseResult.to) {
307
- tl.to(
308
- targets,
309
- {
310
- ...phaseResult.to,
311
- duration: timing2.segDur,
312
- ease,
313
- stagger: timing2.staggerDelay
314
- },
315
- phaseOffset
316
- );
317
- }
318
- if (phaseResult.from) {
319
- for (let oi = 0; oi < targets.length; oi++) {
320
- const outSegOffset = phaseOffset + oi * timing2.staggerDelay;
321
- tl.to(
322
- targets[oi],
323
- {
324
- ...phaseResult.from,
325
- duration: timing2.segDur,
326
- ease
327
- },
328
- outSegOffset
329
- );
330
- }
331
- }
332
- }
333
- }
102
+ // src/html-export/runtime/easing.ts
103
+ function springOutEase(t) {
104
+ if (t <= 0) return 0;
105
+ if (t >= 1) return 1;
106
+ return Math.pow(2, -10 * t) * Math.sin((t * 10 - .75) * (2 * Math.PI / 3)) + 1;
107
+ }
108
+ function springInEase(t) {
109
+ return 1 - springOutEase(1 - t);
110
+ }
111
+ function springInOutEase(t) {
112
+ if (t <= 0) return 0;
113
+ if (t >= 1) return 1;
114
+ const c5 = 2 * Math.PI / 4.5;
115
+ const s = Math.sin((20 * t - 11.125) * c5);
116
+ return t < .5 ? -(Math.pow(2, 20 * t - 10) * s) / 2 : Math.pow(2, -20 * t + 10) * s / 2 + 1;
117
+ }
118
+ function cubicBezierEase(x1, y1, x2, y2) {
119
+ const a = (a1, a2) => 1 - 3 * a2 + 3 * a1;
120
+ const b = (a1, a2) => 3 * a2 - 6 * a1;
121
+ const c = (a1) => 3 * a1;
122
+ const calc = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;
123
+ const slope = (t, a1, a2) => 3 * a(a1, a2) * t * t + 2 * b(a1, a2) * t + c(a1);
124
+ const tForX = (x) => {
125
+ let t = x;
126
+ for (let i = 0; i < 8; i++) {
127
+ const s = slope(t, x1, x2);
128
+ if (Math.abs(s) < 1e-7) break;
129
+ const err = calc(t, x1, x2) - x;
130
+ if (Math.abs(err) < 1e-7) return t;
131
+ t -= err / s;
132
+ }
133
+ let lo = 0;
134
+ let hi = 1;
135
+ t = x;
136
+ for (let i = 0; i < 30 && hi - lo > 1e-7; i++) {
137
+ if (calc(t, x1, x2) < x) lo = t;
138
+ else hi = t;
139
+ t = (lo + hi) / 2;
140
+ }
141
+ return t;
142
+ };
143
+ return function(t) {
144
+ if (t <= 0) return 0;
145
+ if (t >= 1) return 1;
146
+ if (x1 === y1 && x2 === y2) return t;
147
+ return calc(tForX(t), y1, y2);
148
+ };
149
+ }
150
+ function resolveEase(result) {
151
+ if (result.customEase === "springOut") return springOutEase;
152
+ if (result.customEase === "springIn") return springInEase;
153
+ return result.ease;
154
+ }
334
155
 
335
- // src/html-export/runtime/whole-element-tween.ts
336
- function applyExtraTweens(tl, el, result, baseOffset) {
337
- if (!result.extraTweens) return;
338
- result.extraTweens.forEach(function(extra) {
339
- const tweenOffset = baseOffset + (extra.relativeOffset || 0);
340
- if (extra.from) {
341
- tl.from(
342
- el,
343
- {
344
- ...extra.from,
345
- duration: extra.duration,
346
- ease: extra.ease,
347
- immediateRender: false
348
- },
349
- tweenOffset
350
- );
351
- }
352
- if (extra.to) {
353
- tl.to(
354
- el,
355
- {
356
- ...extra.to,
357
- duration: extra.duration,
358
- ease: extra.ease
359
- },
360
- tweenOffset
361
- );
362
- }
363
- });
364
- }
365
- function applyWholeElementTween(tl, el, result, phaseOffset, phase) {
366
- const ease = resolveEase(result);
367
- const first = phase === "in" ? result.from : result.to;
368
- const second = phase === "in" ? result.to : result.from;
369
- if (first) {
370
- const method = phase === "in" ? "from" : "to";
371
- tl[method](
372
- el,
373
- {
374
- ...first,
375
- duration: result.duration,
376
- ease,
377
- ...method === "from" && { immediateRender: false }
378
- },
379
- phaseOffset
380
- );
381
- }
382
- if (second) {
383
- const method = phase === "in" ? "to" : "from";
384
- tl[method](
385
- el,
386
- {
387
- ...second,
388
- duration: result.duration,
389
- ease,
390
- ...method === "from" && { immediateRender: false }
391
- },
392
- phaseOffset
393
- );
394
- }
395
- applyExtraTweens(tl, el, result, phaseOffset);
396
- }
156
+ // src/html-export/runtime/stagger.ts
157
+ function computeStaggerTiming(totalDur, N, overlap) {
158
+ if (N <= 1) return {
159
+ segDur: totalDur,
160
+ staggerDelay: 0
161
+ };
162
+ const segDur = totalDur * ((1 - overlap) / N + overlap);
163
+ return {
164
+ segDur,
165
+ staggerDelay: (totalDur - segDur) / Math.max(1, N - 1)
166
+ };
167
+ }
397
168
 
398
- // src/html-export/runtime/index.ts
399
- (function() {
400
- "use strict";
401
- if (typeof gsap === "undefined") {
402
- console.warn(
403
- "[html5-exporter] gsap not found. Timeline animation disabled."
404
- );
405
- return;
406
- }
407
- const page = document.querySelector(
408
- ".page[data-timeline-duration]"
409
- );
410
- if (!page) return;
411
- const totalDuration = +page.dataset.timelineDuration;
412
- const els = page.querySelectorAll(
413
- "[data-timeline-offset]"
414
- );
415
- if (!els.length) return;
416
- els.forEach(function(el) {
417
- gsap.set(el, { visibility: "hidden" });
418
- });
419
- const tl = gsap.timeline({ paused: true, defaults: { duration: 0 } });
420
- els.forEach(function(el) {
421
- const offset = +el.dataset.timelineOffset;
422
- const dur = +el.dataset.timelineDuration;
423
- tl.set(el, { visibility: "visible", immediateRender: false }, offset);
424
- if (offset + dur < totalDuration) {
425
- tl.set(
426
- el,
427
- { visibility: "hidden", immediateRender: false },
428
- offset + dur
429
- );
430
- }
431
- const animAttr = el.getAttribute("data-animation");
432
- if (animAttr) {
433
- try {
434
- const animData = JSON.parse(animAttr);
435
- const hasTextAnim = !!animData.textWritingStyle;
436
- let contentTarget = null;
437
- if (animData.in && animData.in.target === "content" || animData.out && animData.out.target === "content") {
438
- const inner = el.querySelector(".element-content");
439
- if (inner) {
440
- contentTarget = inner;
441
- gsap.set(inner, { transformOrigin: "50% 50%" });
442
- }
443
- }
444
- if (animData.in) {
445
- const inTarget = animData.in.target === "content" && contentTarget ? contentTarget : el;
446
- if (hasTextAnim) {
447
- applyTextAnimation(tl, el, animData, animData.in, offset, "in");
448
- } else {
449
- applyWholeElementTween(tl, inTarget, animData.in, offset, "in");
450
- }
451
- }
452
- if (animData.out) {
453
- const outStart = offset + dur - animData.out.duration;
454
- const outTarget = animData.out.target === "content" && contentTarget ? contentTarget : el;
455
- if (hasTextAnim) {
456
- applyTextAnimation(tl, el, animData, animData.out, outStart, "out");
457
- } else {
458
- applyWholeElementTween(
459
- tl,
460
- outTarget,
461
- animData.out,
462
- outStart,
463
- "out"
464
- );
465
- }
466
- }
467
- if (animData.loop) {
468
- const loopResult = animData.loop;
469
- const useYoyo = !loopResult.noYoyo;
470
- const loopEase = resolveEase(loopResult);
471
- if (loopResult.extraTweens) {
472
- const cycleDur = loopResult.duration + (loopResult.extraTweens[0] ? loopResult.extraTweens[0].duration : 0);
473
- const loopCount = Math.max(0, Math.ceil(dur / cycleDur) - 1);
474
- const subTl = gsap.timeline({ repeat: loopCount });
475
- if (loopResult.to) {
476
- subTl.to(
477
- el,
478
- {
479
- ...loopResult.to,
480
- duration: loopResult.duration,
481
- ease: loopEase
482
- },
483
- 0
484
- );
485
- }
486
- loopResult.extraTweens.forEach(function(extra) {
487
- if (extra.to) {
488
- subTl.to(
489
- el,
490
- {
491
- ...extra.to,
492
- duration: extra.duration,
493
- ease: extra.ease
494
- },
495
- extra.relativeOffset || 0
496
- );
497
- }
498
- });
499
- tl.add(subTl, offset);
500
- } else if (loopResult.from && loopResult.to) {
501
- const tweenDur = useYoyo ? loopResult.duration / 2 : loopResult.duration;
502
- const repeatCount = Math.max(0, Math.ceil(dur / tweenDur) - 1);
503
- tl.fromTo(
504
- el,
505
- loopResult.from,
506
- {
507
- ...loopResult.to,
508
- duration: tweenDur,
509
- ease: loopEase,
510
- repeat: repeatCount,
511
- yoyo: useYoyo
512
- },
513
- offset
514
- );
515
- } else {
516
- const loopVars = loopResult.to || {};
517
- const simpleDur = useYoyo ? loopResult.duration / 2 : loopResult.duration;
518
- const simpleRepeat = Math.max(0, Math.ceil(dur / simpleDur) - 1);
519
- tl.to(
520
- el,
521
- {
522
- ...loopVars,
523
- duration: simpleDur,
524
- ease: loopEase,
525
- repeat: simpleRepeat,
526
- yoyo: useYoyo
527
- },
528
- offset
529
- );
530
- }
531
- }
532
- } catch (e) {
533
- throw new Error(
534
- "[html5-exporter] Failed to parse animation data: " + e
535
- );
536
- }
537
- }
538
- });
539
- tl.set({}, {}, totalDuration);
540
- tl.seek(1e-3);
541
- tl.seek(0);
542
- window.__timeline = tl;
543
- window.__timelineData = {
544
- totalDuration,
545
- elementCount: els.length
546
- };
547
- })();
548
- })();`;function ar(t){return t.type==="text"&&t.animation?.textWritingStyle?!0:t.type==="group"?t.children.some(e=>ar(e)):!1}function Wt(t,e,r,n,o){return t.type==="svg"?tr(t,r,n,o):t.type==="group"?Je(t,r,Wt,n,o):er(t,r,n,o)}function It(t){let{width:e,height:r,elements:n,fonts:o,backgroundColor:i,pageIndex:a,timeline:l}=t,s=[],c=[];for(let T of n)T.name==="page-background"?s.push(T):c.push(T);let p=0,u=s.map(T=>Wt(T,p++,a,e,r)).join(`
549
- `),m=c.map(T=>Wt(T,p++,a,e,r)).join(`
550
- `),h=i?`background: ${i};`:"background: #fff;",f=rr(o),x=Math.round(e),S=Math.round(r),y=l?` data-timeline-duration="${l.totalDuration}"`:"",A=n.some(T=>ar(T))?' data-requires-plugins="SplitText"':"",R=l?`
551
- <script>
552
- ${Ht}
553
- <\/script>`:"",k=`<!DOCTYPE html>
169
+ // src/html-export/runtime/text-animation.ts
170
+ function getTextContentTarget(el) {
171
+ const inner = el.firstElementChild;
172
+ if (inner && inner.tagName === "DIV" && !inner.classList.length) return inner;
173
+ return el;
174
+ }
175
+ function splitTextElement(el, writingStyle) {
176
+ if (typeof SplitText === "undefined") throw new Error("[html5-exporter] SplitText plugin is required for text animation (writingStyle: " + writingStyle + ") but was not found.");
177
+ const splitType = {
178
+ Line: "lines",
179
+ Word: "words",
180
+ Character: "chars"
181
+ }[writingStyle];
182
+ if (!splitType) throw new Error("[html5-exporter] Unknown writingStyle: " + writingStyle);
183
+ const target = getTextContentTarget(el);
184
+ const split = new SplitText(target, { type: splitType });
185
+ return {
186
+ targets: split[splitType],
187
+ split,
188
+ type: splitType
189
+ };
190
+ }
191
+ function applyTextAnimation(tl, el, animData, phaseResult, phaseOffset, phase) {
192
+ const writingStyle = animData.textWritingStyle;
193
+ const overlap = animData.textOverlap || 0;
194
+ const ease = resolveEase(phaseResult);
195
+ if (animData.spread) {
196
+ const chars = splitTextElement(el, "Character").targets;
197
+ const spreadParams = animData.spread;
198
+ const elRect = el.getBoundingClientRect();
199
+ const blockCenterX = elRect.width / 2;
200
+ const halfWidth = elRect.width / 2;
201
+ chars.forEach(function(charEl) {
202
+ const charRect = charEl.getBoundingClientRect();
203
+ const charCenterX = charRect.left - elRect.left + charRect.width / 2;
204
+ const relativeCenterX = halfWidth > 0 ? (charCenterX - blockCenterX) / halfWidth : 0;
205
+ const offsetX = spreadParams.blockWidth * relativeCenterX * spreadParams.intensity;
206
+ if (phase === "in") tl.from(charEl, {
207
+ x: offsetX,
208
+ opacity: phaseResult.from && phaseResult.from.opacity !== void 0 ? phaseResult.from.opacity : 1,
209
+ duration: phaseResult.duration,
210
+ ease,
211
+ immediateRender: false
212
+ }, phaseOffset);
213
+ else tl.to(charEl, {
214
+ x: offsetX,
215
+ opacity: phaseResult.to && phaseResult.to.opacity !== void 0 ? phaseResult.to.opacity : 1,
216
+ duration: phaseResult.duration,
217
+ ease
218
+ }, phaseOffset);
219
+ });
220
+ return;
221
+ }
222
+ if (animData.merge) {
223
+ const splitResult2 = splitTextElement(el, "Word");
224
+ const lineSplit = new SplitText(getTextContentTarget(el), { type: "lines,words" });
225
+ const mergeParams = animData.merge;
226
+ const moveFirstLineLeft = mergeParams.direction === "Left";
227
+ const timing = computeStaggerTiming(phaseResult.duration, splitResult2.targets.length, overlap);
228
+ splitResult2.targets.forEach(function(wordEl, wordIdx) {
229
+ let lineIdx = 0;
230
+ if (lineSplit.lines) {
231
+ for (let li = 0; li < lineSplit.lines.length; li++) if (lineSplit.lines[li].contains(wordEl)) {
232
+ lineIdx = li;
233
+ break;
234
+ }
235
+ }
236
+ const dirSign = lineIdx % 2 === 0 === moveFirstLineLeft ? -1 : 1;
237
+ const wordOffset = phaseOffset + wordIdx * timing.staggerDelay;
238
+ if (phase === "in") {
239
+ tl.from(wordEl, {
240
+ x: dirSign * mergeParams.distance,
241
+ duration: timing.segDur,
242
+ ease,
243
+ immediateRender: false
244
+ }, wordOffset);
245
+ tl.from(wordEl, {
246
+ opacity: 0,
247
+ duration: timing.segDur / 2,
248
+ ease: "none",
249
+ immediateRender: false
250
+ }, wordOffset);
251
+ } else {
252
+ tl.to(wordEl, {
253
+ x: dirSign * mergeParams.distance,
254
+ duration: timing.segDur,
255
+ ease
256
+ }, wordOffset);
257
+ tl.to(wordEl, {
258
+ opacity: 0,
259
+ duration: timing.segDur / 2,
260
+ ease: "none"
261
+ }, wordOffset + timing.segDur / 2);
262
+ }
263
+ });
264
+ return;
265
+ }
266
+ const targets = splitTextElement(el, writingStyle).targets;
267
+ const timing2 = computeStaggerTiming(phaseResult.duration, targets.length, overlap);
268
+ if (phase === "in") {
269
+ if (phaseResult.from) {
270
+ const toState = {};
271
+ for (const fk in phaseResult.from) toState[fk] = fk === "opacity" || fk === "scale" || fk === "scaleX" || fk === "scaleY" ? 1 : 0;
272
+ tl.set(targets, {
273
+ ...phaseResult.from,
274
+ immediateRender: false
275
+ }, phaseOffset);
276
+ for (let si = 0; si < targets.length; si++) {
277
+ const segOffset = phaseOffset + si * timing2.staggerDelay;
278
+ tl.to(targets[si], {
279
+ ...toState,
280
+ duration: timing2.segDur,
281
+ ease
282
+ }, segOffset);
283
+ }
284
+ }
285
+ if (phaseResult.to) tl.to(targets, {
286
+ ...phaseResult.to,
287
+ duration: timing2.segDur,
288
+ ease,
289
+ stagger: timing2.staggerDelay
290
+ }, phaseOffset);
291
+ } else {
292
+ if (phaseResult.to) tl.to(targets, {
293
+ ...phaseResult.to,
294
+ duration: timing2.segDur,
295
+ ease,
296
+ stagger: timing2.staggerDelay
297
+ }, phaseOffset);
298
+ if (phaseResult.from) for (let oi = 0; oi < targets.length; oi++) {
299
+ const outSegOffset = phaseOffset + oi * timing2.staggerDelay;
300
+ tl.to(targets[oi], {
301
+ ...phaseResult.from,
302
+ duration: timing2.segDur,
303
+ ease
304
+ }, outSegOffset);
305
+ }
306
+ }
307
+ }
308
+
309
+ // src/html-export/runtime/whole-element-tween.ts
310
+ function applyExtraTweens(tl, el, result, baseOffset) {
311
+ if (!result.extraTweens) return;
312
+ result.extraTweens.forEach(function(extra) {
313
+ const tweenOffset = baseOffset + (extra.relativeOffset || 0);
314
+ if (extra.from) tl.from(el, {
315
+ ...extra.from,
316
+ duration: extra.duration,
317
+ ease: extra.ease,
318
+ immediateRender: false
319
+ }, tweenOffset);
320
+ if (extra.to) tl.to(el, {
321
+ ...extra.to,
322
+ duration: extra.duration,
323
+ ease: extra.ease
324
+ }, tweenOffset);
325
+ });
326
+ }
327
+ function applyWholeElementTween(tl, el, result, phaseOffset, phase) {
328
+ const ease = resolveEase(result);
329
+ const first = phase === "in" ? result.from : result.to;
330
+ const second = phase === "in" ? result.to : result.from;
331
+ if (first) {
332
+ const method = phase === "in" ? "from" : "to";
333
+ tl[method](el, {
334
+ ...first,
335
+ duration: result.duration,
336
+ ease,
337
+ ...method === "from" && { immediateRender: false }
338
+ }, phaseOffset);
339
+ }
340
+ if (second) {
341
+ const method = phase === "in" ? "to" : "from";
342
+ tl[method](el, {
343
+ ...second,
344
+ duration: result.duration,
345
+ ease,
346
+ ...method === "from" && { immediateRender: false }
347
+ }, phaseOffset);
348
+ }
349
+ applyExtraTweens(tl, el, result, phaseOffset);
350
+ }
351
+ function applyLoopTween(tl, el, loopResult, offset, dur) {
352
+ const useYoyo = !loopResult.noYoyo;
353
+ const loopEase = resolveEase(loopResult);
354
+ if (loopResult.extraTweens) {
355
+ const cycleDur = loopResult.duration + (loopResult.extraTweens[0] ? loopResult.extraTweens[0].duration : 0);
356
+ const loopCount = Math.max(0, Math.ceil(dur / cycleDur) - 1);
357
+ const subTl = gsap.timeline({ repeat: loopCount });
358
+ if (loopResult.to) subTl.to(el, {
359
+ ...loopResult.to,
360
+ duration: loopResult.duration,
361
+ ease: loopEase
362
+ }, 0);
363
+ loopResult.extraTweens.forEach(function(extra) {
364
+ if (extra.to) subTl.to(el, {
365
+ ...extra.to,
366
+ duration: extra.duration,
367
+ ease: extra.ease
368
+ }, extra.relativeOffset || 0);
369
+ });
370
+ tl.add(subTl, offset);
371
+ } else if (loopResult.from && loopResult.to) {
372
+ const tweenDur = useYoyo ? loopResult.duration / 2 : loopResult.duration;
373
+ const repeatCount = Math.max(0, Math.ceil(dur / tweenDur) - 1);
374
+ tl.fromTo(el, loopResult.from, {
375
+ ...loopResult.to,
376
+ duration: tweenDur,
377
+ ease: loopEase,
378
+ repeat: repeatCount,
379
+ yoyo: useYoyo
380
+ }, offset);
381
+ } else {
382
+ const loopVars = loopResult.to || {};
383
+ const simpleDur = useYoyo ? loopResult.duration / 2 : loopResult.duration;
384
+ const simpleRepeat = Math.max(0, Math.ceil(dur / simpleDur) - 1);
385
+ tl.to(el, {
386
+ ...loopVars,
387
+ duration: simpleDur,
388
+ ease: loopEase,
389
+ repeat: simpleRepeat,
390
+ yoyo: useYoyo
391
+ }, offset);
392
+ }
393
+ }
394
+
395
+ // src/html-export/runtime/keyframes.ts
396
+ const SPRING_EASES = {
397
+ springIn: springInEase,
398
+ springOut: springOutEase,
399
+ springInOut: springInOutEase
400
+ };
401
+ let warnedMotionPath = false;
402
+ function cssVars(track, value) {
403
+ if (track.prop === "xy") {
404
+ const [x, y] = value;
405
+ return {
406
+ x,
407
+ y
408
+ };
409
+ }
410
+ return { [track.prop]: value };
411
+ }
412
+ function resolveKeyframeEase(ease) {
413
+ if (typeof ease === "string") return SPRING_EASES[ease] ?? ease;
414
+ const [x1, y1, x2, y2] = ease.bezier;
415
+ return cubicBezierEase(x1, y1, x2, y2);
416
+ }
417
+ function hasMotionPath() {
418
+ if (typeof MotionPathPlugin !== "undefined") {
419
+ gsap.registerPlugin(MotionPathPlugin);
420
+ return true;
421
+ }
422
+ if (!warnedMotionPath) {
423
+ warnedMotionPath = true;
424
+ console.warn("[html5-exporter] MotionPathPlugin not found. Curved motion paths play as straight lines.");
425
+ }
426
+ return false;
427
+ }
428
+ const WRAPPER_STYLES = [
429
+ "left",
430
+ "top",
431
+ "transform",
432
+ "transform-origin",
433
+ "opacity",
434
+ "mix-blend-mode"
435
+ ];
436
+ function wrapElement(el) {
437
+ const wrapper = document.createElement("div");
438
+ const width = el instanceof HTMLElement ? el.offsetWidth : parseFloat(el.style.width);
439
+ const height = el instanceof HTMLElement ? el.offsetHeight : parseFloat(el.style.height);
440
+ wrapper.style.position = "absolute";
441
+ wrapper.style.width = width + "px";
442
+ wrapper.style.height = height + "px";
443
+ WRAPPER_STYLES.forEach(function(name) {
444
+ wrapper.style.setProperty(name, el.style.getPropertyValue(name));
445
+ el.style.removeProperty(name);
446
+ });
447
+ el.style.left = "0px";
448
+ el.style.top = "0px";
449
+ el.parentNode.insertBefore(wrapper, el);
450
+ wrapper.appendChild(el);
451
+ return wrapper;
452
+ }
453
+ function wrapPresetTranslation(wrapper) {
454
+ const outer = document.createElement("div");
455
+ outer.style.position = "absolute";
456
+ [
457
+ "left",
458
+ "top",
459
+ "width",
460
+ "height",
461
+ "mix-blend-mode"
462
+ ].forEach(function(name) {
463
+ outer.style.setProperty(name, wrapper.style.getPropertyValue(name));
464
+ });
465
+ wrapper.style.removeProperty("mix-blend-mode");
466
+ wrapper.style.left = "0px";
467
+ wrapper.style.top = "0px";
468
+ wrapper.parentNode.insertBefore(outer, wrapper);
469
+ outer.appendChild(wrapper);
470
+ return outer;
471
+ }
472
+ const TRANSLATION_KEYS = [
473
+ "x",
474
+ "y",
475
+ "xPercent",
476
+ "yPercent"
477
+ ];
478
+ function pick(vars, translation) {
479
+ if (!vars) return void 0;
480
+ const out = {};
481
+ Object.keys(vars).forEach(function(key) {
482
+ if (TRANSLATION_KEYS.includes(key) === translation) out[key] = vars[key];
483
+ });
484
+ return out;
485
+ }
486
+ function isEmpty(vars) {
487
+ return !vars || !Object.keys(vars).length;
488
+ }
489
+ function pickResult(result, translation) {
490
+ const extraTweens = result.extraTweens ? result.extraTweens.map(function(extra) {
491
+ return {
492
+ ...extra,
493
+ from: pick(extra.from, translation),
494
+ to: pick(extra.to, translation)
495
+ };
496
+ }) : void 0;
497
+ const picked = {
498
+ ...result,
499
+ from: pick(result.from, translation),
500
+ to: pick(result.to, translation),
501
+ extraTweens
502
+ };
503
+ return [picked, ...extraTweens ?? []].every(function(tween) {
504
+ return isEmpty(tween.from) && isEmpty(tween.to);
505
+ }) ? null : picked;
506
+ }
507
+ function splitPresetTranslation(result) {
508
+ return {
509
+ translation: pickResult(result, true),
510
+ rest: pickResult(result, false)
511
+ };
512
+ }
513
+ function shapeSelector(prop) {
514
+ const match = prop === "stroke" ? "[stroke]" : ":not([fill=\\"none\\"])";
515
+ return [
516
+ "rect",
517
+ "ellipse",
518
+ "path"
519
+ ].map(function(tag) {
520
+ return ":scope > " + tag + match;
521
+ }).join(", ");
522
+ }
523
+ const ELEMENT_PROPS = ["width", "height"];
524
+ function targetsElement(track) {
525
+ return track.target === "shape" || ELEMENT_PROPS.includes(track.prop);
526
+ }
527
+ function applyKeyframeTracks(tl, el, data, offset) {
528
+ const wrapper = data.origin || !data.tracks.every(targetsElement) ? wrapElement(el) : null;
529
+ if (wrapper && data.origin) gsap.set(wrapper, data.origin);
530
+ const motionPath = data.motionPath ? hasMotionPath() : false;
531
+ data.tracks.forEach(function(track) {
532
+ const target = track.target === "shape" ? el.querySelector(shapeSelector(track.prop)) : targetsElement(track) ? el : wrapper;
533
+ if (!target) return;
534
+ tl.set(target, {
535
+ ...cssVars(track, track.values[0]),
536
+ immediateRender: false
537
+ }, offset);
538
+ track.eases.forEach(function(ease, i) {
539
+ const start = offset + track.times[i];
540
+ const end = offset + track.times[i + 1];
541
+ const next = track.values[i + 1];
542
+ if (ease === "hold") {
543
+ tl.set(target, {
544
+ ...cssVars(track, next),
545
+ immediateRender: false
546
+ }, end);
547
+ return;
548
+ }
549
+ const path = track.paths && track.paths[i];
550
+ const vars = path && motionPath ? { motionPath: {
551
+ path: [
552
+ {
553
+ x: path[0],
554
+ y: path[1]
555
+ },
556
+ {
557
+ x: path[2],
558
+ y: path[3]
559
+ },
560
+ {
561
+ x: path[4],
562
+ y: path[5]
563
+ },
564
+ {
565
+ x: path[6],
566
+ y: path[7]
567
+ }
568
+ ],
569
+ type: "cubic"
570
+ } } : cssVars(track, next);
571
+ tl.to(target, {
572
+ ...vars,
573
+ duration: end - start,
574
+ ease: resolveKeyframeEase(ease)
575
+ }, start);
576
+ });
577
+ });
578
+ return wrapper;
579
+ }
580
+
581
+ // src/html-export/runtime/index.ts
582
+ (function() {
583
+ "use strict";
584
+ if (typeof gsap === "undefined") {
585
+ console.warn("[html5-exporter] gsap not found. Timeline animation disabled.");
586
+ return;
587
+ }
588
+ const page = document.querySelector(".page[data-timeline-duration]");
589
+ if (!page) return;
590
+ const totalDuration = +page.dataset.timelineDuration;
591
+ const els = page.querySelectorAll("[data-timeline-offset]");
592
+ if (!els.length) return;
593
+ els.forEach(function(el) {
594
+ gsap.set(el, { visibility: "hidden" });
595
+ });
596
+ const tl = gsap.timeline({
597
+ paused: true,
598
+ defaults: { duration: 0 }
599
+ });
600
+ els.forEach(function(el) {
601
+ const offset = +el.dataset.timelineOffset;
602
+ const dur = +el.dataset.timelineDuration;
603
+ tl.set(el, {
604
+ visibility: "visible",
605
+ immediateRender: false
606
+ }, offset);
607
+ if (offset + dur < totalDuration) tl.set(el, {
608
+ visibility: "hidden",
609
+ immediateRender: false
610
+ }, offset + dur);
611
+ const animAttr = el.getAttribute("data-animation");
612
+ if (animAttr) try {
613
+ const animData = JSON.parse(animAttr);
614
+ const hasTextAnim = !!animData.textWritingStyle;
615
+ const wrapper = animData.keyframes ? applyKeyframeTracks(tl, el, animData.keyframes, offset) : null;
616
+ let outer = null;
617
+ const applyPreset = function(result, apply) {
618
+ if (!wrapper) {
619
+ apply(el, result);
620
+ return;
621
+ }
622
+ const parts = splitPresetTranslation(result);
623
+ if (parts.translation) {
624
+ outer = outer || wrapPresetTranslation(wrapper);
625
+ apply(outer, parts.translation);
626
+ }
627
+ if (parts.rest) apply(el, parts.rest);
628
+ };
629
+ let contentTarget = null;
630
+ if (animData.in && animData.in.target === "content" || animData.out && animData.out.target === "content") {
631
+ const inner = el.querySelector(".element-content");
632
+ if (inner) {
633
+ contentTarget = inner;
634
+ gsap.set(inner, { transformOrigin: "50% 50%" });
635
+ }
636
+ }
637
+ if (animData.in) {
638
+ const inTarget = animData.in.target === "content" && contentTarget ? contentTarget : el;
639
+ if (hasTextAnim) applyTextAnimation(tl, el, animData, animData.in, offset, "in");
640
+ else if (inTarget !== el) applyWholeElementTween(tl, inTarget, animData.in, offset, "in");
641
+ else applyPreset(animData.in, function(target, result) {
642
+ applyWholeElementTween(tl, target, result, offset, "in");
643
+ });
644
+ }
645
+ if (animData.out) {
646
+ const outStart = offset + dur - animData.out.duration;
647
+ const outTarget = animData.out.target === "content" && contentTarget ? contentTarget : el;
648
+ if (hasTextAnim) applyTextAnimation(tl, el, animData, animData.out, outStart, "out");
649
+ else if (outTarget !== el) applyWholeElementTween(tl, outTarget, animData.out, outStart, "out");
650
+ else applyPreset(animData.out, function(target, result) {
651
+ applyWholeElementTween(tl, target, result, outStart, "out");
652
+ });
653
+ }
654
+ if (animData.loop) applyPreset(animData.loop, function(target, result) {
655
+ applyLoopTween(tl, target, result, offset, dur);
656
+ });
657
+ } catch (e) {
658
+ throw new Error("[html5-exporter] Failed to parse animation data: " + e);
659
+ }
660
+ });
661
+ tl.set({}, {}, totalDuration);
662
+ tl.seek(.001);
663
+ tl.seek(0);
664
+ window.__timeline = tl;
665
+ window.__timelineData = {
666
+ totalDuration,
667
+ elementCount: els.length
668
+ };
669
+ })();
670
+
671
+ })();
672
+ <\/script>`:``;return Xn(`<!DOCTYPE html>
554
673
  <html lang="en">
555
674
  <head>
556
675
  <meta charset="UTF-8">
557
- <meta name="viewport" content="width=${x}, height=${S}, initial-scale=1.0">
676
+ <meta name="viewport" content="width=${y}, height=${b}, initial-scale=1.0">
558
677
  <meta name="generator" content="imgly-cli">
559
- <title>HTML5 Ad - Page ${a+1}</title>
678
+ <title>HTML5 Ad - Page ${o+1}</title>
560
679
  <style>
561
- ${f}
680
+ ${v}
562
681
  * { margin: 0; padding: 0; box-sizing: border-box; }
563
682
  body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #f0f0f0; }
564
683
  .page { position: relative; overflow: hidden; }
@@ -568,16 +687,17 @@ ${f}
568
687
  </style>
569
688
  </head>
570
689
  <body>
571
- <div id="container" class="page"${y}${A} style="width: ${x}px; height: ${S}px;">
572
- <div id="background" style="position: absolute; inset: 0; ${h}">
573
- ${u}
690
+ <div id="container" class="page"${x}${C} style="width: ${y}px; height: ${b}px;">
691
+ <div id="background" style="position: absolute; inset: 0; ${_}">
692
+ ${h}
574
693
  </div>
575
694
  <div id="content" style="position: absolute; inset: 0;">
576
- ${m}
695
+ ${g}
577
696
  </div>
578
- </div>${R}
697
+ </div>${w}
579
698
  </body>
580
- </html>`;return ir(k)}function Vr(t,e,r){for(let[,n]of t.getResolved())if(At(n.outputUrl)){let o=V(n.outputUrl);e.has(o)||(e.set(o,{content:n.data,mimeType:$t(o)||n.mimeType}),r?.emit("RESOURCE_FILE_COLLECTED",{relativePath:o}))}}function Vt(t,e={}){let{logger:r,resourceMap:n}=e,o=new et,i=t[0];if(!i)throw new Error("No page data to export");n&&Vr(n,o,r);let a=It(i);return o.set("index.html",{content:a,mimeType:"text/html"}),o}function Xt(t,e={}){let r=new et,n=t[0];if(!n)throw new Error("No page data to export");let o=It(n);return r.set("index.html",{content:o,mimeType:"text/html"}),r}async function Xr(t,e){let r;try{let i=e.editor.defaultURIResolver(t);r=typeof i=="string"&&i.length>0?i:t}catch{r=t}if(!r.startsWith("file://")){if(r.startsWith("http://")||r.startsWith("https://")){let i=await fetch(r);return i.ok?new Uint8Array(await i.arrayBuffer()):null}return null}let[{readFile:n},{fileURLToPath:o}]=await Promise.all([import("node:fs/promises"),import("node:url")]);try{let i=await n(o(r));return new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}catch{return null}}var gt=class{constructor(e,r,n={}){this.engine=e;this.transformer=r;this.logger=n.logger}cache=new Map;logger;async getUrl(e,r,n){let o=this.cache.get(e);if(o)return o.outputUrl;if(e.startsWith("data:"))return e;if(tt(e)){let l=le(),s=await this.transformer({uri:e,kind:r,mimeType:n,data:l},this.engine);return this.cache.set(e,{outputUrl:s,data:l,kind:r,mimeType:n}),s}let i=await this.loadData(e);if(!i)return this.logger?.emit("RESOURCE_LOAD_FAILED",{originalUri:e}),e;let a=await this.transformer({uri:e,kind:r,mimeType:n,data:i},this.engine);return this.cache.set(e,{outputUrl:a,data:i,kind:r,mimeType:n}),a}async registerWithData(e,r,n,o){let i=this.cache.get(e);if(i)return i.outputUrl;let a=await this.transformer({uri:e,kind:r,mimeType:n,data:o},this.engine);return this.cache.set(e,{outputUrl:a,data:o,kind:r,mimeType:n}),a}async loadData(e){if(e.startsWith("data:")){let r=e.match(/^data:[^;]+;base64,(.+)$/);return r?ae(r[1]):null}if(e.startsWith("buffer://")){let r=this.engine.editor.getBufferLength(e);return r>0?new Uint8Array(this.engine.editor.getBufferData(e,0,r)):null}if(e.startsWith("http://")||e.startsWith("https://")){let r=await fetch(e);return r.ok?new Uint8Array(await r.arrayBuffer()):null}if(e.startsWith("bundle://")||e.startsWith("file://"))return await Xr(e,this.engine);throw new Error(`Unsupported URI scheme for embedding: ${e}. Use buffer://, data:, http(s)://, or a bundle://-prefixed engine asset.`)}getResolved(){return this.cache}getFonts(){return[...this.cache.entries()].filter(([,e])=>e.kind==="font").map(([e,r])=>({originalUri:e,outputUrl:r.outputUrl,data:r.data,mimeType:r.mimeType}))}getImages(){return[...this.cache.entries()].filter(([,e])=>e.kind==="image").map(([e,r])=>({originalUri:e,outputUrl:r.outputUrl,data:r.data,mimeType:r.mimeType}))}has(e){return this.cache.has(e)}get size(){return this.cache.size}clear(){this.cache.clear()}};function Yr(t){switch(t){case"image":return"images";case"font":return"fonts";case"video":return"videos";case"audio":return"audio";default:return"assets"}}var Yt=t=>{if(t.uri.startsWith("data:")||tt(t.uri))return t.uri;let e=se(t.data);return`data:${t.mimeType};base64,${e}`},qt=async t=>{if(tt(t.uri)||t.uri.startsWith("data:"))return t.uri;let e=await ce(t.data),r=_t(t.mimeType),n=Yr(t.kind),o=`${e}${r}`;return`buffer://${`${n}/${o}`}`};async function qr(t,e){let r=t.editor.createHistory(),n=t.editor.getActiveHistory();t.editor.setActiveHistory(r);try{return await e()}finally{for(;t.editor.canUndo();)t.editor.undo();t.editor.setActiveHistory(n),t.editor.destroyHistory(r)}}async function sr(t,e){let{engine:r,abortSignal:n}=t,o=e.format,i=e.quality/100;z(n),Qt(`Exporting current scene as HTML (${o} format)...`);let a=new K,l=e.transformResourceURI??(o==="embedded"?Yt:qt),s=new gt(r,l,{logger:a}),c=await qr(r,async()=>{let m=oe(r,{textMode:e.textMode,quality:i,abortSignal:n,logger:a});return(await Ee(r,m,{textMode:e.textMode,quality:i,insertExplicitLineBreaks:e.insertExplicitLineBreaks,animated:e.animated,useSyntheticIds:e.useSyntheticIds,pageIndex:e.pageIndex,abortSignal:n,logger:a},s)).pages}),p={logger:a,engine:r,resourceMap:s},u;return o==="embedded"?u=Xt(c,p):u=Vt(c,p),{messages:a.getMessages(),files:u}}var Kr="https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js",Zr="https://cdn.jsdelivr.net/npm/gsap@3/dist/SplitText.min.js",Qr=`
699
+ </html>`)}function tr(e,t,n){for(let[,r]of e.getResolved())if(Ee(r.outputUrl)){let e=V(r.outputUrl);t.has(e)||(t.set(e,{content:r.data,mimeType:Ce(e)||r.mimeType}),n?.emit(`RESOURCE_FILE_COLLECTED`,{relativePath:e}))}}function nr(e,t={}){let{logger:n,resourceMap:r}=t,i=new jn,a=e[0];if(!a)throw Error(`No page data to export`);r&&tr(r,i,n);let o=er(a);return i.set(`index.html`,{content:o,mimeType:`text/html`}),i}function rr(e,t={}){let n=new jn,r=e[0];if(!r)throw Error(`No page data to export`);let i=er(r);return n.set(`index.html`,{content:i,mimeType:`text/html`}),n}async function ir(e,t){let n;try{let r=t.editor.defaultURIResolver(e);n=typeof r==`string`&&r.length>0?r:e}catch{n=e}if(!n.startsWith(`file://`)){if(n.startsWith(`http://`)||n.startsWith(`https://`)){let e=await fetch(n);return e.ok?new Uint8Array(await e.arrayBuffer()):null}return null}let[{readFile:r},{fileURLToPath:i}]=await Promise.all([import(`node:fs/promises`),import(`node:url`)]);try{let e=await r(i(n));return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}catch{return null}}var ar=class{constructor(e,t,n={}){this.engine=e,this.transformer=t,a(this,`cache`,/* @__PURE__ */ new Map),a(this,`logger`,void 0),this.logger=n.logger}async getUrl(e,t,n){let r=this.cache.get(e);if(r)return r.outputUrl;if(e.startsWith(`data:`))return e;if(H(e)){let r=oe(),i=await this.transformer({uri:e,kind:t,mimeType:n,data:r},this.engine);return this.cache.set(e,{outputUrl:i,data:r,kind:t,mimeType:n}),i}let i=await this.loadData(e);if(!i)return this.logger?.emit(`RESOURCE_LOAD_FAILED`,{originalUri:e}),e;let a=await this.transformer({uri:e,kind:t,mimeType:n,data:i},this.engine);return this.cache.set(e,{outputUrl:a,data:i,kind:t,mimeType:n}),a}async registerWithData(e,t,n,r){let i=this.cache.get(e);if(i)return i.outputUrl;let a=await this.transformer({uri:e,kind:t,mimeType:n,data:r},this.engine);return this.cache.set(e,{outputUrl:a,data:r,kind:t,mimeType:n}),a}async loadData(e){if(e.startsWith(`data:`)){let t=e.match(/^data:[^;]+;base64,(.+)$/);return t?ie(t[1]):null}if(e.startsWith(`buffer://`)){let t=this.engine.editor.getBufferLength(e);return t>0?new Uint8Array(this.engine.editor.getBufferData(e,0,t)):null}if(e.startsWith(`http://`)||e.startsWith(`https://`)){let t=await fetch(e);return t.ok?new Uint8Array(await t.arrayBuffer()):null}if(e.startsWith(`bundle://`)||e.startsWith(`file://`))return await ir(e,this.engine);throw Error(`Unsupported URI scheme for embedding: ${e}. Use buffer://, data:, http(s)://, or a bundle://-prefixed engine asset.`)}getResolved(){return this.cache}getFonts(){return[...this.cache.entries()].filter(([,e])=>e.kind===`font`).map(([e,t])=>({originalUri:e,outputUrl:t.outputUrl,data:t.data,mimeType:t.mimeType}))}getImages(){return[...this.cache.entries()].filter(([,e])=>e.kind===`image`).map(([e,t])=>({originalUri:e,outputUrl:t.outputUrl,data:t.data,mimeType:t.mimeType}))}has(e){return this.cache.has(e)}get size(){return this.cache.size}clear(){this.cache.clear()}};function or(e){switch(e){case`image`:return`images`;case`font`:return`fonts`;case`video`:return`videos`;case`audio`:return`audio`;default:return`assets`}}const sr=e=>{if(e.uri.startsWith(`data:`)||H(e.uri))return e.uri;let t=ae(e.data);return`data:${e.mimeType};base64,${t}`},cr=async e=>{if(H(e.uri)||e.uri.startsWith(`data:`))return e.uri;let t=await se(e.data),n=Se(e.mimeType);return`buffer://${`${or(e.kind)}/${`${t}${n}`}`}`};async function lr(e,t){let n=e.editor.createHistory(),r=e.editor.getActiveHistory();e.editor.setActiveHistory(n);try{return await t()}finally{for(;e.editor.canUndo();)e.editor.undo();e.editor.setActiveHistory(r),e.editor.destroyHistory(n)}}async function ur(e,n){let{engine:r,abortSignal:i,transactionId:a}=e,o=n.format,c=n.quality/100;s(i),t(`Exporting current scene as HTML (${o} format)...`);let l=new g,u=new ar(r,n.transformResourceURI??(o===`embedded`?sr:cr),{logger:l}),d=await lr(r,async()=>{let e=C(r,{textMode:n.textMode,quality:c,abortSignal:i,logger:l});return(await Cn(r,e,{textMode:n.textMode,quality:c,insertExplicitLineBreaks:n.insertExplicitLineBreaks,animated:n.animated,useSyntheticIds:n.useSyntheticIds,pageIndex:n.pageIndex,abortSignal:i,logger:l,transactionId:a},u)).pages}),f={logger:l,engine:r,resourceMap:u},p;return p=o===`embedded`?rr(d,f):nr(d,f),{messages:l.getMessages(),files:p,duration:Math.max(0,...d.map(e=>e.timeline?.totalDuration??0))}}var dr=`@imgly/html-exporter`,fr=`0.3.0`;function pr(e,t){let n=t?.gsapUrl??`https://cdn.jsdelivr.net/npm/gsap@3/dist/gsap.min.js`,r=t?.autoplay??!0,i=`<script src="${n}"><\/script>`,a=(e.match(/data-requires-plugins="([^"]*)"/)?.[1]??``).split(` `);if(t?.splitTextUrl!==!1&&a.includes(`SplitText`)){let e=t?.splitTextUrl??`https://cdn.jsdelivr.net/npm/gsap@3/dist/SplitText.min.js`;i+=`\n <script src="${e}"><\/script>`}if(t?.motionPathUrl!==!1&&a.includes(`MotionPathPlugin`)){let e=t?.motionPathUrl??`https://cdn.jsdelivr.net/npm/gsap@3/dist/MotionPathPlugin.min.js`;i+=`\n <script src="${e}"><\/script>`}let o=i,s=e.indexOf(`<script>`);if(s===-1)return e.replace(`</body>`,` ${o}\n</body>`);let c=e.slice(0,s)+o+`
700
+ `+e.slice(s);return r&&(c=c.replace(`</body>`,`
581
701
  <script>
582
702
  (function() {
583
703
  var tl = window.__timeline;
@@ -592,8 +712,5 @@ ${m}
592
712
  }
593
713
  loop();
594
714
  })();
595
- <\/script>`;function Jr(t,e){let r=e?.gsapUrl??Kr,n=e?.autoplay??!0,o=`<script src="${r}"><\/script>`;if(e?.splitTextUrl!==!1&&t.includes('data-requires-plugins="SplitText"')){let c=e?.splitTextUrl??Zr;o+=`
596
- <script src="${c}"><\/script>`}let i=o,a=t.indexOf("<script>");if(a===-1)return t.replace("</body>",` ${i}
597
- </body>`);let l=t.slice(0,a)+i+`
598
- `+t.slice(a);return n&&(l=l.replace("</body>",` ${Qr}
599
- </body>`)),l}async function es(t,e){if(typeof e.pageIndex!="number")throw new Error("pageIndex is required");let r=t.scene.get();if(r==null)throw new Error("No scene loaded");let n=t.block.findByType("page");if(e.pageIndex<0||e.pageIndex>=n.length)throw new Error(`pageIndex ${e.pageIndex} is out of bounds. Scene has ${n.length} page(s).`);let o={engine:t,currentBlocks:[],abortSignal:e.abortSignal},i=e.animated??"auto",a;i==="auto"?a=d(()=>t.scene.getMode())==="Video":a=i;let l={format:e.format??"external",pageIndex:e.pageIndex,quality:e.quality??90,insertExplicitLineBreaks:e.insertExplicitLineBreaks??!0,textMode:e.textMode??"html",animated:a,useSyntheticIds:e.useSyntheticIds??!1};return sr(o,l)}export{et as FileMap,K as Logger,es as exportHtml,Jr as injectGsapPlayer};
715
+ <\/script>
716
+ </body>`)),c}async function mr(e,n){if(typeof n.pageIndex!=`number`)throw Error(`pageIndex is required`);if(e.scene.get()==null)throw Error(`No scene loaded`);let r=e.block.findByType(`page`);if(n.pageIndex<0||n.pageIndex>=r.length)throw Error(`pageIndex ${n.pageIndex} is out of bounds. Scene has ${r.length} page(s).`);let i=n.animated??`auto`,a;a=i===`auto`?v(()=>e.block.getEnum(e.scene.get(),`scene/mode`))===`Video`:i;let o={format:n.format??`external`,pageIndex:n.pageIndex,quality:n.quality??90,insertExplicitLineBreaks:n.insertExplicitLineBreaks??!0,textMode:n.textMode??`html`,animated:a,useSyntheticIds:n.useSyntheticIds??!1},s=m(e,{type:`html`,format:`text/html`,producer:`${dr}@${fr}`,block:r[n.pageIndex],warn:e=>t(e,`warn`)}),c={engine:e,currentBlocks:[],abortSignal:n.abortSignal,transactionId:s.id},l;try{l=await ur(c,o)}catch(e){throw s.cancel(),e}let{duration:u,...d}=l;return s.end(hr(d),u),d}function hr(e){let t=0;for(let n of e.files.values())t+=typeof n.content==`string`?gr(n.content):n.content.byteLength;return t}function gr(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n),i=e.charCodeAt(n+1);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&i>=56320&&i<=57343?(t+=4,n++):t+=3}return t}export{jn as FileMap,g as Logger,mr as exportHtml,pr as injectGsapPlayer};