@remarkablejames/editor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (456) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/lib/ActionMenuButton-B0EHT9CC.js +35 -0
  4. package/lib/ActionMenuButton-J1el_e6Z.cjs +1 -0
  5. package/lib/Attachment.cjs +19 -0
  6. package/lib/Attachment.js +273 -0
  7. package/lib/Blockquote.cjs +5 -0
  8. package/lib/Blockquote.js +107 -0
  9. package/lib/Bold.cjs +1 -0
  10. package/lib/Bold.js +123 -0
  11. package/lib/BulletList.cjs +1 -0
  12. package/lib/BulletList.js +53 -0
  13. package/lib/Callout.cjs +1 -0
  14. package/lib/Callout.js +225 -0
  15. package/lib/Clear.cjs +1 -0
  16. package/lib/Clear.js +49 -0
  17. package/lib/Code.cjs +1 -0
  18. package/lib/Code.js +100 -0
  19. package/lib/CodeBlock.cjs +44 -0
  20. package/lib/CodeBlock.js +4065 -0
  21. package/lib/CodeView.cjs +1 -0
  22. package/lib/CodeView.js +81 -0
  23. package/lib/Color.cjs +1 -0
  24. package/lib/Color.js +134 -0
  25. package/lib/Column.cjs +1 -0
  26. package/lib/Column.js +230 -0
  27. package/lib/Drawer-BCWVN-4l.js +1125 -0
  28. package/lib/Drawer-BTouEroZ.cjs +2 -0
  29. package/lib/Drawer.cjs +1 -0
  30. package/lib/Drawer.js +7 -0
  31. package/lib/Emoji.cjs +1 -0
  32. package/lib/Emoji.js +19888 -0
  33. package/lib/Excalidraw.cjs +1 -0
  34. package/lib/Excalidraw.js +276 -0
  35. package/lib/ExportPdf.cjs +39 -0
  36. package/lib/ExportPdf.js +142 -0
  37. package/lib/ExportWord.cjs +1 -0
  38. package/lib/ExportWord.js +107 -0
  39. package/lib/FontFamily.cjs +1 -0
  40. package/lib/FontFamily.js +84 -0
  41. package/lib/FontSize.cjs +1 -0
  42. package/lib/FontSize.js +106 -0
  43. package/lib/Heading.cjs +1 -0
  44. package/lib/Heading.js +167 -0
  45. package/lib/Highlight.cjs +1 -0
  46. package/lib/Highlight.js +203 -0
  47. package/lib/History.cjs +1 -0
  48. package/lib/History.js +990 -0
  49. package/lib/HorizontalRule.cjs +1 -0
  50. package/lib/HorizontalRule.js +118 -0
  51. package/lib/Iframe-BdgiWGml.js +416 -0
  52. package/lib/Iframe-BfBLILDA.cjs +1 -0
  53. package/lib/Iframe.cjs +1 -0
  54. package/lib/Iframe.js +7 -0
  55. package/lib/Image.cjs +1 -0
  56. package/lib/Image.js +6 -0
  57. package/lib/ImageGif.cjs +1 -0
  58. package/lib/ImageGif.js +400 -0
  59. package/lib/ImportWord.cjs +1 -0
  60. package/lib/ImportWord.js +145 -0
  61. package/lib/Indent-BpMcZKok.js +148 -0
  62. package/lib/Indent-Dvqz_WEn.cjs +1 -0
  63. package/lib/Indent.cjs +1 -0
  64. package/lib/Indent.js +6 -0
  65. package/lib/Italic.cjs +1 -0
  66. package/lib/Italic.js +123 -0
  67. package/lib/Katex-B8_uprkO.js +2753 -0
  68. package/lib/Katex-BQyeCeQ0.cjs +4 -0
  69. package/lib/Katex.cjs +1 -0
  70. package/lib/Katex.js +6 -0
  71. package/lib/LineHeight.cjs +1 -0
  72. package/lib/LineHeight.js +89 -0
  73. package/lib/Link.cjs +1 -0
  74. package/lib/Link.js +6 -0
  75. package/lib/LinkEditBlock-BX0fXXpF.js +1185 -0
  76. package/lib/LinkEditBlock-CIshn_8F.cjs +5 -0
  77. package/lib/Mention.cjs +1 -0
  78. package/lib/Mention.js +265 -0
  79. package/lib/Mermaid-0GiGVxn0.cjs +2 -0
  80. package/lib/Mermaid-D8bbIgAl.js +381 -0
  81. package/lib/Mermaid.cjs +1 -0
  82. package/lib/Mermaid.js +7 -0
  83. package/lib/MoreMark.cjs +1 -0
  84. package/lib/MoreMark.js +157 -0
  85. package/lib/OrderedList.cjs +1 -0
  86. package/lib/OrderedList.js +52 -0
  87. package/lib/SearchAndReplace.cjs +1 -0
  88. package/lib/SearchAndReplace.js +305 -0
  89. package/lib/SlashCommand.cjs +1 -0
  90. package/lib/SlashCommand.js +90 -0
  91. package/lib/SlashCommandNodeView-BcmtKbEE.js +249 -0
  92. package/lib/SlashCommandNodeView-rDJ7OjRd.cjs +1 -0
  93. package/lib/Strike.cjs +1 -0
  94. package/lib/Strike.js +112 -0
  95. package/lib/Table-BEhNBeuA.cjs +5 -0
  96. package/lib/Table-DbxuP5xh.js +1939 -0
  97. package/lib/Table.cjs +1 -0
  98. package/lib/Table.js +5 -0
  99. package/lib/TaskList.cjs +1 -0
  100. package/lib/TaskList.js +63 -0
  101. package/lib/TextAlign.cjs +1 -0
  102. package/lib/TextAlign.js +165 -0
  103. package/lib/TextDirection.cjs +1 -0
  104. package/lib/TextDirection.js +110 -0
  105. package/lib/TextUnderline.cjs +1 -0
  106. package/lib/TextUnderline.js +115 -0
  107. package/lib/Twitter-9I6BLNmg.js +1666 -0
  108. package/lib/Twitter-BuEBgpi9.cjs +1 -0
  109. package/lib/Twitter.cjs +1 -0
  110. package/lib/Twitter.js +6 -0
  111. package/lib/Video.cjs +1 -0
  112. package/lib/Video.js +7 -0
  113. package/lib/bubble.cjs +3 -0
  114. package/lib/bubble.d.ts +1 -0
  115. package/lib/bubble.js +9533 -0
  116. package/lib/clsx-CDyrfCnw.js +7391 -0
  117. package/lib/clsx-CXbNJWDD.cjs +54 -0
  118. package/lib/components/ActionButton.d.ts +23 -0
  119. package/lib/components/ActionMenuButton.d.ts +28 -0
  120. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -0
  121. package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -0
  122. package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -0
  123. package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -0
  124. package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -0
  125. package/lib/components/Bubble/RichTextBubbleKatex.d.ts +1 -0
  126. package/lib/components/Bubble/RichTextBubbleLink.d.ts +6 -0
  127. package/lib/components/Bubble/RichTextBubbleMedia.d.ts +4 -0
  128. package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +1 -0
  129. package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -0
  130. package/lib/components/Bubble/RichTextBubbleTable.d.ts +5 -0
  131. package/lib/components/Bubble/RichTextBubbleText.d.ts +5 -0
  132. package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -0
  133. package/lib/components/Bubble/formatBubble.d.ts +55 -0
  134. package/lib/components/Bubble/index.d.ts +13 -0
  135. package/lib/components/ColorPicker.d.ts +11 -0
  136. package/lib/components/ReactBus.d.ts +11 -0
  137. package/lib/components/RichTextProvider.d.ts +8 -0
  138. package/lib/components/SizeSetter/SizeSetter.d.ts +13 -0
  139. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -0
  140. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -0
  141. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +5 -0
  142. package/lib/components/icons/Activity.d.ts +2 -0
  143. package/lib/components/icons/Animas.d.ts +2 -0
  144. package/lib/components/icons/AspectRatio.d.ts +2 -0
  145. package/lib/components/icons/Blockquote.d.ts +2 -0
  146. package/lib/components/icons/CodeView.d.ts +1 -0
  147. package/lib/components/icons/ColumnAddLeft.d.ts +1 -0
  148. package/lib/components/icons/ColumnAddRight.d.ts +1 -0
  149. package/lib/components/icons/DeleteColumn.d.ts +2 -0
  150. package/lib/components/icons/DeleteRow.d.ts +2 -0
  151. package/lib/components/icons/Direction.d.ts +1 -0
  152. package/lib/components/icons/Excalidraw.d.ts +1 -0
  153. package/lib/components/icons/ExportPdf.d.ts +1 -0
  154. package/lib/components/icons/ExportWord.d.ts +2 -0
  155. package/lib/components/icons/FileWordOutline.d.ts +2 -0
  156. package/lib/components/icons/Flag.d.ts +2 -0
  157. package/lib/components/icons/Food.d.ts +2 -0
  158. package/lib/components/icons/GIfIcon.d.ts +1 -0
  159. package/lib/components/icons/Html.d.ts +1 -0
  160. package/lib/components/icons/Icon.d.ts +8 -0
  161. package/lib/components/icons/IconColorFill.d.ts +5 -0
  162. package/lib/components/icons/IconHighlightFill.d.ts +3 -0
  163. package/lib/components/icons/ImportWord.d.ts +2 -0
  164. package/lib/components/icons/LeftToRight.d.ts +1 -0
  165. package/lib/components/icons/LineHeight.d.ts +2 -0
  166. package/lib/components/icons/MenuDown.d.ts +2 -0
  167. package/lib/components/icons/Mermaid.d.ts +1 -0
  168. package/lib/components/icons/NoFill.d.ts +1 -0
  169. package/lib/components/icons/Object.d.ts +2 -0
  170. package/lib/components/icons/RightToLeft.d.ts +1 -0
  171. package/lib/components/icons/SizeL.d.ts +2 -0
  172. package/lib/components/icons/SizeM.d.ts +2 -0
  173. package/lib/components/icons/SizeS.d.ts +2 -0
  174. package/lib/components/icons/Symbol.d.ts +2 -0
  175. package/lib/components/icons/Travel.d.ts +2 -0
  176. package/lib/components/icons/Twitter.d.ts +1 -0
  177. package/lib/components/icons/icons.d.ts +1 -0
  178. package/lib/components/icons/index.d.ts +12 -0
  179. package/lib/components/index.d.ts +6 -0
  180. package/lib/components/ui/button.d.ts +11 -0
  181. package/lib/components/ui/checkbox.d.ts +4 -0
  182. package/lib/components/ui/dialog.d.ts +19 -0
  183. package/lib/components/ui/dropdown-menu.d.ts +27 -0
  184. package/lib/components/ui/emoji-picker.d.ts +7 -0
  185. package/lib/components/ui/index.d.ts +15 -0
  186. package/lib/components/ui/input.d.ts +5 -0
  187. package/lib/components/ui/label.d.ts +5 -0
  188. package/lib/components/ui/popover.d.ts +6 -0
  189. package/lib/components/ui/select.d.ts +13 -0
  190. package/lib/components/ui/separator.d.ts +4 -0
  191. package/lib/components/ui/switch.d.ts +4 -0
  192. package/lib/components/ui/tabs.d.ts +7 -0
  193. package/lib/components/ui/textarea.d.ts +5 -0
  194. package/lib/components/ui/toast.d.ts +15 -0
  195. package/lib/components/ui/toaster.d.ts +1 -0
  196. package/lib/components/ui/toggle.d.ts +12 -0
  197. package/lib/components/ui/tooltip.d.ts +7 -0
  198. package/lib/components/ui/use-toast.d.ts +44 -0
  199. package/lib/constants/index.d.ts +47 -0
  200. package/lib/constants/resetCSS.d.ts +1 -0
  201. package/lib/delete-node-CosiBes5.cjs +1 -0
  202. package/lib/delete-node-eQHsyyhR.js +24 -0
  203. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  204. package/lib/dom-dataset-CIEeltF6.js +47 -0
  205. package/lib/dropdown-menu-Bs69ZBbO.js +143 -0
  206. package/lib/dropdown-menu-DjWlG2-J.cjs +1 -0
  207. package/lib/extensions/Attachment/Attachment.d.ts +15 -0
  208. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -0
  209. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIconString.d.ts +1 -0
  210. package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -0
  211. package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -0
  212. package/lib/extensions/Attachment/index.d.ts +1 -0
  213. package/lib/extensions/Blockquote/Blockquote.d.ts +6 -0
  214. package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -0
  215. package/lib/extensions/Blockquote/index.d.ts +1 -0
  216. package/lib/extensions/Bold/Bold.d.ts +6 -0
  217. package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -0
  218. package/lib/extensions/Bold/index.d.ts +1 -0
  219. package/lib/extensions/BulletList/BulletList.d.ts +6 -0
  220. package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -0
  221. package/lib/extensions/BulletList/index.d.ts +1 -0
  222. package/lib/extensions/Callout/Callout.d.ts +18 -0
  223. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -0
  224. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -0
  225. package/lib/extensions/Callout/index.d.ts +1 -0
  226. package/lib/extensions/Clear/Clear.d.ts +6 -0
  227. package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -0
  228. package/lib/extensions/Clear/index.d.ts +1 -0
  229. package/lib/extensions/Code/Code.d.ts +6 -0
  230. package/lib/extensions/Code/components/RichTextCode.d.ts +1 -0
  231. package/lib/extensions/Code/index.d.ts +1 -0
  232. package/lib/extensions/CodeBlock/CodeBlock.d.ts +21 -0
  233. package/lib/extensions/CodeBlock/components/NodeViewCodeBlock/NodeViewCodeBlock.d.ts +1 -0
  234. package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +1 -0
  235. package/lib/extensions/CodeBlock/index.d.ts +1 -0
  236. package/lib/extensions/CodeView/CodeView.d.ts +17 -0
  237. package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -0
  238. package/lib/extensions/CodeView/index.d.ts +1 -0
  239. package/lib/extensions/Color/Color.d.ts +22 -0
  240. package/lib/extensions/Color/components/RichTextColor.d.ts +1 -0
  241. package/lib/extensions/Color/index.d.ts +1 -0
  242. package/lib/extensions/Column/Column.d.ts +17 -0
  243. package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -0
  244. package/lib/extensions/Column/index.d.ts +1 -0
  245. package/lib/extensions/Drawer/Drawer.d.ts +15 -0
  246. package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -0
  247. package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +28 -0
  248. package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -0
  249. package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +1 -0
  250. package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -0
  251. package/lib/extensions/Drawer/index.d.ts +1 -0
  252. package/lib/extensions/Emoji/Emoji.d.ts +5 -0
  253. package/lib/extensions/Emoji/components/EmojiList/EmojiNodeView.d.ts +11 -0
  254. package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +1 -0
  255. package/lib/extensions/Emoji/index.d.ts +1 -0
  256. package/lib/extensions/Excalidraw/Excalidraw.d.ts +17 -0
  257. package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -0
  258. package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -0
  259. package/lib/extensions/Excalidraw/index.d.ts +1 -0
  260. package/lib/extensions/ExportPdf/ExportPdf.d.ts +21 -0
  261. package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -0
  262. package/lib/extensions/ExportPdf/index.d.ts +1 -0
  263. package/lib/extensions/ExportWord/ExportWord.d.ts +13 -0
  264. package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -0
  265. package/lib/extensions/ExportWord/index.d.ts +1 -0
  266. package/lib/extensions/FontFamily/FontFamily.d.ts +10 -0
  267. package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +15 -0
  268. package/lib/extensions/FontFamily/index.d.ts +1 -0
  269. package/lib/extensions/FontSize/FontSize.d.ts +32 -0
  270. package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +12 -0
  271. package/lib/extensions/FontSize/index.d.ts +1 -0
  272. package/lib/extensions/Heading/Heading.d.ts +6 -0
  273. package/lib/extensions/Heading/components/RichTextHeading.d.ts +15 -0
  274. package/lib/extensions/Heading/index.d.ts +1 -0
  275. package/lib/extensions/Highlight/Highlight.d.ts +18 -0
  276. package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +1 -0
  277. package/lib/extensions/Highlight/index.d.ts +1 -0
  278. package/lib/extensions/History/History.d.ts +6 -0
  279. package/lib/extensions/History/components/RichTextHistory.d.ts +2 -0
  280. package/lib/extensions/History/index.d.ts +1 -0
  281. package/lib/extensions/HorizontalRule/HorizontalRule.d.ts +6 -0
  282. package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -0
  283. package/lib/extensions/HorizontalRule/index.d.ts +1 -0
  284. package/lib/extensions/Iframe/Iframe.d.ts +16 -0
  285. package/lib/extensions/Iframe/components/IframeNodeView.d.ts +2 -0
  286. package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -0
  287. package/lib/extensions/Iframe/index.d.ts +1 -0
  288. package/lib/extensions/Iframe/utils.d.ts +9 -0
  289. package/lib/extensions/Image/Image.d.ts +64 -0
  290. package/lib/extensions/Image/components/ImageCropper.d.ts +1 -0
  291. package/lib/extensions/Image/components/ImageView.d.ts +2 -0
  292. package/lib/extensions/Image/components/RichTextImage.d.ts +1 -0
  293. package/lib/extensions/Image/index.d.ts +1 -0
  294. package/lib/extensions/ImageGif/ImageGif.d.ts +39 -0
  295. package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -0
  296. package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +1 -0
  297. package/lib/extensions/ImageGif/components/services.d.ts +458 -0
  298. package/lib/extensions/ImageGif/index.d.ts +1 -0
  299. package/lib/extensions/ImportWord/ImportWord.d.ts +18 -0
  300. package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -0
  301. package/lib/extensions/ImportWord/index.d.ts +1 -0
  302. package/lib/extensions/Indent/Indent.d.ts +23 -0
  303. package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -0
  304. package/lib/extensions/Indent/index.d.ts +1 -0
  305. package/lib/extensions/Italic/Italic.d.ts +6 -0
  306. package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -0
  307. package/lib/extensions/Italic/index.d.ts +1 -0
  308. package/lib/extensions/Katex/Katex.d.ts +17 -0
  309. package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -0
  310. package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -0
  311. package/lib/extensions/Katex/index.d.ts +1 -0
  312. package/lib/extensions/LineHeight/LineHeight.d.ts +7 -0
  313. package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -0
  314. package/lib/extensions/LineHeight/index.d.ts +1 -0
  315. package/lib/extensions/Link/Link.d.ts +6 -0
  316. package/lib/extensions/Link/components/LinkEditBlock.d.ts +9 -0
  317. package/lib/extensions/Link/components/LinkViewBlock.d.ts +8 -0
  318. package/lib/extensions/Link/components/RichTextLink.d.ts +1 -0
  319. package/lib/extensions/Link/index.d.ts +1 -0
  320. package/lib/extensions/Mention/Mention.d.ts +3 -0
  321. package/lib/extensions/Mention/components/NodeViewMentionList.d.ts +16 -0
  322. package/lib/extensions/Mention/index.d.ts +1 -0
  323. package/lib/extensions/Mermaid/Mermaid.d.ts +27 -0
  324. package/lib/extensions/Mermaid/components/EditMermaidBlock.d.ts +9 -0
  325. package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +9 -0
  326. package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -0
  327. package/lib/extensions/Mermaid/index.d.ts +1 -0
  328. package/lib/extensions/MoreMark/MoreMark.d.ts +20 -0
  329. package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +14 -0
  330. package/lib/extensions/MoreMark/index.d.ts +1 -0
  331. package/lib/extensions/OrderedList/OrderedList.d.ts +6 -0
  332. package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -0
  333. package/lib/extensions/OrderedList/index.d.ts +1 -0
  334. package/lib/extensions/SearchAndReplace/SearchAndReplace.d.ts +36 -0
  335. package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -0
  336. package/lib/extensions/SearchAndReplace/index.d.ts +1 -0
  337. package/lib/extensions/SlashCommand/SlashCommand.d.ts +4 -0
  338. package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +6 -0
  339. package/lib/extensions/SlashCommand/components/SlashCommandNodeView.d.ts +3 -0
  340. package/lib/extensions/SlashCommand/index.d.ts +1 -0
  341. package/lib/extensions/SlashCommand/renderCommandListDefault.d.ts +7 -0
  342. package/lib/extensions/SlashCommand/types.d.ts +20 -0
  343. package/lib/extensions/Strike/Strike.d.ts +6 -0
  344. package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -0
  345. package/lib/extensions/Strike/index.d.ts +1 -0
  346. package/lib/extensions/Table/Table.d.ts +21 -0
  347. package/lib/extensions/Table/TableCellBackground.d.ts +14 -0
  348. package/lib/extensions/Table/components/CreateTablePopover.d.ts +7 -0
  349. package/lib/extensions/Table/components/RichTextTable.d.ts +1 -0
  350. package/lib/extensions/Table/index.d.ts +1 -0
  351. package/lib/extensions/TaskList/TaskList.d.ts +11 -0
  352. package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -0
  353. package/lib/extensions/TaskList/index.d.ts +1 -0
  354. package/lib/extensions/TextAlign/TextAlign.d.ts +17 -0
  355. package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +14 -0
  356. package/lib/extensions/TextAlign/index.d.ts +1 -0
  357. package/lib/extensions/TextDirection/TextDirection.d.ts +5 -0
  358. package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +15 -0
  359. package/lib/extensions/TextDirection/index.d.ts +1 -0
  360. package/lib/extensions/TextUnderline/TextUnderline.d.ts +6 -0
  361. package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -0
  362. package/lib/extensions/TextUnderline/index.d.ts +1 -0
  363. package/lib/extensions/Twitter/Twitter.d.ts +46 -0
  364. package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +6 -0
  365. package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +8 -0
  366. package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -0
  367. package/lib/extensions/Twitter/index.d.ts +1 -0
  368. package/lib/extensions/Video/Video.d.ts +66 -0
  369. package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -0
  370. package/lib/extensions/Video/index.d.ts +1 -0
  371. package/lib/hooks/useActive.d.ts +21 -0
  372. package/lib/hooks/useAttributes.d.ts +2 -0
  373. package/lib/hooks/useButtonProps.d.ts +1 -0
  374. package/lib/hooks/useCopy.d.ts +5 -0
  375. package/lib/hooks/useExtension.d.ts +1 -0
  376. package/lib/hooks/useLocalStorage.d.ts +13 -0
  377. package/lib/index-4Q5IhypJ.js +1349 -0
  378. package/lib/index-BCzvbrf5.cjs +12 -0
  379. package/lib/index-BG0kQamI.js +285 -0
  380. package/lib/index-C-tDsIKJ.js +1631 -0
  381. package/lib/index-C1WCZhyA.js +237 -0
  382. package/lib/index-CjhjjJsN.cjs +1 -0
  383. package/lib/index-Cs6cp0Y6.cjs +1 -0
  384. package/lib/index-CsSfYR30.js +1351 -0
  385. package/lib/index-D9oM__YW.cjs +1 -0
  386. package/lib/index-DjDf4BK8.js +707 -0
  387. package/lib/index-NsYff_Ni.cjs +1 -0
  388. package/lib/index-bVGIXhRg.cjs +1 -0
  389. package/lib/index-lj3VWExo.js +4883 -0
  390. package/lib/index-neeeY2o7.cjs +4 -0
  391. package/lib/index.cjs +115 -0
  392. package/lib/index.d.ts +2 -0
  393. package/lib/index.js +338 -0
  394. package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
  395. package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
  396. package/lib/lib/utils.d.ts +2 -0
  397. package/lib/locale-bundle.cjs +1 -0
  398. package/lib/locale-bundle.d.ts +1 -0
  399. package/lib/locale-bundle.js +11 -0
  400. package/lib/locales/en.d.ts +196 -0
  401. package/lib/locales/fi.d.ts +196 -0
  402. package/lib/locales/hu.d.ts +196 -0
  403. package/lib/locales/index.d.ts +1198 -0
  404. package/lib/locales/pt-br.d.ts +196 -0
  405. package/lib/locales/vi.d.ts +196 -0
  406. package/lib/locales/zh-cn.d.ts +196 -0
  407. package/lib/plugins/image-upload.d.ts +13 -0
  408. package/lib/popover-CPr9bHYn.js +24 -0
  409. package/lib/popover-D-hUKDYu.cjs +1 -0
  410. package/lib/renderNodeView-BJSrgyGj.js +28 -0
  411. package/lib/renderNodeView-DfLmGrgA.cjs +1 -0
  412. package/lib/select-C2KF4RNg.cjs +1 -0
  413. package/lib/select-CuE_HaQJ.js +120 -0
  414. package/lib/separator-CHzYNMVt.js +293 -0
  415. package/lib/separator-_gvUNba_.cjs +1 -0
  416. package/lib/store/EditorEditableReactive.d.ts +1 -0
  417. package/lib/store/ThemeColorReactive.d.ts +1 -0
  418. package/lib/store/commandList.d.ts +2 -0
  419. package/lib/store/editor.d.ts +21 -0
  420. package/lib/store/store.d.ts +3 -0
  421. package/lib/style.css +1 -0
  422. package/lib/textarea-DZj6EY-N.cjs +1 -0
  423. package/lib/textarea-gEoNp9CA.js +20 -0
  424. package/lib/theme/theme.d.ts +369 -0
  425. package/lib/theme.cjs +1 -0
  426. package/lib/theme.js +395 -0
  427. package/lib/types.d.ts +230 -0
  428. package/lib/updatePosition-Cjuj2E26.cjs +1 -0
  429. package/lib/updatePosition-e90ZrFWW.js +16 -0
  430. package/lib/utils/base64.d.ts +2 -0
  431. package/lib/utils/checkIsVideoUrl.d.ts +1 -0
  432. package/lib/utils/color.d.ts +7 -0
  433. package/lib/utils/columns.d.ts +14 -0
  434. package/lib/utils/customEvents/events.constant.d.ts +6 -0
  435. package/lib/utils/delete-node.d.ts +2 -0
  436. package/lib/utils/dom-dataset.d.ts +28 -0
  437. package/lib/utils/download.d.ts +1 -0
  438. package/lib/utils/dynamicCSS.d.ts +25 -0
  439. package/lib/utils/editor-container-size.d.ts +4 -0
  440. package/lib/utils/file.d.ts +30 -0
  441. package/lib/utils/getRenderContainer.d.ts +3 -0
  442. package/lib/utils/indent.d.ts +14 -0
  443. package/lib/utils/is-mobile.d.ts +19 -0
  444. package/lib/utils/json.d.ts +2 -0
  445. package/lib/utils/lru-cache.d.ts +31 -0
  446. package/lib/utils/mitt.d.ts +24 -0
  447. package/lib/utils/node.d.ts +15 -0
  448. package/lib/utils/pdf.d.ts +3 -0
  449. package/lib/utils/plateform.d.ts +11 -0
  450. package/lib/utils/renderNodeView.d.ts +6 -0
  451. package/lib/utils/shortId.d.ts +1 -0
  452. package/lib/utils/storage.d.ts +2 -0
  453. package/lib/utils/updatePosition.d.ts +1 -0
  454. package/lib/utils/utils.d.ts +20 -0
  455. package/lib/utils/validateFile.d.ts +16 -0
  456. package/package.json +845 -0
@@ -0,0 +1,1939 @@
1
+ import { Q as de, S as E, Y as Ve, T as W, F as v, v as L, O as ke, u as Ke, Z as Xe, N as Z, m as J, V as Ge, W as Ue, E as Ee, _ as qe } from "./clsx-CDyrfCnw.js";
2
+ import { TextSelection as Ze } from "@tiptap/pm/state";
3
+ import { k as Je, D as oe, a as ne } from "./index-C-tDsIKJ.js";
4
+ import { jsxs as ee, jsx as k, Fragment as Ye } from "react/jsx-runtime";
5
+ import { h as Qe, u as et, d as tt, A as ot } from "./index-lj3VWExo.js";
6
+ import { useState as _ } from "react";
7
+ import "./theme.js";
8
+ import { T as O, k as F, m as j } from "./index-4Q5IhypJ.js";
9
+ import { P as nt, a as lt, b as rt } from "./popover-CPr9bHYn.js";
10
+ let le, re;
11
+ if (typeof WeakMap < "u") {
12
+ let t = /* @__PURE__ */ new WeakMap();
13
+ le = (e) => t.get(e), re = (e, o) => (t.set(e, o), o);
14
+ } else {
15
+ const t = [];
16
+ let o = 0;
17
+ le = (n) => {
18
+ for (let l = 0; l < t.length; l += 2) if (t[l] == n) return t[l + 1];
19
+ }, re = (n, l) => (o == 10 && (o = 0), t[o++] = n, t[o++] = l);
20
+ }
21
+ var C = class {
22
+ constructor(t, e, o, n) {
23
+ this.width = t, this.height = e, this.map = o, this.problems = n;
24
+ }
25
+ findCell(t) {
26
+ for (let e = 0; e < this.map.length; e++) {
27
+ const o = this.map[e];
28
+ if (o != t) continue;
29
+ const n = e % this.width, l = e / this.width | 0;
30
+ let r = n + 1, s = l + 1;
31
+ for (let i = 1; r < this.width && this.map[e + i] == o; i++) r++;
32
+ for (let i = 1; s < this.height && this.map[e + this.width * i] == o; i++) s++;
33
+ return {
34
+ left: n,
35
+ top: l,
36
+ right: r,
37
+ bottom: s
38
+ };
39
+ }
40
+ throw new RangeError(`No cell with offset ${t} found`);
41
+ }
42
+ colCount(t) {
43
+ for (let e = 0; e < this.map.length; e++) if (this.map[e] == t) return e % this.width;
44
+ throw new RangeError(`No cell with offset ${t} found`);
45
+ }
46
+ nextCell(t, e, o) {
47
+ const { left: n, right: l, top: r, bottom: s } = this.findCell(t);
48
+ return e == "horiz" ? (o < 0 ? n == 0 : l == this.width) ? null : this.map[r * this.width + (o < 0 ? n - 1 : l)] : (o < 0 ? r == 0 : s == this.height) ? null : this.map[n + this.width * (o < 0 ? r - 1 : s)];
49
+ }
50
+ rectBetween(t, e) {
51
+ const { left: o, right: n, top: l, bottom: r } = this.findCell(t), { left: s, right: i, top: c, bottom: a } = this.findCell(e);
52
+ return {
53
+ left: Math.min(o, s),
54
+ top: Math.min(l, c),
55
+ right: Math.max(n, i),
56
+ bottom: Math.max(r, a)
57
+ };
58
+ }
59
+ cellsInRect(t) {
60
+ const e = [], o = {};
61
+ for (let n = t.top; n < t.bottom; n++) for (let l = t.left; l < t.right; l++) {
62
+ const r = n * this.width + l, s = this.map[r];
63
+ o[s] || (o[s] = !0, !(l == t.left && l && this.map[r - 1] == s || n == t.top && n && this.map[r - this.width] == s) && e.push(s));
64
+ }
65
+ return e;
66
+ }
67
+ positionAt(t, e, o) {
68
+ for (let n = 0, l = 0; ; n++) {
69
+ const r = l + o.child(n).nodeSize;
70
+ if (n == t) {
71
+ let s = e + t * this.width;
72
+ const i = (t + 1) * this.width;
73
+ for (; s < i && this.map[s] < l; ) s++;
74
+ return s == i ? r - 1 : this.map[s];
75
+ }
76
+ l = r;
77
+ }
78
+ }
79
+ static get(t) {
80
+ return le(t) || re(t, st(t));
81
+ }
82
+ };
83
+ function st(t) {
84
+ if (t.type.spec.tableRole != "table") throw new RangeError("Not a table node: " + t.type.name);
85
+ const e = it(t), o = t.childCount, n = [];
86
+ let l = 0, r = null;
87
+ const s = [];
88
+ for (let a = 0, d = e * o; a < d; a++) n[a] = 0;
89
+ for (let a = 0, d = 0; a < o; a++) {
90
+ const u = t.child(a);
91
+ d++;
92
+ for (let p = 0; ; p++) {
93
+ for (; l < n.length && n[l] != 0; ) l++;
94
+ if (p == u.childCount) break;
95
+ const m = u.child(p), { colspan: g, rowspan: w, colwidth: S } = m.attrs;
96
+ for (let x = 0; x < w; x++) {
97
+ if (x + a >= o) {
98
+ (r || (r = [])).push({
99
+ type: "overlong_rowspan",
100
+ pos: d,
101
+ n: w - x
102
+ });
103
+ break;
104
+ }
105
+ const z = l + x * e;
106
+ for (let T = 0; T < g; T++) {
107
+ n[z + T] == 0 ? n[z + T] = d : (r || (r = [])).push({
108
+ type: "collision",
109
+ row: a,
110
+ pos: d,
111
+ n: g - T
112
+ });
113
+ const P = S && S[T];
114
+ if (P) {
115
+ const B = (z + T) % e * 2, Q = s[B];
116
+ Q == null || Q != P && s[B + 1] == 1 ? (s[B] = P, s[B + 1] = 1) : Q == P && s[B + 1]++;
117
+ }
118
+ }
119
+ }
120
+ l += g, d += m.nodeSize;
121
+ }
122
+ const f = (a + 1) * e;
123
+ let h = 0;
124
+ for (; l < f; ) n[l++] == 0 && h++;
125
+ h && (r || (r = [])).push({
126
+ type: "missing",
127
+ row: a,
128
+ n: h
129
+ }), d++;
130
+ }
131
+ (e === 0 || o === 0) && (r || (r = [])).push({ type: "zero_sized" });
132
+ const i = new C(e, o, n, r);
133
+ let c = !1;
134
+ for (let a = 0; !c && a < s.length; a += 2) s[a] != null && s[a + 1] < o && (c = !0);
135
+ return c && ct(i, s, t), i;
136
+ }
137
+ function it(t) {
138
+ let e = -1, o = !1;
139
+ for (let n = 0; n < t.childCount; n++) {
140
+ const l = t.child(n);
141
+ let r = 0;
142
+ if (o) for (let s = 0; s < n; s++) {
143
+ const i = t.child(s);
144
+ for (let c = 0; c < i.childCount; c++) {
145
+ const a = i.child(c);
146
+ s + a.attrs.rowspan > n && (r += a.attrs.colspan);
147
+ }
148
+ }
149
+ for (let s = 0; s < l.childCount; s++) {
150
+ const i = l.child(s);
151
+ r += i.attrs.colspan, i.attrs.rowspan > 1 && (o = !0);
152
+ }
153
+ e == -1 ? e = r : e != r && (e = Math.max(e, r));
154
+ }
155
+ return e;
156
+ }
157
+ function ct(t, e, o) {
158
+ t.problems || (t.problems = []);
159
+ const n = {};
160
+ for (let l = 0; l < t.map.length; l++) {
161
+ const r = t.map[l];
162
+ if (n[r]) continue;
163
+ n[r] = !0;
164
+ const s = o.nodeAt(r);
165
+ if (!s) throw new RangeError(`No cell with offset ${r} found`);
166
+ let i = null;
167
+ const c = s.attrs;
168
+ for (let a = 0; a < c.colspan; a++) {
169
+ const d = e[(l + a) % t.width * 2];
170
+ d != null && (!c.colwidth || c.colwidth[a] != d) && ((i || (i = at(c)))[a] = d);
171
+ }
172
+ i && t.problems.unshift({
173
+ type: "colwidth mismatch",
174
+ pos: r,
175
+ colwidth: i
176
+ });
177
+ }
178
+ }
179
+ function at(t) {
180
+ if (t.colwidth) return t.colwidth.slice();
181
+ const e = [];
182
+ for (let o = 0; o < t.colspan; o++) e.push(0);
183
+ return e;
184
+ }
185
+ function y(t) {
186
+ let e = t.cached.tableNodeTypes;
187
+ if (!e) {
188
+ e = t.cached.tableNodeTypes = {};
189
+ for (const o in t.nodes) {
190
+ const n = t.nodes[o], l = n.spec.tableRole;
191
+ l && (e[l] = n);
192
+ }
193
+ }
194
+ return e;
195
+ }
196
+ const H = new de("selectingCells");
197
+ function D(t) {
198
+ for (let e = t.depth - 1; e > 0; e--) if (t.node(e).type.spec.tableRole == "row") return t.node(0).resolve(t.before(e + 1));
199
+ return null;
200
+ }
201
+ function dt(t) {
202
+ for (let e = t.depth; e > 0; e--) {
203
+ const o = t.node(e).type.spec.tableRole;
204
+ if (o === "cell" || o === "header_cell") return t.node(e);
205
+ }
206
+ return null;
207
+ }
208
+ function R(t) {
209
+ const e = t.selection.$head;
210
+ for (let o = e.depth; o > 0; o--) if (e.node(o).type.spec.tableRole == "row") return !0;
211
+ return !1;
212
+ }
213
+ function Y(t) {
214
+ const e = t.selection;
215
+ if ("$anchorCell" in e && e.$anchorCell) return e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell;
216
+ if ("node" in e && e.node && e.node.type.spec.tableRole == "cell") return e.$anchor;
217
+ const o = D(e.$head) || ut(e.$head);
218
+ if (o) return o;
219
+ throw new RangeError(`No cell found around position ${e.head}`);
220
+ }
221
+ function ut(t) {
222
+ for (let e = t.nodeAfter, o = t.pos; e; e = e.firstChild, o++) {
223
+ const n = e.type.spec.tableRole;
224
+ if (n == "cell" || n == "header_cell") return t.doc.resolve(o);
225
+ }
226
+ for (let e = t.nodeBefore, o = t.pos; e; e = e.lastChild, o--) {
227
+ const n = e.type.spec.tableRole;
228
+ if (n == "cell" || n == "header_cell") return t.doc.resolve(o - e.nodeSize);
229
+ }
230
+ }
231
+ function se(t) {
232
+ return t.parent.type.spec.tableRole == "row" && !!t.nodeAfter;
233
+ }
234
+ function ft(t) {
235
+ return t.node(0).resolve(t.pos + t.nodeAfter.nodeSize);
236
+ }
237
+ function ue(t, e) {
238
+ return t.depth == e.depth && t.pos >= e.start(-1) && t.pos <= e.end(-1);
239
+ }
240
+ function ze(t, e, o) {
241
+ const n = t.node(-1), l = C.get(n), r = t.start(-1), s = l.nextCell(t.pos - r, e, o);
242
+ return s == null ? null : t.node(0).resolve(r + s);
243
+ }
244
+ function $(t, e, o = 1) {
245
+ const n = {
246
+ ...t,
247
+ colspan: t.colspan - o
248
+ };
249
+ return n.colwidth && (n.colwidth = n.colwidth.slice(), n.colwidth.splice(e, o), n.colwidth.some((l) => l > 0) || (n.colwidth = null)), n;
250
+ }
251
+ function He(t, e, o = 1) {
252
+ const n = {
253
+ ...t,
254
+ colspan: t.colspan + o
255
+ };
256
+ if (n.colwidth) {
257
+ n.colwidth = n.colwidth.slice();
258
+ for (let l = 0; l < o; l++) n.colwidth.splice(e, 0, 0);
259
+ }
260
+ return n;
261
+ }
262
+ function ht(t, e, o) {
263
+ const n = y(e.type.schema).header_cell;
264
+ for (let l = 0; l < t.height; l++) if (e.nodeAt(t.map[o + l * t.width]).type != n) return !1;
265
+ return !0;
266
+ }
267
+ var b = class N extends E {
268
+ constructor(e, o = e) {
269
+ const n = e.node(-1), l = C.get(n), r = e.start(-1), s = l.rectBetween(e.pos - r, o.pos - r), i = e.node(0), c = l.cellsInRect(s).filter((d) => d != o.pos - r);
270
+ c.unshift(o.pos - r);
271
+ const a = c.map((d) => {
272
+ const u = n.nodeAt(d);
273
+ if (!u) throw new RangeError(`No cell with offset ${d} found`);
274
+ const f = r + d + 1;
275
+ return new Ve(i.resolve(f), i.resolve(f + u.content.size));
276
+ });
277
+ super(a[0].$from, a[0].$to, a), this.$anchorCell = e, this.$headCell = o;
278
+ }
279
+ map(e, o) {
280
+ const n = e.resolve(o.map(this.$anchorCell.pos)), l = e.resolve(o.map(this.$headCell.pos));
281
+ if (se(n) && se(l) && ue(n, l)) {
282
+ const r = this.$anchorCell.node(-1) != n.node(-1);
283
+ return r && this.isRowSelection() ? N.rowSelection(n, l) : r && this.isColSelection() ? N.colSelection(n, l) : new N(n, l);
284
+ }
285
+ return W.between(n, l);
286
+ }
287
+ content() {
288
+ const e = this.$anchorCell.node(-1), o = C.get(e), n = this.$anchorCell.start(-1), l = o.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), r = {}, s = [];
289
+ for (let c = l.top; c < l.bottom; c++) {
290
+ const a = [];
291
+ for (let d = c * o.width + l.left, u = l.left; u < l.right; u++, d++) {
292
+ const f = o.map[d];
293
+ if (r[f]) continue;
294
+ r[f] = !0;
295
+ const h = o.findCell(f);
296
+ let p = e.nodeAt(f);
297
+ if (!p) throw new RangeError(`No cell with offset ${f} found`);
298
+ const m = l.left - h.left, g = h.right - l.right;
299
+ if (m > 0 || g > 0) {
300
+ let w = p.attrs;
301
+ if (m > 0 && (w = $(w, 0, m)), g > 0 && (w = $(w, w.colspan - g, g)), h.left < l.left) {
302
+ if (p = p.type.createAndFill(w), !p) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`);
303
+ } else p = p.type.create(w, p.content);
304
+ }
305
+ if (h.top < l.top || h.bottom > l.bottom) {
306
+ const w = {
307
+ ...p.attrs,
308
+ rowspan: Math.min(h.bottom, l.bottom) - Math.max(h.top, l.top)
309
+ };
310
+ h.top < l.top ? p = p.type.createAndFill(w) : p = p.type.create(w, p.content);
311
+ }
312
+ a.push(p);
313
+ }
314
+ s.push(e.child(c).copy(v.from(a)));
315
+ }
316
+ const i = this.isColSelection() && this.isRowSelection() ? e : s;
317
+ return new L(v.from(i), 1, 1);
318
+ }
319
+ replace(e, o = L.empty) {
320
+ const n = e.steps.length, l = this.ranges;
321
+ for (let s = 0; s < l.length; s++) {
322
+ const { $from: i, $to: c } = l[s], a = e.mapping.slice(n);
323
+ e.replace(a.map(i.pos), a.map(c.pos), s ? L.empty : o);
324
+ }
325
+ const r = E.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
326
+ r && e.setSelection(r);
327
+ }
328
+ replaceWith(e, o) {
329
+ this.replace(e, new L(v.from(o), 0, 0));
330
+ }
331
+ forEachCell(e) {
332
+ const o = this.$anchorCell.node(-1), n = C.get(o), l = this.$anchorCell.start(-1), r = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - l, this.$headCell.pos - l));
333
+ for (let s = 0; s < r.length; s++) e(o.nodeAt(r[s]), l + r[s]);
334
+ }
335
+ isColSelection() {
336
+ const e = this.$anchorCell.index(-1), o = this.$headCell.index(-1);
337
+ if (Math.min(e, o) > 0) return !1;
338
+ const n = e + this.$anchorCell.nodeAfter.attrs.rowspan, l = o + this.$headCell.nodeAfter.attrs.rowspan;
339
+ return Math.max(n, l) == this.$headCell.node(-1).childCount;
340
+ }
341
+ static colSelection(e, o = e) {
342
+ const n = e.node(-1), l = C.get(n), r = e.start(-1), s = l.findCell(e.pos - r), i = l.findCell(o.pos - r), c = e.node(0);
343
+ return s.top <= i.top ? (s.top > 0 && (e = c.resolve(r + l.map[s.left])), i.bottom < l.height && (o = c.resolve(r + l.map[l.width * (l.height - 1) + i.right - 1]))) : (i.top > 0 && (o = c.resolve(r + l.map[i.left])), s.bottom < l.height && (e = c.resolve(r + l.map[l.width * (l.height - 1) + s.right - 1]))), new N(e, o);
344
+ }
345
+ isRowSelection() {
346
+ const e = this.$anchorCell.node(-1), o = C.get(e), n = this.$anchorCell.start(-1), l = o.colCount(this.$anchorCell.pos - n), r = o.colCount(this.$headCell.pos - n);
347
+ if (Math.min(l, r) > 0) return !1;
348
+ const s = l + this.$anchorCell.nodeAfter.attrs.colspan, i = r + this.$headCell.nodeAfter.attrs.colspan;
349
+ return Math.max(s, i) == o.width;
350
+ }
351
+ eq(e) {
352
+ return e instanceof N && e.$anchorCell.pos == this.$anchorCell.pos && e.$headCell.pos == this.$headCell.pos;
353
+ }
354
+ static rowSelection(e, o = e) {
355
+ const n = e.node(-1), l = C.get(n), r = e.start(-1), s = l.findCell(e.pos - r), i = l.findCell(o.pos - r), c = e.node(0);
356
+ return s.left <= i.left ? (s.left > 0 && (e = c.resolve(r + l.map[s.top * l.width])), i.right < l.width && (o = c.resolve(r + l.map[l.width * (i.top + 1) - 1]))) : (i.left > 0 && (o = c.resolve(r + l.map[i.top * l.width])), s.right < l.width && (e = c.resolve(r + l.map[l.width * (s.top + 1) - 1]))), new N(e, o);
357
+ }
358
+ toJSON() {
359
+ return {
360
+ type: "cell",
361
+ anchor: this.$anchorCell.pos,
362
+ head: this.$headCell.pos
363
+ };
364
+ }
365
+ static fromJSON(e, o) {
366
+ return new N(e.resolve(o.anchor), e.resolve(o.head));
367
+ }
368
+ static create(e, o, n = o) {
369
+ return new N(e.resolve(o), e.resolve(n));
370
+ }
371
+ getBookmark() {
372
+ return new pt(this.$anchorCell.pos, this.$headCell.pos);
373
+ }
374
+ };
375
+ b.prototype.visible = !1;
376
+ E.jsonID("cell", b);
377
+ var pt = class Le {
378
+ constructor(e, o) {
379
+ this.anchor = e, this.head = o;
380
+ }
381
+ map(e) {
382
+ return new Le(e.map(this.anchor), e.map(this.head));
383
+ }
384
+ resolve(e) {
385
+ const o = e.resolve(this.anchor), n = e.resolve(this.head);
386
+ return o.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && o.index() < o.parent.childCount && n.index() < n.parent.childCount && ue(o, n) ? new b(o, n) : E.near(n, 1);
387
+ }
388
+ };
389
+ function mt(t) {
390
+ if (!(t.selection instanceof b)) return null;
391
+ const e = [];
392
+ return t.selection.forEachCell((o, n) => {
393
+ e.push(ne.node(n, n + o.nodeSize, { class: "selectedCell" }));
394
+ }), oe.create(t.doc, e);
395
+ }
396
+ function gt({ $from: t, $to: e }) {
397
+ if (t.pos == e.pos || t.pos < e.pos - 6) return !1;
398
+ let o = t.pos, n = e.pos, l = t.depth;
399
+ for (; l >= 0 && !(t.after(l + 1) < t.end(l)); l--, o++) ;
400
+ for (let r = e.depth; r >= 0 && !(e.before(r + 1) > e.start(r)); r--, n--) ;
401
+ return o == n && /row|table/.test(t.node(l).type.spec.tableRole);
402
+ }
403
+ function wt({ $from: t, $to: e }) {
404
+ let o, n;
405
+ for (let l = t.depth; l > 0; l--) {
406
+ const r = t.node(l);
407
+ if (r.type.spec.tableRole === "cell" || r.type.spec.tableRole === "header_cell") {
408
+ o = r;
409
+ break;
410
+ }
411
+ }
412
+ for (let l = e.depth; l > 0; l--) {
413
+ const r = e.node(l);
414
+ if (r.type.spec.tableRole === "cell" || r.type.spec.tableRole === "header_cell") {
415
+ n = r;
416
+ break;
417
+ }
418
+ }
419
+ return o !== n && e.parentOffset === 0;
420
+ }
421
+ function bt(t, e, o) {
422
+ const n = (e || t).selection, l = (e || t).doc;
423
+ let r, s;
424
+ if (n instanceof Ke && (s = n.node.type.spec.tableRole)) {
425
+ if (s == "cell" || s == "header_cell") r = b.create(l, n.from);
426
+ else if (s == "row") {
427
+ const i = l.resolve(n.from + 1);
428
+ r = b.rowSelection(i, i);
429
+ } else if (!o) {
430
+ const i = C.get(n.node), c = n.from + 1, a = c + i.map[i.width * i.height - 1];
431
+ r = b.create(l, c + 1, a);
432
+ }
433
+ } else n instanceof W && gt(n) ? r = W.create(l, n.from) : n instanceof W && wt(n) && (r = W.create(l, n.$from.start(), n.$from.end()));
434
+ return r && (e || (e = t.tr)).setSelection(r), e;
435
+ }
436
+ const Ct = new de("fix-tables");
437
+ function We(t, e, o, n) {
438
+ const l = t.childCount, r = e.childCount;
439
+ e: for (let s = 0, i = 0; s < r; s++) {
440
+ const c = e.child(s);
441
+ for (let a = i, d = Math.min(l, s + 3); a < d; a++) if (t.child(a) == c) {
442
+ i = a + 1, o += c.nodeSize;
443
+ continue e;
444
+ }
445
+ n(c, o), i < l && t.child(i).sameMarkup(c) ? We(t.child(i), c, o + 1, n) : c.nodesBetween(0, c.content.size, n, o + 1), o += c.nodeSize;
446
+ }
447
+ }
448
+ function $e(t, e) {
449
+ let o;
450
+ const n = (l, r) => {
451
+ l.type.spec.tableRole == "table" && (o = yt(t, l, r, o));
452
+ };
453
+ return e ? e.doc != t.doc && We(e.doc, t.doc, 0, n) : t.doc.descendants(n), o;
454
+ }
455
+ function yt(t, e, o, n) {
456
+ const l = C.get(e);
457
+ if (!l.problems) return n;
458
+ n || (n = t.tr);
459
+ const r = [];
460
+ for (let c = 0; c < l.height; c++) r.push(0);
461
+ for (let c = 0; c < l.problems.length; c++) {
462
+ const a = l.problems[c];
463
+ if (a.type == "collision") {
464
+ const d = e.nodeAt(a.pos);
465
+ if (!d) continue;
466
+ const u = d.attrs;
467
+ for (let f = 0; f < u.rowspan; f++) r[a.row + f] += a.n;
468
+ n.setNodeMarkup(n.mapping.map(o + 1 + a.pos), null, $(u, u.colspan - a.n, a.n));
469
+ } else if (a.type == "missing") r[a.row] += a.n;
470
+ else if (a.type == "overlong_rowspan") {
471
+ const d = e.nodeAt(a.pos);
472
+ if (!d) continue;
473
+ n.setNodeMarkup(n.mapping.map(o + 1 + a.pos), null, {
474
+ ...d.attrs,
475
+ rowspan: d.attrs.rowspan - a.n
476
+ });
477
+ } else if (a.type == "colwidth mismatch") {
478
+ const d = e.nodeAt(a.pos);
479
+ if (!d) continue;
480
+ n.setNodeMarkup(n.mapping.map(o + 1 + a.pos), null, {
481
+ ...d.attrs,
482
+ colwidth: a.colwidth
483
+ });
484
+ } else if (a.type == "zero_sized") {
485
+ const d = n.mapping.map(o);
486
+ n.delete(d, d + e.nodeSize);
487
+ }
488
+ }
489
+ let s, i;
490
+ for (let c = 0; c < r.length; c++) r[c] && (s == null && (s = c), i = c);
491
+ for (let c = 0, a = o + 1; c < l.height; c++) {
492
+ const d = e.child(c), u = a + d.nodeSize, f = r[c];
493
+ if (f > 0) {
494
+ let h = "cell";
495
+ d.firstChild && (h = d.firstChild.type.spec.tableRole);
496
+ const p = [];
497
+ for (let g = 0; g < f; g++) {
498
+ const w = y(t.schema)[h].createAndFill();
499
+ w && p.push(w);
500
+ }
501
+ const m = (c == 0 || s == c - 1) && i == c ? a + 1 : u - 1;
502
+ n.insert(n.mapping.map(m), p);
503
+ }
504
+ a = u;
505
+ }
506
+ return n.setMeta(Ct, { fixTables: !0 });
507
+ }
508
+ function M(t) {
509
+ const e = t.selection, o = Y(t), n = o.node(-1), l = o.start(-1), r = C.get(n);
510
+ return {
511
+ ...e instanceof b ? r.rectBetween(e.$anchorCell.pos - l, e.$headCell.pos - l) : r.findCell(o.pos - l),
512
+ tableStart: l,
513
+ map: r,
514
+ table: n
515
+ };
516
+ }
517
+ function De(t, { map: e, tableStart: o, table: n }, l) {
518
+ let r = l > 0 ? -1 : 0;
519
+ ht(e, n, l + r) && (r = l == 0 || l == e.width ? null : 0);
520
+ for (let s = 0; s < e.height; s++) {
521
+ const i = s * e.width + l;
522
+ if (l > 0 && l < e.width && e.map[i - 1] == e.map[i]) {
523
+ const c = e.map[i], a = n.nodeAt(c);
524
+ t.setNodeMarkup(t.mapping.map(o + c), null, He(a.attrs, l - e.colCount(c))), s += a.attrs.rowspan - 1;
525
+ } else {
526
+ const c = r == null ? y(n.type.schema).cell : n.nodeAt(e.map[i + r]).type, a = e.positionAt(s, l, n);
527
+ t.insert(t.mapping.map(o + a), c.createAndFill());
528
+ }
529
+ }
530
+ return t;
531
+ }
532
+ function St(t, e) {
533
+ if (!R(t)) return !1;
534
+ if (e) {
535
+ const o = M(t);
536
+ e(De(t.tr, o, o.left));
537
+ }
538
+ return !0;
539
+ }
540
+ function At(t, e) {
541
+ if (!R(t)) return !1;
542
+ if (e) {
543
+ const o = M(t);
544
+ e(De(t.tr, o, o.right));
545
+ }
546
+ return !0;
547
+ }
548
+ function xt(t, { map: e, table: o, tableStart: n }, l) {
549
+ const r = t.mapping.maps.length;
550
+ for (let s = 0; s < e.height; ) {
551
+ const i = s * e.width + l, c = e.map[i], a = o.nodeAt(c), d = a.attrs;
552
+ if (l > 0 && e.map[i - 1] == c || l < e.width - 1 && e.map[i + 1] == c) t.setNodeMarkup(t.mapping.slice(r).map(n + c), null, $(d, l - e.colCount(c)));
553
+ else {
554
+ const u = t.mapping.slice(r).map(n + c);
555
+ t.delete(u, u + a.nodeSize);
556
+ }
557
+ s += d.rowspan;
558
+ }
559
+ }
560
+ function Tt(t, e) {
561
+ if (!R(t)) return !1;
562
+ if (e) {
563
+ const o = M(t), n = t.tr;
564
+ if (o.left == 0 && o.right == o.map.width) return !1;
565
+ for (let l = o.right - 1; xt(n, o, l), l != o.left; l--) {
566
+ const r = o.tableStart ? n.doc.nodeAt(o.tableStart - 1) : n.doc;
567
+ if (!r) throw new RangeError("No table found");
568
+ o.table = r, o.map = C.get(r);
569
+ }
570
+ e(n);
571
+ }
572
+ return !0;
573
+ }
574
+ function Rt(t, e, o) {
575
+ var n;
576
+ const l = y(e.type.schema).header_cell;
577
+ for (let r = 0; r < t.width; r++) if (((n = e.nodeAt(t.map[r + o * t.width])) === null || n === void 0 ? void 0 : n.type) != l) return !1;
578
+ return !0;
579
+ }
580
+ function Be(t, { map: e, tableStart: o, table: n }, l) {
581
+ let r = o;
582
+ for (let a = 0; a < l; a++) r += n.child(a).nodeSize;
583
+ const s = [];
584
+ let i = l > 0 ? -1 : 0;
585
+ Rt(e, n, l + i) && (i = l == 0 || l == e.height ? null : 0);
586
+ for (let a = 0, d = e.width * l; a < e.width; a++, d++) if (l > 0 && l < e.height && e.map[d] == e.map[d - e.width]) {
587
+ const u = e.map[d], f = n.nodeAt(u).attrs;
588
+ t.setNodeMarkup(o + u, null, {
589
+ ...f,
590
+ rowspan: f.rowspan + 1
591
+ }), a += f.colspan - 1;
592
+ } else {
593
+ var c;
594
+ const u = i == null ? y(n.type.schema).cell : (c = n.nodeAt(e.map[d + i * e.width])) === null || c === void 0 ? void 0 : c.type, f = u == null ? void 0 : u.createAndFill();
595
+ f && s.push(f);
596
+ }
597
+ return t.insert(r, y(n.type.schema).row.create(null, s)), t;
598
+ }
599
+ function vt(t, e) {
600
+ if (!R(t)) return !1;
601
+ if (e) {
602
+ const o = M(t);
603
+ e(Be(t.tr, o, o.top));
604
+ }
605
+ return !0;
606
+ }
607
+ function Mt(t, e) {
608
+ if (!R(t)) return !1;
609
+ if (e) {
610
+ const o = M(t);
611
+ e(Be(t.tr, o, o.bottom));
612
+ }
613
+ return !0;
614
+ }
615
+ function Nt(t, { map: e, table: o, tableStart: n }, l) {
616
+ let r = 0;
617
+ for (let a = 0; a < l; a++) r += o.child(a).nodeSize;
618
+ const s = r + o.child(l).nodeSize, i = t.mapping.maps.length;
619
+ t.delete(r + n, s + n);
620
+ const c = /* @__PURE__ */ new Set();
621
+ for (let a = 0, d = l * e.width; a < e.width; a++, d++) {
622
+ const u = e.map[d];
623
+ if (!c.has(u)) {
624
+ if (c.add(u), l > 0 && u == e.map[d - e.width]) {
625
+ const f = o.nodeAt(u).attrs;
626
+ t.setNodeMarkup(t.mapping.slice(i).map(u + n), null, {
627
+ ...f,
628
+ rowspan: f.rowspan - 1
629
+ }), a += f.colspan - 1;
630
+ } else if (l < e.height && u == e.map[d + e.width]) {
631
+ const f = o.nodeAt(u), h = f.attrs, p = f.type.create({
632
+ ...h,
633
+ rowspan: f.attrs.rowspan - 1
634
+ }, f.content), m = e.positionAt(l + 1, a, o);
635
+ t.insert(t.mapping.slice(i).map(n + m), p), a += h.colspan - 1;
636
+ }
637
+ }
638
+ }
639
+ }
640
+ function kt(t, e) {
641
+ if (!R(t)) return !1;
642
+ if (e) {
643
+ const o = M(t), n = t.tr;
644
+ if (o.top == 0 && o.bottom == o.map.height) return !1;
645
+ for (let l = o.bottom - 1; Nt(n, o, l), l != o.top; l--) {
646
+ const r = o.tableStart ? n.doc.nodeAt(o.tableStart - 1) : n.doc;
647
+ if (!r) throw new RangeError("No table found");
648
+ o.table = r, o.map = C.get(o.table);
649
+ }
650
+ e(n);
651
+ }
652
+ return !0;
653
+ }
654
+ function fe(t) {
655
+ const e = t.content;
656
+ return e.childCount == 1 && e.child(0).isTextblock && e.child(0).childCount == 0;
657
+ }
658
+ function Et({ width: t, height: e, map: o }, n) {
659
+ let l = n.top * t + n.left, r = l, s = (n.bottom - 1) * t + n.left, i = l + (n.right - n.left - 1);
660
+ for (let c = n.top; c < n.bottom; c++) {
661
+ if (n.left > 0 && o[r] == o[r - 1] || n.right < t && o[i] == o[i + 1]) return !0;
662
+ r += t, i += t;
663
+ }
664
+ for (let c = n.left; c < n.right; c++) {
665
+ if (n.top > 0 && o[l] == o[l - t] || n.bottom < e && o[s] == o[s + t]) return !0;
666
+ l++, s++;
667
+ }
668
+ return !1;
669
+ }
670
+ function he(t, e) {
671
+ const o = t.selection;
672
+ if (!(o instanceof b) || o.$anchorCell.pos == o.$headCell.pos) return !1;
673
+ const n = M(t), { map: l } = n;
674
+ if (Et(l, n)) return !1;
675
+ if (e) {
676
+ const r = t.tr, s = {};
677
+ let i = v.empty, c, a;
678
+ for (let d = n.top; d < n.bottom; d++) for (let u = n.left; u < n.right; u++) {
679
+ const f = l.map[d * l.width + u], h = n.table.nodeAt(f);
680
+ if (!(s[f] || !h))
681
+ if (s[f] = !0, c == null)
682
+ c = f, a = h;
683
+ else {
684
+ fe(h) || (i = i.append(h.content));
685
+ const p = r.mapping.map(f + n.tableStart);
686
+ r.delete(p, p + h.nodeSize);
687
+ }
688
+ }
689
+ if (c == null || a == null) return !0;
690
+ if (r.setNodeMarkup(c + n.tableStart, null, {
691
+ ...He(a.attrs, a.attrs.colspan, n.right - n.left - a.attrs.colspan),
692
+ rowspan: n.bottom - n.top
693
+ }), i.size > 0) {
694
+ const d = c + 1 + a.content.size, u = fe(a) ? c + 1 : d;
695
+ r.replaceWith(u + n.tableStart, d + n.tableStart, i);
696
+ }
697
+ r.setSelection(new b(r.doc.resolve(c + n.tableStart))), e(r);
698
+ }
699
+ return !0;
700
+ }
701
+ function pe(t, e) {
702
+ const o = y(t.schema);
703
+ return zt(({ node: n }) => o[n.type.spec.tableRole])(t, e);
704
+ }
705
+ function zt(t) {
706
+ return (e, o) => {
707
+ const n = e.selection;
708
+ let l, r;
709
+ if (n instanceof b) {
710
+ if (n.$anchorCell.pos != n.$headCell.pos) return !1;
711
+ l = n.$anchorCell.nodeAfter, r = n.$anchorCell.pos;
712
+ } else {
713
+ var s;
714
+ if (l = dt(n.$from), !l) return !1;
715
+ r = (s = D(n.$from)) === null || s === void 0 ? void 0 : s.pos;
716
+ }
717
+ if (l == null || r == null || l.attrs.colspan == 1 && l.attrs.rowspan == 1) return !1;
718
+ if (o) {
719
+ let i = l.attrs;
720
+ const c = [], a = i.colwidth;
721
+ i.rowspan > 1 && (i = {
722
+ ...i,
723
+ rowspan: 1
724
+ }), i.colspan > 1 && (i = {
725
+ ...i,
726
+ colspan: 1
727
+ });
728
+ const d = M(e), u = e.tr;
729
+ for (let h = 0; h < d.right - d.left; h++) c.push(a ? {
730
+ ...i,
731
+ colwidth: a && a[h] ? [a[h]] : null
732
+ } : i);
733
+ let f;
734
+ for (let h = d.top; h < d.bottom; h++) {
735
+ let p = d.map.positionAt(h, d.left, d.table);
736
+ h == d.top && (p += l.nodeSize);
737
+ for (let m = d.left, g = 0; m < d.right; m++, g++)
738
+ m == d.left && h == d.top || u.insert(f = u.mapping.map(p + d.tableStart, 1), t({
739
+ node: l,
740
+ row: h,
741
+ col: m
742
+ }).createAndFill(c[g]));
743
+ }
744
+ u.setNodeMarkup(r, t({
745
+ node: l,
746
+ row: d.top,
747
+ col: d.left
748
+ }), c[0]), n instanceof b && u.setSelection(new b(u.doc.resolve(n.$anchorCell.pos), f ? u.doc.resolve(f) : void 0)), o(u);
749
+ }
750
+ return !0;
751
+ };
752
+ }
753
+ function Ht(t, e) {
754
+ return function(o, n) {
755
+ if (!R(o)) return !1;
756
+ const l = Y(o);
757
+ if (l.nodeAfter.attrs[t] === e) return !1;
758
+ if (n) {
759
+ const r = o.tr;
760
+ o.selection instanceof b ? o.selection.forEachCell((s, i) => {
761
+ s.attrs[t] !== e && r.setNodeMarkup(i, null, {
762
+ ...s.attrs,
763
+ [t]: e
764
+ });
765
+ }) : r.setNodeMarkup(l.pos, null, {
766
+ ...l.nodeAfter.attrs,
767
+ [t]: e
768
+ }), n(r);
769
+ }
770
+ return !0;
771
+ };
772
+ }
773
+ function Lt(t) {
774
+ return function(e, o) {
775
+ if (!R(e)) return !1;
776
+ if (o) {
777
+ const n = y(e.schema), l = M(e), r = e.tr, s = l.map.cellsInRect(t == "column" ? {
778
+ left: l.left,
779
+ top: 0,
780
+ right: l.right,
781
+ bottom: l.map.height
782
+ } : t == "row" ? {
783
+ left: 0,
784
+ top: l.top,
785
+ right: l.map.width,
786
+ bottom: l.bottom
787
+ } : l), i = s.map((c) => l.table.nodeAt(c));
788
+ for (let c = 0; c < s.length; c++) i[c].type == n.header_cell && r.setNodeMarkup(l.tableStart + s[c], n.cell, i[c].attrs);
789
+ if (r.steps.length === 0) for (let c = 0; c < s.length; c++) r.setNodeMarkup(l.tableStart + s[c], n.header_cell, i[c].attrs);
790
+ o(r);
791
+ }
792
+ return !0;
793
+ };
794
+ }
795
+ function me(t, e, o) {
796
+ const n = e.map.cellsInRect({
797
+ left: 0,
798
+ top: 0,
799
+ right: t == "row" ? e.map.width : 1,
800
+ bottom: t == "column" ? e.map.height : 1
801
+ });
802
+ for (let l = 0; l < n.length; l++) {
803
+ const r = e.table.nodeAt(n[l]);
804
+ if (r && r.type !== o.header_cell) return !1;
805
+ }
806
+ return !0;
807
+ }
808
+ function I(t, e) {
809
+ return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ? Lt(t) : function(o, n) {
810
+ if (!R(o)) return !1;
811
+ if (n) {
812
+ const l = y(o.schema), r = M(o), s = o.tr, i = me("row", r, l), c = me("column", r, l), a = (t === "column" ? i : t === "row" && c) ? 1 : 0, d = t == "column" ? {
813
+ left: 0,
814
+ top: a,
815
+ right: 1,
816
+ bottom: r.map.height
817
+ } : t == "row" ? {
818
+ left: a,
819
+ top: 0,
820
+ right: r.map.width,
821
+ bottom: 1
822
+ } : r, u = t == "column" ? c ? l.cell : l.header_cell : t == "row" ? i ? l.cell : l.header_cell : l.cell;
823
+ r.map.cellsInRect(d).forEach((f) => {
824
+ const h = f + r.tableStart, p = s.doc.nodeAt(h);
825
+ p && s.setNodeMarkup(h, u, p.attrs);
826
+ }), n(s);
827
+ }
828
+ return !0;
829
+ };
830
+ }
831
+ I("row", { useDeprecatedLogic: !0 });
832
+ I("column", { useDeprecatedLogic: !0 });
833
+ const Wt = I("cell", { useDeprecatedLogic: !0 });
834
+ function $t(t, e) {
835
+ if (e < 0) {
836
+ const o = t.nodeBefore;
837
+ if (o) return t.pos - o.nodeSize;
838
+ for (let n = t.index(-1) - 1, l = t.before(); n >= 0; n--) {
839
+ const r = t.node(-1).child(n), s = r.lastChild;
840
+ if (s) return l - 1 - s.nodeSize;
841
+ l -= r.nodeSize;
842
+ }
843
+ } else {
844
+ if (t.index() < t.parent.childCount - 1) return t.pos + t.nodeAfter.nodeSize;
845
+ const o = t.node(-1);
846
+ for (let n = t.indexAfter(-1), l = t.after(); n < o.childCount; n++) {
847
+ const r = o.child(n);
848
+ if (r.childCount) return l + 1;
849
+ l += r.nodeSize;
850
+ }
851
+ }
852
+ return null;
853
+ }
854
+ function ge(t) {
855
+ return function(e, o) {
856
+ if (!R(e)) return !1;
857
+ const n = $t(Y(e), t);
858
+ if (n == null) return !1;
859
+ if (o) {
860
+ const l = e.doc.resolve(n);
861
+ o(e.tr.setSelection(W.between(l, ft(l))).scrollIntoView());
862
+ }
863
+ return !0;
864
+ };
865
+ }
866
+ function Dt(t, e) {
867
+ const o = t.selection.$anchor;
868
+ for (let n = o.depth; n > 0; n--) if (o.node(n).type.spec.tableRole == "table")
869
+ return e && e(t.tr.delete(o.before(n), o.after(n)).scrollIntoView()), !0;
870
+ return !1;
871
+ }
872
+ function V(t, e) {
873
+ const o = t.selection;
874
+ if (!(o instanceof b)) return !1;
875
+ if (e) {
876
+ const n = t.tr, l = y(t.schema).cell.createAndFill().content;
877
+ o.forEachCell((r, s) => {
878
+ r.content.eq(l) || n.replace(n.mapping.map(s + 1), n.mapping.map(s + r.nodeSize - 1), new L(l, 0, 0));
879
+ }), n.docChanged && e(n);
880
+ }
881
+ return !0;
882
+ }
883
+ function Bt(t) {
884
+ if (t.size === 0) return null;
885
+ let { content: e, openStart: o, openEnd: n } = t;
886
+ for (; e.childCount == 1 && (o > 0 && n > 0 || e.child(0).type.spec.tableRole == "table"); )
887
+ o--, n--, e = e.child(0).content;
888
+ const l = e.child(0), r = l.type.spec.tableRole, s = l.type.schema, i = [];
889
+ if (r == "row") for (let c = 0; c < e.childCount; c++) {
890
+ let a = e.child(c).content;
891
+ const d = c ? 0 : Math.max(0, o - 1), u = c < e.childCount - 1 ? 0 : Math.max(0, n - 1);
892
+ (d || u) && (a = ie(y(s).row, new L(a, d, u)).content), i.push(a);
893
+ }
894
+ else if (r == "cell" || r == "header_cell") i.push(o || n ? ie(y(s).row, new L(e, o, n)).content : e);
895
+ else return null;
896
+ return It(s, i);
897
+ }
898
+ function It(t, e) {
899
+ const o = [];
900
+ for (let l = 0; l < e.length; l++) {
901
+ const r = e[l];
902
+ for (let s = r.childCount - 1; s >= 0; s--) {
903
+ const { rowspan: i, colspan: c } = r.child(s).attrs;
904
+ for (let a = l; a < l + i; a++) o[a] = (o[a] || 0) + c;
905
+ }
906
+ }
907
+ let n = 0;
908
+ for (let l = 0; l < o.length; l++) n = Math.max(n, o[l]);
909
+ for (let l = 0; l < o.length; l++)
910
+ if (l >= e.length && e.push(v.empty), o[l] < n) {
911
+ const r = y(t).cell.createAndFill(), s = [];
912
+ for (let i = o[l]; i < n; i++) s.push(r);
913
+ e[l] = e[l].append(v.from(s));
914
+ }
915
+ return {
916
+ height: e.length,
917
+ width: n,
918
+ rows: e
919
+ };
920
+ }
921
+ function ie(t, e) {
922
+ const o = t.createAndFill();
923
+ return new Xe(o).replace(0, o.content.size, e).doc;
924
+ }
925
+ function Pt({ width: t, height: e, rows: o }, n, l) {
926
+ if (t != n) {
927
+ const r = [], s = [];
928
+ for (let i = 0; i < o.length; i++) {
929
+ const c = o[i], a = [];
930
+ for (let d = r[i] || 0, u = 0; d < n; u++) {
931
+ let f = c.child(u % c.childCount);
932
+ d + f.attrs.colspan > n && (f = f.type.createChecked($(f.attrs, f.attrs.colspan, d + f.attrs.colspan - n), f.content)), a.push(f), d += f.attrs.colspan;
933
+ for (let h = 1; h < f.attrs.rowspan; h++) r[i + h] = (r[i + h] || 0) + f.attrs.colspan;
934
+ }
935
+ s.push(v.from(a));
936
+ }
937
+ o = s, t = n;
938
+ }
939
+ if (e != l) {
940
+ const r = [];
941
+ for (let s = 0, i = 0; s < l; s++, i++) {
942
+ const c = [], a = o[i % e];
943
+ for (let d = 0; d < a.childCount; d++) {
944
+ let u = a.child(d);
945
+ s + u.attrs.rowspan > l && (u = u.type.create({
946
+ ...u.attrs,
947
+ rowspan: Math.max(1, l - u.attrs.rowspan)
948
+ }, u.content)), c.push(u);
949
+ }
950
+ r.push(v.from(c));
951
+ }
952
+ o = r, e = l;
953
+ }
954
+ return {
955
+ width: t,
956
+ height: e,
957
+ rows: o
958
+ };
959
+ }
960
+ function _t(t, e, o, n, l, r, s) {
961
+ const i = t.doc.type.schema, c = y(i);
962
+ let a, d;
963
+ if (l > e.width) for (let u = 0, f = 0; u < e.height; u++) {
964
+ const h = o.child(u);
965
+ f += h.nodeSize;
966
+ const p = [];
967
+ let m;
968
+ h.lastChild == null || h.lastChild.type == c.cell ? m = a || (a = c.cell.createAndFill()) : m = d || (d = c.header_cell.createAndFill());
969
+ for (let g = e.width; g < l; g++) p.push(m);
970
+ t.insert(t.mapping.slice(s).map(f - 1 + n), p);
971
+ }
972
+ if (r > e.height) {
973
+ const u = [];
974
+ for (let p = 0, m = (e.height - 1) * e.width; p < Math.max(e.width, l); p++) {
975
+ const g = p >= e.width ? !1 : o.nodeAt(e.map[m + p]).type == c.header_cell;
976
+ u.push(g ? d || (d = c.header_cell.createAndFill()) : a || (a = c.cell.createAndFill()));
977
+ }
978
+ const f = c.row.create(null, v.from(u)), h = [];
979
+ for (let p = e.height; p < r; p++) h.push(f);
980
+ t.insert(t.mapping.slice(s).map(n + o.nodeSize - 2), h);
981
+ }
982
+ return !!(a || d);
983
+ }
984
+ function we(t, e, o, n, l, r, s, i) {
985
+ if (s == 0 || s == e.height) return !1;
986
+ let c = !1;
987
+ for (let a = l; a < r; a++) {
988
+ const d = s * e.width + a, u = e.map[d];
989
+ if (e.map[d - e.width] == u) {
990
+ c = !0;
991
+ const f = o.nodeAt(u), { top: h, left: p } = e.findCell(u);
992
+ t.setNodeMarkup(t.mapping.slice(i).map(u + n), null, {
993
+ ...f.attrs,
994
+ rowspan: s - h
995
+ }), t.insert(t.mapping.slice(i).map(e.positionAt(s, p, o)), f.type.createAndFill({
996
+ ...f.attrs,
997
+ rowspan: h + f.attrs.rowspan - s
998
+ })), a += f.attrs.colspan - 1;
999
+ }
1000
+ }
1001
+ return c;
1002
+ }
1003
+ function be(t, e, o, n, l, r, s, i) {
1004
+ if (s == 0 || s == e.width) return !1;
1005
+ let c = !1;
1006
+ for (let a = l; a < r; a++) {
1007
+ const d = a * e.width + s, u = e.map[d];
1008
+ if (e.map[d - 1] == u) {
1009
+ c = !0;
1010
+ const f = o.nodeAt(u), h = e.colCount(u), p = t.mapping.slice(i).map(u + n);
1011
+ t.setNodeMarkup(p, null, $(f.attrs, s - h, f.attrs.colspan - (s - h))), t.insert(p + f.nodeSize, f.type.createAndFill($(f.attrs, 0, s - h))), a += f.attrs.rowspan - 1;
1012
+ }
1013
+ }
1014
+ return c;
1015
+ }
1016
+ function Ce(t, e, o, n, l) {
1017
+ let r = o ? t.doc.nodeAt(o - 1) : t.doc;
1018
+ if (!r) throw new Error("No table found");
1019
+ let s = C.get(r);
1020
+ const { top: i, left: c } = n, a = c + l.width, d = i + l.height, u = t.tr;
1021
+ let f = 0;
1022
+ function h() {
1023
+ if (r = o ? u.doc.nodeAt(o - 1) : u.doc, !r) throw new Error("No table found");
1024
+ s = C.get(r), f = u.mapping.maps.length;
1025
+ }
1026
+ _t(u, s, r, o, a, d, f) && h(), we(u, s, r, o, c, a, i, f) && h(), we(u, s, r, o, c, a, d, f) && h(), be(u, s, r, o, i, d, c, f) && h(), be(u, s, r, o, i, d, a, f) && h();
1027
+ for (let p = i; p < d; p++) {
1028
+ const m = s.positionAt(p, c, r), g = s.positionAt(p, a, r);
1029
+ u.replace(u.mapping.slice(f).map(m + o), u.mapping.slice(f).map(g + o), new L(l.rows[p - i], 0, 0));
1030
+ }
1031
+ h(), u.setSelection(new b(u.doc.resolve(o + s.positionAt(i, c, r)), u.doc.resolve(o + s.positionAt(d - 1, a - 1, r)))), e(u);
1032
+ }
1033
+ const Ot = Je({
1034
+ ArrowLeft: K("horiz", -1),
1035
+ ArrowRight: K("horiz", 1),
1036
+ ArrowUp: K("vert", -1),
1037
+ ArrowDown: K("vert", 1),
1038
+ "Shift-ArrowLeft": X("horiz", -1),
1039
+ "Shift-ArrowRight": X("horiz", 1),
1040
+ "Shift-ArrowUp": X("vert", -1),
1041
+ "Shift-ArrowDown": X("vert", 1),
1042
+ Backspace: V,
1043
+ "Mod-Backspace": V,
1044
+ Delete: V,
1045
+ "Mod-Delete": V
1046
+ });
1047
+ function U(t, e, o) {
1048
+ return o.eq(t.selection) ? !1 : (e && e(t.tr.setSelection(o).scrollIntoView()), !0);
1049
+ }
1050
+ function K(t, e) {
1051
+ return (o, n, l) => {
1052
+ if (!l) return !1;
1053
+ const r = o.selection;
1054
+ if (r instanceof b) return U(o, n, E.near(r.$headCell, e));
1055
+ if (t != "horiz" && !r.empty) return !1;
1056
+ const s = Ie(l, t, e);
1057
+ if (s == null) return !1;
1058
+ if (t == "horiz") return U(o, n, E.near(o.doc.resolve(r.head + e), e));
1059
+ {
1060
+ const i = o.doc.resolve(s), c = ze(i, t, e);
1061
+ let a;
1062
+ return c ? a = E.near(c, 1) : e < 0 ? a = E.near(o.doc.resolve(i.before(-1)), -1) : a = E.near(o.doc.resolve(i.after(-1)), 1), U(o, n, a);
1063
+ }
1064
+ };
1065
+ }
1066
+ function X(t, e) {
1067
+ return (o, n, l) => {
1068
+ if (!l) return !1;
1069
+ const r = o.selection;
1070
+ let s;
1071
+ if (r instanceof b) s = r;
1072
+ else {
1073
+ const c = Ie(l, t, e);
1074
+ if (c == null) return !1;
1075
+ s = new b(o.doc.resolve(c));
1076
+ }
1077
+ const i = ze(s.$headCell, t, e);
1078
+ return i ? U(o, n, new b(s.$anchorCell, i)) : !1;
1079
+ };
1080
+ }
1081
+ function Ft(t, e) {
1082
+ const o = t.state.doc, n = D(o.resolve(e));
1083
+ return n ? (t.dispatch(t.state.tr.setSelection(new b(n))), !0) : !1;
1084
+ }
1085
+ function jt(t, e, o) {
1086
+ if (!R(t.state)) return !1;
1087
+ let n = Bt(o);
1088
+ const l = t.state.selection;
1089
+ if (l instanceof b) {
1090
+ n || (n = {
1091
+ width: 1,
1092
+ height: 1,
1093
+ rows: [v.from(ie(y(t.state.schema).cell, o))]
1094
+ });
1095
+ const r = l.$anchorCell.node(-1), s = l.$anchorCell.start(-1), i = C.get(r).rectBetween(l.$anchorCell.pos - s, l.$headCell.pos - s);
1096
+ return n = Pt(n, i.right - i.left, i.bottom - i.top), Ce(t.state, t.dispatch, s, i, n), !0;
1097
+ } else if (n) {
1098
+ const r = Y(t.state), s = r.start(-1);
1099
+ return Ce(t.state, t.dispatch, s, C.get(r.node(-1)).findCell(r.pos - s), n), !0;
1100
+ } else return !1;
1101
+ }
1102
+ function Vt(t, e) {
1103
+ var o;
1104
+ if (e.ctrlKey || e.metaKey) return;
1105
+ const n = ye(t, e.target);
1106
+ let l;
1107
+ if (e.shiftKey && t.state.selection instanceof b)
1108
+ r(t.state.selection.$anchorCell, e), e.preventDefault();
1109
+ else if (e.shiftKey && n && (l = D(t.state.selection.$anchor)) != null && ((o = te(t, e)) === null || o === void 0 ? void 0 : o.pos) != l.pos)
1110
+ r(l, e), e.preventDefault();
1111
+ else if (!n) return;
1112
+ function r(c, a) {
1113
+ let d = te(t, a);
1114
+ const u = H.getState(t.state) == null;
1115
+ if (!d || !ue(c, d)) if (u) d = c;
1116
+ else return;
1117
+ const f = new b(c, d);
1118
+ if (u || !t.state.selection.eq(f)) {
1119
+ const h = t.state.tr.setSelection(f);
1120
+ u && h.setMeta(H, c.pos), t.dispatch(h);
1121
+ }
1122
+ }
1123
+ function s() {
1124
+ t.root.removeEventListener("mouseup", s), t.root.removeEventListener("dragstart", s), t.root.removeEventListener("mousemove", i), H.getState(t.state) != null && t.dispatch(t.state.tr.setMeta(H, -1));
1125
+ }
1126
+ function i(c) {
1127
+ const a = c, d = H.getState(t.state);
1128
+ let u;
1129
+ if (d != null) u = t.state.doc.resolve(d);
1130
+ else if (ye(t, a.target) != n && (u = te(t, e), !u))
1131
+ return s();
1132
+ u && r(u, a);
1133
+ }
1134
+ t.root.addEventListener("mouseup", s), t.root.addEventListener("dragstart", s), t.root.addEventListener("mousemove", i);
1135
+ }
1136
+ function Ie(t, e, o) {
1137
+ if (!(t.state.selection instanceof W)) return null;
1138
+ const { $head: n } = t.state.selection;
1139
+ for (let l = n.depth - 1; l >= 0; l--) {
1140
+ const r = n.node(l);
1141
+ if ((o < 0 ? n.index(l) : n.indexAfter(l)) != (o < 0 ? 0 : r.childCount)) return null;
1142
+ if (r.type.spec.tableRole == "cell" || r.type.spec.tableRole == "header_cell") {
1143
+ const s = n.before(l), i = e == "vert" ? o > 0 ? "down" : "up" : o > 0 ? "right" : "left";
1144
+ return t.endOfTextblock(i) ? s : null;
1145
+ }
1146
+ }
1147
+ return null;
1148
+ }
1149
+ function ye(t, e) {
1150
+ for (; e && e != t.dom; e = e.parentNode) if (e.nodeName == "TD" || e.nodeName == "TH") return e;
1151
+ return null;
1152
+ }
1153
+ function te(t, e) {
1154
+ const o = t.posAtCoords({
1155
+ left: e.clientX,
1156
+ top: e.clientY
1157
+ });
1158
+ if (!o) return null;
1159
+ const n = o.inside >= 0 ? o.inside : o.pos;
1160
+ return D(t.state.doc.resolve(n));
1161
+ }
1162
+ var Kt = class {
1163
+ constructor(e, o) {
1164
+ this.node = e, this.defaultCellMinWidth = o, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.table.style.setProperty("--default-cell-min-width", `${o}px`), this.colgroup = this.table.appendChild(document.createElement("colgroup")), ce(e, this.colgroup, this.table, o), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1165
+ }
1166
+ update(e) {
1167
+ return e.type != this.node.type ? !1 : (this.node = e, ce(e, this.colgroup, this.table, this.defaultCellMinWidth), !0);
1168
+ }
1169
+ ignoreMutation(e) {
1170
+ return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
1171
+ }
1172
+ };
1173
+ function ce(t, e, o, n, l, r) {
1174
+ let s = 0, i = !0, c = e.firstChild;
1175
+ const a = t.firstChild;
1176
+ if (a) {
1177
+ for (let u = 0, f = 0; u < a.childCount; u++) {
1178
+ const { colspan: h, colwidth: p } = a.child(u).attrs;
1179
+ for (let m = 0; m < h; m++, f++) {
1180
+ const g = l == f ? r : p && p[m], w = g ? g + "px" : "";
1181
+ if (s += g || n, g || (i = !1), c)
1182
+ c.style.width != w && (c.style.width = w), c = c.nextSibling;
1183
+ else {
1184
+ const S = document.createElement("col");
1185
+ S.style.width = w, e.appendChild(S);
1186
+ }
1187
+ }
1188
+ }
1189
+ for (; c; ) {
1190
+ var d;
1191
+ const u = c.nextSibling;
1192
+ (d = c.parentNode) === null || d === void 0 || d.removeChild(c), c = u;
1193
+ }
1194
+ i ? (o.style.width = s + "px", o.style.minWidth = "") : (o.style.width = "", o.style.minWidth = s + "px");
1195
+ }
1196
+ }
1197
+ const A = new de("tableColumnResizing");
1198
+ function Xt({ handleWidth: t = 5, cellMinWidth: e = 25, defaultCellMinWidth: o = 100, View: n = Kt, lastColumnResizable: l = !0 } = {}) {
1199
+ const r = new ke({
1200
+ key: A,
1201
+ state: {
1202
+ init(s, i) {
1203
+ var c;
1204
+ const a = (c = r.spec) === null || c === void 0 || (c = c.props) === null || c === void 0 ? void 0 : c.nodeViews, d = y(i.schema).table.name;
1205
+ return n && a && (a[d] = (u, f) => new n(u, o, f)), new Gt(-1, !1);
1206
+ },
1207
+ apply(s, i) {
1208
+ return i.apply(s);
1209
+ }
1210
+ },
1211
+ props: {
1212
+ attributes: (s) => {
1213
+ const i = A.getState(s);
1214
+ return i && i.activeHandle > -1 ? { class: "resize-cursor" } : {};
1215
+ },
1216
+ handleDOMEvents: {
1217
+ mousemove: (s, i) => {
1218
+ Ut(s, i, t, l);
1219
+ },
1220
+ mouseleave: (s) => {
1221
+ qt(s);
1222
+ },
1223
+ mousedown: (s, i) => {
1224
+ Zt(s, i, e, o);
1225
+ }
1226
+ },
1227
+ decorations: (s) => {
1228
+ const i = A.getState(s);
1229
+ if (i && i.activeHandle > -1) return to(s, i.activeHandle);
1230
+ },
1231
+ nodeViews: {}
1232
+ }
1233
+ });
1234
+ return r;
1235
+ }
1236
+ var Gt = class q {
1237
+ constructor(e, o) {
1238
+ this.activeHandle = e, this.dragging = o;
1239
+ }
1240
+ apply(e) {
1241
+ const o = this, n = e.getMeta(A);
1242
+ if (n && n.setHandle != null) return new q(n.setHandle, !1);
1243
+ if (n && n.setDragging !== void 0) return new q(o.activeHandle, n.setDragging);
1244
+ if (o.activeHandle > -1 && e.docChanged) {
1245
+ let l = e.mapping.map(o.activeHandle, -1);
1246
+ return se(e.doc.resolve(l)) || (l = -1), new q(l, o.dragging);
1247
+ }
1248
+ return o;
1249
+ }
1250
+ };
1251
+ function Ut(t, e, o, n) {
1252
+ if (!t.editable) return;
1253
+ const l = A.getState(t.state);
1254
+ if (l && !l.dragging) {
1255
+ const r = Yt(e.target);
1256
+ let s = -1;
1257
+ if (r) {
1258
+ const { left: i, right: c } = r.getBoundingClientRect();
1259
+ e.clientX - i <= o ? s = Se(t, e, "left", o) : c - e.clientX <= o && (s = Se(t, e, "right", o));
1260
+ }
1261
+ if (s != l.activeHandle) {
1262
+ if (!n && s !== -1) {
1263
+ const i = t.state.doc.resolve(s), c = i.node(-1), a = C.get(c), d = i.start(-1);
1264
+ if (a.colCount(i.pos - d) + i.nodeAfter.attrs.colspan - 1 == a.width - 1) return;
1265
+ }
1266
+ Pe(t, s);
1267
+ }
1268
+ }
1269
+ }
1270
+ function qt(t) {
1271
+ if (!t.editable) return;
1272
+ const e = A.getState(t.state);
1273
+ e && e.activeHandle > -1 && !e.dragging && Pe(t, -1);
1274
+ }
1275
+ function Zt(t, e, o, n) {
1276
+ var l;
1277
+ if (!t.editable) return !1;
1278
+ const r = (l = t.dom.ownerDocument.defaultView) !== null && l !== void 0 ? l : window, s = A.getState(t.state);
1279
+ if (!s || s.activeHandle == -1 || s.dragging) return !1;
1280
+ const i = t.state.doc.nodeAt(s.activeHandle), c = Jt(t, s.activeHandle, i.attrs);
1281
+ t.dispatch(t.state.tr.setMeta(A, { setDragging: {
1282
+ startX: e.clientX,
1283
+ startWidth: c
1284
+ } }));
1285
+ function a(u) {
1286
+ r.removeEventListener("mouseup", a), r.removeEventListener("mousemove", d);
1287
+ const f = A.getState(t.state);
1288
+ f != null && f.dragging && (Qt(t, f.activeHandle, Ae(f.dragging, u, o)), t.dispatch(t.state.tr.setMeta(A, { setDragging: null })));
1289
+ }
1290
+ function d(u) {
1291
+ if (!u.which) return a(u);
1292
+ const f = A.getState(t.state);
1293
+ if (f && f.dragging) {
1294
+ const h = Ae(f.dragging, u, o);
1295
+ xe(t, f.activeHandle, h, n);
1296
+ }
1297
+ }
1298
+ return xe(t, s.activeHandle, c, n), r.addEventListener("mouseup", a), r.addEventListener("mousemove", d), e.preventDefault(), !0;
1299
+ }
1300
+ function Jt(t, e, { colspan: o, colwidth: n }) {
1301
+ const l = n && n[n.length - 1];
1302
+ if (l) return l;
1303
+ const r = t.domAtPos(e);
1304
+ let s = r.node.childNodes[r.offset].offsetWidth, i = o;
1305
+ if (n)
1306
+ for (let c = 0; c < o; c++) n[c] && (s -= n[c], i--);
1307
+ return s / i;
1308
+ }
1309
+ function Yt(t) {
1310
+ for (; t && t.nodeName != "TD" && t.nodeName != "TH"; ) t = t.classList && t.classList.contains("ProseMirror") ? null : t.parentNode;
1311
+ return t;
1312
+ }
1313
+ function Se(t, e, o, n) {
1314
+ const l = o == "right" ? -n : n, r = t.posAtCoords({
1315
+ left: e.clientX + l,
1316
+ top: e.clientY
1317
+ });
1318
+ if (!r) return -1;
1319
+ const { pos: s } = r, i = D(t.state.doc.resolve(s));
1320
+ if (!i) return -1;
1321
+ if (o == "right") return i.pos;
1322
+ const c = C.get(i.node(-1)), a = i.start(-1), d = c.map.indexOf(i.pos - a);
1323
+ return d % c.width == 0 ? -1 : a + c.map[d - 1];
1324
+ }
1325
+ function Ae(t, e, o) {
1326
+ const n = e.clientX - t.startX;
1327
+ return Math.max(o, t.startWidth + n);
1328
+ }
1329
+ function Pe(t, e) {
1330
+ t.dispatch(t.state.tr.setMeta(A, { setHandle: e }));
1331
+ }
1332
+ function Qt(t, e, o) {
1333
+ const n = t.state.doc.resolve(e), l = n.node(-1), r = C.get(l), s = n.start(-1), i = r.colCount(n.pos - s) + n.nodeAfter.attrs.colspan - 1, c = t.state.tr;
1334
+ for (let a = 0; a < r.height; a++) {
1335
+ const d = a * r.width + i;
1336
+ if (a && r.map[d] == r.map[d - r.width]) continue;
1337
+ const u = r.map[d], f = l.nodeAt(u).attrs, h = f.colspan == 1 ? 0 : i - r.colCount(u);
1338
+ if (f.colwidth && f.colwidth[h] == o) continue;
1339
+ const p = f.colwidth ? f.colwidth.slice() : eo(f.colspan);
1340
+ p[h] = o, c.setNodeMarkup(s + u, null, {
1341
+ ...f,
1342
+ colwidth: p
1343
+ });
1344
+ }
1345
+ c.docChanged && t.dispatch(c);
1346
+ }
1347
+ function xe(t, e, o, n) {
1348
+ const l = t.state.doc.resolve(e), r = l.node(-1), s = l.start(-1), i = C.get(r).colCount(l.pos - s) + l.nodeAfter.attrs.colspan - 1;
1349
+ let c = t.domAtPos(l.start(-1)).node;
1350
+ for (; c && c.nodeName != "TABLE"; ) c = c.parentNode;
1351
+ c && ce(r, c.firstChild, c, n, i, o);
1352
+ }
1353
+ function eo(t) {
1354
+ return Array(t).fill(0);
1355
+ }
1356
+ function to(t, e) {
1357
+ const o = [], n = t.doc.resolve(e), l = n.node(-1);
1358
+ if (!l) return oe.empty;
1359
+ const r = C.get(l), s = n.start(-1), i = r.colCount(n.pos - s) + n.nodeAfter.attrs.colspan - 1;
1360
+ for (let a = 0; a < r.height; a++) {
1361
+ const d = i + a * r.width;
1362
+ if ((i == r.width - 1 || r.map[d] != r.map[d + 1]) && (a == 0 || r.map[d] != r.map[d - r.width])) {
1363
+ var c;
1364
+ const u = r.map[d], f = s + u + l.nodeAt(u).nodeSize - 1, h = document.createElement("div");
1365
+ h.className = "column-resize-handle", !((c = A.getState(t)) === null || c === void 0) && c.dragging && o.push(ne.node(s + u, s + u + l.nodeAt(u).nodeSize, { class: "column-resize-dragging" })), o.push(ne.widget(f, h));
1366
+ }
1367
+ }
1368
+ return oe.create(t.doc, o);
1369
+ }
1370
+ function oo({ allowTableNodeSelection: t = !1 } = {}) {
1371
+ return new ke({
1372
+ key: H,
1373
+ state: {
1374
+ init() {
1375
+ return null;
1376
+ },
1377
+ apply(e, o) {
1378
+ const n = e.getMeta(H);
1379
+ if (n != null) return n == -1 ? null : n;
1380
+ if (o == null || !e.docChanged) return o;
1381
+ const { deleted: l, pos: r } = e.mapping.mapResult(o);
1382
+ return l ? null : r;
1383
+ }
1384
+ },
1385
+ props: {
1386
+ decorations: mt,
1387
+ handleDOMEvents: { mousedown: Vt },
1388
+ createSelectionBetween(e) {
1389
+ return H.getState(e.state) != null ? e.state.selection : null;
1390
+ },
1391
+ handleTripleClick: Ft,
1392
+ handleKeyDown: Ot,
1393
+ handlePaste: jt
1394
+ },
1395
+ appendTransaction(e, o, n) {
1396
+ return bt(n, $e(n, o), t);
1397
+ }
1398
+ });
1399
+ }
1400
+ var _e = Z.create({
1401
+ name: "tableCell",
1402
+ addOptions() {
1403
+ return {
1404
+ HTMLAttributes: {}
1405
+ };
1406
+ },
1407
+ content: "block+",
1408
+ addAttributes() {
1409
+ return {
1410
+ colspan: {
1411
+ default: 1
1412
+ },
1413
+ rowspan: {
1414
+ default: 1
1415
+ },
1416
+ colwidth: {
1417
+ default: null,
1418
+ parseHTML: (t) => {
1419
+ var e, o;
1420
+ const n = t.getAttribute("colwidth"), l = n ? n.split(",").map((r) => parseInt(r, 10)) : null;
1421
+ if (!l) {
1422
+ const r = (e = t.closest("table")) == null ? void 0 : e.querySelectorAll("colgroup > col"), s = Array.from(((o = t.parentElement) == null ? void 0 : o.children) || []).indexOf(t);
1423
+ if (s && s > -1 && r && r[s]) {
1424
+ const i = r[s].getAttribute("width");
1425
+ return i ? [parseInt(i, 10)] : null;
1426
+ }
1427
+ }
1428
+ return l;
1429
+ }
1430
+ }
1431
+ };
1432
+ },
1433
+ tableRole: "cell",
1434
+ isolating: !0,
1435
+ parseHTML() {
1436
+ return [{ tag: "td" }];
1437
+ },
1438
+ renderHTML({ HTMLAttributes: t }) {
1439
+ return ["td", J(this.options.HTMLAttributes, t), 0];
1440
+ }
1441
+ }), Oe = Z.create({
1442
+ name: "tableHeader",
1443
+ addOptions() {
1444
+ return {
1445
+ HTMLAttributes: {}
1446
+ };
1447
+ },
1448
+ content: "block+",
1449
+ addAttributes() {
1450
+ return {
1451
+ colspan: {
1452
+ default: 1
1453
+ },
1454
+ rowspan: {
1455
+ default: 1
1456
+ },
1457
+ colwidth: {
1458
+ default: null,
1459
+ parseHTML: (t) => {
1460
+ const e = t.getAttribute("colwidth");
1461
+ return e ? e.split(",").map((n) => parseInt(n, 10)) : null;
1462
+ }
1463
+ }
1464
+ };
1465
+ },
1466
+ tableRole: "header_cell",
1467
+ isolating: !0,
1468
+ parseHTML() {
1469
+ return [{ tag: "th" }];
1470
+ },
1471
+ renderHTML({ HTMLAttributes: t }) {
1472
+ return ["th", J(this.options.HTMLAttributes, t), 0];
1473
+ }
1474
+ }), Fe = Z.create({
1475
+ name: "tableRow",
1476
+ addOptions() {
1477
+ return {
1478
+ HTMLAttributes: {}
1479
+ };
1480
+ },
1481
+ content: "(tableCell | tableHeader)*",
1482
+ tableRole: "row",
1483
+ parseHTML() {
1484
+ return [{ tag: "tr" }];
1485
+ },
1486
+ renderHTML({ HTMLAttributes: t }) {
1487
+ return ["tr", J(this.options.HTMLAttributes, t), 0];
1488
+ }
1489
+ });
1490
+ function ae(t, e) {
1491
+ return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
1492
+ }
1493
+ function Te(t, e, o, n, l, r) {
1494
+ var s;
1495
+ let i = 0, c = !0, a = e.firstChild;
1496
+ const d = t.firstChild;
1497
+ if (d !== null)
1498
+ for (let f = 0, h = 0; f < d.childCount; f += 1) {
1499
+ const { colspan: p, colwidth: m } = d.child(f).attrs;
1500
+ for (let g = 0; g < p; g += 1, h += 1) {
1501
+ const w = l === h ? r : m && m[g], S = w ? `${w}px` : "";
1502
+ if (i += w || n, w || (c = !1), a) {
1503
+ if (a.style.width !== S) {
1504
+ const [x, z] = ae(n, w);
1505
+ a.style.setProperty(x, z);
1506
+ }
1507
+ a = a.nextSibling;
1508
+ } else {
1509
+ const x = document.createElement("col"), [z, T] = ae(n, w);
1510
+ x.style.setProperty(z, T), e.appendChild(x);
1511
+ }
1512
+ }
1513
+ }
1514
+ for (; a; ) {
1515
+ const f = a.nextSibling;
1516
+ (s = a.parentNode) == null || s.removeChild(a), a = f;
1517
+ }
1518
+ const u = t.attrs.style && typeof t.attrs.style == "string" && /\bwidth\s*:/i.test(t.attrs.style);
1519
+ c && !u ? (o.style.width = `${i}px`, o.style.minWidth = "") : (o.style.width = "", o.style.minWidth = `${i}px`);
1520
+ }
1521
+ var no = class {
1522
+ constructor(t, e) {
1523
+ this.node = t, this.cellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), t.attrs.style && (this.table.style.cssText = t.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), Te(t, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
1524
+ }
1525
+ update(t) {
1526
+ return t.type !== this.node.type ? !1 : (this.node = t, Te(t, this.colgroup, this.table, this.cellMinWidth), !0);
1527
+ }
1528
+ ignoreMutation(t) {
1529
+ const e = t.target, o = this.dom.contains(e), n = this.contentDOM.contains(e);
1530
+ return !!(o && !n && (t.type === "attributes" || t.type === "childList" || t.type === "characterData"));
1531
+ }
1532
+ };
1533
+ function lo(t, e, o, n) {
1534
+ let l = 0, r = !0;
1535
+ const s = [], i = t.firstChild;
1536
+ if (!i)
1537
+ return {};
1538
+ for (let u = 0, f = 0; u < i.childCount; u += 1) {
1539
+ const { colspan: h, colwidth: p } = i.child(u).attrs;
1540
+ for (let m = 0; m < h; m += 1, f += 1) {
1541
+ const g = o === f ? n : p && p[m];
1542
+ l += g || e, g || (r = !1);
1543
+ const [w, S] = ae(e, g);
1544
+ s.push(["col", { style: `${w}: ${S}` }]);
1545
+ }
1546
+ }
1547
+ const c = r ? `${l}px` : "", a = r ? "" : `${l}px`;
1548
+ return { colgroup: ["colgroup", {}, ...s], tableWidth: c, tableMinWidth: a };
1549
+ }
1550
+ function Re(t, e) {
1551
+ return t.createAndFill();
1552
+ }
1553
+ function ro(t) {
1554
+ if (t.cached.tableNodeTypes)
1555
+ return t.cached.tableNodeTypes;
1556
+ const e = {};
1557
+ return Object.keys(t.nodes).forEach((o) => {
1558
+ const n = t.nodes[o];
1559
+ n.spec.tableRole && (e[n.spec.tableRole] = n);
1560
+ }), t.cached.tableNodeTypes = e, e;
1561
+ }
1562
+ function so(t, e, o, n, l) {
1563
+ const r = ro(t), s = [], i = [];
1564
+ for (let a = 0; a < o; a += 1) {
1565
+ const d = Re(r.cell);
1566
+ if (d && i.push(d), n) {
1567
+ const u = Re(r.header_cell);
1568
+ u && s.push(u);
1569
+ }
1570
+ }
1571
+ const c = [];
1572
+ for (let a = 0; a < e; a += 1)
1573
+ c.push(r.row.createChecked(null, n && a === 0 ? s : i));
1574
+ return r.table.createChecked(null, c);
1575
+ }
1576
+ function io(t) {
1577
+ return t instanceof b;
1578
+ }
1579
+ var G = ({ editor: t }) => {
1580
+ const { selection: e } = t.state;
1581
+ if (!io(e))
1582
+ return !1;
1583
+ let o = 0;
1584
+ const n = qe(e.ranges[0].$from, (r) => r.type.name === "table");
1585
+ return n == null || n.node.descendants((r) => {
1586
+ if (r.type.name === "table")
1587
+ return !1;
1588
+ ["tableCell", "tableHeader"].includes(r.type.name) && (o += 1);
1589
+ }), o === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
1590
+ }, co = "";
1591
+ function ao(t) {
1592
+ return (t || "").replace(/\s+/g, " ").trim();
1593
+ }
1594
+ function uo(t, e, o = {}) {
1595
+ var n;
1596
+ const l = (n = o.cellLineSeparator) != null ? n : co;
1597
+ if (!t || !t.content || t.content.length === 0)
1598
+ return "";
1599
+ const r = [];
1600
+ t.content.forEach((p) => {
1601
+ const m = [];
1602
+ p.content && p.content.forEach((g) => {
1603
+ let w = "";
1604
+ g.content && Array.isArray(g.content) && g.content.length > 1 ? w = g.content.map((T) => e.renderChildren(T)).join(l) : w = g.content ? e.renderChildren(g.content) : "";
1605
+ const S = ao(w), x = g.type === "tableHeader";
1606
+ m.push({ text: S, isHeader: x });
1607
+ }), r.push(m);
1608
+ });
1609
+ const s = r.reduce((p, m) => Math.max(p, m.length), 0);
1610
+ if (s === 0)
1611
+ return "";
1612
+ const i = new Array(s).fill(0);
1613
+ r.forEach((p) => {
1614
+ var m;
1615
+ for (let g = 0; g < s; g += 1) {
1616
+ const S = (((m = p[g]) == null ? void 0 : m.text) || "").length;
1617
+ S > i[g] && (i[g] = S), i[g] < 3 && (i[g] = 3);
1618
+ }
1619
+ });
1620
+ const c = (p, m) => p + " ".repeat(Math.max(0, m - p.length)), a = r[0], d = a.some((p) => p.isHeader);
1621
+ let u = `
1622
+ `;
1623
+ const f = new Array(s).fill(0).map((p, m) => d && a[m] && a[m].text || "");
1624
+ return u += `| ${f.map((p, m) => c(p, i[m])).join(" | ")} |
1625
+ `, u += `| ${i.map((p) => "-".repeat(Math.max(3, p))).join(" | ")} |
1626
+ `, (d ? r.slice(1) : r).forEach((p) => {
1627
+ u += `| ${new Array(s).fill(0).map((m, g) => c(p[g] && p[g].text || "", i[g])).join(" | ")} |
1628
+ `;
1629
+ }), u;
1630
+ }
1631
+ var fo = uo, je = Z.create({
1632
+ name: "table",
1633
+ // @ts-ignore
1634
+ addOptions() {
1635
+ return {
1636
+ HTMLAttributes: {},
1637
+ resizable: !1,
1638
+ renderWrapper: !1,
1639
+ handleWidth: 5,
1640
+ cellMinWidth: 25,
1641
+ // TODO: fix
1642
+ View: no,
1643
+ lastColumnResizable: !0,
1644
+ allowTableNodeSelection: !1
1645
+ };
1646
+ },
1647
+ content: "tableRow+",
1648
+ tableRole: "table",
1649
+ isolating: !0,
1650
+ group: "block",
1651
+ parseHTML() {
1652
+ return [{ tag: "table" }];
1653
+ },
1654
+ renderHTML({ node: t, HTMLAttributes: e }) {
1655
+ const { colgroup: o, tableWidth: n, tableMinWidth: l } = lo(t, this.options.cellMinWidth), r = e.style;
1656
+ function s() {
1657
+ return r || (n ? `width: ${n}` : `min-width: ${l}`);
1658
+ }
1659
+ const i = [
1660
+ "table",
1661
+ J(this.options.HTMLAttributes, e, {
1662
+ style: s()
1663
+ }),
1664
+ o,
1665
+ ["tbody", 0]
1666
+ ];
1667
+ return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, i] : i;
1668
+ },
1669
+ parseMarkdown: (t, e) => {
1670
+ const o = [];
1671
+ if (t.header) {
1672
+ const n = [];
1673
+ t.header.forEach((l) => {
1674
+ n.push(e.createNode("tableHeader", {}, [{ type: "paragraph", content: e.parseInline(l.tokens) }]));
1675
+ }), o.push(e.createNode("tableRow", {}, n));
1676
+ }
1677
+ return t.rows && t.rows.forEach((n) => {
1678
+ const l = [];
1679
+ n.forEach((r) => {
1680
+ l.push(e.createNode("tableCell", {}, [{ type: "paragraph", content: e.parseInline(r.tokens) }]));
1681
+ }), o.push(e.createNode("tableRow", {}, l));
1682
+ }), e.createNode("table", void 0, o);
1683
+ },
1684
+ renderMarkdown: (t, e) => fo(t, e),
1685
+ addCommands() {
1686
+ return {
1687
+ insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: o = !0 } = {}) => ({ tr: n, dispatch: l, editor: r }) => {
1688
+ const s = so(r.schema, t, e, o);
1689
+ if (l) {
1690
+ const i = n.selection.from + 1;
1691
+ n.replaceSelectionWith(s).scrollIntoView().setSelection(Ze.near(n.doc.resolve(i)));
1692
+ }
1693
+ return !0;
1694
+ },
1695
+ addColumnBefore: () => ({ state: t, dispatch: e }) => St(t, e),
1696
+ addColumnAfter: () => ({ state: t, dispatch: e }) => At(t, e),
1697
+ deleteColumn: () => ({ state: t, dispatch: e }) => Tt(t, e),
1698
+ addRowBefore: () => ({ state: t, dispatch: e }) => vt(t, e),
1699
+ addRowAfter: () => ({ state: t, dispatch: e }) => Mt(t, e),
1700
+ deleteRow: () => ({ state: t, dispatch: e }) => kt(t, e),
1701
+ deleteTable: () => ({ state: t, dispatch: e }) => Dt(t, e),
1702
+ mergeCells: () => ({ state: t, dispatch: e }) => he(t, e),
1703
+ splitCell: () => ({ state: t, dispatch: e }) => pe(t, e),
1704
+ toggleHeaderColumn: () => ({ state: t, dispatch: e }) => I("column")(t, e),
1705
+ toggleHeaderRow: () => ({ state: t, dispatch: e }) => I("row")(t, e),
1706
+ toggleHeaderCell: () => ({ state: t, dispatch: e }) => Wt(t, e),
1707
+ mergeOrSplit: () => ({ state: t, dispatch: e }) => he(t, e) ? !0 : pe(t, e),
1708
+ setCellAttribute: (t, e) => ({ state: o, dispatch: n }) => Ht(t, e)(o, n),
1709
+ goToNextCell: () => ({ state: t, dispatch: e }) => ge(1)(t, e),
1710
+ goToPreviousCell: () => ({ state: t, dispatch: e }) => ge(-1)(t, e),
1711
+ fixTables: () => ({ state: t, dispatch: e }) => (e && $e(t), !0),
1712
+ setCellSelection: (t) => ({ tr: e, dispatch: o }) => {
1713
+ if (o) {
1714
+ const n = b.create(e.doc, t.anchorCell, t.headCell);
1715
+ e.setSelection(n);
1716
+ }
1717
+ return !0;
1718
+ }
1719
+ };
1720
+ },
1721
+ addKeyboardShortcuts() {
1722
+ return {
1723
+ Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
1724
+ "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
1725
+ Backspace: G,
1726
+ "Mod-Backspace": G,
1727
+ Delete: G,
1728
+ "Mod-Delete": G
1729
+ };
1730
+ },
1731
+ addProseMirrorPlugins() {
1732
+ return [
1733
+ ...this.options.resizable && this.editor.isEditable ? [
1734
+ Xt({
1735
+ handleWidth: this.options.handleWidth,
1736
+ cellMinWidth: this.options.cellMinWidth,
1737
+ defaultCellMinWidth: this.options.cellMinWidth,
1738
+ View: this.options.View,
1739
+ lastColumnResizable: this.options.lastColumnResizable
1740
+ })
1741
+ ] : [],
1742
+ oo({
1743
+ allowTableNodeSelection: this.options.allowTableNodeSelection
1744
+ })
1745
+ ];
1746
+ },
1747
+ extendNodeSchema(t) {
1748
+ const e = {
1749
+ name: t.name,
1750
+ options: t.options,
1751
+ storage: t.storage
1752
+ };
1753
+ return {
1754
+ tableRole: Ge(Ue(t, "tableRole", e))
1755
+ };
1756
+ }
1757
+ });
1758
+ Ee.create({
1759
+ name: "tableKit",
1760
+ addExtensions() {
1761
+ const t = [];
1762
+ return this.options.table !== !1 && t.push(je.configure(this.options.table)), this.options.tableCell !== !1 && t.push(_e.configure(this.options.tableCell)), this.options.tableHeader !== !1 && t.push(Oe.configure(this.options.tableHeader)), this.options.tableRow !== !1 && t.push(Fe.configure(this.options.tableRow)), t;
1763
+ }
1764
+ });
1765
+ function ho(t, e, o) {
1766
+ if (!t.doc)
1767
+ return t;
1768
+ const n = t.doc.nodeAt(e);
1769
+ if (!n || o === n.attrs.backgroundColor)
1770
+ return t;
1771
+ const l = {
1772
+ ...n.attrs,
1773
+ backgroundColor: o
1774
+ };
1775
+ return t.setNodeMarkup(e, n.type, l, n.marks);
1776
+ }
1777
+ function po(t, e, o) {
1778
+ const { doc: n, selection: l } = t;
1779
+ return !n || !l || !(l instanceof b) || l.forEachCell((r, s) => {
1780
+ t = ho(t, s, o);
1781
+ }), t;
1782
+ }
1783
+ function ve(t, e) {
1784
+ return ({ tr: o, state: n, dispatch: l }) => {
1785
+ const { selection: r } = n;
1786
+ return o = o.setSelection(r), o = po(o, e, t), o.docChanged ? (l == null || l(o), !0) : !1;
1787
+ };
1788
+ }
1789
+ const mo = Ee.create({
1790
+ name: "tableCellBackground",
1791
+ addOptions() {
1792
+ return {
1793
+ types: ["tableCell"],
1794
+ HTMLAttributes: {}
1795
+ };
1796
+ },
1797
+ addGlobalAttributes() {
1798
+ return [
1799
+ {
1800
+ types: this.options.types,
1801
+ attributes: {
1802
+ backgroundColor: {
1803
+ parseHTML: (t) => t.style.backgroundColor || "",
1804
+ renderHTML: (t) => !t.backgroundColor || t.backgroundColor === "" ? {} : {
1805
+ style: `background-color: ${t.backgroundColor}`
1806
+ }
1807
+ }
1808
+ }
1809
+ }
1810
+ ];
1811
+ },
1812
+ addCommands() {
1813
+ return {
1814
+ setTableCellBackground: (t) => ve(t, this.options),
1815
+ unsetTableCellBackground: () => ve("", this.options)
1816
+ };
1817
+ }
1818
+ }), go = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i, wo = /CrOS/, bo = /android|ipad|playbook|silk/i;
1819
+ function Me(t = {}) {
1820
+ let e = t.ua || typeof navigator < "u" && navigator.userAgent;
1821
+ return e && typeof e == "object" && e.headers && typeof e.headers["user-agent"] == "string" && (e = e.headers["user-agent"]), typeof e != "string" ? !1 : !!(go.test(e) && !wo.test(e) || t.tablet && bo.test(e) || t.tablet && t.featureDetect && navigator && navigator.maxTouchPoints > 1 && e.includes("Macintosh") && e.includes("Safari"));
1822
+ }
1823
+ const Ne = (t) => Array.from({ length: t }).map((e, o) => o + 1);
1824
+ function Co(t) {
1825
+ var f;
1826
+ const [e, o] = _(!1), [n, l] = _(!0), [r, s] = _({
1827
+ rows: Me() ? O : F,
1828
+ cols: Me() ? O : F
1829
+ }), [i, c] = _({
1830
+ rows: j,
1831
+ cols: j
1832
+ });
1833
+ function a(h, p) {
1834
+ h === r.rows && s((m) => ({
1835
+ ...m,
1836
+ rows: Math.min(h + 1, O)
1837
+ })), p === r.cols && s((m) => ({
1838
+ ...m,
1839
+ cols: Math.min(p + 1, O)
1840
+ })), c({
1841
+ rows: h,
1842
+ cols: p
1843
+ });
1844
+ }
1845
+ function d(h, p) {
1846
+ t == null || t.createTable({ rows: h, cols: p, withHeaderRow: n }), u(), o(!1);
1847
+ }
1848
+ function u() {
1849
+ l(!1), s({
1850
+ rows: F,
1851
+ cols: F
1852
+ }), c({
1853
+ rows: j,
1854
+ cols: j
1855
+ });
1856
+ }
1857
+ return /* @__PURE__ */ ee(nt, { modal: !0, onOpenChange: o, open: e, children: [
1858
+ /* @__PURE__ */ k(lt, { asChild: !0, "data-state": t != null && t.dataState ? "on" : "off", children: t == null ? void 0 : t.children }),
1859
+ /* @__PURE__ */ k(rt, { align: "start", className: "richtext-w-full !richtext-p-2", side: "bottom", children: /* @__PURE__ */ ee("div", { className: "table-grid-size-editor richtext-p-0", children: [
1860
+ /* @__PURE__ */ k("div", { className: "richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1", children: (f = Ne(r == null ? void 0 : r.rows)) == null ? void 0 : f.map((h) => {
1861
+ var p;
1862
+ return /* @__PURE__ */ k("div", { className: "richtext-flex richtext-gap-1", children: (p = Ne(r == null ? void 0 : r.cols)) == null ? void 0 : p.map((m) => /* @__PURE__ */ k(
1863
+ "div",
1864
+ {
1865
+ onMouseDown: () => d(h, m),
1866
+ onMouseOver: () => a(h, m),
1867
+ className: `richtext-cursor-pointer richtext-border-border ${m <= i.cols && h <= i.rows && "tableCellActive !richtext-bg-foreground"}`,
1868
+ children: /* @__PURE__ */ k("div", { className: "richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1" })
1869
+ },
1870
+ `richtext-table-col-${m}`
1871
+ )) }, `richtext-table-row-${h}`);
1872
+ }) }),
1873
+ /* @__PURE__ */ ee("div", { className: "richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-foreground", children: [
1874
+ i.rows,
1875
+ "x",
1876
+ i.cols
1877
+ ] })
1878
+ ] }) })
1879
+ ] });
1880
+ }
1881
+ function zo() {
1882
+ const t = Qe(), e = et(yo.name), {
1883
+ icon: o = void 0,
1884
+ tooltip: n = void 0,
1885
+ action: l = void 0,
1886
+ isActive: r = void 0,
1887
+ color: s
1888
+ } = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: i, disabled: c } = tt(r);
1889
+ if (!e)
1890
+ return /* @__PURE__ */ k(Ye, {});
1891
+ function a(d) {
1892
+ t.chain().focus().insertTable({ ...d, withHeaderRow: !1 }).run();
1893
+ }
1894
+ return /* @__PURE__ */ k(Co, { createTable: a, dataState: i, children: /* @__PURE__ */ k(
1895
+ ot,
1896
+ {
1897
+ action: l,
1898
+ color: s,
1899
+ dataState: i,
1900
+ icon: o,
1901
+ isActive: r,
1902
+ tooltip: n,
1903
+ disabled: c
1904
+ }
1905
+ ) });
1906
+ }
1907
+ const yo = /* @__PURE__ */ je.extend({
1908
+ //@ts-expect-error
1909
+ addOptions() {
1910
+ var t;
1911
+ return {
1912
+ ...(t = this.parent) == null ? void 0 : t.call(this),
1913
+ HTMLAttributes: {},
1914
+ resizable: !0,
1915
+ lastColumnResizable: !0,
1916
+ allowTableNodeSelection: !1,
1917
+ button: ({ editor: e, t: o }) => ({
1918
+ componentProps: {
1919
+ isActive: () => e.isActive("table"),
1920
+ icon: "Table",
1921
+ tooltip: o("editor.table.tooltip")
1922
+ }
1923
+ })
1924
+ };
1925
+ },
1926
+ addExtensions() {
1927
+ return [
1928
+ Fe.configure(this.options.tableRow),
1929
+ Oe.configure(this.options.tableHeader),
1930
+ _e.configure(this.options.tableCell),
1931
+ mo.configure(this.options.tableCellBackground)
1932
+ ];
1933
+ }
1934
+ });
1935
+ export {
1936
+ b as C,
1937
+ zo as R,
1938
+ yo as T
1939
+ };