@opengeni/react 6.35.1-canary.45058281793001 → 6.36.0

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 (1124) hide show
  1. package/dist/app/app-state.js +34 -34
  2. package/dist/app/components/Composer.js +43 -43
  3. package/dist/app/components/add-card-dialog.js +1 -1
  4. package/dist/app/components/add-card.js +2 -2
  5. package/dist/app/components/agent/agent-capability-picker.js +9 -9
  6. package/dist/app/components/agents/agent-can-use.js +47 -47
  7. package/dist/app/components/agents/agent-form-page.js +140 -140
  8. package/dist/app/components/agents/agent-page.js +123 -123
  9. package/dist/app/components/agents/agent-setup-sections.js +74 -74
  10. package/dist/app/components/agents/agent-skills.js +13 -13
  11. package/dist/app/components/agents/agent-trigger-chat-field.js +6 -6
  12. package/dist/app/components/agents/agent-trigger-dialog.js +31 -31
  13. package/dist/app/components/agents/agent-trigger-picker.js +8 -8
  14. package/dist/app/components/agents/agents-page.js +90 -90
  15. package/dist/app/components/agents/composer-agent-chip.js +59 -59
  16. package/dist/app/components/agents/session-agent-chip.js +54 -54
  17. package/dist/app/components/artifacts/app-package.js +10 -10
  18. package/dist/app/components/artifacts/artifact-browse-controls.js +3 -3
  19. package/dist/app/components/artifacts/artifact-library.js +28 -28
  20. package/dist/app/components/artifacts/artifact-page-chrome.js +1 -1
  21. package/dist/app/components/artifacts/artifact-viewer.js +68 -68
  22. package/dist/app/components/artifacts/chat-interactive-block.js +27 -27
  23. package/dist/app/components/artifacts/copy-artifact-link.js +1 -1
  24. package/dist/app/components/artifacts/file-reach-dialog.js +11 -11
  25. package/dist/app/components/artifacts/inline-chat-image.js +51 -51
  26. package/dist/app/components/artifacts/retained-file-preview.js +57 -57
  27. package/dist/app/components/artifacts/retained-text-preview.js +8 -8
  28. package/dist/app/components/artifacts/site-actions.js +11 -11
  29. package/dist/app/components/artifacts/site-audience.js +7 -7
  30. package/dist/app/components/artifacts/site-conversations.js +33 -33
  31. package/dist/app/components/artifacts/site-data.js +28 -28
  32. package/dist/app/components/artifacts/site-public-link.js +3 -3
  33. package/dist/app/components/artifacts/site-publishing-page.js +66 -66
  34. package/dist/app/components/artifacts/site-publishing.js +51 -51
  35. package/dist/app/components/artifacts/site-settings.js +65 -65
  36. package/dist/app/components/artifacts/site-version-menu.js +9 -9
  37. package/dist/app/components/billing-class-mark.js +8 -8
  38. package/dist/app/components/capabilities/capability-detail-sheet.js +18 -18
  39. package/dist/app/components/capabilities/capability-logo-source.js +27 -27
  40. package/dist/app/components/capabilities/capability-logo.js +1 -1
  41. package/dist/app/components/capabilities/connection-account-picker.js +2 -2
  42. package/dist/app/components/capabilities/connector-tool-permissions.js +8 -8
  43. package/dist/app/components/capabilities/native-connect-setup.js +31 -31
  44. package/dist/app/components/capabilities/own-logins-shared-heads-up.js +6 -6
  45. package/dist/app/components/capabilities/perform-capability-action.js +2 -2
  46. package/dist/app/components/capabilities/prepared-mcp-setup-card.js +30 -30
  47. package/dist/app/components/capabilities/session-capability-card.js +142 -142
  48. package/dist/app/components/capabilities/session-chrome-card.js +49 -49
  49. package/dist/app/components/capabilities/session-connect-inputs-card.js +33 -33
  50. package/dist/app/components/capabilities/session-custom-mcp-card.js +37 -37
  51. package/dist/app/components/capabilities/session-github-card.js +46 -46
  52. package/dist/app/components/capabilities/session-machine-card.js +50 -50
  53. package/dist/app/components/capabilities/session-personal-github-card.js +31 -31
  54. package/dist/app/components/capabilities/session-plugin-card.js +20 -20
  55. package/dist/app/components/capabilities/use-capabilities-catalog.js +3 -3
  56. package/dist/app/components/capabilities/use-connection-accounts.js +2 -2
  57. package/dist/app/components/chat-payment-pages.js +2 -2
  58. package/dist/app/components/command-menu/chat-status.js +25 -25
  59. package/dist/app/components/command-menu/chat-switcher.js +84 -84
  60. package/dist/app/components/command-menu/command-menu.js +113 -113
  61. package/dist/app/components/command-menu/shortcut-sheet.js +25 -25
  62. package/dist/app/components/composer-capabilities-menu-body.js +6 -6
  63. package/dist/app/components/composer-mobile-plus-panel.js +31 -31
  64. package/dist/app/components/composer-mobile-plus.js +3 -3
  65. package/dist/app/components/credit-required-gate.js +6 -6
  66. package/dist/app/components/credit-required-prompt.js +19 -19
  67. package/dist/app/components/credits/checkout-credits-celebration.js +1 -1
  68. package/dist/app/components/credits/checkout-return.js +1 -1
  69. package/dist/app/components/credits/coupon-redeem.js +1 -1
  70. package/dist/app/components/credits/credit-refusal-notice.js +7 -7
  71. package/dist/app/components/credits/own-subscription-plan-notice.js +3 -3
  72. package/dist/app/components/desktop/app-shots.js +9 -9
  73. package/dist/app/components/desktop/app-update.js +3 -3
  74. package/dist/app/components/desktop/computer-use.js +3 -3
  75. package/dist/app/components/desktop/this-computer.js +6 -6
  76. package/dist/app/components/feedback.js +10 -10
  77. package/dist/app/components/follow-up-repository-menu-body.js +14 -14
  78. package/dist/app/components/follow-up-repository-picker.js +1 -1
  79. package/dist/app/components/github-app-connect-launcher.js +2 -2
  80. package/dist/app/components/in-app-help-link.js +3 -3
  81. package/dist/app/components/knowledge/agent-learning-settings.js +3 -3
  82. package/dist/app/components/machines/connect-machine-dialog.js +25 -25
  83. package/dist/app/components/manual-repository-editor.js +4 -4
  84. package/dist/app/components/markdown.js +15 -15
  85. package/dist/app/components/model-identity.js +3 -3
  86. package/dist/app/components/models/models-ui.js +16 -16
  87. package/dist/app/components/models/provider-mark.js +3 -3
  88. package/dist/app/components/models/subscription-usage.js +5 -5
  89. package/dist/app/components/my-things.js +16 -16
  90. package/dist/app/components/own-where-it-works.js +10 -10
  91. package/dist/app/components/personal-resource-attachment-surface.js +4 -4
  92. package/dist/app/components/pickers.js +11 -11
  93. package/dist/app/components/rail/channel-create-dialog.js +5 -5
  94. package/dist/app/components/rail/project-glyph.js +52 -52
  95. package/dist/app/components/rail/project-profile.js +74 -74
  96. package/dist/app/components/rail/rail-context.js +2 -2
  97. package/dist/app/components/rail/rail-sections.js +157 -157
  98. package/dist/app/components/rail/session-header.js +128 -128
  99. package/dist/app/components/rail/session-list.js +155 -155
  100. package/dist/app/components/rail/session-row-content.js +7 -7
  101. package/dist/app/components/rail/session-row-hover-details.js +34 -34
  102. package/dist/app/components/rail/session-shell.js +196 -196
  103. package/dist/app/components/rail/site-session-group-heading.js +37 -37
  104. package/dist/app/components/repository-picker.js +14 -14
  105. package/dist/app/components/repository-ref-input.js +2 -2
  106. package/dist/app/components/secrets/session-secrets-panel.js +4 -4
  107. package/dist/app/components/session/agent-configuration-panel.js +46 -46
  108. package/dist/app/components/session/artifact-session-page.js +6 -6
  109. package/dist/app/components/session/banners.js +19 -19
  110. package/dist/app/components/session/chat-avatar.js +52 -52
  111. package/dist/app/components/session/console-new-conversation.js +109 -109
  112. package/dist/app/components/session/conversation-find.js +3 -3
  113. package/dist/app/components/session/descendant-requests.js +109 -109
  114. package/dist/app/components/session/editable-artifacts-workspace.js +59 -59
  115. package/dist/app/components/session/failed-session-banner.js +22 -22
  116. package/dist/app/components/session/failure-recovery-boundary.js +3 -3
  117. package/dist/app/components/session/human-input-delegation-record.js +3 -3
  118. package/dist/app/components/session/human-input.js +87 -87
  119. package/dist/app/components/session/inspector.js +143 -143
  120. package/dist/app/components/session/linked-panel.js +3 -3
  121. package/dist/app/components/session/message-actions.js +10 -10
  122. package/dist/app/components/session/model-recovery-notice.js +4 -4
  123. package/dist/app/components/session/new-session-settings-menu.js +30 -30
  124. package/dist/app/components/session/new-session-setup-strip.js +55 -55
  125. package/dist/app/components/session/pull-request-panel.js +24 -24
  126. package/dist/app/components/session/sandbox-recovery-actions.js +3 -3
  127. package/dist/app/components/session/sandbox-switcher.js +23 -23
  128. package/dist/app/components/session/sandbox-workspace.js +119 -119
  129. package/dist/app/components/session/search-markdown-highlight.js +16 -16
  130. package/dist/app/components/session/search-results-view.js +17 -17
  131. package/dist/app/components/session/session-admin-access.js +11 -11
  132. package/dist/app/components/session/session-admission-notice.js +11 -11
  133. package/dist/app/components/session/session-avatar-picker.js +59 -59
  134. package/dist/app/components/session/session-avatar.js +54 -54
  135. package/dist/app/components/session/session-machine-access-notice.js +11 -11
  136. package/dist/app/components/session/session-profile-dialog.js +70 -70
  137. package/dist/app/components/session/session-profile-editor.js +71 -71
  138. package/dist/app/components/session/session-retention.js +7 -7
  139. package/dist/app/components/session/session-search-dialog.js +22 -22
  140. package/dist/app/components/session/session-skill-reviews.js +5 -5
  141. package/dist/app/components/session/session-tenancy-control.js +27 -27
  142. package/dist/app/components/session/session-unattended-setting.js +3 -3
  143. package/dist/app/components/session/session-usage-limit-section.js +14 -14
  144. package/dist/app/components/session/share-chat-dialog.js +9 -9
  145. package/dist/app/components/session/subagents.js +23 -23
  146. package/dist/app/components/session/subscription-account-indicator.js +25 -25
  147. package/dist/app/components/session/subscription-account-menu.js +7 -7
  148. package/dist/app/components/session-connectors-menu-body.js +7 -7
  149. package/dist/app/components/settings/row-select.js +6 -6
  150. package/dist/app/components/toaster.js +2 -2
  151. package/dist/app/components/transcription-settings.js +10 -10
  152. package/dist/app/components/ui/destructive-confirm.js +9 -9
  153. package/dist/app/components/usage/usage-entry.js +8 -8
  154. package/dist/app/components/window-bar.js +26 -26
  155. package/dist/app/components/workspace-composer-plus.js +41 -41
  156. package/dist/app/components/workspace-reach.js +6 -6
  157. package/dist/app/embed/session-app.js +406 -406
  158. package/dist/app/lib/actions/actions-provider.js +20 -20
  159. package/dist/app/lib/agent-capabilities.js +4 -4
  160. package/dist/app/lib/app-connect-card.js +14 -14
  161. package/dist/app/lib/app-shared-key-dialog.js +8 -8
  162. package/dist/app/lib/app-surfaces.js +1 -1
  163. package/dist/app/lib/app-sync-opt-in.js +4 -4
  164. package/dist/app/lib/codex-usage-query.js +3 -3
  165. package/dist/app/lib/composer-agent.js +2 -2
  166. package/dist/app/lib/composer-connectors.js +31 -31
  167. package/dist/app/lib/composer-send-blocking.js +3 -3
  168. package/dist/app/lib/console-site.js +6 -6
  169. package/dist/app/lib/console-text.js +2 -2
  170. package/dist/app/lib/deployment-free-model.js +2 -2
  171. package/dist/app/lib/events.js +29 -29
  172. package/dist/app/lib/failed-session-copy.js +6 -6
  173. package/dist/app/lib/feedback-capture.js +2 -2
  174. package/dist/app/lib/free-credit-gap.js +2 -2
  175. package/dist/app/lib/model-access-onboarding.js +5 -5
  176. package/dist/app/lib/model-policy.js +1 -1
  177. package/dist/app/lib/move-chat-to-machine.js +5 -5
  178. package/dist/app/lib/personal-resource-attachments.js +1 -1
  179. package/dist/app/lib/session-branch-cache.js +18 -18
  180. package/dist/app/lib/session-create.js +5 -5
  181. package/dist/app/lib/session-group-pagination.js +18 -18
  182. package/dist/app/lib/session-hover-facts.js +25 -25
  183. package/dist/app/lib/session-list-dirty-scopes.js +19 -19
  184. package/dist/app/lib/session-model.js +3 -3
  185. package/dist/app/lib/session-rail.js +16 -16
  186. package/dist/app/lib/session-rename.js +4 -4
  187. package/dist/app/lib/sessions-group.js +22 -22
  188. package/dist/app/lib/site-tool-consent-dialog.js +23 -23
  189. package/dist/app/lib/site-tool-consent.js +1 -1
  190. package/dist/app/lib/turn-failure-analytics.js +7 -7
  191. package/dist/app/lib/unavailable-session-model.js +2 -2
  192. package/dist/app/lib/use-artifact-catalog.js +2 -2
  193. package/dist/app/lib/use-duplicate-site.js +4 -4
  194. package/dist/app/lib/use-follow-up-repositories.js +6 -6
  195. package/dist/app/lib/use-personal-resource-attachment.js +2 -2
  196. package/dist/app/lib/use-workspace-machines.js +10 -10
  197. package/dist/app/lib/use-workspace-model-catalog.js +6 -6
  198. package/dist/app/lib/use-workspace-rigs.js +7 -7
  199. package/dist/app/lib/workspace-navigation-preference.js +5 -5
  200. package/dist/app/lib/workspace-scope-context.js +4 -4
  201. package/dist/app/routes/app-page-view.js +17 -17
  202. package/dist/app/routes/app-page.js +2 -2
  203. package/dist/app/routes/artifacts.js +158 -158
  204. package/dist/app/routes/retained-artifact.js +114 -114
  205. package/dist/app/routes/session-unavailable.js +5 -5
  206. package/dist/app/routes/session.js +247 -247
  207. package/dist/app/routes/sessions-index-hydration.js +6 -6
  208. package/dist/app/routes/sessions-index.js +203 -203
  209. package/dist/app/routes/site-view.js +200 -200
  210. package/dist/artifacts-document.js +4 -4
  211. package/dist/artifacts-presentation.js +7 -7
  212. package/dist/artifacts-spreadsheet.js +4 -4
  213. package/dist/artifacts.js +50 -50
  214. package/dist/automation-model.js +7 -7
  215. package/dist/automations.js +67 -67
  216. package/dist/browser-viewer-EIEMRVFF.js +23 -0
  217. package/dist/chat-interactive-block-FV37LWYZ.js +22 -0
  218. package/dist/chunk-2COBAJC7.js +818 -0
  219. package/dist/chunk-2HS3IUXE.js +170 -0
  220. package/dist/chunk-2JTMFYCT.js +296 -0
  221. package/dist/chunk-2JXKP4M6.js +114 -0
  222. package/dist/chunk-2P5K7CBH.js +269 -0
  223. package/dist/chunk-2XGRHMRI.js +250 -0
  224. package/dist/chunk-332BYSAZ.js +65 -0
  225. package/dist/chunk-3EM5GTP3.js +158 -0
  226. package/dist/chunk-3L5ATO4A.js +52 -0
  227. package/dist/chunk-3S3PJB7J.js +107 -0
  228. package/dist/chunk-3SBKYPNM.js +270 -0
  229. package/dist/chunk-3Z7VA6ET.js +114 -0
  230. package/dist/chunk-43BRJBEV.js +207 -0
  231. package/dist/chunk-46LZO4ZO.js +188 -0
  232. package/dist/chunk-46ZC5VNC.js +38 -0
  233. package/dist/chunk-4AH4EEHE.js +298 -0
  234. package/dist/chunk-4D3YJNVN.js +270 -0
  235. package/dist/chunk-4E5QVAT4.js +4480 -0
  236. package/dist/chunk-4E5QVAT4.js.map +1 -0
  237. package/dist/chunk-4I4RTI4D.js +37 -0
  238. package/dist/chunk-4KASGJTF.js +287 -0
  239. package/dist/chunk-4RUKLIOF.js +1263 -0
  240. package/dist/chunk-4UU7FN3I.js +650 -0
  241. package/dist/chunk-4VEIBNC2.js +427 -0
  242. package/dist/chunk-4VEIBNC2.js.map +1 -0
  243. package/dist/chunk-4ZRNASBF.js +2551 -0
  244. package/dist/chunk-5EJBPQI2.js +41 -0
  245. package/dist/chunk-5G4IGG7F.js +209 -0
  246. package/dist/chunk-5JAYZOAW.js +131 -0
  247. package/dist/chunk-5JOKVDSR.js +789 -0
  248. package/dist/chunk-5MP3G7ZV.js +1236 -0
  249. package/dist/chunk-5OVRMKP5.js +42 -0
  250. package/dist/chunk-5SGTRULO.js +1184 -0
  251. package/dist/chunk-5SOL4INY.js +572 -0
  252. package/dist/chunk-5Y34P32B.js +27 -0
  253. package/dist/chunk-62HIKJ5F.js +72 -0
  254. package/dist/chunk-62T2ZPD5.js +266 -0
  255. package/dist/chunk-63VNZRLY.js +386 -0
  256. package/dist/chunk-6CDBX3XG.js +33 -0
  257. package/dist/chunk-6D3D2JWY.js +278 -0
  258. package/dist/chunk-6DOIINY4.js +201 -0
  259. package/dist/chunk-6DQBUKGJ.js +112 -0
  260. package/dist/chunk-6SETNFNH.js +1399 -0
  261. package/dist/chunk-6XYFMHNT.js +56 -0
  262. package/dist/chunk-6YU3WV2P.js +33 -0
  263. package/dist/chunk-6YUHDFOZ.js +351 -0
  264. package/dist/chunk-72EOXOR7.js +1185 -0
  265. package/dist/chunk-72ND4ALI.js +532 -0
  266. package/dist/chunk-757LE32E.js +283 -0
  267. package/dist/chunk-7FDEV6XW.js +89 -0
  268. package/dist/chunk-7S2S4MXR.js +138 -0
  269. package/dist/chunk-7SYCHMXS.js +200 -0
  270. package/dist/chunk-7TVAPQOV.js +5089 -0
  271. package/dist/chunk-7UDLRDHK.js +214 -0
  272. package/dist/chunk-7YLQCMZP.js +357 -0
  273. package/dist/chunk-A5GX3CAE.js +849 -0
  274. package/dist/chunk-A7EBV2EB.js +318 -0
  275. package/dist/chunk-AB5SPXUR.js +114 -0
  276. package/dist/chunk-AHVQGL5A.js +202 -0
  277. package/dist/chunk-AI77ZKEV.js +26 -0
  278. package/dist/chunk-AIX2D6RB.js +1019 -0
  279. package/dist/chunk-AVSIHP7Q.js +192 -0
  280. package/dist/chunk-AWK23Q32.js +107 -0
  281. package/dist/chunk-AYVWA6KD.js +432 -0
  282. package/dist/chunk-AYZXE4IM.js +2553 -0
  283. package/dist/chunk-AZGGSPTE.js +124 -0
  284. package/dist/chunk-B45TB4HY.js +931 -0
  285. package/dist/chunk-BIUJHNVR.js +46 -0
  286. package/dist/chunk-BJUOKUE5.js +234 -0
  287. package/dist/chunk-BPEEVMKH.js +292 -0
  288. package/dist/chunk-BPHPAGYF.js +74 -0
  289. package/dist/chunk-BXMND6YU.js +307 -0
  290. package/dist/chunk-C6OM2SRG.js +117 -0
  291. package/dist/chunk-CIRCUDKF.js +1309 -0
  292. package/dist/chunk-CLKR4UG3.js +403 -0
  293. package/dist/chunk-CPX6BHER.js +554 -0
  294. package/dist/chunk-CVC4RO7D.js +155 -0
  295. package/dist/chunk-D3YJAQGK.js +103 -0
  296. package/dist/chunk-DFQ72BLS.js +1024 -0
  297. package/dist/chunk-DG65PJOZ.js +4564 -0
  298. package/dist/chunk-DNAXAS5R.js +406 -0
  299. package/dist/chunk-DO247ITS.js +175 -0
  300. package/dist/chunk-DONBARLL.js +154 -0
  301. package/dist/chunk-DTLXQ3ZU.js +373 -0
  302. package/dist/chunk-EAXTACI4.js +274 -0
  303. package/dist/chunk-EDPH7AJH.js +412 -0
  304. package/dist/chunk-EER3B3G5.js +10036 -0
  305. package/dist/chunk-EER3B3G5.js.map +1 -0
  306. package/dist/chunk-EFKQHCGJ.js +276 -0
  307. package/dist/chunk-EILSPMVD.js +133 -0
  308. package/dist/chunk-EK7KIETS.js +211 -0
  309. package/dist/chunk-EMWT6GOK.js +437 -0
  310. package/dist/chunk-EO22NST7.js +259 -0
  311. package/dist/chunk-ER5MYLIE.js +256 -0
  312. package/dist/chunk-ES5HKVQF.js +234 -0
  313. package/dist/chunk-EXRQ5ATC.js +738 -0
  314. package/dist/chunk-EXRQ5ATC.js.map +1 -0
  315. package/dist/chunk-F26YBYAZ.js +111 -0
  316. package/dist/chunk-F6QP4GSK.js +515 -0
  317. package/dist/chunk-F7QEO7M2.js +851 -0
  318. package/dist/chunk-FJFGDLXB.js +12 -0
  319. package/dist/chunk-FLLJ2WXW.js +113 -0
  320. package/dist/chunk-FMBJKMT4.js +107 -0
  321. package/dist/chunk-FPN4I4CG.js +3690 -0
  322. package/dist/chunk-FUXFJTXL.js +3070 -0
  323. package/dist/chunk-FZI4QOAV.js +3996 -0
  324. package/dist/chunk-FZI4QOAV.js.map +1 -0
  325. package/dist/chunk-G6SSSX5R.js +158 -0
  326. package/dist/chunk-GBGCMHBB.js +608 -0
  327. package/dist/chunk-GIHE7U3Y.js +174 -0
  328. package/dist/chunk-GJ4GTYOD.js +372 -0
  329. package/dist/chunk-GLSDWNFV.js +432 -0
  330. package/dist/chunk-GMGAW3T6.js +278 -0
  331. package/dist/chunk-GNGI6XFN.js +43 -0
  332. package/dist/chunk-GO5VIAA7.js +264 -0
  333. package/dist/chunk-GSW4YHZE.js +229 -0
  334. package/dist/chunk-GUC6IWEY.js +407 -0
  335. package/dist/chunk-GWAY3SO5.js +15 -0
  336. package/dist/chunk-GXOTNT5D.js +168 -0
  337. package/dist/chunk-GZZCVF76.js +3851 -0
  338. package/dist/chunk-H4VMHFOX.js +214 -0
  339. package/dist/chunk-HA5RFQAF.js +110 -0
  340. package/dist/chunk-HFROJDFQ.js +118 -0
  341. package/dist/chunk-HHFFPE67.js +220 -0
  342. package/dist/chunk-HJLHGXWL.js +103 -0
  343. package/dist/chunk-HKNMNL7B.js +2984 -0
  344. package/dist/chunk-HT7MBHLY.js +1021 -0
  345. package/dist/chunk-I5FSUZVW.js +584 -0
  346. package/dist/chunk-IINQO425.js +246 -0
  347. package/dist/chunk-IIXNEOK4.js +1022 -0
  348. package/dist/chunk-IM3WA5AL.js +311 -0
  349. package/dist/chunk-IX4P4OGR.js +399 -0
  350. package/dist/chunk-IX5VHZYS.js +129 -0
  351. package/dist/chunk-JB3TSUZO.js +263 -0
  352. package/dist/chunk-JIC6RLUB.js +27 -0
  353. package/dist/chunk-JNJIZCTN.js +172 -0
  354. package/dist/chunk-JNV5ZPUV.js +828 -0
  355. package/dist/chunk-JPQFVR24.js +50 -0
  356. package/dist/chunk-JPZVMXDP.js +1333 -0
  357. package/dist/chunk-JVPF34MX.js +215 -0
  358. package/dist/chunk-KED67KAF.js +85 -0
  359. package/dist/chunk-KJ72GMZ2.js +378 -0
  360. package/dist/chunk-KTGKGHEA.js +75 -0
  361. package/dist/chunk-KU77XHWB.js +285 -0
  362. package/dist/chunk-KVPQUADA.js +5915 -0
  363. package/dist/chunk-KVPQUADA.js.map +1 -0
  364. package/dist/chunk-KXBLLFOO.js +249 -0
  365. package/dist/chunk-L6WVCO6D.js +61 -0
  366. package/dist/chunk-LIOZ2MXJ.js +380 -0
  367. package/dist/chunk-LIOZ2MXJ.js.map +1 -0
  368. package/dist/chunk-LPEFULJY.js +73 -0
  369. package/dist/chunk-LRMGPO7E.js +98 -0
  370. package/dist/chunk-LVKTKORH.js +121 -0
  371. package/dist/chunk-MCPKUVMQ.js +99 -0
  372. package/dist/chunk-MFLU3466.js +99 -0
  373. package/dist/chunk-MIUJ3EH5.js +60 -0
  374. package/dist/chunk-MIUMNTIJ.js +175 -0
  375. package/dist/chunk-ML46TXRM.js +113 -0
  376. package/dist/chunk-MO3XJQN2.js +629 -0
  377. package/dist/chunk-MQRHTOQ2.js +218 -0
  378. package/dist/chunk-MVYQDBE6.js +79 -0
  379. package/dist/chunk-NE5P7LFQ.js +100 -0
  380. package/dist/chunk-NIPON7YB.js +850 -0
  381. package/dist/chunk-NIPON7YB.js.map +1 -0
  382. package/dist/chunk-NPBEUU22.js +196 -0
  383. package/dist/chunk-NSXKGS2K.js +178 -0
  384. package/dist/chunk-NUEFORM6.js +2317 -0
  385. package/dist/chunk-NZOFNQNC.js +176 -0
  386. package/dist/chunk-O664PL2U.js +47 -0
  387. package/dist/chunk-O664PL2U.js.map +1 -0
  388. package/dist/chunk-OATXCLTY.js +211 -0
  389. package/dist/chunk-OG3ELROW.js +538 -0
  390. package/dist/chunk-OI4WS7FW.js +162 -0
  391. package/dist/chunk-OITGZUDC.js +82 -0
  392. package/dist/chunk-OKD2LBMK.js +333 -0
  393. package/dist/chunk-OLFOGAWU.js +273 -0
  394. package/dist/chunk-OLFOGAWU.js.map +1 -0
  395. package/dist/chunk-OSA4CGST.js +134 -0
  396. package/dist/chunk-OXYAKUFU.js +401 -0
  397. package/dist/chunk-OYMSMU5O.js +396 -0
  398. package/dist/chunk-P4NZ72KY.js +162 -0
  399. package/dist/chunk-PBYL2VIM.js +379 -0
  400. package/dist/chunk-PDW3OOSZ.js +505 -0
  401. package/dist/chunk-PGRKTQIW.js +523 -0
  402. package/dist/chunk-PPQJIVGM.js +175 -0
  403. package/dist/chunk-PYMQM65Y.js +125 -0
  404. package/dist/chunk-Q273Q33U.js +166 -0
  405. package/dist/chunk-Q4CLS2HL.js +340 -0
  406. package/dist/chunk-QA5UNVHD.js +85 -0
  407. package/dist/chunk-QFOBUA2J.js +428 -0
  408. package/dist/chunk-QLIM4D56.js +1095 -0
  409. package/dist/chunk-QMQF5U2D.js +20 -0
  410. package/dist/chunk-QNOWKKZ4.js +40 -0
  411. package/dist/chunk-QPOUPVPD.js +144 -0
  412. package/dist/chunk-QTJAQ6DS.js +48 -0
  413. package/dist/chunk-QUOFP3G7.js +404 -0
  414. package/dist/chunk-QVOTPOXK.js +29 -0
  415. package/dist/chunk-QYZ5RVGM.js +184 -0
  416. package/dist/chunk-R7CVDKRN.js +2580 -0
  417. package/dist/chunk-RB7MXNZD.js +639 -0
  418. package/dist/chunk-RDZQFZOQ.js +187 -0
  419. package/dist/chunk-RIHKEGWS.js +194 -0
  420. package/dist/chunk-ROSB7GF6.js +57 -0
  421. package/dist/chunk-RP3YMYCX.js +723 -0
  422. package/dist/chunk-RPHXJHNX.js +271 -0
  423. package/dist/chunk-RVC3M66H.js +191 -0
  424. package/dist/chunk-S3OTJAAC.js +283 -0
  425. package/dist/chunk-SBWPMVRN.js +56 -0
  426. package/dist/chunk-SERECSAR.js +138 -0
  427. package/dist/chunk-SHSEF3GJ.js +187 -0
  428. package/dist/chunk-SMS2M3RG.js +772 -0
  429. package/dist/chunk-SRDHDIRQ.js +177 -0
  430. package/dist/chunk-SXRYA7NN.js +389 -0
  431. package/dist/chunk-SYA3WYG4.js +1187 -0
  432. package/dist/chunk-SYYFA7W7.js +23 -0
  433. package/dist/chunk-T2QDSTBH.js +371 -0
  434. package/dist/chunk-TFSCGFYV.js +251 -0
  435. package/dist/chunk-TGCKZOSX.js +246 -0
  436. package/dist/chunk-THILLYQM.js +132 -0
  437. package/dist/chunk-TI6LGUEZ.js +2412 -0
  438. package/dist/chunk-TSY6YZL2.js +366 -0
  439. package/dist/chunk-TW2RHTLH.js +3321 -0
  440. package/dist/chunk-TWA5G277.js +141 -0
  441. package/dist/chunk-TZZ2S4XI.js +247 -0
  442. package/dist/chunk-U5D3K53R.js +58 -0
  443. package/dist/chunk-UECD27LX.js +251 -0
  444. package/dist/chunk-UFJDETKG.js +108 -0
  445. package/dist/chunk-UHCFYX4I.js +570 -0
  446. package/dist/chunk-UHTURYJO.js +898 -0
  447. package/dist/chunk-UJH63JT3.js +67 -0
  448. package/dist/chunk-UOLDS6S5.js +1152 -0
  449. package/dist/chunk-UUE3OGXI.js +84 -0
  450. package/dist/chunk-UUNJ2E57.js +391 -0
  451. package/dist/chunk-UYQVWRAH.js +199 -0
  452. package/dist/chunk-UYWVK7JQ.js +234 -0
  453. package/dist/chunk-UYWWUEL4.js +126 -0
  454. package/dist/chunk-V4CQKX5H.js +48 -0
  455. package/dist/chunk-V4QM7GDQ.js +3176 -0
  456. package/dist/chunk-V5Y74WII.js +91 -0
  457. package/dist/chunk-VGGZLUQK.js +129 -0
  458. package/dist/chunk-VGX636MB.js +311 -0
  459. package/dist/chunk-VGZLFQO2.js +773 -0
  460. package/dist/chunk-VJWZATNF.js +137 -0
  461. package/dist/chunk-VMWCIC2N.js +50 -0
  462. package/dist/chunk-VPWKTIU5.js +227 -0
  463. package/dist/chunk-VXOLG6YB.js +469 -0
  464. package/dist/chunk-W2NAU5VB.js +1628 -0
  465. package/dist/chunk-WGORKMR3.js +353 -0
  466. package/dist/chunk-WMIDELSJ.js +391 -0
  467. package/dist/chunk-WSOSGL2G.js +383 -0
  468. package/dist/chunk-WXUUOM4X.js +400 -0
  469. package/dist/chunk-WZ74QHLE.js +4863 -0
  470. package/dist/chunk-X2OWM2ME.js +1870 -0
  471. package/dist/chunk-X6UMGG4T.js +68 -0
  472. package/dist/chunk-XDXKB25W.js +93 -0
  473. package/dist/chunk-XE4PHI74.js +231 -0
  474. package/dist/chunk-XHF2XNU5.js +73 -0
  475. package/dist/chunk-XLJ4SQFS.js +230 -0
  476. package/dist/chunk-XOD4FX6M.js +2434 -0
  477. package/dist/chunk-XODQ2GPF.js +3110 -0
  478. package/dist/chunk-XT54RTAM.js +441 -0
  479. package/dist/chunk-YAVW5OJ5.js +131 -0
  480. package/dist/chunk-YDQHFJM2.js +83 -0
  481. package/dist/chunk-YH6O6OQ6.js +1356 -0
  482. package/dist/chunk-YIKPC2QP.js +794 -0
  483. package/dist/chunk-ZD7PKYC4.js +335 -0
  484. package/dist/chunk-ZEQYHEWP.js +406 -0
  485. package/dist/chunk-ZMYL6DTE.js +225 -0
  486. package/dist/chunk-ZP3QCPYG.js +21 -0
  487. package/dist/chunk-ZRVUCTSI.js +265 -0
  488. package/dist/chunk-ZSI3ITRK.js +449 -0
  489. package/dist/chunk-ZZMEQCIZ.js +236 -0
  490. package/dist/composer.js +36 -36
  491. package/dist/computer-viewer-ZBY3BPYW.js +21 -0
  492. package/dist/connect.js +29 -29
  493. package/dist/connection-step-up-JQ4OFSQN.js +145 -0
  494. package/dist/desktop-dictation.js +24 -24
  495. package/dist/desktop.js +2 -2
  496. package/dist/editor.js +2 -2
  497. package/dist/embedded-new-voice-ZB5XLKLU.js +25 -0
  498. package/dist/embedded-voice-MZJISDCS.js +25 -0
  499. package/dist/fleet-decision-row-LG3SYVR3.js +361 -0
  500. package/dist/human-input-model.d.ts +2 -0
  501. package/dist/in-chat-connect-model.js +6 -6
  502. package/dist/index.js +298 -298
  503. package/dist/interaction.js +9 -9
  504. package/dist/latest-question-QWJTXMFA.js +1 -1
  505. package/dist/machine-request-model.js +1 -1
  506. package/dist/machines.js +8 -8
  507. package/dist/meetings-recorder.js +1 -1
  508. package/dist/meetings.js +122 -122
  509. package/dist/messages/en.d.ts +10 -0
  510. package/dist/messages.js +1 -1
  511. package/dist/model-levels.js +2 -2
  512. package/dist/model-picker-model.js +2 -2
  513. package/dist/model-policy-picker-menu-5Y72PLNF.js +23 -0
  514. package/dist/model-policy.js +1 -1
  515. package/dist/payment-page-card-YPSXRHBA.js +226 -0
  516. package/dist/platform-activity-row-ZU4MEBNK.js +156 -0
  517. package/dist/queue-surface-implementation-6Q25RPH6.js +932 -0
  518. package/dist/realtime.js +17 -17
  519. package/dist/recorder-host-JD4GWJ2Z.js +80 -0
  520. package/dist/recordings.js +3 -3
  521. package/dist/sandbox-files-HCLEEJMU.js +28 -0
  522. package/dist/session-app.js +406 -406
  523. package/dist/session-connect-cards-DRKEN3Z4.js +27 -0
  524. package/dist/session-list-model.js +3 -3
  525. package/dist/session-realtime-IZOTTRH6.js +30 -0
  526. package/dist/session-realtime.js +2 -2
  527. package/dist/session-ui.js +95 -95
  528. package/dist/session.js +42 -42
  529. package/dist/sites.js +3 -3
  530. package/dist/terminal.js +2 -2
  531. package/dist/this-computer.js +3 -3
  532. package/dist/timeline-annotation-markers-WWXNJOXI.js +157 -0
  533. package/dist/timeline-annotation-selection-ZKRIQFIQ.js +208 -0
  534. package/dist/timeline-annotations-dialog-4IMKTOXJ.js +283 -0
  535. package/dist/timeline-model.js +58 -58
  536. package/dist/ui/access-list.js +19 -19
  537. package/dist/ui/cadence-picker.js +7 -7
  538. package/dist/ui/choice-cards.js +3 -3
  539. package/dist/ui/confirm-dialog.js +2 -2
  540. package/dist/ui/copy-field.js +3 -3
  541. package/dist/ui/detail-page.js +6 -6
  542. package/dist/ui/detail-sheet.js +6 -6
  543. package/dist/ui/diff-view.js +2 -2
  544. package/dist/ui/disclosure.js +7 -7
  545. package/dist/ui/email-chips-input.js +3 -3
  546. package/dist/ui/field.js +2 -2
  547. package/dist/ui/flush-form-page.js +6 -6
  548. package/dist/ui/form-dialog.js +5 -5
  549. package/dist/ui/list-row.js +7 -7
  550. package/dist/ui/load-failure.js +3 -3
  551. package/dist/ui/relative-time.js +3 -3
  552. package/dist/ui/revision-history.js +10 -10
  553. package/dist/ui/role-select.js +10 -10
  554. package/dist/ui/select-menu.js +5 -5
  555. package/dist/ui/settings-nav.js +6 -6
  556. package/dist/ui/sheet.js +2 -2
  557. package/dist/ui/usage-meter.js +4 -4
  558. package/dist/usage.js +3 -3
  559. package/dist/workbench.js +11 -11
  560. package/package.json +5 -6
  561. package/src/components/secret-question-field.tsx +2 -1
  562. package/src/human-input-model.ts +53 -12
  563. package/src/messages/en.ts +10 -0
  564. package/src/model-policy.ts +3 -1
  565. package/dist/browser-viewer-WGRM3JME.js +0 -23
  566. package/dist/chat-interactive-block-5E3UQYHO.js +0 -22
  567. package/dist/chunk-26KK6DN5.js +0 -41
  568. package/dist/chunk-272XEENJ.js +0 -100
  569. package/dist/chunk-2AU2S5NP.js +0 -772
  570. package/dist/chunk-2L7TCAO4.js +0 -188
  571. package/dist/chunk-2MXP6ZRP.js +0 -1095
  572. package/dist/chunk-2Q4XBV3J.js +0 -113
  573. package/dist/chunk-2U5ZJMNP.js +0 -386
  574. package/dist/chunk-2VHPKSFK.js +0 -1236
  575. package/dist/chunk-2WF5XIPA.js +0 -48
  576. package/dist/chunk-2Y53MMGA.js +0 -56
  577. package/dist/chunk-2ZR75AUO.js +0 -225
  578. package/dist/chunk-33QC4RN7.js +0 -133
  579. package/dist/chunk-35LBFD5I.js +0 -311
  580. package/dist/chunk-37J3ZX2N.js +0 -270
  581. package/dist/chunk-37SXZVSY.js +0 -380
  582. package/dist/chunk-37SXZVSY.js.map +0 -1
  583. package/dist/chunk-3ITEAD3E.js +0 -639
  584. package/dist/chunk-3JBLX5BN.js +0 -629
  585. package/dist/chunk-3JYID53J.js +0 -432
  586. package/dist/chunk-3MZCXSC7.js +0 -723
  587. package/dist/chunk-3NRJ4Z3A.js +0 -3176
  588. package/dist/chunk-3UG2AJHR.js +0 -89
  589. package/dist/chunk-3XS3A6Y6.js +0 -162
  590. package/dist/chunk-3ZBQIZEM.js +0 -214
  591. package/dist/chunk-3ZVACRTK.js +0 -82
  592. package/dist/chunk-46USHCHK.js +0 -389
  593. package/dist/chunk-4IMVT7OU.js +0 -263
  594. package/dist/chunk-4J4IPUPZ.js +0 -103
  595. package/dist/chunk-4PG2BEQA.js +0 -175
  596. package/dist/chunk-4YQFDBKE.js +0 -532
  597. package/dist/chunk-5ERDSF2C.js +0 -79
  598. package/dist/chunk-5EZELID5.js +0 -789
  599. package/dist/chunk-5NGW5K2D.js +0 -1333
  600. package/dist/chunk-5SK5PYFN.js +0 -15
  601. package/dist/chunk-5UI3VPCY.js +0 -1152
  602. package/dist/chunk-5W4ZGFXZ.js +0 -373
  603. package/dist/chunk-64XZTYX4.js +0 -572
  604. package/dist/chunk-67MFNMGH.js +0 -200
  605. package/dist/chunk-6C55RLFY.js +0 -103
  606. package/dist/chunk-6DFHNNWJ.js +0 -121
  607. package/dist/chunk-6F34IWSA.js +0 -47
  608. package/dist/chunk-6F34IWSA.js.map +0 -1
  609. package/dist/chunk-6FWBGVFL.js +0 -5905
  610. package/dist/chunk-6FWBGVFL.js.map +0 -1
  611. package/dist/chunk-6GBJFFQL.js +0 -215
  612. package/dist/chunk-6H2OQ6XG.js +0 -318
  613. package/dist/chunk-6LUF4TOE.js +0 -91
  614. package/dist/chunk-6M2WXQX5.js +0 -523
  615. package/dist/chunk-6O6CHBD3.js +0 -29
  616. package/dist/chunk-6U3PE427.js +0 -794
  617. package/dist/chunk-6V2UH36U.js +0 -187
  618. package/dist/chunk-73YALMGG.js +0 -1022
  619. package/dist/chunk-7JNWIGM4.js +0 -1628
  620. package/dist/chunk-7QODDTOI.js +0 -554
  621. package/dist/chunk-7TEXZ5LW.js +0 -46
  622. package/dist/chunk-A4SKSSSS.js +0 -2553
  623. package/dist/chunk-A7Z65D33.js +0 -400
  624. package/dist/chunk-ACUDUVDJ.js +0 -231
  625. package/dist/chunk-AI7XM4MY.js +0 -194
  626. package/dist/chunk-AJEOTFQE.js +0 -234
  627. package/dist/chunk-AKQSOR4G.js +0 -538
  628. package/dist/chunk-AP4FMXAM.js +0 -353
  629. package/dist/chunk-AQHQUPEF.js +0 -202
  630. package/dist/chunk-ATVSG5CO.js +0 -296
  631. package/dist/chunk-B6YDINPE.js +0 -68
  632. package/dist/chunk-BMOYN4HY.js +0 -283
  633. package/dist/chunk-BMSMK7SA.js +0 -84
  634. package/dist/chunk-BY7AWWDB.js +0 -177
  635. package/dist/chunk-BZ4GSY44.js +0 -2412
  636. package/dist/chunk-CGYPX3HJ.js +0 -292
  637. package/dist/chunk-CHYAUIZ3.js +0 -2984
  638. package/dist/chunk-CJEQQBNZ.js +0 -818
  639. package/dist/chunk-CP53LM7W.js +0 -1021
  640. package/dist/chunk-CQW4ZPU4.js +0 -191
  641. package/dist/chunk-CTKUOOU4.js +0 -246
  642. package/dist/chunk-CWKFPDYB.js +0 -124
  643. package/dist/chunk-CYBRD5BP.js +0 -113
  644. package/dist/chunk-CYPMAJ75.js +0 -449
  645. package/dist/chunk-CYPNXHWM.js +0 -379
  646. package/dist/chunk-D45IDQBW.js +0 -114
  647. package/dist/chunk-D4RTU236.js +0 -230
  648. package/dist/chunk-DBGOJIMM.js +0 -399
  649. package/dist/chunk-DD3DT5MY.js +0 -3321
  650. package/dist/chunk-DG3GW325.js +0 -72
  651. package/dist/chunk-DHLGGANG.js +0 -50
  652. package/dist/chunk-DHZW6JXQ.js +0 -10035
  653. package/dist/chunk-DHZW6JXQ.js.map +0 -1
  654. package/dist/chunk-DLHR7HHS.js +0 -931
  655. package/dist/chunk-DM7JLUWN.js +0 -406
  656. package/dist/chunk-DMQY35LC.js +0 -98
  657. package/dist/chunk-EBVL3YJQ.js +0 -67
  658. package/dist/chunk-EIQQYUOT.js +0 -274
  659. package/dist/chunk-EMART4X3.js +0 -107
  660. package/dist/chunk-EMJSJTIE.js +0 -207
  661. package/dist/chunk-ES3JAYQJ.js +0 -214
  662. package/dist/chunk-EWJ7WEZT.js +0 -175
  663. package/dist/chunk-FC6MLU5C.js +0 -52
  664. package/dist/chunk-FD6F2OE5.js +0 -515
  665. package/dist/chunk-FE4HNBHF.js +0 -48
  666. package/dist/chunk-FFXJF5KU.js +0 -201
  667. package/dist/chunk-FN5UTQSL.js +0 -117
  668. package/dist/chunk-FT4ZKYTG.js +0 -138
  669. package/dist/chunk-FYOGQHCD.js +0 -209
  670. package/dist/chunk-FZOK37SC.js +0 -155
  671. package/dist/chunk-GA42NSDJ.js +0 -132
  672. package/dist/chunk-GDWKVSMK.js +0 -372
  673. package/dist/chunk-GH3Q5XW4.js +0 -2551
  674. package/dist/chunk-GHLUZSIB.js +0 -259
  675. package/dist/chunk-GISBCT5E.js +0 -366
  676. package/dist/chunk-GKA5LFYR.js +0 -21
  677. package/dist/chunk-GPRM5GYZ.js +0 -131
  678. package/dist/chunk-GWJLR55B.js +0 -333
  679. package/dist/chunk-GX3RAB4W.js +0 -357
  680. package/dist/chunk-GYNTJYWY.js +0 -166
  681. package/dist/chunk-GYWQ4KVM.js +0 -85
  682. package/dist/chunk-H2AOQJQP.js +0 -378
  683. package/dist/chunk-H35G5UHL.js +0 -111
  684. package/dist/chunk-H6PJEWZH.js +0 -170
  685. package/dist/chunk-HHUTU5EN.js +0 -108
  686. package/dist/chunk-HPH3MFFE.js +0 -3996
  687. package/dist/chunk-HPH3MFFE.js.map +0 -1
  688. package/dist/chunk-HQZ6NGUU.js +0 -114
  689. package/dist/chunk-HSEHIVAE.js +0 -4564
  690. package/dist/chunk-HTYDPAJL.js +0 -391
  691. package/dist/chunk-HUKGLWAY.js +0 -174
  692. package/dist/chunk-HUTQJY3F.js +0 -23
  693. package/dist/chunk-HUWJZRD3.js +0 -311
  694. package/dist/chunk-HVL7TCB5.js +0 -50
  695. package/dist/chunk-HWOYJOKK.js +0 -266
  696. package/dist/chunk-HXANXMPH.js +0 -3851
  697. package/dist/chunk-HZBPL4KB.js +0 -244
  698. package/dist/chunk-HZBPL4KB.js.map +0 -1
  699. package/dist/chunk-I4CXHN6E.js +0 -269
  700. package/dist/chunk-I6YOCSEP.js +0 -37
  701. package/dist/chunk-IAXF3IO6.js +0 -1399
  702. package/dist/chunk-IGUPUA3G.js +0 -403
  703. package/dist/chunk-IKAVNCO5.js +0 -112
  704. package/dist/chunk-IMWP2Q4W.js +0 -137
  705. package/dist/chunk-IXPLYZFO.js +0 -40
  706. package/dist/chunk-J3CHK7NH.js +0 -12
  707. package/dist/chunk-JAC5I2BN.js +0 -85
  708. package/dist/chunk-JK2WTBLD.js +0 -158
  709. package/dist/chunk-JOKNFHFU.js +0 -412
  710. package/dist/chunk-JOVCPP44.js +0 -441
  711. package/dist/chunk-JTRRMV7B.js +0 -469
  712. package/dist/chunk-K2WDXLZS.js +0 -134
  713. package/dist/chunk-K6JW7GB3.js +0 -828
  714. package/dist/chunk-KA5H2Z3E.js +0 -168
  715. package/dist/chunk-KQBVH5LN.js +0 -229
  716. package/dist/chunk-KQVHSEQQ.js +0 -20
  717. package/dist/chunk-KREVCOE7.js +0 -187
  718. package/dist/chunk-KYDLVMKA.js +0 -99
  719. package/dist/chunk-L4PIAAQB.js +0 -4863
  720. package/dist/chunk-L64LMYJD.js +0 -114
  721. package/dist/chunk-L7XVC27Z.js +0 -850
  722. package/dist/chunk-L7XVC27Z.js.map +0 -1
  723. package/dist/chunk-L7ZLPS37.js +0 -371
  724. package/dist/chunk-LDZSUY7K.js +0 -298
  725. package/dist/chunk-LK3AAMN7.js +0 -404
  726. package/dist/chunk-LLVJ3P2N.js +0 -428
  727. package/dist/chunk-LPHBZCCV.js +0 -1263
  728. package/dist/chunk-LT3MK2XP.js +0 -608
  729. package/dist/chunk-M72GFKDP.js +0 -335
  730. package/dist/chunk-M73QQXUQ.js +0 -270
  731. package/dist/chunk-M7NPDODK.js +0 -1870
  732. package/dist/chunk-MB5EK2PA.js +0 -211
  733. package/dist/chunk-MB5WRIYX.js +0 -33
  734. package/dist/chunk-MBYHDOTU.js +0 -42
  735. package/dist/chunk-MDIHQGPV.js +0 -276
  736. package/dist/chunk-MQFJPFL4.js +0 -5089
  737. package/dist/chunk-MU6IU4IH.js +0 -650
  738. package/dist/chunk-N7IOCNWK.js +0 -1019
  739. package/dist/chunk-NDJPEX7P.js +0 -1187
  740. package/dist/chunk-NLKHAZMG.js +0 -898
  741. package/dist/chunk-NLYAWFDY.js +0 -199
  742. package/dist/chunk-NNIUBJOE.js +0 -154
  743. package/dist/chunk-NSBOITEM.js +0 -175
  744. package/dist/chunk-NUZNJSL5.js +0 -285
  745. package/dist/chunk-NZFMEGPE.js +0 -287
  746. package/dist/chunk-O4UAH7WR.js +0 -427
  747. package/dist/chunk-O4UAH7WR.js.map +0 -1
  748. package/dist/chunk-O4VCJWKV.js +0 -176
  749. package/dist/chunk-OE4QJJ4C.js +0 -432
  750. package/dist/chunk-OQEAJGAJ.js +0 -65
  751. package/dist/chunk-ORSFNFNY.js +0 -1184
  752. package/dist/chunk-OU2J6K3L.js +0 -129
  753. package/dist/chunk-OVAT4PIR.js +0 -437
  754. package/dist/chunk-OWF2AVT6.js +0 -407
  755. package/dist/chunk-P2OHWZMB.js +0 -256
  756. package/dist/chunk-PCSRHFRF.js +0 -75
  757. package/dist/chunk-PH2FDKJE.js +0 -250
  758. package/dist/chunk-PMBZMVKE.js +0 -33
  759. package/dist/chunk-PNLVWZSM.js +0 -211
  760. package/dist/chunk-PQ7WJAKL.js +0 -74
  761. package/dist/chunk-PTSRBKQC.js +0 -118
  762. package/dist/chunk-PTUIF4TT.js +0 -144
  763. package/dist/chunk-PV7X4PRR.js +0 -570
  764. package/dist/chunk-Q35LFE7H.js +0 -26
  765. package/dist/chunk-QAHGGBL2.js +0 -1024
  766. package/dist/chunk-QI5RXPYP.js +0 -56
  767. package/dist/chunk-QODAMEOR.js +0 -2317
  768. package/dist/chunk-QXOO5U46.js +0 -172
  769. package/dist/chunk-R6OBJ7LF.js +0 -131
  770. package/dist/chunk-R6WQLIFX.js +0 -73
  771. package/dist/chunk-R7SBV5KD.js +0 -3690
  772. package/dist/chunk-R7ZIFQ7D.js +0 -738
  773. package/dist/chunk-R7ZIFQ7D.js.map +0 -1
  774. package/dist/chunk-RFBJ6TUL.js +0 -43
  775. package/dist/chunk-RLNJSAHP.js +0 -851
  776. package/dist/chunk-RMVKH4EE.js +0 -351
  777. package/dist/chunk-RO2UO3VN.js +0 -107
  778. package/dist/chunk-ROCQ3IDW.js +0 -184
  779. package/dist/chunk-RPWI6A3H.js +0 -849
  780. package/dist/chunk-RTJVIXH5.js +0 -141
  781. package/dist/chunk-RZ5IQ3SX.js +0 -278
  782. package/dist/chunk-S7NX6KSE.js +0 -406
  783. package/dist/chunk-SFWP4DNI.js +0 -218
  784. package/dist/chunk-SI2RFGQX.js +0 -158
  785. package/dist/chunk-SKHYIIH4.js +0 -107
  786. package/dist/chunk-SOC5IBQT.js +0 -383
  787. package/dist/chunk-SUMBC7BQ.js +0 -396
  788. package/dist/chunk-T4UTYGB2.js +0 -110
  789. package/dist/chunk-T6N33M46.js +0 -251
  790. package/dist/chunk-TD5EKKVD.js +0 -83
  791. package/dist/chunk-TGG3ODCS.js +0 -99
  792. package/dist/chunk-TGVTVLNI.js +0 -401
  793. package/dist/chunk-TLTE3QSX.js +0 -73
  794. package/dist/chunk-TXAMGOUG.js +0 -2580
  795. package/dist/chunk-U4OIE2MJ.js +0 -271
  796. package/dist/chunk-UBTDG6GC.js +0 -126
  797. package/dist/chunk-UFRXYZCJ.js +0 -125
  798. package/dist/chunk-UHU2WESP.js +0 -340
  799. package/dist/chunk-UKDLZ76A.js +0 -2434
  800. package/dist/chunk-UPRN4FBY.js +0 -38
  801. package/dist/chunk-UQDT3SM2.js +0 -27
  802. package/dist/chunk-UQFUI3KT.js +0 -3070
  803. package/dist/chunk-UXBW2TYH.js +0 -1356
  804. package/dist/chunk-UXZLTAJO.js +0 -227
  805. package/dist/chunk-UZAVFOZC.js +0 -505
  806. package/dist/chunk-V2A4I4GC.js +0 -265
  807. package/dist/chunk-VAN6CEAV.js +0 -234
  808. package/dist/chunk-VDHWFRTL.js +0 -58
  809. package/dist/chunk-VLDKWGHD.js +0 -61
  810. package/dist/chunk-W4ABZ6XO.js +0 -4480
  811. package/dist/chunk-W4ABZ6XO.js.map +0 -1
  812. package/dist/chunk-W4TOPPVT.js +0 -162
  813. package/dist/chunk-W7P44UAE.js +0 -278
  814. package/dist/chunk-WAVR3UIC.js +0 -773
  815. package/dist/chunk-WLRB74VH.js +0 -251
  816. package/dist/chunk-WOVGVEKP.js +0 -192
  817. package/dist/chunk-WQ35KUFP.js +0 -264
  818. package/dist/chunk-WSBUFP77.js +0 -391
  819. package/dist/chunk-X56NEOYY.js +0 -283
  820. package/dist/chunk-XET2K3TU.js +0 -138
  821. package/dist/chunk-XJPDGFVT.js +0 -307
  822. package/dist/chunk-XK4VFZHQ.js +0 -246
  823. package/dist/chunk-XVP23IJS.js +0 -236
  824. package/dist/chunk-YEU2JC3B.js +0 -27
  825. package/dist/chunk-YFU2VZXS.js +0 -249
  826. package/dist/chunk-YMY2OO3V.js +0 -584
  827. package/dist/chunk-YNRZN3TU.js +0 -57
  828. package/dist/chunk-YP4SNX4P.js +0 -220
  829. package/dist/chunk-YSZAX6WJ.js +0 -196
  830. package/dist/chunk-YTUVANLR.js +0 -93
  831. package/dist/chunk-YUEYZTBP.js +0 -1309
  832. package/dist/chunk-YUVS7HYN.js +0 -129
  833. package/dist/chunk-YVQUPHYL.js +0 -234
  834. package/dist/chunk-YW4YRCXI.js +0 -3110
  835. package/dist/chunk-YZ2G24VJ.js +0 -1185
  836. package/dist/chunk-ZBTYTG4E.js +0 -247
  837. package/dist/chunk-ZCQJUYDX.js +0 -178
  838. package/dist/chunk-ZD67RM6G.js +0 -60
  839. package/dist/computer-viewer-BWWVUD6J.js +0 -21
  840. package/dist/connection-step-up-7ICLBORD.js +0 -145
  841. package/dist/embedded-new-voice-VD6GR5JQ.js +0 -25
  842. package/dist/embedded-voice-J2B6J2QQ.js +0 -25
  843. package/dist/fleet-decision-row-B672XMNG.js +0 -361
  844. package/dist/model-policy-picker-menu-HT3TWGSS.js +0 -23
  845. package/dist/payment-page-card-4LZPJ3OK.js +0 -226
  846. package/dist/platform-activity-row-TWXWUCXD.js +0 -156
  847. package/dist/queue-surface-implementation-SQ7K2TM4.js +0 -932
  848. package/dist/recorder-host-N2S7G3CW.js +0 -80
  849. package/dist/sandbox-files-6CKWJ2CU.js +0 -28
  850. package/dist/session-connect-cards-VNQWMX7A.js +0 -27
  851. package/dist/session-realtime-CRG7DRV6.js +0 -30
  852. package/dist/timeline-annotation-markers-JXCNK4S6.js +0 -157
  853. package/dist/timeline-annotation-selection-5ZTVYJXT.js +0 -208
  854. package/dist/timeline-annotations-dialog-4QWVCZCF.js +0 -283
  855. /package/dist/{browser-viewer-WGRM3JME.js.map → browser-viewer-EIEMRVFF.js.map} +0 -0
  856. /package/dist/{chat-interactive-block-5E3UQYHO.js.map → chat-interactive-block-FV37LWYZ.js.map} +0 -0
  857. /package/dist/{chunk-CJEQQBNZ.js.map → chunk-2COBAJC7.js.map} +0 -0
  858. /package/dist/{chunk-H6PJEWZH.js.map → chunk-2HS3IUXE.js.map} +0 -0
  859. /package/dist/{chunk-ATVSG5CO.js.map → chunk-2JTMFYCT.js.map} +0 -0
  860. /package/dist/{chunk-L64LMYJD.js.map → chunk-2JXKP4M6.js.map} +0 -0
  861. /package/dist/{chunk-I4CXHN6E.js.map → chunk-2P5K7CBH.js.map} +0 -0
  862. /package/dist/{chunk-PH2FDKJE.js.map → chunk-2XGRHMRI.js.map} +0 -0
  863. /package/dist/{chunk-OQEAJGAJ.js.map → chunk-332BYSAZ.js.map} +0 -0
  864. /package/dist/{chunk-SI2RFGQX.js.map → chunk-3EM5GTP3.js.map} +0 -0
  865. /package/dist/{chunk-FC6MLU5C.js.map → chunk-3L5ATO4A.js.map} +0 -0
  866. /package/dist/{chunk-SKHYIIH4.js.map → chunk-3S3PJB7J.js.map} +0 -0
  867. /package/dist/{chunk-37J3ZX2N.js.map → chunk-3SBKYPNM.js.map} +0 -0
  868. /package/dist/{chunk-D45IDQBW.js.map → chunk-3Z7VA6ET.js.map} +0 -0
  869. /package/dist/{chunk-EMJSJTIE.js.map → chunk-43BRJBEV.js.map} +0 -0
  870. /package/dist/{chunk-2L7TCAO4.js.map → chunk-46LZO4ZO.js.map} +0 -0
  871. /package/dist/{chunk-UPRN4FBY.js.map → chunk-46ZC5VNC.js.map} +0 -0
  872. /package/dist/{chunk-LDZSUY7K.js.map → chunk-4AH4EEHE.js.map} +0 -0
  873. /package/dist/{chunk-M73QQXUQ.js.map → chunk-4D3YJNVN.js.map} +0 -0
  874. /package/dist/{chunk-I6YOCSEP.js.map → chunk-4I4RTI4D.js.map} +0 -0
  875. /package/dist/{chunk-NZFMEGPE.js.map → chunk-4KASGJTF.js.map} +0 -0
  876. /package/dist/{chunk-LPHBZCCV.js.map → chunk-4RUKLIOF.js.map} +0 -0
  877. /package/dist/{chunk-MU6IU4IH.js.map → chunk-4UU7FN3I.js.map} +0 -0
  878. /package/dist/{chunk-GH3Q5XW4.js.map → chunk-4ZRNASBF.js.map} +0 -0
  879. /package/dist/{chunk-26KK6DN5.js.map → chunk-5EJBPQI2.js.map} +0 -0
  880. /package/dist/{chunk-FYOGQHCD.js.map → chunk-5G4IGG7F.js.map} +0 -0
  881. /package/dist/{chunk-GPRM5GYZ.js.map → chunk-5JAYZOAW.js.map} +0 -0
  882. /package/dist/{chunk-5EZELID5.js.map → chunk-5JOKVDSR.js.map} +0 -0
  883. /package/dist/{chunk-2VHPKSFK.js.map → chunk-5MP3G7ZV.js.map} +0 -0
  884. /package/dist/{chunk-MBYHDOTU.js.map → chunk-5OVRMKP5.js.map} +0 -0
  885. /package/dist/{chunk-ORSFNFNY.js.map → chunk-5SGTRULO.js.map} +0 -0
  886. /package/dist/{chunk-64XZTYX4.js.map → chunk-5SOL4INY.js.map} +0 -0
  887. /package/dist/{chunk-YEU2JC3B.js.map → chunk-5Y34P32B.js.map} +0 -0
  888. /package/dist/{chunk-DG3GW325.js.map → chunk-62HIKJ5F.js.map} +0 -0
  889. /package/dist/{chunk-HWOYJOKK.js.map → chunk-62T2ZPD5.js.map} +0 -0
  890. /package/dist/{chunk-2U5ZJMNP.js.map → chunk-63VNZRLY.js.map} +0 -0
  891. /package/dist/{chunk-PMBZMVKE.js.map → chunk-6CDBX3XG.js.map} +0 -0
  892. /package/dist/{chunk-W7P44UAE.js.map → chunk-6D3D2JWY.js.map} +0 -0
  893. /package/dist/{chunk-FFXJF5KU.js.map → chunk-6DOIINY4.js.map} +0 -0
  894. /package/dist/{chunk-IKAVNCO5.js.map → chunk-6DQBUKGJ.js.map} +0 -0
  895. /package/dist/{chunk-IAXF3IO6.js.map → chunk-6SETNFNH.js.map} +0 -0
  896. /package/dist/{chunk-QI5RXPYP.js.map → chunk-6XYFMHNT.js.map} +0 -0
  897. /package/dist/{chunk-MB5WRIYX.js.map → chunk-6YU3WV2P.js.map} +0 -0
  898. /package/dist/{chunk-RMVKH4EE.js.map → chunk-6YUHDFOZ.js.map} +0 -0
  899. /package/dist/{chunk-YZ2G24VJ.js.map → chunk-72EOXOR7.js.map} +0 -0
  900. /package/dist/{chunk-4YQFDBKE.js.map → chunk-72ND4ALI.js.map} +0 -0
  901. /package/dist/{chunk-X56NEOYY.js.map → chunk-757LE32E.js.map} +0 -0
  902. /package/dist/{chunk-3UG2AJHR.js.map → chunk-7FDEV6XW.js.map} +0 -0
  903. /package/dist/{chunk-XET2K3TU.js.map → chunk-7S2S4MXR.js.map} +0 -0
  904. /package/dist/{chunk-67MFNMGH.js.map → chunk-7SYCHMXS.js.map} +0 -0
  905. /package/dist/{chunk-MQFJPFL4.js.map → chunk-7TVAPQOV.js.map} +0 -0
  906. /package/dist/{chunk-ES3JAYQJ.js.map → chunk-7UDLRDHK.js.map} +0 -0
  907. /package/dist/{chunk-GX3RAB4W.js.map → chunk-7YLQCMZP.js.map} +0 -0
  908. /package/dist/{chunk-RPWI6A3H.js.map → chunk-A5GX3CAE.js.map} +0 -0
  909. /package/dist/{chunk-6H2OQ6XG.js.map → chunk-A7EBV2EB.js.map} +0 -0
  910. /package/dist/{chunk-HQZ6NGUU.js.map → chunk-AB5SPXUR.js.map} +0 -0
  911. /package/dist/{chunk-AQHQUPEF.js.map → chunk-AHVQGL5A.js.map} +0 -0
  912. /package/dist/{chunk-Q35LFE7H.js.map → chunk-AI77ZKEV.js.map} +0 -0
  913. /package/dist/{chunk-N7IOCNWK.js.map → chunk-AIX2D6RB.js.map} +0 -0
  914. /package/dist/{chunk-WOVGVEKP.js.map → chunk-AVSIHP7Q.js.map} +0 -0
  915. /package/dist/{chunk-EMART4X3.js.map → chunk-AWK23Q32.js.map} +0 -0
  916. /package/dist/{chunk-3JYID53J.js.map → chunk-AYVWA6KD.js.map} +0 -0
  917. /package/dist/{chunk-A4SKSSSS.js.map → chunk-AYZXE4IM.js.map} +0 -0
  918. /package/dist/{chunk-CWKFPDYB.js.map → chunk-AZGGSPTE.js.map} +0 -0
  919. /package/dist/{chunk-DLHR7HHS.js.map → chunk-B45TB4HY.js.map} +0 -0
  920. /package/dist/{chunk-7TEXZ5LW.js.map → chunk-BIUJHNVR.js.map} +0 -0
  921. /package/dist/{chunk-AJEOTFQE.js.map → chunk-BJUOKUE5.js.map} +0 -0
  922. /package/dist/{chunk-CGYPX3HJ.js.map → chunk-BPEEVMKH.js.map} +0 -0
  923. /package/dist/{chunk-PQ7WJAKL.js.map → chunk-BPHPAGYF.js.map} +0 -0
  924. /package/dist/{chunk-XJPDGFVT.js.map → chunk-BXMND6YU.js.map} +0 -0
  925. /package/dist/{chunk-FN5UTQSL.js.map → chunk-C6OM2SRG.js.map} +0 -0
  926. /package/dist/{chunk-YUEYZTBP.js.map → chunk-CIRCUDKF.js.map} +0 -0
  927. /package/dist/{chunk-IGUPUA3G.js.map → chunk-CLKR4UG3.js.map} +0 -0
  928. /package/dist/{chunk-7QODDTOI.js.map → chunk-CPX6BHER.js.map} +0 -0
  929. /package/dist/{chunk-FZOK37SC.js.map → chunk-CVC4RO7D.js.map} +0 -0
  930. /package/dist/{chunk-6C55RLFY.js.map → chunk-D3YJAQGK.js.map} +0 -0
  931. /package/dist/{chunk-QAHGGBL2.js.map → chunk-DFQ72BLS.js.map} +0 -0
  932. /package/dist/{chunk-HSEHIVAE.js.map → chunk-DG65PJOZ.js.map} +0 -0
  933. /package/dist/{chunk-DM7JLUWN.js.map → chunk-DNAXAS5R.js.map} +0 -0
  934. /package/dist/{chunk-NSBOITEM.js.map → chunk-DO247ITS.js.map} +0 -0
  935. /package/dist/{chunk-NNIUBJOE.js.map → chunk-DONBARLL.js.map} +0 -0
  936. /package/dist/{chunk-5W4ZGFXZ.js.map → chunk-DTLXQ3ZU.js.map} +0 -0
  937. /package/dist/{chunk-EIQQYUOT.js.map → chunk-EAXTACI4.js.map} +0 -0
  938. /package/dist/{chunk-JOKNFHFU.js.map → chunk-EDPH7AJH.js.map} +0 -0
  939. /package/dist/{chunk-MDIHQGPV.js.map → chunk-EFKQHCGJ.js.map} +0 -0
  940. /package/dist/{chunk-33QC4RN7.js.map → chunk-EILSPMVD.js.map} +0 -0
  941. /package/dist/{chunk-PNLVWZSM.js.map → chunk-EK7KIETS.js.map} +0 -0
  942. /package/dist/{chunk-OVAT4PIR.js.map → chunk-EMWT6GOK.js.map} +0 -0
  943. /package/dist/{chunk-GHLUZSIB.js.map → chunk-EO22NST7.js.map} +0 -0
  944. /package/dist/{chunk-P2OHWZMB.js.map → chunk-ER5MYLIE.js.map} +0 -0
  945. /package/dist/{chunk-YVQUPHYL.js.map → chunk-ES5HKVQF.js.map} +0 -0
  946. /package/dist/{chunk-H35G5UHL.js.map → chunk-F26YBYAZ.js.map} +0 -0
  947. /package/dist/{chunk-FD6F2OE5.js.map → chunk-F6QP4GSK.js.map} +0 -0
  948. /package/dist/{chunk-RLNJSAHP.js.map → chunk-F7QEO7M2.js.map} +0 -0
  949. /package/dist/{chunk-J3CHK7NH.js.map → chunk-FJFGDLXB.js.map} +0 -0
  950. /package/dist/{chunk-CYBRD5BP.js.map → chunk-FLLJ2WXW.js.map} +0 -0
  951. /package/dist/{chunk-RO2UO3VN.js.map → chunk-FMBJKMT4.js.map} +0 -0
  952. /package/dist/{chunk-R7SBV5KD.js.map → chunk-FPN4I4CG.js.map} +0 -0
  953. /package/dist/{chunk-UQFUI3KT.js.map → chunk-FUXFJTXL.js.map} +0 -0
  954. /package/dist/{chunk-JK2WTBLD.js.map → chunk-G6SSSX5R.js.map} +0 -0
  955. /package/dist/{chunk-LT3MK2XP.js.map → chunk-GBGCMHBB.js.map} +0 -0
  956. /package/dist/{chunk-HUKGLWAY.js.map → chunk-GIHE7U3Y.js.map} +0 -0
  957. /package/dist/{chunk-GDWKVSMK.js.map → chunk-GJ4GTYOD.js.map} +0 -0
  958. /package/dist/{chunk-OE4QJJ4C.js.map → chunk-GLSDWNFV.js.map} +0 -0
  959. /package/dist/{chunk-RZ5IQ3SX.js.map → chunk-GMGAW3T6.js.map} +0 -0
  960. /package/dist/{chunk-RFBJ6TUL.js.map → chunk-GNGI6XFN.js.map} +0 -0
  961. /package/dist/{chunk-WQ35KUFP.js.map → chunk-GO5VIAA7.js.map} +0 -0
  962. /package/dist/{chunk-KQBVH5LN.js.map → chunk-GSW4YHZE.js.map} +0 -0
  963. /package/dist/{chunk-OWF2AVT6.js.map → chunk-GUC6IWEY.js.map} +0 -0
  964. /package/dist/{chunk-5SK5PYFN.js.map → chunk-GWAY3SO5.js.map} +0 -0
  965. /package/dist/{chunk-KA5H2Z3E.js.map → chunk-GXOTNT5D.js.map} +0 -0
  966. /package/dist/{chunk-HXANXMPH.js.map → chunk-GZZCVF76.js.map} +0 -0
  967. /package/dist/{chunk-3ZBQIZEM.js.map → chunk-H4VMHFOX.js.map} +0 -0
  968. /package/dist/{chunk-T4UTYGB2.js.map → chunk-HA5RFQAF.js.map} +0 -0
  969. /package/dist/{chunk-PTSRBKQC.js.map → chunk-HFROJDFQ.js.map} +0 -0
  970. /package/dist/{chunk-YP4SNX4P.js.map → chunk-HHFFPE67.js.map} +0 -0
  971. /package/dist/{chunk-4J4IPUPZ.js.map → chunk-HJLHGXWL.js.map} +0 -0
  972. /package/dist/{chunk-CHYAUIZ3.js.map → chunk-HKNMNL7B.js.map} +0 -0
  973. /package/dist/{chunk-CP53LM7W.js.map → chunk-HT7MBHLY.js.map} +0 -0
  974. /package/dist/{chunk-YMY2OO3V.js.map → chunk-I5FSUZVW.js.map} +0 -0
  975. /package/dist/{chunk-CTKUOOU4.js.map → chunk-IINQO425.js.map} +0 -0
  976. /package/dist/{chunk-73YALMGG.js.map → chunk-IIXNEOK4.js.map} +0 -0
  977. /package/dist/{chunk-HUWJZRD3.js.map → chunk-IM3WA5AL.js.map} +0 -0
  978. /package/dist/{chunk-DBGOJIMM.js.map → chunk-IX4P4OGR.js.map} +0 -0
  979. /package/dist/{chunk-OU2J6K3L.js.map → chunk-IX5VHZYS.js.map} +0 -0
  980. /package/dist/{chunk-4IMVT7OU.js.map → chunk-JB3TSUZO.js.map} +0 -0
  981. /package/dist/{chunk-UQDT3SM2.js.map → chunk-JIC6RLUB.js.map} +0 -0
  982. /package/dist/{chunk-QXOO5U46.js.map → chunk-JNJIZCTN.js.map} +0 -0
  983. /package/dist/{chunk-K6JW7GB3.js.map → chunk-JNV5ZPUV.js.map} +0 -0
  984. /package/dist/{chunk-HVL7TCB5.js.map → chunk-JPQFVR24.js.map} +0 -0
  985. /package/dist/{chunk-5NGW5K2D.js.map → chunk-JPZVMXDP.js.map} +0 -0
  986. /package/dist/{chunk-6GBJFFQL.js.map → chunk-JVPF34MX.js.map} +0 -0
  987. /package/dist/{chunk-JAC5I2BN.js.map → chunk-KED67KAF.js.map} +0 -0
  988. /package/dist/{chunk-H2AOQJQP.js.map → chunk-KJ72GMZ2.js.map} +0 -0
  989. /package/dist/{chunk-PCSRHFRF.js.map → chunk-KTGKGHEA.js.map} +0 -0
  990. /package/dist/{chunk-NUZNJSL5.js.map → chunk-KU77XHWB.js.map} +0 -0
  991. /package/dist/{chunk-YFU2VZXS.js.map → chunk-KXBLLFOO.js.map} +0 -0
  992. /package/dist/{chunk-VLDKWGHD.js.map → chunk-L6WVCO6D.js.map} +0 -0
  993. /package/dist/{chunk-TLTE3QSX.js.map → chunk-LPEFULJY.js.map} +0 -0
  994. /package/dist/{chunk-DMQY35LC.js.map → chunk-LRMGPO7E.js.map} +0 -0
  995. /package/dist/{chunk-6DFHNNWJ.js.map → chunk-LVKTKORH.js.map} +0 -0
  996. /package/dist/{chunk-TGG3ODCS.js.map → chunk-MCPKUVMQ.js.map} +0 -0
  997. /package/dist/{chunk-KYDLVMKA.js.map → chunk-MFLU3466.js.map} +0 -0
  998. /package/dist/{chunk-ZD67RM6G.js.map → chunk-MIUJ3EH5.js.map} +0 -0
  999. /package/dist/{chunk-EWJ7WEZT.js.map → chunk-MIUMNTIJ.js.map} +0 -0
  1000. /package/dist/{chunk-2Q4XBV3J.js.map → chunk-ML46TXRM.js.map} +0 -0
  1001. /package/dist/{chunk-3JBLX5BN.js.map → chunk-MO3XJQN2.js.map} +0 -0
  1002. /package/dist/{chunk-SFWP4DNI.js.map → chunk-MQRHTOQ2.js.map} +0 -0
  1003. /package/dist/{chunk-5ERDSF2C.js.map → chunk-MVYQDBE6.js.map} +0 -0
  1004. /package/dist/{chunk-272XEENJ.js.map → chunk-NE5P7LFQ.js.map} +0 -0
  1005. /package/dist/{chunk-YSZAX6WJ.js.map → chunk-NPBEUU22.js.map} +0 -0
  1006. /package/dist/{chunk-ZCQJUYDX.js.map → chunk-NSXKGS2K.js.map} +0 -0
  1007. /package/dist/{chunk-QODAMEOR.js.map → chunk-NUEFORM6.js.map} +0 -0
  1008. /package/dist/{chunk-O4VCJWKV.js.map → chunk-NZOFNQNC.js.map} +0 -0
  1009. /package/dist/{chunk-MB5EK2PA.js.map → chunk-OATXCLTY.js.map} +0 -0
  1010. /package/dist/{chunk-AKQSOR4G.js.map → chunk-OG3ELROW.js.map} +0 -0
  1011. /package/dist/{chunk-W4TOPPVT.js.map → chunk-OI4WS7FW.js.map} +0 -0
  1012. /package/dist/{chunk-3ZVACRTK.js.map → chunk-OITGZUDC.js.map} +0 -0
  1013. /package/dist/{chunk-GWJLR55B.js.map → chunk-OKD2LBMK.js.map} +0 -0
  1014. /package/dist/{chunk-K2WDXLZS.js.map → chunk-OSA4CGST.js.map} +0 -0
  1015. /package/dist/{chunk-TGVTVLNI.js.map → chunk-OXYAKUFU.js.map} +0 -0
  1016. /package/dist/{chunk-SUMBC7BQ.js.map → chunk-OYMSMU5O.js.map} +0 -0
  1017. /package/dist/{chunk-3XS3A6Y6.js.map → chunk-P4NZ72KY.js.map} +0 -0
  1018. /package/dist/{chunk-CYPNXHWM.js.map → chunk-PBYL2VIM.js.map} +0 -0
  1019. /package/dist/{chunk-UZAVFOZC.js.map → chunk-PDW3OOSZ.js.map} +0 -0
  1020. /package/dist/{chunk-6M2WXQX5.js.map → chunk-PGRKTQIW.js.map} +0 -0
  1021. /package/dist/{chunk-4PG2BEQA.js.map → chunk-PPQJIVGM.js.map} +0 -0
  1022. /package/dist/{chunk-UFRXYZCJ.js.map → chunk-PYMQM65Y.js.map} +0 -0
  1023. /package/dist/{chunk-GYNTJYWY.js.map → chunk-Q273Q33U.js.map} +0 -0
  1024. /package/dist/{chunk-UHU2WESP.js.map → chunk-Q4CLS2HL.js.map} +0 -0
  1025. /package/dist/{chunk-GYWQ4KVM.js.map → chunk-QA5UNVHD.js.map} +0 -0
  1026. /package/dist/{chunk-LLVJ3P2N.js.map → chunk-QFOBUA2J.js.map} +0 -0
  1027. /package/dist/{chunk-2MXP6ZRP.js.map → chunk-QLIM4D56.js.map} +0 -0
  1028. /package/dist/{chunk-KQVHSEQQ.js.map → chunk-QMQF5U2D.js.map} +0 -0
  1029. /package/dist/{chunk-IXPLYZFO.js.map → chunk-QNOWKKZ4.js.map} +0 -0
  1030. /package/dist/{chunk-PTUIF4TT.js.map → chunk-QPOUPVPD.js.map} +0 -0
  1031. /package/dist/{chunk-FE4HNBHF.js.map → chunk-QTJAQ6DS.js.map} +0 -0
  1032. /package/dist/{chunk-LK3AAMN7.js.map → chunk-QUOFP3G7.js.map} +0 -0
  1033. /package/dist/{chunk-6O6CHBD3.js.map → chunk-QVOTPOXK.js.map} +0 -0
  1034. /package/dist/{chunk-ROCQ3IDW.js.map → chunk-QYZ5RVGM.js.map} +0 -0
  1035. /package/dist/{chunk-TXAMGOUG.js.map → chunk-R7CVDKRN.js.map} +0 -0
  1036. /package/dist/{chunk-3ITEAD3E.js.map → chunk-RB7MXNZD.js.map} +0 -0
  1037. /package/dist/{chunk-KREVCOE7.js.map → chunk-RDZQFZOQ.js.map} +0 -0
  1038. /package/dist/{chunk-AI7XM4MY.js.map → chunk-RIHKEGWS.js.map} +0 -0
  1039. /package/dist/{chunk-YNRZN3TU.js.map → chunk-ROSB7GF6.js.map} +0 -0
  1040. /package/dist/{chunk-3MZCXSC7.js.map → chunk-RP3YMYCX.js.map} +0 -0
  1041. /package/dist/{chunk-U4OIE2MJ.js.map → chunk-RPHXJHNX.js.map} +0 -0
  1042. /package/dist/{chunk-CQW4ZPU4.js.map → chunk-RVC3M66H.js.map} +0 -0
  1043. /package/dist/{chunk-BMOYN4HY.js.map → chunk-S3OTJAAC.js.map} +0 -0
  1044. /package/dist/{chunk-2Y53MMGA.js.map → chunk-SBWPMVRN.js.map} +0 -0
  1045. /package/dist/{chunk-FT4ZKYTG.js.map → chunk-SERECSAR.js.map} +0 -0
  1046. /package/dist/{chunk-6V2UH36U.js.map → chunk-SHSEF3GJ.js.map} +0 -0
  1047. /package/dist/{chunk-2AU2S5NP.js.map → chunk-SMS2M3RG.js.map} +0 -0
  1048. /package/dist/{chunk-BY7AWWDB.js.map → chunk-SRDHDIRQ.js.map} +0 -0
  1049. /package/dist/{chunk-46USHCHK.js.map → chunk-SXRYA7NN.js.map} +0 -0
  1050. /package/dist/{chunk-NDJPEX7P.js.map → chunk-SYA3WYG4.js.map} +0 -0
  1051. /package/dist/{chunk-HUTQJY3F.js.map → chunk-SYYFA7W7.js.map} +0 -0
  1052. /package/dist/{chunk-L7ZLPS37.js.map → chunk-T2QDSTBH.js.map} +0 -0
  1053. /package/dist/{chunk-T6N33M46.js.map → chunk-TFSCGFYV.js.map} +0 -0
  1054. /package/dist/{chunk-XK4VFZHQ.js.map → chunk-TGCKZOSX.js.map} +0 -0
  1055. /package/dist/{chunk-GA42NSDJ.js.map → chunk-THILLYQM.js.map} +0 -0
  1056. /package/dist/{chunk-BZ4GSY44.js.map → chunk-TI6LGUEZ.js.map} +0 -0
  1057. /package/dist/{chunk-GISBCT5E.js.map → chunk-TSY6YZL2.js.map} +0 -0
  1058. /package/dist/{chunk-DD3DT5MY.js.map → chunk-TW2RHTLH.js.map} +0 -0
  1059. /package/dist/{chunk-RTJVIXH5.js.map → chunk-TWA5G277.js.map} +0 -0
  1060. /package/dist/{chunk-ZBTYTG4E.js.map → chunk-TZZ2S4XI.js.map} +0 -0
  1061. /package/dist/{chunk-VDHWFRTL.js.map → chunk-U5D3K53R.js.map} +0 -0
  1062. /package/dist/{chunk-WLRB74VH.js.map → chunk-UECD27LX.js.map} +0 -0
  1063. /package/dist/{chunk-HHUTU5EN.js.map → chunk-UFJDETKG.js.map} +0 -0
  1064. /package/dist/{chunk-PV7X4PRR.js.map → chunk-UHCFYX4I.js.map} +0 -0
  1065. /package/dist/{chunk-NLKHAZMG.js.map → chunk-UHTURYJO.js.map} +0 -0
  1066. /package/dist/{chunk-EBVL3YJQ.js.map → chunk-UJH63JT3.js.map} +0 -0
  1067. /package/dist/{chunk-5UI3VPCY.js.map → chunk-UOLDS6S5.js.map} +0 -0
  1068. /package/dist/{chunk-BMSMK7SA.js.map → chunk-UUE3OGXI.js.map} +0 -0
  1069. /package/dist/{chunk-WSBUFP77.js.map → chunk-UUNJ2E57.js.map} +0 -0
  1070. /package/dist/{chunk-NLYAWFDY.js.map → chunk-UYQVWRAH.js.map} +0 -0
  1071. /package/dist/{chunk-VAN6CEAV.js.map → chunk-UYWVK7JQ.js.map} +0 -0
  1072. /package/dist/{chunk-UBTDG6GC.js.map → chunk-UYWWUEL4.js.map} +0 -0
  1073. /package/dist/{chunk-2WF5XIPA.js.map → chunk-V4CQKX5H.js.map} +0 -0
  1074. /package/dist/{chunk-3NRJ4Z3A.js.map → chunk-V4QM7GDQ.js.map} +0 -0
  1075. /package/dist/{chunk-6LUF4TOE.js.map → chunk-V5Y74WII.js.map} +0 -0
  1076. /package/dist/{chunk-YUVS7HYN.js.map → chunk-VGGZLUQK.js.map} +0 -0
  1077. /package/dist/{chunk-35LBFD5I.js.map → chunk-VGX636MB.js.map} +0 -0
  1078. /package/dist/{chunk-WAVR3UIC.js.map → chunk-VGZLFQO2.js.map} +0 -0
  1079. /package/dist/{chunk-IMWP2Q4W.js.map → chunk-VJWZATNF.js.map} +0 -0
  1080. /package/dist/{chunk-DHLGGANG.js.map → chunk-VMWCIC2N.js.map} +0 -0
  1081. /package/dist/{chunk-UXZLTAJO.js.map → chunk-VPWKTIU5.js.map} +0 -0
  1082. /package/dist/{chunk-JTRRMV7B.js.map → chunk-VXOLG6YB.js.map} +0 -0
  1083. /package/dist/{chunk-7JNWIGM4.js.map → chunk-W2NAU5VB.js.map} +0 -0
  1084. /package/dist/{chunk-AP4FMXAM.js.map → chunk-WGORKMR3.js.map} +0 -0
  1085. /package/dist/{chunk-HTYDPAJL.js.map → chunk-WMIDELSJ.js.map} +0 -0
  1086. /package/dist/{chunk-SOC5IBQT.js.map → chunk-WSOSGL2G.js.map} +0 -0
  1087. /package/dist/{chunk-A7Z65D33.js.map → chunk-WXUUOM4X.js.map} +0 -0
  1088. /package/dist/{chunk-L4PIAAQB.js.map → chunk-WZ74QHLE.js.map} +0 -0
  1089. /package/dist/{chunk-M7NPDODK.js.map → chunk-X2OWM2ME.js.map} +0 -0
  1090. /package/dist/{chunk-B6YDINPE.js.map → chunk-X6UMGG4T.js.map} +0 -0
  1091. /package/dist/{chunk-YTUVANLR.js.map → chunk-XDXKB25W.js.map} +0 -0
  1092. /package/dist/{chunk-ACUDUVDJ.js.map → chunk-XE4PHI74.js.map} +0 -0
  1093. /package/dist/{chunk-R6WQLIFX.js.map → chunk-XHF2XNU5.js.map} +0 -0
  1094. /package/dist/{chunk-D4RTU236.js.map → chunk-XLJ4SQFS.js.map} +0 -0
  1095. /package/dist/{chunk-UKDLZ76A.js.map → chunk-XOD4FX6M.js.map} +0 -0
  1096. /package/dist/{chunk-YW4YRCXI.js.map → chunk-XODQ2GPF.js.map} +0 -0
  1097. /package/dist/{chunk-JOVCPP44.js.map → chunk-XT54RTAM.js.map} +0 -0
  1098. /package/dist/{chunk-R6OBJ7LF.js.map → chunk-YAVW5OJ5.js.map} +0 -0
  1099. /package/dist/{chunk-TD5EKKVD.js.map → chunk-YDQHFJM2.js.map} +0 -0
  1100. /package/dist/{chunk-UXBW2TYH.js.map → chunk-YH6O6OQ6.js.map} +0 -0
  1101. /package/dist/{chunk-6U3PE427.js.map → chunk-YIKPC2QP.js.map} +0 -0
  1102. /package/dist/{chunk-M72GFKDP.js.map → chunk-ZD7PKYC4.js.map} +0 -0
  1103. /package/dist/{chunk-S7NX6KSE.js.map → chunk-ZEQYHEWP.js.map} +0 -0
  1104. /package/dist/{chunk-2ZR75AUO.js.map → chunk-ZMYL6DTE.js.map} +0 -0
  1105. /package/dist/{chunk-GKA5LFYR.js.map → chunk-ZP3QCPYG.js.map} +0 -0
  1106. /package/dist/{chunk-V2A4I4GC.js.map → chunk-ZRVUCTSI.js.map} +0 -0
  1107. /package/dist/{chunk-CYPMAJ75.js.map → chunk-ZSI3ITRK.js.map} +0 -0
  1108. /package/dist/{chunk-XVP23IJS.js.map → chunk-ZZMEQCIZ.js.map} +0 -0
  1109. /package/dist/{computer-viewer-BWWVUD6J.js.map → computer-viewer-ZBY3BPYW.js.map} +0 -0
  1110. /package/dist/{connection-step-up-7ICLBORD.js.map → connection-step-up-JQ4OFSQN.js.map} +0 -0
  1111. /package/dist/{embedded-new-voice-VD6GR5JQ.js.map → embedded-new-voice-ZB5XLKLU.js.map} +0 -0
  1112. /package/dist/{embedded-voice-J2B6J2QQ.js.map → embedded-voice-MZJISDCS.js.map} +0 -0
  1113. /package/dist/{fleet-decision-row-B672XMNG.js.map → fleet-decision-row-LG3SYVR3.js.map} +0 -0
  1114. /package/dist/{model-policy-picker-menu-HT3TWGSS.js.map → model-policy-picker-menu-5Y72PLNF.js.map} +0 -0
  1115. /package/dist/{payment-page-card-4LZPJ3OK.js.map → payment-page-card-YPSXRHBA.js.map} +0 -0
  1116. /package/dist/{platform-activity-row-TWXWUCXD.js.map → platform-activity-row-ZU4MEBNK.js.map} +0 -0
  1117. /package/dist/{queue-surface-implementation-SQ7K2TM4.js.map → queue-surface-implementation-6Q25RPH6.js.map} +0 -0
  1118. /package/dist/{recorder-host-N2S7G3CW.js.map → recorder-host-JD4GWJ2Z.js.map} +0 -0
  1119. /package/dist/{sandbox-files-6CKWJ2CU.js.map → sandbox-files-HCLEEJMU.js.map} +0 -0
  1120. /package/dist/{session-connect-cards-VNQWMX7A.js.map → session-connect-cards-DRKEN3Z4.js.map} +0 -0
  1121. /package/dist/{session-realtime-CRG7DRV6.js.map → session-realtime-IZOTTRH6.js.map} +0 -0
  1122. /package/dist/{timeline-annotation-markers-JXCNK4S6.js.map → timeline-annotation-markers-WWXNJOXI.js.map} +0 -0
  1123. /package/dist/{timeline-annotation-selection-5ZTVYJXT.js.map → timeline-annotation-selection-ZKRIQFIQ.js.map} +0 -0
  1124. /package/dist/{timeline-annotations-dialog-4QWVCZCF.js.map → timeline-annotations-dialog-4IMKTOXJ.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
- ConfirmDialog
10
- } from "./chunk-HQZ6NGUU.js";
11
- import {
12
- useLatestTaskRunner
13
- } from "./chunk-2DDJ6YH6.js";
14
- import {
15
- ArtifactSubmissionProvider,
16
- ArtifactSurface,
17
- EditableArtifactDownloadButton,
18
- EditableArtifactMessage,
19
- artifactSubmissionSessionKey,
20
- asEditableArtifactError,
21
- editableArtifactAccessRevoked,
22
- editableArtifactProjectionKey,
23
- editableArtifactStatusLabel,
24
- useArtifactSubmissions,
25
- useEditableArtifactView
26
- } from "./chunk-GWJLR55B.js";
27
- import {
28
- cn
29
- } from "./chunk-TXS65BB2.js";
30
- import {
31
- useOpenGeniText
32
- } from "./chunk-6FWBGVFL.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-R7SBV5KD.js.map