@opengeni/react 6.36.0 → 6.36.1-canary.45113772604001

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 (1087) hide show
  1. package/dist/app/app-state.js +10 -10
  2. package/dist/app/components/Composer.js +19 -19
  3. package/dist/app/components/agent/agent-capability-picker.js +6 -6
  4. package/dist/app/components/agents/agent-can-use.js +21 -20
  5. package/dist/app/components/agents/agent-form-page.js +69 -65
  6. package/dist/app/components/agents/agent-form-page.js.map +1 -1
  7. package/dist/app/components/agents/agent-page.js +68 -64
  8. package/dist/app/components/agents/agent-setup-sections.js +40 -36
  9. package/dist/app/components/agents/agent-skills.js +5 -5
  10. package/dist/app/components/agents/agent-trigger-chat-field.js +4 -4
  11. package/dist/app/components/agents/agent-trigger-dialog.js +20 -17
  12. package/dist/app/components/agents/agent-trigger-model.d.ts +14 -0
  13. package/dist/app/components/agents/agent-trigger-picker.js +6 -5
  14. package/dist/app/components/agents/agent-trigger-repositories.d.ts +9 -0
  15. package/dist/app/components/agents/agent-trigger-repositories.js +31 -0
  16. package/dist/app/components/agents/agents-page.css +1905 -0
  17. package/dist/app/components/agents/agents-page.css.map +1 -0
  18. package/dist/app/components/agents/agents-page.js +106 -61
  19. package/dist/app/components/agents/agents-page.js.map +1 -1
  20. package/dist/app/components/agents/composer-agent-chip.js +29 -29
  21. package/dist/app/components/agents/session-agent-chip.js +29 -29
  22. package/dist/app/components/artifacts/app-package.js +3 -3
  23. package/dist/app/components/artifacts/app-server-status.d.ts +22 -0
  24. package/dist/app/components/artifacts/app-server-status.js +13 -0
  25. package/dist/app/components/artifacts/artifact-library.css +1905 -0
  26. package/dist/app/components/artifacts/artifact-library.css.map +1 -0
  27. package/dist/app/components/artifacts/artifact-library.js +8 -8
  28. package/dist/app/components/artifacts/artifact-viewer.css +1905 -0
  29. package/dist/app/components/artifacts/artifact-viewer.css.map +1 -0
  30. package/dist/app/components/artifacts/artifact-viewer.js +30 -30
  31. package/dist/app/components/artifacts/chat-interactive-block.js +16 -16
  32. package/dist/app/components/artifacts/file-reach-dialog.js +6 -6
  33. package/dist/app/components/artifacts/inline-chat-image.js +28 -28
  34. package/dist/app/components/artifacts/ready-made-apps.css +1905 -0
  35. package/dist/app/components/artifacts/ready-made-apps.css.map +1 -0
  36. package/dist/app/components/artifacts/ready-made-apps.d.ts +3 -0
  37. package/dist/app/components/artifacts/ready-made-apps.js +40 -0
  38. package/dist/app/components/artifacts/retained-file-preview.js +30 -30
  39. package/dist/app/components/artifacts/retained-text-preview.js +3 -3
  40. package/dist/app/components/artifacts/site-actions.js +1 -1
  41. package/dist/app/components/artifacts/site-audience.js +3 -3
  42. package/dist/app/components/artifacts/site-conversations.js +15 -15
  43. package/dist/app/components/artifacts/site-data.js +11 -11
  44. package/dist/app/components/artifacts/site-publishing-page.js +32 -32
  45. package/dist/app/components/artifacts/site-publishing.js +24 -24
  46. package/dist/app/components/artifacts/site-settings.js +31 -31
  47. package/dist/app/components/artifacts/site-version-menu.js +4 -4
  48. package/dist/app/components/billing-class-mark.js +3 -3
  49. package/dist/app/components/capabilities/capability-detail-sheet.js +7 -7
  50. package/dist/app/components/capabilities/capability-logo-source.js +15 -14
  51. package/dist/app/components/capabilities/connector-tool-permissions.js +4 -4
  52. package/dist/app/components/capabilities/native-connect-setup.js +16 -15
  53. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +3 -3
  54. package/dist/app/components/capabilities/perform-capability-action.js +1 -1
  55. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +17 -16
  56. package/dist/app/components/capabilities/session-capability-card.js +70 -69
  57. package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
  58. package/dist/app/components/capabilities/session-chrome-card.js +22 -22
  59. package/dist/app/components/capabilities/session-connect-inputs-card.js +16 -15
  60. package/dist/app/components/capabilities/session-custom-mcp-card.js +18 -17
  61. package/dist/app/components/capabilities/session-github-card.js +19 -18
  62. package/dist/app/components/capabilities/session-machine-card.js +21 -21
  63. package/dist/app/components/capabilities/session-personal-github-card.js +16 -15
  64. package/dist/app/components/capabilities/session-plugin-card.js +9 -9
  65. package/dist/app/components/capabilities/use-connection-accounts.js +1 -1
  66. package/dist/app/components/command-menu/chat-status.js +18 -18
  67. package/dist/app/components/command-menu/chat-switcher.js +47 -47
  68. package/dist/app/components/command-menu/command-menu.js +58 -58
  69. package/dist/app/components/command-menu/shortcut-sheet.js +15 -15
  70. package/dist/app/components/composer-capabilities-menu-body.js +4 -4
  71. package/dist/app/components/composer-mobile-plus-panel.js +9 -9
  72. package/dist/app/components/composer-mobile-plus.js +1 -1
  73. package/dist/app/components/credit-required-gate.js +1 -1
  74. package/dist/app/components/credit-required-prompt.js +11 -11
  75. package/dist/app/components/credits/checkout-credits-celebration.js +2 -2
  76. package/dist/app/components/credits/checkout-return.js +2 -2
  77. package/dist/app/components/credits/credit-refusal-notice.js +2 -2
  78. package/dist/app/components/desktop/app-shots.js +7 -7
  79. package/dist/app/components/desktop/computer-use.js +2 -2
  80. package/dist/app/components/desktop/this-computer.js +5 -5
  81. package/dist/app/components/feedback.js +3 -3
  82. package/dist/app/components/follow-up-repository-menu-body.js +2 -2
  83. package/dist/app/components/follow-up-repository-picker.js +1 -1
  84. package/dist/app/components/github-app-connect-launcher.js +1 -1
  85. package/dist/app/components/machines/connect-machine-dialog.js +11 -11
  86. package/dist/app/components/markdown.js +7 -7
  87. package/dist/app/components/models/models-ui.js +6 -6
  88. package/dist/app/components/models/subscription-usage.js +5 -5
  89. package/dist/app/components/my-things.js +4 -4
  90. package/dist/app/components/own-where-it-works.js +3 -3
  91. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  92. package/dist/app/components/pickers.js +6 -6
  93. package/dist/app/components/rail/channel-create-dialog.js +3 -3
  94. package/dist/app/components/rail/project-glyph.js +29 -29
  95. package/dist/app/components/rail/project-profile.js +36 -36
  96. package/dist/app/components/rail/rail-context.js +1 -1
  97. package/dist/app/components/rail/rail-sections.js +80 -80
  98. package/dist/app/components/rail/session-header.js +64 -64
  99. package/dist/app/components/rail/session-list.js +78 -78
  100. package/dist/app/components/rail/session-row-content.js +4 -4
  101. package/dist/app/components/rail/session-row-hover-details.js +20 -20
  102. package/dist/app/components/rail/session-shell.js +102 -102
  103. package/dist/app/components/rail/site-session-group-heading.js +14 -14
  104. package/dist/app/components/repository-picker.js +2 -2
  105. package/dist/app/components/session/agent-configuration-panel.js +16 -16
  106. package/dist/app/components/session/artifact-session-page.js +1 -1
  107. package/dist/app/components/session/banners.js +9 -9
  108. package/dist/app/components/session/chat-avatar.js +29 -29
  109. package/dist/app/components/session/console-new-conversation.js +51 -51
  110. package/dist/app/components/session/descendant-requests.js +46 -46
  111. package/dist/app/components/session/editable-artifacts-workspace.css +1905 -0
  112. package/dist/app/components/session/editable-artifacts-workspace.css.map +1 -0
  113. package/dist/app/components/session/editable-artifacts-workspace.js +22 -22
  114. package/dist/app/components/session/failed-session-banner.js +10 -10
  115. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  116. package/dist/app/components/session/human-input-delegation-record.js +2 -2
  117. package/dist/app/components/session/human-input.js +42 -42
  118. package/dist/app/components/session/inspector.js +56 -56
  119. package/dist/app/components/session/linked-panel.js +3 -3
  120. package/dist/app/components/session/message-actions.js +3 -3
  121. package/dist/app/components/session/model-recovery-notice.js +3 -3
  122. package/dist/app/components/session/new-session-settings-menu.js +11 -11
  123. package/dist/app/components/session/new-session-setup-strip.js +30 -30
  124. package/dist/app/components/session/pull-request-panel.js +11 -11
  125. package/dist/app/components/session/sandbox-recovery-actions.js +3 -3
  126. package/dist/app/components/session/sandbox-switcher.js +8 -8
  127. package/dist/app/components/session/sandbox-workspace.js +58 -58
  128. package/dist/app/components/session/search-markdown-highlight.js +8 -8
  129. package/dist/app/components/session/search-results-view.js +9 -9
  130. package/dist/app/components/session/session-admin-access.js +4 -4
  131. package/dist/app/components/session/session-admission-notice.js +4 -4
  132. package/dist/app/components/session/session-avatar-picker.js +30 -30
  133. package/dist/app/components/session/session-avatar.js +28 -28
  134. package/dist/app/components/session/session-machine-access-notice.js +4 -4
  135. package/dist/app/components/session/session-profile-dialog.js +34 -34
  136. package/dist/app/components/session/session-profile-editor.js +35 -35
  137. package/dist/app/components/session/session-retention.js +4 -4
  138. package/dist/app/components/session/session-search-dialog.js +9 -9
  139. package/dist/app/components/session/session-tenancy-control.js +8 -8
  140. package/dist/app/components/session/session-usage-limit-section.js +4 -4
  141. package/dist/app/components/session/share-chat-dialog.js +6 -6
  142. package/dist/app/components/session/subagents.js +13 -13
  143. package/dist/app/components/session/subscription-account-indicator.js +11 -11
  144. package/dist/app/components/session/subscription-account-menu.js +6 -6
  145. package/dist/app/components/settings/row-select.js +4 -4
  146. package/dist/app/components/toaster.js +2 -2
  147. package/dist/app/components/transcription-settings.js +6 -6
  148. package/dist/app/components/ui/destructive-confirm.js +5 -5
  149. package/dist/app/components/usage/usage-entry.js +3 -3
  150. package/dist/app/components/window-bar.js +13 -13
  151. package/dist/app/components/workspace-composer-plus.js +18 -17
  152. package/dist/app/components/workspace-reach.js +4 -4
  153. package/dist/app/embed/session-app.js +241 -240
  154. package/dist/app/lib/actions/actions-provider.js +12 -12
  155. package/dist/app/lib/agent-capabilities.js +3 -3
  156. package/dist/app/lib/app-connect-card.js +9 -9
  157. package/dist/app/lib/app-shared-key-dialog.js +4 -4
  158. package/dist/app/lib/app-sync-opt-in.js +3 -3
  159. package/dist/app/lib/codex-usage-query.js +2 -2
  160. package/dist/app/lib/composer-connectors.js +16 -15
  161. package/dist/app/lib/console-site.js +5 -5
  162. package/dist/app/lib/console-text.js +2 -2
  163. package/dist/app/lib/events.js +18 -18
  164. package/dist/app/lib/failed-session-copy.js +3 -3
  165. package/dist/app/lib/model-access-onboarding.js +3 -3
  166. package/dist/app/lib/move-chat-to-machine.js +3 -3
  167. package/dist/app/lib/needs-you.d.ts +2 -1
  168. package/dist/app/lib/needs-you.js +1 -1
  169. package/dist/app/lib/ready-made-apps.d.ts +14 -0
  170. package/dist/app/lib/ready-made-apps.js +8 -0
  171. package/dist/app/lib/session-branch-cache.js +13 -13
  172. package/dist/app/lib/session-capabilities.js +1 -1
  173. package/dist/app/lib/session-create.js +4 -4
  174. package/dist/app/lib/session-group-pagination.js +13 -13
  175. package/dist/app/lib/session-hover-facts.js +17 -17
  176. package/dist/app/lib/session-list-dirty-scopes.js +14 -14
  177. package/dist/app/lib/session-model.js +2 -2
  178. package/dist/app/lib/session-rail.js +10 -10
  179. package/dist/app/lib/session-rename.js +3 -3
  180. package/dist/app/lib/sessions-group.js +12 -12
  181. package/dist/app/lib/site-tool-consent-dialog.js +8 -8
  182. package/dist/app/lib/site-tool-consent.js +1 -1
  183. package/dist/app/lib/turn-failure-analytics.js +4 -4
  184. package/dist/app/lib/use-follow-up-repositories.js +3 -3
  185. package/dist/app/lib/use-workspace-machines.js +4 -4
  186. package/dist/app/lib/use-workspace-model-catalog.js +3 -3
  187. package/dist/app/lib/use-workspace-rigs.js +2 -2
  188. package/dist/app/lib/workspace-navigation-preference.js +4 -4
  189. package/dist/app/lib/workspace-scope-context.js +3 -3
  190. package/dist/app/routes/app-page-view.js +10 -10
  191. package/dist/app/routes/app-page.js +1 -1
  192. package/dist/app/routes/artifacts.css +1905 -0
  193. package/dist/app/routes/artifacts.css.map +1 -0
  194. package/dist/app/routes/artifacts.js +105 -94
  195. package/dist/app/routes/artifacts.js.map +1 -1
  196. package/dist/app/routes/retained-artifact.js +47 -47
  197. package/dist/app/routes/session-unavailable.js +2 -2
  198. package/dist/app/routes/session.js +131 -130
  199. package/dist/app/routes/sessions-index-hydration.js +5 -5
  200. package/dist/app/routes/sessions-index.js +108 -107
  201. package/dist/app/routes/site-view.js +107 -95
  202. package/dist/app/routes/site-view.js.map +1 -1
  203. package/dist/approval-review-model.js +2 -2
  204. package/dist/artifacts-document.js +4 -4
  205. package/dist/artifacts-presentation.js +5 -5
  206. package/dist/artifacts-spreadsheet.js +4 -4
  207. package/dist/artifacts.js +15 -15
  208. package/dist/automation-model.js +5 -5
  209. package/dist/automations.d.ts +1 -0
  210. package/dist/automations.js +29 -22
  211. package/dist/automations.js.map +1 -1
  212. package/dist/browser-viewer-EPGAK2W6.js +23 -0
  213. package/dist/chat-interactive-block-65YU6TMO.js +22 -0
  214. package/dist/chunk-25ODMMHH.js +403 -0
  215. package/dist/chunk-266ZPUMH.js +400 -0
  216. package/dist/chunk-2A7SB7UR.js +168 -0
  217. package/dist/chunk-2EU4Y7A7.js +100 -0
  218. package/dist/chunk-2F7VSGRS.js +1177 -0
  219. package/dist/chunk-2F7VSGRS.js.map +1 -0
  220. package/dist/chunk-2L6B6766.js +5915 -0
  221. package/dist/chunk-2L6B6766.js.map +1 -0
  222. package/dist/chunk-2LBYEHBH.js +570 -0
  223. package/dist/chunk-2MHIIF4N.js +141 -0
  224. package/dist/chunk-2SHWGDAA.js +283 -0
  225. package/dist/chunk-2VX42S4W.js +773 -0
  226. package/dist/chunk-2WGJQ4XK.js +311 -0
  227. package/dist/chunk-2XSF44TY.js +15 -0
  228. package/dist/chunk-33HUZMNE.js +639 -0
  229. package/dist/chunk-36IKHM4Q.js +148 -0
  230. package/dist/chunk-3JVQZAXQ.js +4480 -0
  231. package/dist/chunk-3SDESU6U.js +287 -0
  232. package/dist/chunk-3VXZFBP6.js +292 -0
  233. package/dist/chunk-3WDNCSVU.js +197 -0
  234. package/dist/chunk-3WDNCSVU.js.map +1 -0
  235. package/dist/chunk-3YKED2ZV.js +307 -0
  236. package/dist/chunk-3ZNOKD3S.js +1019 -0
  237. package/dist/chunk-45SB4UK3.js +2580 -0
  238. package/dist/chunk-47BETTVA.js +133 -0
  239. package/dist/chunk-4BTQ473O.js +274 -0
  240. package/dist/chunk-4JQRWJVR.js +249 -0
  241. package/dist/chunk-4NGIKV2W.js +316 -0
  242. package/dist/chunk-4NGIKV2W.js.map +1 -0
  243. package/dist/chunk-4R6WFQKZ.js +202 -0
  244. package/dist/chunk-4WEPVL7X.js +283 -0
  245. package/dist/chunk-4YWHOAB4.js +201 -0
  246. package/dist/chunk-52XGYRVS.js +155 -0
  247. package/dist/chunk-5G6UHUJZ.js +43 -0
  248. package/dist/chunk-5HFITPHH.js +229 -0
  249. package/dist/chunk-5LVVN2K7.js +650 -0
  250. package/dist/chunk-5PVXFVIT.js +48 -0
  251. package/dist/chunk-5WFGW7B7.js +187 -0
  252. package/dist/chunk-5YMSLKJP.js +92 -0
  253. package/dist/chunk-5YMSLKJP.js.map +1 -0
  254. package/dist/chunk-66M7RVM6.js +3070 -0
  255. package/dist/chunk-6AGNZI2W.js +437 -0
  256. package/dist/chunk-6ENO634Y.js +373 -0
  257. package/dist/chunk-6LQ5KEMP.js +200 -0
  258. package/dist/chunk-6QGIWLH5.js +428 -0
  259. package/dist/chunk-6WEDWD4N.js +170 -0
  260. package/dist/chunk-6YCYPXDA.js +114 -0
  261. package/dist/chunk-6YTNMDFP.js +318 -0
  262. package/dist/chunk-73O7NO3F.js +50 -0
  263. package/dist/chunk-76VXLTQF.js +251 -0
  264. package/dist/chunk-7EJ7PSZT.js +93 -0
  265. package/dist/chunk-7GS2MGFU.js +27 -0
  266. package/dist/chunk-7MF6MFHS.js +406 -0
  267. package/dist/chunk-7N35XBSC.js +386 -0
  268. package/dist/chunk-7ND2VMKV.js +270 -0
  269. package/dist/chunk-7RVJLO3N.js +154 -0
  270. package/dist/chunk-7VAILBP6.js +353 -0
  271. package/dist/chunk-7VSJQWFO.js +37 -0
  272. package/dist/chunk-7YKUIKGH.js +335 -0
  273. package/dist/chunk-A7DS77WC.js +138 -0
  274. package/dist/chunk-ABGHRGID.js +376 -0
  275. package/dist/chunk-ABGHRGID.js.map +1 -0
  276. package/dist/chunk-AEH34OOU.js +298 -0
  277. package/dist/chunk-ANWMRO2G.js +554 -0
  278. package/dist/chunk-APGUIORF.js +247 -0
  279. package/dist/chunk-ASCVQJB4.js +1309 -0
  280. package/dist/chunk-AVYFJKQS.js +10044 -0
  281. package/dist/chunk-AVYFJKQS.js.map +1 -0
  282. package/dist/chunk-AY4XH73V.js +1333 -0
  283. package/dist/chunk-B6AH43UQ.js +2434 -0
  284. package/dist/chunk-BBZUHH4F.js +154 -0
  285. package/dist/chunk-BBZUHH4F.js.map +1 -0
  286. package/dist/chunk-BGT43KDL.js +42 -0
  287. package/dist/chunk-BHS4KW4W.js +3851 -0
  288. package/dist/chunk-BJUDGPOD.js +1803 -0
  289. package/dist/chunk-BJUDGPOD.js.map +1 -0
  290. package/dist/chunk-BNWO72C2.js +851 -0
  291. package/dist/chunk-BSPIASSQ.js +2551 -0
  292. package/dist/chunk-BVWJEZXG.js +230 -0
  293. package/dist/chunk-BZ47G3VP.js +366 -0
  294. package/dist/chunk-C6KI5P3H.js +72 -0
  295. package/dist/chunk-CLERWAEA.js +2317 -0
  296. package/dist/chunk-CNRFFCAE.js +572 -0
  297. package/dist/chunk-CPC6CYVW.js +236 -0
  298. package/dist/chunk-D23UAPXK.js +107 -0
  299. package/dist/chunk-DAPZEB4R.js +29 -0
  300. package/dist/chunk-DEDEA3WS.js +205 -0
  301. package/dist/chunk-DHVA3T3K.js +271 -0
  302. package/dist/chunk-DJQ6TKIP.js +391 -0
  303. package/dist/chunk-DK2CDAMR.js +33 -0
  304. package/dist/chunk-DPOB6MUS.js +278 -0
  305. package/dist/chunk-DSO7S6PZ.js +137 -0
  306. package/dist/chunk-DV3OECO6.js +333 -0
  307. package/dist/chunk-DW2IQRMB.js +1187 -0
  308. package/dist/chunk-DWLPQTDL.js +134 -0
  309. package/dist/chunk-DXMKECFR.js +3176 -0
  310. package/dist/chunk-DYQRNIID.js +73 -0
  311. package/dist/chunk-DZLWO73N.js +129 -0
  312. package/dist/chunk-DZZSFPMW.js +66 -0
  313. package/dist/chunk-DZZSFPMW.js.map +1 -0
  314. package/dist/chunk-E2GNUL64.js +107 -0
  315. package/dist/chunk-E7XU2KHD.js +192 -0
  316. package/dist/chunk-ENYULVQW.js +114 -0
  317. package/dist/chunk-EWHQ3DFM.js +41 -0
  318. package/dist/chunk-F2T4J7CK.js +4957 -0
  319. package/dist/chunk-F2T4J7CK.js.map +1 -0
  320. package/dist/chunk-F3LIUDXN.js +738 -0
  321. package/dist/chunk-F5C7DTVR.js +103 -0
  322. package/dist/chunk-F5NFGBIN.js +391 -0
  323. package/dist/chunk-F6XJLGOV.js +175 -0
  324. package/dist/chunk-F7T2STMX.js +158 -0
  325. package/dist/chunk-FAEVOM6B.js +371 -0
  326. package/dist/chunk-FCFAXQDM.js +276 -0
  327. package/dist/chunk-FEQVCQMK.js +138 -0
  328. package/dist/chunk-FLD4VOJW.js +4565 -0
  329. package/dist/chunk-FLD4VOJW.js.map +1 -0
  330. package/dist/chunk-FLDF2Z44.js +396 -0
  331. package/dist/chunk-GADABL3P.js +772 -0
  332. package/dist/chunk-GFUDB3SA.js +140 -0
  333. package/dist/chunk-GGPZPBHS.js +215 -0
  334. package/dist/chunk-GIEGIEMT.js +311 -0
  335. package/dist/chunk-GKWFQEO3.js +187 -0
  336. package/dist/chunk-GMMB4NCN.js +250 -0
  337. package/dist/chunk-GN4FOL2G.js +269 -0
  338. package/dist/chunk-GQJAMANY.js +469 -0
  339. package/dist/chunk-H7F4ANJQ.js +379 -0
  340. package/dist/chunk-HEPFJ3XQ.js +3110 -0
  341. package/dist/chunk-HLRAQITA.js +234 -0
  342. package/dist/chunk-HXYSZKCC.js +117 -0
  343. package/dist/chunk-I5Q6FVHP.js +828 -0
  344. package/dist/chunk-I7M5BYJU.js +265 -0
  345. package/dist/chunk-IH3J7VWW.js +85 -0
  346. package/dist/chunk-IMMDXSZ4.js +178 -0
  347. package/dist/chunk-IOMZDY5D.js +199 -0
  348. package/dist/chunk-IQTCUUDF.js +1236 -0
  349. package/dist/chunk-ISR6KXWT.js +898 -0
  350. package/dist/chunk-IWPPGXUZ.js +3321 -0
  351. package/dist/chunk-IYKO6BBK.js +3854 -0
  352. package/dist/chunk-IYKO6BBK.js.map +1 -0
  353. package/dist/chunk-IYUZPNMU.js +79 -0
  354. package/dist/chunk-IYUZPNMU.js.map +1 -0
  355. package/dist/chunk-JNPCRNPA.js +84 -0
  356. package/dist/chunk-JSJGGP32.js +505 -0
  357. package/dist/chunk-JZZUEJYD.js +56 -0
  358. package/dist/chunk-K5XFZKK5.js +270 -0
  359. package/dist/chunk-K6GRTSEA.js +65 -0
  360. package/dist/chunk-KA4PZU3Q.js +103 -0
  361. package/dist/chunk-KGZ35ESO.js +83 -0
  362. package/dist/chunk-KRM4PW5N.js +1021 -0
  363. package/dist/chunk-KSNKF6FE.js +551 -0
  364. package/dist/chunk-KSNKF6FE.js.map +1 -0
  365. package/dist/chunk-LEZGGRDQ.js +1095 -0
  366. package/dist/chunk-LFWMFFKT.js +144 -0
  367. package/dist/chunk-LKSPUZPH.js +849 -0
  368. package/dist/chunk-LLX4S6BI.js +401 -0
  369. package/dist/chunk-M4WEF4DZ.js +850 -0
  370. package/dist/chunk-MATYGLUT.js +121 -0
  371. package/dist/chunk-MDI6SH7B.js +27 -0
  372. package/dist/chunk-MQO7MSA6.js +43 -0
  373. package/dist/chunk-MQO7MSA6.js.map +1 -0
  374. package/dist/chunk-MQTYIBY6.js +263 -0
  375. package/dist/chunk-MRKY2GL5.js +1185 -0
  376. package/dist/chunk-MSIQ42IY.js +794 -0
  377. package/dist/chunk-MVGU7BET.js +357 -0
  378. package/dist/chunk-MWY4TBDY.js +404 -0
  379. package/dist/chunk-NGQCWCD6.js +234 -0
  380. package/dist/chunk-NKXMIOYN.js +538 -0
  381. package/dist/chunk-NMVRFFCR.js +256 -0
  382. package/dist/chunk-NNTDIKJP.js +407 -0
  383. package/dist/chunk-NQXCPP4G.js +98 -0
  384. package/dist/chunk-NYGS6FNV.js +132 -0
  385. package/dist/chunk-O3LOQDTI.js +176 -0
  386. package/dist/chunk-O5HRZ2KG.js +818 -0
  387. package/dist/chunk-O5PZRVQR.js +214 -0
  388. package/dist/chunk-O6KR5SN7.js +399 -0
  389. package/dist/chunk-OBKDRV2H.js +259 -0
  390. package/dist/chunk-OBKKUBGL.js +107 -0
  391. package/dist/chunk-OFYXDB6I.js +52 -0
  392. package/dist/chunk-OLMWJGSJ.js +50 -0
  393. package/dist/chunk-OO7N6APA.js +598 -0
  394. package/dist/chunk-OO7N6APA.js.map +1 -0
  395. package/dist/chunk-ORRACKLB.js +1263 -0
  396. package/dist/chunk-P426WWAB.js +351 -0
  397. package/dist/chunk-P4GOY3ZL.js +177 -0
  398. package/dist/chunk-P4KVJLUC.js +129 -0
  399. package/dist/chunk-P4N7ZS6W.js +56 -0
  400. package/dist/chunk-P6LSLNSL.js +209 -0
  401. package/dist/chunk-P7MQCSML.js +77 -0
  402. package/dist/chunk-P7MQCSML.js.map +1 -0
  403. package/dist/chunk-PAFSIDM2.js +111 -0
  404. package/dist/chunk-PC2JAIAH.js +117 -0
  405. package/dist/chunk-PGSXT5OY.js +207 -0
  406. package/dist/chunk-QDMGUTOU.js +2984 -0
  407. package/dist/chunk-QEMDQKQT.js +1356 -0
  408. package/dist/chunk-QK7VU5N3.js +2412 -0
  409. package/dist/chunk-QL4Q332Z.js +12 -0
  410. package/dist/chunk-QL5227KT.js +1184 -0
  411. package/dist/chunk-QREYGVWO.js +297 -0
  412. package/dist/chunk-QREYGVWO.js.map +1 -0
  413. package/dist/chunk-QUFCZMHG.js +114 -0
  414. package/dist/chunk-QXPKUKOV.js +227 -0
  415. package/dist/chunk-QZE3KD34.js +441 -0
  416. package/dist/chunk-RAIUIXCY.js +166 -0
  417. package/dist/chunk-RDLS6IZY.js +723 -0
  418. package/dist/chunk-RKPETJDJ.js +175 -0
  419. package/dist/chunk-RMDLTRLI.js +372 -0
  420. package/dist/chunk-RR6DQN4X.js +523 -0
  421. package/dist/chunk-RVPH6BB7.js +218 -0
  422. package/dist/chunk-RVXLSVJH.js +931 -0
  423. package/dist/chunk-RVY5EZNU.js +246 -0
  424. package/dist/chunk-RWHBX4MN.js +1024 -0
  425. package/dist/chunk-RWHDMGFG.js +214 -0
  426. package/dist/chunk-RYB3WBMZ.js +113 -0
  427. package/dist/chunk-S7EO77EE.js +449 -0
  428. package/dist/chunk-S7J4HBPP.js +584 -0
  429. package/dist/chunk-SA3XI7FB.js +108 -0
  430. package/dist/chunk-SKRTCSUL.js +196 -0
  431. package/dist/chunk-SUWDILUY.js +5089 -0
  432. package/dist/chunk-SWTPVMR4.js +251 -0
  433. package/dist/chunk-T5BYEE66.js +191 -0
  434. package/dist/chunk-T652Q4R6.js +48 -0
  435. package/dist/chunk-TBUOHK6R.js +608 -0
  436. package/dist/chunk-TCUAGCAX.js +1628 -0
  437. package/dist/chunk-TLWH4E3P.js +126 -0
  438. package/dist/chunk-TNHGSWG3.js +1152 -0
  439. package/dist/chunk-TO6VBJI3.js +383 -0
  440. package/dist/chunk-TOL7MOAN.js +162 -0
  441. package/dist/chunk-U243CBVZ.js +2553 -0
  442. package/dist/chunk-U2CEPRDH.js +46 -0
  443. package/dist/chunk-UAZPXKPH.js +3996 -0
  444. package/dist/chunk-UHRGUMLJ.js +412 -0
  445. package/dist/chunk-UNDSD6UA.js +131 -0
  446. package/dist/chunk-USU2SS4V.js +3690 -0
  447. package/dist/chunk-USWA5GQQ.js +340 -0
  448. package/dist/chunk-UXGTI4HR.js +184 -0
  449. package/dist/chunk-UZKAHEQO.js +172 -0
  450. package/dist/chunk-VALESBNH.js +113 -0
  451. package/dist/chunk-VMSMVWCJ.js +515 -0
  452. package/dist/chunk-VPERSFGV.js +158 -0
  453. package/dist/chunk-VVW2CBWK.js +21 -0
  454. package/dist/chunk-VVW2CBWK.js.map +1 -0
  455. package/dist/chunk-VXPY2GF3.js +124 -0
  456. package/dist/chunk-W7RKXZDV.js +112 -0
  457. package/dist/chunk-WEGZPK4I.js +532 -0
  458. package/dist/chunk-WPKY3BGG.js +380 -0
  459. package/dist/chunk-X3T3N6W5.js +1022 -0
  460. package/dist/chunk-X4OGMBY6.js +110 -0
  461. package/dist/chunk-X7ZHIJEI.js +82 -0
  462. package/dist/chunk-XR7Y2HPZ.js +67 -0
  463. package/dist/chunk-Y2NMKJ7F.js +57 -0
  464. package/dist/chunk-Y2QYPJDN.js +26 -0
  465. package/dist/chunk-Y47EPVCD.js +211 -0
  466. package/dist/chunk-Y5Q4ETIW.js +162 -0
  467. package/dist/chunk-YMQVVFXI.js +105 -0
  468. package/dist/chunk-YQ6FP33X.js +378 -0
  469. package/dist/chunk-YUA42N5A.js +406 -0
  470. package/dist/chunk-YXFNW64N.js +91 -0
  471. package/dist/chunk-Z76RJPZF.js +389 -0
  472. package/dist/chunk-ZD67RM6G.js +60 -0
  473. package/dist/chunk-ZE4RD7U5.js +231 -0
  474. package/dist/chunk-ZGR7LNXC.js +432 -0
  475. package/dist/chunk-ZNA65Q6Y.js +20 -0
  476. package/dist/chunk-ZRNK6FK6.js +188 -0
  477. package/dist/chunk-ZVAIKQMC.js +296 -0
  478. package/dist/chunk-ZZ3KNGTJ.js +246 -0
  479. package/dist/components/automations/pasted-webhook-steps.d.ts +29 -0
  480. package/dist/components/browser-viewer.d.ts +4 -1
  481. package/dist/components/human-input-form.d.ts +3 -4
  482. package/dist/components/use-fit-browser-viewport.d.ts +10 -0
  483. package/dist/composer.js +8 -8
  484. package/dist/computer-viewer-M5N3GWBR.js +21 -0
  485. package/dist/connect.js +17 -15
  486. package/dist/connection-step-up-CNVFVWYO.js +146 -0
  487. package/dist/connection-step-up-CNVFVWYO.js.map +1 -0
  488. package/dist/desktop-dictation.js +8 -8
  489. package/dist/desktop.js +2 -2
  490. package/dist/editor.js +2 -2
  491. package/dist/embedded-new-voice-QZJG5DZ3.js +25 -0
  492. package/dist/embedded-voice-7KOQNGKU.js +25 -0
  493. package/dist/fleet-decision-row-FJPAWNOQ.js +361 -0
  494. package/dist/in-chat-connect-model.js +5 -5
  495. package/dist/index.js +65 -65
  496. package/dist/interaction.js +5 -5
  497. package/dist/latest-question-F3VPDR7U.js +124 -0
  498. package/dist/machines.js +3 -3
  499. package/dist/meetings-recorder.js +1 -1
  500. package/dist/meetings.js +20 -20
  501. package/dist/messages/en.d.ts +1 -1
  502. package/dist/messages.js +1 -1
  503. package/dist/model-policy-picker-menu-UNI5B6N6.js +23 -0
  504. package/dist/model-policy-picker-menu-UNI5B6N6.js.map +1 -0
  505. package/dist/payment-page-card-HZJVN3F4.js +226 -0
  506. package/dist/platform-activity-row-NPEGG2VE.js +156 -0
  507. package/dist/queue-surface-implementation-RTCTPF5T.js +932 -0
  508. package/dist/realtime.js +4 -4
  509. package/dist/recorder-host-YPWPLMS6.js +80 -0
  510. package/dist/recordings.js +3 -3
  511. package/dist/sandbox-files-BJKCREOU.js +28 -0
  512. package/dist/sandbox-files-BJKCREOU.js.map +1 -0
  513. package/dist/session-app.js +242 -241
  514. package/dist/session-connect-cards-DK3UJZRY.js +27 -0
  515. package/dist/session-connect-cards-DK3UJZRY.js.map +1 -0
  516. package/dist/session-list-model.js +2 -2
  517. package/dist/session-realtime-AKDUKFY4.js +30 -0
  518. package/dist/session-realtime-AKDUKFY4.js.map +1 -0
  519. package/dist/session-realtime.js +2 -2
  520. package/dist/session-ui.js +42 -42
  521. package/dist/session.js +11 -11
  522. package/dist/sites.js +2 -2
  523. package/dist/terminal.js +2 -2
  524. package/dist/this-computer.js +3 -3
  525. package/dist/timeline-annotation-markers-7QSYK22C.js +157 -0
  526. package/dist/timeline-annotation-selection-XYNMESWL.js +208 -0
  527. package/dist/timeline-annotations-dialog-WSI6L2CP.js +283 -0
  528. package/dist/timeline-model.js +26 -26
  529. package/dist/ui/access-list.js +5 -5
  530. package/dist/ui/cadence-picker.js +5 -5
  531. package/dist/ui/choice-cards.js +3 -3
  532. package/dist/ui/confirm-dialog.js +2 -2
  533. package/dist/ui/copy-field.js +3 -3
  534. package/dist/ui/detail-page.js +2 -2
  535. package/dist/ui/detail-sheet.js +2 -2
  536. package/dist/ui/disclosure.js +3 -3
  537. package/dist/ui/email-chips-input.js +3 -3
  538. package/dist/ui/field.js +2 -2
  539. package/dist/ui/flush-form-page.js +3 -3
  540. package/dist/ui/form-dialog.js +2 -2
  541. package/dist/ui/list-row.js +4 -4
  542. package/dist/ui/relative-time.js +3 -3
  543. package/dist/ui/revision-history.js +5 -5
  544. package/dist/ui/role-select.js +5 -5
  545. package/dist/ui/select-menu.js +3 -3
  546. package/dist/ui/usage-meter.js +4 -4
  547. package/dist/usage.js +2 -2
  548. package/dist/workbench.js +4 -4
  549. package/package.json +6 -5
  550. package/src/app/components/agents/agent-skills.tsx +21 -18
  551. package/src/app/components/agents/agent-trigger-dialog.tsx +80 -119
  552. package/src/app/components/agents/agent-trigger-model.ts +47 -0
  553. package/src/app/components/agents/agent-trigger-repositories.tsx +88 -0
  554. package/src/app/components/agents/agents-page.tsx +118 -38
  555. package/src/app/components/artifacts/app-server-status.test.tsx +33 -0
  556. package/src/app/components/artifacts/app-server-status.tsx +93 -0
  557. package/src/app/components/artifacts/ready-made-apps.tsx +84 -0
  558. package/src/app/lib/codex-model-switch.ts +1 -0
  559. package/src/app/lib/needs-you.test.ts +8 -0
  560. package/src/app/lib/needs-you.tsx +3 -1
  561. package/src/app/lib/ready-made-apps.tsx +42 -0
  562. package/src/app/lib/session-capabilities.tsx +1 -0
  563. package/src/app/routes/artifacts.tsx +11 -0
  564. package/src/app/routes/site-view.tsx +9 -0
  565. package/src/automations.ts +8 -2
  566. package/src/components/automations/pasted-webhook-steps.tsx +89 -0
  567. package/src/components/browser-viewer.tsx +49 -7
  568. package/src/components/human-input-form.tsx +16 -5
  569. package/src/components/secret-question-field.tsx +42 -32
  570. package/src/components/use-fit-browser-viewport.ts +84 -0
  571. package/src/messages/en.ts +1 -1
  572. package/src/timeline/projection.ts +5 -2
  573. package/src/timeline/tool-steps.ts +2 -0
  574. package/dist/browser-viewer-EIEMRVFF.js +0 -23
  575. package/dist/chat-interactive-block-FV37LWYZ.js +0 -22
  576. package/dist/chunk-2COBAJC7.js +0 -818
  577. package/dist/chunk-2HS3IUXE.js +0 -170
  578. package/dist/chunk-2JTMFYCT.js +0 -296
  579. package/dist/chunk-2JXKP4M6.js +0 -114
  580. package/dist/chunk-2P5K7CBH.js +0 -269
  581. package/dist/chunk-2XGRHMRI.js +0 -250
  582. package/dist/chunk-332BYSAZ.js +0 -65
  583. package/dist/chunk-3EM5GTP3.js +0 -158
  584. package/dist/chunk-3L5ATO4A.js +0 -52
  585. package/dist/chunk-3S3PJB7J.js +0 -107
  586. package/dist/chunk-3SBKYPNM.js +0 -270
  587. package/dist/chunk-3Z7VA6ET.js +0 -114
  588. package/dist/chunk-43BRJBEV.js +0 -207
  589. package/dist/chunk-46LZO4ZO.js +0 -188
  590. package/dist/chunk-4AH4EEHE.js +0 -298
  591. package/dist/chunk-4D3YJNVN.js +0 -270
  592. package/dist/chunk-4E5QVAT4.js +0 -4480
  593. package/dist/chunk-4I4RTI4D.js +0 -37
  594. package/dist/chunk-4KASGJTF.js +0 -287
  595. package/dist/chunk-4RUKLIOF.js +0 -1263
  596. package/dist/chunk-4UU7FN3I.js +0 -650
  597. package/dist/chunk-4ZRNASBF.js +0 -2551
  598. package/dist/chunk-5EJBPQI2.js +0 -41
  599. package/dist/chunk-5G4IGG7F.js +0 -209
  600. package/dist/chunk-5JAYZOAW.js +0 -131
  601. package/dist/chunk-5JOKVDSR.js +0 -789
  602. package/dist/chunk-5JOKVDSR.js.map +0 -1
  603. package/dist/chunk-5MP3G7ZV.js +0 -1236
  604. package/dist/chunk-5OVRMKP5.js +0 -42
  605. package/dist/chunk-5SGTRULO.js +0 -1184
  606. package/dist/chunk-5SOL4INY.js +0 -572
  607. package/dist/chunk-5Y34P32B.js +0 -27
  608. package/dist/chunk-62HIKJ5F.js +0 -72
  609. package/dist/chunk-63VNZRLY.js +0 -386
  610. package/dist/chunk-63WDQV5X.js +0 -148
  611. package/dist/chunk-6DOIINY4.js +0 -201
  612. package/dist/chunk-6DQBUKGJ.js +0 -112
  613. package/dist/chunk-6SETNFNH.js +0 -1399
  614. package/dist/chunk-6SETNFNH.js.map +0 -1
  615. package/dist/chunk-6XYFMHNT.js +0 -56
  616. package/dist/chunk-6YU3WV2P.js +0 -33
  617. package/dist/chunk-6YUHDFOZ.js +0 -351
  618. package/dist/chunk-72EOXOR7.js +0 -1185
  619. package/dist/chunk-72ND4ALI.js +0 -532
  620. package/dist/chunk-757LE32E.js +0 -283
  621. package/dist/chunk-7S2S4MXR.js +0 -138
  622. package/dist/chunk-7SYCHMXS.js +0 -200
  623. package/dist/chunk-7TVAPQOV.js +0 -5089
  624. package/dist/chunk-7UDLRDHK.js +0 -214
  625. package/dist/chunk-7YLQCMZP.js +0 -357
  626. package/dist/chunk-A5GX3CAE.js +0 -849
  627. package/dist/chunk-A7EBV2EB.js +0 -318
  628. package/dist/chunk-AB5SPXUR.js +0 -114
  629. package/dist/chunk-AHVQGL5A.js +0 -202
  630. package/dist/chunk-AI77ZKEV.js +0 -26
  631. package/dist/chunk-AIX2D6RB.js +0 -1019
  632. package/dist/chunk-AVSIHP7Q.js +0 -192
  633. package/dist/chunk-AWK23Q32.js +0 -107
  634. package/dist/chunk-AYM3UFP2.js +0 -43
  635. package/dist/chunk-AYM3UFP2.js.map +0 -1
  636. package/dist/chunk-AYVWA6KD.js +0 -432
  637. package/dist/chunk-AYVWA6KD.js.map +0 -1
  638. package/dist/chunk-AYZXE4IM.js +0 -2553
  639. package/dist/chunk-AZGGSPTE.js +0 -124
  640. package/dist/chunk-B45TB4HY.js +0 -931
  641. package/dist/chunk-BC7PTVXW.js +0 -140
  642. package/dist/chunk-BIUJHNVR.js +0 -46
  643. package/dist/chunk-BJUOKUE5.js +0 -234
  644. package/dist/chunk-BMT5IXQW.js +0 -154
  645. package/dist/chunk-BMT5IXQW.js.map +0 -1
  646. package/dist/chunk-BPEEVMKH.js +0 -292
  647. package/dist/chunk-BXMND6YU.js +0 -307
  648. package/dist/chunk-C6OM2SRG.js +0 -117
  649. package/dist/chunk-CIRCUDKF.js +0 -1309
  650. package/dist/chunk-CLKR4UG3.js +0 -403
  651. package/dist/chunk-CPX6BHER.js +0 -554
  652. package/dist/chunk-CVC4RO7D.js +0 -155
  653. package/dist/chunk-D3YJAQGK.js +0 -103
  654. package/dist/chunk-DFQ72BLS.js +0 -1024
  655. package/dist/chunk-DG65PJOZ.js +0 -4564
  656. package/dist/chunk-DG65PJOZ.js.map +0 -1
  657. package/dist/chunk-DNAXAS5R.js +0 -406
  658. package/dist/chunk-DO247ITS.js +0 -175
  659. package/dist/chunk-DONBARLL.js +0 -154
  660. package/dist/chunk-DTLXQ3ZU.js +0 -373
  661. package/dist/chunk-EAXTACI4.js +0 -274
  662. package/dist/chunk-EDPH7AJH.js +0 -412
  663. package/dist/chunk-EER3B3G5.js +0 -10036
  664. package/dist/chunk-EER3B3G5.js.map +0 -1
  665. package/dist/chunk-EFKQHCGJ.js +0 -276
  666. package/dist/chunk-EILSPMVD.js +0 -133
  667. package/dist/chunk-EMWT6GOK.js +0 -437
  668. package/dist/chunk-EO22NST7.js +0 -259
  669. package/dist/chunk-ER5MYLIE.js +0 -256
  670. package/dist/chunk-ES5HKVQF.js +0 -234
  671. package/dist/chunk-EXRQ5ATC.js +0 -738
  672. package/dist/chunk-F26YBYAZ.js +0 -111
  673. package/dist/chunk-F6QP4GSK.js +0 -515
  674. package/dist/chunk-F7QEO7M2.js +0 -851
  675. package/dist/chunk-FJFGDLXB.js +0 -12
  676. package/dist/chunk-FLLJ2WXW.js +0 -113
  677. package/dist/chunk-FMBJKMT4.js +0 -107
  678. package/dist/chunk-FPN4I4CG.js +0 -3690
  679. package/dist/chunk-FUXFJTXL.js +0 -3070
  680. package/dist/chunk-FZI4QOAV.js +0 -3996
  681. package/dist/chunk-G6SSSX5R.js +0 -158
  682. package/dist/chunk-GBGCMHBB.js +0 -608
  683. package/dist/chunk-GJ4GTYOD.js +0 -372
  684. package/dist/chunk-GLSDWNFV.js +0 -432
  685. package/dist/chunk-GMGAW3T6.js +0 -278
  686. package/dist/chunk-GNGI6XFN.js +0 -43
  687. package/dist/chunk-GSW4YHZE.js +0 -229
  688. package/dist/chunk-GUC6IWEY.js +0 -407
  689. package/dist/chunk-GWAY3SO5.js +0 -15
  690. package/dist/chunk-GXOTNT5D.js +0 -168
  691. package/dist/chunk-GZZCVF76.js +0 -3851
  692. package/dist/chunk-H4VMHFOX.js +0 -214
  693. package/dist/chunk-HA5RFQAF.js +0 -110
  694. package/dist/chunk-HJLHGXWL.js +0 -103
  695. package/dist/chunk-HKNMNL7B.js +0 -2984
  696. package/dist/chunk-HT7MBHLY.js +0 -1021
  697. package/dist/chunk-I5FSUZVW.js +0 -584
  698. package/dist/chunk-II376XH3.js +0 -117
  699. package/dist/chunk-IINQO425.js +0 -246
  700. package/dist/chunk-IIXNEOK4.js +0 -1022
  701. package/dist/chunk-IM3WA5AL.js +0 -311
  702. package/dist/chunk-IX4P4OGR.js +0 -399
  703. package/dist/chunk-IX5VHZYS.js +0 -129
  704. package/dist/chunk-J7QHW2KS.js +0 -549
  705. package/dist/chunk-J7QHW2KS.js.map +0 -1
  706. package/dist/chunk-JB3TSUZO.js +0 -263
  707. package/dist/chunk-JD6LHU26.js +0 -3852
  708. package/dist/chunk-JD6LHU26.js.map +0 -1
  709. package/dist/chunk-JIC6RLUB.js +0 -27
  710. package/dist/chunk-JNJIZCTN.js +0 -172
  711. package/dist/chunk-JNV5ZPUV.js +0 -828
  712. package/dist/chunk-JPQFVR24.js +0 -50
  713. package/dist/chunk-JPZVMXDP.js +0 -1333
  714. package/dist/chunk-JVPF34MX.js +0 -215
  715. package/dist/chunk-KED67KAF.js +0 -85
  716. package/dist/chunk-KJ72GMZ2.js +0 -378
  717. package/dist/chunk-KVPQUADA.js +0 -5915
  718. package/dist/chunk-KVPQUADA.js.map +0 -1
  719. package/dist/chunk-KXBLLFOO.js +0 -249
  720. package/dist/chunk-LIOZ2MXJ.js +0 -380
  721. package/dist/chunk-LPEFULJY.js +0 -73
  722. package/dist/chunk-LRMGPO7E.js +0 -98
  723. package/dist/chunk-LVKTKORH.js +0 -121
  724. package/dist/chunk-MFVUNNFN.js +0 -205
  725. package/dist/chunk-MIUJ3EH5.js +0 -60
  726. package/dist/chunk-MIUMNTIJ.js +0 -175
  727. package/dist/chunk-ML46TXRM.js +0 -113
  728. package/dist/chunk-MQRHTOQ2.js +0 -218
  729. package/dist/chunk-NIPON7YB.js +0 -850
  730. package/dist/chunk-NPBEUU22.js +0 -196
  731. package/dist/chunk-NSXKGS2K.js +0 -178
  732. package/dist/chunk-NUEFORM6.js +0 -2317
  733. package/dist/chunk-NZOFNQNC.js +0 -176
  734. package/dist/chunk-OATXCLTY.js +0 -211
  735. package/dist/chunk-OG3ELROW.js +0 -538
  736. package/dist/chunk-OI4WS7FW.js +0 -162
  737. package/dist/chunk-OITGZUDC.js +0 -82
  738. package/dist/chunk-OKD2LBMK.js +0 -333
  739. package/dist/chunk-OSA4CGST.js +0 -134
  740. package/dist/chunk-OXYAKUFU.js +0 -401
  741. package/dist/chunk-OYMSMU5O.js +0 -396
  742. package/dist/chunk-P4NZ72KY.js +0 -162
  743. package/dist/chunk-PBYL2VIM.js +0 -379
  744. package/dist/chunk-PDW3OOSZ.js +0 -505
  745. package/dist/chunk-PGRKTQIW.js +0 -523
  746. package/dist/chunk-Q273Q33U.js +0 -166
  747. package/dist/chunk-Q4CLS2HL.js +0 -340
  748. package/dist/chunk-QFOBUA2J.js +0 -428
  749. package/dist/chunk-QLIM4D56.js +0 -1095
  750. package/dist/chunk-QMQF5U2D.js +0 -20
  751. package/dist/chunk-QPOUPVPD.js +0 -144
  752. package/dist/chunk-QTJAQ6DS.js +0 -48
  753. package/dist/chunk-QUOFP3G7.js +0 -404
  754. package/dist/chunk-QVOTPOXK.js +0 -29
  755. package/dist/chunk-QYZ5RVGM.js +0 -184
  756. package/dist/chunk-R7CVDKRN.js +0 -2580
  757. package/dist/chunk-RB7MXNZD.js +0 -639
  758. package/dist/chunk-RDZQFZOQ.js +0 -187
  759. package/dist/chunk-RIHKEGWS.js +0 -194
  760. package/dist/chunk-RIHKEGWS.js.map +0 -1
  761. package/dist/chunk-ROSB7GF6.js +0 -57
  762. package/dist/chunk-RP3YMYCX.js +0 -723
  763. package/dist/chunk-RPHXJHNX.js +0 -271
  764. package/dist/chunk-RVC3M66H.js +0 -191
  765. package/dist/chunk-S3OTJAAC.js +0 -283
  766. package/dist/chunk-SBWPMVRN.js +0 -56
  767. package/dist/chunk-SERECSAR.js +0 -138
  768. package/dist/chunk-SHSEF3GJ.js +0 -187
  769. package/dist/chunk-SMS2M3RG.js +0 -772
  770. package/dist/chunk-SRDHDIRQ.js +0 -177
  771. package/dist/chunk-SXRYA7NN.js +0 -389
  772. package/dist/chunk-SYA3WYG4.js +0 -1187
  773. package/dist/chunk-T2QDSTBH.js +0 -371
  774. package/dist/chunk-TFSCGFYV.js +0 -251
  775. package/dist/chunk-TGCKZOSX.js +0 -246
  776. package/dist/chunk-THILLYQM.js +0 -132
  777. package/dist/chunk-TI6LGUEZ.js +0 -2412
  778. package/dist/chunk-TSY6YZL2.js +0 -366
  779. package/dist/chunk-TW2RHTLH.js +0 -3321
  780. package/dist/chunk-TWA5G277.js +0 -141
  781. package/dist/chunk-TZZ2S4XI.js +0 -247
  782. package/dist/chunk-UECD27LX.js +0 -251
  783. package/dist/chunk-UFJDETKG.js +0 -108
  784. package/dist/chunk-UHBIXNRW.js +0 -100
  785. package/dist/chunk-UHCFYX4I.js +0 -570
  786. package/dist/chunk-UHTURYJO.js +0 -898
  787. package/dist/chunk-UJH63JT3.js +0 -67
  788. package/dist/chunk-UMLPIMGW.js +0 -105
  789. package/dist/chunk-UOLDS6S5.js +0 -1152
  790. package/dist/chunk-UUE3OGXI.js +0 -84
  791. package/dist/chunk-UUNJ2E57.js +0 -391
  792. package/dist/chunk-UYQVWRAH.js +0 -199
  793. package/dist/chunk-UYWWUEL4.js +0 -126
  794. package/dist/chunk-V4CQKX5H.js +0 -48
  795. package/dist/chunk-V4QM7GDQ.js +0 -3176
  796. package/dist/chunk-V5Y74WII.js +0 -91
  797. package/dist/chunk-VGGZLUQK.js +0 -129
  798. package/dist/chunk-VGX636MB.js +0 -311
  799. package/dist/chunk-VGZLFQO2.js +0 -773
  800. package/dist/chunk-VJWZATNF.js +0 -137
  801. package/dist/chunk-VMWCIC2N.js +0 -50
  802. package/dist/chunk-VPWKTIU5.js +0 -227
  803. package/dist/chunk-VXOLG6YB.js +0 -469
  804. package/dist/chunk-W2NAU5VB.js +0 -1628
  805. package/dist/chunk-WGORKMR3.js +0 -353
  806. package/dist/chunk-WMIDELSJ.js +0 -391
  807. package/dist/chunk-WSOSGL2G.js +0 -383
  808. package/dist/chunk-WXUUOM4X.js +0 -400
  809. package/dist/chunk-WZ74QHLE.js +0 -4863
  810. package/dist/chunk-WZ74QHLE.js.map +0 -1
  811. package/dist/chunk-X2OWM2ME.js +0 -1870
  812. package/dist/chunk-X2OWM2ME.js.map +0 -1
  813. package/dist/chunk-XDXKB25W.js +0 -93
  814. package/dist/chunk-XE4PHI74.js +0 -231
  815. package/dist/chunk-XLJ4SQFS.js +0 -230
  816. package/dist/chunk-XOD4FX6M.js +0 -2434
  817. package/dist/chunk-XODQ2GPF.js +0 -3110
  818. package/dist/chunk-XT54RTAM.js +0 -441
  819. package/dist/chunk-YDQHFJM2.js +0 -83
  820. package/dist/chunk-YH6O6OQ6.js +0 -1356
  821. package/dist/chunk-YIKPC2QP.js +0 -794
  822. package/dist/chunk-ZD7PKYC4.js +0 -335
  823. package/dist/chunk-ZEQYHEWP.js +0 -406
  824. package/dist/chunk-ZRVUCTSI.js +0 -265
  825. package/dist/chunk-ZSI3ITRK.js +0 -449
  826. package/dist/chunk-ZZMEQCIZ.js +0 -236
  827. package/dist/computer-viewer-ZBY3BPYW.js +0 -21
  828. package/dist/connection-step-up-JQ4OFSQN.js +0 -145
  829. package/dist/connection-step-up-JQ4OFSQN.js.map +0 -1
  830. package/dist/embedded-new-voice-ZB5XLKLU.js +0 -25
  831. package/dist/embedded-voice-MZJISDCS.js +0 -25
  832. package/dist/fleet-decision-row-LG3SYVR3.js +0 -361
  833. package/dist/latest-question-QWJTXMFA.js +0 -124
  834. package/dist/model-policy-picker-menu-5Y72PLNF.js +0 -23
  835. package/dist/payment-page-card-YPSXRHBA.js +0 -226
  836. package/dist/platform-activity-row-ZU4MEBNK.js +0 -156
  837. package/dist/queue-surface-implementation-6Q25RPH6.js +0 -932
  838. package/dist/recorder-host-JD4GWJ2Z.js +0 -80
  839. package/dist/sandbox-files-HCLEEJMU.js +0 -28
  840. package/dist/session-connect-cards-DRKEN3Z4.js +0 -27
  841. package/dist/session-realtime-IZOTTRH6.js +0 -30
  842. package/dist/timeline-annotation-markers-WWXNJOXI.js +0 -157
  843. package/dist/timeline-annotation-selection-ZKRIQFIQ.js +0 -208
  844. package/dist/timeline-annotations-dialog-4IMKTOXJ.js +0 -283
  845. /package/dist/{browser-viewer-EIEMRVFF.js.map → app/components/agents/agent-trigger-repositories.js.map} +0 -0
  846. /package/dist/{chat-interactive-block-FV37LWYZ.js.map → app/components/artifacts/app-server-status.js.map} +0 -0
  847. /package/dist/{computer-viewer-ZBY3BPYW.js.map → app/components/artifacts/ready-made-apps.js.map} +0 -0
  848. /package/dist/{embedded-new-voice-ZB5XLKLU.js.map → app/lib/ready-made-apps.js.map} +0 -0
  849. /package/dist/{embedded-voice-MZJISDCS.js.map → browser-viewer-EPGAK2W6.js.map} +0 -0
  850. /package/dist/{model-policy-picker-menu-5Y72PLNF.js.map → chat-interactive-block-65YU6TMO.js.map} +0 -0
  851. /package/dist/{chunk-CLKR4UG3.js.map → chunk-25ODMMHH.js.map} +0 -0
  852. /package/dist/{chunk-WXUUOM4X.js.map → chunk-266ZPUMH.js.map} +0 -0
  853. /package/dist/{chunk-GXOTNT5D.js.map → chunk-2A7SB7UR.js.map} +0 -0
  854. /package/dist/{chunk-UHBIXNRW.js.map → chunk-2EU4Y7A7.js.map} +0 -0
  855. /package/dist/{chunk-UHCFYX4I.js.map → chunk-2LBYEHBH.js.map} +0 -0
  856. /package/dist/{chunk-TWA5G277.js.map → chunk-2MHIIF4N.js.map} +0 -0
  857. /package/dist/{chunk-757LE32E.js.map → chunk-2SHWGDAA.js.map} +0 -0
  858. /package/dist/{chunk-VGZLFQO2.js.map → chunk-2VX42S4W.js.map} +0 -0
  859. /package/dist/{chunk-VGX636MB.js.map → chunk-2WGJQ4XK.js.map} +0 -0
  860. /package/dist/{chunk-GWAY3SO5.js.map → chunk-2XSF44TY.js.map} +0 -0
  861. /package/dist/{chunk-RB7MXNZD.js.map → chunk-33HUZMNE.js.map} +0 -0
  862. /package/dist/{chunk-63WDQV5X.js.map → chunk-36IKHM4Q.js.map} +0 -0
  863. /package/dist/{chunk-4E5QVAT4.js.map → chunk-3JVQZAXQ.js.map} +0 -0
  864. /package/dist/{chunk-4KASGJTF.js.map → chunk-3SDESU6U.js.map} +0 -0
  865. /package/dist/{chunk-BPEEVMKH.js.map → chunk-3VXZFBP6.js.map} +0 -0
  866. /package/dist/{chunk-BXMND6YU.js.map → chunk-3YKED2ZV.js.map} +0 -0
  867. /package/dist/{chunk-AIX2D6RB.js.map → chunk-3ZNOKD3S.js.map} +0 -0
  868. /package/dist/{chunk-R7CVDKRN.js.map → chunk-45SB4UK3.js.map} +0 -0
  869. /package/dist/{chunk-EILSPMVD.js.map → chunk-47BETTVA.js.map} +0 -0
  870. /package/dist/{chunk-EAXTACI4.js.map → chunk-4BTQ473O.js.map} +0 -0
  871. /package/dist/{chunk-KXBLLFOO.js.map → chunk-4JQRWJVR.js.map} +0 -0
  872. /package/dist/{chunk-AHVQGL5A.js.map → chunk-4R6WFQKZ.js.map} +0 -0
  873. /package/dist/{chunk-S3OTJAAC.js.map → chunk-4WEPVL7X.js.map} +0 -0
  874. /package/dist/{chunk-6DOIINY4.js.map → chunk-4YWHOAB4.js.map} +0 -0
  875. /package/dist/{chunk-CVC4RO7D.js.map → chunk-52XGYRVS.js.map} +0 -0
  876. /package/dist/{chunk-GNGI6XFN.js.map → chunk-5G6UHUJZ.js.map} +0 -0
  877. /package/dist/{chunk-GSW4YHZE.js.map → chunk-5HFITPHH.js.map} +0 -0
  878. /package/dist/{chunk-4UU7FN3I.js.map → chunk-5LVVN2K7.js.map} +0 -0
  879. /package/dist/{chunk-V4CQKX5H.js.map → chunk-5PVXFVIT.js.map} +0 -0
  880. /package/dist/{chunk-RDZQFZOQ.js.map → chunk-5WFGW7B7.js.map} +0 -0
  881. /package/dist/{chunk-FUXFJTXL.js.map → chunk-66M7RVM6.js.map} +0 -0
  882. /package/dist/{chunk-EMWT6GOK.js.map → chunk-6AGNZI2W.js.map} +0 -0
  883. /package/dist/{chunk-DTLXQ3ZU.js.map → chunk-6ENO634Y.js.map} +0 -0
  884. /package/dist/{chunk-7SYCHMXS.js.map → chunk-6LQ5KEMP.js.map} +0 -0
  885. /package/dist/{chunk-QFOBUA2J.js.map → chunk-6QGIWLH5.js.map} +0 -0
  886. /package/dist/{chunk-2HS3IUXE.js.map → chunk-6WEDWD4N.js.map} +0 -0
  887. /package/dist/{chunk-AB5SPXUR.js.map → chunk-6YCYPXDA.js.map} +0 -0
  888. /package/dist/{chunk-A7EBV2EB.js.map → chunk-6YTNMDFP.js.map} +0 -0
  889. /package/dist/{chunk-JPQFVR24.js.map → chunk-73O7NO3F.js.map} +0 -0
  890. /package/dist/{chunk-UECD27LX.js.map → chunk-76VXLTQF.js.map} +0 -0
  891. /package/dist/{chunk-XDXKB25W.js.map → chunk-7EJ7PSZT.js.map} +0 -0
  892. /package/dist/{chunk-JIC6RLUB.js.map → chunk-7GS2MGFU.js.map} +0 -0
  893. /package/dist/{chunk-DNAXAS5R.js.map → chunk-7MF6MFHS.js.map} +0 -0
  894. /package/dist/{chunk-63VNZRLY.js.map → chunk-7N35XBSC.js.map} +0 -0
  895. /package/dist/{chunk-3SBKYPNM.js.map → chunk-7ND2VMKV.js.map} +0 -0
  896. /package/dist/{chunk-DONBARLL.js.map → chunk-7RVJLO3N.js.map} +0 -0
  897. /package/dist/{chunk-WGORKMR3.js.map → chunk-7VAILBP6.js.map} +0 -0
  898. /package/dist/{chunk-4I4RTI4D.js.map → chunk-7VSJQWFO.js.map} +0 -0
  899. /package/dist/{chunk-ZD7PKYC4.js.map → chunk-7YKUIKGH.js.map} +0 -0
  900. /package/dist/{chunk-SERECSAR.js.map → chunk-A7DS77WC.js.map} +0 -0
  901. /package/dist/{chunk-4AH4EEHE.js.map → chunk-AEH34OOU.js.map} +0 -0
  902. /package/dist/{chunk-CPX6BHER.js.map → chunk-ANWMRO2G.js.map} +0 -0
  903. /package/dist/{chunk-TZZ2S4XI.js.map → chunk-APGUIORF.js.map} +0 -0
  904. /package/dist/{chunk-CIRCUDKF.js.map → chunk-ASCVQJB4.js.map} +0 -0
  905. /package/dist/{chunk-JPZVMXDP.js.map → chunk-AY4XH73V.js.map} +0 -0
  906. /package/dist/{chunk-XOD4FX6M.js.map → chunk-B6AH43UQ.js.map} +0 -0
  907. /package/dist/{chunk-5OVRMKP5.js.map → chunk-BGT43KDL.js.map} +0 -0
  908. /package/dist/{chunk-GZZCVF76.js.map → chunk-BHS4KW4W.js.map} +0 -0
  909. /package/dist/{chunk-F7QEO7M2.js.map → chunk-BNWO72C2.js.map} +0 -0
  910. /package/dist/{chunk-4ZRNASBF.js.map → chunk-BSPIASSQ.js.map} +0 -0
  911. /package/dist/{chunk-XLJ4SQFS.js.map → chunk-BVWJEZXG.js.map} +0 -0
  912. /package/dist/{chunk-TSY6YZL2.js.map → chunk-BZ47G3VP.js.map} +0 -0
  913. /package/dist/{chunk-62HIKJ5F.js.map → chunk-C6KI5P3H.js.map} +0 -0
  914. /package/dist/{chunk-NUEFORM6.js.map → chunk-CLERWAEA.js.map} +0 -0
  915. /package/dist/{chunk-5SOL4INY.js.map → chunk-CNRFFCAE.js.map} +0 -0
  916. /package/dist/{chunk-ZZMEQCIZ.js.map → chunk-CPC6CYVW.js.map} +0 -0
  917. /package/dist/{chunk-FMBJKMT4.js.map → chunk-D23UAPXK.js.map} +0 -0
  918. /package/dist/{chunk-QVOTPOXK.js.map → chunk-DAPZEB4R.js.map} +0 -0
  919. /package/dist/{chunk-MFVUNNFN.js.map → chunk-DEDEA3WS.js.map} +0 -0
  920. /package/dist/{chunk-RPHXJHNX.js.map → chunk-DHVA3T3K.js.map} +0 -0
  921. /package/dist/{chunk-UUNJ2E57.js.map → chunk-DJQ6TKIP.js.map} +0 -0
  922. /package/dist/{chunk-6YU3WV2P.js.map → chunk-DK2CDAMR.js.map} +0 -0
  923. /package/dist/{chunk-GMGAW3T6.js.map → chunk-DPOB6MUS.js.map} +0 -0
  924. /package/dist/{chunk-VJWZATNF.js.map → chunk-DSO7S6PZ.js.map} +0 -0
  925. /package/dist/{chunk-OKD2LBMK.js.map → chunk-DV3OECO6.js.map} +0 -0
  926. /package/dist/{chunk-SYA3WYG4.js.map → chunk-DW2IQRMB.js.map} +0 -0
  927. /package/dist/{chunk-OSA4CGST.js.map → chunk-DWLPQTDL.js.map} +0 -0
  928. /package/dist/{chunk-V4QM7GDQ.js.map → chunk-DXMKECFR.js.map} +0 -0
  929. /package/dist/{chunk-LPEFULJY.js.map → chunk-DYQRNIID.js.map} +0 -0
  930. /package/dist/{chunk-VGGZLUQK.js.map → chunk-DZLWO73N.js.map} +0 -0
  931. /package/dist/{chunk-AWK23Q32.js.map → chunk-E2GNUL64.js.map} +0 -0
  932. /package/dist/{chunk-AVSIHP7Q.js.map → chunk-E7XU2KHD.js.map} +0 -0
  933. /package/dist/{chunk-2JXKP4M6.js.map → chunk-ENYULVQW.js.map} +0 -0
  934. /package/dist/{chunk-5EJBPQI2.js.map → chunk-EWHQ3DFM.js.map} +0 -0
  935. /package/dist/{chunk-EXRQ5ATC.js.map → chunk-F3LIUDXN.js.map} +0 -0
  936. /package/dist/{chunk-D3YJAQGK.js.map → chunk-F5C7DTVR.js.map} +0 -0
  937. /package/dist/{chunk-WMIDELSJ.js.map → chunk-F5NFGBIN.js.map} +0 -0
  938. /package/dist/{chunk-DO247ITS.js.map → chunk-F6XJLGOV.js.map} +0 -0
  939. /package/dist/{chunk-G6SSSX5R.js.map → chunk-F7T2STMX.js.map} +0 -0
  940. /package/dist/{chunk-T2QDSTBH.js.map → chunk-FAEVOM6B.js.map} +0 -0
  941. /package/dist/{chunk-EFKQHCGJ.js.map → chunk-FCFAXQDM.js.map} +0 -0
  942. /package/dist/{chunk-7S2S4MXR.js.map → chunk-FEQVCQMK.js.map} +0 -0
  943. /package/dist/{chunk-OYMSMU5O.js.map → chunk-FLDF2Z44.js.map} +0 -0
  944. /package/dist/{chunk-SMS2M3RG.js.map → chunk-GADABL3P.js.map} +0 -0
  945. /package/dist/{chunk-BC7PTVXW.js.map → chunk-GFUDB3SA.js.map} +0 -0
  946. /package/dist/{chunk-JVPF34MX.js.map → chunk-GGPZPBHS.js.map} +0 -0
  947. /package/dist/{chunk-IM3WA5AL.js.map → chunk-GIEGIEMT.js.map} +0 -0
  948. /package/dist/{chunk-SHSEF3GJ.js.map → chunk-GKWFQEO3.js.map} +0 -0
  949. /package/dist/{chunk-2XGRHMRI.js.map → chunk-GMMB4NCN.js.map} +0 -0
  950. /package/dist/{chunk-2P5K7CBH.js.map → chunk-GN4FOL2G.js.map} +0 -0
  951. /package/dist/{chunk-VXOLG6YB.js.map → chunk-GQJAMANY.js.map} +0 -0
  952. /package/dist/{chunk-PBYL2VIM.js.map → chunk-H7F4ANJQ.js.map} +0 -0
  953. /package/dist/{chunk-XODQ2GPF.js.map → chunk-HEPFJ3XQ.js.map} +0 -0
  954. /package/dist/{chunk-ES5HKVQF.js.map → chunk-HLRAQITA.js.map} +0 -0
  955. /package/dist/{chunk-II376XH3.js.map → chunk-HXYSZKCC.js.map} +0 -0
  956. /package/dist/{chunk-JNV5ZPUV.js.map → chunk-I5Q6FVHP.js.map} +0 -0
  957. /package/dist/{chunk-ZRVUCTSI.js.map → chunk-I7M5BYJU.js.map} +0 -0
  958. /package/dist/{chunk-KED67KAF.js.map → chunk-IH3J7VWW.js.map} +0 -0
  959. /package/dist/{chunk-NSXKGS2K.js.map → chunk-IMMDXSZ4.js.map} +0 -0
  960. /package/dist/{chunk-UYQVWRAH.js.map → chunk-IOMZDY5D.js.map} +0 -0
  961. /package/dist/{chunk-5MP3G7ZV.js.map → chunk-IQTCUUDF.js.map} +0 -0
  962. /package/dist/{chunk-UHTURYJO.js.map → chunk-ISR6KXWT.js.map} +0 -0
  963. /package/dist/{chunk-TW2RHTLH.js.map → chunk-IWPPGXUZ.js.map} +0 -0
  964. /package/dist/{chunk-UUE3OGXI.js.map → chunk-JNPCRNPA.js.map} +0 -0
  965. /package/dist/{chunk-PDW3OOSZ.js.map → chunk-JSJGGP32.js.map} +0 -0
  966. /package/dist/{chunk-SBWPMVRN.js.map → chunk-JZZUEJYD.js.map} +0 -0
  967. /package/dist/{chunk-4D3YJNVN.js.map → chunk-K5XFZKK5.js.map} +0 -0
  968. /package/dist/{chunk-332BYSAZ.js.map → chunk-K6GRTSEA.js.map} +0 -0
  969. /package/dist/{chunk-HJLHGXWL.js.map → chunk-KA4PZU3Q.js.map} +0 -0
  970. /package/dist/{chunk-YDQHFJM2.js.map → chunk-KGZ35ESO.js.map} +0 -0
  971. /package/dist/{chunk-HT7MBHLY.js.map → chunk-KRM4PW5N.js.map} +0 -0
  972. /package/dist/{chunk-QLIM4D56.js.map → chunk-LEZGGRDQ.js.map} +0 -0
  973. /package/dist/{chunk-QPOUPVPD.js.map → chunk-LFWMFFKT.js.map} +0 -0
  974. /package/dist/{chunk-A5GX3CAE.js.map → chunk-LKSPUZPH.js.map} +0 -0
  975. /package/dist/{chunk-OXYAKUFU.js.map → chunk-LLX4S6BI.js.map} +0 -0
  976. /package/dist/{chunk-NIPON7YB.js.map → chunk-M4WEF4DZ.js.map} +0 -0
  977. /package/dist/{chunk-LVKTKORH.js.map → chunk-MATYGLUT.js.map} +0 -0
  978. /package/dist/{chunk-5Y34P32B.js.map → chunk-MDI6SH7B.js.map} +0 -0
  979. /package/dist/{chunk-JB3TSUZO.js.map → chunk-MQTYIBY6.js.map} +0 -0
  980. /package/dist/{chunk-72EOXOR7.js.map → chunk-MRKY2GL5.js.map} +0 -0
  981. /package/dist/{chunk-YIKPC2QP.js.map → chunk-MSIQ42IY.js.map} +0 -0
  982. /package/dist/{chunk-7YLQCMZP.js.map → chunk-MVGU7BET.js.map} +0 -0
  983. /package/dist/{chunk-QUOFP3G7.js.map → chunk-MWY4TBDY.js.map} +0 -0
  984. /package/dist/{chunk-BJUOKUE5.js.map → chunk-NGQCWCD6.js.map} +0 -0
  985. /package/dist/{chunk-OG3ELROW.js.map → chunk-NKXMIOYN.js.map} +0 -0
  986. /package/dist/{chunk-ER5MYLIE.js.map → chunk-NMVRFFCR.js.map} +0 -0
  987. /package/dist/{chunk-GUC6IWEY.js.map → chunk-NNTDIKJP.js.map} +0 -0
  988. /package/dist/{chunk-LRMGPO7E.js.map → chunk-NQXCPP4G.js.map} +0 -0
  989. /package/dist/{chunk-THILLYQM.js.map → chunk-NYGS6FNV.js.map} +0 -0
  990. /package/dist/{chunk-NZOFNQNC.js.map → chunk-O3LOQDTI.js.map} +0 -0
  991. /package/dist/{chunk-2COBAJC7.js.map → chunk-O5HRZ2KG.js.map} +0 -0
  992. /package/dist/{chunk-H4VMHFOX.js.map → chunk-O5PZRVQR.js.map} +0 -0
  993. /package/dist/{chunk-IX4P4OGR.js.map → chunk-O6KR5SN7.js.map} +0 -0
  994. /package/dist/{chunk-EO22NST7.js.map → chunk-OBKDRV2H.js.map} +0 -0
  995. /package/dist/{chunk-3S3PJB7J.js.map → chunk-OBKKUBGL.js.map} +0 -0
  996. /package/dist/{chunk-3L5ATO4A.js.map → chunk-OFYXDB6I.js.map} +0 -0
  997. /package/dist/{chunk-VMWCIC2N.js.map → chunk-OLMWJGSJ.js.map} +0 -0
  998. /package/dist/{chunk-4RUKLIOF.js.map → chunk-ORRACKLB.js.map} +0 -0
  999. /package/dist/{chunk-6YUHDFOZ.js.map → chunk-P426WWAB.js.map} +0 -0
  1000. /package/dist/{chunk-SRDHDIRQ.js.map → chunk-P4GOY3ZL.js.map} +0 -0
  1001. /package/dist/{chunk-IX5VHZYS.js.map → chunk-P4KVJLUC.js.map} +0 -0
  1002. /package/dist/{chunk-6XYFMHNT.js.map → chunk-P4N7ZS6W.js.map} +0 -0
  1003. /package/dist/{chunk-5G4IGG7F.js.map → chunk-P6LSLNSL.js.map} +0 -0
  1004. /package/dist/{chunk-F26YBYAZ.js.map → chunk-PAFSIDM2.js.map} +0 -0
  1005. /package/dist/{chunk-C6OM2SRG.js.map → chunk-PC2JAIAH.js.map} +0 -0
  1006. /package/dist/{chunk-43BRJBEV.js.map → chunk-PGSXT5OY.js.map} +0 -0
  1007. /package/dist/{chunk-HKNMNL7B.js.map → chunk-QDMGUTOU.js.map} +0 -0
  1008. /package/dist/{chunk-YH6O6OQ6.js.map → chunk-QEMDQKQT.js.map} +0 -0
  1009. /package/dist/{chunk-TI6LGUEZ.js.map → chunk-QK7VU5N3.js.map} +0 -0
  1010. /package/dist/{chunk-FJFGDLXB.js.map → chunk-QL4Q332Z.js.map} +0 -0
  1011. /package/dist/{chunk-5SGTRULO.js.map → chunk-QL5227KT.js.map} +0 -0
  1012. /package/dist/{chunk-3Z7VA6ET.js.map → chunk-QUFCZMHG.js.map} +0 -0
  1013. /package/dist/{chunk-VPWKTIU5.js.map → chunk-QXPKUKOV.js.map} +0 -0
  1014. /package/dist/{chunk-XT54RTAM.js.map → chunk-QZE3KD34.js.map} +0 -0
  1015. /package/dist/{chunk-Q273Q33U.js.map → chunk-RAIUIXCY.js.map} +0 -0
  1016. /package/dist/{chunk-RP3YMYCX.js.map → chunk-RDLS6IZY.js.map} +0 -0
  1017. /package/dist/{chunk-MIUMNTIJ.js.map → chunk-RKPETJDJ.js.map} +0 -0
  1018. /package/dist/{chunk-GJ4GTYOD.js.map → chunk-RMDLTRLI.js.map} +0 -0
  1019. /package/dist/{chunk-PGRKTQIW.js.map → chunk-RR6DQN4X.js.map} +0 -0
  1020. /package/dist/{chunk-MQRHTOQ2.js.map → chunk-RVPH6BB7.js.map} +0 -0
  1021. /package/dist/{chunk-B45TB4HY.js.map → chunk-RVXLSVJH.js.map} +0 -0
  1022. /package/dist/{chunk-IINQO425.js.map → chunk-RVY5EZNU.js.map} +0 -0
  1023. /package/dist/{chunk-DFQ72BLS.js.map → chunk-RWHBX4MN.js.map} +0 -0
  1024. /package/dist/{chunk-7UDLRDHK.js.map → chunk-RWHDMGFG.js.map} +0 -0
  1025. /package/dist/{chunk-FLLJ2WXW.js.map → chunk-RYB3WBMZ.js.map} +0 -0
  1026. /package/dist/{chunk-ZSI3ITRK.js.map → chunk-S7EO77EE.js.map} +0 -0
  1027. /package/dist/{chunk-I5FSUZVW.js.map → chunk-S7J4HBPP.js.map} +0 -0
  1028. /package/dist/{chunk-UFJDETKG.js.map → chunk-SA3XI7FB.js.map} +0 -0
  1029. /package/dist/{chunk-NPBEUU22.js.map → chunk-SKRTCSUL.js.map} +0 -0
  1030. /package/dist/{chunk-7TVAPQOV.js.map → chunk-SUWDILUY.js.map} +0 -0
  1031. /package/dist/{chunk-TFSCGFYV.js.map → chunk-SWTPVMR4.js.map} +0 -0
  1032. /package/dist/{chunk-RVC3M66H.js.map → chunk-T5BYEE66.js.map} +0 -0
  1033. /package/dist/{chunk-QTJAQ6DS.js.map → chunk-T652Q4R6.js.map} +0 -0
  1034. /package/dist/{chunk-GBGCMHBB.js.map → chunk-TBUOHK6R.js.map} +0 -0
  1035. /package/dist/{chunk-W2NAU5VB.js.map → chunk-TCUAGCAX.js.map} +0 -0
  1036. /package/dist/{chunk-UYWWUEL4.js.map → chunk-TLWH4E3P.js.map} +0 -0
  1037. /package/dist/{chunk-UOLDS6S5.js.map → chunk-TNHGSWG3.js.map} +0 -0
  1038. /package/dist/{chunk-WSOSGL2G.js.map → chunk-TO6VBJI3.js.map} +0 -0
  1039. /package/dist/{chunk-OI4WS7FW.js.map → chunk-TOL7MOAN.js.map} +0 -0
  1040. /package/dist/{chunk-AYZXE4IM.js.map → chunk-U243CBVZ.js.map} +0 -0
  1041. /package/dist/{chunk-BIUJHNVR.js.map → chunk-U2CEPRDH.js.map} +0 -0
  1042. /package/dist/{chunk-FZI4QOAV.js.map → chunk-UAZPXKPH.js.map} +0 -0
  1043. /package/dist/{chunk-EDPH7AJH.js.map → chunk-UHRGUMLJ.js.map} +0 -0
  1044. /package/dist/{chunk-5JAYZOAW.js.map → chunk-UNDSD6UA.js.map} +0 -0
  1045. /package/dist/{chunk-FPN4I4CG.js.map → chunk-USU2SS4V.js.map} +0 -0
  1046. /package/dist/{chunk-Q4CLS2HL.js.map → chunk-USWA5GQQ.js.map} +0 -0
  1047. /package/dist/{chunk-QYZ5RVGM.js.map → chunk-UXGTI4HR.js.map} +0 -0
  1048. /package/dist/{chunk-JNJIZCTN.js.map → chunk-UZKAHEQO.js.map} +0 -0
  1049. /package/dist/{chunk-ML46TXRM.js.map → chunk-VALESBNH.js.map} +0 -0
  1050. /package/dist/{chunk-F6QP4GSK.js.map → chunk-VMSMVWCJ.js.map} +0 -0
  1051. /package/dist/{chunk-3EM5GTP3.js.map → chunk-VPERSFGV.js.map} +0 -0
  1052. /package/dist/{chunk-AZGGSPTE.js.map → chunk-VXPY2GF3.js.map} +0 -0
  1053. /package/dist/{chunk-6DQBUKGJ.js.map → chunk-W7RKXZDV.js.map} +0 -0
  1054. /package/dist/{chunk-72ND4ALI.js.map → chunk-WEGZPK4I.js.map} +0 -0
  1055. /package/dist/{chunk-LIOZ2MXJ.js.map → chunk-WPKY3BGG.js.map} +0 -0
  1056. /package/dist/{chunk-IIXNEOK4.js.map → chunk-X3T3N6W5.js.map} +0 -0
  1057. /package/dist/{chunk-HA5RFQAF.js.map → chunk-X4OGMBY6.js.map} +0 -0
  1058. /package/dist/{chunk-OITGZUDC.js.map → chunk-X7ZHIJEI.js.map} +0 -0
  1059. /package/dist/{chunk-UJH63JT3.js.map → chunk-XR7Y2HPZ.js.map} +0 -0
  1060. /package/dist/{chunk-ROSB7GF6.js.map → chunk-Y2NMKJ7F.js.map} +0 -0
  1061. /package/dist/{chunk-AI77ZKEV.js.map → chunk-Y2QYPJDN.js.map} +0 -0
  1062. /package/dist/{chunk-OATXCLTY.js.map → chunk-Y47EPVCD.js.map} +0 -0
  1063. /package/dist/{chunk-P4NZ72KY.js.map → chunk-Y5Q4ETIW.js.map} +0 -0
  1064. /package/dist/{chunk-UMLPIMGW.js.map → chunk-YMQVVFXI.js.map} +0 -0
  1065. /package/dist/{chunk-KJ72GMZ2.js.map → chunk-YQ6FP33X.js.map} +0 -0
  1066. /package/dist/{chunk-ZEQYHEWP.js.map → chunk-YUA42N5A.js.map} +0 -0
  1067. /package/dist/{chunk-V5Y74WII.js.map → chunk-YXFNW64N.js.map} +0 -0
  1068. /package/dist/{chunk-SXRYA7NN.js.map → chunk-Z76RJPZF.js.map} +0 -0
  1069. /package/dist/{chunk-MIUJ3EH5.js.map → chunk-ZD67RM6G.js.map} +0 -0
  1070. /package/dist/{chunk-XE4PHI74.js.map → chunk-ZE4RD7U5.js.map} +0 -0
  1071. /package/dist/{chunk-GLSDWNFV.js.map → chunk-ZGR7LNXC.js.map} +0 -0
  1072. /package/dist/{chunk-QMQF5U2D.js.map → chunk-ZNA65Q6Y.js.map} +0 -0
  1073. /package/dist/{chunk-46LZO4ZO.js.map → chunk-ZRNK6FK6.js.map} +0 -0
  1074. /package/dist/{chunk-2JTMFYCT.js.map → chunk-ZVAIKQMC.js.map} +0 -0
  1075. /package/dist/{chunk-TGCKZOSX.js.map → chunk-ZZ3KNGTJ.js.map} +0 -0
  1076. /package/dist/{sandbox-files-HCLEEJMU.js.map → computer-viewer-M5N3GWBR.js.map} +0 -0
  1077. /package/dist/{session-connect-cards-DRKEN3Z4.js.map → embedded-new-voice-QZJG5DZ3.js.map} +0 -0
  1078. /package/dist/{session-realtime-IZOTTRH6.js.map → embedded-voice-7KOQNGKU.js.map} +0 -0
  1079. /package/dist/{fleet-decision-row-LG3SYVR3.js.map → fleet-decision-row-FJPAWNOQ.js.map} +0 -0
  1080. /package/dist/{latest-question-QWJTXMFA.js.map → latest-question-F3VPDR7U.js.map} +0 -0
  1081. /package/dist/{payment-page-card-YPSXRHBA.js.map → payment-page-card-HZJVN3F4.js.map} +0 -0
  1082. /package/dist/{platform-activity-row-ZU4MEBNK.js.map → platform-activity-row-NPEGG2VE.js.map} +0 -0
  1083. /package/dist/{queue-surface-implementation-6Q25RPH6.js.map → queue-surface-implementation-RTCTPF5T.js.map} +0 -0
  1084. /package/dist/{recorder-host-JD4GWJ2Z.js.map → recorder-host-YPWPLMS6.js.map} +0 -0
  1085. /package/dist/{timeline-annotation-markers-WWXNJOXI.js.map → timeline-annotation-markers-7QSYK22C.js.map} +0 -0
  1086. /package/dist/{timeline-annotation-selection-ZKRIQFIQ.js.map → timeline-annotation-selection-XYNMESWL.js.map} +0 -0
  1087. /package/dist/{timeline-annotations-dialog-4IMKTOXJ.js.map → timeline-annotations-dialog-WSI6L2CP.js.map} +0 -0
@@ -1,3690 +0,0 @@
1
- "use client";
2
- import {
3
- Tooltip,
4
- TooltipContent,
5
- TooltipProvider,
6
- TooltipTrigger
7
- } from "./chunk-SS4QT7SL.js";
8
- import {
9
- useLatestTaskRunner
10
- } from "./chunk-2DDJ6YH6.js";
11
- import {
12
- ArtifactSubmissionProvider,
13
- ArtifactSurface,
14
- EditableArtifactDownloadButton,
15
- EditableArtifactMessage,
16
- artifactSubmissionSessionKey,
17
- asEditableArtifactError,
18
- editableArtifactAccessRevoked,
19
- editableArtifactProjectionKey,
20
- editableArtifactStatusLabel,
21
- useArtifactSubmissions,
22
- useEditableArtifactView
23
- } from "./chunk-OKD2LBMK.js";
24
- import {
25
- ConfirmDialog
26
- } from "./chunk-AB5SPXUR.js";
27
- import {
28
- cn
29
- } from "./chunk-TXS65BB2.js";
30
- import {
31
- useOpenGeniText
32
- } from "./chunk-KVPQUADA.js";
33
-
34
- // src/components/artifacts/presentation-editor.tsx
35
- import {
36
- ChevronLeftIcon,
37
- ChevronRightIcon,
38
- ExpandIcon,
39
- FilePlus2Icon,
40
- MinusIcon,
41
- PlusIcon,
42
- Trash2Icon,
43
- TypeIcon
44
- } from "lucide-react";
45
- import {
46
- useCallback,
47
- useEffect,
48
- useId,
49
- useLayoutEffect,
50
- useMemo,
51
- useRef,
52
- useState
53
- } from "react";
54
- import { jsx, jsxs } from "react/jsx-runtime";
55
- var MIN_ZOOM = 0.2;
56
- var MAX_ZOOM = 4;
57
- var RAIL_ITEM_HEIGHT = 116;
58
- var RAIL_OVERSCAN = 3;
59
- var DEFAULT_RAIL_HEIGHT = 640;
60
- var MOBILE_RAIL_ITEM_HEIGHT = 44;
61
- var MOBILE_RAIL_OVERSCAN = 3;
62
- var DEFAULT_MOBILE_LIST_HEIGHT = 264;
63
- var DEFAULT_VIEWPORT = { width: 960, height: 640 };
64
- var SPATIAL_TILE = 256;
65
- var MAX_SPATIAL_BUCKETS_PER_OBJECT = 1024;
66
- var CANVAS_OVERSCAN_PX = 96;
67
- var MAX_CANVAS_EDGE = 8192;
68
- var MAX_CANVAS_PIXELS = 16e6;
69
- var MAX_EDITOR_GEOMETRY = 1e6;
70
- var MAX_TABLE_CELLS_PER_PAINT = 2e4;
71
- var MAX_PROJECTION_SLIDES = 1e5;
72
- var MAX_PROJECTION_ELEMENTS_PER_SLIDE = 1e5;
73
- var MAX_PROJECTION_GROUP_DEPTH = 16;
74
- var MAX_PROJECTION_TABLE_CELLS = 1e6;
75
- var MAX_PROJECTION_TEXT = 1e6;
76
- function PresentationEditor(props) {
77
- return /* @__PURE__ */ jsx(PresentationEditorCore, { ...props });
78
- }
79
- function PresentationProjectionEditor({
80
- projection,
81
- commit,
82
- onCommandError,
83
- onSlideChange,
84
- onSelectionChange,
85
- readOnly = false,
86
- ...props
87
- }) {
88
- const view = useMemo(() => presentationViewFromProjection(projection), [projection]);
89
- return /* @__PURE__ */ jsx(
90
- PresentationEditorCore,
91
- {
92
- ...props,
93
- presentation: view.presentation,
94
- revision: projection.revision,
95
- readOnly: readOnly || !commit,
96
- onCommit: commit ? (command) => commit({ ...command, revision: projection.revision }) : void 0,
97
- onCommandError,
98
- onSlideChange: (slide, index) => {
99
- const projected = view.slideById.get(slide.id);
100
- if (projected) onSlideChange?.(projected, index);
101
- },
102
- onSelectionChange: (object, slide) => {
103
- const projectedSlide = view.slideById.get(slide.id);
104
- if (!projectedSlide) return;
105
- onSelectionChange?.(
106
- object ? view.elementById.get(object.id) ?? null : null,
107
- projectedSlide
108
- );
109
- }
110
- }
111
- );
112
- }
113
- function nextSlideIndexFromKey(key, activeIndex, length) {
114
- if (length === 0) return null;
115
- if (key === "ArrowDown") return Math.min(length - 1, activeIndex + 1);
116
- if (key === "ArrowUp") return Math.max(0, activeIndex - 1);
117
- if (key === "Home") return 0;
118
- if (key === "End") return length - 1;
119
- return null;
120
- }
121
- function PresentationEditorCore({
122
- presentation,
123
- revision,
124
- activeSlideId: controlledSlideId,
125
- defaultActiveSlideId,
126
- selectedObjectId: controlledSelectionId,
127
- defaultSelectedObjectId = null,
128
- zoom: controlledZoom,
129
- defaultZoom = 0.75,
130
- readOnly = false,
131
- authoringBlockedReason,
132
- className,
133
- onSlideChange,
134
- onSelectionChange,
135
- onCommit,
136
- onCommandError,
137
- onZoomChange
138
- }) {
139
- const t = useOpenGeniText();
140
- const mutationsBlocked = readOnly || authoringBlockedReason !== void 0;
141
- const authoringStatus = readOnly ? null : authoringBlockedReason === "pending_conflict" ? t("artifacts.presentationEditor.anEarlierChangeNeedsAttention") : authoringBlockedReason === "prior_writer" ? t("artifacts.presentationEditor.savingEarlierChanges") : null;
142
- const slides = presentation.slides.items;
143
- const firstSlideId = slides[0]?.id ?? null;
144
- const [localSlideId, setLocalSlideId] = useState(
145
- defaultActiveSlideId ?? controlledSlideId ?? firstSlideId
146
- );
147
- const requestedSlideId = controlledSlideId ?? localSlideId;
148
- const activeSlide = slides.find((slide) => slide.id === requestedSlideId) ?? slides[0] ?? null;
149
- const activeIndex = activeSlide ? slides.indexOf(activeSlide) : -1;
150
- const [localSelectionId, setLocalSelectionId] = useState(defaultSelectedObjectId);
151
- const selectedId = controlledSelectionId === void 0 ? localSelectionId : controlledSelectionId;
152
- const [localZoom, setLocalZoom] = useState(() => clampZoom(defaultZoom));
153
- const zoom = clampZoom(controlledZoom ?? localZoom);
154
- const [fitMode, setFitMode] = useState(false);
155
- const [viewportMeasured, setViewportMeasured] = useState(false);
156
- const [modelEpoch, setModelEpoch] = useState(0);
157
- const [pendingCommands, setPendingCommands] = useState(0);
158
- const [commandFailure, setCommandFailure] = useState(null);
159
- const [rail, setRail] = useState({
160
- scrollTop: 0,
161
- height: DEFAULT_RAIL_HEIGHT
162
- });
163
- const [mobileSelectorOpen, setMobileSelectorOpen] = useState(false);
164
- const [mobileRail, setMobileRail] = useState({
165
- scrollTop: 0,
166
- height: DEFAULT_MOBILE_LIST_HEIGHT
167
- });
168
- const [viewport, setViewport] = useState({
169
- scrollLeft: 0,
170
- scrollTop: 0,
171
- ...DEFAULT_VIEWPORT,
172
- stageLeft: 0,
173
- stageTop: 0
174
- });
175
- const [draftPosition, setDraftPosition] = useState(null);
176
- const [textEdit, setTextEdit] = useState(null);
177
- const [textDraft, setTextDraft] = useState("");
178
- const [paintEpoch, setPaintEpoch] = useState(0);
179
- const railRef = useRef(null);
180
- const mobileSelectorTriggerRef = useRef(null);
181
- const mobileSelectorPanelRef = useRef(null);
182
- const mobileRailRef = useRef(null);
183
- const viewportRef = useRef(null);
184
- const stageRef = useRef(null);
185
- const canvasRef = useRef(null);
186
- const overlayRef = useRef(null);
187
- const editorRef = useRef(null);
188
- const dragRef = useRef(null);
189
- const textEditRef = useRef(null);
190
- const imageCacheRef = useRef(/* @__PURE__ */ new Map());
191
- const mountedRef = useRef(true);
192
- const commandScopeRef = useRef(0);
193
- const commandVersionsRef = useRef(/* @__PURE__ */ new Map());
194
- const pendingSlideIdRef = useRef(null);
195
- const pendingObjectIdRef = useRef(null);
196
- const mobileRailScrollOnOpenRef = useRef(0);
197
- const domId = useId().replaceAll(":", "");
198
- const selectionProxyId = `${domId}-presentation-selection`;
199
- const instructionsId = `${domId}-presentation-instructions`;
200
- const objects = useMemo(
201
- () => activeSlide ? listSlideObjects(activeSlide) : [],
202
- // revision is a deliberate host invalidation token; modelEpoch covers local commits.
203
- // oxlint-disable-next-line react-hooks/exhaustive-deps
204
- [activeSlide, modelEpoch, revision]
205
- );
206
- const objectById = useMemo(
207
- () => new Map(objects.map((entry) => [entry.id, entry])),
208
- [objects]
209
- );
210
- const objectIndexById = useMemo(
211
- () => new Map(objects.map((entry, index) => [entry.id, index])),
212
- [objects]
213
- );
214
- const selected = selectedId ? objectById.get(selectedId) ?? null : null;
215
- const spatialIndex = useMemo(
216
- () => buildSpatialIndex(objects, presentation.slideSize),
217
- [objects, presentation.slideSize]
218
- );
219
- const effectiveSelectedPosition = selected && draftPosition?.objectId === selected.id ? draftPosition.position : selected ? copyPosition(selected.object.position) : null;
220
- useEffect(() => {
221
- const pendingSlideId = pendingSlideIdRef.current;
222
- if (pendingSlideId && controlledSlideId === void 0 && slides.some((slide) => slide.id === pendingSlideId)) {
223
- pendingSlideIdRef.current = null;
224
- setLocalSlideId(pendingSlideId);
225
- return;
226
- }
227
- if (activeSlide && requestedSlideId !== activeSlide.id && controlledSlideId === void 0 && pendingSlideId === null) {
228
- setLocalSlideId(activeSlide.id);
229
- }
230
- }, [activeSlide, controlledSlideId, requestedSlideId, slides]);
231
- useEffect(() => {
232
- if (selectedId && !objectById.has(selectedId) && controlledSelectionId === void 0) {
233
- setLocalSelectionId(null);
234
- }
235
- }, [controlledSelectionId, objectById, selectedId]);
236
- useEffect(() => {
237
- const pendingObjectId = pendingObjectIdRef.current;
238
- if (pendingObjectId && controlledSelectionId === void 0 && objectById.has(pendingObjectId)) {
239
- pendingObjectIdRef.current = null;
240
- setLocalSelectionId(pendingObjectId);
241
- }
242
- }, [controlledSelectionId, objectById]);
243
- useLayoutEffect(() => {
244
- const element = railRef.current;
245
- if (!element || typeof ResizeObserver === "undefined") return;
246
- const measure = () => setRail((current) => ({
247
- scrollTop: element.scrollTop,
248
- height: element.clientHeight || current.height
249
- }));
250
- measure();
251
- const observer = new ResizeObserver(measure);
252
- observer.observe(element);
253
- return () => observer.disconnect();
254
- }, []);
255
- useLayoutEffect(() => {
256
- if (!mobileSelectorOpen) return;
257
- const element = mobileRailRef.current;
258
- if (!element) return;
259
- element.scrollTop = mobileRailScrollOnOpenRef.current;
260
- element.focus();
261
- const measure = () => setMobileRail((current) => ({
262
- scrollTop: element.scrollTop,
263
- height: element.clientHeight || current.height
264
- }));
265
- measure();
266
- if (typeof ResizeObserver === "undefined") return;
267
- const observer = new ResizeObserver(measure);
268
- observer.observe(element);
269
- return () => observer.disconnect();
270
- }, [mobileSelectorOpen]);
271
- useEffect(() => {
272
- if (!mobileSelectorOpen) return;
273
- const onPointerDown = (event) => {
274
- const target = event.target;
275
- if (!(target instanceof Node)) return;
276
- if (mobileSelectorTriggerRef.current?.contains(target)) return;
277
- if (mobileSelectorPanelRef.current?.contains(target)) return;
278
- setMobileSelectorOpen(false);
279
- };
280
- const onKeyDown = (event) => {
281
- if (event.key !== "Escape") return;
282
- event.preventDefault();
283
- setMobileSelectorOpen(false);
284
- mobileSelectorTriggerRef.current?.focus();
285
- };
286
- document.addEventListener("pointerdown", onPointerDown);
287
- document.addEventListener("keydown", onKeyDown);
288
- return () => {
289
- document.removeEventListener("pointerdown", onPointerDown);
290
- document.removeEventListener("keydown", onKeyDown);
291
- };
292
- }, [mobileSelectorOpen]);
293
- useLayoutEffect(() => {
294
- const element = viewportRef.current;
295
- if (!element) return;
296
- const measure = () => {
297
- const stage = stageRef.current;
298
- const measuredWidth = element.clientWidth;
299
- const measuredHeight = element.clientHeight;
300
- const next = {
301
- scrollLeft: element.scrollLeft,
302
- scrollTop: element.scrollTop,
303
- width: measuredWidth || DEFAULT_VIEWPORT.width,
304
- height: measuredHeight || DEFAULT_VIEWPORT.height,
305
- stageLeft: stage?.offsetLeft ?? 0,
306
- stageTop: stage?.offsetTop ?? 0
307
- };
308
- setViewport((current) => sameViewport(current, next) ? current : next);
309
- if (measuredWidth > 0 && measuredHeight > 0) setViewportMeasured(true);
310
- };
311
- measure();
312
- if (typeof ResizeObserver === "undefined") return;
313
- const observer = new ResizeObserver(measure);
314
- observer.observe(element);
315
- if (stageRef.current) observer.observe(stageRef.current);
316
- return () => observer.disconnect();
317
- }, [activeSlide?.id, presentation.slideSize.height, presentation.slideSize.width, zoom]);
318
- useLayoutEffect(() => {
319
- const imageCache = imageCacheRef.current;
320
- return () => disposeCanvasImageCache(imageCache);
321
- }, [activeSlide]);
322
- useEffect(() => {
323
- const edit = textEditRef.current;
324
- const currentEntry = edit ? objectById.get(edit.shape.id) : null;
325
- if (edit && activeSlide?.id === edit.slideId && currentEntry?.kind === "shape" && !currentEntry.readOnly && currentEntry.object.geometry !== "line") {
326
- const rebound = {
327
- ...edit,
328
- shape: currentEntry.object
329
- };
330
- textEditRef.current = rebound;
331
- setTextEdit(rebound);
332
- } else {
333
- textEditRef.current = null;
334
- setTextEdit(null);
335
- }
336
- }, [activeSlide?.id, objectById]);
337
- useEffect(() => {
338
- dragRef.current = null;
339
- setDraftPosition(null);
340
- commandScopeRef.current += 1;
341
- commandVersionsRef.current.clear();
342
- setPendingCommands(0);
343
- setCommandFailure(null);
344
- }, [activeSlide?.id, revision]);
345
- useEffect(() => {
346
- const edit = textEditRef.current;
347
- if (edit && edit.shape.id !== selectedId) {
348
- textEditRef.current = null;
349
- setTextEdit(null);
350
- }
351
- const drag = dragRef.current;
352
- if (drag && drag.object.id !== selectedId) {
353
- dragRef.current = null;
354
- setDraftPosition(null);
355
- }
356
- }, [selectedId]);
357
- useEffect(() => {
358
- if (!readOnly) return;
359
- dragRef.current = null;
360
- setDraftPosition(null);
361
- textEditRef.current = null;
362
- setTextEdit(null);
363
- }, [readOnly]);
364
- useEffect(() => {
365
- mountedRef.current = true;
366
- return () => {
367
- mountedRef.current = false;
368
- dragRef.current = null;
369
- textEditRef.current = null;
370
- };
371
- }, []);
372
- useEffect(() => {
373
- const element = railRef.current;
374
- if (!element || activeIndex < 0) return;
375
- const top = activeIndex * RAIL_ITEM_HEIGHT;
376
- const bottom = top + RAIL_ITEM_HEIGHT;
377
- const height = element.clientHeight || rail.height;
378
- if (top >= element.scrollTop && bottom <= element.scrollTop + height) return;
379
- const nextTop = Math.max(0, top - height / 2);
380
- element.scrollTop = nextTop;
381
- setRail((current) => ({ ...current, scrollTop: nextTop }));
382
- }, [activeIndex, rail.height]);
383
- const visibleSlideRegion = useMemo(() => {
384
- const slideWidth = presentation.slideSize.width;
385
- const slideHeight = presentation.slideSize.height;
386
- const stageWidth2 = slideWidth * zoom;
387
- const stageHeight2 = slideHeight * zoom;
388
- if (stageWidth2 <= viewport.width && stageHeight2 <= viewport.height) {
389
- return { left: 0, top: 0, width: slideWidth, height: slideHeight };
390
- }
391
- const overscan = CANVAS_OVERSCAN_PX / zoom;
392
- const visibleLeft = Math.max(0, (viewport.scrollLeft - viewport.stageLeft) / zoom);
393
- const visibleTop = Math.max(0, (viewport.scrollTop - viewport.stageTop) / zoom);
394
- const left = Math.max(0, visibleLeft - overscan);
395
- const top = Math.max(0, visibleTop - overscan);
396
- return {
397
- left,
398
- top,
399
- width: Math.max(0, Math.min(slideWidth - left, viewport.width / zoom + overscan * 2)),
400
- height: Math.max(0, Math.min(slideHeight - top, viewport.height / zoom + overscan * 2))
401
- };
402
- }, [presentation.slideSize.height, presentation.slideSize.width, viewport, zoom]);
403
- const visibleObjectIndexes = useMemo(() => {
404
- if (!activeSlide) return [];
405
- if (visibleSlideRegion.left === 0 && visibleSlideRegion.top === 0 && visibleSlideRegion.width === presentation.slideSize.width && visibleSlideRegion.height === presentation.slideSize.height) {
406
- return objects.map((_, index) => index);
407
- }
408
- const visible = querySpatialIndex(spatialIndex, visibleSlideRegion);
409
- const selectedIndex = selectedId ? objectIndexById.get(selectedId) ?? -1 : -1;
410
- if (selectedIndex >= 0 && !visible.includes(selectedIndex)) visible.push(selectedIndex);
411
- const draftIndex = draftPosition ? objectIndexById.get(draftPosition.objectId) ?? -1 : -1;
412
- if (draftIndex >= 0 && !visible.includes(draftIndex)) visible.push(draftIndex);
413
- return visible.sort((a, b) => a - b);
414
- }, [
415
- activeSlide,
416
- objects,
417
- objectIndexById,
418
- presentation.slideSize,
419
- draftPosition,
420
- selectedId,
421
- spatialIndex,
422
- visibleSlideRegion
423
- ]);
424
- useLayoutEffect(() => {
425
- const canvas = canvasRef.current;
426
- if (!canvas || !activeSlide) return;
427
- paintSlideCanvas(t, {
428
- canvas,
429
- slide: activeSlide,
430
- slideSize: presentation.slideSize,
431
- zoom,
432
- objects,
433
- objectIndexes: visibleObjectIndexes,
434
- renderRegion: visibleSlideRegion,
435
- draftPosition,
436
- imageCache: imageCacheRef.current,
437
- requestRepaint: () => setPaintEpoch((value) => value + 1)
438
- });
439
- }, [
440
- activeSlide,
441
- draftPosition,
442
- objects,
443
- paintEpoch,
444
- presentation.slideSize,
445
- visibleObjectIndexes,
446
- visibleSlideRegion,
447
- zoom,
448
- t
449
- ]);
450
- const selectObject = useCallback(
451
- (entry) => {
452
- textEditRef.current = null;
453
- setTextEdit(null);
454
- setDraftPosition(null);
455
- if (controlledSelectionId === void 0) setLocalSelectionId(entry?.id ?? null);
456
- if (activeSlide) onSelectionChange?.(entry?.object ?? null, activeSlide);
457
- },
458
- [activeSlide, controlledSelectionId, onSelectionChange]
459
- );
460
- const selectSlide = useCallback(
461
- (slide, index) => {
462
- if (controlledSlideId === void 0) setLocalSlideId(slide.id);
463
- selectObject(null);
464
- onSlideChange?.(slide, index);
465
- },
466
- [controlledSlideId, onSlideChange, selectObject]
467
- );
468
- const changeZoom = useCallback(
469
- (next) => {
470
- const clamped = clampZoom(next);
471
- setFitMode(false);
472
- if (clamped === zoom) return;
473
- if (controlledZoom === void 0) setLocalZoom(clamped);
474
- onZoomChange?.(clamped);
475
- },
476
- [controlledZoom, onZoomChange, zoom]
477
- );
478
- const applyFittedZoom = useCallback(() => {
479
- const next = fittedPresentationZoom(viewport, presentation.slideSize);
480
- if (next === zoom) return;
481
- if (controlledZoom === void 0) setLocalZoom(next);
482
- onZoomChange?.(next);
483
- }, [controlledZoom, onZoomChange, presentation.slideSize, viewport, zoom]);
484
- const fitSlide = useCallback(() => {
485
- setFitMode(true);
486
- applyFittedZoom();
487
- }, [applyFittedZoom]);
488
- useLayoutEffect(() => {
489
- if (!viewportMeasured || controlledZoom !== void 0) return;
490
- const fitted = fittedPresentationZoom(viewport, presentation.slideSize);
491
- if (!fitMode && zoom <= fitted) return;
492
- if (!fitMode) setFitMode(true);
493
- applyFittedZoom();
494
- }, [
495
- applyFittedZoom,
496
- controlledZoom,
497
- fitMode,
498
- presentation.slideSize,
499
- viewport,
500
- viewportMeasured,
501
- zoom
502
- ]);
503
- const runCommit = useCallback(
504
- (key, command, rollback, retry) => {
505
- if (mutationsBlocked || !onCommit) return;
506
- const version = (commandVersionsRef.current.get(key) ?? 0) + 1;
507
- commandVersionsRef.current.set(key, version);
508
- const scope = commandScopeRef.current;
509
- setCommandFailure(null);
510
- let result;
511
- try {
512
- result = onCommit(command);
513
- } catch (cause) {
514
- if (!mountedRef.current || commandScopeRef.current !== scope || commandVersionsRef.current.get(key) !== version) {
515
- return;
516
- }
517
- rollback();
518
- const error = asPresentationError(cause);
519
- setCommandFailure({ message: error.message, retry });
520
- onCommandError?.(error);
521
- return;
522
- }
523
- if (!result || typeof result.then !== "function") return;
524
- setPendingCommands((current) => current + 1);
525
- void Promise.resolve(result).then(
526
- () => {
527
- if (!mountedRef.current || commandScopeRef.current !== scope) return;
528
- setPendingCommands((current) => Math.max(0, current - 1));
529
- },
530
- (cause) => {
531
- if (!mountedRef.current || commandScopeRef.current !== scope) return;
532
- setPendingCommands((current) => Math.max(0, current - 1));
533
- if (commandVersionsRef.current.get(key) !== version) return;
534
- rollback();
535
- const error = asPresentationError(cause);
536
- setCommandFailure({ message: error.message, retry });
537
- onCommandError?.(error);
538
- }
539
- );
540
- },
541
- [mutationsBlocked, onCommandError, onCommit]
542
- );
543
- const commitPosition = useCallback(
544
- (entry, kind, next) => {
545
- if (!activeSlide || mutationsBlocked || entry.readOnly) return;
546
- const before = copyPosition(entry.object.position);
547
- const after = normalizeEditorPosition(next);
548
- if (samePosition(before, after)) return;
549
- entry.object.position = after;
550
- setModelEpoch((value) => value + 1);
551
- const command = {
552
- kind,
553
- slideId: activeSlide.id,
554
- objectId: entry.id,
555
- before,
556
- after
557
- };
558
- const submit = () => runCommit(
559
- `position:${activeSlide.id}:${entry.id}`,
560
- command,
561
- () => {
562
- entry.object.position = before;
563
- setModelEpoch((value) => value + 1);
564
- },
565
- () => {
566
- entry.object.position = after;
567
- setModelEpoch((value) => value + 1);
568
- submit();
569
- }
570
- );
571
- submit();
572
- },
573
- [activeSlide, mutationsBlocked, runCommit]
574
- );
575
- const insertSlide = useCallback(() => {
576
- if (mutationsBlocked) return;
577
- const slideId = randomPresentationId();
578
- const index = activeIndex < 0 ? slides.length : activeIndex + 1;
579
- const command = { kind: "slide-insert", slideId, index };
580
- const submit = () => {
581
- pendingSlideIdRef.current = slideId;
582
- runCommit(
583
- `slide-insert:${slideId}`,
584
- command,
585
- () => {
586
- if (pendingSlideIdRef.current === slideId) pendingSlideIdRef.current = null;
587
- },
588
- submit
589
- );
590
- };
591
- submit();
592
- }, [activeIndex, mutationsBlocked, runCommit, slides.length]);
593
- const deleteSlide = useCallback(
594
- (slideId) => {
595
- const index = slides.findIndex((slide) => slide.id === slideId);
596
- if (mutationsBlocked || index < 0) return;
597
- const command = { kind: "slide-delete", slideId, index };
598
- const submit = () => runCommit(`slide-delete:${slideId}`, command, () => void 0, submit);
599
- submit();
600
- },
601
- [mutationsBlocked, runCommit, slides]
602
- );
603
- const insertTextBox = useCallback(() => {
604
- if (mutationsBlocked || !activeSlide) return;
605
- const objectId = randomPresentationId();
606
- const position = nextTextBoxPosition(objects, presentation.slideSize);
607
- const command = {
608
- kind: "object-insert",
609
- slideId: activeSlide.id,
610
- objectId,
611
- index: activeSlide.elements.length,
612
- position
613
- };
614
- const submit = () => {
615
- pendingObjectIdRef.current = objectId;
616
- runCommit(
617
- `object-insert:${activeSlide.id}:${objectId}`,
618
- command,
619
- () => {
620
- if (pendingObjectIdRef.current === objectId) pendingObjectIdRef.current = null;
621
- },
622
- submit
623
- );
624
- };
625
- submit();
626
- }, [activeSlide, objects, presentation.slideSize, mutationsBlocked, runCommit]);
627
- const deleteObject = useCallback(
628
- (slideId, objectId) => {
629
- const entry = activeSlide?.id === slideId ? objectById.get(objectId) : void 0;
630
- if (mutationsBlocked || !entry || entry.readOnly) return;
631
- const command = { kind: "object-delete", slideId, objectId };
632
- const submit = () => runCommit(`object-delete:${slideId}:${objectId}`, command, () => void 0, submit);
633
- submit();
634
- },
635
- [activeSlide, mutationsBlocked, objectById, runCommit]
636
- );
637
- const deleteTriggerRef = useRef(null);
638
- const addSlideRef = useRef(null);
639
- const [confirmingDelete, setConfirmingDelete] = useState(null);
640
- const deleteTarget = selected && !selected.readOnly && activeSlide ? {
641
- kind: "object",
642
- slideId: activeSlide.id,
643
- objectId: selected.id,
644
- name: objectLabel(t, selected)
645
- } : activeSlide ? { kind: "slide", slideId: activeSlide.id, index: activeIndex } : null;
646
- const deleteEnabled = !mutationsBlocked && deleteTarget !== null;
647
- const deleteKind = deleteTarget?.kind ?? "slide";
648
- const deleteLabel = deleteKind === "object" ? t("artifacts.presentationEditor.deleteObject") : t("artifacts.presentationEditor.deleteSlide");
649
- const confirmingTargetExists = confirmingDelete === null ? false : confirmingDelete.kind === "slide" ? slides.some((slide) => slide.id === confirmingDelete.slideId) : activeSlide?.id === confirmingDelete.slideId && objectById.has(confirmingDelete.objectId);
650
- useEffect(() => {
651
- if (confirmingDelete !== null && (mutationsBlocked || !confirmingTargetExists)) {
652
- setConfirmingDelete(null);
653
- }
654
- }, [confirmingDelete, confirmingTargetExists, mutationsBlocked]);
655
- const confirmDelete = useCallback(() => {
656
- if (confirmingDelete?.kind === "object") {
657
- deleteObject(confirmingDelete.slideId, confirmingDelete.objectId);
658
- } else if (confirmingDelete?.kind === "slide") {
659
- deleteSlide(confirmingDelete.slideId);
660
- }
661
- }, [confirmingDelete, deleteObject, deleteSlide]);
662
- const startTextEdit = useCallback(
663
- (entry) => {
664
- if (mutationsBlocked || !entry || entry.readOnly || entry.kind !== "shape") return;
665
- const shape = entry.object;
666
- if (shape.geometry === "line") return;
667
- const before = shape.text.toString();
668
- if (!activeSlide) return;
669
- const edit = { slideId: activeSlide.id, shape, before };
670
- textEditRef.current = edit;
671
- setTextEdit(edit);
672
- setTextDraft(before);
673
- },
674
- [activeSlide, mutationsBlocked]
675
- );
676
- useEffect(() => {
677
- if (!textEdit) return;
678
- editorRef.current?.focus();
679
- editorRef.current?.select();
680
- }, [textEdit]);
681
- const finishTextEdit = useCallback(
682
- (cancel = false) => {
683
- const edit = textEditRef.current;
684
- if (!edit || !cancel && authoringBlockedReason !== void 0) return;
685
- textEditRef.current = null;
686
- setTextEdit(null);
687
- const { shape, before, slideId } = edit;
688
- if (!activeSlide || activeSlide.id !== slideId) return;
689
- if (cancel || mutationsBlocked || before === textDraft) return;
690
- shape.text.set(textDraft);
691
- setModelEpoch((value) => value + 1);
692
- const command = {
693
- kind: "text",
694
- slideId,
695
- objectId: shape.id,
696
- before,
697
- after: textDraft
698
- };
699
- const submit = () => runCommit(
700
- `text:${slideId}:${shape.id}`,
701
- command,
702
- () => {
703
- shape.text.set(before);
704
- setModelEpoch((value) => value + 1);
705
- },
706
- () => {
707
- shape.text.set(textDraft);
708
- setModelEpoch((value) => value + 1);
709
- submit();
710
- }
711
- );
712
- submit();
713
- },
714
- [activeSlide, authoringBlockedReason, mutationsBlocked, runCommit, textDraft]
715
- );
716
- const cycleObject = useCallback(
717
- (direction) => {
718
- if (objects.length === 0) return;
719
- const current = selected ? objects.indexOf(selected) : direction === 1 ? -1 : 0;
720
- const next = (current + direction + objects.length) % objects.length;
721
- selectObject(objects[next] ?? null);
722
- },
723
- [objects, selectObject, selected]
724
- );
725
- const changeSlideBy = useCallback(
726
- (amount) => {
727
- if (activeIndex < 0) return;
728
- const nextIndex = Math.max(0, Math.min(slides.length - 1, activeIndex + amount));
729
- const next = slides[nextIndex];
730
- if (next && next !== activeSlide) selectSlide(next, nextIndex);
731
- },
732
- [activeIndex, activeSlide, selectSlide, slides]
733
- );
734
- const toggleMobileSlideSelector = useCallback(() => {
735
- setMobileSelectorOpen((open) => {
736
- if (open) return false;
737
- const index = Math.max(0, activeIndex);
738
- const height = DEFAULT_MOBILE_LIST_HEIGHT;
739
- const maxScroll = Math.max(0, slides.length * MOBILE_RAIL_ITEM_HEIGHT - height);
740
- const scrollTop = Math.max(
741
- 0,
742
- Math.min(
743
- maxScroll,
744
- index * MOBILE_RAIL_ITEM_HEIGHT - height / 2 + MOBILE_RAIL_ITEM_HEIGHT / 2
745
- )
746
- );
747
- mobileRailScrollOnOpenRef.current = scrollTop;
748
- setMobileRail({ scrollTop, height });
749
- return true;
750
- });
751
- }, [activeIndex, slides.length]);
752
- const chooseMobileSlide = useCallback(
753
- (slide, index) => {
754
- if (slide !== activeSlide) selectSlide(slide, index);
755
- setMobileSelectorOpen(false);
756
- mobileSelectorTriggerRef.current?.focus();
757
- },
758
- [activeSlide, selectSlide]
759
- );
760
- const handleCanvasKeyDown = useCallback(
761
- (event) => {
762
- if (event.metaKey || event.ctrlKey) {
763
- if (event.key === "+" || event.key === "=") {
764
- event.preventDefault();
765
- changeZoom(zoom * 1.15);
766
- } else if (event.key === "-") {
767
- event.preventDefault();
768
- changeZoom(zoom / 1.15);
769
- } else if (event.key === "0") {
770
- event.preventDefault();
771
- fitSlide();
772
- }
773
- return;
774
- }
775
- if (event.key === "]") {
776
- event.preventDefault();
777
- cycleObject(1);
778
- return;
779
- }
780
- if (event.key === "[") {
781
- event.preventDefault();
782
- cycleObject(-1);
783
- return;
784
- }
785
- if (event.key === "PageDown") {
786
- event.preventDefault();
787
- changeSlideBy(1);
788
- return;
789
- }
790
- if (event.key === "PageUp") {
791
- event.preventDefault();
792
- changeSlideBy(-1);
793
- return;
794
- }
795
- if (event.key === "Escape") {
796
- event.preventDefault();
797
- selectObject(null);
798
- return;
799
- }
800
- if (event.key === "Enter" || event.key === "F2") {
801
- if (selected?.kind === "shape") {
802
- event.preventDefault();
803
- startTextEdit(selected);
804
- }
805
- return;
806
- }
807
- if (!selected || !event.key.startsWith("Arrow")) return;
808
- event.preventDefault();
809
- if (mutationsBlocked || selected.readOnly) return;
810
- const amount = event.shiftKey ? 10 : 1;
811
- const dx = event.key === "ArrowLeft" ? -amount : event.key === "ArrowRight" ? amount : 0;
812
- const dy = event.key === "ArrowUp" ? -amount : event.key === "ArrowDown" ? amount : 0;
813
- const before = selected.object.position;
814
- commitPosition(
815
- selected,
816
- event.altKey ? "resize" : "move",
817
- event.altKey ? {
818
- ...before,
819
- width: Math.max(8, before.width + dx),
820
- height: Math.max(8, before.height + dy)
821
- } : { ...before, left: before.left + dx, top: before.top + dy }
822
- );
823
- },
824
- [
825
- changeSlideBy,
826
- changeZoom,
827
- commitPosition,
828
- cycleObject,
829
- fitSlide,
830
- mutationsBlocked,
831
- selectObject,
832
- selected,
833
- startTextEdit,
834
- zoom
835
- ]
836
- );
837
- const pointFromPointer = useCallback(
838
- (event) => {
839
- const rect = overlayRef.current?.getBoundingClientRect() ?? event.currentTarget.getBoundingClientRect();
840
- const width = rect.width || presentation.slideSize.width * zoom;
841
- const height = rect.height || presentation.slideSize.height * zoom;
842
- return {
843
- x: (event.clientX - rect.left) / Math.max(1, width) * presentation.slideSize.width,
844
- y: (event.clientY - rect.top) / Math.max(1, height) * presentation.slideSize.height
845
- };
846
- },
847
- [presentation.slideSize.height, presentation.slideSize.width, zoom]
848
- );
849
- const beginDrag = useCallback(
850
- (event, entry, mode) => {
851
- event.preventDefault();
852
- event.stopPropagation();
853
- selectObject(entry);
854
- if (mutationsBlocked || entry.readOnly) return;
855
- const start = pointFromPointer(event);
856
- const before = copyPosition(entry.object.position);
857
- dragRef.current = {
858
- pointerId: event.pointerId,
859
- mode,
860
- object: entry.object,
861
- rotation: objectRotation(entry),
862
- start,
863
- before
864
- };
865
- setDraftPosition({ objectId: entry.id, position: before });
866
- overlayRef.current?.setPointerCapture?.(event.pointerId);
867
- },
868
- [pointFromPointer, mutationsBlocked, selectObject]
869
- );
870
- const handlePointerDown = useCallback(
871
- (event) => {
872
- if (event.button !== 0) return;
873
- const point = pointFromPointer(event);
874
- const hit = hitTest(spatialIndex, point.x, point.y);
875
- if (!hit) {
876
- selectObject(null);
877
- return;
878
- }
879
- beginDrag(event, hit, "move");
880
- },
881
- [beginDrag, pointFromPointer, selectObject, spatialIndex]
882
- );
883
- const handlePointerMove = useCallback(
884
- (event) => {
885
- const drag = dragRef.current;
886
- if (!drag || drag.pointerId !== event.pointerId || mutationsBlocked) return;
887
- const point = pointFromPointer(event);
888
- setDraftPosition({ objectId: drag.object.id, position: positionFromDrag(drag, point) });
889
- },
890
- [mutationsBlocked, pointFromPointer]
891
- );
892
- const finishDrag = useCallback(
893
- (event, cancel = false) => {
894
- const drag = dragRef.current;
895
- if (!drag || drag.pointerId !== event.pointerId || !cancel && authoringBlockedReason !== void 0)
896
- return;
897
- dragRef.current = null;
898
- const captureTarget = overlayRef.current;
899
- if (captureTarget?.hasPointerCapture?.(event.pointerId)) {
900
- captureTarget.releasePointerCapture(event.pointerId);
901
- }
902
- setDraftPosition(null);
903
- if (cancel) return;
904
- const entry = objectById.get(drag.object.id);
905
- if (!entry) return;
906
- const point = pointFromPointer(event);
907
- commitPosition(entry, drag.mode, positionFromDrag(drag, point));
908
- },
909
- [authoringBlockedReason, commitPosition, objectById, pointFromPointer]
910
- );
911
- const handleLostPointerCapture = useCallback(
912
- (event) => {
913
- const drag = dragRef.current;
914
- if (!drag || drag.pointerId !== event.pointerId || authoringBlockedReason !== void 0)
915
- return;
916
- dragRef.current = null;
917
- setDraftPosition(null);
918
- },
919
- [authoringBlockedReason]
920
- );
921
- const railStart = Math.max(0, Math.floor(rail.scrollTop / RAIL_ITEM_HEIGHT) - RAIL_OVERSCAN);
922
- const railEnd = Math.min(
923
- slides.length,
924
- Math.ceil((rail.scrollTop + rail.height) / RAIL_ITEM_HEIGHT) + RAIL_OVERSCAN
925
- );
926
- const mobileRailStart = Math.max(
927
- 0,
928
- Math.floor(mobileRail.scrollTop / MOBILE_RAIL_ITEM_HEIGHT) - MOBILE_RAIL_OVERSCAN
929
- );
930
- const mobileRailEnd = Math.min(
931
- slides.length,
932
- Math.ceil((mobileRail.scrollTop + mobileRail.height) / MOBILE_RAIL_ITEM_HEIGHT) + MOBILE_RAIL_OVERSCAN
933
- );
934
- const slideCountLabel = activeIndex >= 0 ? `${activeIndex + 1} / ${slides.length}` : `0 / ${slides.length}`;
935
- const stageWidth = presentation.slideSize.width * zoom;
936
- const stageHeight = presentation.slideSize.height * zoom;
937
- return /* @__PURE__ */ jsxs(
938
- "div",
939
- {
940
- className: cn("flex size-full min-w-0 flex-col bg-og-surface-1", className),
941
- style: { minHeight: "22rem" },
942
- "data-og-presentation-editor": true,
943
- "data-og-painted-object-count": visibleObjectIndexes.length,
944
- "data-og-command-state": commandFailure || authoringBlockedReason === "pending_conflict" ? "error" : pendingCommands > 0 || authoringBlockedReason === "prior_writer" ? "pending" : "idle",
945
- "aria-busy": pendingCommands > 0 || authoringBlockedReason === "prior_writer" ? "true" : void 0,
946
- children: [
947
- /* @__PURE__ */ jsxs(
948
- "div",
949
- {
950
- role: "toolbar",
951
- "aria-label": t("artifacts.presentationEditor.presentationControls"),
952
- className: "flex h-10 shrink-0 items-center border-b border-og-border bg-og-surface-2",
953
- children: [
954
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto px-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
955
- /* @__PURE__ */ jsx(
956
- "button",
957
- {
958
- type: "button",
959
- "aria-label": t("artifacts.presentationEditor.previousSlide"),
960
- disabled: activeIndex <= 0,
961
- onClick: () => changeSlideBy(-1),
962
- className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg disabled:opacity-35 [&>svg]:size-3.5",
963
- children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
964
- }
965
- ),
966
- /* @__PURE__ */ jsx(
967
- "button",
968
- {
969
- ref: mobileSelectorTriggerRef,
970
- type: "button",
971
- "aria-label": t("artifacts.presentationEditor.chooseSlide"),
972
- "aria-haspopup": "listbox",
973
- "aria-expanded": mobileSelectorOpen,
974
- "aria-controls": mobileSelectorOpen ? `${domId}-mobile-slides` : void 0,
975
- disabled: slides.length === 0,
976
- "data-og-mobile-slide-selector": true,
977
- onClick: toggleMobileSlideSelector,
978
- className: "inline-flex min-h-11 min-w-16 shrink-0 items-center justify-center rounded-og-sm px-2 text-og-xs tabular-nums text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg disabled:opacity-35 sm:hidden",
979
- children: /* @__PURE__ */ jsx("span", { children: slideCountLabel })
980
- }
981
- ),
982
- /* @__PURE__ */ jsx("span", { className: "hidden min-w-16 shrink-0 text-center text-og-xs tabular-nums text-og-fg-muted sm:inline", children: slideCountLabel }),
983
- /* @__PURE__ */ jsx(
984
- "button",
985
- {
986
- type: "button",
987
- "aria-label": t("artifacts.presentationEditor.nextSlide"),
988
- disabled: activeIndex < 0 || activeIndex >= slides.length - 1,
989
- onClick: () => changeSlideBy(1),
990
- className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg disabled:opacity-35 [&>svg]:size-3.5",
991
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
992
- }
993
- ),
994
- /* @__PURE__ */ jsx(
995
- "button",
996
- {
997
- type: "button",
998
- ref: addSlideRef,
999
- "aria-label": t("artifacts.presentationEditor.addSlide"),
1000
- disabled: mutationsBlocked,
1001
- onClick: insertSlide,
1002
- className: "ml-0.5 grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg disabled:opacity-35 [&>svg]:size-3.5",
1003
- children: /* @__PURE__ */ jsx(FilePlus2Icon, {})
1004
- }
1005
- ),
1006
- /* @__PURE__ */ jsx("span", { className: "mx-1 h-4 w-px shrink-0 bg-og-border" }),
1007
- /* @__PURE__ */ jsx(
1008
- "button",
1009
- {
1010
- type: "button",
1011
- "aria-label": t("artifacts.presentationEditor.zoomOut"),
1012
- onClick: () => changeZoom(zoom / 1.15),
1013
- className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg [&>svg]:size-3.5",
1014
- children: /* @__PURE__ */ jsx(MinusIcon, {})
1015
- }
1016
- ),
1017
- /* @__PURE__ */ jsxs("span", { className: "min-w-11 shrink-0 text-center text-og-xs tabular-nums text-og-fg-muted", children: [
1018
- Math.round(zoom * 100),
1019
- "%"
1020
- ] }),
1021
- /* @__PURE__ */ jsx(
1022
- "button",
1023
- {
1024
- type: "button",
1025
- "aria-label": t("artifacts.presentationEditor.zoomIn"),
1026
- onClick: () => changeZoom(zoom * 1.15),
1027
- className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg [&>svg]:size-3.5",
1028
- children: /* @__PURE__ */ jsx(PlusIcon, {})
1029
- }
1030
- ),
1031
- /* @__PURE__ */ jsx(
1032
- "button",
1033
- {
1034
- type: "button",
1035
- "aria-label": t("artifacts.presentationEditor.fitSlide"),
1036
- onClick: fitSlide,
1037
- className: "ml-0.5 grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg [&>svg]:size-3.5",
1038
- children: /* @__PURE__ */ jsx(ExpandIcon, {})
1039
- }
1040
- ),
1041
- /* @__PURE__ */ jsx("span", { className: "mx-1 h-4 w-px shrink-0 bg-og-border" }),
1042
- /* @__PURE__ */ jsx(
1043
- "button",
1044
- {
1045
- type: "button",
1046
- "aria-label": t("artifacts.presentationEditor.addTextBox"),
1047
- disabled: mutationsBlocked || !activeSlide,
1048
- onClick: insertTextBox,
1049
- className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted hover:bg-og-surface-3 hover:text-og-fg disabled:opacity-35 [&>svg]:size-3.5",
1050
- children: /* @__PURE__ */ jsx(TypeIcon, {})
1051
- }
1052
- ),
1053
- /* @__PURE__ */ jsx("span", { className: "mx-1 h-4 w-px shrink-0 bg-og-border" }),
1054
- /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
1055
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
1056
- "button",
1057
- {
1058
- ref: deleteTriggerRef,
1059
- type: "button",
1060
- "data-og-presentation-delete": deleteKind,
1061
- disabled: !deleteEnabled,
1062
- onClick: () => setConfirmingDelete(deleteTarget),
1063
- className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-og-sm px-2 text-og-xs text-og-fg-muted hover:bg-og-surface-3 hover:text-og-status-failed disabled:opacity-35 [&>svg]:size-3.5",
1064
- children: [
1065
- /* @__PURE__ */ jsx(Trash2Icon, { "aria-hidden": true }),
1066
- /* @__PURE__ */ jsx("span", { children: deleteLabel })
1067
- ]
1068
- }
1069
- ) }),
1070
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: deleteKind === "object" ? t("artifacts.presentationEditor.deleteObjectHint") : t("artifacts.presentationEditor.deleteSlideHint") })
1071
- ] }) })
1072
- ] }),
1073
- /* @__PURE__ */ jsx(
1074
- "span",
1075
- {
1076
- className: "hidden max-w-44 shrink-0 truncate border-l border-og-border px-2 text-og-xs text-og-fg-subtle sm:block",
1077
- title: commandFailure ? t("artifacts.presentationEditor.changeNotSaved") : authoringStatus ? authoringStatus : pendingCommands > 0 ? t("artifacts.presentationEditor.saving") : mutationsBlocked ? t("artifacts.presentationEditor.viewOnly") : selected ? `${objectLabel(t, selected)}${selected.readOnly ? " \xB7 View only" : ""}` : t("artifacts.presentationEditor.selectAnObjectToEdit"),
1078
- children: commandFailure ? t("artifacts.presentationEditor.changeNotSaved") : authoringStatus ? authoringStatus : pendingCommands > 0 ? t("artifacts.presentationEditor.saving") : mutationsBlocked ? t("artifacts.presentationEditor.viewOnly") : selected ? `${objectLabel(t, selected)}${selected.readOnly ? " \xB7 View only" : ""}` : t("artifacts.presentationEditor.selectAnObjectToEdit")
1079
- }
1080
- )
1081
- ]
1082
- }
1083
- ),
1084
- /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", className: "sr-only", children: commandFailure?.message ?? authoringStatus ?? (pendingCommands > 0 ? t("artifacts.presentationEditor.savingPresentationChanges") : "") }),
1085
- /* @__PURE__ */ jsxs("div", { className: "relative flex min-h-0 min-w-0 flex-1", children: [
1086
- /* @__PURE__ */ jsx(
1087
- "div",
1088
- {
1089
- ref: railRef,
1090
- role: "listbox",
1091
- tabIndex: 0,
1092
- "aria-label": t("artifacts.presentationEditor.slides"),
1093
- "aria-orientation": "vertical",
1094
- "aria-activedescendant": activeSlide && activeIndex >= railStart && activeIndex < railEnd ? `${domId}-slide-${safeDomId(activeSlide.id)}` : void 0,
1095
- className: "relative hidden w-40 shrink-0 overflow-y-auto border-r border-og-border bg-og-surface-2/70 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent sm:block",
1096
- "data-og-slide-rail": true,
1097
- "data-og-window-start": railStart,
1098
- "data-og-window-end": railEnd,
1099
- onScroll: (event) => {
1100
- const scrollTop = event.currentTarget.scrollTop;
1101
- const height = event.currentTarget.clientHeight;
1102
- setRail((current) => ({
1103
- scrollTop,
1104
- height: height || current.height
1105
- }));
1106
- },
1107
- onKeyDown: (event) => {
1108
- const nextIndex = nextSlideIndexFromKey(event.key, activeIndex, slides.length);
1109
- if (nextIndex === null) return;
1110
- event.preventDefault();
1111
- const next = slides[nextIndex];
1112
- if (next && next !== activeSlide) selectSlide(next, nextIndex);
1113
- },
1114
- children: /* @__PURE__ */ jsx("div", { className: "relative w-full", style: { height: slides.length * RAIL_ITEM_HEIGHT }, children: slides.slice(railStart, railEnd).map((slide, offset) => {
1115
- const index = railStart + offset;
1116
- const active = slide === activeSlide;
1117
- return /* @__PURE__ */ jsxs(
1118
- "button",
1119
- {
1120
- id: `${domId}-slide-${safeDomId(slide.id)}`,
1121
- type: "button",
1122
- role: "option",
1123
- tabIndex: -1,
1124
- "aria-selected": active,
1125
- "aria-label": t("artifacts.presentationEditor.slideIndexValue", {
1126
- index: index + 1,
1127
- value: slide.title ? `: ${slide.title}` : ""
1128
- }),
1129
- onClick: () => selectSlide(slide, index),
1130
- className: cn(
1131
- "absolute left-0 flex w-full items-start gap-2 px-2 py-2 text-left transition-colors",
1132
- active ? "bg-og-surface-3 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-3/70"
1133
- ),
1134
- style: { top: index * RAIL_ITEM_HEIGHT, height: 116 },
1135
- "data-og-slide-index": index,
1136
- children: [
1137
- /* @__PURE__ */ jsx("span", { className: "w-5 shrink-0 pt-0.5 text-right text-og-xs tabular-nums text-og-fg-subtle", children: index + 1 }),
1138
- /* @__PURE__ */ jsx(
1139
- "span",
1140
- {
1141
- className: cn(
1142
- "block min-w-0 flex-1 overflow-hidden border bg-white shadow-og-sm",
1143
- active ? "border-og-accent" : "border-og-border"
1144
- ),
1145
- style: { aspectRatio: "16 / 9", borderRadius: 3 },
1146
- children: /* @__PURE__ */ jsx(
1147
- SlideThumbnail,
1148
- {
1149
- slide,
1150
- width: presentation.slideSize.width,
1151
- height: presentation.slideSize.height,
1152
- paintRevision: `${String(revision ?? "")}:${modelEpoch}`
1153
- }
1154
- )
1155
- }
1156
- )
1157
- ]
1158
- },
1159
- slide.id
1160
- );
1161
- }) })
1162
- }
1163
- ),
1164
- mobileSelectorOpen ? /* @__PURE__ */ jsx(
1165
- "div",
1166
- {
1167
- ref: mobileSelectorPanelRef,
1168
- className: "absolute left-2 top-2 z-40 max-w-56 overflow-hidden rounded-og-md border border-og-border bg-og-surface-1 shadow-og-md sm:hidden",
1169
- style: { width: "calc(100% - 1rem)" },
1170
- children: /* @__PURE__ */ jsx(
1171
- "div",
1172
- {
1173
- ref: mobileRailRef,
1174
- id: `${domId}-mobile-slides`,
1175
- role: "listbox",
1176
- tabIndex: 0,
1177
- "aria-label": t("artifacts.presentationEditor.slides"),
1178
- "aria-orientation": "vertical",
1179
- "aria-activedescendant": activeSlide && activeIndex >= mobileRailStart && activeIndex < mobileRailEnd ? `${domId}-mobile-slide-${safeDomId(activeSlide.id)}` : void 0,
1180
- className: "max-h-72 overflow-y-auto outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
1181
- "data-og-mobile-slide-list": true,
1182
- "data-og-window-start": mobileRailStart,
1183
- "data-og-window-end": mobileRailEnd,
1184
- onScroll: (event) => {
1185
- const scrollTop = event.currentTarget.scrollTop;
1186
- const height = event.currentTarget.clientHeight;
1187
- setMobileRail((current) => ({
1188
- scrollTop,
1189
- height: height || current.height
1190
- }));
1191
- },
1192
- onKeyDown: (event) => {
1193
- if (event.key === "Escape") {
1194
- event.preventDefault();
1195
- setMobileSelectorOpen(false);
1196
- mobileSelectorTriggerRef.current?.focus();
1197
- return;
1198
- }
1199
- const nextIndex = nextSlideIndexFromKey(event.key, activeIndex, slides.length);
1200
- if (nextIndex === null) return;
1201
- event.preventDefault();
1202
- const next = slides[nextIndex];
1203
- if (!next) return;
1204
- if (next !== activeSlide) selectSlide(next, nextIndex);
1205
- const list = event.currentTarget;
1206
- const top = nextIndex * MOBILE_RAIL_ITEM_HEIGHT;
1207
- const bottom = top + MOBILE_RAIL_ITEM_HEIGHT;
1208
- if (top < list.scrollTop) list.scrollTop = top;
1209
- else if (bottom > list.scrollTop + list.clientHeight) {
1210
- list.scrollTop = bottom - list.clientHeight;
1211
- }
1212
- },
1213
- children: /* @__PURE__ */ jsx(
1214
- "div",
1215
- {
1216
- className: "relative w-full",
1217
- style: { height: slides.length * MOBILE_RAIL_ITEM_HEIGHT },
1218
- children: slides.slice(mobileRailStart, mobileRailEnd).map((slide, offset) => {
1219
- const index = mobileRailStart + offset;
1220
- const active = slide === activeSlide;
1221
- return /* @__PURE__ */ jsxs(
1222
- "button",
1223
- {
1224
- id: `${domId}-mobile-slide-${safeDomId(slide.id)}`,
1225
- type: "button",
1226
- role: "option",
1227
- tabIndex: -1,
1228
- "aria-selected": active,
1229
- "aria-label": t("artifacts.presentationEditor.slideIndexValue", {
1230
- index: index + 1,
1231
- value: slide.title ? `: ${slide.title}` : ""
1232
- }),
1233
- onClick: () => chooseMobileSlide(slide, index),
1234
- className: cn(
1235
- "absolute left-0 flex min-h-11 w-full items-center gap-2 px-2 text-left",
1236
- active ? "bg-og-surface-3 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-3/70"
1237
- ),
1238
- style: {
1239
- top: index * MOBILE_RAIL_ITEM_HEIGHT,
1240
- height: MOBILE_RAIL_ITEM_HEIGHT
1241
- },
1242
- "data-og-mobile-slide-index": index,
1243
- children: [
1244
- /* @__PURE__ */ jsx("span", { className: "w-7 shrink-0 text-right text-og-xs tabular-nums text-og-fg-subtle", children: index + 1 }),
1245
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-og-sm", children: slide.title || t("artifacts.presentationEditor.slideIndex", { index: index + 1 }) })
1246
- ]
1247
- },
1248
- slide.id
1249
- );
1250
- })
1251
- }
1252
- )
1253
- }
1254
- )
1255
- }
1256
- ) : null,
1257
- /* @__PURE__ */ jsxs(
1258
- "div",
1259
- {
1260
- ref: viewportRef,
1261
- className: "relative min-h-0 min-w-0 flex-1 overflow-auto bg-og-surface-3/60 p-6",
1262
- onScroll: (event) => {
1263
- const element = event.currentTarget;
1264
- const width = element.clientWidth || viewport.width;
1265
- const height = element.clientHeight || viewport.height;
1266
- const next = {
1267
- scrollLeft: element.scrollLeft,
1268
- scrollTop: element.scrollTop,
1269
- width,
1270
- height,
1271
- stageLeft: stageRef.current?.offsetLeft ?? 0,
1272
- stageTop: stageRef.current?.offsetTop ?? 0
1273
- };
1274
- setViewport((current) => sameViewport(current, next) ? current : next);
1275
- if (element.clientWidth > 0 && element.clientHeight > 0) setViewportMeasured(true);
1276
- },
1277
- "data-og-presentation-viewport": true,
1278
- children: [
1279
- commandFailure ? /* @__PURE__ */ jsxs(
1280
- "div",
1281
- {
1282
- role: "alert",
1283
- className: "absolute left-2 top-2 z-30 flex w-fit items-center gap-2 rounded-og-sm border border-og-status-failed/30 bg-og-surface-1/95 px-2 py-1 text-og-xs text-og-status-failed shadow-og-sm",
1284
- style: { maxWidth: "calc(100% - 1rem)" },
1285
- children: [
1286
- /* @__PURE__ */ jsx("span", { className: "truncate", children: commandFailure.message }),
1287
- /* @__PURE__ */ jsx(
1288
- "button",
1289
- {
1290
- type: "button",
1291
- disabled: mutationsBlocked,
1292
- onClick: () => {
1293
- if (!mutationsBlocked) commandFailure.retry();
1294
- },
1295
- className: "shrink-0 rounded-og-xs px-1.5 py-0.5 font-medium outline-hidden hover:bg-og-surface-3 focus-visible:ring-2 focus-visible:ring-og-accent",
1296
- children: t("artifacts.presentationEditor.retry")
1297
- }
1298
- )
1299
- ]
1300
- }
1301
- ) : null,
1302
- activeSlide ? /* @__PURE__ */ jsxs(
1303
- "div",
1304
- {
1305
- ref: stageRef,
1306
- className: "relative mx-auto shrink-0 overflow-hidden shadow-og-lg",
1307
- style: { width: stageWidth, height: stageHeight, backgroundColor: "#fff" },
1308
- "data-og-presentation-stage": true,
1309
- "data-og-theme": "light",
1310
- children: [
1311
- /* @__PURE__ */ jsx(
1312
- "canvas",
1313
- {
1314
- ref: canvasRef,
1315
- "aria-hidden": true,
1316
- className: "absolute inset-0 size-full",
1317
- style: { width: stageWidth, height: stageHeight }
1318
- }
1319
- ),
1320
- /* @__PURE__ */ jsx(
1321
- "svg",
1322
- {
1323
- ref: overlayRef,
1324
- role: "application",
1325
- tabIndex: 0,
1326
- "aria-label": t("artifacts.presentationEditor.slideActiveindexEditor", {
1327
- activeIndex: activeIndex + 1
1328
- }),
1329
- "aria-describedby": selected ? `${instructionsId} ${selectionProxyId}` : instructionsId,
1330
- "aria-readonly": mutationsBlocked || selected?.readOnly || void 0,
1331
- viewBox: `0 0 ${presentation.slideSize.width} ${presentation.slideSize.height}`,
1332
- className: "absolute inset-0 size-full touch-none outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
1333
- onKeyDown: handleCanvasKeyDown,
1334
- onPointerDown: handlePointerDown,
1335
- onPointerMove: handlePointerMove,
1336
- onPointerUp: (event) => finishDrag(event),
1337
- onPointerCancel: (event) => finishDrag(event, true),
1338
- onLostPointerCapture: handleLostPointerCapture,
1339
- onDoubleClick: () => startTextEdit(selected),
1340
- children: selected && effectiveSelectedPosition ? /* @__PURE__ */ jsxs(
1341
- "g",
1342
- {
1343
- "data-og-presentation-object": selected.id,
1344
- transform: selectionTransform(selected, effectiveSelectedPosition),
1345
- children: [
1346
- /* @__PURE__ */ jsx(
1347
- "rect",
1348
- {
1349
- x: effectiveSelectedPosition.left,
1350
- y: effectiveSelectedPosition.top,
1351
- width: effectiveSelectedPosition.width,
1352
- height: effectiveSelectedPosition.height,
1353
- fill: "transparent",
1354
- stroke: "var(--og-color-accent-deep)",
1355
- strokeWidth: 2,
1356
- vectorEffect: "non-scaling-stroke",
1357
- pointerEvents: "none"
1358
- }
1359
- ),
1360
- !mutationsBlocked && !selected.readOnly ? /* @__PURE__ */ jsx(
1361
- "circle",
1362
- {
1363
- cx: effectiveSelectedPosition.left + effectiveSelectedPosition.width,
1364
- cy: effectiveSelectedPosition.top + effectiveSelectedPosition.height,
1365
- r: 6 / zoom,
1366
- fill: "var(--og-color-accent-deep)",
1367
- stroke: "white",
1368
- strokeWidth: 1.5,
1369
- vectorEffect: "non-scaling-stroke",
1370
- className: "cursor-nwse-resize",
1371
- onPointerDown: (event) => beginDrag(event, selected, "resize")
1372
- }
1373
- ) : null
1374
- ]
1375
- }
1376
- ) : null
1377
- }
1378
- ),
1379
- selected ? /* @__PURE__ */ jsx("span", { id: selectionProxyId, role: "status", "aria-live": "polite", className: "sr-only", children: accessibleObjectLabel(t, selected) }) : null,
1380
- /* @__PURE__ */ jsx("span", { id: instructionsId, className: "sr-only", children: t("artifacts.presentationEditor.useBracketKeysToSelect") }),
1381
- textEdit && selected?.id === textEdit.shape.id && effectiveSelectedPosition ? /* @__PURE__ */ jsx(
1382
- "textarea",
1383
- {
1384
- ref: editorRef,
1385
- "aria-label": t("artifacts.presentationEditor.editName", {
1386
- name: textEdit.shape.name
1387
- }),
1388
- value: textDraft,
1389
- readOnly: mutationsBlocked,
1390
- maxLength: 1e6,
1391
- onChange: (event) => {
1392
- if (!mutationsBlocked) setTextDraft(event.currentTarget.value);
1393
- },
1394
- onInput: (event) => {
1395
- if (!mutationsBlocked) setTextDraft(event.currentTarget.value);
1396
- },
1397
- onBlur: () => finishTextEdit(),
1398
- onKeyDown: (event) => {
1399
- if (event.key === "Escape") {
1400
- event.preventDefault();
1401
- finishTextEdit(true);
1402
- } else if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
1403
- event.preventDefault();
1404
- finishTextEdit();
1405
- }
1406
- },
1407
- className: "absolute resize-none overflow-hidden border-2 border-og-accent p-1 outline-hidden",
1408
- style: {
1409
- left: effectiveSelectedPosition.left * zoom,
1410
- top: effectiveSelectedPosition.top * zoom,
1411
- width: effectiveSelectedPosition.width * zoom,
1412
- height: effectiveSelectedPosition.height * zoom,
1413
- backgroundColor: "#fffffff2",
1414
- color: resolveColor(textEdit.shape.text.style.color ?? "slate-950"),
1415
- fontFamily: textEdit.shape.text.style.fontFamily ?? "Arial, sans-serif",
1416
- fontSize: Math.max(8, (textEdit.shape.text.style.fontSize ?? 18) * zoom),
1417
- fontWeight: textEdit.shape.text.style.bold ? 700 : 400,
1418
- fontStyle: textEdit.shape.text.style.italic ? "italic" : "normal",
1419
- textAlign: textEdit.shape.text.style.alignment ?? "left",
1420
- transform: textEdit.shape.rotation === 0 ? void 0 : `rotate(${textEdit.shape.rotation}deg)`,
1421
- transformOrigin: "center"
1422
- }
1423
- }
1424
- ) : null
1425
- ]
1426
- }
1427
- ) : /* @__PURE__ */ jsx("div", { className: "grid size-full min-h-72 place-items-center text-og-sm text-og-fg-muted", children: t("artifacts.presentationEditor.thisPresentationHasNoSlides") })
1428
- ]
1429
- }
1430
- )
1431
- ] }),
1432
- /* @__PURE__ */ jsx(
1433
- ConfirmDialog,
1434
- {
1435
- open: confirmingDelete !== null,
1436
- onOpenChange: (open) => {
1437
- if (!open) setConfirmingDelete(null);
1438
- },
1439
- title: confirmingDelete?.kind === "object" ? t("artifacts.presentationEditor.deleteObjectTitle", { name: confirmingDelete.name }) : t("artifacts.presentationEditor.deleteSlideTitle", {
1440
- index: (confirmingDelete?.index ?? activeIndex) + 1
1441
- }),
1442
- description: confirmingDelete?.kind === "object" ? t("artifacts.presentationEditor.deleteObjectDescription") : t("artifacts.presentationEditor.deleteSlideDescription"),
1443
- confirmLabel: confirmingDelete?.kind === "object" ? t("artifacts.presentationEditor.deleteObject") : t("artifacts.presentationEditor.deleteSlide"),
1444
- restoreFocusRef: deleteTriggerRef,
1445
- restoreFocusFallbackRef: addSlideRef,
1446
- onConfirm: confirmDelete
1447
- }
1448
- )
1449
- ]
1450
- }
1451
- );
1452
- }
1453
- function PresentationArtifactSurface({
1454
- presentation,
1455
- title: titleProp,
1456
- showHeader,
1457
- subtitle,
1458
- actions,
1459
- busy,
1460
- className,
1461
- ...editorProps
1462
- }) {
1463
- const t = useOpenGeniText();
1464
- const title = titleProp === void 0 ? t("artifacts.presentationEditor.presentation") : titleProp;
1465
- const count = presentation.slides.items.length;
1466
- return /* @__PURE__ */ jsx(
1467
- ArtifactSurface,
1468
- {
1469
- modality: "presentation",
1470
- title,
1471
- showHeader,
1472
- subtitle: subtitle ?? t("counts.slides", { count }),
1473
- actions,
1474
- busy,
1475
- className,
1476
- children: /* @__PURE__ */ jsx(PresentationEditor, { ...editorProps, presentation })
1477
- }
1478
- );
1479
- }
1480
- function PresentationProjectionArtifactSurface({
1481
- projection,
1482
- title: titleProp,
1483
- showHeader,
1484
- subtitle,
1485
- actions,
1486
- busy,
1487
- className,
1488
- ...editorProps
1489
- }) {
1490
- const t = useOpenGeniText();
1491
- const title = titleProp === void 0 ? t("artifacts.presentationEditor.presentation") : titleProp;
1492
- const count = projection.slides.length;
1493
- return /* @__PURE__ */ jsx(
1494
- ArtifactSurface,
1495
- {
1496
- modality: "presentation",
1497
- title,
1498
- showHeader,
1499
- subtitle: subtitle ?? t("counts.slides", { count }),
1500
- actions,
1501
- busy,
1502
- className,
1503
- children: /* @__PURE__ */ jsx(PresentationProjectionEditor, { ...editorProps, projection })
1504
- }
1505
- );
1506
- }
1507
- function SlideThumbnail({
1508
- slide,
1509
- width,
1510
- height,
1511
- paintRevision
1512
- }) {
1513
- const t = useOpenGeniText();
1514
- const canvasRef = useRef(null);
1515
- const imageCacheRef = useRef(/* @__PURE__ */ new Map());
1516
- const [paintEpoch, setPaintEpoch] = useState(0);
1517
- useLayoutEffect(() => {
1518
- const imageCache = imageCacheRef.current;
1519
- return () => disposeCanvasImageCache(imageCache);
1520
- }, []);
1521
- useLayoutEffect(() => {
1522
- const canvas = canvasRef.current;
1523
- const context = canvas?.getContext("2d");
1524
- if (!canvas || !context) return;
1525
- const displayWidth = 112;
1526
- const scale = displayWidth / width;
1527
- canvas.width = Math.max(1, Math.round(width * scale));
1528
- canvas.height = Math.max(1, Math.round(height * scale));
1529
- context.setTransform(scale, 0, 0, scale, 0, 0);
1530
- context.fillStyle = resolveColor(slide.background.fill);
1531
- context.fillRect(0, 0, width, height);
1532
- const objects = listSlideObjects(slide);
1533
- const usedImageSources = /* @__PURE__ */ new Set();
1534
- for (const entry of objects) {
1535
- drawObject(
1536
- t,
1537
- context,
1538
- entry,
1539
- entry.object.position,
1540
- imageCacheRef.current,
1541
- () => setPaintEpoch((value) => value + 1),
1542
- { left: 0, top: 0, width, height },
1543
- scale,
1544
- usedImageSources
1545
- );
1546
- }
1547
- disposeUnusedCanvasImages(imageCacheRef.current, usedImageSources);
1548
- }, [height, paintEpoch, paintRevision, slide, width, t]);
1549
- return /* @__PURE__ */ jsx("canvas", { ref: canvasRef, "aria-hidden": true, className: "block size-full" });
1550
- }
1551
- function presentationViewFromProjection(projection) {
1552
- if (projection.slides.length > MAX_PROJECTION_SLIDES) {
1553
- throw new Error(`Presentation projection exceeds ${MAX_PROJECTION_SLIDES} slides`);
1554
- }
1555
- const slideById = /* @__PURE__ */ new Map();
1556
- const elementById = /* @__PURE__ */ new Map();
1557
- const slideSize = {
1558
- width: Math.min(MAX_EDITOR_GEOMETRY, Math.max(1, finite(projection.slideSize.width, 1))),
1559
- height: Math.min(MAX_EDITOR_GEOMETRY, Math.max(1, finite(projection.slideSize.height, 1)))
1560
- };
1561
- const slides = projection.slides.map((slideProjection) => {
1562
- if (slideProjection.elements.length > MAX_PROJECTION_ELEMENTS_PER_SLIDE) {
1563
- throw new Error(
1564
- `Slide ${slideProjection.id} exceeds ${MAX_PROJECTION_ELEMENTS_PER_SLIDE} projected objects`
1565
- );
1566
- }
1567
- slideById.set(slideProjection.id, slideProjection);
1568
- const elements = slideProjection.elements.map(
1569
- (element) => presentationElementView(element, elementById, 0)
1570
- );
1571
- return {
1572
- id: slideProjection.id,
1573
- title: boundedProjectionText(slideProjection.title ?? ""),
1574
- background: { fill: cloneProjectionFill(slideProjection.background ?? "white") },
1575
- elements
1576
- };
1577
- });
1578
- return {
1579
- presentation: {
1580
- slideSize,
1581
- slides: { items: slides }
1582
- },
1583
- slideById,
1584
- elementById
1585
- };
1586
- }
1587
- function presentationElementView(element, byId, depth) {
1588
- if (depth > MAX_PROJECTION_GROUP_DEPTH) {
1589
- throw new Error(`Presentation group depth exceeds ${MAX_PROJECTION_GROUP_DEPTH}`);
1590
- }
1591
- byId.set(element.id, element);
1592
- const position = normalizeEditorPosition(element.position);
1593
- switch (element.kind) {
1594
- case "shape": {
1595
- const text = mutableProjectionText(element.text, element.textStyle);
1596
- return {
1597
- id: element.id,
1598
- name: boundedProjectionText(element.name),
1599
- __projectionReadOnly: element.readOnly ?? false,
1600
- geometry: element.geometry,
1601
- position,
1602
- fill: cloneProjectionFill(
1603
- element.fill ?? (element.geometry === "textbox" ? "none" : "white")
1604
- ),
1605
- line: cloneProjectionLine(element.line),
1606
- rotation: finite(element.rotation ?? 0, 0),
1607
- borderRadius: element.borderRadius,
1608
- text
1609
- };
1610
- }
1611
- case "chart":
1612
- return {
1613
- id: element.id,
1614
- name: boundedProjectionText(element.name),
1615
- __projectionReadOnly: element.readOnly ?? false,
1616
- type: element.type,
1617
- position,
1618
- title: boundedProjectionText(element.title ?? ""),
1619
- series: {
1620
- items: element.series.map((series) => ({
1621
- name: boundedProjectionText(series.name),
1622
- categories: (series.categories ?? []).map(boundedProjectionText),
1623
- values: series.values.map((value) => finite(value, 0)),
1624
- xValues: (series.xValues ?? []).map((value) => finite(value, 0)),
1625
- bubbleSizes: (series.bubbleSizes ?? []).map((value) => finite(value, 0)),
1626
- fill: series.fill ? cloneProjectionFill(series.fill) : void 0,
1627
- line: cloneProjectionLine(series.line)
1628
- }))
1629
- },
1630
- xAxis: element.xAxis ? { ...element.xAxis } : void 0,
1631
- yAxis: element.yAxis ? { ...element.yAxis } : void 0,
1632
- dataLabels: element.dataLabels ? { ...element.dataLabels } : void 0
1633
- };
1634
- case "image": {
1635
- const source = safeProjectionImageSource(element.source);
1636
- return {
1637
- id: element.id,
1638
- name: boundedProjectionText(element.name),
1639
- __projectionReadOnly: element.readOnly ?? false,
1640
- position,
1641
- alt: boundedProjectionText(element.alt ?? ""),
1642
- prompt: element.prompt ? boundedProjectionText(element.prompt) : void 0,
1643
- fit: element.fit ?? "contain",
1644
- crop: element.crop ? { ...element.crop } : void 0,
1645
- geometry: element.geometry ?? "rect",
1646
- borderRadius: element.borderRadius,
1647
- rotation: finite(element.rotation ?? 0, 0),
1648
- flipHorizontal: element.flipHorizontal ?? false,
1649
- flipVertical: element.flipVertical ?? false,
1650
- sourceForSvg: () => source
1651
- };
1652
- }
1653
- case "table": {
1654
- const columns = element.rows[0]?.length ?? 0;
1655
- if (columns <= 0 || element.rows.some((row) => row.length !== columns) || element.rows.length * columns > MAX_PROJECTION_TABLE_CELLS) {
1656
- throw new Error(`Table ${element.id} has an invalid or oversized projected grid`);
1657
- }
1658
- return {
1659
- id: element.id,
1660
- name: boundedProjectionText(element.name),
1661
- __projectionReadOnly: element.readOnly ?? false,
1662
- position,
1663
- rows: element.rows.map(
1664
- (row) => row.map(
1665
- (cell) => cell ? {
1666
- text: mutableProjectionText(cell.text, cell.textStyle),
1667
- fill: cloneProjectionFill(cell.fill ?? "white"),
1668
- rowSpan: boundedSpan(cell.rowSpan),
1669
- colSpan: boundedSpan(cell.colSpan)
1670
- } : null
1671
- )
1672
- ),
1673
- columnWidths: [...element.columnWidths ?? []],
1674
- rowHeights: [...element.rowHeights ?? []],
1675
- fill: cloneProjectionFill(element.fill ?? "white"),
1676
- line: cloneProjectionLine(element.line),
1677
- textStyle: { ...element.textStyle ?? {} }
1678
- };
1679
- }
1680
- case "group":
1681
- return {
1682
- id: element.id,
1683
- name: boundedProjectionText(element.name),
1684
- __projectionReadOnly: element.readOnly ?? false,
1685
- position,
1686
- childOffset: {
1687
- left: finite(element.childOffset.left, 0),
1688
- top: finite(element.childOffset.top, 0)
1689
- },
1690
- childExtent: {
1691
- width: Math.max(1, finite(element.childExtent.width, 1)),
1692
- height: Math.max(1, finite(element.childExtent.height, 1))
1693
- },
1694
- rotation: finite(element.rotation ?? 0, 0),
1695
- flipHorizontal: element.flipHorizontal ?? false,
1696
- flipVertical: element.flipVertical ?? false,
1697
- children: element.children.map((child) => presentationElementView(child, byId, depth + 1))
1698
- };
1699
- case "connector":
1700
- return {
1701
- id: element.id,
1702
- name: boundedProjectionText(element.name),
1703
- __projectionReadOnly: element.readOnly ?? false,
1704
- geometry: "line",
1705
- position,
1706
- fill: "none",
1707
- line: cloneProjectionLine(element.line),
1708
- rotation: 0,
1709
- text: mutableProjectionText("", void 0)
1710
- };
1711
- }
1712
- }
1713
- function mutableProjectionText(initial, style) {
1714
- let value = boundedProjectionText(initial);
1715
- return {
1716
- style: { ...style ?? {} },
1717
- set(next) {
1718
- value = boundedProjectionText(next);
1719
- },
1720
- toString() {
1721
- return value;
1722
- }
1723
- };
1724
- }
1725
- function cloneProjectionFill(fill) {
1726
- return typeof fill === "string" ? fill : { ...fill };
1727
- }
1728
- function cloneProjectionLine(line) {
1729
- return {
1730
- style: line?.style ?? "solid",
1731
- fill: line?.fill ? cloneProjectionFill(line.fill) : "slate-900",
1732
- width: Math.max(0, finite(line?.width ?? 1, 1))
1733
- };
1734
- }
1735
- function boundedProjectionText(value) {
1736
- return value.slice(0, MAX_PROJECTION_TEXT);
1737
- }
1738
- function boundedSpan(value) {
1739
- return Math.max(1, Math.min(1e4, Math.floor(finite(value ?? 1, 1))));
1740
- }
1741
- function safeProjectionImageSource(source) {
1742
- if (!source || source.length > 64 * 1024 * 1024) return void 0;
1743
- if (/^data:image\/(?:png|jpeg|gif|webp);base64,/i.test(source) || source.startsWith("blob:")) {
1744
- return source;
1745
- }
1746
- try {
1747
- const base = globalThis.location?.href;
1748
- if (!base) return void 0;
1749
- const url = new URL(source, base);
1750
- return url.origin === globalThis.location.origin && /^https?:$/.test(url.protocol) ? url.href : void 0;
1751
- } catch {
1752
- return void 0;
1753
- }
1754
- }
1755
- function asPresentationError(cause) {
1756
- return cause instanceof Error ? cause : new Error("Presentation change failed");
1757
- }
1758
- function listSlideObjects(slide) {
1759
- return slide.elements.map(displayObjectFromElement);
1760
- }
1761
- function displayObjectFromElement(object) {
1762
- const readOnly = object.__projectionReadOnly === true;
1763
- if ("geometry" in object && "text" in object)
1764
- return { id: object.id, kind: "shape", object, readOnly };
1765
- if ("series" in object) return { id: object.id, kind: "chart", object, readOnly };
1766
- if ("sourceForSvg" in object) return { id: object.id, kind: "image", object, readOnly };
1767
- if ("rows" in object) return { id: object.id, kind: "table", object, readOnly };
1768
- return { id: object.id, kind: "group", object, readOnly };
1769
- }
1770
- function buildSpatialIndex(objects, slideSize) {
1771
- const buckets = /* @__PURE__ */ new Map();
1772
- const overflowObjects = [];
1773
- const bounds = objects.map(objectBounds);
1774
- const maxX = Math.max(0, Math.ceil(slideSize.width / SPATIAL_TILE) - 1);
1775
- const maxY = Math.max(0, Math.ceil(slideSize.height / SPATIAL_TILE) - 1);
1776
- for (const [index, entry] of objects.entries()) {
1777
- const objectBound = bounds[index] ?? entry.object.position;
1778
- if (!intersects(objectBound, { left: 0, top: 0, ...slideSize })) continue;
1779
- const left = Math.max(0, Math.floor(objectBound.left / SPATIAL_TILE));
1780
- const top = Math.max(0, Math.floor(objectBound.top / SPATIAL_TILE));
1781
- const right = Math.min(maxX, Math.floor((objectBound.left + objectBound.width) / SPATIAL_TILE));
1782
- const bottom = Math.min(
1783
- maxY,
1784
- Math.floor((objectBound.top + objectBound.height) / SPATIAL_TILE)
1785
- );
1786
- const bucketCount = (right - left + 1) * (bottom - top + 1);
1787
- if (!Number.isSafeInteger(bucketCount) || bucketCount > MAX_SPATIAL_BUCKETS_PER_OBJECT) {
1788
- overflowObjects.push(index);
1789
- continue;
1790
- }
1791
- for (let y = top; y <= bottom; y += 1) {
1792
- for (let x = left; x <= right; x += 1) {
1793
- const key = `${x}:${y}`;
1794
- const bucket = buckets.get(key);
1795
- if (bucket) bucket.push(index);
1796
- else buckets.set(key, [index]);
1797
- }
1798
- }
1799
- }
1800
- return { objects, bounds, buckets, overflowObjects };
1801
- }
1802
- function querySpatialIndex(index, viewport) {
1803
- const seen = new Set(index.overflowObjects);
1804
- const left = Math.floor(viewport.left / SPATIAL_TILE);
1805
- const top = Math.floor(viewport.top / SPATIAL_TILE);
1806
- const right = Math.floor((viewport.left + viewport.width) / SPATIAL_TILE);
1807
- const bottom = Math.floor((viewport.top + viewport.height) / SPATIAL_TILE);
1808
- for (let y = top; y <= bottom; y += 1) {
1809
- for (let x = left; x <= right; x += 1) {
1810
- for (const objectIndex of index.buckets.get(`${x}:${y}`) ?? []) {
1811
- if (intersects(index.bounds[objectIndex], viewport)) seen.add(objectIndex);
1812
- }
1813
- }
1814
- }
1815
- return [...seen].filter((objectIndex) => {
1816
- return !!index.objects[objectIndex] && intersects(index.bounds[objectIndex], viewport);
1817
- }).sort((a, b) => a - b);
1818
- }
1819
- function paintSlideCanvas(t, options) {
1820
- const { canvas, slide, slideSize, zoom } = options;
1821
- const context = canvas.getContext("2d");
1822
- if (!context) return;
1823
- const cssWidth = slideSize.width * zoom;
1824
- const cssHeight = slideSize.height * zoom;
1825
- const ratio = Math.max(
1826
- 1e-4,
1827
- Math.min(
1828
- 2,
1829
- Math.max(1, globalThis.devicePixelRatio || 1),
1830
- MAX_CANVAS_EDGE / Math.max(1, cssWidth),
1831
- MAX_CANVAS_EDGE / Math.max(1, cssHeight),
1832
- Math.sqrt(MAX_CANVAS_PIXELS / Math.max(1, cssWidth * cssHeight))
1833
- )
1834
- );
1835
- const pixelWidth = Math.max(1, Math.round(slideSize.width * zoom * ratio));
1836
- const pixelHeight = Math.max(1, Math.round(slideSize.height * zoom * ratio));
1837
- if (canvas.width !== pixelWidth) canvas.width = pixelWidth;
1838
- if (canvas.height !== pixelHeight) canvas.height = pixelHeight;
1839
- context.setTransform(zoom * ratio, 0, 0, zoom * ratio, 0, 0);
1840
- context.clearRect(0, 0, slideSize.width, slideSize.height);
1841
- context.fillStyle = resolveColor(slide.background.fill);
1842
- context.fillRect(0, 0, slideSize.width, slideSize.height);
1843
- const usedImageSources = /* @__PURE__ */ new Set();
1844
- for (const index of options.objectIndexes) {
1845
- const entry = options.objects[index];
1846
- if (!entry) continue;
1847
- const position = entry.id === options.draftPosition?.objectId ? options.draftPosition.position : entry.object.position;
1848
- drawObject(
1849
- t,
1850
- context,
1851
- entry,
1852
- position,
1853
- options.imageCache,
1854
- options.requestRepaint,
1855
- options.renderRegion,
1856
- zoom * ratio,
1857
- usedImageSources
1858
- );
1859
- }
1860
- disposeUnusedCanvasImages(options.imageCache, usedImageSources);
1861
- }
1862
- function drawObject(t, context, entry, position, imageCache, requestRepaint, renderRegion, pixelScale, usedImageSources) {
1863
- switch (entry.kind) {
1864
- case "shape":
1865
- drawShape(t, context, entry.object, position);
1866
- return;
1867
- case "chart":
1868
- drawChart(t, context, entry.object, position);
1869
- return;
1870
- case "image": {
1871
- const source = drawImage(
1872
- t,
1873
- context,
1874
- entry.object,
1875
- position,
1876
- imageCache,
1877
- requestRepaint
1878
- );
1879
- if (source) usedImageSources.add(source);
1880
- return;
1881
- }
1882
- case "table":
1883
- drawTable(t, context, entry.object, position, renderRegion, pixelScale);
1884
- return;
1885
- case "group":
1886
- drawGroup(
1887
- t,
1888
- context,
1889
- entry.object,
1890
- position,
1891
- imageCache,
1892
- requestRepaint,
1893
- renderRegion,
1894
- pixelScale,
1895
- usedImageSources
1896
- );
1897
- }
1898
- }
1899
- function drawTable(t, context, table, position, renderRegion, pixelScale) {
1900
- const rowCount = table.rows.length;
1901
- const columnCount = table.rows[0]?.length ?? 0;
1902
- if (rowCount === 0 || columnCount === 0 || !intersects(position, renderRegion)) return;
1903
- const columnWidths = normalizeTableTracks(table.columnWidths, columnCount, position.width);
1904
- const rowHeights = normalizeTableTracks(table.rowHeights, rowCount, position.height);
1905
- const columnOffsets = cumulativeOffsets(columnWidths, position.left);
1906
- const rowOffsets = cumulativeOffsets(rowHeights, position.top);
1907
- const columnStart = visibleTrackStart(columnOffsets, renderRegion.left);
1908
- const columnEnd = visibleTrackEnd(columnOffsets, renderRegion.left + renderRegion.width);
1909
- const rowStart = visibleTrackStart(rowOffsets, renderRegion.top);
1910
- const rowEnd = visibleTrackEnd(rowOffsets, renderRegion.top + renderRegion.height);
1911
- const visibleCellCount = (rowEnd - rowStart) * (columnEnd - columnStart);
1912
- if (visibleCellCount > MAX_TABLE_CELLS_PER_PAINT) {
1913
- drawTableOverview(context, table, position, columnOffsets, rowOffsets, {
1914
- columnStart,
1915
- columnEnd,
1916
- rowStart,
1917
- rowEnd
1918
- });
1919
- return;
1920
- }
1921
- context.save();
1922
- for (let rowIndex = rowStart; rowIndex < rowEnd; rowIndex += 1) {
1923
- const row = table.rows[rowIndex];
1924
- if (!row) continue;
1925
- for (let columnIndex = columnStart; columnIndex < columnEnd; columnIndex += 1) {
1926
- const cell = row[columnIndex];
1927
- if (!cell) continue;
1928
- const rightIndex = Math.min(columnCount, columnIndex + cell.colSpan);
1929
- const bottomIndex = Math.min(rowCount, rowIndex + cell.rowSpan);
1930
- const left = columnOffsets[columnIndex] ?? position.left;
1931
- const top = rowOffsets[rowIndex] ?? position.top;
1932
- const right = columnOffsets[rightIndex] ?? position.left + position.width;
1933
- const bottom = rowOffsets[bottomIndex] ?? position.top + position.height;
1934
- const width = Math.max(1, right - left);
1935
- const height = Math.max(1, bottom - top);
1936
- context.beginPath();
1937
- context.rect(left, top, width, height);
1938
- applyFillAndLine(context, cell.fill, table.line, false);
1939
- if (width * pixelScale >= 8 && height * pixelScale >= 8) {
1940
- drawText(t, context, cell.text.toString(), cell.text.style, {
1941
- left: left + 4,
1942
- top: top + 2,
1943
- width: Math.max(1, width - 8),
1944
- height: Math.max(1, height - 4)
1945
- });
1946
- }
1947
- }
1948
- }
1949
- context.restore();
1950
- }
1951
- function visibleTrackStart(offsets, value) {
1952
- return Math.max(0, Math.min(offsets.length - 2, lowerBound(offsets, value) - 1));
1953
- }
1954
- function visibleTrackEnd(offsets, value) {
1955
- return Math.max(0, Math.min(offsets.length - 1, lowerBound(offsets, value) + 1));
1956
- }
1957
- function lowerBound(values, target) {
1958
- let low = 0;
1959
- let high = values.length;
1960
- while (low < high) {
1961
- const middle = low + Math.floor((high - low) / 2);
1962
- if ((values[middle] ?? Number.POSITIVE_INFINITY) < target) low = middle + 1;
1963
- else high = middle;
1964
- }
1965
- return low;
1966
- }
1967
- function drawTableOverview(context, table, position, columnOffsets, rowOffsets, visible) {
1968
- context.save();
1969
- context.beginPath();
1970
- context.rect(position.left, position.top, position.width, position.height);
1971
- applyFillAndLine(context, table.fill, table.line, false);
1972
- const columnStep = Math.max(1, Math.ceil((visible.columnEnd - visible.columnStart) / 96));
1973
- const rowStep = Math.max(1, Math.ceil((visible.rowEnd - visible.rowStart) / 96));
1974
- context.beginPath();
1975
- for (let index = visible.columnStart; index <= visible.columnEnd; index += columnStep) {
1976
- const x = columnOffsets[index];
1977
- if (x === void 0) continue;
1978
- context.moveTo(x, position.top);
1979
- context.lineTo(x, position.top + position.height);
1980
- }
1981
- for (let index = visible.rowStart; index <= visible.rowEnd; index += rowStep) {
1982
- const y = rowOffsets[index];
1983
- if (y === void 0) continue;
1984
- context.moveTo(position.left, y);
1985
- context.lineTo(position.left + position.width, y);
1986
- }
1987
- applyFillAndLine(context, "none", table.line, true);
1988
- context.restore();
1989
- }
1990
- function normalizeTableTracks(values, count, total) {
1991
- if (values.length !== count) return Array.from({ length: count }, () => total / count);
1992
- const sum = values.reduce((value, next) => value + next, 0);
1993
- if (!Number.isFinite(sum) || sum <= 0) {
1994
- return Array.from({ length: count }, () => total / count);
1995
- }
1996
- return values.map((value) => value / sum * total);
1997
- }
1998
- function cumulativeOffsets(tracks, start) {
1999
- const offsets = [start];
2000
- for (const track of tracks) offsets.push((offsets.at(-1) ?? start) + track);
2001
- return offsets;
2002
- }
2003
- function drawGroup(t, context, group, position, imageCache, requestRepaint, renderRegion, pixelScale, usedImageSources) {
2004
- const scaleX = position.width / group.childExtent.width;
2005
- const scaleY = position.height / group.childExtent.height;
2006
- const translatedX = position.left - group.childOffset.left * scaleX;
2007
- const translatedY = position.top - group.childOffset.top * scaleY;
2008
- const centerX = position.left + position.width / 2;
2009
- const centerY = position.top + position.height / 2;
2010
- context.save();
2011
- context.translate(centerX, centerY);
2012
- context.rotate(group.rotation * Math.PI / 180);
2013
- context.scale(group.flipHorizontal ? -1 : 1, group.flipVertical ? -1 : 1);
2014
- context.translate(-centerX, -centerY);
2015
- context.translate(translatedX, translatedY);
2016
- context.scale(scaleX, scaleY);
2017
- const childRenderRegion = inverseGroupRegion(group, position, renderRegion);
2018
- for (const child of group.children) {
2019
- const entry = displayObjectFromElement(child);
2020
- if (!intersects(objectBounds(entry), childRenderRegion)) continue;
2021
- drawObject(
2022
- t,
2023
- context,
2024
- entry,
2025
- child.position,
2026
- imageCache,
2027
- requestRepaint,
2028
- childRenderRegion,
2029
- pixelScale * Math.min(Math.abs(scaleX), Math.abs(scaleY)),
2030
- usedImageSources
2031
- );
2032
- }
2033
- context.restore();
2034
- }
2035
- function inverseGroupRegion(group, position, region) {
2036
- const scaleX = position.width / group.childExtent.width;
2037
- const scaleY = position.height / group.childExtent.height;
2038
- const translatedX = position.left - group.childOffset.left * scaleX;
2039
- const translatedY = position.top - group.childOffset.top * scaleY;
2040
- const centerX = position.left + position.width / 2;
2041
- const centerY = position.top + position.height / 2;
2042
- const radians = -group.rotation * Math.PI / 180;
2043
- const cos = Math.cos(radians);
2044
- const sin = Math.sin(radians);
2045
- const points = [
2046
- [region.left, region.top],
2047
- [region.left + region.width, region.top],
2048
- [region.left, region.top + region.height],
2049
- [region.left + region.width, region.top + region.height]
2050
- ].map(([x = 0, y = 0]) => {
2051
- const dx = x - centerX;
2052
- const dy = y - centerY;
2053
- const rotatedX = dx * cos - dy * sin;
2054
- const rotatedY = dx * sin + dy * cos;
2055
- const unflippedX = rotatedX * (group.flipHorizontal ? -1 : 1) + centerX;
2056
- const unflippedY = rotatedY * (group.flipVertical ? -1 : 1) + centerY;
2057
- return {
2058
- x: (unflippedX - translatedX) / scaleX,
2059
- y: (unflippedY - translatedY) / scaleY
2060
- };
2061
- });
2062
- const xs = points.map((point) => point.x);
2063
- const ys = points.map((point) => point.y);
2064
- const left = Math.min(...xs);
2065
- const right = Math.max(...xs);
2066
- const top = Math.min(...ys);
2067
- const bottom = Math.max(...ys);
2068
- return { left, top, width: right - left, height: bottom - top };
2069
- }
2070
- function drawShape(t, context, shape, position) {
2071
- context.save();
2072
- context.translate(position.left + position.width / 2, position.top + position.height / 2);
2073
- context.rotate(shape.rotation * Math.PI / 180);
2074
- const x = -position.width / 2;
2075
- const y = -position.height / 2;
2076
- context.beginPath();
2077
- switch (shape.geometry) {
2078
- case "ellipse":
2079
- context.ellipse(0, 0, position.width / 2, position.height / 2, 0, 0, Math.PI * 2);
2080
- break;
2081
- case "triangle":
2082
- context.moveTo(0, y);
2083
- context.lineTo(x + position.width, y + position.height);
2084
- context.lineTo(x, y + position.height);
2085
- context.closePath();
2086
- break;
2087
- case "rightArrow": {
2088
- const body = position.width * 0.65;
2089
- context.moveTo(x, y + position.height * 0.25);
2090
- context.lineTo(x + body, y + position.height * 0.25);
2091
- context.lineTo(x + body, y);
2092
- context.lineTo(x + position.width, 0);
2093
- context.lineTo(x + body, y + position.height);
2094
- context.lineTo(x + body, y + position.height * 0.75);
2095
- context.lineTo(x, y + position.height * 0.75);
2096
- context.closePath();
2097
- break;
2098
- }
2099
- case "line":
2100
- context.moveTo(x, y);
2101
- context.lineTo(x + position.width, y + position.height);
2102
- break;
2103
- case "roundRect":
2104
- roundedRect(
2105
- context,
2106
- x,
2107
- y,
2108
- position.width,
2109
- position.height,
2110
- resolveRadius(shape.borderRadius, position)
2111
- );
2112
- break;
2113
- default:
2114
- context.rect(x, y, position.width, position.height);
2115
- }
2116
- applyFillAndLine(context, shape.fill, shape.line, shape.geometry === "line");
2117
- const text = shape.text.toString();
2118
- if (text)
2119
- drawText(t, context, text, shape.text.style, {
2120
- left: x,
2121
- top: y,
2122
- width: position.width,
2123
- height: position.height
2124
- });
2125
- context.restore();
2126
- }
2127
- function drawChart(t, context, chart, position) {
2128
- context.save();
2129
- context.fillStyle = "#ffffff";
2130
- context.strokeStyle = "#e2e8f0";
2131
- context.lineWidth = 1;
2132
- context.fillRect(position.left, position.top, position.width, position.height);
2133
- context.strokeRect(position.left, position.top, position.width, position.height);
2134
- if (chart.title) {
2135
- drawText(
2136
- t,
2137
- context,
2138
- chart.title,
2139
- { fontSize: 18, bold: true, alignment: "center" },
2140
- {
2141
- left: position.left + 16,
2142
- top: position.top + 8,
2143
- width: Math.max(1, position.width - 32),
2144
- height: 28
2145
- }
2146
- );
2147
- }
2148
- const plot = {
2149
- left: position.left + 36,
2150
- top: position.top + (chart.title ? 46 : 20),
2151
- width: Math.max(1, position.width - 56),
2152
- height: Math.max(1, position.height - (chart.title ? 72 : 48))
2153
- };
2154
- const values = chart.series.items.flatMap((series) => series.values).filter(Number.isFinite);
2155
- const minValue = Math.min(0, chart.yAxis?.min ?? Math.min(...values, 0));
2156
- const maxValue = Math.max(1, chart.yAxis?.max ?? Math.max(...values, 1));
2157
- const valueRange = Math.max(Number.EPSILON, maxValue - minValue);
2158
- const yForValue = (value) => plot.top + plot.height - (value - minValue) / valueRange * plot.height;
2159
- const palette = ["#2563eb", "#0f766e", "#f59e0b", "#dc2626", "#7c3aed"];
2160
- if (chart.type === "pie" || chart.type === "doughnut") {
2161
- const series = chart.series.items[0];
2162
- const slices = series?.values.map((value) => Math.max(0, value)) ?? [];
2163
- const total = slices.reduce((sum, value) => sum + value, 0);
2164
- let angle = -Math.PI / 2;
2165
- const radius = Math.min(plot.width, plot.height) * 0.42;
2166
- const cx = plot.left + plot.width / 2;
2167
- const cy = plot.top + plot.height / 2;
2168
- slices.forEach((value, index) => {
2169
- const next = angle + (total > 0 ? value / total * Math.PI * 2 : 0);
2170
- context.beginPath();
2171
- context.moveTo(cx, cy);
2172
- context.arc(cx, cy, radius, angle, next);
2173
- context.closePath();
2174
- context.fillStyle = palette[index % palette.length] ?? "#2563eb";
2175
- context.fill();
2176
- angle = next;
2177
- });
2178
- if (chart.type === "doughnut") {
2179
- context.beginPath();
2180
- context.arc(cx, cy, radius * 0.55, 0, Math.PI * 2);
2181
- context.fillStyle = "#ffffff";
2182
- context.fill();
2183
- }
2184
- } else if (chart.type === "line" || chart.type === "area") {
2185
- drawChartAxes(context, chart, plot, yForValue(0));
2186
- chart.series.items.forEach((series, seriesIndex) => {
2187
- if (series.values.length === 0) return;
2188
- const points = series.values.map((value, index) => ({
2189
- x: plot.left + index / Math.max(1, series.values.length - 1) * plot.width,
2190
- y: yForValue(value)
2191
- }));
2192
- const color = resolveColor(
2193
- series.line?.fill ?? series.fill ?? palette[seriesIndex % palette.length] ?? "#2563eb"
2194
- );
2195
- if (chart.type === "area") {
2196
- context.beginPath();
2197
- context.moveTo(points[0]?.x ?? plot.left, yForValue(0));
2198
- for (const point of points) context.lineTo(point.x, point.y);
2199
- context.lineTo(points.at(-1)?.x ?? plot.left + plot.width, yForValue(0));
2200
- context.closePath();
2201
- context.globalAlpha = 0.22;
2202
- context.fillStyle = color;
2203
- context.fill();
2204
- context.globalAlpha = 1;
2205
- }
2206
- context.beginPath();
2207
- points.forEach((point, index) => {
2208
- if (index === 0) context.moveTo(point.x, point.y);
2209
- else context.lineTo(point.x, point.y);
2210
- });
2211
- context.strokeStyle = color;
2212
- context.lineWidth = series.line?.width ?? 3;
2213
- context.stroke();
2214
- for (const point of points) {
2215
- context.beginPath();
2216
- context.arc(point.x, point.y, 3, 0, Math.PI * 2);
2217
- context.fillStyle = color;
2218
- context.fill();
2219
- }
2220
- });
2221
- } else if (chart.type === "scatter" || chart.type === "bubble") {
2222
- drawChartAxes(context, chart, plot, yForValue(0));
2223
- const xValues = chart.series.items.flatMap(
2224
- (series) => series.values.map((_value, index) => series.xValues[index] ?? index)
2225
- );
2226
- const minX = chart.xAxis?.min ?? Math.min(...xValues, 0);
2227
- const maxX = chart.xAxis?.max ?? Math.max(...xValues, 1);
2228
- const xRange = Math.max(Number.EPSILON, maxX - minX);
2229
- chart.series.items.forEach((series, seriesIndex) => {
2230
- context.fillStyle = resolveColor(
2231
- series.fill ?? palette[seriesIndex % palette.length] ?? "#2563eb"
2232
- );
2233
- series.values.forEach((value, index) => {
2234
- const xValue = series.xValues[index] ?? index;
2235
- const x = plot.left + (xValue - minX) / xRange * plot.width;
2236
- const radius = chart.type === "bubble" ? Math.max(3, Math.sqrt(Math.max(0, series.bubbleSizes[index] ?? 9))) : 4;
2237
- context.beginPath();
2238
- context.arc(x, yForValue(value), radius, 0, Math.PI * 2);
2239
- context.fill();
2240
- });
2241
- });
2242
- } else if (chart.type === "radar") {
2243
- drawRadarChart(context, chart, plot, palette);
2244
- } else {
2245
- drawChartAxes(context, chart, plot, yForValue(0));
2246
- const count = Math.max(1, ...chart.series.items.map((series) => series.values.length));
2247
- const groupWidth = plot.width / count;
2248
- const barWidth = groupWidth * 0.72 / Math.max(1, chart.series.items.length);
2249
- const baseline = yForValue(0);
2250
- chart.series.items.forEach((series, seriesIndex) => {
2251
- series.values.forEach((value, valueIndex) => {
2252
- const valueY = yForValue(value);
2253
- const height = Math.abs(baseline - valueY);
2254
- context.fillStyle = resolveColor(
2255
- series.fill ?? palette[seriesIndex % palette.length] ?? "#2563eb"
2256
- );
2257
- const left = plot.left + valueIndex * groupWidth + groupWidth * 0.14 + seriesIndex * barWidth;
2258
- context.fillRect(left, Math.min(baseline, valueY), Math.max(1, barWidth), height);
2259
- if (chart.dataLabels?.showValue) {
2260
- drawText(
2261
- t,
2262
- context,
2263
- String(value),
2264
- { fontSize: 11, alignment: "center" },
2265
- {
2266
- left,
2267
- top: Math.max(plot.top, Math.min(baseline, valueY) - 14),
2268
- width: Math.max(1, barWidth),
2269
- height: 14
2270
- }
2271
- );
2272
- }
2273
- });
2274
- });
2275
- }
2276
- context.restore();
2277
- }
2278
- function drawChartAxes(context, chart, plot, baseline) {
2279
- context.save();
2280
- context.strokeStyle = "#94a3b8";
2281
- context.lineWidth = 1;
2282
- if (chart.xAxis?.visible !== false) {
2283
- context.beginPath();
2284
- context.moveTo(plot.left, Math.max(plot.top, Math.min(plot.top + plot.height, baseline)));
2285
- context.lineTo(
2286
- plot.left + plot.width,
2287
- Math.max(plot.top, Math.min(plot.top + plot.height, baseline))
2288
- );
2289
- context.stroke();
2290
- }
2291
- if (chart.yAxis?.visible !== false) {
2292
- context.beginPath();
2293
- context.moveTo(plot.left, plot.top);
2294
- context.lineTo(plot.left, plot.top + plot.height);
2295
- context.stroke();
2296
- }
2297
- context.restore();
2298
- }
2299
- function drawRadarChart(context, chart, plot, palette) {
2300
- const count = Math.max(3, ...chart.series.items.map((series) => series.values.length));
2301
- const maximum = Math.max(
2302
- 1,
2303
- ...chart.series.items.flatMap((series) => series.values.map((value) => Math.max(0, value)))
2304
- );
2305
- const centerX = plot.left + plot.width / 2;
2306
- const centerY = plot.top + plot.height / 2;
2307
- const radius = Math.min(plot.width, plot.height) * 0.42;
2308
- const point = (index, value) => {
2309
- const angle = -Math.PI / 2 + index / count * Math.PI * 2;
2310
- const scaled = Math.max(0, value) / maximum * radius;
2311
- return { x: centerX + Math.cos(angle) * scaled, y: centerY + Math.sin(angle) * scaled };
2312
- };
2313
- context.save();
2314
- context.strokeStyle = "#cbd5e1";
2315
- for (let ring = 1; ring <= 4; ring += 1) {
2316
- context.beginPath();
2317
- for (let index = 0; index < count; index += 1) {
2318
- const next = point(index, maximum * ring / 4);
2319
- if (index === 0) context.moveTo(next.x, next.y);
2320
- else context.lineTo(next.x, next.y);
2321
- }
2322
- context.closePath();
2323
- context.stroke();
2324
- }
2325
- chart.series.items.forEach((series, seriesIndex) => {
2326
- const color = resolveColor(series.fill ?? palette[seriesIndex % palette.length] ?? "#2563eb");
2327
- context.beginPath();
2328
- for (let index = 0; index < count; index += 1) {
2329
- const next = point(index, series.values[index] ?? 0);
2330
- if (index === 0) context.moveTo(next.x, next.y);
2331
- else context.lineTo(next.x, next.y);
2332
- }
2333
- context.closePath();
2334
- context.globalAlpha = 0.18;
2335
- context.fillStyle = color;
2336
- context.fill();
2337
- context.globalAlpha = 1;
2338
- context.strokeStyle = color;
2339
- context.lineWidth = series.line?.width ?? 2;
2340
- context.stroke();
2341
- });
2342
- context.restore();
2343
- }
2344
- function drawImage(t, context, image, position, imageCache, requestRepaint) {
2345
- context.save();
2346
- applyImageTransform(context, image, position);
2347
- imageClipPath(context, image, position);
2348
- context.clip();
2349
- context.fillStyle = "#f1f5f9";
2350
- context.fillRect(position.left, position.top, position.width, position.height);
2351
- const source = imageSourceForCanvas(image);
2352
- if (source && typeof Image !== "undefined") {
2353
- let cached = imageCache.get(source);
2354
- if (!cached) {
2355
- const element = new Image();
2356
- cached = { image: element, ready: false };
2357
- imageCache.set(source, cached);
2358
- element.onload = () => {
2359
- const current = imageCache.get(source);
2360
- if (!current || current.image !== element) return;
2361
- current.ready = true;
2362
- requestRepaint();
2363
- };
2364
- element.onerror = () => {
2365
- const current = imageCache.get(source);
2366
- if (current?.image === element) current.ready = false;
2367
- };
2368
- element.src = source;
2369
- }
2370
- if (cached.ready && cached.image.naturalWidth > 0 && cached.image.naturalHeight > 0) {
2371
- drawFittedImage(context, cached.image, image, position);
2372
- context.restore();
2373
- return source;
2374
- }
2375
- }
2376
- context.strokeStyle = "#94a3b8";
2377
- context.lineWidth = 1;
2378
- context.setLineDash([8, 6]);
2379
- imageClipPath(context, image, position);
2380
- context.stroke();
2381
- context.setLineDash([]);
2382
- drawText(
2383
- t,
2384
- context,
2385
- image.alt || image.prompt || t("artifacts.presentationEditor.image"),
2386
- { fontSize: 14, color: "slate-600" },
2387
- {
2388
- left: position.left + 12,
2389
- top: position.top + 12,
2390
- width: Math.max(1, position.width - 24),
2391
- height: Math.max(1, position.height - 24)
2392
- }
2393
- );
2394
- context.restore();
2395
- return source;
2396
- }
2397
- function imageSourceForCanvas(image) {
2398
- try {
2399
- return image.sourceForSvg();
2400
- } catch {
2401
- return void 0;
2402
- }
2403
- }
2404
- function applyImageTransform(context, image, position) {
2405
- const centerX = position.left + position.width / 2;
2406
- const centerY = position.top + position.height / 2;
2407
- context.translate(centerX, centerY);
2408
- context.rotate(image.rotation * Math.PI / 180);
2409
- context.scale(image.flipHorizontal ? -1 : 1, image.flipVertical ? -1 : 1);
2410
- context.translate(-centerX, -centerY);
2411
- }
2412
- function imageClipPath(context, image, position) {
2413
- context.beginPath();
2414
- if (image.geometry === "ellipse") {
2415
- context.ellipse(
2416
- position.left + position.width / 2,
2417
- position.top + position.height / 2,
2418
- position.width / 2,
2419
- position.height / 2,
2420
- 0,
2421
- 0,
2422
- Math.PI * 2
2423
- );
2424
- } else if (image.geometry === "roundRect") {
2425
- roundedRect(
2426
- context,
2427
- position.left,
2428
- position.top,
2429
- position.width,
2430
- position.height,
2431
- resolveRadius(image.borderRadius, position)
2432
- );
2433
- } else {
2434
- context.rect(position.left, position.top, position.width, position.height);
2435
- }
2436
- context.closePath();
2437
- }
2438
- function drawFittedImage(context, source, image, position) {
2439
- const crop = image.crop ?? { left: 0, top: 0, right: 0, bottom: 0 };
2440
- const sourceX = source.naturalWidth * crop.left;
2441
- const sourceY = source.naturalHeight * crop.top;
2442
- const sourceWidth = source.naturalWidth * (1 - crop.left - crop.right);
2443
- const sourceHeight = source.naturalHeight * (1 - crop.top - crop.bottom);
2444
- if (sourceWidth <= 0 || sourceHeight <= 0) return;
2445
- const scale = image.fit === "cover" ? Math.max(position.width / sourceWidth, position.height / sourceHeight) : Math.min(position.width / sourceWidth, position.height / sourceHeight);
2446
- const width = sourceWidth * scale;
2447
- const height = sourceHeight * scale;
2448
- const left = position.left + (position.width - width) / 2;
2449
- const top = position.top + (position.height - height) / 2;
2450
- context.drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight, left, top, width, height);
2451
- }
2452
- function disposeCanvasImageCache(cache) {
2453
- for (const entry of cache.values()) disposeCanvasImageEntry(entry);
2454
- cache.clear();
2455
- }
2456
- function disposeUnusedCanvasImages(cache, usedSources) {
2457
- for (const [source, entry] of cache) {
2458
- if (usedSources.has(source)) continue;
2459
- disposeCanvasImageEntry(entry);
2460
- cache.delete(source);
2461
- }
2462
- }
2463
- function disposeCanvasImageEntry(entry) {
2464
- entry.image.onload = null;
2465
- entry.image.onerror = null;
2466
- entry.image.removeAttribute("src");
2467
- }
2468
- function drawText(t, context, text, style, position) {
2469
- const fontSize = style.fontSize ?? 18;
2470
- const fontStyle = style.italic ? "italic " : "";
2471
- const fontWeight = style.bold ? "700 " : "400 ";
2472
- context.font = `${fontStyle}${fontWeight}${fontSize}px ${style.fontFamily ?? t("artifacts.presentationEditor.arialSansSerif")}`;
2473
- context.fillStyle = resolveColor(style.color ?? "slate-950");
2474
- context.textAlign = style.alignment === "center" ? "center" : style.alignment === "right" ? "right" : "left";
2475
- context.textBaseline = "top";
2476
- const x = style.alignment === "center" ? position.left + position.width / 2 : style.alignment === "right" ? position.left + position.width : position.left;
2477
- const lineHeight = fontSize * 1.2;
2478
- const lines = wrapCanvasText(context, text, position.width);
2479
- const totalHeight = lines.length * lineHeight;
2480
- const top = style.verticalAlignment === "middle" ? position.top + (position.height - totalHeight) / 2 : style.verticalAlignment === "bottom" ? position.top + position.height - totalHeight : position.top;
2481
- context.save();
2482
- context.beginPath();
2483
- context.rect(position.left, position.top, position.width, position.height);
2484
- context.clip();
2485
- lines.forEach((line, index) => context.fillText(line, x, top + index * lineHeight));
2486
- context.restore();
2487
- }
2488
- function wrapCanvasText(context, text, width) {
2489
- const result = [];
2490
- for (const paragraph of text.split("\n")) {
2491
- const words = paragraph.split(/\s+/).filter(Boolean);
2492
- if (words.length === 0) {
2493
- result.push("");
2494
- continue;
2495
- }
2496
- let line = words[0] ?? "";
2497
- for (let index = 1; index < words.length; index += 1) {
2498
- const word = words[index] ?? "";
2499
- const candidate = `${line} ${word}`;
2500
- if (context.measureText(candidate).width <= width || line.length === 0) line = candidate;
2501
- else {
2502
- result.push(line);
2503
- line = word;
2504
- }
2505
- }
2506
- result.push(line);
2507
- }
2508
- return result;
2509
- }
2510
- function applyFillAndLine(context, fill, line, lineOnly) {
2511
- if (!lineOnly && resolveColor(fill) !== "transparent") {
2512
- context.fillStyle = resolveColor(fill);
2513
- context.fill();
2514
- }
2515
- if (line.style !== "none" && resolveColor(line.fill ?? "slate-900") !== "transparent" && (line.width ?? 1) > 0) {
2516
- context.strokeStyle = resolveColor(line.fill ?? "slate-900");
2517
- context.lineWidth = line.width ?? 1;
2518
- context.setLineDash(line.style === "dash" ? [8, 5] : line.style === "dot" ? [2, 4] : []);
2519
- context.stroke();
2520
- context.setLineDash([]);
2521
- }
2522
- }
2523
- function roundedRect(context, x, y, width, height, radius) {
2524
- const r = Math.min(Math.max(0, radius), width / 2, height / 2);
2525
- context.moveTo(x + r, y);
2526
- context.lineTo(x + width - r, y);
2527
- context.quadraticCurveTo(x + width, y, x + width, y + r);
2528
- context.lineTo(x + width, y + height - r);
2529
- context.quadraticCurveTo(x + width, y + height, x + width - r, y + height);
2530
- context.lineTo(x + r, y + height);
2531
- context.quadraticCurveTo(x, y + height, x, y + height - r);
2532
- context.lineTo(x, y + r);
2533
- context.quadraticCurveTo(x, y, x + r, y);
2534
- context.closePath();
2535
- }
2536
- function hitTest(index, x, y) {
2537
- const candidates = querySpatialIndex(index, { left: x, top: y, width: 0, height: 0 });
2538
- for (let candidateIndex = candidates.length - 1; candidateIndex >= 0; candidateIndex -= 1) {
2539
- const entry = index.objects[candidates[candidateIndex] ?? -1];
2540
- if (entry && objectContainsPoint(entry, x, y)) return entry;
2541
- }
2542
- return null;
2543
- }
2544
- function objectContainsPoint(entry, x, y) {
2545
- const position = entry.object.position;
2546
- const rotation = objectRotation(entry);
2547
- if (rotation === 0) {
2548
- return x >= position.left && x <= position.left + position.width && y >= position.top && y <= position.top + position.height;
2549
- }
2550
- const centerX = position.left + position.width / 2;
2551
- const centerY = position.top + position.height / 2;
2552
- const radians = -rotation * Math.PI / 180;
2553
- const dx = x - centerX;
2554
- const dy = y - centerY;
2555
- const localX = dx * Math.cos(radians) - dy * Math.sin(radians) + centerX;
2556
- const localY = dx * Math.sin(radians) + dy * Math.cos(radians) + centerY;
2557
- return localX >= position.left && localX <= position.left + position.width && localY >= position.top && localY <= position.top + position.height;
2558
- }
2559
- function objectBounds(entry) {
2560
- const position = entry.object.position;
2561
- const rotation = objectRotation(entry);
2562
- if (rotation === 0) return position;
2563
- const radians = rotation * Math.PI / 180;
2564
- const width = Math.abs(position.width * Math.cos(radians)) + Math.abs(position.height * Math.sin(radians));
2565
- const height = Math.abs(position.width * Math.sin(radians)) + Math.abs(position.height * Math.cos(radians));
2566
- return {
2567
- left: position.left + (position.width - width) / 2,
2568
- top: position.top + (position.height - height) / 2,
2569
- width,
2570
- height
2571
- };
2572
- }
2573
- function objectRotation(entry) {
2574
- if (entry.kind === "shape") return finite(entry.object.rotation, 0);
2575
- if (entry.kind === "image") return finite(entry.object.rotation, 0);
2576
- if (entry.kind === "group") return finite(entry.object.rotation, 0);
2577
- return 0;
2578
- }
2579
- function objectLabel(t, entry) {
2580
- const object = entry.object;
2581
- if (entry.kind === "shape") {
2582
- const shape = object;
2583
- return shape.text.toString().trim() || shape.name || t("artifacts.presentationEditor.shape");
2584
- }
2585
- if (entry.kind === "chart")
2586
- return object.title || object.name || t("artifacts.presentationEditor.chart");
2587
- if (entry.kind === "image")
2588
- return object.alt || object.name || t("artifacts.presentationEditor.image");
2589
- if (entry.kind === "table") return object.name || t("artifacts.presentationEditor.table");
2590
- return object.name || t("artifacts.presentationEditor.group");
2591
- }
2592
- function accessibleObjectLabel(t, entry) {
2593
- const position = entry.object.position;
2594
- return `${objectLabel(t, entry)}. Position ${Math.round(position.left)}, ${Math.round(position.top)}. Size ${Math.round(position.width)} by ${Math.round(position.height)}.`;
2595
- }
2596
- function nextTextBoxPosition(objects, slideSize) {
2597
- const width = slideSize.width * 0.6;
2598
- const height = Math.max(48, slideSize.height * 0.16);
2599
- const lefts = [0.2, 0.08, 0.32].map(
2600
- (ratio) => Math.max(0, Math.min(slideSize.width - width, slideSize.width * ratio))
2601
- );
2602
- const tops = [0.2, 0.42, 0.64, 0.06].map(
2603
- (ratio) => Math.max(0, Math.min(slideSize.height - height, slideSize.height * ratio))
2604
- );
2605
- const occupied = objects.map(objectBounds);
2606
- let best = null;
2607
- let bestOverlap = Number.POSITIVE_INFINITY;
2608
- for (const left of lefts) {
2609
- for (const top of tops) {
2610
- const candidate = normalizeEditorPosition({ left, top, width, height });
2611
- const overlap = occupied.reduce(
2612
- (total, bounds) => total + intersectionArea(candidate, bounds),
2613
- 0
2614
- );
2615
- if (overlap < bestOverlap) {
2616
- best = candidate;
2617
- bestOverlap = overlap;
2618
- if (overlap === 0) return candidate;
2619
- }
2620
- }
2621
- }
2622
- return best ?? normalizeEditorPosition({ left: 0, top: 0, width, height });
2623
- }
2624
- function intersectionArea(a, b) {
2625
- const width = Math.max(
2626
- 0,
2627
- Math.min(a.left + a.width, b.left + b.width) - Math.max(a.left, b.left)
2628
- );
2629
- const height = Math.max(0, Math.min(a.top + a.height, b.top + b.height) - Math.max(a.top, b.top));
2630
- return width * height;
2631
- }
2632
- function normalizeEditorPosition(position) {
2633
- return {
2634
- left: clampGeometry(finite(position.left, 0)),
2635
- top: clampGeometry(finite(position.top, 0)),
2636
- width: Math.min(MAX_EDITOR_GEOMETRY, Math.max(8, finite(position.width, 8))),
2637
- height: Math.min(MAX_EDITOR_GEOMETRY, Math.max(8, finite(position.height, 8)))
2638
- };
2639
- }
2640
- function clampGeometry(value) {
2641
- return Math.max(-MAX_EDITOR_GEOMETRY, Math.min(MAX_EDITOR_GEOMETRY, value));
2642
- }
2643
- function positionFromDrag(drag, point) {
2644
- const dx = point.x - drag.start.x;
2645
- const dy = point.y - drag.start.y;
2646
- const radians = -drag.rotation * Math.PI / 180;
2647
- const resizeDx = dx * Math.cos(radians) - dy * Math.sin(radians);
2648
- const resizeDy = dx * Math.sin(radians) + dy * Math.cos(radians);
2649
- return normalizeEditorPosition(
2650
- drag.mode === "move" ? {
2651
- ...drag.before,
2652
- left: drag.before.left + dx,
2653
- top: drag.before.top + dy
2654
- } : {
2655
- ...drag.before,
2656
- width: Math.max(8, drag.before.width + resizeDx),
2657
- height: Math.max(8, drag.before.height + resizeDy)
2658
- }
2659
- );
2660
- }
2661
- function selectionTransform(entry, position) {
2662
- const rotation = objectRotation(entry);
2663
- if (rotation === 0) return void 0;
2664
- const centerX = position.left + position.width / 2;
2665
- const centerY = position.top + position.height / 2;
2666
- return `rotate(${rotation} ${centerX} ${centerY})`;
2667
- }
2668
- function copyPosition(position) {
2669
- return {
2670
- left: position.left,
2671
- top: position.top,
2672
- width: position.width,
2673
- height: position.height
2674
- };
2675
- }
2676
- function samePosition(a, b) {
2677
- return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;
2678
- }
2679
- function sameViewport(a, b) {
2680
- return a.scrollLeft === b.scrollLeft && a.scrollTop === b.scrollTop && a.width === b.width && a.height === b.height && a.stageLeft === b.stageLeft && a.stageTop === b.stageTop;
2681
- }
2682
- function intersects(a, b) {
2683
- return !!a && a.left <= b.left + b.width && a.left + a.width >= b.left && a.top <= b.top + b.height && a.top + a.height >= b.top;
2684
- }
2685
- function clampZoom(value) {
2686
- return Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, finite(value, 0.75)));
2687
- }
2688
- function fittedPresentationZoom(viewport, slideSize) {
2689
- const horizontalRoom = Math.max(1, viewport.width - 48);
2690
- const verticalRoom = Math.max(1, viewport.height - 48);
2691
- return clampZoom(Math.min(horizontalRoom / slideSize.width, verticalRoom / slideSize.height));
2692
- }
2693
- function finite(value, fallback) {
2694
- return Number.isFinite(value) ? value : fallback;
2695
- }
2696
- function safeDomId(value) {
2697
- return value.replaceAll(/[^a-zA-Z0-9_-]/g, "-");
2698
- }
2699
- function randomPresentationId() {
2700
- for (; ; ) {
2701
- const bytes = crypto.getRandomValues(new Uint8Array(16));
2702
- if (bytes.some((byte) => byte !== 0)) {
2703
- return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
2704
- }
2705
- }
2706
- }
2707
- function resolveRadius(value, position) {
2708
- if (typeof value === "number") return value;
2709
- const min = Math.min(position.width, position.height);
2710
- const preset = value?.startsWith("rounded-") ? value.slice("rounded-".length) : void 0;
2711
- if (preset === "full") return min / 2;
2712
- if (preset === "2xl") return 16;
2713
- if (preset === "xl") return 12;
2714
- if (preset === "lg") return 8;
2715
- return 6;
2716
- }
2717
- var COLORS = {
2718
- none: "transparent",
2719
- transparent: "transparent",
2720
- white: "#ffffff",
2721
- black: "#000000",
2722
- "slate-50": "#f8fafc",
2723
- "slate-100": "#f1f5f9",
2724
- "slate-200": "#e2e8f0",
2725
- "slate-300": "#cbd5e1",
2726
- "slate-400": "#94a3b8",
2727
- "slate-500": "#64748b",
2728
- "slate-600": "#475569",
2729
- "slate-700": "#334155",
2730
- "slate-800": "#1e293b",
2731
- "slate-900": "#0f172a",
2732
- "slate-950": "#020617"
2733
- };
2734
- function resolveColor(fill) {
2735
- const value = typeof fill === "string" ? fill : fill.color;
2736
- return COLORS[value] ?? value;
2737
- }
2738
-
2739
- // src/components/artifacts/editable-presentation.tsx
2740
- import {
2741
- PRESENTATION_ARTIFACT_COMMAND_VERSION,
2742
- PRESENTATION_ARTIFACT_QUERY_MAX_NODES,
2743
- PRESENTATION_ARTIFACT_QUERY_MAX_SLIDES,
2744
- PRESENTATION_ARTIFACT_QUERY_MAX_TEXT_BYTES,
2745
- PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES
2746
- } from "@opengeni/sdk/editable-artifacts";
2747
- import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
2748
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2749
- var EMU_PER_CSS_PIXEL = 9525;
2750
- var PRESENTATION_CATALOG_PAGE = 128;
2751
- var PRESENTATION_MAX_INTERACTIVE_SLIDES = 256;
2752
- var PRESENTATION_MAX_INTERACTIVE_NODES = 16384;
2753
- var PRESENTATION_MAX_INTERACTIVE_TEXT_BYTES = 4 * 1024 * 1024;
2754
- var PRESENTATION_MAX_CATALOG_PAGES = 32;
2755
- var PRESENTATION_SCENE_CONCURRENCY = 4;
2756
- var PRESENTATION_COMPOSITION_ATTEMPTS = 3;
2757
- var DEFAULT_PRESENTATION_TEXT_STYLE = Object.freeze({
2758
- fontFamily: "Arial",
2759
- fontSizeCentipoints: 1800,
2760
- color: 255,
2761
- bold: false,
2762
- italic: false,
2763
- underline: false,
2764
- language: null
2765
- });
2766
- function EditablePresentationArtifactSurface(props) {
2767
- return /* @__PURE__ */ jsx2(ArtifactSubmissionProvider, { children: /* @__PURE__ */ jsx2(EditablePresentationArtifactSurfaceSession, { ...props }) }, artifactSubmissionSessionKey(props.session));
2768
- }
2769
- function EditablePresentationArtifactSurfaceSession({
2770
- session,
2771
- title: titleProp,
2772
- showHeader,
2773
- subtitle,
2774
- readOnly = false,
2775
- onCommit,
2776
- onCommandError,
2777
- download,
2778
- actions: actionsProp,
2779
- ...surfaceProps
2780
- }) {
2781
- const t = useOpenGeniText();
2782
- const title = titleProp === void 0 ? t("artifacts.editablePresentation.presentation") : titleProp;
2783
- const view = useEditableArtifactView(session);
2784
- const submissions = useArtifactSubmissions();
2785
- const invalidator = editableArtifactProjectionKey(view);
2786
- const [retryEpoch, setRetryEpoch] = useState2(0);
2787
- const [state, setState] = useState2({
2788
- composed: null,
2789
- loading: true,
2790
- error: null
2791
- });
2792
- const loadGeneration = useRef2(0);
2793
- const scheduleLoad = useLatestTaskRunner(session);
2794
- const sceneNodes = useRef2(/* @__PURE__ */ new Map());
2795
- useEffect2(() => {
2796
- const generation = ++loadGeneration.current;
2797
- let cancelled = false;
2798
- setState((current) => ({ ...current, loading: true, error: null }));
2799
- scheduleLoad(async () => {
2800
- if (cancelled || generation !== loadGeneration.current) return;
2801
- await composePresentationEditorProjection(t, session).then(
2802
- (composed) => {
2803
- if (cancelled || generation !== loadGeneration.current) return;
2804
- sceneNodes.current = new Map(composed.sceneNodes);
2805
- setState({ composed, loading: false, error: null });
2806
- },
2807
- (cause) => {
2808
- if (cancelled || generation !== loadGeneration.current) return;
2809
- setState({
2810
- composed: null,
2811
- loading: false,
2812
- error: asEditableArtifactError(
2813
- cause,
2814
- t("artifacts.editablePresentation.couldNotOpenThisPresentation")
2815
- )
2816
- });
2817
- }
2818
- );
2819
- });
2820
- return () => {
2821
- cancelled = true;
2822
- };
2823
- }, [invalidator, retryEpoch, scheduleLoad, session, t]);
2824
- const refresh = useCallback2(() => setRetryEpoch((value) => value + 1), []);
2825
- const writable = !readOnly && view.writable;
2826
- const applyCommit = useCallback2(
2827
- async (commit) => {
2828
- const composed = state.composed;
2829
- if (!composed) throw new Error("Presentation projection is not ready");
2830
- if (!writable)
2831
- throw new Error(t("artifacts.editablePresentation.thisPresentationIsReadOnly"));
2832
- if (view.authoringBlockedReason)
2833
- throw new Error(t("artifacts.editablePresentation.anEarlierChangeMustSettle"));
2834
- if (commit.revision !== void 0 && String(commit.revision) !== String(composed.projection.revision)) {
2835
- throw new Error(t("artifacts.editablePresentation.thePresentationChangedRetryThis"));
2836
- }
2837
- if (commit.kind === "slide-insert") {
2838
- await session.createPresentationSlide({
2839
- slideId: commit.slideId,
2840
- index: commit.index
2841
- });
2842
- notifyPresentationCommit(t, onCommit, onCommandError, commit);
2843
- refresh();
2844
- return;
2845
- }
2846
- if (commit.kind === "slide-delete") {
2847
- await session.applyPresentationCommands({
2848
- version: PRESENTATION_ARTIFACT_COMMAND_VERSION,
2849
- commands: [
2850
- ...presentationNodeDeletionCommands(
2851
- [...sceneNodes.current.values()],
2852
- commit.slideId,
2853
- null
2854
- ),
2855
- { kind: "slide.delete", id: commit.slideId }
2856
- ]
2857
- });
2858
- notifyPresentationCommit(t, onCommit, onCommandError, commit);
2859
- refresh();
2860
- return;
2861
- }
2862
- if (commit.kind === "object-insert") {
2863
- await session.applyPresentationCommands({
2864
- version: PRESENTATION_ARTIFACT_COMMAND_VERSION,
2865
- commands: [
2866
- {
2867
- kind: "node.insert",
2868
- owner: { kind: "slide", id: commit.slideId },
2869
- parentId: null,
2870
- index: commit.index,
2871
- node: {
2872
- id: commit.objectId,
2873
- name: "Text box",
2874
- bounds: {
2875
- x: canonicalCoordinate(commit.position.left),
2876
- y: canonicalCoordinate(commit.position.top),
2877
- width: Math.max(1, canonicalCoordinate(commit.position.width)),
2878
- height: Math.max(1, canonicalCoordinate(commit.position.height))
2879
- },
2880
- transform: { rotation: 0, flipHorizontal: false, flipVertical: false },
2881
- content: {
2882
- kind: "shape",
2883
- geometry: "text-box",
2884
- fill: { kind: "none" },
2885
- line: { fill: { kind: "none" }, width: 0, dash: "solid" },
2886
- text: emptyPresentationText(),
2887
- placeholder: null
2888
- }
2889
- }
2890
- }
2891
- ]
2892
- });
2893
- notifyPresentationCommit(t, onCommit, onCommandError, commit);
2894
- refresh();
2895
- return;
2896
- }
2897
- if (commit.kind === "object-delete") {
2898
- await session.applyPresentationCommands({
2899
- version: PRESENTATION_ARTIFACT_COMMAND_VERSION,
2900
- commands: presentationNodeDeletionCommands(
2901
- [...sceneNodes.current.values()],
2902
- commit.slideId,
2903
- commit.objectId
2904
- )
2905
- });
2906
- notifyPresentationCommit(t, onCommit, onCommandError, commit);
2907
- refresh();
2908
- return;
2909
- }
2910
- const key = sceneNodeKey(commit.slideId, commit.objectId);
2911
- const node = sceneNodes.current.get(key);
2912
- if (!node) throw new Error(t("artifacts.editablePresentation.theEditedPresentationObjectIs"));
2913
- if (node.inherited || node.source.kind !== "slide" || node.source.id !== commit.slideId) {
2914
- throw new Error(t("artifacts.editablePresentation.inheritedMasterAndLayoutObjects"));
2915
- }
2916
- let command;
2917
- let nextNode;
2918
- if (commit.kind === "text") {
2919
- if (node.content.kind !== "shape" || node.content.text === null) {
2920
- throw new Error(t("artifacts.editablePresentation.thisPresentationObjectDoesNot"));
2921
- }
2922
- if (flattenPresentationRichText(node.content.text) !== commit.before) {
2923
- throw new Error(t("artifacts.editablePresentation.thePresentationTextChangedRetry"));
2924
- }
2925
- const text = replacePresentationRichText(node.content.text, commit.before, commit.after);
2926
- const content = Object.freeze({ ...node.content, text });
2927
- command = { kind: "node.content.set", id: node.id, content };
2928
- nextNode = Object.freeze({ ...node, content });
2929
- } else {
2930
- const current = normalizeProjectedEditorPosition(projectPosition(node.bounds));
2931
- if (!sameProjectedPosition(current, commit.before)) {
2932
- throw new Error(t("artifacts.editablePresentation.thePresentationObjectChangedRetry"));
2933
- }
2934
- const bounds = commit.kind === "move" ? Object.freeze({
2935
- ...node.bounds,
2936
- x: canonicalCoordinate(commit.after.left),
2937
- y: canonicalCoordinate(commit.after.top)
2938
- }) : Object.freeze({
2939
- ...node.bounds,
2940
- width: Math.max(1, canonicalCoordinate(commit.after.width)),
2941
- height: Math.max(1, canonicalCoordinate(commit.after.height))
2942
- });
2943
- command = { kind: "node.bounds.set", id: node.id, bounds };
2944
- nextNode = Object.freeze({ ...node, bounds });
2945
- }
2946
- await session.applyPresentationCommands({
2947
- version: PRESENTATION_ARTIFACT_COMMAND_VERSION,
2948
- commands: [command]
2949
- });
2950
- sceneNodes.current.set(key, nextNode);
2951
- notifyPresentationCommit(t, onCommit, onCommandError, commit);
2952
- refresh();
2953
- },
2954
- [
2955
- onCommandError,
2956
- onCommit,
2957
- refresh,
2958
- session,
2959
- state.composed,
2960
- view.authoringBlockedReason,
2961
- writable,
2962
- t
2963
- ]
2964
- );
2965
- const submitCommit = useCallback2(
2966
- (commit) => submissions.run(() => applyCommit(commit)),
2967
- [applyCommit, submissions]
2968
- );
2969
- const actions = download ? /* @__PURE__ */ jsxs2(Fragment, { children: [
2970
- actionsProp,
2971
- /* @__PURE__ */ jsx2(
2972
- EditableArtifactDownloadButton,
2973
- {
2974
- session,
2975
- title,
2976
- download,
2977
- format: "pptx"
2978
- }
2979
- )
2980
- ] }) : actionsProp;
2981
- const projection = state.composed?.projection ?? null;
2982
- const status = editableArtifactStatusLabel(t, view);
2983
- const accessRevoked = editableArtifactAccessRevoked(view);
2984
- return projection && !accessRevoked ? /* @__PURE__ */ jsx2(
2985
- PresentationProjectionArtifactSurface,
2986
- {
2987
- ...surfaceProps,
2988
- title,
2989
- showHeader,
2990
- actions,
2991
- subtitle: subtitle ?? writable ? t("counts.slides", { count: projection.slides.length }) : t("artifacts.readOnlySubtitle", {
2992
- subtitle: t("counts.slides", { count: projection.slides.length })
2993
- }),
2994
- projection,
2995
- commit: writable ? submitCommit : void 0,
2996
- readOnly: !writable,
2997
- authoringBlockedReason: view.authoringBlockedReason,
2998
- busy: state.loading,
2999
- onCommandError
3000
- }
3001
- ) : /* @__PURE__ */ jsx2(
3002
- ArtifactSurface,
3003
- {
3004
- modality: "presentation",
3005
- title,
3006
- showHeader,
3007
- subtitle: subtitle ?? status,
3008
- actions: accessRevoked ? actionsProp : actions,
3009
- busy: !accessRevoked && !state.error,
3010
- className: surfaceProps.className,
3011
- children: /* @__PURE__ */ jsx2(
3012
- EditableArtifactMessage,
3013
- {
3014
- title: accessRevoked ? t("artifacts.editablePresentation.accessChanged") : state.error ? t("artifacts.editablePresentation.couldNotOpenThisPresentation") : t("artifacts.editablePresentation.openingPresentation"),
3015
- detail: accessRevoked ? status : state.error?.message ?? status,
3016
- retry: !accessRevoked && state.error ? refresh : void 0
3017
- }
3018
- )
3019
- }
3020
- );
3021
- }
3022
- function presentationNodeDeletionCommands(nodes, slideId, rootId) {
3023
- const owned = nodes.filter(
3024
- (node) => !node.inherited && node.source.kind === "slide" && node.source.id === slideId
3025
- );
3026
- if (rootId !== null && !owned.some((node) => node.id === rootId)) {
3027
- return [{ kind: "node.delete", id: rootId }];
3028
- }
3029
- let targets;
3030
- if (rootId === null) {
3031
- targets = new Set(owned.map((node) => node.id));
3032
- } else {
3033
- const children = /* @__PURE__ */ new Map();
3034
- for (const node of owned) {
3035
- if (node.parentId === null) continue;
3036
- const siblings = children.get(node.parentId);
3037
- if (siblings) siblings.push(node.id);
3038
- else children.set(node.parentId, [node.id]);
3039
- }
3040
- targets = /* @__PURE__ */ new Set([rootId]);
3041
- const stack = [rootId];
3042
- while (stack.length > 0) {
3043
- for (const child of children.get(stack.pop()) ?? []) {
3044
- if (targets.has(child)) continue;
3045
- targets.add(child);
3046
- stack.push(child);
3047
- }
3048
- }
3049
- }
3050
- const commands = [];
3051
- for (const node of owned) {
3052
- if (targets.has(node.id) || node.content.kind !== "connector") continue;
3053
- const { start, end } = node.content;
3054
- const detachStart = start.nodeId !== null && targets.has(start.nodeId);
3055
- const detachEnd = end.nodeId !== null && targets.has(end.nodeId);
3056
- if (!detachStart && !detachEnd) continue;
3057
- commands.push({
3058
- kind: "node.content.set",
3059
- id: node.id,
3060
- content: {
3061
- ...node.content,
3062
- start: detachStart ? { ...start, nodeId: null } : start,
3063
- end: detachEnd ? { ...end, nodeId: null } : end
3064
- }
3065
- });
3066
- }
3067
- const doomed = owned.filter((node) => targets.has(node.id));
3068
- const referencedBy = (node) => {
3069
- const referenced = /* @__PURE__ */ new Set();
3070
- if (node.parentId !== null && targets.has(node.parentId)) referenced.add(node.parentId);
3071
- if (node.content.kind === "connector") {
3072
- for (const endpoint of [node.content.start.nodeId, node.content.end.nodeId]) {
3073
- if (endpoint !== null && endpoint !== node.id && targets.has(endpoint)) {
3074
- referenced.add(endpoint);
3075
- }
3076
- }
3077
- }
3078
- return referenced;
3079
- };
3080
- const references = new Map(doomed.map((node) => [node.id, referencedBy(node)]));
3081
- const blockers = new Map(doomed.map((node) => [node.id, 0]));
3082
- for (const referenced of references.values()) {
3083
- for (const id of referenced) blockers.set(id, blockers.get(id) + 1);
3084
- }
3085
- const ready = doomed.filter((node) => blockers.get(node.id) === 0).map((node) => node.id);
3086
- const deleted = /* @__PURE__ */ new Set();
3087
- for (let index = 0; index < ready.length; index += 1) {
3088
- const id = ready[index];
3089
- deleted.add(id);
3090
- commands.push({ kind: "node.delete", id });
3091
- for (const referenced of references.get(id)) {
3092
- const left = blockers.get(referenced) - 1;
3093
- blockers.set(referenced, left);
3094
- if (left === 0) ready.push(referenced);
3095
- }
3096
- }
3097
- for (const node of doomed) {
3098
- if (!deleted.has(node.id)) commands.push({ kind: "node.delete", id: node.id });
3099
- }
3100
- return commands;
3101
- }
3102
- async function composePresentationEditorProjection(t, session) {
3103
- if (session.modality !== "presentation") {
3104
- throw new Error("Expected a presentation artifact session");
3105
- }
3106
- let lastRevisionError = null;
3107
- for (let attempt = 0; attempt < PRESENTATION_COMPOSITION_ATTEMPTS; attempt += 1) {
3108
- try {
3109
- return await composePresentationAttempt(session);
3110
- } catch (cause) {
3111
- const error = asEditableArtifactError(
3112
- cause,
3113
- t("artifacts.editablePresentation.couldNotProjectThisPresentation")
3114
- );
3115
- if (!isPresentationRevisionDrift(error) || attempt === PRESENTATION_COMPOSITION_ATTEMPTS - 1) {
3116
- throw error;
3117
- }
3118
- lastRevisionError = error;
3119
- }
3120
- }
3121
- throw lastRevisionError ?? new Error("Presentation changed while it was opening");
3122
- }
3123
- async function composePresentationAttempt(session) {
3124
- const metadata = await session.queryPresentation({
3125
- kind: "metadata",
3126
- maxBytes: PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES
3127
- });
3128
- if (metadata.kind !== "metadata") throw new Error("Presentation metadata response is malformed");
3129
- if (metadata.slides > PRESENTATION_MAX_INTERACTIVE_SLIDES) {
3130
- throw new Error(
3131
- `Presentation exceeds the interactive limit of ${PRESENTATION_MAX_INTERACTIVE_SLIDES} slides`
3132
- );
3133
- }
3134
- const catalog = await collectSlideCatalog(session, metadata.revision, metadata.slides);
3135
- const scenes = [];
3136
- for (let start = 0; start < catalog.length; start += PRESENTATION_SCENE_CONCURRENCY) {
3137
- const batch = catalog.slice(start, start + PRESENTATION_SCENE_CONCURRENCY);
3138
- const projected = await Promise.all(
3139
- batch.map(
3140
- (slide) => session.queryPresentationEditorSlide({
3141
- kind: "editor-slide",
3142
- slideId: slide.id,
3143
- maxNodes: PRESENTATION_ARTIFACT_QUERY_MAX_NODES,
3144
- maxTextBytes: PRESENTATION_ARTIFACT_QUERY_MAX_TEXT_BYTES,
3145
- maxBytes: PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES
3146
- })
3147
- )
3148
- );
3149
- for (const scene of projected) {
3150
- if (scene.revision !== metadata.revision) {
3151
- throw new Error("Presentation projection revision drifted");
3152
- }
3153
- if (scene.truncated) {
3154
- throw new Error(`Slide ${scene.slide.index + 1} exceeds the bounded editor projection`);
3155
- }
3156
- scenes.push(scene);
3157
- }
3158
- }
3159
- const totalNodes = scenes.reduce((sum, scene) => sum + scene.nodes.length, 0);
3160
- const totalText = scenes.reduce((sum, scene) => sum + scene.projectedTextBytes, 0);
3161
- if (totalNodes > PRESENTATION_MAX_INTERACTIVE_NODES) {
3162
- throw new Error(
3163
- `Presentation exceeds the interactive limit of ${PRESENTATION_MAX_INTERACTIVE_NODES} scene nodes`
3164
- );
3165
- }
3166
- if (totalText > PRESENTATION_MAX_INTERACTIVE_TEXT_BYTES) {
3167
- throw new Error(
3168
- `Presentation exceeds the interactive limit of ${PRESENTATION_MAX_INTERACTIVE_TEXT_BYTES} text bytes`
3169
- );
3170
- }
3171
- if (scenes.length !== catalog.length) {
3172
- throw new Error("Presentation slides changed while they were opening");
3173
- }
3174
- const sceneNodeMap = /* @__PURE__ */ new Map();
3175
- const slides = scenes.map((scene, index) => {
3176
- if (scene.slide.id !== catalog[index]?.id || scene.slide.index !== index) {
3177
- throw new Error("Presentation slide catalog changed while it was opening");
3178
- }
3179
- for (const node of scene.nodes) {
3180
- sceneNodeMap.set(sceneNodeKey(scene.slide.id, node.id), node);
3181
- }
3182
- return projectPresentationSlide(scene);
3183
- });
3184
- return Object.freeze({
3185
- projection: Object.freeze({
3186
- revision: metadata.revision.toString(),
3187
- slideSize: Object.freeze({
3188
- width: displayCoordinate(metadata.slideSize.width),
3189
- height: displayCoordinate(metadata.slideSize.height)
3190
- }),
3191
- slides: Object.freeze(slides)
3192
- }),
3193
- sceneNodes: sceneNodeMap
3194
- });
3195
- }
3196
- async function collectSlideCatalog(session, revision, expectedSlides) {
3197
- const slides = [];
3198
- let startSlide = 0;
3199
- let projectedText = 0;
3200
- for (let page = 0; page < PRESENTATION_MAX_CATALOG_PAGES; page += 1) {
3201
- const response = await session.queryPresentationSlideCatalog({
3202
- kind: "slide-catalog",
3203
- startSlide,
3204
- maxSlides: Math.min(
3205
- PRESENTATION_CATALOG_PAGE,
3206
- PRESENTATION_ARTIFACT_QUERY_MAX_SLIDES,
3207
- Math.max(1, expectedSlides - slides.length)
3208
- ),
3209
- maxTextBytes: PRESENTATION_ARTIFACT_QUERY_MAX_TEXT_BYTES,
3210
- maxBytes: PRESENTATION_ARTIFACT_QUERY_RESPONSE_MAX_BYTES
3211
- });
3212
- if (response.revision !== revision) {
3213
- throw new Error("Presentation projection revision drifted");
3214
- }
3215
- if (response.startSlide !== startSlide) {
3216
- throw new Error("Presentation slide catalog cursor is malformed");
3217
- }
3218
- if (response.slides.some((slide, offset) => slide.index !== startSlide + offset)) {
3219
- throw new Error("Presentation slide catalog order is malformed");
3220
- }
3221
- slides.push(...response.slides);
3222
- projectedText += response.projectedTextBytes;
3223
- if (slides.length > PRESENTATION_MAX_INTERACTIVE_SLIDES || projectedText > PRESENTATION_MAX_INTERACTIVE_TEXT_BYTES) {
3224
- throw new Error("Presentation slide catalog exceeds its interactive limit");
3225
- }
3226
- if (response.nextSlide === null) {
3227
- if (response.truncated || slides.length !== expectedSlides) {
3228
- throw new Error("Presentation slide catalog is incomplete");
3229
- }
3230
- return slides;
3231
- }
3232
- if (!response.truncated || response.nextSlide <= startSlide || response.nextSlide !== startSlide + response.slides.length || response.slides.length === 0) {
3233
- throw new Error("Presentation slide catalog did not advance");
3234
- }
3235
- startSlide = response.nextSlide;
3236
- }
3237
- throw new Error(`Presentation catalog exceeds ${PRESENTATION_MAX_CATALOG_PAGES} pages`);
3238
- }
3239
- function projectPresentationSlide(scene) {
3240
- const byId = new Map(scene.nodes.map((node) => [node.id, node]));
3241
- if (byId.size !== scene.nodes.length)
3242
- throw new Error("Presentation slide contains duplicate IDs");
3243
- const children = /* @__PURE__ */ new Map();
3244
- for (const node of scene.nodes) {
3245
- const entries = children.get(node.parentId) ?? [];
3246
- entries.push(node);
3247
- children.set(node.parentId, entries);
3248
- }
3249
- for (const entries of children.values()) {
3250
- entries.sort((left, right) => left.order - right.order || left.id.localeCompare(right.id));
3251
- }
3252
- const visited = /* @__PURE__ */ new Set();
3253
- const stack = /* @__PURE__ */ new Set();
3254
- const projectNode = (node) => {
3255
- if (stack.has(node.id)) throw new Error("Presentation group hierarchy contains a cycle");
3256
- if (visited.has(node.id)) throw new Error("Presentation node appears more than once");
3257
- stack.add(node.id);
3258
- visited.add(node.id);
3259
- const directChildren = children.get(node.id) ?? [];
3260
- let orderedChildren = directChildren;
3261
- if (node.content.kind === "group") {
3262
- const directIds = new Set(directChildren.map((child) => child.id));
3263
- if (node.content.children.length !== directChildren.length || node.content.children.some((id) => !directIds.has(id))) {
3264
- throw new Error(`Presentation group ${node.id} hierarchy is inconsistent`);
3265
- }
3266
- orderedChildren = node.content.children.map((id) => byId.get(id));
3267
- } else if (directChildren.length > 0) {
3268
- throw new Error(`Presentation non-group node ${node.id} contains children`);
3269
- }
3270
- const result = projectPresentationNode(node, orderedChildren.map(projectNode));
3271
- stack.delete(node.id);
3272
- return result;
3273
- };
3274
- const elements = (children.get(null) ?? []).map(projectNode);
3275
- if (visited.size !== scene.nodes.length) {
3276
- throw new Error("Presentation slide contains orphaned hierarchy nodes");
3277
- }
3278
- return Object.freeze({
3279
- id: scene.slide.id,
3280
- title: scene.slide.title,
3281
- background: projectFill(scene.slide.background),
3282
- elements: Object.freeze(elements),
3283
- layout: scene.slide.layout ? Object.freeze({
3284
- id: scene.slide.layout.id,
3285
- name: scene.slide.layout.name,
3286
- masterId: scene.slide.layout.masterId,
3287
- background: projectFill(scene.slide.layout.background)
3288
- }) : null,
3289
- notes: scene.notes ? projectRichText(scene.notes) : null
3290
- });
3291
- }
3292
- function projectPresentationNode(node, children) {
3293
- const metadata = {
3294
- nodeSource: { ...node.source },
3295
- inherited: node.inherited,
3296
- parentId: node.parentId,
3297
- order: node.order,
3298
- readOnly: node.inherited || node.source.kind !== "slide"
3299
- };
3300
- const position = projectPosition(node.bounds);
3301
- const rotation = node.transform.rotation / 6e4;
3302
- const content = node.content;
3303
- if (content.kind === "shape") {
3304
- const richText = content.text ? projectRichText(content.text) : void 0;
3305
- const textStyle = richText ? firstTextStyle(richText) : void 0;
3306
- return Object.freeze({
3307
- ...metadata,
3308
- kind: "shape",
3309
- id: node.id,
3310
- name: node.name,
3311
- geometry: projectShapeGeometry(content.geometry),
3312
- position,
3313
- fill: projectFill(content.fill),
3314
- line: projectLine(content.line),
3315
- rotation,
3316
- text: content.text ? flattenPresentationRichText(content.text) : "",
3317
- ...richText ? { richText } : {},
3318
- ...textStyle ? { textStyle } : {}
3319
- });
3320
- }
3321
- if (content.kind === "group") {
3322
- return Object.freeze({
3323
- ...metadata,
3324
- kind: "group",
3325
- id: node.id,
3326
- name: node.name,
3327
- position,
3328
- childOffset: Object.freeze({
3329
- left: displayCoordinate(content.childOffsetX),
3330
- top: displayCoordinate(content.childOffsetY)
3331
- }),
3332
- childExtent: Object.freeze({
3333
- width: displayCoordinate(content.childExtentWidth),
3334
- height: displayCoordinate(content.childExtentHeight)
3335
- }),
3336
- rotation,
3337
- flipHorizontal: node.transform.flipHorizontal,
3338
- flipVertical: node.transform.flipVertical,
3339
- children: Object.freeze([...children])
3340
- });
3341
- }
3342
- if (content.kind === "connector") {
3343
- return Object.freeze({
3344
- ...metadata,
3345
- kind: "connector",
3346
- id: node.id,
3347
- name: node.name,
3348
- connectorKind: content.connectorKind,
3349
- position,
3350
- start: Object.freeze({
3351
- nodeId: content.start.nodeId,
3352
- x: displayCoordinate(content.start.x),
3353
- y: displayCoordinate(content.start.y)
3354
- }),
3355
- end: Object.freeze({
3356
- nodeId: content.end.nodeId,
3357
- x: displayCoordinate(content.end.x),
3358
- y: displayCoordinate(content.end.y)
3359
- }),
3360
- line: projectLine(content.line)
3361
- });
3362
- }
3363
- if (content.kind === "chart") {
3364
- const titleRichText = projectRichText(content.title);
3365
- return Object.freeze({
3366
- ...metadata,
3367
- kind: "chart",
3368
- id: node.id,
3369
- name: node.name,
3370
- type: content.chartType,
3371
- position,
3372
- title: flattenPresentationRichText(content.title),
3373
- titleRichText,
3374
- hasLegend: content.hasLegend,
3375
- series: Object.freeze(
3376
- content.series.map((series) => ({
3377
- name: series.name,
3378
- categories: Object.freeze([...series.categories]),
3379
- values: Object.freeze([...series.values]),
3380
- xValues: Object.freeze([...series.xValues]),
3381
- bubbleSizes: Object.freeze([...series.bubbleSizes])
3382
- }))
3383
- )
3384
- });
3385
- }
3386
- if (content.kind === "table") {
3387
- return Object.freeze({
3388
- ...metadata,
3389
- kind: "table",
3390
- id: node.id,
3391
- name: node.name,
3392
- position,
3393
- rows: Object.freeze(
3394
- content.rows.map(
3395
- (row) => Object.freeze(
3396
- row.map(
3397
- (cell) => cell ? Object.freeze({
3398
- text: flattenPresentationRichText(cell.text),
3399
- richText: projectRichText(cell.text),
3400
- fill: projectFill(cell.fill),
3401
- rowSpan: cell.rowSpan,
3402
- colSpan: cell.columnSpan
3403
- }) : null
3404
- )
3405
- )
3406
- )
3407
- ),
3408
- columnWidths: Object.freeze(content.columnWidths.map(displayCoordinate)),
3409
- rowHeights: Object.freeze(content.rowHeights.map(displayCoordinate)),
3410
- line: projectLine(content.line)
3411
- });
3412
- }
3413
- return Object.freeze({
3414
- ...metadata,
3415
- kind: "image",
3416
- id: node.id,
3417
- name: node.name,
3418
- position,
3419
- alt: content.altText,
3420
- fit: content.fit,
3421
- rotation,
3422
- flipHorizontal: node.transform.flipHorizontal,
3423
- flipVertical: node.transform.flipVertical,
3424
- digest: bytesToHex(content.digest),
3425
- contentType: content.contentType,
3426
- intrinsicWidth: content.intrinsicWidth,
3427
- intrinsicHeight: content.intrinsicHeight
3428
- });
3429
- }
3430
- function projectRichText(text) {
3431
- return Object.freeze({
3432
- verticalAlignment: text.verticalAlignment,
3433
- paragraphs: Object.freeze(
3434
- text.paragraphs.map(
3435
- (paragraph) => Object.freeze({
3436
- alignment: paragraph.alignment,
3437
- runs: Object.freeze(
3438
- paragraph.runs.map(
3439
- (run) => Object.freeze({
3440
- text: run.text,
3441
- style: projectTextStyle(run.style, paragraph.alignment, text.verticalAlignment),
3442
- language: run.style.language
3443
- })
3444
- )
3445
- )
3446
- })
3447
- )
3448
- )
3449
- });
3450
- }
3451
- function projectTextStyle(style, alignment, verticalAlignment) {
3452
- return Object.freeze({
3453
- fontFamily: style.fontFamily,
3454
- fontSize: style.fontSizeCentipoints / 100,
3455
- color: rgbaCss(style.color),
3456
- bold: style.bold,
3457
- italic: style.italic,
3458
- underline: style.underline,
3459
- ...alignment ? { alignment } : {},
3460
- ...verticalAlignment ? { verticalAlignment } : {}
3461
- });
3462
- }
3463
- function firstTextStyle(text) {
3464
- return text.paragraphs[0]?.runs[0]?.style;
3465
- }
3466
- function projectFill(fill) {
3467
- return fill.kind === "none" ? "none" : Object.freeze({ type: "solid", color: rgbaCss(fill.color) });
3468
- }
3469
- function projectLine(line) {
3470
- return Object.freeze({
3471
- style: line.dash,
3472
- fill: projectFill(line.fill),
3473
- width: displayCoordinate(line.width)
3474
- });
3475
- }
3476
- function projectPosition(bounds) {
3477
- return Object.freeze({
3478
- left: displayCoordinate(bounds.x),
3479
- top: displayCoordinate(bounds.y),
3480
- width: displayCoordinate(bounds.width),
3481
- height: displayCoordinate(bounds.height)
3482
- });
3483
- }
3484
- function displayCoordinate(value) {
3485
- return value / EMU_PER_CSS_PIXEL;
3486
- }
3487
- function normalizeProjectedEditorPosition(position) {
3488
- const clamp = (value) => Math.max(-1e6, Math.min(1e6, value));
3489
- return {
3490
- left: clamp(position.left),
3491
- top: clamp(position.top),
3492
- width: Math.min(1e6, Math.max(8, position.width)),
3493
- height: Math.min(1e6, Math.max(8, position.height))
3494
- };
3495
- }
3496
- function canonicalCoordinate(value) {
3497
- if (!Number.isFinite(value)) throw new Error("Presentation coordinate must be finite");
3498
- const canonical = Math.round(value * EMU_PER_CSS_PIXEL);
3499
- if (!Number.isSafeInteger(canonical)) throw new Error("Presentation coordinate is out of range");
3500
- return canonical;
3501
- }
3502
- function sameProjectedPosition(left, right) {
3503
- return canonicalCoordinate(left.left) === canonicalCoordinate(right.left) && canonicalCoordinate(left.top) === canonicalCoordinate(right.top) && canonicalCoordinate(left.width) === canonicalCoordinate(right.width) && canonicalCoordinate(left.height) === canonicalCoordinate(right.height);
3504
- }
3505
- function projectShapeGeometry(geometry) {
3506
- return {
3507
- "text-box": "textbox",
3508
- rectangle: "rect",
3509
- "rounded-rectangle": "roundRect",
3510
- ellipse: "ellipse",
3511
- triangle: "triangle",
3512
- "right-arrow": "rightArrow",
3513
- line: "line"
3514
- }[geometry];
3515
- }
3516
- function emptyPresentationText() {
3517
- return Object.freeze({
3518
- verticalAlignment: "middle",
3519
- paragraphs: Object.freeze([
3520
- Object.freeze({
3521
- alignment: "left",
3522
- runs: Object.freeze([Object.freeze({ text: "", style: DEFAULT_PRESENTATION_TEXT_STYLE })])
3523
- })
3524
- ])
3525
- });
3526
- }
3527
- function flattenPresentationRichText(text) {
3528
- return text.paragraphs.map((paragraph) => paragraph.runs.map((run) => run.text).join("")).join("\n");
3529
- }
3530
- function replacePresentationRichText(richText, before, after) {
3531
- const canonicalBefore = flattenPresentationRichText(richText);
3532
- if (canonicalBefore !== before) throw new Error("Presentation rich text does not match its edit");
3533
- if (before === after) return richText;
3534
- const diff = textReplacementRange(before, after);
3535
- const spans = presentationStyleSpans(richText);
3536
- const paragraphStarts = presentationParagraphStarts(richText);
3537
- const insertionStyle = styleAtOffset(spans, diff.start) ?? DEFAULT_PRESENTATION_TEXT_STYLE;
3538
- const insertionAlignment = alignmentAtOffset(richText, paragraphStarts, diff.start);
3539
- const paragraphs = [];
3540
- let newOffset = 0;
3541
- for (const paragraphText of after.split("\n")) {
3542
- const alignment = alignmentForNewOffset(
3543
- richText,
3544
- paragraphStarts,
3545
- diff,
3546
- newOffset,
3547
- insertionAlignment
3548
- );
3549
- const runs = [];
3550
- let localOffset = 0;
3551
- for (const character of paragraphText) {
3552
- const offset = newOffset + localOffset;
3553
- const oldOffset = oldOffsetForNewOffset(diff, offset);
3554
- const style = oldOffset === null ? insertionStyle : styleAtOffset(spans, oldOffset) ?? insertionStyle;
3555
- const previous = runs.at(-1);
3556
- if (previous && samePresentationTextStyle(previous.style, style)) previous.text += character;
3557
- else runs.push({ text: character, style });
3558
- localOffset += character.length;
3559
- }
3560
- paragraphs.push(
3561
- Object.freeze({
3562
- alignment,
3563
- runs: Object.freeze(
3564
- runs.map(
3565
- (run) => Object.freeze({ text: run.text, style: Object.freeze({ ...run.style }) })
3566
- )
3567
- )
3568
- })
3569
- );
3570
- newOffset += paragraphText.length + 1;
3571
- }
3572
- return Object.freeze({
3573
- verticalAlignment: richText.verticalAlignment,
3574
- paragraphs: Object.freeze(paragraphs)
3575
- });
3576
- }
3577
- function textReplacementRange(before, after) {
3578
- let start = 0;
3579
- while (start < before.length && start < after.length && before.charCodeAt(start) === after.charCodeAt(start)) {
3580
- start += 1;
3581
- }
3582
- while (start > 0 && (splitsSurrogate(before, start) || splitsSurrogate(after, start))) start -= 1;
3583
- let suffix = 0;
3584
- while (suffix < before.length - start && suffix < after.length - start && before.charCodeAt(before.length - suffix - 1) === after.charCodeAt(after.length - suffix - 1)) {
3585
- suffix += 1;
3586
- }
3587
- while (suffix > 0 && (splitsSurrogate(before, before.length - suffix) || splitsSurrogate(after, after.length - suffix))) {
3588
- suffix -= 1;
3589
- }
3590
- const oldEnd = before.length - suffix;
3591
- const newEnd = after.length - suffix;
3592
- return { start, oldEnd, newEnd, delta: oldEnd - newEnd };
3593
- }
3594
- function oldOffsetForNewOffset(diff, offset) {
3595
- if (offset < diff.start) return offset;
3596
- if (offset >= diff.newEnd) return offset + diff.delta;
3597
- return null;
3598
- }
3599
- function presentationStyleSpans(text) {
3600
- const spans = [];
3601
- let offset = 0;
3602
- text.paragraphs.forEach((paragraph, paragraphIndex) => {
3603
- for (const run of paragraph.runs) {
3604
- spans.push({ start: offset, end: offset + run.text.length, style: run.style });
3605
- offset += run.text.length;
3606
- }
3607
- if (paragraphIndex < text.paragraphs.length - 1) offset += 1;
3608
- });
3609
- return spans;
3610
- }
3611
- function presentationParagraphStarts(text) {
3612
- const starts = [];
3613
- let offset = 0;
3614
- text.paragraphs.forEach((paragraph, index) => {
3615
- starts.push(offset);
3616
- offset += paragraph.runs.reduce((sum, run) => sum + run.text.length, 0);
3617
- if (index < text.paragraphs.length - 1) offset += 1;
3618
- });
3619
- return starts;
3620
- }
3621
- function styleAtOffset(spans, offset) {
3622
- const containing = spans.find((span) => offset >= span.start && offset < span.end);
3623
- if (containing) return containing.style;
3624
- const before = [...spans].reverse().find((span) => span.end <= offset);
3625
- return before?.style ?? spans[0]?.style ?? null;
3626
- }
3627
- function alignmentAtOffset(text, starts, offset) {
3628
- let index = 0;
3629
- while (index + 1 < starts.length && (starts[index + 1] ?? Number.POSITIVE_INFINITY) <= offset) {
3630
- index += 1;
3631
- }
3632
- return text.paragraphs[index]?.alignment ?? "left";
3633
- }
3634
- function alignmentForNewOffset(text, starts, diff, newOffset, fallback) {
3635
- const oldOffset = oldOffsetForNewOffset(diff, newOffset);
3636
- return oldOffset === null ? fallback : alignmentAtOffset(text, starts, oldOffset);
3637
- }
3638
- function samePresentationTextStyle(left, right) {
3639
- return left.fontFamily === right.fontFamily && left.fontSizeCentipoints === right.fontSizeCentipoints && left.color === right.color && left.bold === right.bold && left.italic === right.italic && left.underline === right.underline && left.language === right.language;
3640
- }
3641
- function splitsSurrogate(value, index) {
3642
- if (index <= 0 || index >= value.length) return false;
3643
- const left = value.charCodeAt(index - 1);
3644
- const right = value.charCodeAt(index);
3645
- return left >= 55296 && left <= 56319 && right >= 56320 && right <= 57343;
3646
- }
3647
- function rgbaCss(value) {
3648
- const hex = (value >>> 0).toString(16).padStart(8, "0");
3649
- return hex.endsWith("ff") ? `#${hex.slice(0, 6)}` : `#${hex}`;
3650
- }
3651
- function bytesToHex(value) {
3652
- return [...value].map((byte) => byte.toString(16).padStart(2, "0")).join("");
3653
- }
3654
- function sceneNodeKey(slideId, nodeId) {
3655
- return `${slideId}:${nodeId}`;
3656
- }
3657
- function isPresentationRevisionDrift(error) {
3658
- return error.message.includes("changed while") || error.message.includes("revision drifted");
3659
- }
3660
- function notifyPresentationCommit(t, observer, onError, commit) {
3661
- try {
3662
- const result = observer?.(commit);
3663
- if (result && typeof result.then === "function") {
3664
- void Promise.resolve(result).catch(
3665
- (cause) => onError?.(
3666
- asEditableArtifactError(
3667
- cause,
3668
- t("artifacts.editablePresentation.presentationCommitObserverFailed")
3669
- )
3670
- )
3671
- );
3672
- }
3673
- } catch (cause) {
3674
- onError?.(
3675
- asEditableArtifactError(
3676
- cause,
3677
- t("artifacts.editablePresentation.presentationCommitObserverFailed")
3678
- )
3679
- );
3680
- }
3681
- }
3682
-
3683
- export {
3684
- PresentationEditor,
3685
- PresentationProjectionEditor,
3686
- PresentationArtifactSurface,
3687
- PresentationProjectionArtifactSurface,
3688
- EditablePresentationArtifactSurface
3689
- };
3690
- //# sourceMappingURL=chunk-FPN4I4CG.js.map