@forgedevstack/ink 1.1.7 → 1.1.9

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 (295) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +9 -1
  3. package/bin/ink.const.mjs +26 -0
  4. package/bin/ink.mjs +58 -0
  5. package/dist/components/InkEditor/InkEditor.cjs +1 -1
  6. package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
  7. package/dist/components/InkEditor/InkEditor.js +1193 -834
  8. package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
  9. package/dist/components/InkEditor/components/AiPanel/AiPanel.d.ts.map +1 -1
  10. package/dist/components/InkEditor/components/AiPanel/AiPanel.js +58 -52
  11. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -0
  12. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts +4 -0
  13. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -0
  14. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +223 -0
  15. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts +10 -0
  16. package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.types.d.ts.map +1 -0
  17. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts +3 -0
  18. package/dist/components/InkEditor/components/ExcelSheetPanel/index.d.ts.map +1 -0
  19. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -0
  20. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts +4 -0
  21. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.d.ts.map +1 -0
  22. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +91 -0
  23. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts +11 -0
  24. package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.types.d.ts.map +1 -0
  25. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts +3 -0
  26. package/dist/components/InkEditor/components/GraphEditModal/index.d.ts.map +1 -0
  27. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -0
  28. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts +4 -0
  29. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.d.ts.map +1 -0
  30. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +98 -0
  31. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts +10 -0
  32. package/dist/components/InkEditor/components/GraphPicker/GraphPicker.types.d.ts.map +1 -0
  33. package/dist/components/InkEditor/components/GraphPicker/index.d.ts +3 -0
  34. package/dist/components/InkEditor/components/GraphPicker/index.d.ts.map +1 -0
  35. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -0
  36. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts +4 -0
  37. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.d.ts.map +1 -0
  38. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +27 -0
  39. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts +7 -0
  40. package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.types.d.ts.map +1 -0
  41. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts +3 -0
  42. package/dist/components/InkEditor/components/HtmlSourcePanel/index.d.ts.map +1 -0
  43. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
  44. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.d.ts.map +1 -1
  45. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +17 -12
  46. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts +1 -0
  47. package/dist/components/InkEditor/components/OutlineRail/OutlineRail.types.d.ts.map +1 -1
  48. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -0
  49. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.cjs +1 -0
  50. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts +7 -0
  51. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.d.ts.map +1 -0
  52. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.const.js +9 -0
  53. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts +4 -0
  54. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.d.ts.map +1 -0
  55. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +82 -0
  56. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts +8 -0
  57. package/dist/components/InkEditor/components/PresenceStack/PresenceStack.types.d.ts.map +1 -0
  58. package/dist/components/InkEditor/components/PresenceStack/index.d.ts +3 -0
  59. package/dist/components/InkEditor/components/PresenceStack/index.d.ts.map +1 -0
  60. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -0
  61. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.cjs +1 -0
  62. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts +7 -0
  63. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.d.ts.map +1 -0
  64. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.const.js +10 -0
  65. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts +4 -0
  66. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.d.ts.map +1 -0
  67. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +65 -0
  68. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts +6 -0
  69. package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.types.d.ts.map +1 -0
  70. package/dist/components/InkEditor/components/RemoteCursors/index.d.ts +3 -0
  71. package/dist/components/InkEditor/components/RemoteCursors/index.d.ts.map +1 -0
  72. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -0
  73. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -0
  74. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts +10 -0
  75. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.d.ts.map +1 -0
  76. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +18 -0
  77. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts +4 -0
  78. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.d.ts.map +1 -0
  79. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +96 -0
  80. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts +11 -0
  81. package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.types.d.ts.map +1 -0
  82. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts +3 -0
  83. package/dist/components/InkEditor/components/TableSizePicker/index.d.ts.map +1 -0
  84. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -0
  85. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts +4 -0
  86. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -0
  87. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +65 -0
  88. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts +12 -0
  89. package/dist/components/InkEditor/components/ThemePicker/ThemePicker.types.d.ts.map +1 -0
  90. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +3 -0
  91. package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +1 -0
  92. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +1 -0
  93. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +13 -0
  94. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +1 -0
  95. package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +39 -0
  96. package/dist/components/InkEditor/components/ThemePicker/index.d.ts +3 -0
  97. package/dist/components/InkEditor/components/ThemePicker/index.d.ts.map +1 -0
  98. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -0
  99. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts +4 -0
  100. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.d.ts.map +1 -0
  101. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +79 -0
  102. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts +10 -0
  103. package/dist/components/InkEditor/components/TitleGallery/TitleGallery.types.d.ts.map +1 -0
  104. package/dist/components/InkEditor/components/TitleGallery/index.d.ts +3 -0
  105. package/dist/components/InkEditor/components/TitleGallery/index.d.ts.map +1 -0
  106. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
  107. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -1
  108. package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +41 -18
  109. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
  110. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -1
  111. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +25 -23
  112. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
  113. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts +1 -1
  114. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.d.ts.map +1 -1
  115. package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +7 -7
  116. package/dist/components/InkEditor/components/index.d.ts +18 -0
  117. package/dist/components/InkEditor/components/index.d.ts.map +1 -1
  118. package/dist/components/InkEditor/helpers/format.utils.cjs +2 -2
  119. package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -1
  120. package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
  121. package/dist/components/InkEditor/helpers/format.utils.js +72 -72
  122. package/dist/components/InkTabs/InkTabs.cjs +1 -0
  123. package/dist/components/InkTabs/InkTabs.d.ts +4 -0
  124. package/dist/components/InkTabs/InkTabs.d.ts.map +1 -0
  125. package/dist/components/InkTabs/InkTabs.js +104 -0
  126. package/dist/components/InkTabs/index.d.ts +2 -0
  127. package/dist/components/InkTabs/index.d.ts.map +1 -0
  128. package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -0
  129. package/dist/components/InkWorkspace/InkWorkspace.d.ts +4 -0
  130. package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -0
  131. package/dist/components/InkWorkspace/InkWorkspace.js +317 -0
  132. package/dist/components/InkWorkspace/components/WorkspaceIcons.cjs +1 -0
  133. package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts +11 -0
  134. package/dist/components/InkWorkspace/components/WorkspaceIcons.d.ts.map +1 -0
  135. package/dist/components/InkWorkspace/components/WorkspaceIcons.js +39 -0
  136. package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -0
  137. package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts +30 -0
  138. package/dist/components/InkWorkspace/hooks/useInkWorkspace.d.ts.map +1 -0
  139. package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +72 -0
  140. package/dist/components/InkWorkspace/index.d.ts +4 -0
  141. package/dist/components/InkWorkspace/index.d.ts.map +1 -0
  142. package/dist/components/index.d.ts +2 -0
  143. package/dist/components/index.d.ts.map +1 -1
  144. package/dist/constants/collab.const.cjs +1 -0
  145. package/dist/constants/collab.const.d.ts +20 -0
  146. package/dist/constants/collab.const.d.ts.map +1 -0
  147. package/dist/constants/collab.const.js +54 -0
  148. package/dist/constants/colorMode.const.cjs +1 -1
  149. package/dist/constants/colorMode.const.d.ts +1 -1
  150. package/dist/constants/colorMode.const.d.ts.map +1 -1
  151. package/dist/constants/colorMode.const.js +4 -4
  152. package/dist/constants/contextMenu.const.cjs +1 -1
  153. package/dist/constants/contextMenu.const.d.ts +2 -0
  154. package/dist/constants/contextMenu.const.d.ts.map +1 -1
  155. package/dist/constants/contextMenu.const.js +17 -15
  156. package/dist/constants/defaultIcons.cjs +1 -1
  157. package/dist/constants/defaultIcons.d.ts.map +1 -1
  158. package/dist/constants/defaultIcons.js +20 -13
  159. package/dist/constants/defaults.const.cjs +1 -1
  160. package/dist/constants/defaults.const.d.ts +48 -0
  161. package/dist/constants/defaults.const.d.ts.map +1 -1
  162. package/dist/constants/defaults.const.js +201 -102
  163. package/dist/constants/generals.const.cjs +1 -1
  164. package/dist/constants/generals.const.d.ts +48 -0
  165. package/dist/constants/generals.const.d.ts.map +1 -1
  166. package/dist/constants/generals.const.js +71 -28
  167. package/dist/constants/index.d.ts +3 -0
  168. package/dist/constants/index.d.ts.map +1 -1
  169. package/dist/constants/numbers.cjs +1 -1
  170. package/dist/constants/numbers.d.ts +14 -0
  171. package/dist/constants/numbers.d.ts.map +1 -1
  172. package/dist/constants/numbers.js +47 -28
  173. package/dist/constants/plugins.const.cjs +1 -0
  174. package/dist/constants/plugins.const.d.ts +13 -0
  175. package/dist/constants/plugins.const.d.ts.map +1 -0
  176. package/dist/constants/plugins.const.js +45 -0
  177. package/dist/constants/table.const.cjs +1 -1
  178. package/dist/constants/table.const.d.ts +4 -0
  179. package/dist/constants/table.const.d.ts.map +1 -1
  180. package/dist/constants/table.const.js +10 -6
  181. package/dist/constants/toolbar.const.cjs +1 -1
  182. package/dist/constants/toolbar.const.d.ts +7 -0
  183. package/dist/constants/toolbar.const.d.ts.map +1 -1
  184. package/dist/constants/toolbar.const.js +16 -9
  185. package/dist/constants/toolbarMenu.const.cjs +1 -1
  186. package/dist/constants/toolbarMenu.const.d.ts +2 -0
  187. package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
  188. package/dist/constants/toolbarMenu.const.js +80 -19
  189. package/dist/constants/workspace.const.cjs +1 -0
  190. package/dist/constants/workspace.const.d.ts +24 -0
  191. package/dist/constants/workspace.const.d.ts.map +1 -0
  192. package/dist/constants/workspace.const.js +23 -0
  193. package/dist/hooks/index.d.ts +4 -0
  194. package/dist/hooks/index.d.ts.map +1 -0
  195. package/dist/hooks/useInkCollaboration.cjs +1 -0
  196. package/dist/hooks/useInkCollaboration.d.ts +4 -0
  197. package/dist/hooks/useInkCollaboration.d.ts.map +1 -0
  198. package/dist/hooks/useInkCollaboration.js +86 -0
  199. package/dist/hooks/useToolbarOverflow.cjs +1 -0
  200. package/dist/hooks/useToolbarOverflow.d.ts +8 -0
  201. package/dist/hooks/useToolbarOverflow.d.ts.map +1 -0
  202. package/dist/hooks/useToolbarOverflow.js +29 -0
  203. package/dist/index.cjs +1 -1
  204. package/dist/index.d.ts +8 -3
  205. package/dist/index.d.ts.map +1 -1
  206. package/dist/index.js +150 -104
  207. package/dist/plugins/excel/excel.utils.cjs +1 -0
  208. package/dist/plugins/excel/excel.utils.d.ts +13 -0
  209. package/dist/plugins/excel/excel.utils.d.ts.map +1 -0
  210. package/dist/plugins/excel/excel.utils.js +40 -0
  211. package/dist/plugins/excel/index.d.ts +3 -0
  212. package/dist/plugins/excel/index.d.ts.map +1 -0
  213. package/dist/plugins/graph/graph.const.cjs +1 -0
  214. package/dist/plugins/graph/graph.const.d.ts +14 -0
  215. package/dist/plugins/graph/graph.const.d.ts.map +1 -0
  216. package/dist/plugins/graph/graph.const.js +24 -0
  217. package/dist/plugins/graph/graph.types.d.ts +7 -0
  218. package/dist/plugins/graph/graph.types.d.ts.map +1 -0
  219. package/dist/plugins/graph/graph.utils.cjs +1 -0
  220. package/dist/plugins/graph/graph.utils.d.ts +11 -0
  221. package/dist/plugins/graph/graph.utils.d.ts.map +1 -0
  222. package/dist/plugins/graph/graph.utils.js +76 -0
  223. package/dist/plugins/graph/index.d.ts +4 -0
  224. package/dist/plugins/graph/index.d.ts.map +1 -0
  225. package/dist/plugins/host/index.d.ts +2 -0
  226. package/dist/plugins/host/index.d.ts.map +1 -0
  227. package/dist/plugins/host/inkPlugins.cjs +1 -0
  228. package/dist/plugins/host/inkPlugins.d.ts +16 -0
  229. package/dist/plugins/host/inkPlugins.d.ts.map +1 -0
  230. package/dist/plugins/host/inkPlugins.js +20 -0
  231. package/dist/plugins/index.d.ts +5 -0
  232. package/dist/plugins/index.d.ts.map +1 -0
  233. package/dist/plugins/theme/index.d.ts +4 -0
  234. package/dist/plugins/theme/index.d.ts.map +1 -0
  235. package/dist/plugins/theme/inkTheme.cjs +1 -0
  236. package/dist/plugins/theme/inkTheme.d.ts +5 -0
  237. package/dist/plugins/theme/inkTheme.d.ts.map +1 -0
  238. package/dist/plugins/theme/inkTheme.js +27 -0
  239. package/dist/plugins/theme/theme.const.cjs +1 -0
  240. package/dist/plugins/theme/theme.const.d.ts +9 -0
  241. package/dist/plugins/theme/theme.const.d.ts.map +1 -0
  242. package/dist/plugins/theme/theme.const.js +15 -0
  243. package/dist/plugins/theme/theme.types.d.ts +12 -0
  244. package/dist/plugins/theme/theme.types.d.ts.map +1 -0
  245. package/dist/plugins/titles/index.d.ts +4 -0
  246. package/dist/plugins/titles/index.d.ts.map +1 -0
  247. package/dist/plugins/titles/titles.const.cjs +1 -0
  248. package/dist/plugins/titles/titles.const.d.ts +4 -0
  249. package/dist/plugins/titles/titles.const.d.ts.map +1 -0
  250. package/dist/plugins/titles/titles.const.js +15 -0
  251. package/dist/plugins/titles/titles.types.d.ts +2 -0
  252. package/dist/plugins/titles/titles.types.d.ts.map +1 -0
  253. package/dist/plugins/titles/titles.utils.cjs +1 -0
  254. package/dist/plugins/titles/titles.utils.d.ts +3 -0
  255. package/dist/plugins/titles/titles.utils.d.ts.map +1 -0
  256. package/dist/plugins/titles/titles.utils.js +14 -0
  257. package/dist/styles.css +1 -1
  258. package/dist/types/collab.types.d.ts +55 -0
  259. package/dist/types/collab.types.d.ts.map +1 -0
  260. package/dist/types/features.types.d.ts +1 -1
  261. package/dist/types/features.types.d.ts.map +1 -1
  262. package/dist/types/index.d.ts +3 -0
  263. package/dist/types/index.d.ts.map +1 -1
  264. package/dist/types/ink.types.d.ts +10 -2
  265. package/dist/types/ink.types.d.ts.map +1 -1
  266. package/dist/types/plugin.types.d.ts +8 -0
  267. package/dist/types/plugin.types.d.ts.map +1 -0
  268. package/dist/types/premium.types.d.ts +1 -1
  269. package/dist/types/premium.types.d.ts.map +1 -1
  270. package/dist/types/workspace.types.d.ts +54 -0
  271. package/dist/types/workspace.types.d.ts.map +1 -0
  272. package/dist/utils/collab.utils.cjs +1 -0
  273. package/dist/utils/collab.utils.d.ts +5 -0
  274. package/dist/utils/collab.utils.d.ts.map +1 -0
  275. package/dist/utils/collab.utils.js +32 -0
  276. package/dist/utils/collab.utils.test.d.ts +2 -0
  277. package/dist/utils/collab.utils.test.d.ts.map +1 -0
  278. package/dist/utils/index.d.ts +3 -1
  279. package/dist/utils/index.d.ts.map +1 -1
  280. package/dist/utils/ink.brand.test.d.ts +2 -0
  281. package/dist/utils/ink.brand.test.d.ts.map +1 -0
  282. package/dist/utils/outline.utils.cjs +1 -1
  283. package/dist/utils/outline.utils.d.ts.map +1 -1
  284. package/dist/utils/outline.utils.js +32 -32
  285. package/dist/utils/table.utils.cjs +1 -1
  286. package/dist/utils/table.utils.d.ts +4 -0
  287. package/dist/utils/table.utils.d.ts.map +1 -1
  288. package/dist/utils/table.utils.js +84 -45
  289. package/dist/utils/workspace.utils.cjs +1 -0
  290. package/dist/utils/workspace.utils.d.ts +5 -0
  291. package/dist/utils/workspace.utils.d.ts.map +1 -0
  292. package/dist/utils/workspace.utils.js +26 -0
  293. package/dist/utils/workspace.utils.test.d.ts +2 -0
  294. package/dist/utils/workspace.utils.test.d.ts.map +1 -0
  295. package/package.json +7 -1
@@ -1,1238 +1,1597 @@
1
- import { jsxs as D, jsx as l, Fragment as qo } from "react/jsx-runtime";
2
- import { useRef as k, useState as a, useEffect as A } from "react";
3
- import { INK_MIN_HEIGHT as $o, NUMBER_ZERO as f, NUMBER_ONE as xt, INK_DEFAULT_TEXT_COLOR as Zo, INK_DEFAULT_HIGHLIGHT_COLOR as Qo } from "../../constants/numbers.js";
4
- import { EMPTY_STRING as ue, INK_FOOTER_WORDS_LABEL as Jo, INK_FOOTER_DOT as er, INK_FOOTER_CHARS_LABEL as tr, INK_FOOTER_LINE_LABEL as nr, INK_FOOTER_COL_LABEL as or, INK_FOOTER_SYNCED_LABEL as rr, INK_CODE_LABEL as lr, INK_AI_PILL_LABEL as Xe } from "../../constants/generals.const.js";
5
- import { TOOLBAR_OPTION_FONT_DROPDOWN as Xt, TOOLBAR_OPTION_LIST_DROPDOWN as Wt, TOOLBAR_OPTION_CHECKLIST as de, TOOLBAR_OPTION_SIGNATURE as Vt, TOOLBAR_OPTION_FIND_REPLACE as Gt, TOOLBAR_OPTION_FIND_REPLACE_DROPDOWN as Yt, TOOLBAR_OPTION_HORIZONTAL_RULE as zt } from "../../constants/toolbar.const.js";
6
- import { TOOLBAR_SHOW_CONTROL_LABEL as ir, TOOLBAR_SHOW_CONTROL_ARIA_LABEL as cr, AGENT_BAR_PLACEHOLDER as sr, CONTEXT_MENU_LABEL_SHOW_TOOLBAR as ar, CONTEXT_MENU_ID_SHOW_TOOLBAR as ur, TOOLBAR_CONTEXT_MENU_LABEL_CUSTOMIZE as dr, TOOLBAR_CONTEXT_MENU_ID_CUSTOMIZE as _r, TOOLBAR_CONTEXT_MENU_LABEL_HIDE as fr, TOOLBAR_CONTEXT_MENU_ID_HIDE as mr, TOOLBAR_OPTION_DIVIDER as jt } from "../../constants/toolbarMenu.const.js";
7
- import { INK_DEFAULT_COLOR_MODE as Tr, COLOR_MODE_SYSTEM as Er } from "../../constants/colorMode.const.js";
8
- import { KEY_TAB as pr, KEY_ENTER as Or, KEY_ESCAPE as Cr, KEY_K as Lr, KEY_Z as Nr } from "../../constants/keyboard.const.js";
9
- import { FONT_VALUE_SYSTEM as Ir, INK_FONT_OPTIONS as Ar, FONT_DROPDOWN_TITLE as hr } from "../../constants/fonts.const.js";
10
- import { LIST_VALUE_BULLET as gr, INK_LIST_OPTIONS as br, LIST_DROPDOWN_TITLE as Rr } from "../../constants/lists.const.js";
11
- import { FIND_REPLACE_FOCUS_FIND as _e, INK_FIND_REPLACE_OPTIONS as Dr, FIND_REPLACE_DROPDOWN_TITLE as Br, FIND_REPLACE_FOCUS_REPLACE as Sr, FIND_REPLACE_VALUE_REPLACE as Mr } from "../../constants/findReplaceMenu.const.js";
12
- import { BLOCK_DROP_POSITION_BEFORE as kr, DIR_LTR as Ur, DIR_RTL as Hr } from "../../constants/blocks.const.js";
13
- import { INK_PLACEHOLDER_DEFAULT as Pr, INK_DEFAULT_VARIANT as wr, INK_DEFAULT_CHROME as yr, INK_DEFAULT_AUTHOR as Fr, INK_TABLE_DEFAULT_ROWS as Kr, INK_TABLE_DEFAULT_COLS as vr, INK_DEFAULT_FEATURES as xr, INK_CHROME_TOOLBAR as Xr, INK_DEFAULT_TOOLBAR as Wr, INK_CLASS_TOOLBAR_SHOW as Vr, INK_CLASS_TOOLBAR as Gr, INK_CLASS_SHELL as Yr, INK_CLASS_BODY as zr, INK_CLASS_CONTENT as jr, INK_CLASS_FOOTER as qr, INK_CLASS_FOOTER_META as $r, INK_VARIANT_DOCUMENT as qt, INK_CLASS_DIVIDER as Zr, INK_HEADING_OPTIONS as Qr, INK_BUTTON_CONFIG as We, INK_CLASS_BUTTON_WIDE as Jr, INK_CLASS_BUTTON_LABEL as el, INK_CLASS_AI_PILL as tl, INK_CLASS_AI_PILL_DOT as nl, INK_CLASS_BLOCK_ACTIVE as ol, INK_CHECKLIST_HTML as $t, INK_CALLOUT_HTML as rl, INK_FORMAT_BLOCK_PRE as ll, INK_FORMAT_BLOCK_QUOTE as il, INK_FORMAT_BLOCK_P as cl, INK_FORMAT_BLOCK_H3 as sl, INK_FORMAT_BLOCK_H2 as al, INK_FORMAT_BLOCK_H1 as ul, INK_CLASS_ROOT as dl } from "../../constants/defaults.const.js";
14
- import { INK_AI_DEMO_PROVIDER_ID as _l } from "../../constants/aiModels.const.js";
1
+ import { jsxs as B, jsx as r, Fragment as dl } from "react/jsx-runtime";
2
+ import { useRef as D, useState as c, useEffect as S } from "react";
3
+ import { INK_MIN_HEIGHT as Tl, NUMBER_ZERO as p, NUMBER_ONE as Cn, INK_DEFAULT_TEXT_COLOR as fl, INK_DEFAULT_HIGHLIGHT_COLOR as El, INK_TABLE_COL_RESIZE_EDGE_PX as Nn } from "../../constants/numbers.js";
4
+ import { EMPTY_STRING as M, INK_TOOLBAR_MORE_TITLE as In, CONTEXT_MENU_LABEL_GRAPH_BAR as ml, CONTEXT_MENU_ID_GRAPH_BAR as pl, CONTEXT_MENU_LABEL_GRAPH_LINE as Ll, CONTEXT_MENU_ID_GRAPH_LINE as Ol, CONTEXT_MENU_LABEL_GRAPH_PIE as Cl, CONTEXT_MENU_ID_GRAPH_PIE as Nl, CONTEXT_MENU_LABEL_GRAPH_EDIT as Il, CONTEXT_MENU_ID_GRAPH_EDIT as Al, CONTEXT_MENU_LABEL_GRAPH_COLORS as hl, CONTEXT_MENU_ID_GRAPH_COLORS as gl, CONTEXT_MENU_LABEL_GRAPH_AI as Rl, CONTEXT_MENU_ID_GRAPH_AI as bl, INK_FOOTER_WORDS_LABEL as Sl, INK_FOOTER_DOT as Bl, INK_FOOTER_CHARS_LABEL as Dl, INK_FOOTER_LINE_LABEL as Ml, INK_FOOTER_COL_LABEL as Hl, INK_FOOTER_SYNCED_LABEL as kl, INK_FULLSCREEN_EXIT_TITLE as Pl, INK_FULLSCREEN_TITLE as Ul, INK_OUTLINE_TOGGLE_TITLE as vl, INK_HTML_SOURCE_TITLE as wl, INK_HTML_SOURCE_LABEL as Kl, INK_CODE_LABEL as Fl, INK_AI_PILL_LABEL as ut, INK_TITLES_DEFAULT_TEXT as An, INK_LINK_PROMPT as yl, INK_LINK_PROMPT_DEFAULT as xl } from "../../constants/generals.const.js";
5
+ import { TOOLBAR_OPTION_FONT_DROPDOWN as hn, TOOLBAR_OPTION_LIST_DROPDOWN as gn, TOOLBAR_OPTION_CHECKLIST as Re, TOOLBAR_OPTION_TITLES as Rn, TOOLBAR_OPTION_EXCEL as bn, TOOLBAR_OPTION_GRAPH as Sn, TOOLBAR_OPTION_THEME as Bn, TOOLBAR_OPTION_FULLSCREEN as Dn, TOOLBAR_OPTION_OUTLINE as Mn, TOOLBAR_OPTION_HTML_SOURCE as Hn, TOOLBAR_OPTION_SIGNATURE as kn, TOOLBAR_OPTION_FIND_REPLACE as Pn, TOOLBAR_OPTION_FIND_REPLACE_DROPDOWN as Un, TOOLBAR_OPTION_HORIZONTAL_RULE as vn } from "../../constants/toolbar.const.js";
6
+ import { TOOLBAR_SHOW_CONTROL_LABEL as Xl, TOOLBAR_SHOW_CONTROL_ARIA_LABEL as Gl, AGENT_BAR_PLACEHOLDER as Wl, CONTEXT_MENU_LABEL_SHOW_TOOLBAR as Vl, CONTEXT_MENU_ID_SHOW_TOOLBAR as Yl, TOOLBAR_CONTEXT_MENU_LABEL_CUSTOMIZE as zl, TOOLBAR_CONTEXT_MENU_ID_CUSTOMIZE as $l, TOOLBAR_CONTEXT_MENU_LABEL_HIDE as ql, TOOLBAR_CONTEXT_MENU_ID_HIDE as jl, TOOLBAR_OPTION_HINTS as O, TOOLBAR_OPTION_DIVIDER as wn } from "../../constants/toolbarMenu.const.js";
7
+ import { INK_DEFAULT_COLOR_MODE as Zl, COLOR_MODE_SYSTEM as Ql } from "../../constants/colorMode.const.js";
8
+ import { KEY_TAB as Jl, KEY_ENTER as ei, KEY_ESCAPE as ti, KEY_K as ni, KEY_Z as oi } from "../../constants/keyboard.const.js";
9
+ import { FONT_VALUE_SYSTEM as ri, INK_FONT_OPTIONS as li, FONT_DROPDOWN_TITLE as ii } from "../../constants/fonts.const.js";
10
+ import { LIST_VALUE_BULLET as ci, INK_LIST_OPTIONS as si, LIST_DROPDOWN_TITLE as ai } from "../../constants/lists.const.js";
11
+ import { FIND_REPLACE_FOCUS_FIND as be, INK_FIND_REPLACE_OPTIONS as ui, FIND_REPLACE_DROPDOWN_TITLE as _i, FIND_REPLACE_FOCUS_REPLACE as di, FIND_REPLACE_VALUE_REPLACE as Ti } from "../../constants/findReplaceMenu.const.js";
12
+ import { BLOCK_DROP_POSITION_BEFORE as fi, DIR_LTR as Ei, DIR_RTL as mi } from "../../constants/blocks.const.js";
13
+ import { INK_PLACEHOLDER_DEFAULT as pi, INK_DEFAULT_VARIANT as Li, INK_DEFAULT_CHROME as Oi, INK_DEFAULT_AUTHOR as Ci, INK_TABLE_DEFAULT_ROWS as Ni, INK_TABLE_DEFAULT_COLS as Ii, INK_DEFAULT_FEATURES as Ai, INK_CHROME_TOOLBAR as hi, INK_DEFAULT_TOOLBAR as gi, INK_VARIANT_DOCUMENT as Kn, INK_CLASS_TOOLBAR_SHOW as Ri, INK_CLASS_TOOLBAR as bi, INK_CLASS_TOOLBAR_MEASURE as Si, INK_CLASS_TOOLBAR_ROW as Bi, INK_ATTR_MORE as Di, INK_CLASS_TOOLBAR_OVERFLOW as Mi, INK_CLASS_TOOLBAR_HINT as Hi, INK_CLASS_SHELL as ki, INK_CLASS_BODY as Pi, INK_CLASS_CONTENT as Fn, INK_CLASS_CONTENT_HIDDEN as Ui, INK_CLASS_FOOTER as vi, INK_CLASS_FOOTER_META as wi, INK_CLASS_TABLE_RESIZE as Te, INK_CLASS_DIVIDER as Ki, INK_HEADING_OPTIONS as Fi, INK_CLASS_BUTTON_WIDE as yn, INK_CLASS_BUTTON_LABEL as xn, INK_BUTTON_CONFIG as _t, INK_CLASS_AI_PILL as Xn, INK_CLASS_AI_PILL_INSTALLED as yi, INK_CLASS_AI_PILL_DOT as xi, INK_ATTR_GRAPH as Xi, INK_CLASS_BLOCK_ACTIVE as Gi, INK_ATTR_GRAPH_POINTS as Gn, INK_ATTR_GRAPH_COLORS as Wi, INK_CHECKLIST_HTML as Wn, INK_CALLOUT_HTML as Vi, INK_FORMAT_BLOCK_PRE as Yi, INK_FORMAT_BLOCK_QUOTE as zi, INK_FORMAT_BLOCK_P as $i, INK_FORMAT_BLOCK_H3 as qi, INK_FORMAT_BLOCK_H2 as ji, INK_FORMAT_BLOCK_H1 as Zi, INK_CLASS_ROOT as Qi } from "../../constants/defaults.const.js";
14
+ import { INK_AI_DEMO_PROVIDER_ID as Ji } from "../../constants/aiModels.const.js";
15
15
  import "../../constants/openai.const.js";
16
- import { INK_DEFAULT_ICONS as Zt } from "../../constants/defaultIcons.js";
17
- import { CONTEXT_MENU_LABEL_TABLE_ROW_ABOVE as fl, CONTEXT_MENU_ID_TABLE_ROW_ABOVE as ml, CONTEXT_MENU_LABEL_TABLE_ROW_BELOW as Tl, CONTEXT_MENU_ID_TABLE_ROW_BELOW as El, CONTEXT_MENU_LABEL_TABLE_COL_LEFT as pl, CONTEXT_MENU_ID_TABLE_COL_LEFT as Ol, CONTEXT_MENU_LABEL_TABLE_COL_RIGHT as Cl, CONTEXT_MENU_ID_TABLE_COL_RIGHT as Ll, CONTEXT_MENU_LABEL_TABLE_DELETE_ROW as Nl, CONTEXT_MENU_ID_TABLE_DELETE_ROW as Il, CONTEXT_MENU_LABEL_TABLE_DELETE_COL as Al, CONTEXT_MENU_ID_TABLE_DELETE_COL as hl, CONTEXT_MENU_LABEL_BOLD as gl, CONTEXT_MENU_ID_BOLD as bl, CONTEXT_MENU_LABEL_ITALIC as Rl, CONTEXT_MENU_ID_ITALIC as Dl, CONTEXT_MENU_LABEL_UNDERLINE as Bl, CONTEXT_MENU_ID_UNDERLINE as Sl, CONTEXT_MENU_LABEL_STRIKE as Ml, CONTEXT_MENU_ID_STRIKE as kl, CONTEXT_MENU_LABEL_HEADING as Ul, CONTEXT_MENU_ID_HEADING as Hl, CONTEXT_MENU_LABEL_BULLET as Pl, CONTEXT_MENU_ID_BULLET as wl, CONTEXT_MENU_LABEL_ORDERED as yl, CONTEXT_MENU_ID_ORDERED as Fl, CONTEXT_MENU_LABEL_LINK as Kl, CONTEXT_MENU_ID_LINK as vl, CONTEXT_MENU_LABEL_CLEAR as xl, CONTEXT_MENU_ID_CLEAR as Xl, CONTEXT_MENU_LABEL_FIND as Wl, CONTEXT_MENU_ID_FIND as Vl, CONTEXT_MENU_LABEL_SIGNATURE as Gl, CONTEXT_MENU_ID_SIGNATURE as Yl, CONTEXT_MENU_LABEL_COMMENT as zl, CONTEXT_MENU_ID_COMMENT as jl } from "../../constants/contextMenu.const.js";
18
- import { cn as ql } from "../../utils/cn.utils.js";
19
- import { applyTypoAutoFix as $l } from "../../utils/typo.utils.js";
20
- import { createInkId as Qt } from "../../utils/id.utils.js";
21
- import { getTableCellFromSelection as Jt, buildTableHtml as Zl, insertTableRow as en, insertTableColumn as tn, deleteTableRow as Ql, deleteTableColumn as Jl } from "../../utils/table.utils.js";
22
- import { getBlockElement as te, clearBlockDragClasses as Ve, markActiveBlock as nn, markDraggingBlock as ei, moveBlock as ti, resolveDropPosition as on, reorderBlockBefore as ni, reorderBlockAfter as oi, markDropTarget as rn } from "../../utils/blocks.utils.js";
23
- import { createTrackChange as Ge, rejectTrackChangeInHtml as ri, acceptTrackChangeInHtml as li, wrapInsertHtml as ln, wrapDeleteHtml as ii } from "../../utils/trackChanges.utils.js";
24
- import { removeCommentMark as ci, wrapSelectionAsComment as si, createCommentThread as ai } from "../../utils/comments.utils.js";
25
- import { InkHistoryStack as Ye } from "../../utils/history.utils.js";
26
- import { extractSlashQuery as ui, filterSlashCommands as di } from "../../utils/slash.utils.js";
27
- import { countWords as _i } from "../../utils/words.utils.js";
28
- import { scrollOutlineHeading as fi, getCaretLineCol as cn, collectOutlineItems as sn } from "../../utils/outline.utils.js";
29
- import { resolveInkPremium as mi, hasInkPremiumFeature as ne, themeTokensToStyle as Ti } from "../../utils/premium.utils.js";
30
- import { extractClipboardHtml as Ei, sanitizePastedHtml as pi, extractClipboardText as Oi } from "../../utils/paste.utils.js";
31
- import { readInkMemory as Ci, writeInkMemory as Li } from "../../utils/memory.utils.js";
32
- import { replaceInHtml as Ni } from "../../utils/findReplace.utils.js";
33
- import { withPreservedSelection as ze } from "../../utils/selection.utils.js";
34
- import { readToolbarItems as Ii, readToolbarHidden as Ai, listCustomizableToolbarOptions as hi, writeToolbarHidden as gi, buildVisibleToolbarItems as bi, writeToolbarItems as Ri } from "../../utils/toolbarStorage.utils.js";
35
- import { Button as Di } from "../../common-components/Button/Button.js";
36
- import { ContextMenu as an } from "../../common-components/ContextMenu/ContextMenu.js";
37
- import { insertImage as je, insertHTML as I, setTextColor as Bi, setHighlightColor as Si, getActiveFormats as Mi, queryCommandValue as ki, detectListType as Ui, tryConvertMarkdownListPrefix as Hi, execCommand as p, insertLink as Pi, applyFontFamily as wi, applyListType as yi, clearFormatDeep as Fi, setBlockDirection as un, fileToDataUrl as Ki } from "./helpers/format.utils.js";
38
- import { inkAi as vi } from "../../plugins/ai/aiPlugin.js";
39
- import { ToolbarButton as O } from "./components/ToolbarButton/ToolbarButton.js";
40
- import { ToolbarDropdown as fe } from "./components/ToolbarDropdown/ToolbarDropdown.js";
41
- import { ToolbarColorPicker as dn } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
42
- import { CommentsPanel as xi } from "./components/CommentsPanel/CommentsPanel.js";
43
- import { AiPanel as Xi } from "./components/AiPanel/AiPanel.js";
44
- import { AiAutocomplete as Wi } from "./components/AiAutocomplete/AiAutocomplete.js";
45
- import { AI_AUTOCOMPLETE_DEBOUNCE_MS as Vi, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT as Gi } from "./components/AiAutocomplete/AiAutocomplete.const.js";
46
- import { getTextBeforeCaret as Yi, getCaretPositionInRoot as _n } from "./components/AiAutocomplete/AiAutocomplete.utils.js";
47
- import { BlockHandles as zi } from "./components/BlockHandles/BlockHandles.js";
48
- import { BLOCK_HANDLES_DRAG_MIME as ji, BLOCK_HANDLES_DRAG_PAYLOAD as qi, BLOCK_HANDLES_DRAG_EFFECT_MOVE as fn } from "./components/BlockHandles/BlockHandles.const.js";
49
- import { InlineToolbar as $i } from "./components/InlineToolbar/InlineToolbar.js";
50
- import { INLINE_TOOLBAR_EDGE_PADDING_PX as Zi, INLINE_TOOLBAR_ESTIMATED_WIDTH_PX as Qi, INLINE_TOOLBAR_ESTIMATED_HEIGHT_PX as Ji, INLINE_TOOLBAR_GAP_PX as ec } from "./components/InlineToolbar/InlineToolbar.const.js";
51
- import { selectionIsInsideElement as tc, clampInlineToolbarPosition as nc } from "./components/InlineToolbar/InlineToolbar.utils.js";
52
- import { SlashMenu as oc } from "./components/SlashMenu/SlashMenu.js";
53
- import { OutlineRail as rc } from "./components/OutlineRail/OutlineRail.js";
54
- import { TrackChangesBar as lc } from "./components/TrackChangesBar/TrackChangesBar.js";
55
- import { SignPad as ic } from "./components/SignPad/SignPad.js";
56
- import { FindReplace as cc } from "./components/FindReplace/FindReplace.js";
57
- import { ToolbarCustomize as sc } from "./components/ToolbarCustomize/ToolbarCustomize.js";
58
- const qe = () => {
59
- const h = window.getSelection();
60
- if (!h || h.rangeCount === f) return "";
61
- const C = h.getRangeAt(f), g = document.createElement("div");
62
- return g.appendChild(C.cloneContents()), g.innerHTML;
63
- }, E = (h) => {
64
- h == null || h.focus({ preventScroll: !0 });
65
- }, fs = (h) => {
66
- var Ft;
16
+ import { INK_DEFAULT_ICONS as Vn } from "../../constants/defaultIcons.js";
17
+ import { CONTEXT_MENU_LABEL_TABLE_ROW_ABOVE as ec, CONTEXT_MENU_ID_TABLE_ROW_ABOVE as tc, CONTEXT_MENU_LABEL_TABLE_ROW_BELOW as nc, CONTEXT_MENU_ID_TABLE_ROW_BELOW as oc, CONTEXT_MENU_LABEL_TABLE_COL_LEFT as rc, CONTEXT_MENU_ID_TABLE_COL_LEFT as lc, CONTEXT_MENU_LABEL_TABLE_COL_RIGHT as ic, CONTEXT_MENU_ID_TABLE_COL_RIGHT as cc, CONTEXT_MENU_LABEL_TABLE_DELETE_ROW as sc, CONTEXT_MENU_ID_TABLE_DELETE_ROW as ac, CONTEXT_MENU_LABEL_TABLE_DELETE_COL as uc, CONTEXT_MENU_ID_TABLE_DELETE_COL as _c, CONTEXT_MENU_LABEL_TABLE_HEADER as dc, CONTEXT_MENU_ID_TABLE_HEADER as Tc, CONTEXT_MENU_LABEL_BOLD as fc, CONTEXT_MENU_ID_BOLD as Ec, CONTEXT_MENU_LABEL_ITALIC as mc, CONTEXT_MENU_ID_ITALIC as pc, CONTEXT_MENU_LABEL_UNDERLINE as Lc, CONTEXT_MENU_ID_UNDERLINE as Oc, CONTEXT_MENU_LABEL_STRIKE as Cc, CONTEXT_MENU_ID_STRIKE as Nc, CONTEXT_MENU_LABEL_HEADING as Ic, CONTEXT_MENU_ID_HEADING as Ac, CONTEXT_MENU_LABEL_BULLET as hc, CONTEXT_MENU_ID_BULLET as gc, CONTEXT_MENU_LABEL_ORDERED as Rc, CONTEXT_MENU_ID_ORDERED as bc, CONTEXT_MENU_LABEL_LINK as Sc, CONTEXT_MENU_ID_LINK as Bc, CONTEXT_MENU_LABEL_CLEAR as Dc, CONTEXT_MENU_ID_CLEAR as Mc, CONTEXT_MENU_LABEL_FIND as Hc, CONTEXT_MENU_ID_FIND as kc, CONTEXT_MENU_LABEL_SIGNATURE as Pc, CONTEXT_MENU_ID_SIGNATURE as Uc, CONTEXT_MENU_LABEL_COMMENT as vc, CONTEXT_MENU_ID_COMMENT as wc } from "../../constants/contextMenu.const.js";
18
+ import { TABLE_CELL_SELECTOR as Yn, TABLE_TAG as dt } from "../../constants/table.const.js";
19
+ import { cn as Kc } from "../../utils/cn.utils.js";
20
+ import { applyTypoAutoFix as Fc } from "../../utils/typo.utils.js";
21
+ import { createInkId as zn } from "../../utils/id.utils.js";
22
+ import { getColumnResizeIndex as $n, getTableCellFromSelection as qn, setTableColumnWidth as yc, buildTableHtml as xc, insertTableRow as jn, insertTableColumn as Zn, deleteTableRow as Xc, deleteTableColumn as Gc, toggleTableHeaderRow as Wc } from "../../utils/table.utils.js";
23
+ import { getBlockElement as fe, clearBlockDragClasses as Tt, markActiveBlock as Qn, markDraggingBlock as Vc, moveBlock as Yc, resolveDropPosition as Jn, reorderBlockBefore as zc, reorderBlockAfter as $c, markDropTarget as eo } from "../../utils/blocks.utils.js";
24
+ import { createTrackChange as ft, rejectTrackChangeInHtml as qc, acceptTrackChangeInHtml as jc, wrapInsertHtml as to, wrapDeleteHtml as Zc } from "../../utils/trackChanges.utils.js";
25
+ import { removeCommentMark as Qc, wrapSelectionAsComment as Jc, createCommentThread as es } from "../../utils/comments.utils.js";
26
+ import { InkHistoryStack as Et } from "../../utils/history.utils.js";
27
+ import { extractSlashQuery as ts, filterSlashCommands as ns } from "../../utils/slash.utils.js";
28
+ import { countWords as os } from "../../utils/words.utils.js";
29
+ import { collectOutlineItems as ee, scrollOutlineHeading as rs, getCaretLineCol as no } from "../../utils/outline.utils.js";
30
+ import { resolveInkPremium as ls, hasInkPremiumFeature as Ee, themeTokensToStyle as is } from "../../utils/premium.utils.js";
31
+ import { extractClipboardHtml as cs, sanitizePastedHtml as ss, extractClipboardText as as } from "../../utils/paste.utils.js";
32
+ import { readInkMemory as us, writeInkMemory as _s } from "../../utils/memory.utils.js";
33
+ import { replaceInHtml as ds } from "../../utils/findReplace.utils.js";
34
+ import { withPreservedSelection as mt, captureSelectionInRoot as Ts, restoreSelectionInRoot as fs } from "../../utils/selection.utils.js";
35
+ import { readToolbarItems as Es, readToolbarHidden as ms, listCustomizableToolbarOptions as ps, writeToolbarHidden as Ls, buildVisibleToolbarItems as Os, writeToolbarItems as Cs } from "../../utils/toolbarStorage.utils.js";
36
+ import { TITLE_STYLE_DEFAULT as Ns } from "../../plugins/titles/titles.const.js";
37
+ import { buildTitleHtml as oo } from "../../plugins/titles/titles.utils.js";
38
+ import { excelGridToTableHtml as Is, createEmptyExcelGrid as As } from "../../plugins/excel/excel.utils.js";
39
+ import { GRAPH_SAMPLE as Se, GRAPH_KIND_DEFAULT as ro } from "../../plugins/graph/graph.const.js";
40
+ import { parseGraphColors as lo, replaceGraphBlock as io, getGraphBlock as hs, buildGraphHtml as gs, parseGraphPoints as co } from "../../plugins/graph/graph.utils.js";
41
+ import { THEME_DEFAULT as Rs } from "../../plugins/theme/theme.const.js";
42
+ import { applyInkTheme as bs } from "../../plugins/theme/inkTheme.js";
43
+ import { inkPlugins as me } from "../../plugins/host/inkPlugins.js";
44
+ import { useToolbarOverflow as Ss } from "../../hooks/useToolbarOverflow.js";
45
+ import { Button as Bs } from "../../common-components/Button/Button.js";
46
+ import { ContextMenu as so } from "../../common-components/ContextMenu/ContextMenu.js";
47
+ import { insertImage as pt, insertHTML as A, setTextColor as Ds, setHighlightColor as Ms, getActiveFormats as Hs, queryCommandValue as ks, detectListType as Ps, tryConvertMarkdownListPrefix as Us, execCommand as h, insertLink as vs, applyFontFamily as ws, applyListType as Ks, clearFormatDeep as Fs, setBlockDirection as ao, fileToDataUrl as ys } from "./helpers/format.utils.js";
48
+ import { inkAi as xs } from "../../plugins/ai/aiPlugin.js";
49
+ import { ToolbarButton as N } from "./components/ToolbarButton/ToolbarButton.js";
50
+ import { ToolbarDropdown as Be } from "./components/ToolbarDropdown/ToolbarDropdown.js";
51
+ import { ToolbarColorPicker as uo } from "./components/ToolbarColorPicker/ToolbarColorPicker.js";
52
+ import { CommentsPanel as Xs } from "./components/CommentsPanel/CommentsPanel.js";
53
+ import { AiPanel as Gs } from "./components/AiPanel/AiPanel.js";
54
+ import { AiAutocomplete as Ws } from "./components/AiAutocomplete/AiAutocomplete.js";
55
+ import { AI_AUTOCOMPLETE_DEBOUNCE_MS as Vs, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT as Ys } from "./components/AiAutocomplete/AiAutocomplete.const.js";
56
+ import { getTextBeforeCaret as zs, getCaretPositionInRoot as _o } from "./components/AiAutocomplete/AiAutocomplete.utils.js";
57
+ import { BlockHandles as $s } from "./components/BlockHandles/BlockHandles.js";
58
+ import { BLOCK_HANDLES_DRAG_MIME as qs, BLOCK_HANDLES_DRAG_PAYLOAD as js, BLOCK_HANDLES_DRAG_EFFECT_MOVE as To } from "./components/BlockHandles/BlockHandles.const.js";
59
+ import { InlineToolbar as Zs } from "./components/InlineToolbar/InlineToolbar.js";
60
+ import { INLINE_TOOLBAR_EDGE_PADDING_PX as Qs, INLINE_TOOLBAR_ESTIMATED_WIDTH_PX as Js, INLINE_TOOLBAR_ESTIMATED_HEIGHT_PX as ea, INLINE_TOOLBAR_GAP_PX as ta } from "./components/InlineToolbar/InlineToolbar.const.js";
61
+ import { selectionIsInsideElement as na, clampInlineToolbarPosition as oa } from "./components/InlineToolbar/InlineToolbar.utils.js";
62
+ import { SlashMenu as ra } from "./components/SlashMenu/SlashMenu.js";
63
+ import { OutlineRail as la } from "./components/OutlineRail/OutlineRail.js";
64
+ import { TrackChangesBar as ia } from "./components/TrackChangesBar/TrackChangesBar.js";
65
+ import { SignPad as ca } from "./components/SignPad/SignPad.js";
66
+ import { FindReplace as sa } from "./components/FindReplace/FindReplace.js";
67
+ import { ToolbarCustomize as aa } from "./components/ToolbarCustomize/ToolbarCustomize.js";
68
+ import { HtmlSourcePanel as ua } from "./components/HtmlSourcePanel/HtmlSourcePanel.js";
69
+ import { TableSizePicker as _a } from "./components/TableSizePicker/TableSizePicker.js";
70
+ import { TitleGallery as da } from "./components/TitleGallery/TitleGallery.js";
71
+ import { ExcelSheetPanel as Ta } from "./components/ExcelSheetPanel/ExcelSheetPanel.js";
72
+ import { GraphPicker as fa } from "./components/GraphPicker/GraphPicker.js";
73
+ import { GraphEditModal as Ea } from "./components/GraphEditModal/GraphEditModal.js";
74
+ import { ThemePicker as ma } from "./components/ThemePicker/ThemePicker.js";
75
+ import { PresenceStack as pa } from "./components/PresenceStack/PresenceStack.js";
76
+ import { RemoteCursors as La } from "./components/RemoteCursors/RemoteCursors.js";
77
+ const Lt = () => {
78
+ const H = window.getSelection();
79
+ if (!H || H.rangeCount === p) return "";
80
+ const g = H.getRangeAt(p), k = document.createElement("div");
81
+ return k.appendChild(g.cloneContents()), k.innerHTML;
82
+ }, I = (H) => {
83
+ H == null || H.focus({ preventScroll: !0 });
84
+ }, Xu = (H) => {
85
+ var Ln;
67
86
  const {
68
- value: C,
69
- defaultValue: g = "",
70
- onChange: b,
71
- placeholder: $e = Pr,
87
+ value: g,
88
+ defaultValue: k = "",
89
+ onChange: P,
90
+ placeholder: Ot = pi,
72
91
  disabled: i = !1,
73
- readOnly: c = !1,
74
- minHeight: me = $o,
75
- maxHeight: Te,
76
- toolbar: mn,
77
- className: Tn = "",
78
- testId: En,
79
- allowImagePaste: Ze = !0,
80
- showCharCount: Qe = !1,
81
- charCountMax: Je,
82
- typoAutoFix: pn = !0,
83
- variant: oe = wr,
84
- chrome: On = yr,
85
- colorMode: et = Tr,
86
- features: Cn,
87
- author: w = Fr,
88
- trackChanges: Y,
89
- onTrackChangesChange: Ee,
90
- trackChangesEnabled: re,
91
- onTrackChangesEnabledChange: pe,
92
- comments: z,
93
- onCommentsChange: Oe,
94
- showCommentsPanel: j,
95
- onShowCommentsPanelChange: Ce,
96
- ai: _,
97
- slashCommands: Ln,
98
- tableRows: Nn = Kr,
99
- tableCols: In = vr,
100
- premium: An,
101
- theme: hn,
102
- icons: tt,
103
- pasteMode: gn = "plain",
104
- onImageUpload: nt,
105
- wysiwyg: bn = !1,
106
- keepInMemory: y = !1,
107
- memoryKey: F,
108
- onToolbarChange: Le,
109
- toolbarHidden: K,
110
- onToolbarHiddenChange: Ne,
111
- showOutline: Rn,
112
- style: Dn,
113
- ...Bn
114
- } = h, le = mn ?? (oe === qt ? Xr : Wr), d = { ...xr, ...Cn }, v = mi(An), Sn = ne(v, "icons"), Mn = ne(v, "theme"), kn = ne(v, "richPaste"), Un = ne(v, "imageUpload"), Hn = ne(v, "wysiwyg") && bn, m = Sn && tt ? { ...Zt, ...tt } : Zt, Pn = Mn ? Ti(hn) : {}, wn = kn && gn === "rich", n = k(null), q = k(new Ye(C ?? g)), x = k(null), U = k(null), [Ie, yn] = a(/* @__PURE__ */ new Set()), [Fn, ot] = a("p"), [Kn, vn] = a(f), [xn, Xn] = a(f), [Wn, rt] = a(xt), [Vn, lt] = a(xt), [Gn, it] = a([]), [Yn, zn] = a(f), [jn, Ae] = a(ue), [qn, $n] = a(Zo), [Zn, Qn] = a(Qo), [X, ct] = a(re ?? !1), [Jn, st] = a(Y ?? []), [eo, at] = a(z ?? []), [to, ut] = a(j ?? !1), [dt, ie] = a(!!(_ != null && _.enabled && _.openOnInit)), [ce, no] = a(!1), _t = k(!1), [B, $] = a({
92
+ readOnly: s = !1,
93
+ minHeight: De = Tl,
94
+ maxHeight: Me,
95
+ toolbar: fo,
96
+ className: Eo = "",
97
+ testId: mo,
98
+ allowImagePaste: Ct = !0,
99
+ showCharCount: Nt = !1,
100
+ charCountMax: It,
101
+ typoAutoFix: po = !0,
102
+ variant: pe = Li,
103
+ chrome: Lo = Oi,
104
+ colorMode: At = Zl,
105
+ features: Oo,
106
+ author: X = Ci,
107
+ trackChanges: te,
108
+ onTrackChangesChange: He,
109
+ trackChangesEnabled: Le,
110
+ onTrackChangesEnabledChange: ke,
111
+ comments: ne,
112
+ onCommentsChange: Pe,
113
+ showCommentsPanel: oe,
114
+ onShowCommentsPanelChange: Ue,
115
+ ai: f,
116
+ slashCommands: Co,
117
+ tableRows: No = Ni,
118
+ tableCols: Io = Ii,
119
+ premium: Ao,
120
+ theme: ho,
121
+ themeId: ht,
122
+ onThemeChange: ve,
123
+ icons: gt,
124
+ pasteMode: go = "plain",
125
+ onImageUpload: Rt,
126
+ wysiwyg: Ro = !1,
127
+ keepInMemory: G = !1,
128
+ memoryKey: W,
129
+ onToolbarChange: we,
130
+ toolbarHidden: V,
131
+ onToolbarHiddenChange: Ke,
132
+ showOutline: bo,
133
+ onOutlineChange: Fe,
134
+ collaboration: R,
135
+ style: So,
136
+ ...Bo
137
+ } = H, Oe = fo ?? (pe === Kn ? hi : gi), a = { ...Ai, ...Oo }, Y = ls(Ao), Do = Ee(Y, "icons"), Mo = Ee(Y, "theme"), Ho = Ee(Y, "richPaste"), ko = Ee(Y, "imageUpload"), Po = Ee(Y, "wysiwyg") && Ro, E = Do && gt ? { ...Vn, ...gt } : Vn, Uo = Mo ? is(ho) : {}, vo = Ho && go === "rich", o = D(null), Ce = D(null), re = D(new Et(g ?? k)), z = D(null), F = D(null), Ne = D(M), [ye, wo] = c(/* @__PURE__ */ new Set()), [Ko, bt] = c("p"), [Fo, yo] = c(p), [xo, Xo] = c(p), [Go, St] = c(Cn), [Wo, Bt] = c(Cn), [Vo, $] = c([]), [Yo, zo] = c(p), [$o, xe] = c(M), [qo, jo] = c(fl), [Zo, Qo] = c(El), [q, Dt] = c(Le ?? !1), [Jo, Mt] = c(te ?? []), [er, Ht] = c(ne ?? []), [tr, kt] = c(oe ?? !1), [Pt, le] = c(!!(f != null && f.enabled && f.openOnInit)), [Ie, nr] = c(!1), Ut = D(!1), [v, ie] = c({
115
138
  visible: !1,
116
139
  suggestion: "",
117
- top: f,
118
- left: f
119
- }), Z = k(null), W = k(f), [ft, oo] = a(""), [ro, lo] = a(0), [io, mt] = a(!1), [co, se] = a([]), [Tt, so] = a({ top: 0, left: 0 }), [Et, he] = a(!1), [ge, ae] = a(!1), [ao, uo] = a(_e), [_o, fo] = a(Ir), [mo, pt] = a(gr), [To, Eo] = a(_e), [be, Re] = a({ open: !1, x: f, y: f }), [po, Ot] = a(!1), [De, Be] = a({
140
+ top: p,
141
+ left: p
142
+ }), ce = D(null), j = D(p), [vt, or] = c(""), [rr, lr] = c(0), [ir, wt] = c(!1), [cr, Ae] = c([]), [Kt, sr] = c({ top: 0, left: 0 }), [Ft, Xe] = c(!1), [Ge, he] = c(!1), [se, yt] = c(!1), [xt, Xt] = c(M), [ar, ur] = c(be), [_r, dr] = c(ri), [Tr, Gt] = c(ci), [fr, Er] = c(be), [We, Ve] = c({ open: !1, x: p, y: p }), [mr, Wt] = c(!1), [Ye, ze] = c({
120
143
  open: !1,
121
- x: f,
122
- y: f
123
- }), [Se, V] = a({
144
+ x: p,
145
+ y: p
146
+ }), [$e, Z] = c({
124
147
  open: !1,
125
- top: f,
126
- left: f
127
- }), [Me, Ct] = a(
128
- () => Ii(y, F) ?? le
129
- ), [Oo, Lt] = a(() => K !== void 0 ? K : Ai(y, F) ?? !1), [Co, Nt] = a(!1), It = k(!0), Lo = le.join(","), S = Y ?? Jn, Q = z ?? eo, ke = j ?? to, At = Ln ?? d.slash, Ue = Rn ?? oe === qt, ht = K ?? Oo, gt = le, No = hi(gt), He = et === Er ? void 0 : et, Pe = !!(d.ai && (_ != null && _.enabled) && _.autocomplete !== !1 && !i && !c), we = () => {
130
- Z.current !== null && (window.clearTimeout(Z.current), Z.current = null);
131
- }, R = () => {
132
- we(), W.current += 1, $(
133
- (e) => e.visible || e.suggestion ? { visible: !1, suggestion: "", top: f, left: f } : e
148
+ top: p,
149
+ left: p
150
+ }), [Q, Vt] = c(
151
+ () => Es(G, W) ?? Oe
152
+ ), [pr, Yt] = c(() => V !== void 0 ? V : ms(G, W) ?? !1), [Lr, zt] = c(!1), $t = D(!0), Or = Oe.join(","), w = te ?? Jo, ae = ne ?? er, qe = oe ?? tr, qt = Co ?? a.slash, [je, Cr] = c(
153
+ () => bo ?? pe === Kn
154
+ ), [jt, m] = c(M), [Nr, Ir] = c(!1), J = D(null), [Ar, Ze] = c(!1), [hr, gr] = c("values"), [Rr, br] = c(Se), [Sr, Br] = c(() => lo(null)), [Dr, Mr] = c(ht || Rs), Zt = ht ?? Dr, [Qt, Hr] = c(!1), kr = !!(a.outline && je), y = Ss(Q.length), Jt = V ?? pr, en = Oe, Pr = ps(en), Qe = At === Ql ? void 0 : At, Je = !!(a.ai && (f != null && f.enabled) && f.autocomplete !== !1 && !i && !s), et = () => {
155
+ ce.current !== null && (window.clearTimeout(ce.current), ce.current = null);
156
+ }, U = () => {
157
+ et(), j.current += 1, ie(
158
+ (e) => e.visible || e.suggestion ? { visible: !1, suggestion: "", top: p, left: p } : e
134
159
  );
135
- }, Io = () => {
136
- if (!Pe || ce || !n.current) {
137
- R();
160
+ }, Ur = () => {
161
+ if (!Je || Ie || !o.current) {
162
+ U();
138
163
  return;
139
164
  }
140
165
  const e = window.getSelection();
141
166
  if (!e || !e.isCollapsed) {
142
- R();
167
+ U();
143
168
  return;
144
169
  }
145
- we(), $(
146
- (o) => o.visible || o.suggestion ? { ...o, visible: !1, suggestion: "" } : o
170
+ et(), ie(
171
+ (n) => n.visible || n.suggestion ? { ...n, visible: !1, suggestion: "" } : n
147
172
  );
148
- const t = (_ == null ? void 0 : _.providerId) || _l;
149
- Z.current = window.setTimeout(() => {
150
- if (Z.current = null, !n.current || _t.current) return;
151
- const o = window.getSelection();
152
- if (!o || !o.isCollapsed) return;
153
- const r = Yi(n.current), s = _n(n.current);
154
- if (!r.trim() || !s) return;
155
- const T = W.current + 1;
156
- W.current = T;
157
- const N = n.current.innerHTML;
158
- vi.runProvider(t, {
173
+ const t = (f == null ? void 0 : f.providerId) || Ji;
174
+ ce.current = window.setTimeout(() => {
175
+ if (ce.current = null, !o.current || Ut.current) return;
176
+ const n = window.getSelection();
177
+ if (!n || !n.isCollapsed) return;
178
+ const l = zs(o.current), u = _o(o.current);
179
+ if (!l.trim() || !u) return;
180
+ const T = j.current + 1;
181
+ j.current = T;
182
+ const L = o.current.innerHTML;
183
+ xs.runProvider(t, {
159
184
  capability: "autocomplete",
160
- html: N,
161
- prompt: r,
162
- modelId: _ == null ? void 0 : _.modelId
163
- }).then((P) => {
164
- var vt;
165
- if (T !== W.current) return;
166
- const M = ((vt = P.text) == null ? void 0 : vt.trim()) || "";
167
- if (!M) {
168
- $({
185
+ html: L,
186
+ prompt: l,
187
+ modelId: f == null ? void 0 : f.modelId
188
+ }).then((_) => {
189
+ var de;
190
+ if (T !== j.current) return;
191
+ const C = ((de = _.text) == null ? void 0 : de.trim()) || "";
192
+ if (!C) {
193
+ ie({
169
194
  visible: !1,
170
195
  suggestion: "",
171
- top: f,
172
- left: f
196
+ top: p,
197
+ left: p
173
198
  });
174
199
  return;
175
200
  }
176
- const Kt = n.current && _n(n.current) || s;
177
- $({
201
+ const ge = o.current && _o(o.current) || u;
202
+ ie({
178
203
  visible: !0,
179
- suggestion: M,
180
- top: Kt.top,
181
- left: Kt.left
204
+ suggestion: C,
205
+ top: ge.top,
206
+ left: ge.left
182
207
  });
183
208
  }).catch(() => {
184
- T === W.current && $({
209
+ T === j.current && ie({
185
210
  visible: !1,
186
211
  suggestion: "",
187
- top: f,
188
- left: f
212
+ top: p,
213
+ left: p
189
214
  });
190
215
  });
191
- }, Vi);
216
+ }, Vs);
192
217
  };
193
- A(() => () => {
194
- we(), W.current += 1;
195
- }, []), A(() => {
196
- _t.current = ce, ce && R();
197
- }, [ce]), A(() => {
198
- re !== void 0 && ct(re);
199
- }, [re]), A(() => {
200
- Y && st(Y);
201
- }, [Y]), A(() => {
202
- z && at(z);
203
- }, [z]), A(() => {
204
- j !== void 0 && ut(j);
205
- }, [j]), A(() => {
206
- K !== void 0 && Lt(K);
207
- }, [K]), A(() => {
208
- if (It.current) {
209
- It.current = !1;
218
+ S(() => () => {
219
+ et(), j.current += 1;
220
+ }, []), S(() => {
221
+ Ut.current = Ie, Ie && U();
222
+ }, [Ie]), S(() => {
223
+ Le !== void 0 && Dt(Le);
224
+ }, [Le]), S(() => {
225
+ te && Mt(te);
226
+ }, [te]), S(() => {
227
+ ne && Ht(ne);
228
+ }, [ne]), S(() => {
229
+ oe !== void 0 && kt(oe);
230
+ }, [oe]), S(() => {
231
+ V !== void 0 && Yt(V);
232
+ }, [V]), S(() => {
233
+ if ($t.current) {
234
+ $t.current = !1;
210
235
  return;
211
236
  }
212
- Ct(le);
213
- }, [Lo]), A(() => {
214
- if (!n.current || C === void 0 || C === x.current) return;
215
- if (n.current.innerHTML === C) {
216
- x.current = C;
237
+ Vt(Oe);
238
+ }, [Or]), S(() => {
239
+ if (!o.current || g === void 0 || g === z.current) return;
240
+ if (o.current.innerHTML === g) {
241
+ z.current = g;
217
242
  return;
218
243
  }
219
- const e = document.activeElement === n.current;
220
- ze(e ? n.current : null, () => {
221
- n.current && (n.current.innerHTML = C);
222
- }), x.current = C;
223
- }, [C]), A(() => {
224
- if (!n.current) return;
225
- const e = y ? Ci(F) : "";
244
+ const e = document.activeElement === o.current;
245
+ mt(e ? o.current : null, () => {
246
+ o.current && (o.current.innerHTML = g);
247
+ }), z.current = g;
248
+ }, [g]), S(() => {
249
+ if (!o.current) return;
250
+ const e = G ? us(W) : "";
226
251
  if (e) {
227
- n.current.innerHTML = e, x.current = e, q.current = new Ye(e), b == null || b(e);
252
+ o.current.innerHTML = e, z.current = e, re.current = new Et(e), P == null || P(e), a.outline && $(ee(o.current));
228
253
  return;
229
254
  }
230
- C === void 0 && g && (n.current.innerHTML = g, x.current = g, q.current = new Ye(g), b == null || b(g));
255
+ if (g !== void 0) {
256
+ a.outline && $(ee(o.current));
257
+ return;
258
+ }
259
+ k && (o.current.innerHTML = k, z.current = k, re.current = new Et(k), P == null || P(k), a.outline && $(ee(o.current)));
260
+ }, []), S(() => {
261
+ const e = () => {
262
+ Hr(document.fullscreenElement === Ce.current);
263
+ };
264
+ return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
231
265
  }, []);
232
- const ye = (e) => {
233
- if (q.current.push(e), x.current = e, b == null || b(e), y && Li(e, F), Qe && n.current) {
234
- const o = n.current.textContent ?? ue;
235
- vn(o.length), Xn(_i(o));
266
+ const tt = (e) => {
267
+ if (re.current.push(e), z.current = e, P == null || P(e), G && _s(e, W), Nt && o.current) {
268
+ const n = o.current.textContent ?? M;
269
+ yo(n.length), Xo(os(n));
236
270
  }
237
- Ue && it(sn(n.current));
238
- const t = cn(n.current);
239
- rt(t.line), lt(t.col);
240
- }, H = (e) => {
241
- n.current && (ze(n.current, () => {
242
- n.current && (n.current.innerHTML = e);
243
- }), ye(e));
244
- }, Fe = (e) => {
245
- Lt(e), Ne == null || Ne(e), gi(e, y, F);
246
- }, Ao = (e) => {
247
- Ct(e), Le == null || Le(e), Ri(e, y, F);
248
- }, ho = (e, t) => {
249
- if (e === jt) return;
250
- const o = new Set(
251
- Me.filter((r) => r !== jt)
271
+ a.outline && $(ee(o.current));
272
+ const t = no(o.current);
273
+ St(t.line), Bt(t.col);
274
+ }, K = (e) => {
275
+ o.current && (mt(o.current, () => {
276
+ o.current && (o.current.innerHTML = e);
277
+ }), tt(e));
278
+ }, nt = (e) => {
279
+ Yt(e), Ke == null || Ke(e), Ls(e, G, W);
280
+ }, vr = (e) => {
281
+ Vt(e), we == null || we(e), Cs(e, G, W);
282
+ }, wr = (e, t) => {
283
+ if (e === wn) return;
284
+ const n = new Set(
285
+ Q.filter((l) => l !== wn)
252
286
  );
253
- t ? o.add(e) : o.delete(e), Ao(bi(gt, o));
254
- }, J = (e) => {
255
- st(e), Ee == null || Ee(e);
256
- }, Ke = (e) => {
257
- at(e), Oe == null || Oe(e);
258
- }, ve = (e) => {
259
- ut(e), Ce == null || Ce(e);
260
- }, go = (e) => {
261
- ct(e), pe == null || pe(e);
262
- }, bo = () => {
263
- if (i || c) {
264
- V((s) => s.open ? { ...s, open: !1 } : s);
287
+ t ? n.add(e) : n.delete(e), vr(Os(en, n));
288
+ }, ue = (e) => {
289
+ Mt(e), He == null || He(e);
290
+ }, ot = (e) => {
291
+ Ht(e), Pe == null || Pe(e);
292
+ }, rt = (e) => {
293
+ kt(e), Ue == null || Ue(e);
294
+ }, Kr = (e) => {
295
+ Dt(e), ke == null || ke(e);
296
+ }, Fr = () => {
297
+ if (i || s) {
298
+ Z((u) => u.open ? { ...u, open: !1 } : u);
265
299
  return;
266
300
  }
267
301
  const e = window.getSelection();
268
- if (!e || e.isCollapsed || e.rangeCount === 0 || !tc(e, n.current)) {
269
- V((s) => s.open ? { ...s, open: !1 } : s);
302
+ if (!e || e.isCollapsed || e.rangeCount === 0 || !na(e, o.current)) {
303
+ Z((u) => u.open ? { ...u, open: !1 } : u);
270
304
  return;
271
305
  }
272
- const o = e.getRangeAt(0).getBoundingClientRect();
273
- if (o.width === 0 && o.height === 0) {
274
- V((s) => s.open ? { ...s, open: !1 } : s);
306
+ const n = e.getRangeAt(0).getBoundingClientRect();
307
+ if (n.width === 0 && n.height === 0) {
308
+ Z((u) => u.open ? { ...u, open: !1 } : u);
275
309
  return;
276
310
  }
277
- const r = nc({
278
- selectionRect: o,
279
- toolbarWidth: Qi,
280
- toolbarHeight: Ji,
311
+ const l = oa({
312
+ selectionRect: n,
313
+ toolbarWidth: Js,
314
+ toolbarHeight: ea,
281
315
  viewport: { width: window.innerWidth, height: window.innerHeight },
282
- gap: ec,
283
- edgePadding: Zi
316
+ gap: ta,
317
+ edgePadding: Qs
284
318
  });
285
- V({ open: !0, top: r.top, left: r.left });
286
- }, ee = () => {
287
- yn(Mi());
288
- const e = ki("formatBlock");
289
- e && ot(e.toLowerCase().replace(/[<>]/g, "")), pt(Ui()), oo(qe()), bo();
290
- const t = cn(n.current);
291
- if (rt(t.line), lt(t.col), Ue && it(sn(n.current)), !n.current || !d.blocks) return;
292
- const o = window.getSelection(), r = (o == null ? void 0 : o.anchorNode) ?? null, s = te(r, n.current);
293
- if (nn(n.current, s), s) {
294
- const T = n.current.getBoundingClientRect(), N = s.getBoundingClientRect();
295
- lo(N.top - T.top + n.current.scrollTop), mt(!0);
319
+ Z({ open: !0, top: l.top, left: l.left });
320
+ }, _e = () => {
321
+ var L;
322
+ wo(Hs());
323
+ const e = ks("formatBlock");
324
+ e && bt(e.toLowerCase().replace(/[<>]/g, "")), Gt(Ps()), or(Lt());
325
+ const t = (L = window.getSelection()) == null ? void 0 : L.toString().trim();
326
+ t && (Ne.current = t), Fr();
327
+ const n = no(o.current);
328
+ if (St(n.line), Bt(n.col), a.outline && $(ee(o.current)), !o.current || !a.blocks) return;
329
+ const l = window.getSelection(), u = (l == null ? void 0 : l.anchorNode) ?? null, T = fe(u, o.current);
330
+ if (Qn(o.current, T), T) {
331
+ const _ = o.current.getBoundingClientRect(), C = T.getBoundingClientRect();
332
+ lr(C.top - _.top + o.current.scrollTop), wt(!0);
296
333
  } else
297
- mt(!1);
298
- }, u = () => {
299
- var t, o, r;
300
- if (!n.current) return;
301
- let e = n.current.innerHTML;
302
- if (X && d.trackChanges) {
303
- const s = window.getSelection();
304
- if (s && !s.isCollapsed) {
305
- const T = qe();
334
+ wt(!1);
335
+ }, d = () => {
336
+ var t, n, l;
337
+ if (!o.current) return;
338
+ let e = o.current.innerHTML;
339
+ if (q && a.trackChanges) {
340
+ const u = window.getSelection();
341
+ if (u && !u.isCollapsed) {
342
+ const T = Lt();
306
343
  if (T) {
307
- const N = Ge("delete", T, w);
308
- J([...S, N]), Ro(N.id), e = n.current.innerHTML;
344
+ const L = ft("delete", T, X);
345
+ ue([...w, L]), yr(L.id), e = o.current.innerHTML;
309
346
  }
310
347
  }
311
348
  }
312
- if (ye(e), ee(), At && n.current) {
313
- const s = ((o = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : o.textContent) ?? "", T = ui(s);
349
+ if (tt(e), _e(), qt && o.current) {
350
+ const u = ((n = (t = window.getSelection()) == null ? void 0 : t.anchorNode) == null ? void 0 : n.textContent) ?? "", T = ts(u);
314
351
  if (T !== null) {
315
- Ae(T), se(di(T));
316
- const N = (r = window.getSelection()) == null ? void 0 : r.getRangeAt(0);
317
- if (N && n.current) {
318
- const P = N.getBoundingClientRect(), M = n.current.getBoundingClientRect();
319
- so({
320
- top: P.bottom - M.top + 8,
321
- left: P.left - M.left
352
+ xe(T), Ae(ns(T));
353
+ const L = (l = window.getSelection()) == null ? void 0 : l.getRangeAt(0);
354
+ if (L && o.current) {
355
+ const _ = L.getBoundingClientRect(), C = o.current.getBoundingClientRect();
356
+ sr({
357
+ top: _.bottom - C.top + 8,
358
+ left: _.left - C.left
322
359
  });
323
360
  }
324
361
  } else
325
- Ae(ue), se([]);
362
+ xe(M), Ae([]);
326
363
  }
327
- Pe ? Io() : R();
328
- }, bt = () => {
329
- const e = B.suggestion;
364
+ Je ? Ur() : U();
365
+ };
366
+ S(() => {
367
+ const e = o.current;
368
+ if (!e || i || s || !a.table) return;
369
+ const t = (l) => {
370
+ const u = l.target;
371
+ if (!(u instanceof Element)) return;
372
+ const T = u.closest(Yn);
373
+ if (!T || !e.contains(T)) return;
374
+ const L = T.closest(dt);
375
+ if (!L) return;
376
+ const _ = $n(l.clientX, T, Nn);
377
+ if (_ === null) return;
378
+ l.preventDefault();
379
+ const C = l.clientX, ge = T.getBoundingClientRect().width;
380
+ L.classList.add(Te);
381
+ const de = (_l) => {
382
+ yc(L, _, ge + (_l.clientX - C));
383
+ }, On = () => {
384
+ L.classList.remove(Te), document.removeEventListener("pointermove", de), document.removeEventListener("pointerup", On), d();
385
+ };
386
+ document.addEventListener("pointermove", de), document.addEventListener("pointerup", On);
387
+ }, n = (l) => {
388
+ const u = l.target;
389
+ if (!(u instanceof Element)) return;
390
+ const T = u.closest(Yn);
391
+ if (e.querySelectorAll(dt).forEach((C) => {
392
+ C.classList.contains(Te) || C.classList.remove(Te);
393
+ }), !T || !e.contains(T)) return;
394
+ const _ = T.closest(dt);
395
+ _ && $n(l.clientX, T, Nn) !== null && _.classList.add(Te);
396
+ };
397
+ return e.addEventListener("pointerdown", t), e.addEventListener("pointermove", n), () => {
398
+ e.removeEventListener("pointerdown", t), e.removeEventListener("pointermove", n);
399
+ };
400
+ }, [i, s, a.table]);
401
+ const tn = () => {
402
+ const e = v.suggestion;
330
403
  if (!e) {
331
- R();
404
+ U();
332
405
  return;
333
406
  }
334
- E(n.current), p(Gi, e), R(), u();
335
- }, Ro = (e) => {
407
+ I(o.current), h(Ys, e), U(), d();
408
+ }, yr = (e) => {
336
409
  const t = window.getSelection();
337
410
  if (!t || t.rangeCount === 0) return;
338
- const o = qe();
339
- o && I(ii(o, e));
340
- }, Do = () => {
341
- if (!n.current || !pn || !d.typoAutoFix || i || c) return;
342
- const e = n.current.innerHTML, t = $l(e);
343
- t.html !== e && (ze(n.current, () => {
344
- n.current && (n.current.innerHTML = t.html);
345
- }), ye(t.html));
346
- }, L = (e) => {
347
- if (i || c) return;
348
- if (E(n.current), e === "clearFormat") {
349
- Fi(), u();
411
+ const n = Lt();
412
+ n && A(Zc(n, e));
413
+ }, xr = () => {
414
+ if (!o.current || !po || !a.typoAutoFix || i || s) return;
415
+ const e = o.current.innerHTML, t = Fc(e);
416
+ t.html !== e && (mt(o.current, () => {
417
+ o.current && (o.current.innerHTML = t.html);
418
+ }), tt(t.html));
419
+ }, b = (e) => {
420
+ if (i || s) return;
421
+ if (I(o.current), e === "clearFormat") {
422
+ Fs(), d();
350
423
  return;
351
424
  }
352
- if (e === "directionLtr" && n.current) {
353
- un(n.current, Ur), u();
425
+ if (e === "directionLtr" && o.current) {
426
+ ao(o.current, Ei), d();
354
427
  return;
355
428
  }
356
- if (e === "directionRtl" && n.current) {
357
- un(n.current, Hr), u();
429
+ if (e === "directionRtl" && o.current) {
430
+ ao(o.current, mi), d();
358
431
  return;
359
432
  }
360
- if (e === de) {
361
- I($t), u();
433
+ if (e === Re) {
434
+ A(Wn), d();
362
435
  return;
363
436
  }
364
- const t = We[e];
365
- t && (t.value ? p(t.command, t.value) : p(t.command), u());
366
- }, Bo = (e) => {
367
- i || c || (E(n.current), p("formatBlock", e), ot(e), u());
368
- }, So = (e) => {
369
- i || c || (E(n.current), wi(e), fo(e), u());
370
- }, Mo = (e) => {
371
- i || c || (E(n.current), yi(e), pt(e), u());
372
- }, Rt = (e) => {
373
- uo(e), Eo(e), ae(!0);
374
- }, ko = (e) => {
375
- if (i || c) return;
376
- Rt(e === Mr ? Sr : _e);
377
- }, xe = () => {
378
- if (i || c) return;
379
- const e = window.prompt("Enter URL:", "https://");
380
- e && (E(n.current), Pi(e), u());
381
- }, Dt = async (e) => Un && nt ? nt(e) : Ki(e), Bt = async () => {
382
- if (i || c) return;
437
+ const t = _t[e];
438
+ t && (t.value ? h(t.command, t.value) : h(t.command), d());
439
+ }, Xr = (e) => {
440
+ i || s || (I(o.current), h("formatBlock", e), bt(e), d());
441
+ }, Gr = (e) => {
442
+ i || s || (I(o.current), ws(e), dr(e), d());
443
+ }, Wr = (e) => {
444
+ i || s || (I(o.current), Ks(e), Gt(e), d());
445
+ }, nn = (e) => {
446
+ ur(e), Er(e), he(!0);
447
+ }, Vr = (e) => {
448
+ if (i || s) return;
449
+ nn(e === Ti ? di : be);
450
+ }, lt = () => {
451
+ var l;
452
+ if (i || s) return;
453
+ const e = Ts(o.current), t = ((l = window.getSelection()) == null ? void 0 : l.toString().trim()) || Ne.current, n = window.prompt(yl, xl);
454
+ n && (I(o.current), fs(o.current, e), vs(n, t), d());
455
+ }, it = (e) => {
456
+ i || s || (I(o.current), A(e), d());
457
+ }, Yr = (e) => {
458
+ var n;
459
+ const t = ((n = window.getSelection()) == null ? void 0 : n.toString().trim()) || Ne.current;
460
+ it(oo(e, t || An));
461
+ }, on = async (e) => ko && Rt ? Rt(e) : ys(e), rn = async () => {
462
+ if (i || s) return;
383
463
  const e = document.createElement("input");
384
464
  e.type = "file", e.accept = "image/*", e.onchange = async () => {
385
- var r;
386
- const t = (r = e.files) == null ? void 0 : r[0];
465
+ var l;
466
+ const t = (l = e.files) == null ? void 0 : l[0];
387
467
  if (!t) return;
388
- const o = await Dt(t);
389
- E(n.current), je(o, t.name), u();
468
+ const n = await on(t);
469
+ I(o.current), pt(n, t.name), d();
390
470
  }, e.click();
391
- }, St = () => {
392
- if (i || c || !d.table) return;
393
- E(n.current);
394
- const e = Zl(Nn, In);
395
- if (X && d.trackChanges) {
396
- const t = Ge("insert", e, w);
397
- J([...S, t]), I(ln(e, t.id));
471
+ }, ln = (e = No, t = Io) => {
472
+ if (i || s || !a.table) return;
473
+ I(o.current);
474
+ const n = xc(e, t);
475
+ if (q && a.trackChanges) {
476
+ const l = ft("insert", n, X);
477
+ ue([...w, l]), A(to(n, l.id));
398
478
  } else
399
- I(e);
400
- u();
401
- }, Mt = () => {
402
- const e = q.current.undo();
403
- if (e === null || !n.current) {
404
- p("undo"), u();
479
+ A(n);
480
+ d();
481
+ }, cn = () => {
482
+ const e = re.current.undo();
483
+ if (e === null || !o.current) {
484
+ h("undo"), d();
405
485
  return;
406
486
  }
407
- H(e);
408
- }, kt = () => {
409
- const e = q.current.redo();
410
- if (e === null || !n.current) {
411
- p("redo"), u();
487
+ K(e);
488
+ }, sn = () => {
489
+ const e = re.current.redo();
490
+ if (e === null || !o.current) {
491
+ h("redo"), d();
412
492
  return;
413
493
  }
414
- H(e);
415
- }, Uo = (e) => {
416
- i || c || (e.preventDefault(), Be((t) => t.open ? { ...t, open: !1 } : t), Ot(!!(d.table && Jt())), Re({ open: !0, x: e.clientX, y: e.clientY }));
417
- }, Ho = (e) => {
418
- i || c || (e.preventDefault(), Re((t) => t.open ? { ...t, open: !1 } : t), Be({ open: !0, x: e.clientX, y: e.clientY }));
419
- }, Ut = () => {
420
- if (i || c || !d.comments) return;
494
+ K(e);
495
+ }, zr = (e) => {
496
+ if (i || s) return;
497
+ e.preventDefault(), ze((n) => n.open ? { ...n, open: !1 } : n);
498
+ const t = a.graph ? hs(e.target) : null;
499
+ J.current = t, Ir(!!t), Wt(!!(a.table && qn())), Ve({ open: !0, x: e.clientX, y: e.clientY });
500
+ }, ct = (e) => {
501
+ const t = J.current;
502
+ if (!t) return;
503
+ const n = co(t.getAttribute(Gn));
504
+ io(t, e, n.length ? n : Se), J.current = null, d();
505
+ }, an = (e) => {
506
+ const t = J.current;
507
+ if (!t) return;
508
+ const n = co(t.getAttribute(Gn));
509
+ br(n.length ? n : Se), Br(lo(t.getAttribute(Wi))), gr(e), Ze(!0);
510
+ }, $r = (e, t) => {
511
+ const n = J.current;
512
+ if (!n) return;
513
+ const l = n.getAttribute(Xi) ?? ro;
514
+ io(n, l, e, t), Ze(!1), d();
515
+ }, un = () => {
516
+ const e = Ce.current;
517
+ if (!(!e || !a.fullscreen)) {
518
+ if (document.fullscreenElement) {
519
+ document.exitFullscreen();
520
+ return;
521
+ }
522
+ e.requestFullscreen();
523
+ }
524
+ }, qr = () => {
525
+ const e = J.current;
526
+ if (e) {
527
+ const t = document.createRange();
528
+ t.selectNodeContents(e);
529
+ const n = window.getSelection();
530
+ n == null || n.removeAllRanges(), n == null || n.addRange(t);
531
+ }
532
+ le(!0);
533
+ }, _n = () => {
534
+ const e = !je;
535
+ Cr(e), e && o.current && $(ee(o.current)), Fe == null || Fe(e);
536
+ }, jr = (e) => {
537
+ i || s || (e.preventDefault(), Ve((t) => t.open ? { ...t, open: !1 } : t), ze({ open: !0, x: e.clientX, y: e.clientY }));
538
+ }, dn = () => {
539
+ if (i || s || !a.comments) return;
421
540
  const e = window.prompt("Comment:");
422
541
  if (!(e != null && e.trim())) return;
423
- const t = Qt("hl");
424
- if (E(n.current), !si(t)) return;
425
- const r = ai(w, e.trim(), t);
426
- Ke([r, ...Q]), ve(!0), u();
427
- }, Po = [
542
+ const t = zn("hl");
543
+ if (I(o.current), !Jc(t)) return;
544
+ const l = es(X, e.trim(), t);
545
+ ot([l, ...ae]), rt(!0), d();
546
+ }, Zr = [
428
547
  {
429
- id: _r,
430
- label: dr,
431
- onSelect: () => Nt(!0)
548
+ id: $l,
549
+ label: zl,
550
+ onSelect: () => zt(!0)
432
551
  },
433
552
  {
434
- id: mr,
435
- label: fr,
436
- onSelect: () => Fe(!0)
553
+ id: jl,
554
+ label: ql,
555
+ onSelect: () => nt(!0)
437
556
  }
438
- ], G = (e) => {
439
- const t = Jt();
440
- !t || !d.table || e(t) && u();
441
- }, wo = [
442
- ...d.table && po ? [
443
- {
444
- id: ml,
445
- label: fl,
446
- onSelect: () => G((e) => en(e, "before"))
447
- },
557
+ ], x = (e) => {
558
+ const t = qn();
559
+ !t || !a.table || e(t) && d();
560
+ }, Qr = a.table && mr ? [
561
+ {
562
+ id: tc,
563
+ label: ec,
564
+ onSelect: () => x((e) => jn(e, "before"))
565
+ },
566
+ {
567
+ id: oc,
568
+ label: nc,
569
+ onSelect: () => x((e) => jn(e, "after"))
570
+ },
571
+ {
572
+ id: lc,
573
+ label: rc,
574
+ onSelect: () => x((e) => Zn(e, "before"))
575
+ },
576
+ {
577
+ id: cc,
578
+ label: ic,
579
+ onSelect: () => x((e) => Zn(e, "after"))
580
+ },
581
+ {
582
+ id: ac,
583
+ label: sc,
584
+ onSelect: () => x((e) => Xc(e))
585
+ },
586
+ {
587
+ id: _c,
588
+ label: uc,
589
+ onSelect: () => x((e) => Gc(e))
590
+ },
591
+ {
592
+ id: Tc,
593
+ label: dc,
594
+ onSelect: () => x((e) => Wc(e))
595
+ }
596
+ ] : [], Jr = [
597
+ ...a.graph && Nr ? [
448
598
  {
449
- id: El,
450
- label: Tl,
451
- onSelect: () => G((e) => en(e, "after"))
599
+ id: pl,
600
+ label: ml,
601
+ onSelect: () => ct("bar")
452
602
  },
453
603
  {
454
604
  id: Ol,
455
- label: pl,
456
- onSelect: () => G((e) => tn(e, "before"))
605
+ label: Ll,
606
+ onSelect: () => ct("line")
457
607
  },
458
608
  {
459
- id: Ll,
609
+ id: Nl,
460
610
  label: Cl,
461
- onSelect: () => G((e) => tn(e, "after"))
611
+ onSelect: () => ct("pie")
612
+ },
613
+ {
614
+ id: Al,
615
+ label: Il,
616
+ onSelect: () => an("values")
462
617
  },
463
618
  {
464
- id: Il,
465
- label: Nl,
466
- onSelect: () => G((e) => Ql(e))
619
+ id: gl,
620
+ label: hl,
621
+ onSelect: () => an("colors")
467
622
  },
468
623
  {
469
- id: hl,
470
- label: Al,
471
- onSelect: () => G((e) => Jl(e))
624
+ id: bl,
625
+ label: Rl,
626
+ onSelect: qr
472
627
  }
473
628
  ] : [],
629
+ ...Qr,
474
630
  {
475
- id: bl,
476
- label: gl,
477
- onSelect: () => L("bold")
631
+ id: Ec,
632
+ label: fc,
633
+ onSelect: () => b("bold")
478
634
  },
479
635
  {
480
- id: Dl,
481
- label: Rl,
482
- onSelect: () => L("italic")
636
+ id: pc,
637
+ label: mc,
638
+ onSelect: () => b("italic")
483
639
  },
484
640
  {
485
- id: Sl,
486
- label: Bl,
487
- onSelect: () => L("underline")
641
+ id: Oc,
642
+ label: Lc,
643
+ onSelect: () => b("underline")
488
644
  },
489
645
  {
490
- id: kl,
491
- label: Ml,
492
- onSelect: () => L("strikethrough")
646
+ id: Nc,
647
+ label: Cc,
648
+ onSelect: () => b("strikethrough")
493
649
  },
494
650
  {
495
- id: Hl,
496
- label: Ul,
497
- onSelect: () => L("heading2")
651
+ id: Ac,
652
+ label: Ic,
653
+ onSelect: () => b("heading2")
498
654
  },
499
655
  {
500
- id: wl,
501
- label: Pl,
502
- onSelect: () => L("bulletList")
656
+ id: gc,
657
+ label: hc,
658
+ onSelect: () => b("bulletList")
503
659
  },
504
660
  {
505
- id: Fl,
506
- label: yl,
507
- onSelect: () => L("orderedList")
661
+ id: bc,
662
+ label: Rc,
663
+ onSelect: () => b("orderedList")
508
664
  },
509
665
  {
510
- id: vl,
511
- label: Kl,
512
- onSelect: () => xe()
666
+ id: Bc,
667
+ label: Sc,
668
+ onSelect: () => lt()
513
669
  },
514
670
  {
515
- id: Xl,
516
- label: xl,
517
- onSelect: () => L("clearFormat")
671
+ id: Mc,
672
+ label: Dc,
673
+ onSelect: () => b("clearFormat")
518
674
  },
519
675
  {
520
- id: Vl,
521
- label: Wl,
522
- disabled: !d.findReplace,
523
- onSelect: () => ae(!0)
676
+ id: kc,
677
+ label: Hc,
678
+ disabled: !a.findReplace,
679
+ onSelect: () => he(!0)
524
680
  },
525
681
  {
526
- id: Yl,
527
- label: Gl,
528
- disabled: !d.signature,
529
- onSelect: () => he(!0)
682
+ id: Uc,
683
+ label: Pc,
684
+ disabled: !a.signature,
685
+ onSelect: () => Xe(!0)
530
686
  },
531
687
  {
532
- id: jl,
533
- label: zl,
534
- disabled: !d.comments,
535
- onSelect: () => Ut()
688
+ id: wc,
689
+ label: vc,
690
+ disabled: !a.comments,
691
+ onSelect: () => dn()
536
692
  },
537
- ...ht ? [
693
+ ...Jt ? [
538
694
  {
539
- id: ur,
540
- label: ar,
541
- onSelect: () => Fe(!1)
695
+ id: Yl,
696
+ label: Vl,
697
+ onSelect: () => nt(!1)
542
698
  }
543
699
  ] : []
544
- ], Ht = (e) => {
545
- if (!n.current) return;
546
- const t = li(n.current.innerHTML, e);
547
- H(t), J(
548
- S.map((o) => o.id === e ? { ...o, accepted: !0 } : o)
700
+ ], Tn = (e) => {
701
+ if (!o.current) return;
702
+ const t = jc(o.current.innerHTML, e);
703
+ K(t), ue(
704
+ w.map((n) => n.id === e ? { ...n, accepted: !0 } : n)
549
705
  );
550
- }, Pt = (e) => {
551
- if (!n.current) return;
552
- const t = ri(n.current.innerHTML, e);
553
- H(t), J(
554
- S.map((o) => o.id === e ? { ...o, rejected: !0 } : o)
706
+ }, fn = (e) => {
707
+ if (!o.current) return;
708
+ const t = qc(o.current.innerHTML, e);
709
+ K(t), ue(
710
+ w.map((n) => n.id === e ? { ...n, rejected: !0 } : n)
555
711
  );
556
- }, wt = async (e) => {
557
- const t = await Dt(e), o = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
558
- if (X && d.trackChanges) {
559
- const r = Ge("insert", o, w);
560
- J([...S, r]), I(ln(o, r.id));
712
+ }, En = async (e) => {
713
+ const t = await on(e), n = `<img src="${t}" alt="" style="max-width:100%;height:auto;" />`;
714
+ if (q && a.trackChanges) {
715
+ const l = ft("insert", n, X);
716
+ ue([...w, l]), A(to(n, l.id));
561
717
  } else
562
- je(t);
563
- u();
564
- }, yo = async (e) => {
565
- if (i || c) return;
718
+ pt(t);
719
+ d();
720
+ }, el = async (e) => {
721
+ if (i || s) return;
566
722
  const t = e.clipboardData;
567
723
  if (!t) return;
568
- if (wn) {
569
- const r = Ei(t);
570
- if (r) {
724
+ if (vo) {
725
+ const l = cs(t);
726
+ if (l) {
571
727
  e.preventDefault();
572
- const T = pi(r);
573
- T && (I(T), u());
574
- const N = t.items;
575
- if (Ze && N)
576
- for (const P of Array.from(N)) {
577
- if (!P.type.startsWith("image/")) continue;
578
- const M = P.getAsFile();
579
- M && await wt(M);
728
+ const T = ss(l);
729
+ T && (A(T), d());
730
+ const L = t.items;
731
+ if (Ct && L)
732
+ for (const _ of Array.from(L)) {
733
+ if (!_.type.startsWith("image/")) continue;
734
+ const C = _.getAsFile();
735
+ C && await En(C);
580
736
  }
581
737
  return;
582
738
  }
583
- const s = Oi(t);
584
- if (s) {
585
- e.preventDefault(), I(s.replace(/\n/g, "<br />")), u();
739
+ const u = as(t);
740
+ if (u) {
741
+ e.preventDefault(), A(u.replace(/\n/g, "<br />")), d();
586
742
  return;
587
743
  }
588
744
  }
589
- if (!Ze) return;
590
- const o = t.items;
591
- if (o)
592
- for (const r of Array.from(o)) {
593
- if (!r.type.startsWith("image/")) continue;
745
+ if (!Ct) return;
746
+ const n = t.items;
747
+ if (n)
748
+ for (const l of Array.from(n)) {
749
+ if (!l.type.startsWith("image/")) continue;
594
750
  e.preventDefault();
595
- const s = r.getAsFile();
596
- s && await wt(s);
751
+ const u = l.getAsFile();
752
+ u && await En(u);
597
753
  }
598
- }, Fo = (e) => {
599
- L(e);
600
- }, Ko = (e) => {
601
- if (e.key === pr && B.visible && B.suggestion) {
602
- e.preventDefault(), bt();
754
+ }, tl = (e) => {
755
+ b(e);
756
+ }, nl = (e) => {
757
+ if (e.key === Jl && v.visible && v.suggestion) {
758
+ e.preventDefault(), tn();
603
759
  return;
604
760
  }
605
- if (e.key === Or) {
606
- R();
761
+ if (e.key === ei) {
762
+ U();
607
763
  return;
608
764
  }
609
- if (Hi(e.nativeEvent)) {
610
- u();
765
+ if (Us(e.nativeEvent)) {
766
+ d();
611
767
  return;
612
768
  }
613
- if (e.key === Cr) {
614
- if (B.visible) {
615
- e.preventDefault(), R();
769
+ if (e.key === ti) {
770
+ if (v.visible) {
771
+ e.preventDefault(), U();
616
772
  return;
617
773
  }
618
- se([]), V((t) => t.open ? { ...t, open: !1 } : t);
774
+ Ae([]), Z((t) => t.open ? { ...t, open: !1 } : t);
619
775
  }
620
- if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === Lr) {
621
- e.preventDefault(), d.ai && (_ != null && _.enabled) && ie(!0);
776
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === ni) {
777
+ e.preventDefault(), a.ai && (f != null && f.enabled) && le(!0);
622
778
  return;
623
779
  }
624
- (e.metaKey || e.ctrlKey) && e.key === Nr && (e.preventDefault(), e.shiftKey ? kt() : Mt());
625
- }, vo = (e) => {
626
- var o;
627
- E(n.current);
780
+ (e.metaKey || e.ctrlKey) && e.key === oi && (e.preventDefault(), e.shiftKey ? sn() : cn());
781
+ }, ol = (e) => {
782
+ var n;
783
+ I(o.current);
628
784
  const t = window.getSelection();
629
- if ((o = t == null ? void 0 : t.anchorNode) != null && o.textContent) {
630
- const s = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
631
- t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = s);
785
+ if ((n = t == null ? void 0 : t.anchorNode) != null && n.textContent) {
786
+ const u = t.anchorNode.textContent.replace(/(?:^|\s)\/[^\s]*$/, " ");
787
+ t.anchorNode.nodeType === Node.TEXT_NODE && (t.anchorNode.textContent = u);
632
788
  }
633
- switch (Ae(ue), se([]), e.insert) {
789
+ switch (xe(M), Ae([]), e.insert) {
634
790
  case "heading1":
635
- p("formatBlock", ul);
791
+ h("formatBlock", Zi);
636
792
  break;
637
793
  case "heading2":
638
- p("formatBlock", al);
794
+ h("formatBlock", ji);
639
795
  break;
640
796
  case "heading3":
641
- p("formatBlock", sl);
797
+ h("formatBlock", qi);
642
798
  break;
643
799
  case "paragraph":
644
- p("formatBlock", cl);
800
+ h("formatBlock", $i);
645
801
  break;
646
802
  case "bulletList":
647
- p("insertUnorderedList");
803
+ h("insertUnorderedList");
648
804
  break;
649
805
  case "orderedList":
650
- p("insertOrderedList");
806
+ h("insertOrderedList");
651
807
  break;
652
808
  case "checklist":
653
- I($t);
809
+ A(Wn);
654
810
  break;
655
811
  case "quote":
656
- p("formatBlock", il);
812
+ h("formatBlock", zi);
657
813
  break;
658
814
  case "code":
659
- p("formatBlock", ll);
815
+ h("formatBlock", Yi);
660
816
  break;
661
817
  case "callout":
662
- I(rl);
818
+ A(Vi);
663
819
  break;
664
820
  case "table":
665
- St();
821
+ ln();
666
822
  return;
667
823
  case "image":
668
- Bt();
824
+ rn();
669
825
  return;
670
826
  case "ai":
671
- ie(!0);
827
+ le(!0);
828
+ break;
829
+ case "titles":
830
+ A(oo(Ns, Ne.current || An));
831
+ break;
832
+ case "excel":
833
+ A(Is(As()));
834
+ break;
835
+ case "graph":
836
+ A(gs(ro, Se));
672
837
  break;
673
838
  }
674
- u();
675
- }, yt = (e) => {
676
- if (!n.current) return;
677
- const t = window.getSelection(), o = te((t == null ? void 0 : t.anchorNode) ?? null, n.current);
678
- o && ti(o, e) && (u(), ee());
679
- }, xo = (e) => {
680
- if (!n.current) return;
681
- const t = window.getSelection(), o = te((t == null ? void 0 : t.anchorNode) ?? null, n.current), r = n.current.querySelector(`.${ol}`), s = o ?? (r instanceof HTMLElement ? r : null);
682
- if (!s) {
839
+ d();
840
+ }, mn = (e) => {
841
+ if (!o.current) return;
842
+ const t = window.getSelection(), n = fe((t == null ? void 0 : t.anchorNode) ?? null, o.current);
843
+ n && Yc(n, e) && (d(), _e());
844
+ }, rl = (e) => {
845
+ if (!o.current) return;
846
+ const t = window.getSelection(), n = fe((t == null ? void 0 : t.anchorNode) ?? null, o.current), l = o.current.querySelector(`.${Gi}`), u = n ?? (l instanceof HTMLElement ? l : null);
847
+ if (!u) {
683
848
  e.preventDefault();
684
849
  return;
685
850
  }
686
- U.current = s, Ve(n.current), nn(n.current, s), ei(s), e.dataTransfer.setData(ji, qi), e.dataTransfer.effectAllowed = fn;
687
- }, Xo = (e) => {
688
- if (!n.current || !U.current) return;
689
- e.preventDefault(), e.dataTransfer.dropEffect = fn;
690
- const t = te(e.target, n.current);
691
- if (!t || t === U.current) {
692
- rn(n.current, null, null);
851
+ F.current = u, Tt(o.current), Qn(o.current, u), Vc(u), e.dataTransfer.setData(qs, js), e.dataTransfer.effectAllowed = To;
852
+ }, ll = (e) => {
853
+ if (!o.current || !F.current) return;
854
+ e.preventDefault(), e.dataTransfer.dropEffect = To;
855
+ const t = fe(e.target, o.current);
856
+ if (!t || t === F.current) {
857
+ eo(o.current, null, null);
693
858
  return;
694
859
  }
695
- const o = on(e.clientY, t);
696
- rn(n.current, t, o);
697
- }, Wo = (e) => {
698
- if (!n.current || !U.current) return;
860
+ const n = Jn(e.clientY, t);
861
+ eo(o.current, t, n);
862
+ }, il = (e) => {
863
+ if (!o.current || !F.current) return;
699
864
  e.preventDefault();
700
- const t = te(e.target, n.current), o = U.current;
701
- t && t !== o && (on(e.clientY, t) === kr ? ni(o, t) : oi(o, t)) && (u(), ee()), Ve(n.current), U.current = null;
702
- }, Vo = () => {
703
- n.current && Ve(n.current), U.current = null;
704
- }, Go = (e, t) => {
865
+ const t = fe(e.target, o.current), n = F.current;
866
+ t && t !== n && (Jn(e.clientY, t) === fi ? zc(n, t) : $c(n, t)) && (d(), _e()), Tt(o.current), F.current = null;
867
+ }, cl = () => {
868
+ o.current && Tt(o.current), F.current = null;
869
+ }, st = (e, t) => {
870
+ var l, u, T, L;
705
871
  if (e === "divider")
706
- return /* @__PURE__ */ l("span", { className: Zr }, `divider-${t}`);
872
+ return /* @__PURE__ */ r("span", { className: Ki }, `divider-${t}`);
707
873
  if (e === "headingDropdown")
708
- return /* @__PURE__ */ l(
709
- fe,
874
+ return /* @__PURE__ */ r(
875
+ Be,
710
876
  {
711
877
  title: "Heading",
712
- options: Qr,
713
- value: Fn || "p",
714
- disabled: i || c,
715
- onChange: Bo
878
+ options: Fi,
879
+ value: Ko || "p",
880
+ disabled: i || s,
881
+ onChange: Xr
716
882
  },
717
883
  "heading"
718
884
  );
719
- if (e === Xt)
720
- return /* @__PURE__ */ l(
721
- fe,
885
+ if (e === hn)
886
+ return /* @__PURE__ */ r(
887
+ Be,
722
888
  {
723
- title: hr,
724
- options: Ar,
725
- value: _o,
726
- disabled: i || c,
727
- onChange: So
889
+ title: ii,
890
+ options: li,
891
+ value: _r,
892
+ disabled: i || s,
893
+ onChange: Gr
728
894
  },
729
- Xt
895
+ hn
730
896
  );
731
- if (e === Wt)
732
- return /* @__PURE__ */ l(
733
- fe,
897
+ if (e === gn)
898
+ return /* @__PURE__ */ r(
899
+ Be,
734
900
  {
735
- title: Rr,
736
- options: br,
737
- value: mo,
738
- disabled: i || c,
739
- onChange: Mo
901
+ title: ai,
902
+ options: si,
903
+ value: Tr,
904
+ disabled: i || s,
905
+ onChange: Wr
740
906
  },
741
- Wt
907
+ gn
742
908
  );
743
909
  if (e === "textColor")
744
- return /* @__PURE__ */ l(
745
- dn,
910
+ return /* @__PURE__ */ r(
911
+ uo,
746
912
  {
747
913
  title: "Text color",
748
914
  type: "text",
749
- value: qn,
750
- disabled: i || c,
751
- onChange: (r) => {
752
- E(n.current), Bi(r), $n(r), u();
915
+ value: qo,
916
+ disabled: i || s,
917
+ onChange: (_) => {
918
+ I(o.current), Ds(_), jo(_), d();
753
919
  }
754
920
  },
755
921
  "textColor"
756
922
  );
757
923
  if (e === "highlightColor")
758
- return /* @__PURE__ */ l(
759
- dn,
924
+ return /* @__PURE__ */ r(
925
+ uo,
760
926
  {
761
927
  title: "Highlight color",
762
928
  type: "highlight",
763
- value: Zn,
764
- disabled: i || c,
765
- onChange: (r) => {
766
- E(n.current), Si(r), Qn(r), u();
929
+ value: Zo,
930
+ disabled: i || s,
931
+ onChange: (_) => {
932
+ I(o.current), Ms(_), Qo(_), d();
767
933
  }
768
934
  },
769
935
  "highlightColor"
770
936
  );
771
937
  if (e === "link")
772
- return /* @__PURE__ */ l(
773
- O,
938
+ return /* @__PURE__ */ r(
939
+ N,
774
940
  {
775
- icon: m.link,
941
+ icon: E.link,
776
942
  title: "Insert link",
777
- disabled: i || c,
778
- onClick: xe
943
+ hint: O.link,
944
+ onHint: m,
945
+ disabled: i || s,
946
+ onClick: lt
779
947
  },
780
948
  "link"
781
949
  );
782
950
  if (e === "image")
783
- return /* @__PURE__ */ l(
784
- O,
951
+ return /* @__PURE__ */ r(
952
+ N,
785
953
  {
786
- icon: m.image,
954
+ hint: O.image,
955
+ onHint: m,
956
+ icon: E.image,
787
957
  title: "Insert image",
788
- disabled: i || c,
958
+ disabled: i || s,
789
959
  onClick: () => {
790
- Bt();
960
+ rn();
791
961
  }
792
962
  },
793
963
  "image"
794
964
  );
795
- if (e === de)
796
- return /* @__PURE__ */ l(
797
- O,
965
+ if (e === Re)
966
+ return /* @__PURE__ */ r(
967
+ N,
798
968
  {
799
- icon: m.checklist,
969
+ icon: E.checklist,
800
970
  title: "Checklist",
801
- disabled: i || c,
802
- onClick: () => L(de)
971
+ hint: O.checklist,
972
+ onHint: m,
973
+ disabled: i || s,
974
+ onClick: () => b(Re)
803
975
  },
804
- de
976
+ Re
805
977
  );
806
978
  if (e === "table")
807
- return d.table ? /* @__PURE__ */ l(
808
- O,
979
+ return a.table ? /* @__PURE__ */ r(
980
+ _a,
809
981
  {
810
- icon: m.table,
811
- title: "Insert table",
812
- disabled: i || c,
813
- onClick: St
982
+ icon: E.table,
983
+ disabled: i || s,
984
+ onSelect: ln
814
985
  },
815
986
  "table"
816
987
  ) : null;
817
- if (e === Vt)
818
- return d.signature ? /* @__PURE__ */ l(
819
- O,
988
+ if (e === Rn)
989
+ return a.titles ? /* @__PURE__ */ r(
990
+ da,
991
+ {
992
+ icon: E.titles,
993
+ disabled: i || s,
994
+ pluginColor: (l = me.get("titles")) == null ? void 0 : l.color,
995
+ hint: O.titles,
996
+ onHint: m,
997
+ onSelect: Yr
998
+ },
999
+ Rn
1000
+ ) : null;
1001
+ if (e === bn)
1002
+ return a.excel ? /* @__PURE__ */ r(
1003
+ Ta,
1004
+ {
1005
+ icon: E.excel,
1006
+ disabled: i || s,
1007
+ pluginColor: (u = me.get("excel")) == null ? void 0 : u.color,
1008
+ hint: O.excel,
1009
+ onHint: m,
1010
+ onInsert: it
1011
+ },
1012
+ bn
1013
+ ) : null;
1014
+ if (e === Sn)
1015
+ return a.graph ? /* @__PURE__ */ r(
1016
+ fa,
1017
+ {
1018
+ icon: E.graph,
1019
+ disabled: i || s,
1020
+ pluginColor: (T = me.get("graph")) == null ? void 0 : T.color,
1021
+ hint: O.graph,
1022
+ onHint: m,
1023
+ onInsert: it
1024
+ },
1025
+ Sn
1026
+ ) : null;
1027
+ if (e === Bn)
1028
+ return a.theme ? /* @__PURE__ */ r(
1029
+ ma,
1030
+ {
1031
+ icon: E.theme,
1032
+ disabled: i,
1033
+ pluginColor: (L = me.get("theme")) == null ? void 0 : L.color,
1034
+ hint: O.theme,
1035
+ onHint: m,
1036
+ value: Zt,
1037
+ onChange: (_) => {
1038
+ Mr(_), ve == null || ve(_), bs(Ce.current, _);
1039
+ }
1040
+ },
1041
+ Bn
1042
+ ) : null;
1043
+ if (e === Dn)
1044
+ return a.fullscreen ? /* @__PURE__ */ r(
1045
+ N,
820
1046
  {
821
- icon: m.signature,
1047
+ icon: E.fullscreen,
1048
+ title: Qt ? Pl : Ul,
1049
+ hint: O.fullscreen,
1050
+ onHint: m,
1051
+ active: Qt,
1052
+ disabled: i,
1053
+ onClick: un
1054
+ },
1055
+ Dn
1056
+ ) : null;
1057
+ if (e === Mn)
1058
+ return a.outline ? /* @__PURE__ */ r(
1059
+ N,
1060
+ {
1061
+ icon: E.outline,
1062
+ title: vl,
1063
+ hint: O.outline,
1064
+ onHint: m,
1065
+ active: je,
1066
+ disabled: i,
1067
+ onClick: _n
1068
+ },
1069
+ Mn
1070
+ ) : null;
1071
+ if (e === Hn)
1072
+ return a.htmlSource ? /* @__PURE__ */ r(
1073
+ N,
1074
+ {
1075
+ className: yn,
1076
+ icon: /* @__PURE__ */ r("span", { className: xn, children: Kl }),
1077
+ title: wl,
1078
+ hint: O.htmlSource,
1079
+ onHint: m,
1080
+ active: se,
1081
+ disabled: i,
1082
+ onClick: () => {
1083
+ var _;
1084
+ if (se) {
1085
+ s || K(xt), yt(!1);
1086
+ return;
1087
+ }
1088
+ Xt(((_ = o.current) == null ? void 0 : _.innerHTML) ?? g ?? M), yt(!0);
1089
+ }
1090
+ },
1091
+ Hn
1092
+ ) : null;
1093
+ if (e === kn)
1094
+ return a.signature ? /* @__PURE__ */ r(
1095
+ N,
1096
+ {
1097
+ icon: E.signature,
822
1098
  title: "Sign pad",
823
- active: Et,
824
- disabled: i || c,
825
- onClick: () => he(!0)
1099
+ hint: O.signature,
1100
+ onHint: m,
1101
+ active: Ft,
1102
+ disabled: i || s,
1103
+ onClick: () => Xe(!0)
826
1104
  },
827
- Vt
1105
+ kn
828
1106
  ) : null;
829
- if (e === Gt)
830
- return d.findReplace ? /* @__PURE__ */ l(
831
- O,
1107
+ if (e === Pn)
1108
+ return a.findReplace ? /* @__PURE__ */ r(
1109
+ N,
832
1110
  {
833
- icon: m.findReplace,
1111
+ icon: E.findReplace,
834
1112
  title: "Find and replace",
835
- active: ge,
836
- disabled: i || c,
1113
+ hint: O.findReplace,
1114
+ onHint: m,
1115
+ active: Ge,
1116
+ disabled: i || s,
837
1117
  onClick: () => {
838
- ge ? ae(!1) : Rt(_e);
1118
+ Ge ? he(!1) : nn(be);
839
1119
  }
840
1120
  },
841
- Gt
1121
+ Pn
842
1122
  ) : null;
843
- if (e === Yt)
844
- return d.findReplace ? /* @__PURE__ */ l(
845
- fe,
1123
+ if (e === Un)
1124
+ return a.findReplace ? /* @__PURE__ */ r(
1125
+ Be,
846
1126
  {
847
- title: Br,
848
- options: Dr,
849
- value: To,
850
- disabled: i || c,
851
- onChange: ko
1127
+ title: _i,
1128
+ options: ui,
1129
+ value: fr,
1130
+ disabled: i || s,
1131
+ onChange: Vr
852
1132
  },
853
- Yt
1133
+ Un
854
1134
  ) : null;
855
- if (e === zt)
856
- return d.horizontalRule ? /* @__PURE__ */ l(
857
- O,
1135
+ if (e === vn)
1136
+ return a.horizontalRule ? /* @__PURE__ */ r(
1137
+ N,
858
1138
  {
859
- icon: m.horizontalRule,
1139
+ icon: E.horizontalRule,
860
1140
  title: "Horizontal rule",
861
- disabled: i || c,
1141
+ hint: O.horizontalRule,
1142
+ onHint: m,
1143
+ disabled: i || s,
862
1144
  onClick: () => {
863
- E(n.current), I("<hr />"), u();
1145
+ I(o.current), A("<hr />"), d();
864
1146
  }
865
1147
  },
866
- zt
1148
+ vn
867
1149
  ) : null;
868
1150
  if (e === "undo")
869
- return /* @__PURE__ */ l(
870
- O,
1151
+ return /* @__PURE__ */ r(
1152
+ N,
871
1153
  {
872
- icon: m.undo,
1154
+ icon: E.undo,
873
1155
  title: "Undo",
874
- disabled: i || c,
875
- onClick: Mt
1156
+ hint: O.undo,
1157
+ onHint: m,
1158
+ disabled: i || s,
1159
+ onClick: cn
876
1160
  },
877
1161
  "undo"
878
1162
  );
879
1163
  if (e === "redo")
880
- return /* @__PURE__ */ l(
881
- O,
1164
+ return /* @__PURE__ */ r(
1165
+ N,
882
1166
  {
883
- icon: m.redo,
1167
+ icon: E.redo,
884
1168
  title: "Redo",
885
- disabled: i || c,
886
- onClick: kt
1169
+ hint: O.redo,
1170
+ onHint: m,
1171
+ disabled: i || s,
1172
+ onClick: sn
887
1173
  },
888
1174
  "redo"
889
1175
  );
890
1176
  if (e === "trackChanges")
891
- return d.trackChanges ? /* @__PURE__ */ l(
892
- O,
1177
+ return a.trackChanges ? /* @__PURE__ */ r(
1178
+ N,
893
1179
  {
894
- icon: m.trackChanges,
1180
+ icon: E.trackChanges,
895
1181
  title: "Track changes",
896
- active: X,
897
- disabled: i || c,
898
- onClick: () => go(!X)
1182
+ hint: O.trackChanges,
1183
+ onHint: m,
1184
+ active: q,
1185
+ disabled: i || s,
1186
+ onClick: () => Kr(!q)
899
1187
  },
900
1188
  "trackChanges"
901
1189
  ) : null;
902
1190
  if (e === "comments")
903
- return d.comments ? /* @__PURE__ */ l(
904
- O,
1191
+ return a.comments ? /* @__PURE__ */ r(
1192
+ N,
905
1193
  {
906
- icon: m.comments,
1194
+ icon: E.comments,
907
1195
  title: "Comments",
908
- active: ke,
909
- disabled: i || c,
1196
+ hint: O.comments,
1197
+ onHint: m,
1198
+ active: qe,
1199
+ disabled: i || s,
910
1200
  onClick: () => {
911
- ke ? ve(!1) : Ut();
1201
+ qe ? rt(!1) : dn();
912
1202
  }
913
1203
  },
914
1204
  "comments"
915
1205
  ) : null;
916
1206
  if (e === "code") {
917
- const r = We.code;
918
- return /* @__PURE__ */ l(
919
- O,
1207
+ const _ = _t.code;
1208
+ return /* @__PURE__ */ r(
1209
+ N,
920
1210
  {
921
- className: Jr,
922
- icon: /* @__PURE__ */ D(qo, { children: [
923
- m.code,
924
- /* @__PURE__ */ l("span", { className: el, children: lr })
1211
+ className: yn,
1212
+ icon: /* @__PURE__ */ B(dl, { children: [
1213
+ E.code,
1214
+ /* @__PURE__ */ r("span", { className: xn, children: Fl })
925
1215
  ] }),
926
- title: r.title,
927
- active: Ie.has(e),
928
- disabled: i || c,
929
- onClick: () => L(e)
1216
+ title: _.title,
1217
+ hint: O.code,
1218
+ onHint: m,
1219
+ active: ye.has(e),
1220
+ disabled: i || s,
1221
+ onClick: () => b(e)
930
1222
  },
931
1223
  "code"
932
1224
  );
933
1225
  }
934
- if (e === "ai")
935
- return !d.ai || !(_ != null && _.enabled) ? null : /* @__PURE__ */ D(
1226
+ if (e === "ai") {
1227
+ if (!a.ai || !(f != null && f.enabled)) return null;
1228
+ const _ = me.get("ai");
1229
+ return /* @__PURE__ */ B(
936
1230
  "button",
937
1231
  {
938
1232
  type: "button",
939
- className: tl,
940
- title: Xe,
941
- "aria-label": Xe,
942
- "aria-pressed": dt,
943
- disabled: i || c,
944
- onMouseDown: (r) => {
945
- r.preventDefault();
1233
+ className: _ ? `${Xn} ${yi}` : Xn,
1234
+ title: ut,
1235
+ style: _ ? { "--ink-plugin-color": _.color } : void 0,
1236
+ "aria-label": ut,
1237
+ "aria-pressed": Pt,
1238
+ disabled: i || s,
1239
+ onMouseEnter: () => m(O.ai),
1240
+ onMouseLeave: () => m(M),
1241
+ onMouseDown: (C) => {
1242
+ C.preventDefault();
946
1243
  },
947
- onClick: () => ie((r) => !r),
1244
+ onClick: () => le((C) => !C),
948
1245
  children: [
949
- /* @__PURE__ */ l("span", { className: nl, "aria-hidden": "true" }),
950
- Xe
1246
+ /* @__PURE__ */ r("span", { className: xi, "aria-hidden": "true" }),
1247
+ ut
951
1248
  ]
952
1249
  },
953
1250
  "ai"
954
1251
  );
955
- const o = We[e];
956
- return o ? /* @__PURE__ */ l(
957
- O,
1252
+ }
1253
+ const n = _t[e];
1254
+ return n ? /* @__PURE__ */ r(
1255
+ N,
958
1256
  {
959
- icon: m[e] ?? e.slice(0, 1).toUpperCase(),
960
- title: o.title,
961
- active: Ie.has(e),
962
- disabled: i || c,
963
- onClick: () => L(e)
1257
+ icon: E[e] ?? e.slice(0, 1).toUpperCase(),
1258
+ title: n.title,
1259
+ hint: O[e],
1260
+ onHint: m,
1261
+ active: ye.has(e),
1262
+ disabled: i || s,
1263
+ onClick: () => b(e)
964
1264
  },
965
1265
  e
966
1266
  ) : null;
967
- }, Yo = typeof me == "number" ? `${me}px` : me, zo = typeof Te == "number" ? `${Te}px` : Te, jo = !!(_ != null && _.enabled && dt);
968
- return /* @__PURE__ */ D(
1267
+ }, pn = typeof De == "number" ? `${De}px` : De, sl = typeof Me == "number" ? `${Me}px` : Me, al = !!(f != null && f.enabled && Pt), ul = Q.slice(p, y.fitCount), at = Q.slice(y.fitCount);
1268
+ return /* @__PURE__ */ B(
969
1269
  "div",
970
1270
  {
971
- className: ql(dl, Tn),
972
- "data-testid": En,
1271
+ ref: Ce,
1272
+ className: Kc(Qi, Eo),
1273
+ "data-testid": mo,
973
1274
  "data-disabled": i || void 0,
974
- "data-variant": oe,
975
- "data-chrome": On,
976
- "data-color-mode": He,
977
- "data-premium": v.active || void 0,
978
- "data-wysiwyg": Hn || void 0,
979
- style: { ...Pn, ...Dn },
980
- ...Bn,
1275
+ "data-variant": pe,
1276
+ "data-chrome": Lo,
1277
+ "data-color-mode": Qe,
1278
+ "data-ink-theme": Zt,
1279
+ "data-premium": Y.active || void 0,
1280
+ "data-wysiwyg": Po || void 0,
1281
+ style: { ...Uo, ...So },
1282
+ ...Bo,
981
1283
  children: [
982
- ht ? /* @__PURE__ */ l("div", { className: Vr, children: /* @__PURE__ */ l(
983
- Di,
1284
+ Jt ? /* @__PURE__ */ r("div", { className: Ri, children: /* @__PURE__ */ r(
1285
+ Bs,
984
1286
  {
985
1287
  type: "button",
986
- "aria-label": cr,
987
- onClick: () => Fe(!1),
988
- children: ir
1288
+ "aria-label": Gl,
1289
+ onClick: () => nt(!1),
1290
+ children: Xl
989
1291
  }
990
- ) }) : /* @__PURE__ */ l(
1292
+ ) }) : /* @__PURE__ */ B(
991
1293
  "div",
992
1294
  {
993
- className: Gr,
1295
+ className: bi,
994
1296
  role: "toolbar",
995
1297
  "aria-label": "Ink formatting toolbar",
996
- onContextMenu: Ho,
997
- children: Me.map(Go)
1298
+ onContextMenu: jr,
1299
+ onDoubleClick: un,
1300
+ onMouseOver: (e) => {
1301
+ const t = e.target.closest("button");
1302
+ if (!(t instanceof HTMLElement)) return;
1303
+ const n = t.getAttribute("title") || t.getAttribute("aria-label") || M;
1304
+ n && m(n);
1305
+ },
1306
+ onMouseLeave: () => m(M),
1307
+ children: [
1308
+ /* @__PURE__ */ r("div", { className: Si, ref: y.measureRef, "aria-hidden": !0, children: Q.map(st) }),
1309
+ /* @__PURE__ */ B("div", { className: Bi, ref: y.rowRef, children: [
1310
+ ul.map(st),
1311
+ R != null && R.collaborators && R.showPresenceStack !== !1 ? /* @__PURE__ */ r(
1312
+ pa,
1313
+ {
1314
+ collaborators: R.collaborators,
1315
+ maxAvatars: R.maxAvatars || 4,
1316
+ onFollow: R.onFollow
1317
+ }
1318
+ ) : null,
1319
+ at.length > p ? /* @__PURE__ */ r("span", { [Di]: "", children: /* @__PURE__ */ r(
1320
+ N,
1321
+ {
1322
+ icon: "⋯",
1323
+ title: In,
1324
+ hint: In,
1325
+ onHint: m,
1326
+ active: y.overflowOpen,
1327
+ disabled: i,
1328
+ onClick: () => y.setOverflowOpen((e) => !e)
1329
+ }
1330
+ ) }) : null
1331
+ ] }),
1332
+ y.overflowOpen && at.length > p ? /* @__PURE__ */ r("div", { className: Mi, children: at.map(st) }) : null,
1333
+ jt ? /* @__PURE__ */ r("p", { className: Hi, children: jt }) : null
1334
+ ]
998
1335
  }
999
1336
  ),
1000
- /* @__PURE__ */ l(
1001
- sc,
1337
+ /* @__PURE__ */ r(
1338
+ aa,
1002
1339
  {
1003
- open: Co,
1004
- options: No,
1005
- visibleItems: Me,
1006
- onToggle: ho,
1007
- onClose: () => Nt(!1)
1340
+ open: Lr,
1341
+ options: Pr,
1342
+ visibleItems: Q,
1343
+ onToggle: wr,
1344
+ onClose: () => zt(!1)
1008
1345
  }
1009
1346
  ),
1010
- /* @__PURE__ */ l(
1011
- ic,
1347
+ /* @__PURE__ */ r(
1348
+ Ea,
1012
1349
  {
1013
- open: Et,
1014
- onClose: () => he(!1),
1350
+ open: Ar,
1351
+ mode: hr,
1352
+ points: Rr,
1353
+ colors: Sr,
1354
+ onClose: () => Ze(!1),
1355
+ onApply: $r
1356
+ }
1357
+ ),
1358
+ /* @__PURE__ */ r(
1359
+ ca,
1360
+ {
1361
+ open: Ft,
1362
+ onClose: () => Xe(!1),
1015
1363
  onConfirm: (e) => {
1016
- E(n.current), je(e), u();
1364
+ I(o.current), pt(e), d();
1017
1365
  }
1018
1366
  }
1019
1367
  ),
1020
- /* @__PURE__ */ l(
1021
- cc,
1368
+ /* @__PURE__ */ r(
1369
+ sa,
1022
1370
  {
1023
- open: ge,
1024
- focusField: ao,
1025
- onClose: () => ae(!1),
1026
- onReplace: (e, t, o) => {
1027
- if (!n.current) return;
1028
- const r = Ni(n.current.innerHTML, e, t, o);
1029
- H(r);
1371
+ open: Ge,
1372
+ focusField: ar,
1373
+ onClose: () => he(!1),
1374
+ onReplace: (e, t, n) => {
1375
+ if (!o.current) return;
1376
+ const l = ds(o.current.innerHTML, e, t, n);
1377
+ K(l);
1030
1378
  }
1031
1379
  }
1032
1380
  ),
1033
- X && d.trackChanges ? /* @__PURE__ */ l(
1034
- lc,
1381
+ q && a.trackChanges ? /* @__PURE__ */ r(
1382
+ ia,
1035
1383
  {
1036
- changes: S,
1037
- onAccept: Ht,
1038
- onReject: Pt,
1039
- onAcceptAll: () => S.forEach((e) => Ht(e.id)),
1040
- onRejectAll: () => S.forEach((e) => Pt(e.id))
1384
+ changes: w,
1385
+ onAccept: Tn,
1386
+ onReject: fn,
1387
+ onAcceptAll: () => w.forEach((e) => Tn(e.id)),
1388
+ onRejectAll: () => w.forEach((e) => fn(e.id))
1041
1389
  }
1042
1390
  ) : null,
1043
- oe === "agent" ? /* @__PURE__ */ l("div", { className: "Ink-Editor__agent-bar", role: "status", children: sr }) : null,
1044
- /* @__PURE__ */ D("div", { className: Yr, children: [
1045
- Ue ? /* @__PURE__ */ l(
1046
- rc,
1391
+ pe === "agent" ? /* @__PURE__ */ r("div", { className: "Ink-Editor__agent-bar", role: "status", children: Wl }) : null,
1392
+ /* @__PURE__ */ B("div", { className: ki, children: [
1393
+ kr ? /* @__PURE__ */ r(
1394
+ la,
1047
1395
  {
1048
- items: Gn,
1049
- activeIndex: Yn,
1396
+ items: Vo,
1397
+ activeIndex: Yo,
1398
+ onHide: _n,
1050
1399
  onSelect: (e) => {
1051
- n.current && (fi(n.current, e), zn(e));
1400
+ o.current && (rs(o.current, e), zo(e));
1052
1401
  }
1053
1402
  }
1054
1403
  ) : null,
1055
- /* @__PURE__ */ D("div", { className: zr, children: [
1056
- d.blocks ? /* @__PURE__ */ l(
1057
- zi,
1404
+ /* @__PURE__ */ B("div", { className: Pi, children: [
1405
+ a.blocks ? /* @__PURE__ */ r(
1406
+ $s,
1058
1407
  {
1059
- visible: io && !i && !c,
1060
- top: ro,
1061
- onMoveUp: () => yt("up"),
1062
- onMoveDown: () => yt("down"),
1063
- onDragStart: xo
1408
+ visible: ir && !i && !s,
1409
+ top: rr,
1410
+ onMoveUp: () => mn("up"),
1411
+ onMoveDown: () => mn("down"),
1412
+ onDragStart: rl
1064
1413
  }
1065
1414
  ) : null,
1066
- /* @__PURE__ */ l(
1415
+ R != null && R.collaborators && R.showRemoteCursors !== !1 ? /* @__PURE__ */ r(La, { collaborators: R.collaborators }) : null,
1416
+ /* @__PURE__ */ r(
1067
1417
  "div",
1068
1418
  {
1069
- ref: n,
1070
- className: jr,
1071
- contentEditable: !i && !c,
1419
+ ref: o,
1420
+ className: se ? `${Fn} ${Ui}` : Fn,
1421
+ contentEditable: !i && !s && !se,
1072
1422
  role: "textbox",
1073
1423
  "aria-multiline": "true",
1074
- "aria-placeholder": $e,
1075
- "data-placeholder": $e,
1424
+ "aria-placeholder": Ot,
1425
+ "data-placeholder": Ot,
1076
1426
  suppressContentEditableWarning: !0,
1077
- style: { minHeight: Yo, maxHeight: zo },
1078
- onInput: u,
1079
- onBlur: Do,
1080
- onKeyUp: ee,
1081
- onKeyDown: Ko,
1082
- onMouseUp: ee,
1083
- onContextMenu: Uo,
1084
- onDragOver: Xo,
1085
- onDrop: Wo,
1086
- onDragEnd: Vo,
1427
+ style: { minHeight: pn, maxHeight: sl },
1428
+ onInput: d,
1429
+ onBlur: xr,
1430
+ onKeyUp: _e,
1431
+ onKeyDown: nl,
1432
+ onMouseUp: _e,
1433
+ onContextMenu: zr,
1434
+ onDragOver: ll,
1435
+ onDrop: il,
1436
+ onDragEnd: cl,
1087
1437
  onPaste: (e) => {
1088
- yo(e);
1438
+ el(e);
1089
1439
  }
1090
1440
  }
1091
1441
  ),
1092
- At ? /* @__PURE__ */ l(
1093
- oc,
1442
+ se ? /* @__PURE__ */ r(
1443
+ ua,
1444
+ {
1445
+ value: xt,
1446
+ onChange: Xt,
1447
+ disabled: i || s,
1448
+ minHeight: pn
1449
+ }
1450
+ ) : null,
1451
+ qt ? /* @__PURE__ */ r(
1452
+ ra,
1094
1453
  {
1095
- items: co,
1096
- top: Tt.top,
1097
- left: Tt.left,
1098
- query: jn,
1099
- onSelect: vo
1454
+ items: cr,
1455
+ top: Kt.top,
1456
+ left: Kt.left,
1457
+ query: $o,
1458
+ onSelect: ol
1100
1459
  }
1101
1460
  ) : null,
1102
- Pe ? /* @__PURE__ */ l(
1103
- Wi,
1461
+ Je ? /* @__PURE__ */ r(
1462
+ Ws,
1104
1463
  {
1105
- suggestion: B.suggestion,
1106
- position: { top: B.top, left: B.left },
1107
- visible: B.visible,
1108
- onAccept: bt,
1109
- onDismiss: R
1464
+ suggestion: v.suggestion,
1465
+ position: { top: v.top, left: v.left },
1466
+ visible: v.visible,
1467
+ onAccept: tn,
1468
+ onDismiss: U
1110
1469
  }
1111
1470
  ) : null,
1112
- /* @__PURE__ */ l(
1113
- $i,
1471
+ /* @__PURE__ */ r(
1472
+ Zs,
1114
1473
  {
1115
- open: Se.open,
1116
- top: Se.top,
1117
- left: Se.left,
1474
+ open: $e.open,
1475
+ top: $e.top,
1476
+ left: $e.left,
1118
1477
  icons: {
1119
- bold: m.bold,
1120
- italic: m.italic,
1121
- underline: m.underline,
1122
- code: m.code,
1123
- link: m.link,
1124
- clearFormat: m.clearFormat
1478
+ bold: E.bold,
1479
+ italic: E.italic,
1480
+ underline: E.underline,
1481
+ code: E.code,
1482
+ link: E.link,
1483
+ clearFormat: E.clearFormat
1125
1484
  },
1126
- activeFormats: Ie,
1127
- disabled: i || c,
1128
- onFormat: Fo,
1129
- onLink: xe,
1130
- onClose: () => V((e) => ({ ...e, open: !1 }))
1485
+ activeFormats: ye,
1486
+ disabled: i || s,
1487
+ onFormat: tl,
1488
+ onLink: lt,
1489
+ onClose: () => Z((e) => ({ ...e, open: !1 }))
1131
1490
  }
1132
1491
  ),
1133
- /* @__PURE__ */ l(
1134
- an,
1492
+ /* @__PURE__ */ r(
1493
+ so,
1135
1494
  {
1136
- open: be.open,
1137
- x: be.x,
1138
- y: be.y,
1139
- items: wo,
1140
- colorMode: He,
1495
+ open: We.open,
1496
+ x: We.x,
1497
+ y: We.y,
1498
+ items: Jr,
1499
+ colorMode: Qe,
1141
1500
  onClose: () => {
1142
- Ot(!1), Re((e) => ({ ...e, open: !1 }));
1501
+ Wt(!1), Ve((e) => ({ ...e, open: !1 }));
1143
1502
  }
1144
1503
  }
1145
1504
  ),
1146
- /* @__PURE__ */ l(
1147
- an,
1505
+ /* @__PURE__ */ r(
1506
+ so,
1148
1507
  {
1149
- open: De.open,
1150
- x: De.x,
1151
- y: De.y,
1152
- items: Po,
1153
- colorMode: He,
1154
- onClose: () => Be((e) => ({ ...e, open: !1 }))
1508
+ open: Ye.open,
1509
+ x: Ye.x,
1510
+ y: Ye.y,
1511
+ items: Zr,
1512
+ colorMode: Qe,
1513
+ onClose: () => ze((e) => ({ ...e, open: !1 }))
1155
1514
  }
1156
1515
  )
1157
1516
  ] }),
1158
- ke && d.comments ? /* @__PURE__ */ l(
1159
- xi,
1517
+ qe && a.comments ? /* @__PURE__ */ r(
1518
+ Xs,
1160
1519
  {
1161
- comments: Q,
1162
- author: w,
1163
- onClose: () => ve(!1),
1520
+ comments: ae,
1521
+ author: X,
1522
+ onClose: () => rt(!1),
1164
1523
  onResolve: (e) => {
1165
- const t = Q.find((o) => o.id === e);
1166
- Ke(
1167
- Q.map(
1168
- (o) => o.id === e ? { ...o, resolved: !0 } : o
1524
+ const t = ae.find((n) => n.id === e);
1525
+ ot(
1526
+ ae.map(
1527
+ (n) => n.id === e ? { ...n, resolved: !0 } : n
1169
1528
  )
1170
- ), t && n.current && H(ci(n.current.innerHTML, t.highlightId));
1529
+ ), t && o.current && K(Qc(o.current.innerHTML, t.highlightId));
1171
1530
  },
1172
1531
  onAddReply: (e, t) => {
1173
- Ke(
1174
- Q.map(
1175
- (o) => o.id === e ? {
1176
- ...o,
1532
+ ot(
1533
+ ae.map(
1534
+ (n) => n.id === e ? {
1535
+ ...n,
1177
1536
  replies: [
1178
- ...o.replies,
1537
+ ...n.replies,
1179
1538
  {
1180
- id: Qt("reply"),
1181
- author: w,
1539
+ id: zn("reply"),
1540
+ author: X,
1182
1541
  body: t,
1183
1542
  timestamp: Date.now()
1184
1543
  }
1185
1544
  ]
1186
- } : o
1545
+ } : n
1187
1546
  )
1188
1547
  );
1189
1548
  }
1190
1549
  }
1191
1550
  ) : null,
1192
- jo && _ ? /* @__PURE__ */ l(
1193
- Xi,
1551
+ al && f ? /* @__PURE__ */ r(
1552
+ Gs,
1194
1553
  {
1195
- config: _,
1196
- documentHtml: ((Ft = n.current) == null ? void 0 : Ft.innerHTML) ?? C ?? "",
1197
- selectionHtml: ft,
1198
- onBusyChange: no,
1199
- onClose: () => ie(!1),
1554
+ config: f,
1555
+ documentHtml: ((Ln = o.current) == null ? void 0 : Ln.innerHTML) ?? g ?? "",
1556
+ selectionHtml: vt,
1557
+ onBusyChange: nr,
1558
+ onClose: () => le(!1),
1200
1559
  onApplyHtml: (e) => {
1201
- if (E(n.current), ft)
1202
- I(e);
1560
+ if (I(o.current), vt)
1561
+ A(e);
1203
1562
  else {
1204
- H(e);
1563
+ K(e);
1205
1564
  return;
1206
1565
  }
1207
- u();
1566
+ d();
1208
1567
  }
1209
1568
  }
1210
1569
  ) : null
1211
1570
  ] }),
1212
- Qe ? /* @__PURE__ */ D("div", { className: qr, children: [
1213
- /* @__PURE__ */ D("span", { children: [
1214
- xn,
1571
+ Nt ? /* @__PURE__ */ B("div", { className: vi, children: [
1572
+ /* @__PURE__ */ B("span", { children: [
1573
+ xo,
1215
1574
  " ",
1216
- Jo,
1575
+ Sl,
1217
1576
  " ",
1218
- er,
1577
+ Bl,
1219
1578
  " ",
1220
- Kn,
1221
- Je ? ` / ${Je}` : "",
1579
+ Fo,
1580
+ It ? ` / ${It}` : "",
1222
1581
  " ",
1223
- tr
1582
+ Dl
1224
1583
  ] }),
1225
- /* @__PURE__ */ D("span", { className: $r, children: [
1226
- /* @__PURE__ */ D("span", { children: [
1227
- nr,
1584
+ /* @__PURE__ */ B("span", { className: wi, children: [
1585
+ /* @__PURE__ */ B("span", { children: [
1586
+ Ml,
1228
1587
  " ",
1229
- Wn,
1588
+ Go,
1230
1589
  ", ",
1231
- or,
1590
+ Hl,
1232
1591
  " ",
1233
- Vn
1592
+ Wo
1234
1593
  ] }),
1235
- /* @__PURE__ */ l("span", { className: "Ink-Editor__footer-sync", children: rr })
1594
+ /* @__PURE__ */ r("span", { className: "Ink-Editor__footer-sync", children: kl })
1236
1595
  ] })
1237
1596
  ] }) : null
1238
1597
  ]
@@ -1240,5 +1599,5 @@ const qe = () => {
1240
1599
  );
1241
1600
  };
1242
1601
  export {
1243
- fs as InkEditor
1602
+ Xu as InkEditor
1244
1603
  };