@forgedevstack/ink 1.1.6 → 1.1.8

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