@arbidocs/blocks 0.5.120 → 0.5.122

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 (417) hide show
  1. package/dist/ClippingMediaViewer-IEIBT74X.cjs +156 -0
  2. package/dist/ClippingMediaViewer-IEIBT74X.cjs.map +1 -0
  3. package/dist/ClippingPdfViewer-OGYLMVCE.cjs +79 -0
  4. package/dist/ClippingPdfViewer-OGYLMVCE.cjs.map +1 -0
  5. package/dist/{ConnectedCallDock-WER7R222.cjs → ConnectedCallDock-XJOYVVAH.cjs} +9 -7
  6. package/dist/ConnectedCallDock-XJOYVVAH.cjs.map +1 -0
  7. package/dist/{ConnectedCallRoom-T7OBQTYP.cjs → ConnectedCallRoom-CUDYAPQK.cjs} +9 -7
  8. package/dist/{ConnectedCallRoom-T7OBQTYP.cjs.map → ConnectedCallRoom-CUDYAPQK.cjs.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-SGE4R3M4.cjs → ConnectedNativeDocxComparison-QKHCYD6W.cjs} +7 -7
  10. package/dist/{ConnectedNativeDocxComparison-SGE4R3M4.cjs.map → ConnectedNativeDocxComparison-QKHCYD6W.cjs.map} +1 -1
  11. package/dist/ConnectedPresentation-AU25OW25.cjs +321 -0
  12. package/dist/ConnectedPresentation-AU25OW25.cjs.map +1 -0
  13. package/dist/ConnectedSlidesTab-I75LKKN7.cjs +236 -0
  14. package/dist/ConnectedSlidesTab-I75LKKN7.cjs.map +1 -0
  15. package/dist/{ConnectedStreamedWordArtifact-6MCLJRIT.cjs → ConnectedStreamedWordArtifact-AG62232A.cjs} +7 -7
  16. package/dist/{ConnectedStreamedWordArtifact-6MCLJRIT.cjs.map → ConnectedStreamedWordArtifact-AG62232A.cjs.map} +1 -1
  17. package/dist/{DocumentReviewCard-BPIAJJED.cjs → DocumentReviewCard-M53XFLI2.cjs} +15 -14
  18. package/dist/DocumentReviewCard-M53XFLI2.cjs.map +1 -0
  19. package/dist/{FilesViewerDialog-67WK3TZC.cjs → FilesViewerDialog-4352KIOG.cjs} +30 -22
  20. package/dist/FilesViewerDialog-4352KIOG.cjs.map +1 -0
  21. package/dist/{GridViewImpl-ZMJJWTOM.cjs → GridViewImpl-LTYET77Q.cjs} +3 -3
  22. package/dist/GridViewImpl-LTYET77Q.cjs.map +1 -0
  23. package/dist/{WorkspaceTableView-J3C6VH4T.cjs → WorkspaceTableView-3XYAV4BV.cjs} +9 -8
  24. package/dist/WorkspaceTableView-3XYAV4BV.cjs.map +1 -0
  25. package/dist/agents/index.cjs +186 -186
  26. package/dist/{ai-IM4A23YT.cjs → ai-IEIR7SC2.cjs} +17 -15
  27. package/dist/ai-IEIR7SC2.cjs.map +1 -0
  28. package/dist/calls/connected/CallControls.d.ts +2 -0
  29. package/dist/calls/connected/CallControls.js +71 -9
  30. package/dist/calls/connected/CallControls.js.map +2 -2
  31. package/dist/calls/connected/ShareDocumentDialog.d.ts +14 -0
  32. package/dist/calls/connected/ShareDocumentDialog.js +77 -0
  33. package/dist/calls/connected/ShareDocumentDialog.js.map +7 -0
  34. package/dist/calls/index.cjs +2 -2
  35. package/dist/chat/index.cjs +8 -7
  36. package/dist/{chunk-557MJ4IH.cjs → chunk-2F57IO7S.cjs} +9 -146
  37. package/dist/chunk-2F57IO7S.cjs.map +1 -0
  38. package/dist/chunk-2RLA6QO2.cjs +174 -0
  39. package/dist/chunk-2RLA6QO2.cjs.map +1 -0
  40. package/dist/chunk-4TTX6ZNS.cjs +1374 -0
  41. package/dist/chunk-4TTX6ZNS.cjs.map +1 -0
  42. package/dist/chunk-5GCCUXMT.cjs +63 -0
  43. package/dist/chunk-5GCCUXMT.cjs.map +1 -0
  44. package/dist/{chunk-BUVIBHFU.cjs → chunk-5QERK4PK.cjs} +38 -38
  45. package/dist/chunk-5QERK4PK.cjs.map +1 -0
  46. package/dist/chunk-6OK7ESTL.cjs +134 -0
  47. package/dist/chunk-6OK7ESTL.cjs.map +1 -0
  48. package/dist/{chunk-ECLUFKYR.cjs → chunk-7557LDAN.cjs} +4 -4
  49. package/dist/{chunk-ECLUFKYR.cjs.map → chunk-7557LDAN.cjs.map} +1 -1
  50. package/dist/{chunk-KTQOGT2L.cjs → chunk-7L4X6QN2.cjs} +7 -7
  51. package/dist/{chunk-KTQOGT2L.cjs.map → chunk-7L4X6QN2.cjs.map} +1 -1
  52. package/dist/{chunk-BP3IJ34D.cjs → chunk-7NLO7ASW.cjs} +4 -4
  53. package/dist/{chunk-BP3IJ34D.cjs.map → chunk-7NLO7ASW.cjs.map} +1 -1
  54. package/dist/{chunk-3GWWOYGS.cjs → chunk-7PN3YENO.cjs} +4 -4
  55. package/dist/{chunk-3GWWOYGS.cjs.map → chunk-7PN3YENO.cjs.map} +1 -1
  56. package/dist/{chunk-DFBDQKGE.cjs → chunk-ADDQKZ5I.cjs} +4 -4
  57. package/dist/{chunk-DFBDQKGE.cjs.map → chunk-ADDQKZ5I.cjs.map} +1 -1
  58. package/dist/chunk-AFQTQC7A.cjs +35 -0
  59. package/dist/chunk-AFQTQC7A.cjs.map +1 -0
  60. package/dist/{chunk-NLSWDP42.cjs → chunk-ALK3PUUB.cjs} +21 -11
  61. package/dist/chunk-ALK3PUUB.cjs.map +1 -0
  62. package/dist/{chunk-775S43W7.cjs → chunk-CQQQIZU4.cjs} +8 -8
  63. package/dist/{chunk-775S43W7.cjs.map → chunk-CQQQIZU4.cjs.map} +1 -1
  64. package/dist/{chunk-TDO5UWXF.cjs → chunk-E3L5DB5F.cjs} +5 -5
  65. package/dist/{chunk-TDO5UWXF.cjs.map → chunk-E3L5DB5F.cjs.map} +1 -1
  66. package/dist/chunk-GFUOCGY6.cjs +32 -0
  67. package/dist/chunk-GFUOCGY6.cjs.map +1 -0
  68. package/dist/chunk-HYUKPHCT.cjs +66 -0
  69. package/dist/chunk-HYUKPHCT.cjs.map +1 -0
  70. package/dist/{chunk-QQWHG3KF.cjs → chunk-JJZOL5MG.cjs} +4 -4
  71. package/dist/{chunk-QQWHG3KF.cjs.map → chunk-JJZOL5MG.cjs.map} +1 -1
  72. package/dist/chunk-K4763GD5.cjs +301 -0
  73. package/dist/chunk-K4763GD5.cjs.map +1 -0
  74. package/dist/{chunk-B3LZITVF.cjs → chunk-KA3F6TIH.cjs} +2 -442
  75. package/dist/chunk-KA3F6TIH.cjs.map +1 -0
  76. package/dist/{chunk-PGJYD67F.cjs → chunk-KNGZZC4O.cjs} +7 -6
  77. package/dist/chunk-KNGZZC4O.cjs.map +1 -0
  78. package/dist/{chunk-YYPZOEED.cjs → chunk-LHWOKOMP.cjs} +23 -2
  79. package/dist/chunk-LHWOKOMP.cjs.map +1 -0
  80. package/dist/{chunk-HA66DHW6.cjs → chunk-MLA2BJ2Y.cjs} +28 -28
  81. package/dist/chunk-MLA2BJ2Y.cjs.map +1 -0
  82. package/dist/{chunk-CPR6EHG7.cjs → chunk-NG2EE7HR.cjs} +134 -10
  83. package/dist/chunk-NG2EE7HR.cjs.map +1 -0
  84. package/dist/{chunk-CKCG4NDB.cjs → chunk-OHHKBURG.cjs} +29 -29
  85. package/dist/chunk-OHHKBURG.cjs.map +1 -0
  86. package/dist/{chunk-4XJEHKVZ.cjs → chunk-PIYYBPHH.cjs} +4 -4
  87. package/dist/{chunk-4XJEHKVZ.cjs.map → chunk-PIYYBPHH.cjs.map} +1 -1
  88. package/dist/{chunk-YYSBWMDJ.cjs → chunk-QG2U2JGX.cjs} +4 -4
  89. package/dist/{chunk-YYSBWMDJ.cjs.map → chunk-QG2U2JGX.cjs.map} +1 -1
  90. package/dist/{chunk-5IZFSAEZ.cjs → chunk-SDRYSLOX.cjs} +4 -4
  91. package/dist/{chunk-5IZFSAEZ.cjs.map → chunk-SDRYSLOX.cjs.map} +1 -1
  92. package/dist/{chunk-NJCK6V6U.cjs → chunk-T73BHNQX.cjs} +2 -58
  93. package/dist/chunk-T73BHNQX.cjs.map +1 -0
  94. package/dist/{chunk-EOG6OT5I.cjs → chunk-TXP2N3DC.cjs} +4 -4
  95. package/dist/{chunk-EOG6OT5I.cjs.map → chunk-TXP2N3DC.cjs.map} +1 -1
  96. package/dist/{chunk-6UTKM5AB.cjs → chunk-UFT22LAB.cjs} +75 -75
  97. package/dist/chunk-UFT22LAB.cjs.map +1 -0
  98. package/dist/chunk-USNTRL22.cjs +4790 -0
  99. package/dist/chunk-USNTRL22.cjs.map +1 -0
  100. package/dist/{chunk-X36UR4A7.cjs → chunk-UTJ223TI.cjs} +413 -90
  101. package/dist/chunk-UTJ223TI.cjs.map +1 -0
  102. package/dist/{chunk-VZCPMXWC.cjs → chunk-V6MW7B4B.cjs} +4 -4
  103. package/dist/{chunk-VZCPMXWC.cjs.map → chunk-V6MW7B4B.cjs.map} +1 -1
  104. package/dist/{chunk-T23UTIRI.cjs → chunk-VWBYE3XY.cjs} +5 -5
  105. package/dist/{chunk-T23UTIRI.cjs.map → chunk-VWBYE3XY.cjs.map} +1 -1
  106. package/dist/chunk-WFMWKPGY.cjs +102 -0
  107. package/dist/chunk-WFMWKPGY.cjs.map +1 -0
  108. package/dist/chunk-WOOOMTTA.cjs +19 -0
  109. package/dist/chunk-WOOOMTTA.cjs.map +1 -0
  110. package/dist/{chunk-W6INT5GS.cjs → chunk-WRLGLZIA.cjs} +8 -8
  111. package/dist/{chunk-W6INT5GS.cjs.map → chunk-WRLGLZIA.cjs.map} +1 -1
  112. package/dist/{chunk-CJYWHUZR.cjs → chunk-XCKHOXRP.cjs} +4 -4
  113. package/dist/{chunk-CJYWHUZR.cjs.map → chunk-XCKHOXRP.cjs.map} +1 -1
  114. package/dist/chunk-XF355M7O.cjs +154 -0
  115. package/dist/chunk-XF355M7O.cjs.map +1 -0
  116. package/dist/{chunk-Q6CLWOP2.cjs → chunk-XGM4VVNV.cjs} +34 -34
  117. package/dist/{chunk-Q6CLWOP2.cjs.map → chunk-XGM4VVNV.cjs.map} +1 -1
  118. package/dist/{chunk-6WMMZLEV.cjs → chunk-XJEXFEWG.cjs} +2 -27
  119. package/dist/chunk-XJEXFEWG.cjs.map +1 -0
  120. package/dist/chunk-XK4TVJKD.cjs +73 -0
  121. package/dist/chunk-XK4TVJKD.cjs.map +1 -0
  122. package/dist/{chunk-E7TE2WVT.cjs → chunk-ZVEW3JBT.cjs} +3 -3
  123. package/dist/{chunk-E7TE2WVT.cjs.map → chunk-ZVEW3JBT.cjs.map} +1 -1
  124. package/dist/collaboration/index.cjs +70 -70
  125. package/dist/components/ZoomSlider.d.ts +25 -0
  126. package/dist/components/ZoomSlider.js +59 -0
  127. package/dist/components/ZoomSlider.js.map +7 -0
  128. package/dist/connect/docx.cjs +10 -10
  129. package/dist/connect/index.cjs +1066 -1147
  130. package/dist/connect/index.cjs.map +1 -1
  131. package/dist/connect/viewer.cjs +19 -12
  132. package/dist/connection/ai.d.ts +1 -1
  133. package/dist/connection/conversation/ConnectedMessage.js +1 -1
  134. package/dist/connection/conversation/ConnectedMessage.js.map +2 -2
  135. package/dist/connection/files/ConnectedNewFileMenu.d.ts +2 -1
  136. package/dist/connection/files/ConnectedNewFileMenu.js +9 -3
  137. package/dist/connection/files/ConnectedNewFileMenu.js.map +2 -2
  138. package/dist/connection/files/explorer/ConnectedFilesExplorer.js +1 -1
  139. package/dist/connection/files/explorer/ConnectedFilesExplorer.js.map +2 -2
  140. package/dist/connection/files/explorer/FileTiles.js +1 -1
  141. package/dist/connection/files/explorer/FileTiles.js.map +2 -2
  142. package/dist/connection/files/fields/documentField.js +1 -1
  143. package/dist/connection/files/fields/documentField.js.map +2 -2
  144. package/dist/connection/files/grid/documentColumns.js +1 -1
  145. package/dist/connection/files/grid/documentColumns.js.map +2 -2
  146. package/dist/connection/files/page/DocumentsFilterBarActions.js +17 -28
  147. package/dist/connection/files/page/DocumentsFilterBarActions.js.map +2 -2
  148. package/dist/connection/mail/useMailboxDefaults.js +1 -1
  149. package/dist/connection/mail/useMailboxDefaults.js.map +2 -2
  150. package/dist/connection/panels/useSessionPanelMode.js +3 -2
  151. package/dist/connection/panels/useSessionPanelMode.js.map +2 -2
  152. package/dist/connection/presentation/ClippingMediaViewer.d.ts +12 -0
  153. package/dist/connection/presentation/ClippingMediaViewer.js +153 -0
  154. package/dist/connection/presentation/ClippingMediaViewer.js.map +7 -0
  155. package/dist/connection/presentation/ClippingPdfViewer.d.ts +22 -0
  156. package/dist/connection/presentation/ClippingPdfViewer.js +75 -0
  157. package/dist/connection/presentation/ClippingPdfViewer.js.map +7 -0
  158. package/dist/connection/presentation/ConnectedPresentation.d.ts +12 -0
  159. package/dist/connection/presentation/ConnectedPresentation.js +100 -0
  160. package/dist/connection/presentation/ConnectedPresentation.js.map +7 -0
  161. package/dist/connection/presentation/ConnectedSlidesTab.d.ts +20 -0
  162. package/dist/connection/presentation/ConnectedSlidesTab.js +222 -0
  163. package/dist/connection/presentation/ConnectedSlidesTab.js.map +7 -0
  164. package/dist/connection/presentation/CropClipDialog.d.ts +11 -0
  165. package/dist/connection/presentation/CropClipDialog.js +86 -0
  166. package/dist/connection/presentation/CropClipDialog.js.map +7 -0
  167. package/dist/connection/presentation/GenerateTile.d.ts +4 -0
  168. package/dist/connection/presentation/GenerateTile.js +24 -0
  169. package/dist/connection/presentation/GenerateTile.js.map +7 -0
  170. package/dist/connection/presentation/LabelColumnMenu.d.ts +8 -0
  171. package/dist/connection/presentation/LabelColumnMenu.js +38 -0
  172. package/dist/connection/presentation/LabelColumnMenu.js.map +7 -0
  173. package/dist/connection/presentation/PresentationDialogs.d.ts +39 -0
  174. package/dist/connection/presentation/PresentationDialogs.js +295 -0
  175. package/dist/connection/presentation/PresentationDialogs.js.map +7 -0
  176. package/dist/connection/presentation/PresentationFileCard.d.ts +10 -0
  177. package/dist/connection/presentation/PresentationFileCard.js +35 -0
  178. package/dist/connection/presentation/PresentationFileCard.js.map +7 -0
  179. package/dist/connection/presentation/PresentationPill.d.ts +8 -0
  180. package/dist/connection/presentation/PresentationPill.js +39 -0
  181. package/dist/connection/presentation/PresentationPill.js.map +7 -0
  182. package/dist/connection/presentation/PresentationSlot.d.ts +7 -0
  183. package/dist/connection/presentation/PresentationSlot.js +35 -0
  184. package/dist/connection/presentation/PresentationSlot.js.map +7 -0
  185. package/dist/connection/presentation/requests.d.ts +21 -0
  186. package/dist/connection/presentation/requests.js +27 -0
  187. package/dist/connection/presentation/requests.js.map +7 -0
  188. package/dist/connection/presentation/useImageGeneration.d.ts +11 -0
  189. package/dist/connection/presentation/useImageGeneration.js +66 -0
  190. package/dist/connection/presentation/useImageGeneration.js.map +7 -0
  191. package/dist/connection/presentation/useLabelColumns.d.ts +15 -0
  192. package/dist/connection/presentation/useLabelColumns.js +33 -0
  193. package/dist/connection/presentation/useLabelColumns.js.map +7 -0
  194. package/dist/connection/presentation/usePresentationController.d.ts +15 -0
  195. package/dist/connection/presentation/usePresentationController.js +118 -0
  196. package/dist/connection/presentation/usePresentationController.js.map +7 -0
  197. package/dist/connection/presentation/usePresentationFiles.d.ts +44 -0
  198. package/dist/connection/presentation/usePresentationFiles.js +307 -0
  199. package/dist/connection/presentation/usePresentationFiles.js.map +7 -0
  200. package/dist/connection/presentation/useViewerClipping.d.ts +14 -0
  201. package/dist/connection/presentation/useViewerClipping.js +18 -0
  202. package/dist/connection/presentation/useViewerClipping.js.map +7 -0
  203. package/dist/connection/shell/ConnectedAppShell.js +5 -1
  204. package/dist/connection/shell/ConnectedAppShell.js.map +2 -2
  205. package/dist/connection/viewer/CleanViewControl.d.ts +8 -0
  206. package/dist/connection/viewer/CleanViewControl.js +76 -0
  207. package/dist/connection/viewer/CleanViewControl.js.map +7 -0
  208. package/dist/connection/viewer/ConnectedDocumentViewer.js +28 -29
  209. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  210. package/dist/connection/viewer/ViewerCropModal.d.ts +5 -0
  211. package/dist/connection/viewer/ViewerCropModal.js +22 -0
  212. package/dist/connection/viewer/ViewerCropModal.js.map +7 -0
  213. package/dist/connection/viewer/ViewerPdfPane.d.ts +3 -1
  214. package/dist/connection/viewer/ViewerPdfPane.js +41 -1
  215. package/dist/connection/viewer/ViewerPdfPane.js.map +2 -2
  216. package/dist/connection/viewer/documentPlace.d.ts +5 -4
  217. package/dist/connection/viewer/documentPlace.js +2 -2
  218. package/dist/connection/viewer/documentPlace.js.map +2 -2
  219. package/dist/connection/viewer/drafts.js +6 -4
  220. package/dist/connection/viewer/drafts.js.map +2 -2
  221. package/dist/connection/viewer/pdf/PdfClipOutlines.d.ts +11 -0
  222. package/dist/connection/viewer/pdf/PdfClipOutlines.js +42 -0
  223. package/dist/connection/viewer/pdf/PdfClipOutlines.js.map +7 -0
  224. package/dist/connection/viewer/pdf/clipOutlines.d.ts +17 -0
  225. package/dist/connection/viewer/pdf/clipOutlines.js +24 -0
  226. package/dist/connection/viewer/pdf/clipOutlines.js.map +7 -0
  227. package/dist/connection/viewer/pdf/passageHighlights.d.ts +2 -0
  228. package/dist/connection/viewer/pdf/passageHighlights.js +12 -1
  229. package/dist/connection/viewer/pdf/passageHighlights.js.map +2 -2
  230. package/dist/connection/viewer/pdf/usePdfClipOutlines.d.ts +7 -0
  231. package/dist/connection/viewer/pdf/usePdfClipOutlines.js +36 -0
  232. package/dist/connection/viewer/pdf/usePdfClipOutlines.js.map +7 -0
  233. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js +11 -2
  234. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js.map +2 -2
  235. package/dist/connection/viewer/shareDocument.d.ts +11 -0
  236. package/dist/connection/viewer/shareDocument.js +11 -0
  237. package/dist/connection/viewer/shareDocument.js.map +7 -0
  238. package/dist/connection/viewer/slidesTabChunk.d.ts +2 -0
  239. package/dist/connection/viewer/slidesTabChunk.js +9 -0
  240. package/dist/connection/viewer/slidesTabChunk.js.map +7 -0
  241. package/dist/connection/viewer/useCleanView.d.ts +14 -0
  242. package/dist/connection/viewer/useCleanView.js +29 -0
  243. package/dist/connection/viewer/useCleanView.js.map +7 -0
  244. package/dist/connection/viewer/useViewedDocument.d.ts +1 -0
  245. package/dist/connection/viewer/useViewedDocument.js +9 -1
  246. package/dist/connection/viewer/useViewedDocument.js.map +2 -2
  247. package/dist/connection/viewer/useViewerTabs.js +18 -4
  248. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  249. package/dist/connection/workflows/ConnectedWorkflowStart.d.ts +14 -2
  250. package/dist/connection/workflows/ConnectedWorkflowStart.js +5 -2
  251. package/dist/connection/workflows/ConnectedWorkflowStart.js.map +2 -2
  252. package/dist/databases/index.cjs +49 -49
  253. package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
  254. package/dist/document-tools/DocumentToolButtons.js +22 -1
  255. package/dist/document-tools/DocumentToolButtons.js.map +2 -2
  256. package/dist/document-tools/index.cjs +16 -12
  257. package/dist/document-tools/index.d.ts +1 -1
  258. package/dist/document-tools/index.js +2 -0
  259. package/dist/document-tools/index.js.map +2 -2
  260. package/dist/embed/index.cjs +17 -15
  261. package/dist/files/GridViewImpl.js +1 -1
  262. package/dist/files/GridViewImpl.js.map +2 -2
  263. package/dist/files/ViewerChrome.d.ts +5 -1
  264. package/dist/files/ViewerChrome.js +16 -6
  265. package/dist/files/ViewerChrome.js.map +2 -2
  266. package/dist/files/index.cjs +224 -224
  267. package/dist/files/navigator/DocumentSearchList.js +1 -1
  268. package/dist/files/navigator/DocumentSearchList.js.map +2 -2
  269. package/dist/index.cjs +359 -356
  270. package/dist/index.cjs.map +1 -1
  271. package/dist/presentation/BoxActionBar.d.ts +11 -0
  272. package/dist/presentation/BoxActionBar.js +182 -0
  273. package/dist/presentation/BoxActionBar.js.map +7 -0
  274. package/dist/presentation/ClipActionBar.d.ts +26 -0
  275. package/dist/presentation/ClipActionBar.js +103 -0
  276. package/dist/presentation/ClipActionBar.js.map +7 -0
  277. package/dist/presentation/ClipCaptureOverlay.d.ts +14 -0
  278. package/dist/presentation/ClipCaptureOverlay.js +69 -0
  279. package/dist/presentation/ClipCaptureOverlay.js.map +7 -0
  280. package/dist/presentation/ClipImage.d.ts +21 -0
  281. package/dist/presentation/ClipImage.js +119 -0
  282. package/dist/presentation/ClipImage.js.map +7 -0
  283. package/dist/presentation/ClipTray.d.ts +11 -0
  284. package/dist/presentation/ClipTray.js +152 -0
  285. package/dist/presentation/ClipTray.js.map +7 -0
  286. package/dist/presentation/ClipViewControls.d.ts +11 -0
  287. package/dist/presentation/ClipViewControls.js +142 -0
  288. package/dist/presentation/ClipViewControls.js.map +7 -0
  289. package/dist/presentation/DesignMenu.d.ts +8 -0
  290. package/dist/presentation/DesignMenu.js +199 -0
  291. package/dist/presentation/DesignMenu.js.map +7 -0
  292. package/dist/presentation/LayoutMenu.d.ts +17 -0
  293. package/dist/presentation/LayoutMenu.js +122 -0
  294. package/dist/presentation/LayoutMenu.js.map +7 -0
  295. package/dist/presentation/MediaClip.d.ts +15 -0
  296. package/dist/presentation/MediaClip.js +67 -0
  297. package/dist/presentation/MediaClip.js.map +7 -0
  298. package/dist/presentation/Notice.d.ts +6 -0
  299. package/dist/presentation/Notice.js +43 -0
  300. package/dist/presentation/Notice.js.map +7 -0
  301. package/dist/presentation/PresentControls.d.ts +11 -0
  302. package/dist/presentation/PresentControls.js +117 -0
  303. package/dist/presentation/PresentControls.js.map +7 -0
  304. package/dist/presentation/PresentationStage.d.ts +32 -0
  305. package/dist/presentation/PresentationStage.js +232 -0
  306. package/dist/presentation/PresentationStage.js.map +7 -0
  307. package/dist/presentation/PresenterView.d.ts +16 -0
  308. package/dist/presentation/PresenterView.js +100 -0
  309. package/dist/presentation/PresenterView.js.map +7 -0
  310. package/dist/presentation/SlideDecor.d.ts +25 -0
  311. package/dist/presentation/SlideDecor.js +189 -0
  312. package/dist/presentation/SlideDecor.js.map +7 -0
  313. package/dist/presentation/SlidesEditor.d.ts +25 -0
  314. package/dist/presentation/SlidesEditor.js +375 -0
  315. package/dist/presentation/SlidesEditor.js.map +7 -0
  316. package/dist/presentation/StageBox.d.ts +30 -0
  317. package/dist/presentation/StageBox.js +281 -0
  318. package/dist/presentation/StageBox.js.map +7 -0
  319. package/dist/presentation/StageItem.d.ts +37 -0
  320. package/dist/presentation/StageItem.js +211 -0
  321. package/dist/presentation/StageItem.js.map +7 -0
  322. package/dist/presentation/box-style.d.ts +6 -0
  323. package/dist/presentation/box-style.js +19 -0
  324. package/dist/presentation/box-style.js.map +7 -0
  325. package/dist/presentation/boxes.d.ts +105 -0
  326. package/dist/presentation/boxes.js +103 -0
  327. package/dist/presentation/boxes.js.map +7 -0
  328. package/dist/presentation/draw-boxes.d.ts +8 -0
  329. package/dist/presentation/draw-boxes.js +130 -0
  330. package/dist/presentation/draw-boxes.js.map +7 -0
  331. package/dist/presentation/export-boxes.d.ts +10 -0
  332. package/dist/presentation/export-boxes.js +74 -0
  333. package/dist/presentation/export-boxes.js.map +7 -0
  334. package/dist/presentation/export-pptx.d.ts +16 -0
  335. package/dist/presentation/export-pptx.js +194 -0
  336. package/dist/presentation/export-pptx.js.map +7 -0
  337. package/dist/presentation/import-pptx.d.ts +35 -0
  338. package/dist/presentation/import-pptx.js +659 -0
  339. package/dist/presentation/import-pptx.js.map +7 -0
  340. package/dist/presentation/merge-outside-edits.d.ts +12 -0
  341. package/dist/presentation/merge-outside-edits.js +35 -0
  342. package/dist/presentation/merge-outside-edits.js.map +7 -0
  343. package/dist/presentation/model.d.ts +201 -0
  344. package/dist/presentation/model.js +271 -0
  345. package/dist/presentation/model.js.map +7 -0
  346. package/dist/presentation/panel-id.d.ts +44 -0
  347. package/dist/presentation/panel-id.js +29 -0
  348. package/dist/presentation/panel-id.js.map +7 -0
  349. package/dist/presentation/persistence.d.ts +121 -0
  350. package/dist/presentation/persistence.js +141 -0
  351. package/dist/presentation/persistence.js.map +7 -0
  352. package/dist/presentation/pptx-data.d.ts +22 -0
  353. package/dist/presentation/pptx-data.js +83 -0
  354. package/dist/presentation/pptx-data.js.map +7 -0
  355. package/dist/presentation/pptx-xml.d.ts +90 -0
  356. package/dist/presentation/pptx-xml.js +333 -0
  357. package/dist/presentation/pptx-xml.js.map +7 -0
  358. package/dist/presentation/render-slides.d.ts +58 -0
  359. package/dist/presentation/render-slides.js +309 -0
  360. package/dist/presentation/render-slides.js.map +7 -0
  361. package/dist/presentation/saved-boxes.d.ts +11 -0
  362. package/dist/presentation/saved-boxes.js +80 -0
  363. package/dist/presentation/saved-boxes.js.map +7 -0
  364. package/dist/presentation/slide-layout.d.ts +58 -0
  365. package/dist/presentation/slide-layout.js +133 -0
  366. package/dist/presentation/slide-layout.js.map +7 -0
  367. package/dist/presentation/stage-videos.d.ts +5 -0
  368. package/dist/presentation/stage-videos.js +19 -0
  369. package/dist/presentation/stage-videos.js.map +7 -0
  370. package/dist/presentation/store.d.ts +203 -0
  371. package/dist/presentation/store.js +429 -0
  372. package/dist/presentation/store.js.map +7 -0
  373. package/dist/presentation/theme.d.ts +102 -0
  374. package/dist/presentation/theme.js +276 -0
  375. package/dist/presentation/theme.js.map +7 -0
  376. package/dist/presentation/useClipDrag.d.ts +26 -0
  377. package/dist/presentation/useClipDrag.js +65 -0
  378. package/dist/presentation/useClipDrag.js.map +7 -0
  379. package/dist/presentation/useObjectUrl.d.ts +6 -0
  380. package/dist/presentation/useObjectUrl.js +15 -0
  381. package/dist/presentation/useObjectUrl.js.map +7 -0
  382. package/dist/presentation/usePresenterKeys.d.ts +13 -0
  383. package/dist/presentation/usePresenterKeys.js +62 -0
  384. package/dist/presentation/usePresenterKeys.js.map +7 -0
  385. package/dist/settings/index.cjs +149 -148
  386. package/dist/shell/PanelPortal.js +13 -3
  387. package/dist/shell/PanelPortal.js.map +2 -2
  388. package/dist/shell/index.cjs +49 -46
  389. package/dist/shell/panel-windows.d.ts +2 -0
  390. package/dist/shell/panel-windows.js +8 -2
  391. package/dist/shell/panel-windows.js.map +2 -2
  392. package/dist/studio/index.cjs +8 -6
  393. package/dist/studio/index.cjs.map +1 -1
  394. package/dist/styles.css +1 -1
  395. package/dist/workflow-canvas/index.cjs +26 -25
  396. package/dist/workflow-canvas/index.cjs.map +1 -1
  397. package/node_modules/@arbidocs/coedit/package.json +1 -1
  398. package/package.json +6 -5
  399. package/dist/ConnectedCallDock-WER7R222.cjs.map +0 -1
  400. package/dist/DocumentReviewCard-BPIAJJED.cjs.map +0 -1
  401. package/dist/FilesViewerDialog-67WK3TZC.cjs.map +0 -1
  402. package/dist/GridViewImpl-ZMJJWTOM.cjs.map +0 -1
  403. package/dist/WorkspaceTableView-J3C6VH4T.cjs.map +0 -1
  404. package/dist/ai-IM4A23YT.cjs.map +0 -1
  405. package/dist/chunk-557MJ4IH.cjs.map +0 -1
  406. package/dist/chunk-6UTKM5AB.cjs.map +0 -1
  407. package/dist/chunk-6WMMZLEV.cjs.map +0 -1
  408. package/dist/chunk-B3LZITVF.cjs.map +0 -1
  409. package/dist/chunk-BUVIBHFU.cjs.map +0 -1
  410. package/dist/chunk-CKCG4NDB.cjs.map +0 -1
  411. package/dist/chunk-CPR6EHG7.cjs.map +0 -1
  412. package/dist/chunk-HA66DHW6.cjs.map +0 -1
  413. package/dist/chunk-NJCK6V6U.cjs.map +0 -1
  414. package/dist/chunk-NLSWDP42.cjs.map +0 -1
  415. package/dist/chunk-PGJYD67F.cjs.map +0 -1
  416. package/dist/chunk-X36UR4A7.cjs.map +0 -1
  417. package/dist/chunk-YYPZOEED.cjs.map +0 -1
@@ -0,0 +1,1374 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkGFUOCGY6_cjs = require('./chunk-GFUOCGY6.cjs');
5
+ var zustand = require('zustand');
6
+ var viewers = require('@arbidocs/react/viewers');
7
+
8
+ // src/presentation/model.ts
9
+ var SLIDE_LAYOUTS = [
10
+ "clips",
11
+ "points",
12
+ "compare",
13
+ "title",
14
+ "section",
15
+ "free"
16
+ ];
17
+ var STAGE_ASPECT = 16 / 9;
18
+ var STAGE_MARGIN = 0.03;
19
+ var STAGE_GAP = 0.02;
20
+ var MIN_FRAME_WIDTH = 0.05;
21
+ var SNAP_DISTANCE = 0.012;
22
+ var CAPTION_SPACE = 0.06;
23
+ var NO_RESERVE = { top: 0, below: 0 };
24
+ function frameHeight(frame, aspect) {
25
+ return frame.w * STAGE_ASPECT / aspect;
26
+ }
27
+ function containWidth(aspect, width, height) {
28
+ return Math.max(0, Math.min(width, height * aspect / STAGE_ASPECT));
29
+ }
30
+ function autoLayout(aspects, reserve = NO_RESERVE) {
31
+ const n = aspects.length;
32
+ if (n === 0) return [];
33
+ const { top, below, right = 0, bottom = 0, columns, inset = 0 } = reserve;
34
+ const left = STAGE_MARGIN + inset;
35
+ const innerW = 1 - 2 * left - right;
36
+ const innerH = 1 - 2 * STAGE_MARGIN - top - bottom;
37
+ let best = null;
38
+ const fixed = columns ? Math.min(columns, n) : 0;
39
+ for (let cols = fixed || 1; cols <= (fixed || n); cols++) {
40
+ const rows = Math.ceil(n / cols);
41
+ const cellW = (innerW - (cols - 1) * STAGE_GAP) / cols;
42
+ const cellH = (innerH - (rows - 1) * STAGE_GAP) / rows;
43
+ if (cellW <= 0 || cellH <= below) continue;
44
+ const frames = [];
45
+ let area = 0;
46
+ for (let i = 0; i < n; i++) {
47
+ const row = Math.floor(i / cols);
48
+ const inRow = row === rows - 1 ? n - row * cols : cols;
49
+ const col = i - row * cols;
50
+ const rowStart = left + (cols - inRow) * (cellW + STAGE_GAP) / 2;
51
+ const w = containWidth(aspects[i], cellW, cellH - below);
52
+ const h = frameHeight({ w }, aspects[i]);
53
+ frames.push({
54
+ x: rowStart + col * (cellW + STAGE_GAP) + (cellW - w) / 2,
55
+ y: STAGE_MARGIN + top + row * (cellH + STAGE_GAP) + (cellH - h - below) / 2,
56
+ w
57
+ });
58
+ area += w * h;
59
+ }
60
+ if (!best || area > best.area + 1e-9) best = { frames, area };
61
+ }
62
+ return best?.frames ?? [];
63
+ }
64
+ function fitFrame(aspect, reserve = NO_RESERVE) {
65
+ return autoLayout([aspect], reserve)[0];
66
+ }
67
+ function fullWidthFrame(frame, aspect, reserve = NO_RESERVE) {
68
+ const { top, below, right = 0, bottom = 0, inset = 0 } = reserve;
69
+ const w = 1 - 2 * (STAGE_MARGIN + inset) - right;
70
+ const h = frameHeight({ w }, aspect);
71
+ if (h + below > 1 - 2 * STAGE_MARGIN - top - bottom) return fitFrame(aspect, reserve);
72
+ const centre = frame.y + frameHeight(frame, aspect) / 2;
73
+ return {
74
+ x: STAGE_MARGIN + inset,
75
+ y: clamp(centre - h / 2, STAGE_MARGIN + top, 1 - STAGE_MARGIN - h - below - bottom),
76
+ w
77
+ };
78
+ }
79
+ function fullHeightFrame(frame, aspect, reserve = NO_RESERVE) {
80
+ const { top, below, right = 0, bottom = 0 } = reserve;
81
+ const inner = 1 - 2 * STAGE_MARGIN;
82
+ const w = (inner - top - below - bottom) * aspect / STAGE_ASPECT;
83
+ if (w > inner - right) return fitFrame(aspect, reserve);
84
+ const centre = frame.x + frame.w / 2;
85
+ return {
86
+ x: clamp(centre - w / 2, STAGE_MARGIN, 1 - STAGE_MARGIN - right - w),
87
+ y: STAGE_MARGIN + top,
88
+ w
89
+ };
90
+ }
91
+ function clamp(value, min, max) {
92
+ return max < min ? (min + max) / 2 : Math.min(Math.max(value, min), max);
93
+ }
94
+ var SNAP_DISTANCE_Y = SNAP_DISTANCE * STAGE_ASPECT;
95
+ function snapTargets(axis, others) {
96
+ const targets = [0, STAGE_MARGIN, 0.5, 1 - STAGE_MARGIN, 1];
97
+ for (const { frame, aspect } of others) {
98
+ const start = axis === "x" ? frame.x : frame.y;
99
+ const size = axis === "x" ? frame.w : frameHeight(frame, aspect);
100
+ targets.push(start, start + size / 2, start + size);
101
+ }
102
+ return targets;
103
+ }
104
+ function snapSpan(start, size, targets, distance) {
105
+ let best = null;
106
+ let bestDistance = distance;
107
+ for (const target of targets) {
108
+ for (const offset of [0, size / 2, size]) {
109
+ const d = Math.abs(start + offset - target);
110
+ if (d < bestDistance) {
111
+ bestDistance = d;
112
+ best = { start: target - offset, at: target };
113
+ }
114
+ }
115
+ }
116
+ return best;
117
+ }
118
+ function moveFrame(frame, aspect, dx, dy, others = [], free = false) {
119
+ const h = frameHeight(frame, aspect);
120
+ let x = frame.x + dx;
121
+ let y = frame.y + dy;
122
+ const guides = [];
123
+ if (!free) {
124
+ const sx = snapSpan(x, frame.w, snapTargets("x", others), SNAP_DISTANCE);
125
+ const sy = snapSpan(y, h, snapTargets("y", others), SNAP_DISTANCE_Y);
126
+ if (sx) {
127
+ x = sx.start;
128
+ guides.push({ axis: "x", at: sx.at });
129
+ }
130
+ if (sy) {
131
+ y = sy.start;
132
+ guides.push({ axis: "y", at: sy.at });
133
+ }
134
+ }
135
+ return { frame: { x: clamp(x, 0, 1 - frame.w), y: clamp(y, 0, 1 - h), w: frame.w }, guides };
136
+ }
137
+ function resizeFrame(frame, aspect, corner, dx, dy, others = [], free = false) {
138
+ const h0 = frameHeight(frame, aspect);
139
+ const west = corner === "nw" || corner === "sw";
140
+ const north = corner === "nw" || corner === "ne";
141
+ const anchorX = west ? frame.x + frame.w : frame.x;
142
+ const anchorY = north ? frame.y + h0 : frame.y;
143
+ const pointerX = (west ? frame.x : frame.x + frame.w) + dx;
144
+ const pointerY = (north ? frame.y : frame.y + h0) + dy;
145
+ const widthOfHeight = (height) => height * aspect / STAGE_ASPECT;
146
+ let w = Math.max(Math.abs(pointerX - anchorX), widthOfHeight(Math.abs(pointerY - anchorY)));
147
+ const guides = [];
148
+ if (!free) {
149
+ const edgeX = west ? anchorX - w : anchorX + w;
150
+ const edgeY = north ? anchorY - frameHeight({ w }, aspect) : anchorY + frameHeight({ w }, aspect);
151
+ const sx = snapSpan(edgeX, 0, snapTargets("x", others), SNAP_DISTANCE);
152
+ const sy = snapSpan(edgeY, 0, snapTargets("y", others), SNAP_DISTANCE_Y);
153
+ const dxSnap = sx ? Math.abs(sx.at - edgeX) : Infinity;
154
+ const dySnap = sy ? Math.abs(sy.at - edgeY) / STAGE_ASPECT : Infinity;
155
+ if (sx && dxSnap <= dySnap) {
156
+ w = Math.abs(sx.at - anchorX);
157
+ guides.push({ axis: "x", at: sx.at });
158
+ } else if (sy) {
159
+ w = widthOfHeight(Math.abs(sy.at - anchorY));
160
+ guides.push({ axis: "y", at: sy.at });
161
+ }
162
+ }
163
+ const maxW = Math.min(west ? anchorX : 1 - anchorX, widthOfHeight(north ? anchorY : 1 - anchorY));
164
+ w = clamp(w, Math.min(MIN_FRAME_WIDTH, maxW), maxW);
165
+ const h = frameHeight({ w }, aspect);
166
+ return { frame: { x: west ? anchorX - w : anchorX, y: north ? anchorY - h : anchorY, w }, guides };
167
+ }
168
+ var MIN_CLIP_SPAN = 0.02;
169
+ function reshapeFrame(frame, clip, edge, dx, dy, others = [], free = false) {
170
+ const { rect, aspect } = clip;
171
+ const horizontal = edge === "e" || edge === "w";
172
+ const far = edge === "e" || edge === "s";
173
+ const start = horizontal ? frame.x : frame.y;
174
+ const size = horizontal ? frame.w : frameHeight(frame, aspect);
175
+ const sourceStart = horizontal ? rect.x : rect.y;
176
+ const sourceSize = horizontal ? rect.w : rect.h;
177
+ const scale = size / sourceSize;
178
+ const axis = horizontal ? "x" : "y";
179
+ let at = (far ? start + size : start) + (horizontal ? dx : dy);
180
+ if (!free) {
181
+ const distance = horizontal ? SNAP_DISTANCE : SNAP_DISTANCE_Y;
182
+ const snap = snapSpan(at, 0, snapTargets(axis, others), distance);
183
+ if (snap) at = snap.at;
184
+ }
185
+ const least = Math.min(
186
+ size,
187
+ Math.max(horizontal ? MIN_FRAME_WIDTH : MIN_FRAME_WIDTH * STAGE_ASPECT, MIN_CLIP_SPAN * scale)
188
+ );
189
+ const end = start + size;
190
+ const most = far ? Math.min(1 - start, (1 - sourceStart) * scale) : Math.min(end, (sourceStart + sourceSize) * scale);
191
+ const nextSize = clamp(far ? at - start : end - at, least, Math.max(most, size));
192
+ const nextSourceSize = nextSize / scale;
193
+ const nextStart = far ? start : end - nextSize;
194
+ const nextSourceStart = far ? sourceStart : sourceStart + sourceSize - nextSourceSize;
195
+ const nextRect = horizontal ? { ...rect, x: nextSourceStart, w: nextSourceSize } : { ...rect, y: nextSourceStart, h: nextSourceSize };
196
+ const sourceAspect = aspect * rect.h / rect.w;
197
+ const edgeAt = far ? nextStart + nextSize : nextStart;
198
+ return {
199
+ frame: horizontal ? { x: nextStart, y: frame.y, w: nextSize } : { x: frame.x, y: nextStart, w: frame.w },
200
+ rect: nextRect,
201
+ aspect: sourceAspect * nextRect.w / nextRect.h,
202
+ // A guide only where the edge did snap (not where a bound stopped it).
203
+ guides: !free && Math.abs(edgeAt - at) < 1e-9 && snapTargets(axis, others).includes(at) ? [{ axis, at }] : []
204
+ };
205
+ }
206
+ function alignFrame(frame, aspect, alignment, reserve = NO_RESERVE) {
207
+ const h = frameHeight(frame, aspect);
208
+ const right = reserve.right ?? 0;
209
+ const side = STAGE_MARGIN + (reserve.inset ?? 0);
210
+ const below = reserve.below + (reserve.bottom ?? 0);
211
+ switch (alignment) {
212
+ case "left":
213
+ return { ...frame, x: side };
214
+ case "centre":
215
+ return { ...frame, x: (1 - right - frame.w) / 2 };
216
+ case "right":
217
+ return { ...frame, x: 1 - side - right - frame.w };
218
+ case "top":
219
+ return { ...frame, y: STAGE_MARGIN + reserve.top };
220
+ case "middle":
221
+ return { ...frame, y: (1 + reserve.top - below - h) / 2 };
222
+ case "bottom":
223
+ return { ...frame, y: 1 - STAGE_MARGIN - below - h };
224
+ }
225
+ }
226
+ function dropFrame(aspect, at) {
227
+ const fit = fitFrame(aspect);
228
+ const w = Math.min(fit.w, 0.45);
229
+ const h = frameHeight({ w }, aspect);
230
+ return { x: clamp(at.x - w / 2, 0, 1 - w), y: clamp(at.y - h / 2, 0, 1 - h), w };
231
+ }
232
+ function defaultCaption(fileName, page) {
233
+ return `${documentName(fileName)} \xB7 p. ${page}`;
234
+ }
235
+ var documentName = (fileName) => fileName.replace(/\.[a-z0-9]{1,5}$/i, "") || "Document";
236
+ function formatTime(seconds) {
237
+ const total = Math.max(0, Math.floor(seconds));
238
+ const h = Math.floor(total / 3600);
239
+ const m = Math.floor(total % 3600 / 60);
240
+ const s = String(total % 60).padStart(2, "0");
241
+ return h ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
242
+ }
243
+ function clipLabel(clip, columnValues) {
244
+ const value = columnValues[clip.documentId]?.trim();
245
+ if (!value) return clip.caption;
246
+ return clip.caption ? `${value} \xB7 ${clip.caption}` : value;
247
+ }
248
+ function mediaCaption(fileName, start) {
249
+ const name = documentName(fileName);
250
+ return start === void 0 ? name : `${name} \xB7 ${formatTime(start)}`;
251
+ }
252
+
253
+ // src/presentation/slide-layout.ts
254
+ var TEXT_INSET = 0.06;
255
+ var LAYOUT_INFO = {
256
+ clips: { label: "Title and clips" },
257
+ points: { label: "Clips and points", text: "One point per line" },
258
+ compare: { label: "Side by side" },
259
+ title: { label: "Title slide", text: "Subtitle" },
260
+ section: { label: "Section", text: "Subtitle" },
261
+ free: { label: "Blank" }
262
+ };
263
+ var FOOTER = 0.085;
264
+ function slideGeometry(slide, options) {
265
+ const below = options.labels ? CAPTION_SPACE : 0;
266
+ const bottom = options.logo ? FOOTER : 0;
267
+ const logo = options.logo ? {
268
+ x: options.logo === "bl" ? TEXT_INSET : 1 - TEXT_INSET - 0.16,
269
+ y: 1 - 0.03 - 0.055,
270
+ w: 0.16,
271
+ h: 0.055
272
+ } : null;
273
+ const hasTitle = slide.caption.trim() !== "";
274
+ if (slide.layout === "free") {
275
+ return { title: null, rule: null, text: null, logo, reserve: { top: 0, below, bottom } };
276
+ }
277
+ if (slide.layout === "title" || slide.layout === "section") {
278
+ const centred = slide.layout === "title";
279
+ const title2 = centred ? {
280
+ x: 0.1,
281
+ y: 0.28,
282
+ w: 0.8,
283
+ h: 0.2,
284
+ size: 0.052,
285
+ weight: 700,
286
+ align: "center",
287
+ tone: "title",
288
+ leading: 1.1,
289
+ // Just above the rule, however many lines it takes.
290
+ anchor: "bottom"
291
+ } : {
292
+ x: TEXT_INSET + 0.02,
293
+ y: 0.36,
294
+ w: 0.8,
295
+ h: 0.18,
296
+ size: 0.046,
297
+ weight: 700,
298
+ align: "left",
299
+ tone: "title",
300
+ leading: 1.1
301
+ };
302
+ return {
303
+ title: title2,
304
+ rule: centred ? { x: 0.47, y: 0.505, w: 0.06, h: 7e-3 } : { x: TEXT_INSET + 0.02, y: 0.33, w: 0.07, h: 8e-3 },
305
+ text: {
306
+ x: title2.x,
307
+ y: centred ? 0.545 : 0.555,
308
+ w: title2.w,
309
+ h: 0.1,
310
+ size: 0.021,
311
+ weight: 400,
312
+ align: title2.align,
313
+ tone: "muted",
314
+ leading: 1.3
315
+ },
316
+ logo,
317
+ // Clips, if any, go under the text.
318
+ reserve: { top: 0.62, below, bottom }
319
+ };
320
+ }
321
+ const title = {
322
+ x: TEXT_INSET,
323
+ y: 0.05,
324
+ w: 1 - 2 * TEXT_INSET,
325
+ h: 0.075,
326
+ size: 0.03,
327
+ weight: 600,
328
+ align: "left",
329
+ tone: "title",
330
+ leading: 1.15
331
+ };
332
+ const top = hasTitle ? 0.14 : 0;
333
+ const inset = hasTitle || slide.layout === "points" ? TEXT_INSET - STAGE_MARGIN : 0;
334
+ const geometry = {
335
+ title,
336
+ rule: hasTitle ? { x: TEXT_INSET, y: 0.128, w: 0.045, h: 6e-3 } : null,
337
+ text: null,
338
+ logo,
339
+ reserve: { top, below, bottom, inset }
340
+ };
341
+ if (slide.layout === "points" && slide.items && slide.items.length === 0) {
342
+ const y = STAGE_MARGIN + top;
343
+ geometry.text = {
344
+ x: TEXT_INSET,
345
+ y,
346
+ w: 1 - 2 * TEXT_INSET,
347
+ h: 1 - y - STAGE_MARGIN - bottom,
348
+ size: 0.024,
349
+ weight: 400,
350
+ align: "left",
351
+ tone: "body",
352
+ bullets: true,
353
+ leading: 1.45
354
+ };
355
+ return geometry;
356
+ }
357
+ if (slide.layout === "points") {
358
+ const y = STAGE_MARGIN + top;
359
+ geometry.text = {
360
+ x: 0.6,
361
+ y,
362
+ w: 1 - 0.6 - TEXT_INSET,
363
+ h: 1 - y - STAGE_MARGIN - bottom - below,
364
+ // Level with the clips, which are centred in their room.
365
+ anchor: "middle",
366
+ size: 0.0195,
367
+ weight: 400,
368
+ align: "left",
369
+ tone: "body",
370
+ bullets: true,
371
+ leading: 1.45
372
+ };
373
+ geometry.reserve = { ...geometry.reserve, right: 0.4 - inset };
374
+ }
375
+ if (slide.layout === "compare") geometry.reserve = { ...geometry.reserve, columns: 2 };
376
+ return geometry;
377
+ }
378
+ var textLines = (text) => text.split("\n").map((line) => line.trim()).filter(Boolean);
379
+
380
+ // src/presentation/theme.ts
381
+ var BRAND = "brand";
382
+ var DEFAULT_THEME = {
383
+ background: BRAND,
384
+ font: "sans",
385
+ accent: BRAND,
386
+ logo: null
387
+ };
388
+ var BACKGROUNDS = [
389
+ // The app's primary colour, read from its tokens when drawn (`brandColors`).
390
+ { id: BRAND, label: "Brand", from: "", to: "", glow: 0.1 },
391
+ { id: "graphite", label: "Graphite", from: "#2b3038", to: "#0c0e11", glow: 0.09 },
392
+ { id: "midnight", label: "Midnight", from: "#17294a", to: "#050a15", glow: 0.1 },
393
+ { id: "oxford", label: "Oxford", from: "#123d45", to: "#04141a", glow: 0.08 },
394
+ { id: "claret", label: "Claret", from: "#4b1526", to: "#110409", glow: 0.08 },
395
+ { id: "linen", label: "Linen", from: "#2a2b30", to: "#111215", glow: 0.06, texture: "linen" },
396
+ { id: "onyx", label: "Onyx", from: "#000000", to: "#000000", glow: 0 }
397
+ ];
398
+ var FONTS = {
399
+ sans: {
400
+ label: "Modern",
401
+ css: 'Calibri, Carlito, "Segoe UI", "Helvetica Neue", Arial, sans-serif',
402
+ pptx: "Calibri"
403
+ },
404
+ serif: {
405
+ label: "Editorial",
406
+ css: 'Georgia, Gelasio, "Times New Roman", serif',
407
+ pptx: "Georgia"
408
+ },
409
+ classic: {
410
+ label: "Classic",
411
+ css: 'Garamond, "EB Garamond", "Cormorant Garamond", "Times New Roman", serif',
412
+ pptx: "Garamond"
413
+ }
414
+ };
415
+ var ACCENTS = [
416
+ { label: "Brand", color: BRAND },
417
+ { label: "Gold", color: "#c9a96e" },
418
+ { label: "Teal", color: "#4fb3bf" },
419
+ { label: "Blue", color: "#6b9bf2" },
420
+ { label: "Coral", color: "#e57a6e" },
421
+ { label: "Silver", color: "#cfd4dc" }
422
+ ];
423
+ var TEXT_COLORS = { title: "#ffffff", body: "#e6e8ec", muted: "#aab0ba" };
424
+ var HEX = /^#[0-9a-f]{6}$/i;
425
+ var isHexColor = (value) => HEX.test(value);
426
+ function mix(hex, toward, amount) {
427
+ const channel = (i) => {
428
+ const value = parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
429
+ return Math.round(value + (toward - value) * amount).toString(16).padStart(2, "0");
430
+ };
431
+ return `#${channel(0)}${channel(1)}${channel(2)}`;
432
+ }
433
+ var BRAND_TOKENS = { primary: "229.85 50.43% 25.29%", secondary: "195 100% 47%" };
434
+ function hslToHex(h, s, l) {
435
+ const k = (n) => (n + h / 30) % 12;
436
+ const a = s * Math.min(l, 1 - l);
437
+ const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
438
+ return `#${[f(0), f(8), f(4)].map(
439
+ (x) => Math.round(x * 255).toString(16).padStart(2, "0")
440
+ ).join("")}`;
441
+ }
442
+ function readToken(name, fallback) {
443
+ const value = typeof document !== "undefined" && getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
444
+ const [h, s, l] = value.split(/\s+/).map((part) => parseFloat(part));
445
+ return [h, s / 100, l / 100];
446
+ }
447
+ var brand = null;
448
+ function brandColors() {
449
+ if (brand) return brand;
450
+ const [ph, ps, pl] = readToken("--primary", BRAND_TOKENS.primary);
451
+ const [sh, ss, sl] = readToken("--secondary", BRAND_TOKENS.secondary);
452
+ brand = { primary: hslToHex(ph, ps, Math.min(pl, 0.3)), secondary: hslToHex(sh, ss, sl) };
453
+ return brand;
454
+ }
455
+ var accentColor = (accent) => accent === BRAND ? brandColors().secondary : accent;
456
+ function backgroundSpec(background) {
457
+ if (background === BRAND) {
458
+ const { primary } = brandColors();
459
+ return { from: mix(primary, 255, 0.05), to: mix(primary, 0, 0.6), glow: 0.1 };
460
+ }
461
+ const preset = BACKGROUNDS.find((entry) => entry.id === background);
462
+ if (preset) return preset;
463
+ if (isHexColor(background)) {
464
+ return { from: mix(background, 255, 0.06), to: mix(background, 0, 0.62), glow: 0.08 };
465
+ }
466
+ return backgroundSpec(BRAND);
467
+ }
468
+ function backgroundCss(background) {
469
+ const spec = backgroundSpec(background);
470
+ const layers = [];
471
+ if (spec.glow > 0) {
472
+ layers.push(
473
+ `radial-gradient(120% 90% at 12% -10%, rgba(255,255,255,${spec.glow}), transparent 60%)`
474
+ );
475
+ }
476
+ if (spec.texture === "linen") {
477
+ layers.push(
478
+ "repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 0.06cqw, transparent 0.06cqw 0.32cqw)",
479
+ "repeating-linear-gradient(-45deg, rgba(255,255,255,0.02) 0 0.06cqw, transparent 0.06cqw 0.32cqw)"
480
+ );
481
+ }
482
+ layers.push(`linear-gradient(155deg, ${spec.from} 0%, ${spec.to} 100%)`);
483
+ return layers.join(", ");
484
+ }
485
+ function paintBackground(context, width, height, background) {
486
+ const spec = backgroundSpec(background);
487
+ const angle = 155 * Math.PI / 180;
488
+ const dx = Math.sin(angle);
489
+ const dy = -Math.cos(angle);
490
+ const length = Math.abs(width * dx) + Math.abs(height * dy);
491
+ const cx = width / 2;
492
+ const cy = height / 2;
493
+ const gradient = context.createLinearGradient(
494
+ cx - dx * length / 2,
495
+ cy - dy * length / 2,
496
+ cx + dx * length / 2,
497
+ cy + dy * length / 2
498
+ );
499
+ gradient.addColorStop(0, spec.from);
500
+ gradient.addColorStop(1, spec.to);
501
+ context.fillStyle = gradient;
502
+ context.fillRect(0, 0, width, height);
503
+ if (spec.texture === "linen") {
504
+ const step = width * 32e-4;
505
+ context.save();
506
+ context.lineWidth = width * 6e-4;
507
+ for (const [direction, alpha] of [
508
+ [1, 0.025],
509
+ [-1, 0.02]
510
+ ]) {
511
+ context.strokeStyle = `rgba(255,255,255,${alpha})`;
512
+ context.beginPath();
513
+ for (let offset = -height; offset < width + height; offset += step) {
514
+ context.moveTo(offset, direction === 1 ? height : 0);
515
+ context.lineTo(offset + height, direction === 1 ? 0 : height);
516
+ }
517
+ context.stroke();
518
+ }
519
+ context.restore();
520
+ }
521
+ if (spec.glow > 0) {
522
+ const rx = width * 1.2;
523
+ const ry = height * 0.9;
524
+ context.save();
525
+ context.translate(width * 0.12, -height * 0.1);
526
+ context.scale(rx, ry);
527
+ const glow = context.createRadialGradient(0, 0, 0, 0, 0, 1);
528
+ glow.addColorStop(0, `rgba(255,255,255,${spec.glow})`);
529
+ glow.addColorStop(0.6, "rgba(255,255,255,0)");
530
+ context.fillStyle = glow;
531
+ context.fillRect(-1, -1, 2, 2);
532
+ context.restore();
533
+ }
534
+ }
535
+ var CLIP_EDGE_SOLID = 2e-3;
536
+ var CLIP_EDGE_FADE = 9e-3;
537
+ var CLIP_EDGE_MAX = 0.08;
538
+ function clipEdgeCss() {
539
+ const solid = `min(${CLIP_EDGE_SOLID * 100}cqw, ${CLIP_EDGE_MAX * 25}%)`;
540
+ const fade = `min(${CLIP_EDGE_FADE * 100}cqw, ${CLIP_EDGE_MAX * 100}%)`;
541
+ return ["to right", "to left", "to bottom", "to top"].map(
542
+ (direction) => `linear-gradient(${direction}, #fff 0, #fff ${solid}, rgba(255,255,255,0) ${fade})`
543
+ ).join(", ");
544
+ }
545
+ function paintClipEdge(context, box, stageWidth) {
546
+ const sides = [
547
+ { length: box.width, from: [box.x, 0], to: [box.x + 1, 0] },
548
+ { length: box.width, from: [box.x + box.width, 0], to: [box.x + box.width - 1, 0] },
549
+ { length: box.height, from: [0, box.y], to: [0, box.y + 1] },
550
+ { length: box.height, from: [0, box.y + box.height], to: [0, box.y + box.height - 1] }
551
+ ];
552
+ for (const side of sides) {
553
+ const fade = Math.min(CLIP_EDGE_FADE * stageWidth, CLIP_EDGE_MAX * side.length);
554
+ const solid = Math.min(CLIP_EDGE_SOLID * stageWidth, CLIP_EDGE_MAX * 0.25 * side.length);
555
+ const [fx, fy] = side.from;
556
+ const [tx, ty] = side.to;
557
+ const gradient = context.createLinearGradient(
558
+ fx,
559
+ fy,
560
+ fx + (tx - fx) * fade,
561
+ fy + (ty - fy) * fade
562
+ );
563
+ gradient.addColorStop(0, "rgba(255,255,255,1)");
564
+ gradient.addColorStop(Math.min(1, solid / fade), "rgba(255,255,255,1)");
565
+ gradient.addColorStop(1, "rgba(255,255,255,0)");
566
+ context.fillStyle = gradient;
567
+ context.fillRect(box.x, box.y, box.width, box.height);
568
+ }
569
+ }
570
+ function slideBackgroundCss(background, media) {
571
+ const image = background.image ? media[background.image] : void 0;
572
+ if (image) return `center / cover no-repeat url("${image}")`;
573
+ if (background.gradient) {
574
+ const { angle, from, to } = background.gradient;
575
+ return `linear-gradient(${angle}deg, ${from}, ${to})`;
576
+ }
577
+ return background.color ?? "#ffffff";
578
+ }
579
+ async function paintSlideBackground(context, width, height, background, media) {
580
+ const image = background.image ? media[background.image] : void 0;
581
+ if (image) {
582
+ const picture = new Image();
583
+ picture.src = image;
584
+ await picture.decode();
585
+ const scale = Math.max(width / picture.width, height / picture.height);
586
+ const w = picture.width * scale;
587
+ const h = picture.height * scale;
588
+ context.drawImage(picture, (width - w) / 2, (height - h) / 2, w, h);
589
+ return;
590
+ }
591
+ if (background.gradient) {
592
+ const { angle, from, to } = background.gradient;
593
+ const radians = angle * Math.PI / 180;
594
+ const dx = Math.sin(radians);
595
+ const dy = -Math.cos(radians);
596
+ const length = Math.abs(width * dx) + Math.abs(height * dy);
597
+ const gradient = context.createLinearGradient(
598
+ width / 2 - dx * length / 2,
599
+ height / 2 - dy * length / 2,
600
+ width / 2 + dx * length / 2,
601
+ height / 2 + dy * length / 2
602
+ );
603
+ gradient.addColorStop(0, from);
604
+ gradient.addColorStop(1, to);
605
+ context.fillStyle = gradient;
606
+ } else {
607
+ context.fillStyle = background.color ?? "#ffffff";
608
+ }
609
+ context.fillRect(0, 0, width, height);
610
+ }
611
+ function isLightBackground(background) {
612
+ const color2 = background?.gradient?.from ?? background?.color;
613
+ if (!color2 || !isHexColor(color2)) return false;
614
+ const n = parseInt(color2.slice(1), 16);
615
+ const luminance = 0.2126 * (n >> 16 & 255) + 0.7152 * (n >> 8 & 255) + 0.0722 * (n & 255);
616
+ return luminance > 150;
617
+ }
618
+ function parseTheme(value) {
619
+ const data = value ?? {};
620
+ const logo = data.logo;
621
+ return {
622
+ background: typeof data.background === "string" && (BACKGROUNDS.some((entry) => entry.id === data.background) || isHexColor(data.background)) ? data.background : DEFAULT_THEME.background,
623
+ font: data.font && data.font in FONTS ? data.font : DEFAULT_THEME.font,
624
+ accent: typeof data.accent === "string" && (isHexColor(data.accent) || data.accent === BRAND) ? data.accent : DEFAULT_THEME.accent,
625
+ logo: logo && typeof logo.documentId === "string" ? {
626
+ documentId: logo.documentId,
627
+ fileName: typeof logo.fileName === "string" ? logo.fileName : "",
628
+ corner: logo.corner === "bl" ? "bl" : "br"
629
+ } : null
630
+ };
631
+ }
632
+
633
+ // src/presentation/saved-boxes.ts
634
+ var HEX2 = /^#[0-9a-f]{6}$/i;
635
+ var SHAPES = ["text", "rect", "roundRect", "ellipse", "line"];
636
+ var ALIGNS = ["left", "center", "right", "justify"];
637
+ var num = (v) => typeof v === "number" && Number.isFinite(v);
638
+ var color = (v) => typeof v === "string" && HEX2.test(v) ? v.toLowerCase() : void 0;
639
+ function parseRun(value) {
640
+ const run = value;
641
+ if (!run || typeof run.text !== "string") return null;
642
+ return {
643
+ text: run.text,
644
+ ...num(run.size) && run.size > 0 && run.size < 400 ? { size: run.size } : {},
645
+ ...run.bold === true ? { bold: true } : {},
646
+ ...run.italic === true ? { italic: true } : {},
647
+ ...run.underline === true ? { underline: true } : {},
648
+ ...color(run.color) ? { color: color(run.color) } : {},
649
+ ...typeof run.font === "string" && run.font ? { font: run.font.slice(0, 64) } : {}
650
+ };
651
+ }
652
+ function parseParagraph(value) {
653
+ const paragraph = value;
654
+ if (!paragraph || !Array.isArray(paragraph.runs)) return null;
655
+ return {
656
+ runs: paragraph.runs.map(parseRun).filter((run) => run !== null),
657
+ ...ALIGNS.includes(paragraph.align) ? { align: paragraph.align } : {},
658
+ ...num(paragraph.level) && paragraph.level > 0 ? { level: Math.min(8, Math.round(paragraph.level)) } : {},
659
+ ...paragraph.bullet === true ? { bullet: true } : {}
660
+ };
661
+ }
662
+ function parseBox(value) {
663
+ const box = value;
664
+ const frame = box?.frame;
665
+ if (!box || !frame || !num(frame.x) || !num(frame.y) || !num(frame.w) || !num(frame.h) || frame.w < 0 || frame.h < 0 || !SHAPES.includes(box.shape)) {
666
+ return null;
667
+ }
668
+ const line = box.line;
669
+ return {
670
+ frame: { x: frame.x, y: frame.y, w: frame.w, h: frame.h },
671
+ shape: box.shape,
672
+ paragraphs: Array.isArray(box.paragraphs) ? box.paragraphs.map(parseParagraph).filter((p) => p !== null) : [],
673
+ ...num(box.rotation) && box.rotation % 360 !== 0 ? { rotation: box.rotation % 360 } : {},
674
+ ...box.flipH === true ? { flipH: true } : {},
675
+ ...box.flipV === true ? { flipV: true } : {},
676
+ ...color(box.fill) ? { fill: color(box.fill) } : {},
677
+ ...num(box.fillAlpha) && box.fillAlpha >= 0 && box.fillAlpha < 1 ? { fillAlpha: box.fillAlpha } : {},
678
+ ...line && color(line.color) && num(line.width) && line.width >= 0 ? {
679
+ line: {
680
+ color: color(line.color),
681
+ width: line.width,
682
+ ...line.dash === true ? { dash: true } : {}
683
+ }
684
+ } : {},
685
+ ...box.anchor === "middle" || box.anchor === "bottom" || box.anchor === "top" ? { anchor: box.anchor } : {},
686
+ ...num(box.inset) && box.inset >= 0 ? { inset: box.inset } : {},
687
+ ...box.role === "title" || box.role === "body" ? { role: box.role } : {},
688
+ ...box.front === true ? { front: true } : {}
689
+ };
690
+ }
691
+ function parseBoxes(value) {
692
+ return Array.isArray(value) ? value.map(parseBox).filter((b) => b !== null) : [];
693
+ }
694
+ function parseBackground(value, media) {
695
+ const background = value;
696
+ if (!background || typeof background !== "object") return void 0;
697
+ const gradient = background.gradient;
698
+ const parsed = {
699
+ ...color(background.color) ? { color: color(background.color) } : {},
700
+ ...gradient && color(gradient.from) && color(gradient.to) && num(gradient.angle) ? {
701
+ gradient: { from: color(gradient.from), to: color(gradient.to), angle: gradient.angle }
702
+ } : {},
703
+ ...typeof background.image === "string" && media[background.image] ? { image: background.image } : {}
704
+ };
705
+ return Object.keys(parsed).length ? parsed : void 0;
706
+ }
707
+
708
+ // src/presentation/persistence.ts
709
+ var PRESENTATIONS_FOLDER = "Presentations";
710
+ var TEMPLATES_FOLDER = `${PRESENTATIONS_FOLDER}/Templates`;
711
+ var EXPORTS_FOLDER = `${PRESENTATIONS_FOLDER}/Exports`;
712
+ var PRESENTATION_ATTACHMENT = "arbi-presentation.json";
713
+ var FORMAT = "arbi-presentation";
714
+ function serializePresentation(snapshot) {
715
+ const index = new Map(snapshot.clips.map((clip, i) => [clip.id, i]));
716
+ return {
717
+ format: FORMAT,
718
+ version: 1,
719
+ title: snapshot.title,
720
+ captions: snapshot.captions,
721
+ ...snapshot.labelColumn ? { labelColumn: snapshot.labelColumn } : {},
722
+ ...snapshot.theme ? { theme: snapshot.theme } : {},
723
+ clips: snapshot.clips.map((clip) => ({
724
+ kind: clip.kind,
725
+ documentId: clip.documentId,
726
+ ...clip.version !== void 0 ? { version: clip.version } : {},
727
+ fileName: clip.fileName,
728
+ page: clip.page,
729
+ rect: clip.rect,
730
+ aspect: clip.aspect,
731
+ caption: clip.caption,
732
+ ...clip.start !== void 0 ? { start: clip.start } : {},
733
+ ...clip.zoomBase !== void 0 ? { zoomBase: clip.zoomBase } : {},
734
+ ...clip.media ? { media: clip.media } : {},
735
+ ...clip.plain ? { plain: true } : {}
736
+ })),
737
+ slides: snapshot.slides.map((slide, i) => ({
738
+ caption: slide.caption,
739
+ auto: slide.auto,
740
+ layout: slide.layout ?? "clips",
741
+ ...slide.points ? { points: slide.points } : {},
742
+ items: slide.items.filter((item) => index.has(item.clipId)).map((item) => ({ clip: index.get(item.clipId), frame: item.frame })),
743
+ ...slide.boxes?.length ? { boxes: slide.boxes.map(({ id: _id, ...box }) => (box)) } : {},
744
+ ...slide.background ? { background: slide.background } : {},
745
+ ...slide.notes?.trim() ? { notes: slide.notes } : {},
746
+ ...snapshot.fingerprints?.[i] ? { fingerprint: snapshot.fingerprints[i] } : {}
747
+ })),
748
+ ...usedMedia(snapshot) ? { media: usedMedia(snapshot) } : {}
749
+ };
750
+ }
751
+ function usedMedia(snapshot) {
752
+ const media = snapshot.media ?? {};
753
+ const keys = /* @__PURE__ */ new Set();
754
+ for (const clip of snapshot.clips) if (clip.media) keys.add(clip.media);
755
+ for (const slide of snapshot.slides) if (slide.background?.image) keys.add(slide.background.image);
756
+ const used = Object.fromEntries(
757
+ [...keys].filter((key) => media[key]).map((key) => [key, media[key]])
758
+ );
759
+ return Object.keys(used).length ? used : void 0;
760
+ }
761
+ var isNumber = (v) => typeof v === "number" && Number.isFinite(v);
762
+ var isRect = (v) => {
763
+ const r = v;
764
+ return !!r && isNumber(r.x) && isNumber(r.y) && isNumber(r.w) && isNumber(r.h) && r.w > 0 && r.h > 0;
765
+ };
766
+ var isFrame = (v) => {
767
+ const f = v;
768
+ return !!f && isNumber(f.x) && isNumber(f.y) && isNumber(f.w) && f.w > 0;
769
+ };
770
+ function parsePresentation(text) {
771
+ const data = JSON.parse(text);
772
+ if (data?.format !== FORMAT || data.version !== 1) throw new Error("Not a presentation file");
773
+ const clips = Array.isArray(data.clips) ? data.clips : [];
774
+ const slides = Array.isArray(data.slides) ? data.slides : [];
775
+ const media = data.media && typeof data.media === "object" ? Object.fromEntries(
776
+ Object.entries(data.media).filter(
777
+ ([, url]) => typeof url === "string" && url.startsWith("data:image/")
778
+ )
779
+ ) : {};
780
+ for (const clip of clips) {
781
+ if (!["pdf", "image", "video"].includes(clip.kind) || typeof clip.documentId !== "string" || clip.media !== void 0 && !media[clip.media] || !isRect(clip.rect) || !isNumber(clip.aspect) || !isNumber(clip.page)) {
782
+ throw new Error("The presentation file is damaged");
783
+ }
784
+ }
785
+ for (const slide of slides) {
786
+ if (!Array.isArray(slide.items)) throw new Error("The presentation file is damaged");
787
+ for (const item of slide.items) {
788
+ if (!isNumber(item.clip) || !clips[item.clip] || !isFrame(item.frame)) {
789
+ throw new Error("The presentation file is damaged");
790
+ }
791
+ }
792
+ }
793
+ return {
794
+ format: FORMAT,
795
+ version: 1,
796
+ title: typeof data.title === "string" ? data.title : "Presentation",
797
+ captions: data.captions !== false,
798
+ ...data.theme !== void 0 ? { theme: parseTheme(data.theme) } : {},
799
+ ...typeof data.labelColumn === "string" && data.labelColumn ? { labelColumn: data.labelColumn } : {},
800
+ clips,
801
+ slides: slides.map((slide) => {
802
+ const { boxes, background, fingerprint, notes, ...rest } = slide;
803
+ const parsedBoxes = parseBoxes(boxes);
804
+ const parsedBackground = parseBackground(background, media);
805
+ return {
806
+ ...rest,
807
+ layout: SLIDE_LAYOUTS.includes(slide.layout) ? slide.layout : "clips",
808
+ ...typeof slide.points === "string" && slide.points ? { points: slide.points } : {},
809
+ ...parsedBoxes.length ? { boxes: parsedBoxes } : {},
810
+ ...parsedBackground ? { background: parsedBackground } : {},
811
+ ...typeof fingerprint === "string" ? { fingerprint } : {},
812
+ ...typeof notes === "string" && notes.trim() ? { notes } : {}
813
+ };
814
+ }),
815
+ ...Object.keys(media).length ? { media } : {},
816
+ ...data.slidesStale === true ? { slidesStale: true } : {}
817
+ };
818
+ }
819
+ function safeFileStem(title) {
820
+ return title.replace(/[\\/:*?"<>|]+/g, " ").trim() || "Presentation";
821
+ }
822
+ function presentationFileName(title) {
823
+ return `${safeFileStem(title)}.pptx`;
824
+ }
825
+ function presentationTitle(fileName) {
826
+ for (const suffix of [chunkGFUOCGY6_cjs.PRESENTATION_FILE_SUFFIX, chunkGFUOCGY6_cjs.LEGACY_PRESENTATION_SUFFIX, ".pptx", ".pdf"]) {
827
+ if (fileName.endsWith(suffix)) return fileName.slice(0, -suffix.length);
828
+ }
829
+ return fileName;
830
+ }
831
+
832
+ // src/presentation/boxes.ts
833
+ var SLIDE_POINTS = { w: 960, h: 540 };
834
+ var DEFAULT_TEXT_SIZE = 18;
835
+ var DEFAULT_INSET = 7.2;
836
+ var MIN_BOX = 0.02;
837
+ var pointsToStage = (points) => points / SLIDE_POINTS.w;
838
+ var boxText = (box) => box.paragraphs.map((paragraph) => paragraph.runs.map((run) => run.text).join("")).join("\n");
839
+ function withText(box, text) {
840
+ const lines = text.split("\n");
841
+ const fallback = box.paragraphs[box.paragraphs.length - 1] ?? { runs: [{ text: "" }] };
842
+ const paragraphs = lines.map((line, index) => {
843
+ const before = box.paragraphs[index] ?? fallback;
844
+ const { text: _old, ...style } = before.runs[0] ?? { text: "" };
845
+ return { ...before, runs: [{ ...style, text: line }] };
846
+ });
847
+ return { ...box, paragraphs };
848
+ }
849
+ function styleRuns(box, change) {
850
+ return {
851
+ ...box,
852
+ paragraphs: box.paragraphs.map((paragraph) => ({
853
+ ...paragraph,
854
+ runs: paragraph.runs.map(change)
855
+ }))
856
+ };
857
+ }
858
+ var firstRun = (box) => box.paragraphs.find((paragraph) => paragraph.runs.length)?.runs[0];
859
+ var clamp2 = (value, min, max) => max < min ? (min + max) / 2 : Math.min(Math.max(value, min), max);
860
+ function moveBox(frame, dx, dy) {
861
+ return {
862
+ ...frame,
863
+ x: clamp2(frame.x + dx, -frame.w / 2, 1 - frame.w / 2),
864
+ y: clamp2(frame.y + dy, -frame.h / 2, 1 - frame.h / 2)
865
+ };
866
+ }
867
+ function stretchBox(frame, handle, dx, dy) {
868
+ let { x, y, w, h } = frame;
869
+ if (handle.includes("w")) {
870
+ const right = x + w;
871
+ x = Math.min(x + dx, right - MIN_BOX);
872
+ w = right - x;
873
+ } else if (handle.includes("e")) {
874
+ w = Math.max(MIN_BOX, w + dx);
875
+ }
876
+ if (handle.startsWith("n")) {
877
+ const bottom = y + h;
878
+ y = Math.min(y + dy, bottom - MIN_BOX);
879
+ h = bottom - y;
880
+ } else if (handle.startsWith("s")) {
881
+ h = Math.max(MIN_BOX, h + dy);
882
+ }
883
+ return { x, y, w, h };
884
+ }
885
+ var sequence = 0;
886
+ var nextBoxId = () => `box-${Date.now().toString(36)}-${++sequence}`;
887
+ function newBox(shape, accent) {
888
+ const id = nextBoxId();
889
+ if (shape === "text") {
890
+ return {
891
+ id,
892
+ shape,
893
+ frame: { x: 0.3, y: 0.42, w: 0.4, h: 0.12 },
894
+ paragraphs: [{ runs: [{ text: "", size: 24 }] }],
895
+ front: true
896
+ };
897
+ }
898
+ if (shape === "line") {
899
+ return {
900
+ id,
901
+ shape,
902
+ frame: { x: 0.35, y: 0.5, w: 0.3, h: 0 },
903
+ line: { color: accent, width: 2 },
904
+ paragraphs: [],
905
+ front: true
906
+ };
907
+ }
908
+ return {
909
+ id,
910
+ shape,
911
+ frame: { x: 0.35, y: 0.35, w: 0.3, h: 0.3 },
912
+ fill: accent,
913
+ paragraphs: [{ runs: [{ text: "", size: 20, color: "#ffffff" }], align: "center" }],
914
+ anchor: "middle",
915
+ front: false
916
+ };
917
+ }
918
+
919
+ // src/presentation/store.ts
920
+ var MIN_CLIP_AREA = 0.02;
921
+ var MAX_ITEMS_PER_SLIDE = 6;
922
+ var AUTO_PLACE_BELOW = 2;
923
+ var sequence2 = 0;
924
+ var nextId = (kind) => `${kind}-${Date.now().toString(36)}-${++sequence2}`;
925
+ var emptySlide = (layout = "clips") => ({
926
+ id: nextId("slide"),
927
+ items: [],
928
+ auto: true,
929
+ caption: "",
930
+ layout,
931
+ points: "",
932
+ boxes: []
933
+ });
934
+ var initialState = () => ({
935
+ clips: [],
936
+ slides: [emptySlide()],
937
+ current: 0,
938
+ blank: false,
939
+ captions: true,
940
+ theme: DEFAULT_THEME,
941
+ logoImage: null,
942
+ labelColumn: null,
943
+ columnValues: {},
944
+ presenting: false,
945
+ dragging: null,
946
+ notice: null,
947
+ title: "Untitled presentation",
948
+ savedId: null,
949
+ version: null,
950
+ boundTo: null,
951
+ clean: null,
952
+ media: {}
953
+ });
954
+ function arranged(slide, clips, look) {
955
+ const aspects = slide.items.map((item) => aspectOf(clips, item.clipId));
956
+ const frames = autoLayout(aspects, reserveOf(slide, look));
957
+ return {
958
+ ...slide,
959
+ auto: true,
960
+ items: slide.items.map((item, i) => ({ ...item, frame: frames[i] }))
961
+ };
962
+ }
963
+ var reserveOf = (slide, look) => slideGeometry(slide, { labels: look.captions, logo: look.theme.logo?.corner ?? null }).reserve;
964
+ function aspectOf(clips, clipId) {
965
+ return clips.find((clip) => clip.id === clipId)?.aspect ?? 1;
966
+ }
967
+ var usePresentation = zustand.create()((set, get) => {
968
+ const updateSlide = (change, at) => set((state) => {
969
+ const index = at ?? state.current;
970
+ const slide = state.slides[index];
971
+ if (!slide) return state;
972
+ const next = change(slide, state.clips);
973
+ if (next === slide) return state;
974
+ const slides = state.slides.slice();
975
+ slides[index] = next.auto ? arranged(next, state.clips, state) : next;
976
+ return { slides };
977
+ });
978
+ const updateBoxes = (boxId, change) => set((state) => {
979
+ const index = state.slides.findIndex((slide2) => slide2.boxes.some((box) => box.id === boxId));
980
+ if (index < 0) return state;
981
+ const slide = state.slides[index];
982
+ const slides = state.slides.slice();
983
+ slides[index] = {
984
+ ...slide,
985
+ boxes: change(
986
+ slide.boxes,
987
+ slide.boxes.findIndex((box) => box.id === boxId)
988
+ )
989
+ };
990
+ return { slides };
991
+ });
992
+ const restack = (clipId, to) => set((state) => {
993
+ const slide = state.slides[state.current];
994
+ const item = slide?.items.find((entry) => entry.clipId === clipId);
995
+ if (!slide || !item) return state;
996
+ const rest = slide.items.filter((entry) => entry !== item);
997
+ const items = to === "front" ? [...rest, item] : [item, ...rest];
998
+ if (items.every((entry, i) => entry === slide.items[i])) return state;
999
+ const slides = state.slides.slice();
1000
+ slides[state.current] = { ...slide, items };
1001
+ return { slides };
1002
+ });
1003
+ return {
1004
+ ...initialState(),
1005
+ addClip(clip) {
1006
+ const id = nextId("clip");
1007
+ const full = {
1008
+ ...clip,
1009
+ id,
1010
+ caption: clip.caption ?? defaultCaption(clip.fileName, clip.page),
1011
+ zoomBase: clip.zoomBase ?? clip.rect.w
1012
+ };
1013
+ set((state) => ({ clips: [...state.clips, full] }));
1014
+ const slide = get().slides[get().current];
1015
+ if (slide && slide.items.length < AUTO_PLACE_BELOW) get().place(id);
1016
+ return id;
1017
+ },
1018
+ removeClip(clipId) {
1019
+ const { clips, slides } = get();
1020
+ const removed = clips.find((clip) => clip.id === clipId);
1021
+ if (!removed) return;
1022
+ const rest = clips.filter((clip) => clip.id !== clipId);
1023
+ set({
1024
+ clips: rest,
1025
+ slides: slides.map((slide) => {
1026
+ if (!slide.items.some((item) => item.clipId === clipId)) return slide;
1027
+ const next = { ...slide, items: slide.items.filter((item) => item.clipId !== clipId) };
1028
+ return next.auto ? arranged(next, rest, get()) : next;
1029
+ })
1030
+ });
1031
+ if (!rest.some((clip) => clip.source === removed.source))
1032
+ viewers.releasePdfRegionSource(removed.source);
1033
+ },
1034
+ setCaption: (clipId, caption) => set((state) => ({
1035
+ clips: state.clips.map((clip) => clip.id === clipId ? { ...clip, caption } : clip)
1036
+ })),
1037
+ place: (clipId, at) => updateSlide((slide, clips) => {
1038
+ if (!clips.some((clip) => clip.id === clipId)) return slide;
1039
+ const others = slide.items.filter((item) => item.clipId !== clipId);
1040
+ if (!at && others.length < slide.items.length) return slide;
1041
+ if (others.length >= MAX_ITEMS_PER_SLIDE) return slide;
1042
+ const aspect = aspectOf(clips, clipId);
1043
+ const frame = slide.auto ? fitFrame(aspect) : dropFrame(aspect, at ?? { x: 0.5, y: 0.5 });
1044
+ return { ...slide, items: [...others, { clipId, frame }] };
1045
+ }),
1046
+ unplace: (clipId) => updateSlide(
1047
+ (slide) => slide.items.some((item) => item.clipId === clipId) ? { ...slide, items: slide.items.filter((item) => item.clipId !== clipId) } : slide
1048
+ ),
1049
+ setFrame: (clipId, frame) => updateSlide((slide) => ({
1050
+ ...slide,
1051
+ auto: false,
1052
+ items: slide.items.map((item) => item.clipId === clipId ? { ...item, frame } : item)
1053
+ })),
1054
+ applyFrame(clipId, command) {
1055
+ const slide = get().slides[get().current];
1056
+ const item = slide?.items.find((entry) => entry.clipId === clipId);
1057
+ if (!item) return;
1058
+ const aspect = aspectOf(get().clips, clipId);
1059
+ const reserve = reserveOf(slide, get());
1060
+ const frame = command === "fullWidth" ? fullWidthFrame(item.frame, aspect, reserve) : command === "fullHeight" ? fullHeightFrame(item.frame, aspect, reserve) : fitFrame(aspect, reserve);
1061
+ get().setFrame(clipId, frame);
1062
+ get().bringToFront(clipId);
1063
+ },
1064
+ bringToFront: (clipId) => restack(clipId, "front"),
1065
+ sendToBack: (clipId) => restack(clipId, "back"),
1066
+ panClip: (clipId, dx, dy) => set((state) => {
1067
+ const clip = state.clips.find((entry) => entry.id === clipId);
1068
+ if (!clip) return state;
1069
+ const { rect } = clip;
1070
+ const x = Math.min(Math.max(rect.x + dx, 0), 1 - rect.w);
1071
+ const y = Math.min(Math.max(rect.y + dy, 0), 1 - rect.h);
1072
+ if (x === rect.x && y === rect.y) return state;
1073
+ return {
1074
+ clips: state.clips.map(
1075
+ (entry) => entry === clip ? { ...clip, rect: { ...rect, x, y } } : entry
1076
+ )
1077
+ };
1078
+ }),
1079
+ zoomClip: (clipId, factor) => set((state) => {
1080
+ const clip = state.clips.find((entry) => entry.id === clipId);
1081
+ if (!clip || !(factor > 0)) return state;
1082
+ const { rect } = clip;
1083
+ const largest = Math.min(1 / rect.w, 1 / rect.h);
1084
+ const smallest = Math.max(MIN_CLIP_AREA / rect.w, MIN_CLIP_AREA / rect.h);
1085
+ const scale = Math.min(Math.max(1 / factor, smallest), largest);
1086
+ if (scale === 1) return state;
1087
+ const w = rect.w * scale;
1088
+ const h = rect.h * scale;
1089
+ const x = Math.min(Math.max(rect.x + (rect.w - w) / 2, 0), 1 - w);
1090
+ const y = Math.min(Math.max(rect.y + (rect.h - h) / 2, 0), 1 - h);
1091
+ return {
1092
+ clips: state.clips.map(
1093
+ (entry) => entry === clip ? { ...clip, rect: { x, y, w, h } } : entry
1094
+ )
1095
+ };
1096
+ }),
1097
+ setClipZoom(clipId, percent) {
1098
+ const clip = get().clips.find((entry) => entry.id === clipId);
1099
+ if (!clip || !(percent > 0)) return;
1100
+ const width = (clip.zoomBase ?? clip.rect.w) / (percent / 100);
1101
+ get().zoomClip(clipId, clip.rect.w / width);
1102
+ },
1103
+ align(clipId, alignment) {
1104
+ const slide = get().slides[get().current];
1105
+ const item = slide?.items.find((entry) => entry.clipId === clipId);
1106
+ if (!slide || !item) return;
1107
+ const aspect = aspectOf(get().clips, clipId);
1108
+ get().setFrame(clipId, alignFrame(item.frame, aspect, alignment, reserveOf(slide, get())));
1109
+ },
1110
+ nudge(clipId, dx, dy) {
1111
+ const slide = get().slides[get().current];
1112
+ const item = slide?.items.find((entry) => entry.clipId === clipId);
1113
+ if (!item) return;
1114
+ const aspect = aspectOf(get().clips, clipId);
1115
+ get().setFrame(clipId, moveFrame(item.frame, aspect, dx, dy, [], true).frame);
1116
+ },
1117
+ // An auto slide makes (or gives back) the caption's room; one arranged by hand keeps its places.
1118
+ // A blank slide's title is its title box's text.
1119
+ setSlideCaption: (caption, index) => updateSlide(
1120
+ (slide) => ({
1121
+ ...slide,
1122
+ caption,
1123
+ boxes: slide.boxes.map((box) => box.role === "title" ? withText(box, caption) : box)
1124
+ }),
1125
+ index
1126
+ ),
1127
+ setSlideLayout: (layout, index) => updateSlide((slide) => ({ ...slide, layout, auto: true }), index),
1128
+ setSlidePoints: (points, index) => updateSlide((slide) => ({ ...slide, points }), index),
1129
+ setTheme: (change) => set((state) => {
1130
+ const theme = { ...state.theme, ...change };
1131
+ const logoMoved = (theme.logo?.corner ?? null) !== (state.theme.logo?.corner ?? null);
1132
+ return {
1133
+ theme,
1134
+ ...theme.logo?.documentId !== state.theme.logo?.documentId ? { logoImage: null } : {},
1135
+ slides: logoMoved ? state.slides.map(
1136
+ (slide) => slide.auto ? arranged(slide, state.clips, { ...state, theme }) : slide
1137
+ ) : state.slides
1138
+ };
1139
+ }),
1140
+ setLogoImage: (logoImage) => set({ logoImage }),
1141
+ arrange: () => updateSlide((slide) => ({ ...slide, auto: true })),
1142
+ addSlide: (layout, after) => set((state) => {
1143
+ const at = (after ?? state.current) + 1;
1144
+ const slides = state.slides.slice();
1145
+ const before = state.slides[at - 1];
1146
+ const slide = emptySlide(layout ?? before?.layout ?? "clips");
1147
+ slides.splice(
1148
+ at,
1149
+ 0,
1150
+ before?.background ? { ...slide, background: before.background } : slide
1151
+ );
1152
+ return { slides, current: at };
1153
+ }),
1154
+ removeSlide: (index) => set((state) => {
1155
+ const target = index ?? state.current;
1156
+ if (state.slides.length <= 1) return { slides: [emptySlide()], current: 0 };
1157
+ const slides = state.slides.filter((_, i) => i !== target);
1158
+ const current = state.current > target ? state.current - 1 : state.current;
1159
+ return { slides, current: Math.min(current, slides.length - 1) };
1160
+ }),
1161
+ duplicateSlide: (index) => set((state) => {
1162
+ const slide = state.slides[index];
1163
+ if (!slide) return state;
1164
+ const slides = state.slides.slice();
1165
+ slides.splice(index + 1, 0, {
1166
+ ...slide,
1167
+ id: nextId("slide"),
1168
+ items: slide.items.map((item) => ({ ...item, frame: { ...item.frame } })),
1169
+ boxes: slide.boxes.map((box) => ({ ...box, id: nextBoxId() }))
1170
+ });
1171
+ return { slides, current: index + 1 };
1172
+ }),
1173
+ moveSlide: (index, to) => set((state) => {
1174
+ if (to < 0 || to >= state.slides.length || index === to || !state.slides[index]) {
1175
+ return state;
1176
+ }
1177
+ const slides = state.slides.slice();
1178
+ const [slide] = slides.splice(index, 1);
1179
+ slides.splice(to, 0, slide);
1180
+ return { slides, current: to };
1181
+ }),
1182
+ goTo: (index) => set(
1183
+ (state) => index < 0 || index >= state.slides.length || index === state.current ? state : { current: index }
1184
+ ),
1185
+ setBlank: (blank) => set({ blank }),
1186
+ // Slides arranged automatically make (or give back) the captions' room.
1187
+ setCaptions: (captions) => set((state) => ({
1188
+ captions,
1189
+ slides: state.slides.map(
1190
+ (slide) => slide.auto ? arranged(slide, state.clips, { ...state, captions }) : slide
1191
+ )
1192
+ })),
1193
+ setLabelColumn: (labelColumn) => set({ labelColumn }),
1194
+ setColumnValues: (columnValues) => set({ columnValues }),
1195
+ setPresenting: (presenting) => set({ presenting }),
1196
+ setDragging: (dragging) => set({ dragging }),
1197
+ setTitle: (title) => set({ title }),
1198
+ notify: (text, kind) => set({ notice: { text, kind, id: ++sequence2 } }),
1199
+ clearNotice: (id) => set((state) => state.notice?.id === id ? { notice: null } : state),
1200
+ cropClip: (clipId, rect, aspect) => set((state) => {
1201
+ const clips = state.clips.map(
1202
+ (clip) => clip.id === clipId ? { ...clip, rect, aspect } : clip
1203
+ );
1204
+ return {
1205
+ clips,
1206
+ // Its shape changed: slides arranged automatically arrange again around it.
1207
+ slides: state.slides.map(
1208
+ (slide) => slide.auto && slide.items.some((item) => item.clipId === clipId) ? arranged(slide, clips, state) : slide
1209
+ )
1210
+ };
1211
+ }),
1212
+ reshapeClip: (clipId, frame, rect, aspect) => set((state) => {
1213
+ const clip = state.clips.find((entry) => entry.id === clipId);
1214
+ if (!clip) return state;
1215
+ const zoomBase = (clip.zoomBase ?? clip.rect.w) * rect.w / clip.rect.w;
1216
+ const clips = state.clips.map(
1217
+ (entry) => entry === clip ? { ...clip, rect, aspect, zoomBase } : entry
1218
+ );
1219
+ return {
1220
+ clips,
1221
+ slides: state.slides.map((slide, index) => {
1222
+ if (index === state.current) {
1223
+ return {
1224
+ ...slide,
1225
+ auto: false,
1226
+ items: slide.items.map(
1227
+ (item) => item.clipId === clipId ? { ...item, frame } : item
1228
+ )
1229
+ };
1230
+ }
1231
+ return slide.auto && slide.items.some((item) => item.clipId === clipId) ? arranged(slide, clips, state) : slide;
1232
+ })
1233
+ };
1234
+ }),
1235
+ addBox(box, index) {
1236
+ const id = nextBoxId();
1237
+ updateSlide((slide) => ({ ...slide, boxes: [...slide.boxes, { ...box, id }] }), index);
1238
+ return id;
1239
+ },
1240
+ updateBox: (boxId, change) => updateBoxes(boxId, (boxes, at) => {
1241
+ const next = boxes.slice();
1242
+ next[at] = change(boxes[at]);
1243
+ return next;
1244
+ }),
1245
+ setBoxText(boxId, text) {
1246
+ get().updateBox(boxId, (box) => withText(box, text));
1247
+ set((state) => ({
1248
+ slides: state.slides.map(
1249
+ (slide) => slide.boxes.some((box) => box.id === boxId && box.role === "title") ? { ...slide, caption: text.replace(/\s*\n\s*/g, " ").trim() } : slide
1250
+ )
1251
+ }));
1252
+ },
1253
+ removeBox: (boxId) => updateBoxes(boxId, (boxes, at) => boxes.filter((_, i) => i !== at)),
1254
+ restackBox: (boxId, to) => updateBoxes(boxId, (boxes, at) => {
1255
+ const box = { ...boxes[at], front: to === "front" };
1256
+ const rest = boxes.filter((_, i) => i !== at);
1257
+ return to === "front" ? [...rest, box] : [box, ...rest];
1258
+ }),
1259
+ setSlideNotes: (notes, index) => updateSlide((slide) => ({ ...slide, notes }), index),
1260
+ setSlideBackground: (background, index) => updateSlide((slide) => {
1261
+ const { background: _old, ...rest } = slide;
1262
+ return background ? { ...rest, background } : rest;
1263
+ }, index),
1264
+ setSaved: (savedId, title, version = null) => {
1265
+ set({ savedId, title, boundTo: savedId, version });
1266
+ set({ clean: snapshotOf(get()) });
1267
+ },
1268
+ bind: (boundTo) => set({ boundTo }),
1269
+ adoptClips: (adopted) => set((state) => ({
1270
+ clips: [
1271
+ ...state.clips,
1272
+ ...adopted.filter((clip) => !state.clips.some((entry) => entry.id === clip.id))
1273
+ ]
1274
+ })),
1275
+ load(opened) {
1276
+ get().reset();
1277
+ const clips = opened.clips.map((clip) => ({ ...clip, id: nextId("clip") }));
1278
+ const slides = opened.slides.map((slide) => ({
1279
+ id: nextId("slide"),
1280
+ caption: slide.caption,
1281
+ auto: slide.auto,
1282
+ layout: slide.layout ?? "clips",
1283
+ points: slide.points ?? "",
1284
+ // Items whose clip could not be opened are left out.
1285
+ items: slide.items.filter((item) => clips[item.clip]).map((item) => ({ clipId: clips[item.clip].id, frame: item.frame })),
1286
+ boxes: (slide.boxes ?? []).map((box) => ({ ...box, id: nextBoxId() })),
1287
+ ...slide.background ? { background: slide.background } : {},
1288
+ ...slide.notes ? { notes: slide.notes } : {}
1289
+ }));
1290
+ set({
1291
+ title: opened.title,
1292
+ savedId: opened.savedId,
1293
+ version: opened.version ?? null,
1294
+ boundTo: opened.boundTo ?? opened.savedId,
1295
+ captions: opened.captions,
1296
+ labelColumn: opened.labelColumn ?? null,
1297
+ theme: opened.theme ?? DEFAULT_THEME,
1298
+ clips,
1299
+ slides: slides.length ? slides : [emptySlide()],
1300
+ current: 0,
1301
+ media: opened.media ?? {}
1302
+ });
1303
+ set({ clean: opened.savedId ? snapshotOf(get()) : null });
1304
+ },
1305
+ reset() {
1306
+ for (const source of new Set(get().clips.map((clip) => clip.source))) {
1307
+ viewers.releasePdfRegionSource(source);
1308
+ }
1309
+ set(initialState());
1310
+ }
1311
+ };
1312
+ });
1313
+ var currentSlide = (state) => state.slides[state.current];
1314
+ function snapshotOf(state) {
1315
+ return JSON.stringify(serializePresentation({ ...state, media: void 0 }));
1316
+ }
1317
+ function hasUnsavedChanges(state) {
1318
+ if (state.clean !== null) return snapshotOf(state) !== state.clean;
1319
+ return state.clips.length > 0 || state.slides.some(
1320
+ (slide) => slide.items.length || slide.boxes.length || slide.caption.trim() || slide.points.trim()
1321
+ );
1322
+ }
1323
+
1324
+ exports.ACCENTS = ACCENTS;
1325
+ exports.BACKGROUNDS = BACKGROUNDS;
1326
+ exports.DEFAULT_INSET = DEFAULT_INSET;
1327
+ exports.DEFAULT_TEXT_SIZE = DEFAULT_TEXT_SIZE;
1328
+ exports.DEFAULT_THEME = DEFAULT_THEME;
1329
+ exports.EXPORTS_FOLDER = EXPORTS_FOLDER;
1330
+ exports.FONTS = FONTS;
1331
+ exports.LAYOUT_INFO = LAYOUT_INFO;
1332
+ exports.PRESENTATIONS_FOLDER = PRESENTATIONS_FOLDER;
1333
+ exports.PRESENTATION_ATTACHMENT = PRESENTATION_ATTACHMENT;
1334
+ exports.SLIDE_LAYOUTS = SLIDE_LAYOUTS;
1335
+ exports.SLIDE_POINTS = SLIDE_POINTS;
1336
+ exports.STAGE_ASPECT = STAGE_ASPECT;
1337
+ exports.STAGE_MARGIN = STAGE_MARGIN;
1338
+ exports.TEMPLATES_FOLDER = TEMPLATES_FOLDER;
1339
+ exports.TEXT_COLORS = TEXT_COLORS;
1340
+ exports.accentColor = accentColor;
1341
+ exports.backgroundCss = backgroundCss;
1342
+ exports.boxText = boxText;
1343
+ exports.clipEdgeCss = clipEdgeCss;
1344
+ exports.clipLabel = clipLabel;
1345
+ exports.currentSlide = currentSlide;
1346
+ exports.firstRun = firstRun;
1347
+ exports.formatTime = formatTime;
1348
+ exports.frameHeight = frameHeight;
1349
+ exports.hasUnsavedChanges = hasUnsavedChanges;
1350
+ exports.isHexColor = isHexColor;
1351
+ exports.isLightBackground = isLightBackground;
1352
+ exports.mediaCaption = mediaCaption;
1353
+ exports.moveBox = moveBox;
1354
+ exports.moveFrame = moveFrame;
1355
+ exports.newBox = newBox;
1356
+ exports.paintBackground = paintBackground;
1357
+ exports.paintClipEdge = paintClipEdge;
1358
+ exports.paintSlideBackground = paintSlideBackground;
1359
+ exports.parsePresentation = parsePresentation;
1360
+ exports.pointsToStage = pointsToStage;
1361
+ exports.presentationFileName = presentationFileName;
1362
+ exports.presentationTitle = presentationTitle;
1363
+ exports.reshapeFrame = reshapeFrame;
1364
+ exports.resizeFrame = resizeFrame;
1365
+ exports.safeFileStem = safeFileStem;
1366
+ exports.serializePresentation = serializePresentation;
1367
+ exports.slideBackgroundCss = slideBackgroundCss;
1368
+ exports.slideGeometry = slideGeometry;
1369
+ exports.stretchBox = stretchBox;
1370
+ exports.styleRuns = styleRuns;
1371
+ exports.textLines = textLines;
1372
+ exports.usePresentation = usePresentation;
1373
+ //# sourceMappingURL=chunk-4TTX6ZNS.cjs.map
1374
+ //# sourceMappingURL=chunk-4TTX6ZNS.cjs.map