@forgedevstack/ink 1.1.9 → 1.2.1

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