reactjs-tiptap-editor 1.0.25 → 1.0.26

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 (289) hide show
  1. package/lib/{ActionMenuButton-8cTG45Ft.js → ActionMenuButton-B4KDkZ0z.js} +1 -1
  2. package/lib/{ActionMenuButton-CXeFhner.cjs → ActionMenuButton-C3Cfeza9.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +25 -25
  5. package/lib/Blockquote.cjs +5 -5
  6. package/lib/Blockquote.js +1490 -53
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +3 -3
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +222 -8
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +2 -2
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +56 -39
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +8 -4
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +2 -2
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +3 -3
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +2 -2
  25. package/lib/{Drawer-TJY4NuHx.cjs → Drawer-D7E9kTca.cjs} +1 -1
  26. package/lib/{Drawer-C-EO1uoK.js → Drawer-DA0FLHs9.js} +20 -20
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +4 -4
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +1644 -148
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +10 -10
  33. package/lib/ExportPdf.cjs +1 -1
  34. package/lib/ExportPdf.js +2 -2
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +2 -2
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +5 -5
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +5 -5
  41. package/lib/FormatPainter.cjs +1 -0
  42. package/lib/FormatPainter.js +133 -0
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +10 -6
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +3 -3
  47. package/lib/History.cjs +7 -1
  48. package/lib/History.js +519 -478
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +2 -2
  51. package/lib/{Iframe-CGb6-2LD.js → Iframe-DZ3r3QzK.js} +7 -7
  52. package/lib/{Iframe-5zx43DL4.cjs → Iframe-OMVd0xa_.cjs} +1 -1
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +3 -3
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +6 -6
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +35 -35
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +15 -15
  61. package/lib/{Indent-DuwV8s1t.cjs → Indent-QgCoonRk.cjs} +1 -1
  62. package/lib/{Indent-CdMYsDNS.js → Indent-kI4G-clX.js} +2 -2
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +2 -2
  67. package/lib/{Katex-CCP_ZQz2.js → Katex-BPbXjcZQ.js} +6 -7
  68. package/lib/Katex-CUofhjB5.cjs +4 -0
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +3 -3
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +4 -4
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/{LinkEditBlock-B1m-TVMu.js → LinkEditBlock-BYWwH2_x.js} +59 -32
  76. package/lib/{LinkEditBlock-DQ8-iufJ.cjs → LinkEditBlock-Z7RRurvx.cjs} +2 -2
  77. package/lib/MarkdownPaste.cjs +1 -1
  78. package/lib/MarkdownPaste.js +1 -1
  79. package/lib/Mention.cjs +1 -1
  80. package/lib/Mention.js +9 -5
  81. package/lib/Mermaid.cjs +2 -2
  82. package/lib/Mermaid.js +61 -62
  83. package/lib/MoreMark.cjs +1 -1
  84. package/lib/MoreMark.js +5 -5
  85. package/lib/OrderedList.cjs +1 -1
  86. package/lib/OrderedList.js +2 -2
  87. package/lib/SearchAndReplace.cjs +1 -1
  88. package/lib/SearchAndReplace.js +14 -14
  89. package/lib/SlashCommand.cjs +1 -1
  90. package/lib/SlashCommand.js +7 -7
  91. package/lib/{SlashCommandNodeView-Dt6n1SP9.js → SlashCommandNodeView-C0l3Fb_3.js} +10 -10
  92. package/lib/{SlashCommandNodeView-DNixmQGa.cjs → SlashCommandNodeView-DPPmYEjC.cjs} +1 -1
  93. package/lib/Strike.cjs +1 -1
  94. package/lib/Strike.js +2 -2
  95. package/lib/{Table-C5JxBXef.cjs → Table-D5G3rfwb.cjs} +5 -5
  96. package/lib/{Table-DdEgaUwa.js → Table-DwseaFSD.js} +115 -97
  97. package/lib/Table.cjs +1 -1
  98. package/lib/Table.js +1 -1
  99. package/lib/TaskList.cjs +1 -1
  100. package/lib/TaskList.js +2 -2
  101. package/lib/TextAlign.cjs +1 -1
  102. package/lib/TextAlign.js +11 -11
  103. package/lib/TextDirection.cjs +1 -1
  104. package/lib/TextDirection.js +3 -3
  105. package/lib/TextUnderline.cjs +1 -1
  106. package/lib/TextUnderline.js +2 -2
  107. package/lib/{Twitter-Dnz9qyW0.js → Twitter-DP26Lkn8.js} +195 -195
  108. package/lib/Twitter-q4ZGZL0i.cjs +1 -0
  109. package/lib/Twitter.cjs +1 -1
  110. package/lib/Twitter.js +3 -3
  111. package/lib/Video.cjs +1 -1
  112. package/lib/Video.js +5 -5
  113. package/lib/bubble.cjs +6 -6
  114. package/lib/bubble.js +2783 -2137
  115. package/lib/{clsx-D6gYQn3o.cjs → clsx-DRbkQ4T7.cjs} +1 -1
  116. package/lib/{clsx-0OU6n9va.js → clsx-_bq4MQQ7.js} +14 -4
  117. package/lib/components/Bubble/RichTextBubbleCallout.d.ts +1 -1
  118. package/lib/components/Bubble/RichTextBubbleCodeBlock.d.ts +1 -1
  119. package/lib/components/Bubble/RichTextBubbleColumns.d.ts +1 -1
  120. package/lib/components/Bubble/RichTextBubbleDrawer.d.ts +1 -1
  121. package/lib/components/Bubble/RichTextBubbleExcalidraw.d.ts +1 -1
  122. package/lib/components/Bubble/RichTextBubbleIframe.d.ts +1 -1
  123. package/lib/components/Bubble/RichTextBubbleKatex.d.ts +2 -1
  124. package/lib/components/Bubble/RichTextBubbleLink.d.ts +1 -1
  125. package/lib/components/Bubble/RichTextBubbleMedia.d.ts +3 -3
  126. package/lib/components/Bubble/RichTextBubbleMenuDragHandle.d.ts +2 -1
  127. package/lib/components/Bubble/RichTextBubbleMermaid.d.ts +1 -1
  128. package/lib/components/Bubble/RichTextBubbleTable.d.ts +1 -1
  129. package/lib/components/Bubble/RichTextBubbleText.d.ts +1 -1
  130. package/lib/components/Bubble/RichTextBubbleTwitter.d.ts +1 -1
  131. package/lib/components/ColorPicker.d.ts +1 -1
  132. package/lib/components/ReactBus.d.ts +1 -1
  133. package/lib/components/RichTextProvider.d.ts +1 -1
  134. package/lib/components/SlashDialogTrigger/RenderDialogUploadImage.d.ts +1 -1
  135. package/lib/components/SlashDialogTrigger/RenderDialogUploadVideo.d.ts +1 -1
  136. package/lib/components/SlashDialogTrigger/SlashDialogTrigger.d.ts +2 -1
  137. package/lib/components/icons/Activity.d.ts +2 -1
  138. package/lib/components/icons/Animas.d.ts +2 -1
  139. package/lib/components/icons/AspectRatio.d.ts +1 -1
  140. package/lib/components/icons/Blockquote.d.ts +1 -1
  141. package/lib/components/icons/CodeView.d.ts +1 -1
  142. package/lib/components/icons/ColumnAddLeft.d.ts +1 -1
  143. package/lib/components/icons/ColumnAddRight.d.ts +1 -1
  144. package/lib/components/icons/DeleteColumn.d.ts +1 -1
  145. package/lib/components/icons/DeleteRow.d.ts +1 -1
  146. package/lib/components/icons/Direction.d.ts +1 -1
  147. package/lib/components/icons/Excalidraw.d.ts +1 -1
  148. package/lib/components/icons/ExportPdf.d.ts +1 -1
  149. package/lib/components/icons/ExportWord.d.ts +2 -1
  150. package/lib/components/icons/FileWordOutline.d.ts +1 -1
  151. package/lib/components/icons/Flag.d.ts +2 -1
  152. package/lib/components/icons/Food.d.ts +2 -1
  153. package/lib/components/icons/GIfIcon.d.ts +1 -1
  154. package/lib/components/icons/Html.d.ts +1 -1
  155. package/lib/components/icons/Icon.d.ts +1 -1
  156. package/lib/components/icons/IconColorFill.d.ts +1 -1
  157. package/lib/components/icons/IconHighlightFill.d.ts +1 -1
  158. package/lib/components/icons/ImportWord.d.ts +2 -1
  159. package/lib/components/icons/LeftToRight.d.ts +1 -1
  160. package/lib/components/icons/LineHeight.d.ts +1 -1
  161. package/lib/components/icons/MenuDown.d.ts +1 -1
  162. package/lib/components/icons/Mermaid.d.ts +1 -1
  163. package/lib/components/icons/NoFill.d.ts +1 -1
  164. package/lib/components/icons/Object.d.ts +2 -1
  165. package/lib/components/icons/RightToLeft.d.ts +1 -1
  166. package/lib/components/icons/SizeL.d.ts +1 -1
  167. package/lib/components/icons/SizeM.d.ts +1 -1
  168. package/lib/components/icons/SizeS.d.ts +1 -1
  169. package/lib/components/icons/Symbol.d.ts +2 -1
  170. package/lib/components/icons/Travel.d.ts +2 -1
  171. package/lib/components/icons/Twitter.d.ts +1 -1
  172. package/lib/components/ui/dialog.d.ts +2 -2
  173. package/lib/components/ui/dropdown-menu.d.ts +1 -1
  174. package/lib/components/ui/emoji-picker.d.ts +4 -4
  175. package/lib/components/ui/toaster.d.ts +1 -1
  176. package/lib/{dropdown-menu-ROihzXsP.js → dropdown-menu-BKSX4gvT.js} +1 -1
  177. package/lib/{dropdown-menu-yQ-sQ1k4.cjs → dropdown-menu-CURWpB9o.cjs} +1 -1
  178. package/lib/extensions/Attachment/components/NodeViewAttachment/FileIcon.d.ts +1 -1
  179. package/lib/extensions/Attachment/components/NodeViewAttachment/NodeViewAttachment.d.ts +1 -1
  180. package/lib/extensions/Attachment/components/RichTextAttachment.d.ts +1 -1
  181. package/lib/extensions/Blockquote/components/RichTextBlockquote.d.ts +1 -1
  182. package/lib/extensions/Bold/components/RichTextBold.d.ts +1 -1
  183. package/lib/extensions/BulletList/components/RichTextBulletList.d.ts +1 -1
  184. package/lib/extensions/Callout/components/NodeViewCallout/NodeViewCallout.d.ts +1 -1
  185. package/lib/extensions/Callout/components/RichTextCallout.d.ts +1 -1
  186. package/lib/extensions/Clear/components/RichTextClear.d.ts +1 -1
  187. package/lib/extensions/Code/components/RichTextCode.d.ts +1 -1
  188. package/lib/extensions/CodeBlock/components/RichTextCodeBlock.d.ts +2 -1
  189. package/lib/extensions/CodeView/components/RichTextCodeView.d.ts +1 -1
  190. package/lib/extensions/Color/components/RichTextColor.d.ts +1 -1
  191. package/lib/extensions/Column/components/RichTextColumn.d.ts +1 -1
  192. package/lib/extensions/Drawer/components/ControlDrawer/ControlDrawer.d.ts +2 -1
  193. package/lib/extensions/Drawer/components/ControlDrawer/icon.d.ts +27 -27
  194. package/lib/extensions/Drawer/components/EditDrawerBlock.d.ts +1 -1
  195. package/lib/extensions/Drawer/components/NodeViewDrawer/NodeViewDrawer.d.ts +2 -1
  196. package/lib/extensions/Drawer/components/RichTextDrawer.d.ts +1 -1
  197. package/lib/extensions/Emoji/components/RichTextEmoji.d.ts +2 -1
  198. package/lib/extensions/Excalidraw/components/NodeViewExcalidraw/NodeViewExcalidraw.d.ts +2 -1
  199. package/lib/extensions/Excalidraw/components/RichTextExcalidraw.d.ts +1 -1
  200. package/lib/extensions/ExportPdf/components/RichTextExportPdf.d.ts +1 -1
  201. package/lib/extensions/ExportWord/components/RichTextExportWord.d.ts +1 -1
  202. package/lib/extensions/FontFamily/components/RichTextFontFamily.d.ts +1 -1
  203. package/lib/extensions/FontSize/components/RichTextFontSize.d.ts +1 -1
  204. package/lib/extensions/FormatPainter/FormatPainter.d.ts +17 -0
  205. package/lib/extensions/FormatPainter/components/RichTextFormatPainter.d.ts +1 -0
  206. package/lib/extensions/FormatPainter/index.d.ts +1 -0
  207. package/lib/extensions/Heading/components/RichTextHeading.d.ts +1 -1
  208. package/lib/extensions/Highlight/components/RichTextHighlight.d.ts +2 -1
  209. package/lib/extensions/History/components/RichTextHistory.d.ts +3 -2
  210. package/lib/extensions/HorizontalRule/components/RichTextHorizontalRule.d.ts +1 -1
  211. package/lib/extensions/Iframe/components/IframeNodeView.d.ts +1 -1
  212. package/lib/extensions/Iframe/components/RichTextIframe.d.ts +1 -1
  213. package/lib/extensions/Image/components/ImageCropper.d.ts +2 -1
  214. package/lib/extensions/Image/components/ImageView.d.ts +2 -1
  215. package/lib/extensions/Image/components/RichTextImage.d.ts +1 -1
  216. package/lib/extensions/ImageGif/components/ImageGifView.d.ts +2 -1
  217. package/lib/extensions/ImageGif/components/RichTextImageGif.d.ts +2 -1
  218. package/lib/extensions/ImportWord/components/RichTextImportWord.d.ts +1 -1
  219. package/lib/extensions/Indent/components/RichTextIndent.d.ts +1 -1
  220. package/lib/extensions/Italic/components/RichTextItalic.d.ts +1 -1
  221. package/lib/extensions/Katex/components/KatexWrapper.d.ts +1 -1
  222. package/lib/extensions/Katex/components/RichTextKatex.d.ts +1 -1
  223. package/lib/extensions/LineHeight/components/RichTextLightHeight.d.ts +1 -1
  224. package/lib/extensions/Link/components/LinkEditBlock.d.ts +1 -1
  225. package/lib/extensions/Link/components/LinkViewBlock.d.ts +2 -1
  226. package/lib/extensions/Link/components/RichTextLink.d.ts +1 -1
  227. package/lib/extensions/Mermaid/components/NodeViewMermaid/NodeViewMermaid.d.ts +2 -1
  228. package/lib/extensions/Mermaid/components/RichTextMermaid.d.ts +1 -1
  229. package/lib/extensions/MoreMark/components/RichTextMoreMark.d.ts +1 -1
  230. package/lib/extensions/OrderedList/components/RichTextOrderedList.d.ts +1 -1
  231. package/lib/extensions/SearchAndReplace/components/RichTextSearchAndReplace.d.ts +1 -1
  232. package/lib/extensions/SlashCommand/components/SlashCommandList.d.ts +1 -1
  233. package/lib/extensions/Strike/components/RichTextStrike.d.ts +1 -1
  234. package/lib/extensions/Table/components/CreateTablePopover.d.ts +2 -1
  235. package/lib/extensions/Table/components/RichTextTable.d.ts +2 -1
  236. package/lib/extensions/TaskList/components/RichTextTaskList.d.ts +1 -1
  237. package/lib/extensions/TextAlign/components/RichTextAlign.d.ts +1 -1
  238. package/lib/extensions/TextDirection/components/RichTextTextDirection.d.ts +1 -1
  239. package/lib/extensions/TextUnderline/components/RichTextUnderline.d.ts +1 -1
  240. package/lib/extensions/Twitter/components/FormEditLinkTwitter.d.ts +1 -1
  241. package/lib/extensions/Twitter/components/NodeViewTweet.d.ts +1 -1
  242. package/lib/extensions/Twitter/components/RichTextTwitter.d.ts +1 -1
  243. package/lib/extensions/Video/components/RichTextVideo.d.ts +1 -1
  244. package/lib/index-BGfIcDCQ.cjs +26 -0
  245. package/lib/index-BaR0Brts.js +1115 -0
  246. package/lib/index-BgNKVyMW.cjs +2 -0
  247. package/lib/index-BpLw6ebr.cjs +1 -0
  248. package/lib/{index-X6WZUM9O.js → index-C52cuQ_Y.js} +1503 -1352
  249. package/lib/index-CDw4Eszh.cjs +12 -0
  250. package/lib/{index-CUvjYuRp.cjs → index-CHVV5iY-.cjs} +1 -1
  251. package/lib/{index-zw-Kd38i.js → index-CJMI7Fjf.js} +1 -1
  252. package/lib/{index-D-Ouz0vF.js → index-DQy9iBzV.js} +1 -1
  253. package/lib/index-Dbm_Mans.js +1756 -0
  254. package/lib/{index-oj858lQO.js → index-DtyAGMbq.js} +208 -208
  255. package/lib/{index-BblvcbTH.js → index-Dx-Dh7KS.js} +1464 -1348
  256. package/lib/{index-BAb_UADw.cjs → index-SEMQrdk2.cjs} +1 -1
  257. package/lib/index-aujjnfSJ.cjs +1 -0
  258. package/lib/index.cjs +1 -1
  259. package/lib/index.js +12 -12
  260. package/lib/{jsx-runtime-CT7Pcg-t.js → jsx-runtime-DE8oVoME.js} +3 -1
  261. package/lib/locale-bundle.cjs +1 -1
  262. package/lib/locale-bundle.js +1 -1
  263. package/lib/locales/index.d.ts +1 -1
  264. package/lib/{popover-BfWFqCIs.js → popover-BB-ZDnqk.js} +1 -1
  265. package/lib/{popover-BPzkMuyi.cjs → popover-CrywEkBR.cjs} +1 -1
  266. package/lib/{renderNodeView-D--fDFov.cjs → renderNodeView-5h3-p80E.cjs} +1 -1
  267. package/lib/{renderNodeView-CfWJK4rG.js → renderNodeView-DoKZ4GYy.js} +2 -2
  268. package/lib/{separator-DpaS43Gt.cjs → separator-BGO9AZp4.cjs} +1 -1
  269. package/lib/{separator-CBPrZizK.js → separator-DuuOJRQd.js} +21 -21
  270. package/lib/store/EditorEditableReactive.d.ts +1 -1
  271. package/lib/store/ThemeColorReactive.d.ts +1 -1
  272. package/lib/style.css +1 -1
  273. package/lib/types.d.ts +2 -2
  274. package/lib/{updatePosition-DGPtRfWN.cjs → updatePosition-B1oRJE1x.cjs} +1 -1
  275. package/lib/{updatePosition-BwzAsiY0.js → updatePosition-CFTYKYNJ.js} +2 -2
  276. package/package.json +79 -66
  277. package/lib/Callout-DWOMZPiP.cjs +0 -1
  278. package/lib/Callout-ZlPQrMEt.js +0 -340
  279. package/lib/Katex-D9FP7EUE.cjs +0 -4
  280. package/lib/Twitter--tfifMt1.cjs +0 -1
  281. package/lib/index-BF3EVCB1.cjs +0 -2
  282. package/lib/index-Bcj8cyOO.cjs +0 -24
  283. package/lib/index-CGjT-a9h.js +0 -1377
  284. package/lib/index-CPTpXLfX.cjs +0 -11
  285. package/lib/index-CWw4s87s.cjs +0 -1
  286. package/lib/index-Cal5SPfB.js +0 -779
  287. package/lib/index-Gi752TMk.cjs +0 -1
  288. package/lib/textarea-Bl64keav.js +0 -20
  289. package/lib/textarea-wvARZKyA.cjs +0 -1
@@ -1,7 +1,7 @@
1
- import { NodeSelection as oe, TextSelection as J, Plugin as Q, PluginKey as Z, Selection as re, AllSelection as $n } from "@tiptap/pm/state";
2
- import { Fragment as ie, Slice as Pn, Node as Bn, Schema as Dn, DOMParser as De } from "@tiptap/pm/model";
1
+ import { NodeSelection as oe, TextSelection as J, Plugin as Q, PluginKey as G, Selection as re, AllSelection as Fn } from "@tiptap/pm/state";
2
+ import { Fragment as ie, Slice as Ln, Node as Wn, Schema as Jn, DOMParser as Fe } from "@tiptap/pm/model";
3
3
  import "@tiptap/pm/view";
4
- function Bt(r, e, t) {
4
+ function Dt(r, e, t) {
5
5
  for (let n = 0; ; n++) {
6
6
  if (n == r.childCount || n == e.childCount)
7
7
  return r.childCount == e.childCount ? null : t;
@@ -13,19 +13,20 @@ function Bt(r, e, t) {
13
13
  if (!i.sameMarkup(s))
14
14
  return t;
15
15
  if (i.isText && i.text != s.text) {
16
- for (let o = 0; i.text[o] == s.text[o]; o++)
16
+ let o = i.text, l = s.text, a = 0;
17
+ for (; o[a] == l[a]; a++)
17
18
  t++;
18
- return t;
19
+ return a && a < o.length && a < l.length && Wt(o.charCodeAt(a - 1)) && Lt(o.charCodeAt(a)) && t--, t;
19
20
  }
20
21
  if (i.content.size || s.content.size) {
21
- let o = Bt(i.content, s.content, t + 1);
22
+ let o = Dt(i.content, s.content, t + 1);
22
23
  if (o != null)
23
24
  return o;
24
25
  }
25
26
  t += i.nodeSize;
26
27
  }
27
28
  }
28
- function Dt(r, e, t, n) {
29
+ function Ft(r, e, t, n) {
29
30
  for (let i = r.childCount, s = e.childCount; ; ) {
30
31
  if (i == 0 || s == 0)
31
32
  return i == s ? null : { a: t, b: n };
@@ -37,19 +38,25 @@ function Dt(r, e, t, n) {
37
38
  if (!o.sameMarkup(l))
38
39
  return { a: t, b: n };
39
40
  if (o.isText && o.text != l.text) {
40
- let c = 0, f = Math.min(o.text.length, l.text.length);
41
- for (; c < f && o.text[o.text.length - c - 1] == l.text[l.text.length - c - 1]; )
42
- c++, t--, n--;
43
- return { a: t, b: n };
41
+ let c = o.text, f = l.text, u = c.length, d = f.length;
42
+ for (; u > 0 && d > 0 && c[u - 1] == f[d - 1]; )
43
+ u--, d--, t--, n--;
44
+ return u && d && u < c.length && Wt(c.charCodeAt(u - 1)) && Lt(c.charCodeAt(u)) && (t++, n++), { a: t, b: n };
44
45
  }
45
46
  if (o.content.size || l.content.size) {
46
- let c = Dt(o.content, l.content, t - 1, n - 1);
47
+ let c = Ft(o.content, l.content, t - 1, n - 1);
47
48
  if (c)
48
49
  return c;
49
50
  }
50
51
  t -= a, n -= a;
51
52
  }
52
53
  }
54
+ function Lt(r) {
55
+ return r >= 56320 && r < 57344;
56
+ }
57
+ function Wt(r) {
58
+ return r >= 55296 && r < 56320;
59
+ }
53
60
  class w {
54
61
  /**
55
62
  @internal
@@ -212,7 +219,7 @@ class w {
212
219
  fragment differ, or `null` if they are the same.
213
220
  */
214
221
  findDiffStart(e, t = 0) {
215
- return Bt(this, e, t);
222
+ return Dt(this, e, t);
216
223
  }
217
224
  /**
218
225
  Find the first position, searching from the end, at which this
@@ -221,7 +228,7 @@ class w {
221
228
  nodes, an object with two separate positions is returned.
222
229
  */
223
230
  findDiffEnd(e, t = this.size, n = e.size) {
224
- return Dt(this, e, t, n);
231
+ return Ft(this, e, t, n);
225
232
  }
226
233
  /**
227
234
  Find the index and inner offset corresponding to a given relative
@@ -268,7 +275,7 @@ class w {
268
275
  return w.empty;
269
276
  if (!Array.isArray(t))
270
277
  throw new RangeError("Invalid input for Fragment.fromJSON");
271
- return new w(t.map(e.nodeFromJSON));
278
+ return w.fromArray(t.map(e.nodeFromJSON));
272
279
  }
273
280
  /**
274
281
  Build a fragment from an array of nodes. Ensures that adjacent
@@ -303,9 +310,9 @@ class w {
303
310
  }
304
311
  }
305
312
  w.empty = new w([], 0);
306
- const Fe = { index: 0, offset: 0 };
313
+ const Le = { index: 0, offset: 0 };
307
314
  function xe(r, e) {
308
- return Fe.index = r, Fe.offset = e, Fe;
315
+ return Le.index = r, Le.offset = e, Le;
309
316
  }
310
317
  function Ke(r, e) {
311
318
  if (r === e)
@@ -437,7 +444,7 @@ let F = class Xe {
437
444
  }
438
445
  };
439
446
  F.none = [];
440
- class Fn extends Error {
447
+ class jn extends Error {
441
448
  }
442
449
  class k {
443
450
  /**
@@ -465,14 +472,14 @@ class k {
465
472
  @internal
466
473
  */
467
474
  insertAt(e, t) {
468
- let n = Lt(this.content, e + this.openStart, t);
475
+ let n = jt(this.content, e + this.openStart, t, this.openStart + 1, this.openEnd + 1);
469
476
  return n && new k(n, this.openStart, this.openEnd);
470
477
  }
471
478
  /**
472
479
  @internal
473
480
  */
474
481
  removeBetween(e, t) {
475
- return new k(Ft(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
482
+ return new k(Jt(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
476
483
  }
477
484
  /**
478
485
  Tests whether this slice is equal to another slice.
@@ -520,7 +527,7 @@ class k {
520
527
  }
521
528
  }
522
529
  k.empty = new k(w.empty, 0, 0);
523
- function Ft(r, e, t) {
530
+ function Jt(r, e, t) {
524
531
  let { index: n, offset: i } = r.findIndex(e), s = r.maybeChild(n), { index: o, offset: l } = r.findIndex(t);
525
532
  if (i == e || s.isText) {
526
533
  if (l != t && !r.child(o).isText)
@@ -529,14 +536,14 @@ function Ft(r, e, t) {
529
536
  }
530
537
  if (n != o)
531
538
  throw new RangeError("Removing non-flat range");
532
- return r.replaceChild(n, s.copy(Ft(s.content, e - i - 1, t - i - 1)));
539
+ return r.replaceChild(n, s.copy(Jt(s.content, e - i - 1, t - i - 1)));
533
540
  }
534
- function Lt(r, e, t, n) {
535
- let { index: i, offset: s } = r.findIndex(e), o = r.maybeChild(i);
536
- if (s == e || o.isText)
537
- return n && !n.canReplace(i, i, t) ? null : r.cut(0, e).append(t).append(r.cut(e));
538
- let l = Lt(o.content, e - s - 1, t, o);
539
- return l && r.replaceChild(i, o.copy(l));
541
+ function jt(r, e, t, n, i, s) {
542
+ let { index: o, offset: l } = r.findIndex(e), a = r.maybeChild(o);
543
+ if (l == e || a.isText)
544
+ return s && n <= 0 && i <= 0 && !s.canReplace(o, o, t) ? null : r.cut(0, e).append(t).append(r.cut(e));
545
+ let c = jt(a.content, e - l - 1, t, o == 0 ? n - 1 : 0, o == r.childCount - 1 ? i - 1 : 0, a);
546
+ return c && r.replaceChild(o, a.copy(c));
540
547
  }
541
548
  class Ye {
542
549
  /**
@@ -578,7 +585,7 @@ class Ye {
578
585
  return this.$to.indexAfter(this.depth);
579
586
  }
580
587
  }
581
- function Ln(r) {
588
+ function Hn(r) {
582
589
  let e = /* @__PURE__ */ Object.create(null);
583
590
  for (let t in r) {
584
591
  let n = r[t];
@@ -588,7 +595,7 @@ function Ln(r) {
588
595
  }
589
596
  return e;
590
597
  }
591
- function Wn(r, e) {
598
+ function _n(r, e) {
592
599
  let t = /* @__PURE__ */ Object.create(null);
593
600
  for (let n in r) {
594
601
  let i = e && e[n];
@@ -603,23 +610,21 @@ function Wn(r, e) {
603
610
  }
604
611
  return t;
605
612
  }
606
- function Jn(r, e, t, n) {
613
+ function Vn(r, e, t, n) {
607
614
  for (let i in e)
608
615
  if (!(i in r))
609
- throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);
610
- for (let i in r) {
611
- let s = r[i];
612
- s.validate && s.validate(e[i]);
613
- }
616
+ throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${n}`);
617
+ for (let i in r)
618
+ r[i].validate && r[i].validate(e[i]);
614
619
  }
615
- function jn(r, e) {
620
+ function qn(r, e) {
616
621
  let t = /* @__PURE__ */ Object.create(null);
617
622
  if (e)
618
623
  for (let n in e)
619
- t[n] = new _n(r, n, e[n]);
624
+ t[n] = new Kn(r, n, e[n]);
620
625
  return t;
621
626
  }
622
- function Hn(r, e, t) {
627
+ function Un(r, e, t) {
623
628
  let n = t.split("|");
624
629
  return (i) => {
625
630
  let s = i === null ? "null" : typeof i;
@@ -627,9 +632,9 @@ function Hn(r, e, t) {
627
632
  throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`);
628
633
  };
629
634
  }
630
- class _n {
635
+ class Kn {
631
636
  constructor(e, t, n) {
632
- this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Hn(e, t, n.validate) : n.validate;
637
+ this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Un(e, t, n.validate) : n.validate;
633
638
  }
634
639
  get isRequired() {
635
640
  return !this.hasDefault;
@@ -640,8 +645,8 @@ class rt {
640
645
  @internal
641
646
  */
642
647
  constructor(e, t, n, i) {
643
- this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = jn(e, i.attrs), this.excluded = null;
644
- let s = Ln(this.attrs);
648
+ this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = qn(e, i.attrs), this.excluded = null;
649
+ let s = Hn(this.attrs);
645
650
  this.instance = s ? new F(this, s) : null;
646
651
  }
647
652
  /**
@@ -650,7 +655,7 @@ class rt {
650
655
  they have defaults, will be added.
651
656
  */
652
657
  create(e = null) {
653
- return !e && this.instance ? this.instance : new F(this, Wn(this.attrs, e));
658
+ return !e && this.instance ? this.instance : new F(this, _n(this.attrs, e));
654
659
  }
655
660
  /**
656
661
  @internal
@@ -680,7 +685,7 @@ class rt {
680
685
  @internal
681
686
  */
682
687
  checkAttrs(e) {
683
- Jn(this.attrs, e, "mark", this.name);
688
+ Vn(this.attrs, e, "mark", this.name);
684
689
  }
685
690
  /**
686
691
  Queries whether a given mark type is
@@ -690,10 +695,10 @@ class rt {
690
695
  return this.excluded.indexOf(e) > -1;
691
696
  }
692
697
  }
693
- function Vn(r) {
698
+ function Xn(r) {
694
699
  return r.tag != null;
695
700
  }
696
- function qn(r) {
701
+ function Yn(r) {
697
702
  return r.style != null;
698
703
  }
699
704
  class Qe {
@@ -705,9 +710,9 @@ class Qe {
705
710
  this.schema = e, this.rules = t, this.tags = [], this.styles = [];
706
711
  let n = this.matchedStyles = [];
707
712
  t.forEach((i) => {
708
- if (Vn(i))
713
+ if (Xn(i))
709
714
  this.tags.push(i);
710
- else if (qn(i)) {
715
+ else if (Yn(i)) {
711
716
  let s = /[^=]*/.exec(i.style)[0];
712
717
  n.indexOf(s) < 0 && n.push(s), this.styles.push(i);
713
718
  }
@@ -743,7 +748,7 @@ class Qe {
743
748
  matchTag(e, t, n) {
744
749
  for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
745
750
  let s = this.tags[i];
746
- if (Xn(e, s.tag) && (s.namespace === void 0 || e.namespaceURI == s.namespace) && (!s.context || t.matchesContext(s.context))) {
751
+ if (Zn(e, s.tag) && (s.namespace === void 0 || e.namespaceURI == s.namespace) && (!s.context || t.matchesContext(s.context))) {
747
752
  if (s.getAttrs) {
748
753
  let o = s.getAttrs(e);
749
754
  if (o === !1)
@@ -811,7 +816,7 @@ class Qe {
811
816
  return e.cached.domParser || (e.cached.domParser = new Qe(e, Qe.schemaRules(e)));
812
817
  }
813
818
  }
814
- const Wt = {
819
+ const Ht = {
815
820
  address: !0,
816
821
  article: !0,
817
822
  aside: !0,
@@ -844,16 +849,16 @@ const Wt = {
844
849
  table: !0,
845
850
  tfoot: !0,
846
851
  ul: !0
847
- }, Un = {
852
+ }, Qn = {
848
853
  head: !0,
849
854
  noscript: !0,
850
855
  object: !0,
851
856
  script: !0,
852
857
  style: !0,
853
858
  title: !0
854
- }, Jt = { ol: !0, ul: !0 }, pe = 1, Ze = 2, he = 4;
859
+ }, _t = { ol: !0, ul: !0 }, pe = 1, Ge = 2, he = 4;
855
860
  function wt(r, e, t) {
856
- return e != null ? (e ? pe : 0) | (e === "full" ? Ze : 0) : r && r.whitespace == "pre" ? pe | Ze : t & ~he;
861
+ return e != null ? (e ? pe : 0) | (e === "full" ? Ge : 0) : r && r.whitespace == "pre" ? pe | Ge : t & ~he;
857
862
  }
858
863
  class ve {
859
864
  constructor(e, t, n, i, s, o) {
@@ -885,7 +890,7 @@ class ve {
885
890
  return !e && this.match && (t = t.append(this.match.fillBefore(w.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
886
891
  }
887
892
  inlineContext(e) {
888
- return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Wt.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
893
+ return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Ht.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
889
894
  }
890
895
  }
891
896
  class kt {
@@ -904,7 +909,7 @@ class kt {
904
909
  e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
905
910
  }
906
911
  addTextNode(e, t) {
907
- let n = e.nodeValue, i = this.top, s = i.options & Ze ? "full" : this.localPreserveWS || (i.options & pe) > 0, { schema: o } = this.parser;
912
+ let n = e.nodeValue, i = this.top, s = i.options & Ge ? "full" : this.localPreserveWS || (i.options & pe) > 0, { schema: o } = this.parser;
908
913
  if (s === "full" || i.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
909
914
  if (s)
910
915
  if (s === "full")
@@ -931,14 +936,14 @@ class kt {
931
936
  let i = this.localPreserveWS, s = this.top;
932
937
  (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
933
938
  let o = e.nodeName.toLowerCase(), l;
934
- Jt.hasOwnProperty(o) && this.parser.normalizeLists && Kn(e);
939
+ _t.hasOwnProperty(o) && this.parser.normalizeLists && Gn(e);
935
940
  let a = this.options.ruleFromNode && this.options.ruleFromNode(e) || (l = this.parser.matchTag(e, this, n));
936
- e: if (a ? a.ignore : Un.hasOwnProperty(o))
941
+ e: if (a ? a.ignore : Qn.hasOwnProperty(o))
937
942
  this.findInside(e), this.ignoreFallback(e, t);
938
943
  else if (!a || a.skip || a.closeParent) {
939
944
  a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (e = a.skip);
940
945
  let c, f = this.needsBlock;
941
- if (Wt.hasOwnProperty(o))
946
+ if (Ht.hasOwnProperty(o))
942
947
  s.content.length && s.content[0].isInline && this.open && (this.open--, s = this.top), c = !0, s.type || (this.needsBlock = !0);
943
948
  else if (!e.firstChild) {
944
949
  this.leafFallback(e, t);
@@ -1170,13 +1175,13 @@ class kt {
1170
1175
  }
1171
1176
  }
1172
1177
  }
1173
- function Kn(r) {
1178
+ function Gn(r) {
1174
1179
  for (let e = r.firstChild, t = null; e; e = e.nextSibling) {
1175
1180
  let n = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
1176
- n && Jt.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
1181
+ n && _t.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
1177
1182
  }
1178
1183
  }
1179
- function Xn(r, e) {
1184
+ function Zn(r, e) {
1180
1185
  return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, e);
1181
1186
  }
1182
1187
  function xt(r) {
@@ -1203,7 +1208,7 @@ function vt(r, e) {
1203
1208
  return !0;
1204
1209
  }
1205
1210
  }
1206
- class jt {
1211
+ class Vt {
1207
1212
  /**
1208
1213
  Create a serializer. `nodes` should map node names to functions
1209
1214
  that take a node and return a description of the corresponding
@@ -1223,7 +1228,7 @@ class jt {
1223
1228
  nodes.
1224
1229
  */
1225
1230
  serializeFragment(e, t = {}, n) {
1226
- n || (n = Le(t).createDocumentFragment());
1231
+ n || (n = be(t).createDocumentFragment());
1227
1232
  let i = n, s = [];
1228
1233
  return e.forEach((o) => {
1229
1234
  if (s.length || o.marks.length) {
@@ -1252,7 +1257,9 @@ class jt {
1252
1257
  @internal
1253
1258
  */
1254
1259
  serializeNodeInner(e, t) {
1255
- let { dom: n, contentDOM: i } = Ee(Le(t), this.nodes[e.type.name](e), null, e.attrs);
1260
+ if (e.isText)
1261
+ return be(t).createTextNode(e.text);
1262
+ let { dom: n, contentDOM: i } = Ce(be(t), this.nodes[e.type.name](e), null, e.attrs);
1256
1263
  if (i) {
1257
1264
  if (e.isLeaf)
1258
1265
  throw new RangeError("Content hole not allowed in a leaf node spec");
@@ -1280,17 +1287,17 @@ class jt {
1280
1287
  */
1281
1288
  serializeMark(e, t, n = {}) {
1282
1289
  let i = this.marks[e.type.name];
1283
- return i && Ee(Le(n), i(e, t), null, e.attrs);
1290
+ return i && Ce(be(n), i(e, t), null, e.attrs);
1284
1291
  }
1285
1292
  static renderSpec(e, t, n = null, i) {
1286
- return Ee(e, t, n, i);
1293
+ return typeof t == "string" ? { dom: e.createTextNode(t) } : Ce(e, t, n, i);
1287
1294
  }
1288
1295
  /**
1289
1296
  Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
1290
1297
  properties in a schema's node and mark specs.
1291
1298
  */
1292
1299
  static fromSchema(e) {
1293
- return e.cached.domSerializer || (e.cached.domSerializer = new jt(this.nodesFromSchema(e), this.marksFromSchema(e)));
1300
+ return e.cached.domSerializer || (e.cached.domSerializer = new Vt(this.nodesFromSchema(e), this.marksFromSchema(e)));
1294
1301
  }
1295
1302
  /**
1296
1303
  Gather the serializers in a schema's node specs into an object.
@@ -1315,15 +1322,15 @@ function bt(r) {
1315
1322
  }
1316
1323
  return e;
1317
1324
  }
1318
- function Le(r) {
1325
+ function be(r) {
1319
1326
  return r.document || window.document;
1320
1327
  }
1321
1328
  const St = /* @__PURE__ */ new WeakMap();
1322
- function Yn(r) {
1329
+ function er(r) {
1323
1330
  let e = St.get(r);
1324
- return e === void 0 && St.set(r, e = Qn(r)), e;
1331
+ return e === void 0 && St.set(r, e = tr(r)), e;
1325
1332
  }
1326
- function Qn(r) {
1333
+ function tr(r) {
1327
1334
  let e = null;
1328
1335
  function t(n) {
1329
1336
  if (n && typeof n == "object")
@@ -1339,17 +1346,15 @@ function Qn(r) {
1339
1346
  }
1340
1347
  return t(r), e;
1341
1348
  }
1342
- function Ee(r, e, t, n) {
1343
- if (typeof e == "string")
1344
- return { dom: r.createTextNode(e) };
1345
- if (e.nodeType != null)
1349
+ function Ce(r, e, t, n) {
1350
+ if (e.nodeType == 1)
1346
1351
  return { dom: e };
1347
- if (e.dom && e.dom.nodeType != null)
1352
+ if (e.dom && e.dom.nodeType == 1)
1348
1353
  return e;
1349
1354
  let i = e[0], s;
1350
1355
  if (typeof i != "string")
1351
1356
  throw new RangeError("Invalid array passed to renderSpec");
1352
- if (n && (s = Yn(n)) && s.indexOf(e) > -1)
1357
+ if (n && (s = er(n)) && s.indexOf(e) > -1)
1353
1358
  throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
1354
1359
  let o = i.indexOf(" ");
1355
1360
  o > 0 && (t = i.slice(0, o), i = i.slice(o + 1));
@@ -1368,8 +1373,10 @@ function Ee(r, e, t, n) {
1368
1373
  if (u < e.length - 1 || u > f)
1369
1374
  throw new RangeError("Content hole must be the only child of its parent node");
1370
1375
  return { dom: a, contentDOM: a };
1371
- } else {
1372
- let { dom: h, contentDOM: p } = Ee(r, d, t, n);
1376
+ } else if (typeof d == "string")
1377
+ a.appendChild(r.createTextNode(d));
1378
+ else {
1379
+ let { dom: h, contentDOM: p } = Ce(r, d, t, n);
1373
1380
  if (a.appendChild(h), p) {
1374
1381
  if (l)
1375
1382
  throw new RangeError("Multiple content holes");
@@ -1379,18 +1386,18 @@ function Ee(r, e, t, n) {
1379
1386
  }
1380
1387
  return { dom: a, contentDOM: l };
1381
1388
  }
1382
- const Ht = 65535, _t = Math.pow(2, 16);
1383
- function Zn(r, e) {
1384
- return r + e * _t;
1389
+ const qt = 65535, Ut = Math.pow(2, 16);
1390
+ function nr(r, e) {
1391
+ return r + e * Ut;
1385
1392
  }
1386
1393
  function Mt(r) {
1387
- return r & Ht;
1394
+ return r & qt;
1388
1395
  }
1389
- function Gn(r) {
1390
- return (r - (r & Ht)) / _t;
1396
+ function rr(r) {
1397
+ return (r - (r & qt)) / Ut;
1391
1398
  }
1392
- const Vt = 1, qt = 2, Ce = 4, Ut = 8;
1393
- class Ge {
1399
+ const Kt = 1, Xt = 2, Te = 4, Yt = 8;
1400
+ class Ze {
1394
1401
  /**
1395
1402
  @internal
1396
1403
  */
@@ -1403,19 +1410,19 @@ class Ge {
1403
1410
  argument from the document.
1404
1411
  */
1405
1412
  get deleted() {
1406
- return (this.delInfo & Ut) > 0;
1413
+ return (this.delInfo & Yt) > 0;
1407
1414
  }
1408
1415
  /**
1409
1416
  Tells you whether the token before the mapped position was deleted.
1410
1417
  */
1411
1418
  get deletedBefore() {
1412
- return (this.delInfo & (Vt | Ce)) > 0;
1419
+ return (this.delInfo & (Kt | Te)) > 0;
1413
1420
  }
1414
1421
  /**
1415
1422
  True when the token after the mapped position was deleted.
1416
1423
  */
1417
1424
  get deletedAfter() {
1418
- return (this.delInfo & (qt | Ce)) > 0;
1425
+ return (this.delInfo & (Xt | Te)) > 0;
1419
1426
  }
1420
1427
  /**
1421
1428
  Tells whether any of the steps mapped through deletes across the
@@ -1423,7 +1430,7 @@ class Ge {
1423
1430
  position).
1424
1431
  */
1425
1432
  get deletedAcross() {
1426
- return (this.delInfo & Ce) > 0;
1433
+ return (this.delInfo & Te) > 0;
1427
1434
  }
1428
1435
  }
1429
1436
  class D {
@@ -1444,7 +1451,7 @@ class D {
1444
1451
  if (!this.inverted)
1445
1452
  for (let i = 0; i < n; i++)
1446
1453
  t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
1447
- return this.ranges[n * 3] + t + Gn(e);
1454
+ return this.ranges[n * 3] + t + rr(e);
1448
1455
  }
1449
1456
  mapResult(e, t = 1) {
1450
1457
  return this._map(e, t, !1);
@@ -1466,12 +1473,12 @@ class D {
1466
1473
  let d = c ? e == a ? -1 : e == u ? 1 : t : t, h = a + i + (d < 0 ? 0 : f);
1467
1474
  if (n)
1468
1475
  return h;
1469
- let p = e == (t < 0 ? a : u) ? null : Zn(l / 3, e - a), m = e == a ? qt : e == u ? Vt : Ce;
1470
- return (t < 0 ? e != a : e != u) && (m |= Ut), new Ge(h, m, p);
1476
+ let p = e == (t < 0 ? a : u) ? null : nr(l / 3, e - a), m = e == a ? Xt : e == u ? Kt : Te;
1477
+ return (t < 0 ? e != a : e != u) && (m |= Yt), new Ze(h, m, p);
1471
1478
  }
1472
1479
  i += f - c;
1473
1480
  }
1474
- return n ? e + i : new Ge(e + i, 0, null);
1481
+ return n ? e + i : new Ze(e + i, 0, null);
1475
1482
  }
1476
1483
  /**
1477
1484
  @internal
@@ -1523,7 +1530,7 @@ class D {
1523
1530
  }
1524
1531
  }
1525
1532
  D.empty = new D([]);
1526
- class Ae {
1533
+ class Ie {
1527
1534
  /**
1528
1535
  Create a new mapping with the given position maps.
1529
1536
  */
@@ -1540,7 +1547,7 @@ class Ae {
1540
1547
  Create a mapping that maps only through a part of this one.
1541
1548
  */
1542
1549
  slice(e = 0, t = this.maps.length) {
1543
- return new Ae(this._maps, this.mirror, e, t);
1550
+ return new Ie(this._maps, this.mirror, e, t);
1544
1551
  }
1545
1552
  /**
1546
1553
  Add a step map to the end of this mapping. If `mirrors` is
@@ -1591,7 +1598,7 @@ class Ae {
1591
1598
  Create an inverted version of this mapping.
1592
1599
  */
1593
1600
  invert() {
1594
- let e = new Ae();
1601
+ let e = new Ie();
1595
1602
  return e.appendMappingInverted(this), e;
1596
1603
  }
1597
1604
  /**
@@ -1627,7 +1634,7 @@ class Ae {
1627
1634
  }
1628
1635
  i |= l.delInfo, e = l.pos;
1629
1636
  }
1630
- return n ? e : new Ge(e, i, null);
1637
+ return n ? e : new Ze(e, i, null);
1631
1638
  }
1632
1639
  }
1633
1640
  const We = /* @__PURE__ */ Object.create(null);
@@ -1672,7 +1679,7 @@ class z {
1672
1679
  return We[e] = t, t.prototype.jsonID = e, t;
1673
1680
  }
1674
1681
  }
1675
- class C {
1682
+ class T {
1676
1683
  /**
1677
1684
  @internal
1678
1685
  */
@@ -1683,13 +1690,13 @@ class C {
1683
1690
  Create a successful step result.
1684
1691
  */
1685
1692
  static ok(e) {
1686
- return new C(e, null);
1693
+ return new T(e, null);
1687
1694
  }
1688
1695
  /**
1689
1696
  Create a failed step result.
1690
1697
  */
1691
1698
  static fail(e) {
1692
- return new C(null, e);
1699
+ return new T(null, e);
1693
1700
  }
1694
1701
  /**
1695
1702
  Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
@@ -1698,10 +1705,10 @@ class C {
1698
1705
  */
1699
1706
  static fromReplace(e, t, n, i) {
1700
1707
  try {
1701
- return C.ok(e.replace(t, n, i));
1708
+ return T.ok(e.replace(t, n, i));
1702
1709
  } catch (s) {
1703
- if (s instanceof Fn)
1704
- return C.fail(s.message);
1710
+ if (s instanceof jn)
1711
+ return T.fail(s.message);
1705
1712
  throw s;
1706
1713
  }
1707
1714
  }
@@ -1723,7 +1730,7 @@ class X extends z {
1723
1730
  }
1724
1731
  apply(e) {
1725
1732
  let t = e.slice(this.from, this.to), n = e.resolve(this.from), i = n.node(n.sharedDepth(this.to)), s = new k(it(t.content, (o, l) => !o.isAtom || !l.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), i), t.openStart, t.openEnd);
1726
- return C.fromReplace(e, this.from, this.to, s);
1733
+ return T.fromReplace(e, this.from, this.to, s);
1727
1734
  }
1728
1735
  invert() {
1729
1736
  return new W(this.from, this.to, this.mark);
@@ -1762,7 +1769,7 @@ class W extends z {
1762
1769
  }
1763
1770
  apply(e) {
1764
1771
  let t = e.slice(this.from, this.to), n = new k(it(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
1765
- return C.fromReplace(e, this.from, this.to, n);
1772
+ return T.fromReplace(e, this.from, this.to, n);
1766
1773
  }
1767
1774
  invert() {
1768
1775
  return new X(this.from, this.to, this.mark);
@@ -1802,9 +1809,9 @@ class Y extends z {
1802
1809
  apply(e) {
1803
1810
  let t = e.nodeAt(this.pos);
1804
1811
  if (!t)
1805
- return C.fail("No node at mark step's position");
1812
+ return T.fail("No node at mark step's position");
1806
1813
  let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
1807
- return C.fromReplace(e, this.pos, this.pos + 1, new k(w.from(n), 0, t.isLeaf ? 0 : 1));
1814
+ return T.fromReplace(e, this.pos, this.pos + 1, new k(w.from(n), 0, t.isLeaf ? 0 : 1));
1808
1815
  }
1809
1816
  invert(e) {
1810
1817
  let t = e.nodeAt(this.pos);
@@ -1846,9 +1853,9 @@ class te extends z {
1846
1853
  apply(e) {
1847
1854
  let t = e.nodeAt(this.pos);
1848
1855
  if (!t)
1849
- return C.fail("No node at mark step's position");
1856
+ return T.fail("No node at mark step's position");
1850
1857
  let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
1851
- return C.fromReplace(e, this.pos, this.pos + 1, new k(w.from(n), 0, t.isLeaf ? 0 : 1));
1858
+ return T.fromReplace(e, this.pos, this.pos + 1, new k(w.from(n), 0, t.isLeaf ? 0 : 1));
1852
1859
  }
1853
1860
  invert(e) {
1854
1861
  let t = e.nodeAt(this.pos);
@@ -1871,7 +1878,7 @@ class te extends z {
1871
1878
  }
1872
1879
  }
1873
1880
  z.jsonID("removeNodeMark", te);
1874
- class T extends z {
1881
+ class C extends z {
1875
1882
  /**
1876
1883
  The given `slice` should fit the 'gap' between `from` and
1877
1884
  `to`—the depths must line up, and the surrounding nodes must be
@@ -1885,27 +1892,27 @@ class T extends z {
1885
1892
  super(), this.from = e, this.to = t, this.slice = n, this.structure = i;
1886
1893
  }
1887
1894
  apply(e) {
1888
- return this.structure && et(e, this.from, this.to) ? C.fail("Structure replace would overwrite content") : C.fromReplace(e, this.from, this.to, this.slice);
1895
+ return this.structure && et(e, this.from, this.to) ? T.fail("Structure replace would overwrite content") : T.fromReplace(e, this.from, this.to, this.slice);
1889
1896
  }
1890
1897
  getMap() {
1891
1898
  return new D([this.from, this.to - this.from, this.slice.size]);
1892
1899
  }
1893
1900
  invert(e) {
1894
- return new T(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
1901
+ return new C(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
1895
1902
  }
1896
1903
  map(e) {
1897
- let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
1898
- return t.deletedAcross && n.deletedAcross ? null : new T(t.pos, Math.max(t.pos, n.pos), this.slice, this.structure);
1904
+ let t = e.mapResult(this.to, -1), n = this.from == this.to && C.MAP_BIAS < 0 ? t : e.mapResult(this.from, 1);
1905
+ return n.deletedAcross && t.deletedAcross ? null : new C(n.pos, Math.max(n.pos, t.pos), this.slice, this.structure);
1899
1906
  }
1900
1907
  merge(e) {
1901
- if (!(e instanceof T) || e.structure || this.structure)
1908
+ if (!(e instanceof C) || e.structure || this.structure)
1902
1909
  return null;
1903
1910
  if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
1904
1911
  let t = this.slice.size + e.slice.size == 0 ? k.empty : new k(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
1905
- return new T(this.from, this.to + (e.to - e.from), t, this.structure);
1912
+ return new C(this.from, this.to + (e.to - e.from), t, this.structure);
1906
1913
  } else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
1907
1914
  let t = this.slice.size + e.slice.size == 0 ? k.empty : new k(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
1908
- return new T(e.from, this.to, t, this.structure);
1915
+ return new C(e.from, this.to, t, this.structure);
1909
1916
  } else
1910
1917
  return null;
1911
1918
  }
@@ -1919,10 +1926,11 @@ class T extends z {
1919
1926
  static fromJSON(e, t) {
1920
1927
  if (typeof t.from != "number" || typeof t.to != "number")
1921
1928
  throw new RangeError("Invalid input for ReplaceStep.fromJSON");
1922
- return new T(t.from, t.to, k.fromJSON(e, t.slice), !!t.structure);
1929
+ return new C(t.from, t.to, k.fromJSON(e, t.slice), !!t.structure);
1923
1930
  }
1924
1931
  }
1925
- z.jsonID("replace", T);
1932
+ C.MAP_BIAS = 1;
1933
+ z.jsonID("replace", C);
1926
1934
  class A extends z {
1927
1935
  /**
1928
1936
  Create a replace-around step with the given range and gap.
@@ -1935,12 +1943,12 @@ class A extends z {
1935
1943
  }
1936
1944
  apply(e) {
1937
1945
  if (this.structure && (et(e, this.from, this.gapFrom) || et(e, this.gapTo, this.to)))
1938
- return C.fail("Structure gap-replace would overwrite content");
1946
+ return T.fail("Structure gap-replace would overwrite content");
1939
1947
  let t = e.slice(this.gapFrom, this.gapTo);
1940
1948
  if (t.openStart || t.openEnd)
1941
- return C.fail("Gap is not a flat range");
1949
+ return T.fail("Gap is not a flat range");
1942
1950
  let n = this.slice.insertAt(this.insert, t.content);
1943
- return n ? C.fromReplace(e, this.from, this.to, n) : C.fail("Content does not fit in gap");
1951
+ return n ? T.fromReplace(e, this.from, this.to, n) : T.fail("Content does not fit in gap");
1944
1952
  }
1945
1953
  getMap() {
1946
1954
  return new D([
@@ -1995,7 +2003,7 @@ function et(r, e, t) {
1995
2003
  }
1996
2004
  return !1;
1997
2005
  }
1998
- function er(r, e, t, n) {
2006
+ function ir(r, e, t, n) {
1999
2007
  let i = [], s = [], o, l;
2000
2008
  r.doc.nodesBetween(e, t, (a, c, f) => {
2001
2009
  if (!a.isInline)
@@ -2009,7 +2017,7 @@ function er(r, e, t, n) {
2009
2017
  }
2010
2018
  }), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
2011
2019
  }
2012
- function tr(r, e, t, n) {
2020
+ function sr(r, e, t, n) {
2013
2021
  let i = [], s = 0;
2014
2022
  r.doc.nodesBetween(e, t, (o, l) => {
2015
2023
  if (!o.isInline)
@@ -2039,7 +2047,7 @@ function st(r, e, t, n = t.contentMatch, i = !0) {
2039
2047
  for (let a = 0; a < s.childCount; a++) {
2040
2048
  let c = s.child(a), f = l + c.nodeSize, u = n.matchType(c.type);
2041
2049
  if (!u)
2042
- o.push(new T(l, f, k.empty));
2050
+ o.push(new C(l, f, k.empty));
2043
2051
  else {
2044
2052
  n = u;
2045
2053
  for (let d = 0; d < c.marks.length; d++)
@@ -2047,7 +2055,7 @@ function st(r, e, t, n = t.contentMatch, i = !0) {
2047
2055
  if (i && c.isText && t.whitespace != "pre") {
2048
2056
  let d, h = /\r?\n|\r/g, p;
2049
2057
  for (; d = h.exec(c.text); )
2050
- p || (p = new k(w.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), o.push(new T(l + d.index, l + d.index + d[0].length, p));
2058
+ p || (p = new k(w.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), o.push(new C(l + d.index, l + d.index + d[0].length, p));
2051
2059
  }
2052
2060
  }
2053
2061
  l = f;
@@ -2059,7 +2067,7 @@ function st(r, e, t, n = t.contentMatch, i = !0) {
2059
2067
  for (let a = o.length - 1; a >= 0; a--)
2060
2068
  r.step(o[a]);
2061
2069
  }
2062
- function nr(r, e, t) {
2070
+ function or(r, e, t) {
2063
2071
  return (e == 0 || r.canReplace(e, r.childCount)) && (t == r.childCount || r.canReplace(0, t));
2064
2072
  }
2065
2073
  function ce(r) {
@@ -2068,13 +2076,13 @@ function ce(r) {
2068
2076
  let o = r.$from.node(n), l = r.$from.index(n) + i, a = r.$to.indexAfter(n) - s;
2069
2077
  if (n < r.depth && o.canReplace(l, a, t))
2070
2078
  return n;
2071
- if (n == 0 || o.type.spec.isolating || !nr(o, l, a))
2079
+ if (n == 0 || o.type.spec.isolating || !or(o, l, a))
2072
2080
  break;
2073
2081
  l && (i = 1), a < o.childCount && (s = 1);
2074
2082
  }
2075
2083
  return null;
2076
2084
  }
2077
- function rr(r, e, t) {
2085
+ function lr(r, e, t) {
2078
2086
  let { $from: n, $to: i, depth: s } = e, o = n.before(s + 1), l = i.after(s + 1), a = o, c = l, f = w.empty, u = 0;
2079
2087
  for (let p = s, m = !1; p > t; p--)
2080
2088
  m || n.index(p) > 0 ? (m = !0, f = w.from(n.node(p).copy(f)), u++) : a--;
@@ -2084,20 +2092,20 @@ function rr(r, e, t) {
2084
2092
  r.step(new A(a, c, o, l, new k(f.append(d), u, h), f.size - u, !0));
2085
2093
  }
2086
2094
  function ot(r, e, t = null, n = r) {
2087
- let i = ir(r, e), s = i && sr(n, e);
2095
+ let i = ar(r, e), s = i && cr(n, e);
2088
2096
  return s ? i.map(Et).concat({ type: e, attrs: t }).concat(s.map(Et)) : null;
2089
2097
  }
2090
2098
  function Et(r) {
2091
2099
  return { type: r, attrs: null };
2092
2100
  }
2093
- function ir(r, e) {
2101
+ function ar(r, e) {
2094
2102
  let { parent: t, startIndex: n, endIndex: i } = r, s = t.contentMatchAt(n).findWrapping(e);
2095
2103
  if (!s)
2096
2104
  return null;
2097
2105
  let o = s.length ? s[0] : e;
2098
2106
  return t.canReplaceWith(n, i, o) ? s : null;
2099
2107
  }
2100
- function sr(r, e) {
2108
+ function cr(r, e) {
2101
2109
  let { parent: t, startIndex: n, endIndex: i } = r, s = t.child(n), o = e.contentMatch.findWrapping(s.type);
2102
2110
  if (!o)
2103
2111
  return null;
@@ -2106,7 +2114,7 @@ function sr(r, e) {
2106
2114
  a = a.matchType(t.child(c).type);
2107
2115
  return !a || !a.validEnd ? null : o;
2108
2116
  }
2109
- function or(r, e, t) {
2117
+ function fr(r, e, t) {
2110
2118
  let n = w.empty;
2111
2119
  for (let o = t.length - 1; o >= 0; o--) {
2112
2120
  if (n.size) {
@@ -2119,25 +2127,25 @@ function or(r, e, t) {
2119
2127
  let i = e.start, s = e.end;
2120
2128
  r.step(new A(i, s, i, s, new k(n, 0, 0), t.length, !0));
2121
2129
  }
2122
- function lr(r, e, t, n, i) {
2130
+ function ur(r, e, t, n, i) {
2123
2131
  if (!n.isTextblock)
2124
2132
  throw new RangeError("Type given to setBlockType should be a textblock");
2125
2133
  let s = r.steps.length;
2126
2134
  r.doc.nodesBetween(e, t, (o, l) => {
2127
2135
  let a = typeof i == "function" ? i(o) : i;
2128
- if (o.isTextblock && !o.hasMarkup(n, a) && ar(r.doc, r.mapping.slice(s).map(l), n)) {
2136
+ if (o.isTextblock && !o.hasMarkup(n, a) && dr(r.doc, r.mapping.slice(s).map(l), n)) {
2129
2137
  let c = null;
2130
2138
  if (n.schema.linebreakReplacement) {
2131
2139
  let h = n.whitespace == "pre", p = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
2132
2140
  h && !p ? c = !1 : !h && p && (c = !0);
2133
2141
  }
2134
- c === !1 && Xt(r, o, l, s), st(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
2142
+ c === !1 && Gt(r, o, l, s), st(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
2135
2143
  let f = r.mapping.slice(s), u = f.map(l, 1), d = f.map(l + o.nodeSize, 1);
2136
- return r.step(new A(u, d, u + 1, d - 1, new k(w.from(n.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && Kt(r, o, l, s), !1;
2144
+ return r.step(new A(u, d, u + 1, d - 1, new k(w.from(n.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && Qt(r, o, l, s), !1;
2137
2145
  }
2138
2146
  });
2139
2147
  }
2140
- function Kt(r, e, t, n) {
2148
+ function Qt(r, e, t, n) {
2141
2149
  e.forEach((i, s) => {
2142
2150
  if (i.isText) {
2143
2151
  let o, l = /\r?\n|\r/g;
@@ -2148,7 +2156,7 @@ function Kt(r, e, t, n) {
2148
2156
  }
2149
2157
  });
2150
2158
  }
2151
- function Xt(r, e, t, n) {
2159
+ function Gt(r, e, t, n) {
2152
2160
  e.forEach((i, s) => {
2153
2161
  if (i.type == i.type.schema.linebreakReplacement) {
2154
2162
  let o = r.mapping.slice(n).map(t + 1 + s);
@@ -2157,11 +2165,11 @@ function Xt(r, e, t, n) {
2157
2165
  }
2158
2166
  });
2159
2167
  }
2160
- function ar(r, e, t) {
2168
+ function dr(r, e, t) {
2161
2169
  let n = r.resolve(e), i = n.index();
2162
2170
  return n.parent.canReplaceWith(i, i + 1, t);
2163
2171
  }
2164
- function cr(r, e, t, n, i) {
2172
+ function hr(r, e, t, n, i) {
2165
2173
  let s = r.doc.nodeAt(e);
2166
2174
  if (!s)
2167
2175
  throw new RangeError("No node at given position");
@@ -2190,20 +2198,20 @@ function K(r, e, t = 1, n) {
2190
2198
  let l = i.indexAfter(s), a = n && n[0];
2191
2199
  return i.node(s).canReplaceWith(l, l, a ? a.type : i.node(s + 1).type);
2192
2200
  }
2193
- function fr(r, e, t = 1, n) {
2201
+ function pr(r, e, t = 1, n) {
2194
2202
  let i = r.doc.resolve(e), s = w.empty, o = w.empty;
2195
2203
  for (let l = i.depth, a = i.depth - t, c = t - 1; l > a; l--, c--) {
2196
2204
  s = w.from(i.node(l).copy(s));
2197
2205
  let f = n && n[c];
2198
2206
  o = w.from(f ? f.type.create(f.attrs, o) : i.node(l).copy(o));
2199
2207
  }
2200
- r.step(new T(e, e, new k(s.append(o), t, t), !0));
2208
+ r.step(new C(e, e, new k(s.append(o), t, t), !0));
2201
2209
  }
2202
- function G(r, e) {
2210
+ function Z(r, e) {
2203
2211
  let t = r.resolve(e), n = t.index();
2204
- return Yt(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
2212
+ return Zt(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
2205
2213
  }
2206
- function ur(r, e) {
2214
+ function mr(r, e) {
2207
2215
  e.content.size || r.type.compatibleContent(e.type);
2208
2216
  let t = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
2209
2217
  for (let i = 0; i < e.childCount; i++) {
@@ -2213,21 +2221,21 @@ function ur(r, e) {
2213
2221
  }
2214
2222
  return t.validEnd;
2215
2223
  }
2216
- function Yt(r, e) {
2217
- return !!(r && e && !r.isLeaf && ur(r, e));
2224
+ function Zt(r, e) {
2225
+ return !!(r && e && !r.isLeaf && mr(r, e));
2218
2226
  }
2219
- function Re(r, e, t = -1) {
2227
+ function Ne(r, e, t = -1) {
2220
2228
  let n = r.resolve(e);
2221
2229
  for (let i = n.depth; ; i--) {
2222
2230
  let s, o, l = n.index(i);
2223
- if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock && Yt(s, o) && n.node(i).canReplace(l, l + 1))
2231
+ if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock && Zt(s, o) && n.node(i).canReplace(l, l + 1))
2224
2232
  return e;
2225
2233
  if (i == 0)
2226
2234
  break;
2227
2235
  e = t < 0 ? n.before(i) : n.after(i);
2228
2236
  }
2229
2237
  }
2230
- function dr(r, e, t) {
2238
+ function gr(r, e, t) {
2231
2239
  let n = null, { linebreakReplacement: i } = r.doc.type.schema, s = r.doc.resolve(e - t), o = s.node().type;
2232
2240
  if (i && o.inlineContent) {
2233
2241
  let f = o.whitespace == "pre", u = !!o.contentMatch.matchType(i);
@@ -2236,17 +2244,17 @@ function dr(r, e, t) {
2236
2244
  let l = r.steps.length;
2237
2245
  if (n === !1) {
2238
2246
  let f = r.doc.resolve(e + t);
2239
- Xt(r, f.node(), f.before(), l);
2247
+ Gt(r, f.node(), f.before(), l);
2240
2248
  }
2241
2249
  o.inlineContent && st(r, e + t - 1, o, s.node().contentMatchAt(s.index()), n == null);
2242
2250
  let a = r.mapping.slice(l), c = a.map(e - t);
2243
- if (r.step(new T(c, a.map(e + t, -1), k.empty, !0)), n === !0) {
2251
+ if (r.step(new C(c, a.map(e + t, -1), k.empty, !0)), n === !0) {
2244
2252
  let f = r.doc.resolve(c);
2245
- Kt(r, f.node(), f.before(), r.steps.length);
2253
+ Qt(r, f.node(), f.before(), r.steps.length);
2246
2254
  }
2247
2255
  return r;
2248
2256
  }
2249
- function hr(r, e, t) {
2257
+ function yr(r, e, t) {
2250
2258
  let n = r.resolve(e);
2251
2259
  if (n.parent.canReplaceWith(n.index(), n.index(), t))
2252
2260
  return e;
@@ -2268,7 +2276,7 @@ function hr(r, e, t) {
2268
2276
  }
2269
2277
  return null;
2270
2278
  }
2271
- function Vs(r, e, t) {
2279
+ function Xs(r, e, t) {
2272
2280
  let n = r.resolve(e);
2273
2281
  if (!t.content.size)
2274
2282
  return e;
@@ -2289,16 +2297,16 @@ function Vs(r, e, t) {
2289
2297
  }
2290
2298
  return null;
2291
2299
  }
2292
- function Ne(r, e, t = e, n = k.empty) {
2300
+ function ze(r, e, t = e, n = k.empty) {
2293
2301
  if (e == t && !n.size)
2294
2302
  return null;
2295
2303
  let i = r.resolve(e), s = r.resolve(t);
2296
- return Qt(i, s, n) ? new T(e, t, n) : new pr(i, s, n).fit();
2304
+ return en(i, s, n) ? new C(e, t, n) : new wr(i, s, n).fit();
2297
2305
  }
2298
- function Qt(r, e, t) {
2306
+ function en(r, e, t) {
2299
2307
  return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
2300
2308
  }
2301
- class pr {
2309
+ class wr {
2302
2310
  constructor(e, t, n) {
2303
2311
  this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = w.empty;
2304
2312
  for (let i = 0; i <= e.depth; i++) {
@@ -2326,7 +2334,7 @@ class pr {
2326
2334
  for (; o && l && s.childCount == 1; )
2327
2335
  s = s.firstChild.content, o--, l--;
2328
2336
  let a = new k(s, o, l);
2329
- return e > -1 ? new A(n.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || n.pos != this.$to.pos ? new T(n.pos, i.pos, a) : null;
2337
+ return e > -1 ? new A(n.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || n.pos != this.$to.pos ? new C(n.pos, i.pos, a) : null;
2330
2338
  }
2331
2339
  // Find a position on the start spine of `this.unplaced` that has
2332
2340
  // content that can be moved somewhere on the frontier. Returns two
@@ -2389,7 +2397,7 @@ class pr {
2389
2397
  let m = l.child(c), g = u.matchType(m.type);
2390
2398
  if (!g)
2391
2399
  break;
2392
- c++, (c > 1 || a == 0 || m.content.size) && (u = g, f.push(Zt(m.mark(d.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
2400
+ c++, (c > 1 || a == 0 || m.content.size) && (u = g, f.push(tn(m.mark(d.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
2393
2401
  }
2394
2402
  let p = c == l.childCount;
2395
2403
  p || (h = -1), this.placed = de(this.placed, t, w.from(f)), this.frontier[t].match = u, p && h < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
@@ -2456,35 +2464,35 @@ function Je(r, e) {
2456
2464
  r = r.firstChild.content;
2457
2465
  return r;
2458
2466
  }
2459
- function Zt(r, e, t) {
2467
+ function tn(r, e, t) {
2460
2468
  if (e <= 0)
2461
2469
  return r;
2462
2470
  let n = r.content;
2463
- return e > 1 && (n = n.replaceChild(0, Zt(n.firstChild, e - 1, n.childCount == 1 ? t - 1 : 0))), e > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), t <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(w.empty, !0)))), r.copy(n);
2471
+ return e > 1 && (n = n.replaceChild(0, tn(n.firstChild, e - 1, n.childCount == 1 ? t - 1 : 0))), e > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), t <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(w.empty, !0)))), r.copy(n);
2464
2472
  }
2465
2473
  function je(r, e, t, n, i) {
2466
2474
  let s = r.node(e), o = i ? r.indexAfter(e) : r.index(e);
2467
2475
  if (o == s.childCount && !t.compatibleContent(s.type))
2468
2476
  return null;
2469
2477
  let l = n.fillBefore(s.content, !0, o);
2470
- return l && !mr(t, s.content, o) ? l : null;
2478
+ return l && !kr(t, s.content, o) ? l : null;
2471
2479
  }
2472
- function mr(r, e, t) {
2480
+ function kr(r, e, t) {
2473
2481
  for (let n = t; n < e.childCount; n++)
2474
2482
  if (!r.allowsMarks(e.child(n).marks))
2475
2483
  return !0;
2476
2484
  return !1;
2477
2485
  }
2478
- function gr(r) {
2486
+ function xr(r) {
2479
2487
  return r.spec.defining || r.spec.definingForContent;
2480
2488
  }
2481
- function yr(r, e, t, n) {
2489
+ function vr(r, e, t, n) {
2482
2490
  if (!n.size)
2483
2491
  return r.deleteRange(e, t);
2484
2492
  let i = r.doc.resolve(e), s = r.doc.resolve(t);
2485
- if (Qt(i, s, n))
2486
- return r.step(new T(e, t, n));
2487
- let o = en(i, s);
2493
+ if (en(i, s, n))
2494
+ return r.step(new C(e, t, n));
2495
+ let o = rn(i, s);
2488
2496
  o[o.length - 1] == 0 && o.pop();
2489
2497
  let l = -(i.depth + 1);
2490
2498
  o.unshift(l);
@@ -2502,7 +2510,7 @@ function yr(r, e, t, n) {
2502
2510
  d = p.content;
2503
2511
  }
2504
2512
  for (let d = f - 1; d >= 0; d--) {
2505
- let h = c[d], p = gr(h.type);
2513
+ let h = c[d], p = xr(h.type);
2506
2514
  if (p && !h.sameMarkup(i.node(Math.abs(l) - 1)))
2507
2515
  f = d;
2508
2516
  else if (p || !h.type.isTextblock)
@@ -2516,7 +2524,7 @@ function yr(r, e, t, n) {
2516
2524
  g < 0 && (y = !1, g = -g);
2517
2525
  let x = i.node(g - 1), v = i.index(g - 1);
2518
2526
  if (x.canReplaceWith(v, v, p.type, p.marks))
2519
- return r.replace(i.before(g), y ? s.after(g) : t, new k(Gt(n.content, 0, n.openStart, h), h, n.openEnd));
2527
+ return r.replace(i.before(g), y ? s.after(g) : t, new k(nn(n.content, 0, n.openStart, h), h, n.openEnd));
2520
2528
  }
2521
2529
  }
2522
2530
  let u = r.steps.length;
@@ -2525,10 +2533,10 @@ function yr(r, e, t, n) {
2525
2533
  h < 0 || (e = i.before(h), t = s.after(h));
2526
2534
  }
2527
2535
  }
2528
- function Gt(r, e, t, n, i) {
2536
+ function nn(r, e, t, n, i) {
2529
2537
  if (e < t) {
2530
2538
  let s = r.firstChild;
2531
- r = r.replaceChild(0, s.copy(Gt(s.content, e + 1, t, n, s)));
2539
+ r = r.replaceChild(0, s.copy(nn(s.content, e + 1, t, n, s)));
2532
2540
  }
2533
2541
  if (e > n) {
2534
2542
  let s = i.contentMatchAt(0), o = s.fillBefore(r).append(r);
@@ -2536,15 +2544,30 @@ function Gt(r, e, t, n, i) {
2536
2544
  }
2537
2545
  return r;
2538
2546
  }
2539
- function wr(r, e, t, n) {
2547
+ function br(r, e, t, n) {
2540
2548
  if (!n.isInline && e == t && r.doc.resolve(e).parent.content.size) {
2541
- let i = hr(r.doc, e, n.type);
2549
+ let i = yr(r.doc, e, n.type);
2542
2550
  i != null && (e = t = i);
2543
2551
  }
2544
2552
  r.replaceRange(e, t, new k(w.from(n), 0, 0));
2545
2553
  }
2546
- function kr(r, e, t) {
2547
- let n = r.doc.resolve(e), i = r.doc.resolve(t), s = en(n, i);
2554
+ function Sr(r, e, t) {
2555
+ let n = r.doc.resolve(e), i = r.doc.resolve(t);
2556
+ if (n.parent.isTextblock && i.parent.isTextblock && n.start() != i.start() && n.parentOffset == 0 && i.parentOffset == 0) {
2557
+ let o = n.sharedDepth(t), l = !1;
2558
+ for (let a = n.depth; a > o; a--)
2559
+ n.node(a).type.spec.isolating && (l = !0);
2560
+ for (let a = i.depth; a > o; a--)
2561
+ i.node(a).type.spec.isolating && (l = !0);
2562
+ if (!l) {
2563
+ for (let a = n.depth; a > 0 && e == n.start(a); a--)
2564
+ e = n.before(a);
2565
+ for (let a = i.depth; a > 0 && t == i.start(a); a--)
2566
+ t = i.before(a);
2567
+ n = r.doc.resolve(e), i = r.doc.resolve(t);
2568
+ }
2569
+ }
2570
+ let s = rn(n, i);
2548
2571
  for (let o = 0; o < s.length; o++) {
2549
2572
  let l = s[o], a = o == s.length - 1;
2550
2573
  if (a && l == 0 || n.node(l).type.contentMatch.validEnd)
@@ -2557,7 +2580,7 @@ function kr(r, e, t) {
2557
2580
  return r.delete(n.before(o), t);
2558
2581
  r.delete(e, t);
2559
2582
  }
2560
- function en(r, e) {
2583
+ function rn(r, e) {
2561
2584
  let t = [], n = Math.min(r.depth, e.depth);
2562
2585
  for (let i = n; i >= 0; i--) {
2563
2586
  let s = r.start(i);
@@ -2577,13 +2600,13 @@ class se extends z {
2577
2600
  apply(e) {
2578
2601
  let t = e.nodeAt(this.pos);
2579
2602
  if (!t)
2580
- return C.fail("No node at attribute step's position");
2603
+ return T.fail("No node at attribute step's position");
2581
2604
  let n = /* @__PURE__ */ Object.create(null);
2582
2605
  for (let s in t.attrs)
2583
2606
  n[s] = t.attrs[s];
2584
2607
  n[this.attr] = this.value;
2585
2608
  let i = t.type.create(n, null, t.marks);
2586
- return C.fromReplace(e, this.pos, this.pos + 1, new k(w.from(i), 0, t.isLeaf ? 0 : 1));
2609
+ return T.fromReplace(e, this.pos, this.pos + 1, new k(w.from(i), 0, t.isLeaf ? 0 : 1));
2587
2610
  }
2588
2611
  getMap() {
2589
2612
  return D.empty;
@@ -2618,7 +2641,7 @@ class me extends z {
2618
2641
  t[i] = e.attrs[i];
2619
2642
  t[this.attr] = this.value;
2620
2643
  let n = e.type.create(t, e.content, e.marks);
2621
- return C.ok(n);
2644
+ return T.ok(n);
2622
2645
  }
2623
2646
  getMap() {
2624
2647
  return D.empty;
@@ -2648,12 +2671,12 @@ le = function r(e) {
2648
2671
  le.prototype = Object.create(Error.prototype);
2649
2672
  le.prototype.constructor = le;
2650
2673
  le.prototype.name = "TransformError";
2651
- class xr {
2674
+ class Mr {
2652
2675
  /**
2653
2676
  Create a transform that starts with the given document.
2654
2677
  */
2655
2678
  constructor(e) {
2656
- this.doc = e, this.steps = [], this.docs = [], this.mapping = new Ae();
2679
+ this.doc = e, this.steps = [], this.docs = [], this.mapping = new Ie();
2657
2680
  }
2658
2681
  /**
2659
2682
  The starting document.
@@ -2713,7 +2736,7 @@ class xr {
2713
2736
  given `slice`.
2714
2737
  */
2715
2738
  replace(e, t = e, n = k.empty) {
2716
- let i = Ne(this.doc, e, t, n);
2739
+ let i = ze(this.doc, e, t, n);
2717
2740
  return i && this.step(i), this;
2718
2741
  }
2719
2742
  /**
@@ -2755,7 +2778,7 @@ class xr {
2755
2778
  control over what happens.
2756
2779
  */
2757
2780
  replaceRange(e, t, n) {
2758
- return yr(this, e, t, n), this;
2781
+ return vr(this, e, t, n), this;
2759
2782
  }
2760
2783
  /**
2761
2784
  Replace the given range with a node, but use `from` and `to` as
@@ -2767,14 +2790,14 @@ class xr {
2767
2790
  that parent node.
2768
2791
  */
2769
2792
  replaceRangeWith(e, t, n) {
2770
- return wr(this, e, t, n), this;
2793
+ return br(this, e, t, n), this;
2771
2794
  }
2772
2795
  /**
2773
2796
  Delete the given range, expanding it to cover fully covered
2774
2797
  parent nodes until a valid replace is found.
2775
2798
  */
2776
2799
  deleteRange(e, t) {
2777
- return kr(this, e, t), this;
2800
+ return Sr(this, e, t), this;
2778
2801
  }
2779
2802
  /**
2780
2803
  Split the content in the given range off from its parent, if there
@@ -2784,14 +2807,14 @@ class xr {
2784
2807
  sure the lift is valid.
2785
2808
  */
2786
2809
  lift(e, t) {
2787
- return rr(this, e, t), this;
2810
+ return lr(this, e, t), this;
2788
2811
  }
2789
2812
  /**
2790
2813
  Join the blocks around the given position. If depth is 2, their
2791
2814
  last and first siblings are also joined, and so on.
2792
2815
  */
2793
2816
  join(e, t = 1) {
2794
- return dr(this, e, t), this;
2817
+ return gr(this, e, t), this;
2795
2818
  }
2796
2819
  /**
2797
2820
  Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
@@ -2799,21 +2822,21 @@ class xr {
2799
2822
  probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
2800
2823
  */
2801
2824
  wrap(e, t) {
2802
- return or(this, e, t), this;
2825
+ return fr(this, e, t), this;
2803
2826
  }
2804
2827
  /**
2805
2828
  Set the type of all textblocks (partly) between `from` and `to` to
2806
2829
  the given node type with the given attributes.
2807
2830
  */
2808
2831
  setBlockType(e, t = e, n, i = null) {
2809
- return lr(this, e, t, n, i), this;
2832
+ return ur(this, e, t, n, i), this;
2810
2833
  }
2811
2834
  /**
2812
2835
  Change the type, attributes, and/or marks of the node at `pos`.
2813
2836
  When `type` isn't given, the existing node type is preserved,
2814
2837
  */
2815
2838
  setNodeMarkup(e, t, n = null, i) {
2816
- return cr(this, e, t, n, i), this;
2839
+ return hr(this, e, t, n, i), this;
2817
2840
  }
2818
2841
  /**
2819
2842
  Set a single attribute on a given node to a new value.
@@ -2862,13 +2885,13 @@ class xr {
2862
2885
  use after the split (with the outermost nodes coming first).
2863
2886
  */
2864
2887
  split(e, t = 1, n) {
2865
- return fr(this, e, t, n), this;
2888
+ return pr(this, e, t, n), this;
2866
2889
  }
2867
2890
  /**
2868
2891
  Add the given mark to the inline content between `from` and `to`.
2869
2892
  */
2870
2893
  addMark(e, t, n) {
2871
- return er(this, e, t, n), this;
2894
+ return ir(this, e, t, n), this;
2872
2895
  }
2873
2896
  /**
2874
2897
  Remove marks from inline nodes between `from` and `to`. When
@@ -2877,7 +2900,7 @@ class xr {
2877
2900
  remove all marks of any type.
2878
2901
  */
2879
2902
  removeMark(e, t, n) {
2880
- return tr(this, e, t, n), this;
2903
+ return sr(this, e, t, n), this;
2881
2904
  }
2882
2905
  /**
2883
2906
  Removes all marks and nodes from the content of the node at
@@ -2897,7 +2920,7 @@ class E {
2897
2920
  `$head`.
2898
2921
  */
2899
2922
  constructor(e, t, n) {
2900
- this.$anchor = e, this.$head = t, this.ranges = n || [new vr(e.min(t), e.max(t))];
2923
+ this.$anchor = e, this.$head = t, this.ranges = n || [new Er(e.min(t), e.max(t))];
2901
2924
  }
2902
2925
  /**
2903
2926
  The selection's anchor, as an unresolved position.
@@ -3055,7 +3078,7 @@ class E {
3055
3078
  }
3056
3079
  }
3057
3080
  E.prototype.visible = !0;
3058
- class vr {
3081
+ class Er {
3059
3082
  /**
3060
3083
  Create a range.
3061
3084
  */
@@ -3098,7 +3121,7 @@ class P extends E {
3098
3121
  return e instanceof P && e.anchor == this.anchor && e.head == this.head;
3099
3122
  }
3100
3123
  getBookmark() {
3101
- return new ze(this.anchor, this.head);
3124
+ return new Oe(this.anchor, this.head);
3102
3125
  }
3103
3126
  toJSON() {
3104
3127
  return { type: "text", anchor: this.anchor, head: this.head };
@@ -3139,12 +3162,12 @@ class P extends E {
3139
3162
  }
3140
3163
  }
3141
3164
  E.jsonID("text", P);
3142
- class ze {
3165
+ class Oe {
3143
3166
  constructor(e, t) {
3144
3167
  this.anchor = e, this.head = t;
3145
3168
  }
3146
3169
  map(e) {
3147
- return new ze(e.map(this.anchor), e.map(this.head));
3170
+ return new Oe(e.map(this.anchor), e.map(this.head));
3148
3171
  }
3149
3172
  resolve(e) {
3150
3173
  return P.between(e.resolve(this.anchor), e.resolve(this.head));
@@ -3205,7 +3228,7 @@ class lt {
3205
3228
  }
3206
3229
  map(e) {
3207
3230
  let { deleted: t, pos: n } = e.mapResult(this.anchor);
3208
- return t ? new ze(n, n) : new lt(n);
3231
+ return t ? new Oe(n, n) : new lt(n);
3209
3232
  }
3210
3233
  resolve(e) {
3211
3234
  let t = e.resolve(this.anchor), n = t.nodeAfter;
@@ -3243,11 +3266,11 @@ class j extends E {
3243
3266
  return e instanceof j;
3244
3267
  }
3245
3268
  getBookmark() {
3246
- return br;
3269
+ return Cr;
3247
3270
  }
3248
3271
  }
3249
3272
  E.jsonID("all", j);
3250
- const br = {
3273
+ const Cr = {
3251
3274
  map() {
3252
3275
  return this;
3253
3276
  },
@@ -3277,7 +3300,7 @@ function At(r, e, t) {
3277
3300
  if (n < e)
3278
3301
  return;
3279
3302
  let i = r.steps[n];
3280
- if (!(i instanceof T || i instanceof A))
3303
+ if (!(i instanceof C || i instanceof A))
3281
3304
  return;
3282
3305
  let s = r.mapping.maps[n], o;
3283
3306
  s.forEach((l, a, c, f) => {
@@ -3287,33 +3310,33 @@ function At(r, e, t) {
3287
3310
  function It(r, e) {
3288
3311
  return !e || !r ? r : r.bind(e);
3289
3312
  }
3290
- class be {
3313
+ class Se {
3291
3314
  constructor(e, t, n) {
3292
3315
  this.name = e, this.init = It(t.init, n), this.apply = It(t.apply, n);
3293
3316
  }
3294
3317
  }
3295
- new be("doc", {
3318
+ new Se("doc", {
3296
3319
  init(r) {
3297
3320
  return r.doc || r.schema.topNodeType.createAndFill();
3298
3321
  },
3299
3322
  apply(r) {
3300
3323
  return r.doc;
3301
3324
  }
3302
- }), new be("selection", {
3325
+ }), new Se("selection", {
3303
3326
  init(r, e) {
3304
3327
  return r.selection || E.atStart(e.doc);
3305
3328
  },
3306
3329
  apply(r) {
3307
3330
  return r.selection;
3308
3331
  }
3309
- }), new be("storedMarks", {
3332
+ }), new Se("storedMarks", {
3310
3333
  init(r) {
3311
3334
  return r.storedMarks || null;
3312
3335
  },
3313
3336
  apply(r, e, t, n) {
3314
3337
  return n.selection.$cursor ? r.storedMarks : null;
3315
3338
  }
3316
- }), new be("scrollToSelection", {
3339
+ }), new Se("scrollToSelection", {
3317
3340
  init() {
3318
3341
  return 0;
3319
3342
  },
@@ -3321,19 +3344,19 @@ new be("doc", {
3321
3344
  return r.scrolledIntoView ? e + 1 : e;
3322
3345
  }
3323
3346
  });
3324
- function tn(r, e, t) {
3347
+ function sn(r, e, t) {
3325
3348
  for (let n in r) {
3326
3349
  let i = r[n];
3327
- i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = tn(i, e, {})), t[n] = i;
3350
+ i instanceof Function ? i = i.bind(e) : n == "handleDOMEvents" && (i = sn(i, e, {})), t[n] = i;
3328
3351
  }
3329
3352
  return t;
3330
3353
  }
3331
- class qs {
3354
+ class Ys {
3332
3355
  /**
3333
3356
  Create a plugin.
3334
3357
  */
3335
3358
  constructor(e) {
3336
- this.spec = e, this.props = {}, e.props && tn(e.props, this, this.props), this.key = e.key ? e.key.key : nn("plugin");
3359
+ this.spec = e, this.props = {}, e.props && sn(e.props, this, this.props), this.key = e.key ? e.key.key : on("plugin");
3337
3360
  }
3338
3361
  /**
3339
3362
  Extract the plugin's state field from an editor state.
@@ -3343,15 +3366,15 @@ class qs {
3343
3366
  }
3344
3367
  }
3345
3368
  const _e = /* @__PURE__ */ Object.create(null);
3346
- function nn(r) {
3369
+ function on(r) {
3347
3370
  return r in _e ? r + "$" + ++_e[r] : (_e[r] = 0, r + "$");
3348
3371
  }
3349
- class Us {
3372
+ class Qs {
3350
3373
  /**
3351
3374
  Create a plugin key.
3352
3375
  */
3353
3376
  constructor(e = "key") {
3354
- this.key = nn(e);
3377
+ this.key = on(e);
3355
3378
  }
3356
3379
  /**
3357
3380
  Get the active plugin with this key, if any, from an editor
@@ -3367,13 +3390,13 @@ class Us {
3367
3390
  return e[this.key];
3368
3391
  }
3369
3392
  }
3370
- const rn = (r, e) => r.selection.empty ? !1 : (e && e(r.tr.deleteSelection().scrollIntoView()), !0);
3371
- function sn(r, e) {
3393
+ const ln = (r, e) => r.selection.empty ? !1 : (e && e(r.tr.deleteSelection().scrollIntoView()), !0);
3394
+ function an(r, e) {
3372
3395
  let { $cursor: t } = r.selection;
3373
3396
  return !t || (e ? !e.endOfTextblock("backward", r) : t.parentOffset > 0) ? null : t;
3374
3397
  }
3375
- const on = (r, e, t) => {
3376
- let n = sn(r, t);
3398
+ const cn = (r, e, t) => {
3399
+ let n = an(r, t);
3377
3400
  if (!n)
3378
3401
  return !1;
3379
3402
  let i = at(n);
@@ -3382,11 +3405,11 @@ const on = (r, e, t) => {
3382
3405
  return l == null ? !1 : (e && e(r.tr.lift(o, l).scrollIntoView()), !0);
3383
3406
  }
3384
3407
  let s = i.nodeBefore;
3385
- if (mn(r, i, e, -1))
3408
+ if (wn(r, i, e, -1))
3386
3409
  return !0;
3387
3410
  if (n.parent.content.size == 0 && (ae(s, "end") || M.isSelectable(s)))
3388
3411
  for (let o = n.depth; ; o--) {
3389
- let l = Ne(r.doc, n.before(o), n.after(o), k.empty);
3412
+ let l = ze(r.doc, n.before(o), n.after(o), k.empty);
3390
3413
  if (l && l.slice.size < l.to - l.from) {
3391
3414
  if (e) {
3392
3415
  let a = r.tr.step(l);
@@ -3398,20 +3421,20 @@ const on = (r, e, t) => {
3398
3421
  break;
3399
3422
  }
3400
3423
  return s.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos - s.nodeSize, i.pos).scrollIntoView()), !0) : !1;
3401
- }, Sr = (r, e, t) => {
3402
- let n = sn(r, t);
3424
+ }, Tr = (r, e, t) => {
3425
+ let n = an(r, t);
3403
3426
  if (!n)
3404
3427
  return !1;
3405
3428
  let i = at(n);
3406
- return i ? ln(r, i, e) : !1;
3407
- }, Mr = (r, e, t) => {
3408
- let n = cn(r, t);
3429
+ return i ? fn(r, i, e) : !1;
3430
+ }, Ar = (r, e, t) => {
3431
+ let n = dn(r, t);
3409
3432
  if (!n)
3410
3433
  return !1;
3411
3434
  let i = ct(n);
3412
- return i ? ln(r, i, e) : !1;
3435
+ return i ? fn(r, i, e) : !1;
3413
3436
  };
3414
- function ln(r, e, t) {
3437
+ function fn(r, e, t) {
3415
3438
  let n = e.nodeBefore, i = n, s = e.pos - 1;
3416
3439
  for (; !i.isTextblock; s--) {
3417
3440
  if (i.type.spec.isolating)
@@ -3430,8 +3453,8 @@ function ln(r, e, t) {
3430
3453
  return !1;
3431
3454
  l = f;
3432
3455
  }
3433
- let c = Ne(r.doc, s, a, k.empty);
3434
- if (!c || c.from != s || c instanceof T && c.slice.size >= a - s)
3456
+ let c = ze(r.doc, s, a, k.empty);
3457
+ if (!c || c.from != s || c instanceof C && c.slice.size >= a - s)
3435
3458
  return !1;
3436
3459
  if (t) {
3437
3460
  let f = r.tr.step(c);
@@ -3448,7 +3471,7 @@ function ae(r, e, t = !1) {
3448
3471
  }
3449
3472
  return !1;
3450
3473
  }
3451
- const an = (r, e, t) => {
3474
+ const un = (r, e, t) => {
3452
3475
  let { $head: n, empty: i } = r.selection, s = n;
3453
3476
  if (!i)
3454
3477
  return !1;
@@ -3470,22 +3493,22 @@ function at(r) {
3470
3493
  }
3471
3494
  return null;
3472
3495
  }
3473
- function cn(r, e) {
3496
+ function dn(r, e) {
3474
3497
  let { $cursor: t } = r.selection;
3475
3498
  return !t || (e ? !e.endOfTextblock("forward", r) : t.parentOffset < t.parent.content.size) ? null : t;
3476
3499
  }
3477
- const fn = (r, e, t) => {
3478
- let n = cn(r, t);
3500
+ const hn = (r, e, t) => {
3501
+ let n = dn(r, t);
3479
3502
  if (!n)
3480
3503
  return !1;
3481
3504
  let i = ct(n);
3482
3505
  if (!i)
3483
3506
  return !1;
3484
3507
  let s = i.nodeAfter;
3485
- if (mn(r, i, e, 1))
3508
+ if (wn(r, i, e, 1))
3486
3509
  return !0;
3487
3510
  if (n.parent.content.size == 0 && (ae(s, "start") || M.isSelectable(s))) {
3488
- let o = Ne(r.doc, n.before(), n.after(), k.empty);
3511
+ let o = ze(r.doc, n.before(), n.after(), k.empty);
3489
3512
  if (o && o.slice.size < o.to - o.from) {
3490
3513
  if (e) {
3491
3514
  let l = r.tr.step(o);
@@ -3495,7 +3518,7 @@ const fn = (r, e, t) => {
3495
3518
  }
3496
3519
  }
3497
3520
  return s.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos, i.pos + s.nodeSize).scrollIntoView()), !0) : !1;
3498
- }, un = (r, e, t) => {
3521
+ }, pn = (r, e, t) => {
3499
3522
  let { $head: n, empty: i } = r.selection, s = n;
3500
3523
  if (!i)
3501
3524
  return !1;
@@ -3518,32 +3541,32 @@ function ct(r) {
3518
3541
  }
3519
3542
  return null;
3520
3543
  }
3521
- const Er = (r, e) => {
3544
+ const Ir = (r, e) => {
3522
3545
  let t = r.selection, n = t instanceof M, i;
3523
3546
  if (n) {
3524
- if (t.node.isTextblock || !G(r.doc, t.from))
3547
+ if (t.node.isTextblock || !Z(r.doc, t.from))
3525
3548
  return !1;
3526
3549
  i = t.from;
3527
- } else if (i = Re(r.doc, t.from, -1), i == null)
3550
+ } else if (i = Ne(r.doc, t.from, -1), i == null)
3528
3551
  return !1;
3529
3552
  if (e) {
3530
3553
  let s = r.tr.join(i);
3531
3554
  n && s.setSelection(M.create(s.doc, i - r.doc.resolve(i).nodeBefore.nodeSize)), e(s.scrollIntoView());
3532
3555
  }
3533
3556
  return !0;
3534
- }, Cr = (r, e) => {
3557
+ }, Rr = (r, e) => {
3535
3558
  let t = r.selection, n;
3536
3559
  if (t instanceof M) {
3537
- if (t.node.isTextblock || !G(r.doc, t.to))
3560
+ if (t.node.isTextblock || !Z(r.doc, t.to))
3538
3561
  return !1;
3539
3562
  n = t.to;
3540
- } else if (n = Re(r.doc, t.to, 1), n == null)
3563
+ } else if (n = Ne(r.doc, t.to, 1), n == null)
3541
3564
  return !1;
3542
3565
  return e && e(r.tr.join(n).scrollIntoView()), !0;
3543
- }, Tr = (r, e) => {
3566
+ }, Nr = (r, e) => {
3544
3567
  let { $from: t, $to: n } = r.selection, i = t.blockRange(n), s = i && ce(i);
3545
3568
  return s == null ? !1 : (e && e(r.tr.lift(i, s).scrollIntoView()), !0);
3546
- }, dn = (r, e) => {
3569
+ }, mn = (r, e) => {
3547
3570
  let { $head: t, $anchor: n } = r.selection;
3548
3571
  return !t.parent.type.spec.code || !t.sameParent(n) ? !1 : (e && e(r.tr.insertText(`
3549
3572
  `).scrollIntoView()), !0);
@@ -3556,7 +3579,7 @@ function ft(r) {
3556
3579
  }
3557
3580
  return null;
3558
3581
  }
3559
- const Ar = (r, e) => {
3582
+ const zr = (r, e) => {
3560
3583
  let { $head: t, $anchor: n } = r.selection;
3561
3584
  if (!t.parent.type.spec.code || !t.sameParent(n))
3562
3585
  return !1;
@@ -3568,7 +3591,7 @@ const Ar = (r, e) => {
3568
3591
  a.setSelection(E.near(a.doc.resolve(l), 1)), e(a.scrollIntoView());
3569
3592
  }
3570
3593
  return !0;
3571
- }, hn = (r, e) => {
3594
+ }, gn = (r, e) => {
3572
3595
  let t = r.selection, { $from: n, $to: i } = t;
3573
3596
  if (t instanceof j || n.parent.inlineContent || i.parent.inlineContent)
3574
3597
  return !1;
@@ -3580,7 +3603,7 @@ const Ar = (r, e) => {
3580
3603
  l.setSelection(P.create(l.doc, o + 1)), e(l.scrollIntoView());
3581
3604
  }
3582
3605
  return !0;
3583
- }, pn = (r, e) => {
3606
+ }, yn = (r, e) => {
3584
3607
  let { $cursor: t } = r.selection;
3585
3608
  if (!t || t.parent.content.size)
3586
3609
  return !1;
@@ -3592,7 +3615,7 @@ const Ar = (r, e) => {
3592
3615
  let n = t.blockRange(), i = n && ce(n);
3593
3616
  return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
3594
3617
  };
3595
- function Ir(r) {
3618
+ function Or(r) {
3596
3619
  return (e, t) => {
3597
3620
  let { $from: n, $to: i } = e.selection;
3598
3621
  if (e.selection instanceof M && e.selection.node.isBlock)
@@ -3621,17 +3644,17 @@ function Ir(r) {
3621
3644
  return t && t(f.scrollIntoView()), !0;
3622
3645
  };
3623
3646
  }
3624
- const Rr = Ir(), Nr = (r, e) => {
3647
+ const $r = Or(), Pr = (r, e) => {
3625
3648
  let { $from: t, to: n } = r.selection, i, s = t.sharedDepth(n);
3626
3649
  return s == 0 ? !1 : (i = t.before(s), e && e(r.tr.setSelection(M.create(r.doc, i))), !0);
3627
3650
  };
3628
- function zr(r, e, t) {
3651
+ function Br(r, e, t) {
3629
3652
  let n = e.nodeBefore, i = e.nodeAfter, s = e.index();
3630
- return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(s - 1, s) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock || G(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
3653
+ return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(s - 1, s) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock || Z(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
3631
3654
  }
3632
- function mn(r, e, t, n) {
3655
+ function wn(r, e, t, n) {
3633
3656
  let i = e.nodeBefore, s = e.nodeAfter, o, l, a = i.type.spec.isolating || s.type.spec.isolating;
3634
- if (!a && zr(r, e, t))
3657
+ if (!a && Br(r, e, t))
3635
3658
  return !0;
3636
3659
  let c = !a && e.parent.canReplace(e.index(), e.index() + 1);
3637
3660
  if (c && (o = (l = i.contentMatchAt(i.childCount)).findWrapping(s.type)) && l.matchType(o[0] || s.type).validEnd) {
@@ -3641,7 +3664,7 @@ function mn(r, e, t, n) {
3641
3664
  p = w.from(o[y].create(null, p));
3642
3665
  p = w.from(i.copy(p));
3643
3666
  let m = r.tr.step(new A(e.pos - 1, h, e.pos, h, new k(p, 1, 0), o.length, !0)), g = m.doc.resolve(h + 2 * o.length);
3644
- g.nodeAfter && g.nodeAfter.type == i.type && G(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
3667
+ g.nodeAfter && g.nodeAfter.type == i.type && Z(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
3645
3668
  }
3646
3669
  return !0;
3647
3670
  }
@@ -3668,7 +3691,7 @@ function mn(r, e, t, n) {
3668
3691
  }
3669
3692
  return !1;
3670
3693
  }
3671
- function gn(r) {
3694
+ function kn(r) {
3672
3695
  return function(e, t) {
3673
3696
  let n = e.selection, i = r < 0 ? n.$from : n.$to, s = i.depth;
3674
3697
  for (; i.node(s).isInline; ) {
@@ -3679,8 +3702,8 @@ function gn(r) {
3679
3702
  return i.node(s).isTextblock ? (t && t(e.tr.setSelection(P.create(e.doc, r < 0 ? i.start(s) : i.end(s)))), !0) : !1;
3680
3703
  };
3681
3704
  }
3682
- const Or = gn(-1), $r = gn(1);
3683
- function Pr(r, e = null) {
3705
+ const Dr = kn(-1), Fr = kn(1);
3706
+ function Lr(r, e = null) {
3684
3707
  return function(t, n) {
3685
3708
  let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o && ot(o, r, e);
3686
3709
  return l ? (n && n(t.tr.wrap(o, l).scrollIntoView()), !0) : !1;
@@ -3724,20 +3747,20 @@ function ut(...r) {
3724
3747
  return !1;
3725
3748
  };
3726
3749
  }
3727
- ut(rn, on, an);
3728
- ut(rn, fn, un);
3729
- ut(dn, hn, pn, Rr);
3750
+ ut(ln, cn, un);
3751
+ ut(ln, hn, pn);
3752
+ ut(mn, gn, yn, $r);
3730
3753
  typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
3731
- function Br(r, e = null) {
3754
+ function Wr(r, e = null) {
3732
3755
  return function(t, n) {
3733
3756
  let { $from: i, $to: s } = t.selection, o = i.blockRange(s);
3734
3757
  if (!o)
3735
3758
  return !1;
3736
3759
  let l = n ? t.tr : null;
3737
- return Dr(l, o, r, e) ? (n && n(l.scrollIntoView()), !0) : !1;
3760
+ return Jr(l, o, r, e) ? (n && n(l.scrollIntoView()), !0) : !1;
3738
3761
  };
3739
3762
  }
3740
- function Dr(r, e, t, n = null) {
3763
+ function Jr(r, e, t, n = null) {
3741
3764
  let i = !1, s = e, o = e.$from.doc;
3742
3765
  if (e.depth >= 2 && e.$from.node(e.depth - 1).type.compatibleContent(t) && e.startIndex == 0) {
3743
3766
  if (e.$from.index(e.depth - 1) == 0)
@@ -3746,9 +3769,9 @@ function Dr(r, e, t, n = null) {
3746
3769
  s = new Ye(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new Ye(e.$from, o.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
3747
3770
  }
3748
3771
  let l = ot(s, t, n, e);
3749
- return l ? (r && Fr(r, e, l, i, t), !0) : !1;
3772
+ return l ? (r && jr(r, e, l, i, t), !0) : !1;
3750
3773
  }
3751
- function Fr(r, e, t, n, i) {
3774
+ function jr(r, e, t, n, i) {
3752
3775
  let s = w.empty;
3753
3776
  for (let f = t.length - 1; f >= 0; f--)
3754
3777
  s = w.from(t[f].type.create(t[f].attrs, s));
@@ -3761,13 +3784,13 @@ function Fr(r, e, t, n, i) {
3761
3784
  !d && K(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(f).nodeSize;
3762
3785
  return r;
3763
3786
  }
3764
- function Lr(r) {
3787
+ function Hr(r) {
3765
3788
  return function(e, t) {
3766
3789
  let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (o) => o.childCount > 0 && o.firstChild.type == r);
3767
- return s ? t ? n.node(s.depth - 1).type == r ? Wr(e, t, r, s) : Jr(e, t, s) : !0 : !1;
3790
+ return s ? t ? n.node(s.depth - 1).type == r ? _r(e, t, r, s) : Vr(e, t, s) : !0 : !1;
3768
3791
  };
3769
3792
  }
3770
- function Wr(r, e, t, n) {
3793
+ function _r(r, e, t, n) {
3771
3794
  let i = r.tr, s = n.end, o = n.$to.end(n.depth);
3772
3795
  s < o && (i.step(new A(s - 1, o, s, o, new k(w.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new Ye(i.doc.resolve(n.$from.pos), i.doc.resolve(o), n.depth));
3773
3796
  const l = ce(n);
@@ -3775,9 +3798,9 @@ function Wr(r, e, t, n) {
3775
3798
  return !1;
3776
3799
  i.lift(n, l);
3777
3800
  let a = i.doc.resolve(i.mapping.map(s, -1) - 1);
3778
- return G(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
3801
+ return Z(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
3779
3802
  }
3780
- function Jr(r, e, t) {
3803
+ function Vr(r, e, t) {
3781
3804
  let n = r.tr, i = t.parent;
3782
3805
  for (let h = t.end, p = t.endIndex - 1, m = t.startIndex; p > m; p--)
3783
3806
  h -= i.child(p).nodeSize, n.delete(h - 1, h + 1);
@@ -3790,7 +3813,7 @@ function Jr(r, e, t) {
3790
3813
  let u = s.pos, d = u + o.nodeSize;
3791
3814
  return n.step(new A(u - (l ? 1 : 0), d + (a ? 1 : 0), u + 1, d - 1, new k((l ? w.empty : w.from(i.copy(w.empty))).append(a ? w.empty : w.from(i.copy(w.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(n.scrollIntoView()), !0;
3792
3815
  }
3793
- function jr(r) {
3816
+ function qr(r) {
3794
3817
  return function(e, t) {
3795
3818
  let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (c) => c.childCount > 0 && c.firstChild.type == r);
3796
3819
  if (!s)
@@ -3808,11 +3831,11 @@ function jr(r) {
3808
3831
  return !0;
3809
3832
  };
3810
3833
  }
3811
- var Hr = Object.defineProperty, dt = (r, e) => {
3834
+ var Ur = Object.defineProperty, dt = (r, e) => {
3812
3835
  for (var t in e)
3813
- Hr(r, t, { get: e[t], enumerable: !0 });
3836
+ Ur(r, t, { get: e[t], enumerable: !0 });
3814
3837
  };
3815
- function yn(r) {
3838
+ function xn(r) {
3816
3839
  const { state: e, transaction: t } = r;
3817
3840
  let { selection: n } = t, { doc: i } = t, { storedMarks: s } = t;
3818
3841
  return {
@@ -3837,7 +3860,7 @@ function yn(r) {
3837
3860
  }
3838
3861
  };
3839
3862
  }
3840
- var _r = class {
3863
+ var Kr = class {
3841
3864
  constructor(r) {
3842
3865
  this.editor = r.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = r.state;
3843
3866
  }
@@ -3888,7 +3911,7 @@ var _r = class {
3888
3911
  tr: r,
3889
3912
  editor: n,
3890
3913
  view: s,
3891
- state: yn({
3914
+ state: xn({
3892
3915
  state: i,
3893
3916
  transaction: r
3894
3917
  }),
@@ -3904,73 +3927,73 @@ var _r = class {
3904
3927
  };
3905
3928
  return o;
3906
3929
  }
3907
- }, wn = {};
3908
- dt(wn, {
3909
- blur: () => Vr,
3910
- clearContent: () => qr,
3911
- clearNodes: () => Ur,
3912
- command: () => Kr,
3913
- createParagraphNear: () => Xr,
3914
- cut: () => Yr,
3915
- deleteCurrentNode: () => Qr,
3916
- deleteNode: () => Zr,
3917
- deleteRange: () => Gr,
3918
- deleteSelection: () => ni,
3919
- enter: () => ri,
3920
- exitCode: () => ii,
3921
- extendMarkRange: () => oi,
3922
- first: () => li,
3923
- focus: () => fi,
3924
- forEach: () => ui,
3925
- insertContent: () => di,
3926
- insertContentAt: () => mi,
3927
- joinBackward: () => wi,
3928
- joinDown: () => yi,
3929
- joinForward: () => ki,
3930
- joinItemBackward: () => xi,
3931
- joinItemForward: () => vi,
3932
- joinTextblockBackward: () => bi,
3933
- joinTextblockForward: () => Si,
3934
- joinUp: () => gi,
3935
- keyboardShortcut: () => Ei,
3936
- lift: () => Ci,
3937
- liftEmptyBlock: () => Ti,
3938
- liftListItem: () => Ai,
3939
- newlineInCode: () => Ii,
3940
- resetAttributes: () => Ri,
3941
- scrollIntoView: () => Ni,
3942
- selectAll: () => zi,
3943
- selectNodeBackward: () => Oi,
3944
- selectNodeForward: () => $i,
3945
- selectParentNode: () => Pi,
3946
- selectTextblockEnd: () => Bi,
3947
- selectTextblockStart: () => Di,
3948
- setContent: () => Li,
3949
- setMark: () => Gi,
3950
- setMeta: () => es,
3951
- setNode: () => ts,
3952
- setNodeSelection: () => ns,
3953
- setTextDirection: () => rs,
3954
- setTextSelection: () => is,
3955
- sinkListItem: () => ss,
3956
- splitBlock: () => ls,
3957
- splitListItem: () => as,
3958
- toggleList: () => fs,
3959
- toggleMark: () => us,
3960
- toggleNode: () => ds,
3961
- toggleWrap: () => hs,
3962
- undoInputRule: () => ps,
3963
- unsetAllMarks: () => ms,
3964
- unsetMark: () => gs,
3965
- unsetTextDirection: () => ys,
3966
- updateAttributes: () => ws,
3967
- wrapIn: () => ks,
3968
- wrapInList: () => xs
3930
+ }, vn = {};
3931
+ dt(vn, {
3932
+ blur: () => Xr,
3933
+ clearContent: () => Yr,
3934
+ clearNodes: () => Qr,
3935
+ command: () => Gr,
3936
+ createParagraphNear: () => Zr,
3937
+ cut: () => ei,
3938
+ deleteCurrentNode: () => ti,
3939
+ deleteNode: () => ni,
3940
+ deleteRange: () => ri,
3941
+ deleteSelection: () => oi,
3942
+ enter: () => li,
3943
+ exitCode: () => ai,
3944
+ extendMarkRange: () => fi,
3945
+ first: () => ui,
3946
+ focus: () => pi,
3947
+ forEach: () => mi,
3948
+ insertContent: () => gi,
3949
+ insertContentAt: () => ki,
3950
+ joinBackward: () => bi,
3951
+ joinDown: () => vi,
3952
+ joinForward: () => Si,
3953
+ joinItemBackward: () => Mi,
3954
+ joinItemForward: () => Ei,
3955
+ joinTextblockBackward: () => Ci,
3956
+ joinTextblockForward: () => Ti,
3957
+ joinUp: () => xi,
3958
+ keyboardShortcut: () => Ii,
3959
+ lift: () => Ri,
3960
+ liftEmptyBlock: () => Ni,
3961
+ liftListItem: () => zi,
3962
+ newlineInCode: () => Oi,
3963
+ resetAttributes: () => $i,
3964
+ scrollIntoView: () => Pi,
3965
+ selectAll: () => Bi,
3966
+ selectNodeBackward: () => Di,
3967
+ selectNodeForward: () => Fi,
3968
+ selectParentNode: () => Li,
3969
+ selectTextblockEnd: () => Wi,
3970
+ selectTextblockStart: () => Ji,
3971
+ setContent: () => Hi,
3972
+ setMark: () => rs,
3973
+ setMeta: () => is,
3974
+ setNode: () => ss,
3975
+ setNodeSelection: () => ls,
3976
+ setTextDirection: () => as,
3977
+ setTextSelection: () => cs,
3978
+ sinkListItem: () => fs,
3979
+ splitBlock: () => us,
3980
+ splitListItem: () => ds,
3981
+ toggleList: () => ps,
3982
+ toggleMark: () => ms,
3983
+ toggleNode: () => gs,
3984
+ toggleWrap: () => ys,
3985
+ undoInputRule: () => ws,
3986
+ unsetAllMarks: () => ks,
3987
+ unsetMark: () => xs,
3988
+ unsetTextDirection: () => vs,
3989
+ updateAttributes: () => bs,
3990
+ wrapIn: () => Ss,
3991
+ wrapInList: () => Ms
3969
3992
  });
3970
- var Vr = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
3993
+ var Xr = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
3971
3994
  var t;
3972
3995
  r.isDestroyed || (e.dom.blur(), (t = window == null ? void 0 : window.getSelection()) == null || t.removeAllRanges());
3973
- }), !0), qr = (r = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: r }), Ur = () => ({ state: r, tr: e, dispatch: t }) => {
3996
+ }), !0), Yr = (r = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: r }), Qr = () => ({ state: r, tr: e, dispatch: t }) => {
3974
3997
  const { selection: n } = e, { ranges: i } = n;
3975
3998
  return t && i.forEach(({ $from: s, $to: o }) => {
3976
3999
  r.doc.nodesBetween(s.pos, o.pos, (l, a) => {
@@ -3987,12 +4010,12 @@ var Vr = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
3987
4010
  (p || p === 0) && e.lift(h, p);
3988
4011
  });
3989
4012
  }), !0;
3990
- }, Kr = (r) => (e) => r(e), Xr = () => ({ state: r, dispatch: e }) => hn(r, e), Yr = (r, e) => ({ editor: t, tr: n }) => {
4013
+ }, Gr = (r) => (e) => r(e), Zr = () => ({ state: r, dispatch: e }) => gn(r, e), ei = (r, e) => ({ editor: t, tr: n }) => {
3991
4014
  const { state: i } = t, s = i.doc.slice(r.from, r.to);
3992
4015
  n.deleteRange(r.from, r.to);
3993
4016
  const o = n.mapping.map(e);
3994
4017
  return n.insert(o, s.content), n.setSelection(new J(n.doc.resolve(Math.max(o - 1, 0)))), !0;
3995
- }, Qr = () => ({ tr: r, dispatch: e }) => {
4018
+ }, ti = () => ({ tr: r, dispatch: e }) => {
3996
4019
  const { selection: t } = r, n = t.$anchor.node();
3997
4020
  if (n.content.size > 0)
3998
4021
  return !1;
@@ -4010,12 +4033,14 @@ var Vr = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
4010
4033
  function N(r, e) {
4011
4034
  if (typeof r == "string") {
4012
4035
  if (!e.nodes[r])
4013
- throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);
4036
+ throw Error(
4037
+ `There is no node type named '${r}'. Maybe you forgot to add the extension?`
4038
+ );
4014
4039
  return e.nodes[r];
4015
4040
  }
4016
4041
  return r;
4017
4042
  }
4018
- var Zr = (r) => ({ tr: e, state: t, dispatch: n }) => {
4043
+ var ni = (r) => ({ tr: e, state: t, dispatch: n }) => {
4019
4044
  const i = N(r, t.schema), s = e.selection.$anchor;
4020
4045
  for (let o = s.depth; o > 0; o -= 1)
4021
4046
  if (s.node(o).type === i) {
@@ -4026,40 +4051,40 @@ var Zr = (r) => ({ tr: e, state: t, dispatch: n }) => {
4026
4051
  return !0;
4027
4052
  }
4028
4053
  return !1;
4029
- }, Gr = (r) => ({ tr: e, dispatch: t }) => {
4054
+ }, ri = (r) => ({ tr: e, dispatch: t }) => {
4030
4055
  const { from: n, to: i } = r;
4031
4056
  return t && e.delete(n, i), !0;
4032
- }, ei = (r) => r.content ? /^text(\*|\+)/.test(r.content) : !1, Nt = (r, e, t) => {
4057
+ }, ii = (r) => r.content ? /^text(\*|\+)/.test(r.content) : !1, Nt = (r, e, t) => {
4033
4058
  if (!r.parent.isInline || t === "left" && r.pos > r.start() || t === "right" && r.pos < r.end())
4034
4059
  return r.pos;
4035
4060
  const n = e.nodes[r.parent.type.name].spec;
4036
- return ei(n) ? t === "left" ? r.start() - 1 : r.end() + 1 : r.pos;
4037
- }, ti = (r, e, t) => {
4061
+ return ii(n) ? t === "left" ? r.start() - 1 : r.end() + 1 : r.pos;
4062
+ }, si = (r, e, t) => {
4038
4063
  const n = Nt(r, t, "left"), i = Nt(e, t, "right");
4039
4064
  return { from: n, to: i };
4040
- }, ni = () => ({ state: r, dispatch: e }) => {
4065
+ }, oi = () => ({ state: r, dispatch: e }) => {
4041
4066
  const { $from: t, $to: n } = r.selection;
4042
4067
  if (r.selection.empty)
4043
4068
  return !1;
4044
- const { from: i, to: s } = ti(t, n, r.schema);
4069
+ const { from: i, to: s } = si(t, n, r.schema);
4045
4070
  return e && (r.tr.deleteRange(i, s).scrollIntoView(), e(r.tr)), !0;
4046
- }, ri = () => ({ commands: r }) => r.keyboardShortcut("Enter"), ii = () => ({ state: r, dispatch: e }) => Ar(r, e);
4047
- function si(r) {
4071
+ }, li = () => ({ commands: r }) => r.keyboardShortcut("Enter"), ai = () => ({ state: r, dispatch: e }) => zr(r, e);
4072
+ function ci(r) {
4048
4073
  return Object.prototype.toString.call(r) === "[object RegExp]";
4049
4074
  }
4050
- function Ie(r, e, t = { strict: !0 }) {
4075
+ function Re(r, e, t = { strict: !0 }) {
4051
4076
  const n = Object.keys(e);
4052
- return n.length ? n.every((i) => t.strict ? e[i] === r[i] : si(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
4077
+ return n.length ? n.every((i) => t.strict ? e[i] === r[i] : ci(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
4053
4078
  }
4054
- function kn(r, e, t = {}) {
4055
- return r.find((n) => n.type === e && Ie(
4079
+ function bn(r, e, t = {}) {
4080
+ return r.find((n) => n.type === e && Re(
4056
4081
  // Only check equality for the attributes that are provided
4057
4082
  Object.fromEntries(Object.keys(t).map((i) => [i, n.attrs[i]])),
4058
4083
  t
4059
4084
  ));
4060
4085
  }
4061
4086
  function zt(r, e, t = {}) {
4062
- return !!kn(r, e, t);
4087
+ return !!bn(r, e, t);
4063
4088
  }
4064
4089
  function ht(r, e, t) {
4065
4090
  if (!r || !e)
@@ -4071,7 +4096,7 @@ function ht(r, e, t) {
4071
4096
  const c = n.node.marks.find((f) => f.type === e);
4072
4097
  c && (t = c.attrs);
4073
4098
  }
4074
- if (!kn([...n.node.marks], e, t))
4099
+ if (!bn([...n.node.marks], e, t))
4075
4100
  return;
4076
4101
  let s = n.index, o = r.start() + n.offset, l = s + 1, a = o + n.node.nodeSize;
4077
4102
  for (; s > 0 && zt([...r.parent.child(s - 1).marks], e, t); )
@@ -4086,12 +4111,14 @@ function ht(r, e, t) {
4086
4111
  function ee(r, e) {
4087
4112
  if (typeof r == "string") {
4088
4113
  if (!e.marks[r])
4089
- throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);
4114
+ throw Error(
4115
+ `There is no mark type named '${r}'. Maybe you forgot to add the extension?`
4116
+ );
4090
4117
  return e.marks[r];
4091
4118
  }
4092
4119
  return r;
4093
4120
  }
4094
- var oi = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4121
+ var fi = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4095
4122
  const s = ee(r, n.schema), { doc: o, selection: l } = t, { $from: a, from: c, to: f } = l;
4096
4123
  if (i) {
4097
4124
  const u = ht(a, s, e);
@@ -4101,7 +4128,7 @@ var oi = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4101
4128
  }
4102
4129
  }
4103
4130
  return !0;
4104
- }, li = (r) => (e) => {
4131
+ }, ui = (r) => (e) => {
4105
4132
  const t = typeof r == "function" ? r(e) : r;
4106
4133
  for (let n = 0; n < t.length; n += 1)
4107
4134
  if (t[n](e))
@@ -4114,7 +4141,7 @@ function pt(r) {
4114
4141
  function U(r = 0, e = 0, t = 0) {
4115
4142
  return Math.min(Math.max(r, e), t);
4116
4143
  }
4117
- function ai(r, e = null) {
4144
+ function di(r, e = null) {
4118
4145
  if (!e)
4119
4146
  return null;
4120
4147
  const t = re.atStart(r), n = re.atEnd(r);
@@ -4123,25 +4150,35 @@ function ai(r, e = null) {
4123
4150
  if (e === "end")
4124
4151
  return n;
4125
4152
  const i = t.from, s = n.to;
4126
- return e === "all" ? J.create(r, U(0, i, s), U(r.content.size, i, s)) : J.create(r, U(e, i, s), U(e, i, s));
4153
+ return e === "all" ? J.create(
4154
+ r,
4155
+ U(0, i, s),
4156
+ U(r.content.size, i, s)
4157
+ ) : J.create(
4158
+ r,
4159
+ U(e, i, s),
4160
+ U(e, i, s)
4161
+ );
4127
4162
  }
4128
4163
  function tt() {
4129
4164
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
4130
4165
  }
4131
4166
  function ge() {
4132
- return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
4167
+ return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
4168
+ navigator.platform
4169
+ ) || // iPad on iOS 13 detection
4133
4170
  navigator.userAgent.includes("Mac") && "ontouchend" in document;
4134
4171
  }
4135
- function ci() {
4172
+ function hi() {
4136
4173
  return typeof navigator < "u" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : !1;
4137
4174
  }
4138
- var fi = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
4175
+ var pi = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
4139
4176
  e = {
4140
4177
  scrollIntoView: !0,
4141
4178
  ...e
4142
4179
  };
4143
4180
  const o = () => {
4144
- (ge() || tt()) && n.dom.focus(), ci() && !ge() && !tt() && n.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
4181
+ (ge() || tt()) && n.dom.focus(), hi() && !ge() && !tt() && n.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
4145
4182
  t.isDestroyed || (n.focus(), e != null && e.scrollIntoView && t.commands.scrollIntoView());
4146
4183
  });
4147
4184
  };
@@ -4153,24 +4190,30 @@ var fi = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
4153
4190
  }
4154
4191
  if (s && r === null && !pt(t.state.selection))
4155
4192
  return o(), !0;
4156
- const l = ai(i.doc, r) || t.state.selection, a = t.state.selection.eq(l);
4193
+ const l = di(i.doc, r) || t.state.selection, a = t.state.selection.eq(l);
4157
4194
  return s && (a || i.setSelection(l), a && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
4158
- }, ui = (r, e) => (t) => r.every((n, i) => e(n, { ...t, index: i })), di = (r, e) => ({ tr: t, commands: n }) => n.insertContentAt({ from: t.selection.from, to: t.selection.to }, r, e), xn = (r) => {
4195
+ }, mi = (r, e) => (t) => r.every((n, i) => e(n, { ...t, index: i })), gi = (r, e) => ({ tr: t, commands: n }) => n.insertContentAt(
4196
+ { from: t.selection.from, to: t.selection.to },
4197
+ r,
4198
+ e
4199
+ ), Sn = (r) => {
4159
4200
  const e = r.childNodes;
4160
4201
  for (let t = e.length - 1; t >= 0; t -= 1) {
4161
4202
  const n = e[t];
4162
- n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 && xn(n);
4203
+ n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 && Sn(n);
4163
4204
  }
4164
4205
  return r;
4165
4206
  };
4166
- function Se(r) {
4207
+ function Me(r) {
4167
4208
  if (typeof window > "u")
4168
- throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
4209
+ throw new Error(
4210
+ "[tiptap error]: there is no window object available, so this function cannot be used"
4211
+ );
4169
4212
  const e = `<body>${r}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
4170
- return xn(t);
4213
+ return Sn(t);
4171
4214
  }
4172
4215
  function ye(r, e, t) {
4173
- if (r instanceof Bn || r instanceof ie)
4216
+ if (r instanceof Wn || r instanceof ie)
4174
4217
  return r;
4175
4218
  t = {
4176
4219
  slice: !0,
@@ -4192,7 +4235,7 @@ function ye(r, e, t) {
4192
4235
  if (i) {
4193
4236
  if (t.errorOnInvalidContent) {
4194
4237
  let o = !1, l = "";
4195
- const a = new Dn({
4238
+ const a = new Jn({
4196
4239
  topNode: e.spec.topNode,
4197
4240
  marks: e.spec.marks,
4198
4241
  // Prosemirror's schemas are executed such that: the last to execute, matches last
@@ -4210,22 +4253,28 @@ function ye(r, e, t) {
4210
4253
  }
4211
4254
  })
4212
4255
  });
4213
- if (t.slice ? De.fromSchema(a).parseSlice(Se(r), t.parseOptions) : De.fromSchema(a).parse(Se(r), t.parseOptions), t.errorOnInvalidContent && o)
4256
+ if (t.slice ? Fe.fromSchema(a).parseSlice(
4257
+ Me(r),
4258
+ t.parseOptions
4259
+ ) : Fe.fromSchema(a).parse(
4260
+ Me(r),
4261
+ t.parseOptions
4262
+ ), t.errorOnInvalidContent && o)
4214
4263
  throw new Error("[tiptap error]: Invalid HTML content", {
4215
4264
  cause: new Error(`Invalid element found: ${l}`)
4216
4265
  });
4217
4266
  }
4218
- const s = De.fromSchema(e);
4219
- return t.slice ? s.parseSlice(Se(r), t.parseOptions).content : s.parse(Se(r), t.parseOptions);
4267
+ const s = Fe.fromSchema(e);
4268
+ return t.slice ? s.parseSlice(Me(r), t.parseOptions).content : s.parse(Me(r), t.parseOptions);
4220
4269
  }
4221
4270
  return ye("", e, t);
4222
4271
  }
4223
- function hi(r, e, t) {
4272
+ function yi(r, e, t) {
4224
4273
  const n = r.steps.length - 1;
4225
4274
  if (n < e)
4226
4275
  return;
4227
4276
  const i = r.steps[n];
4228
- if (!(i instanceof T || i instanceof A))
4277
+ if (!(i instanceof C || i instanceof A))
4229
4278
  return;
4230
4279
  const s = r.mapping.maps[n];
4231
4280
  let o = 0;
@@ -4233,7 +4282,7 @@ function hi(r, e, t) {
4233
4282
  o === 0 && (o = f);
4234
4283
  }), r.setSelection(re.near(r.doc.resolve(o), t));
4235
4284
  }
4236
- var pi = (r) => !("type" in r), mi = (r, e, t) => ({ tr: n, dispatch: i, editor: s }) => {
4285
+ var wi = (r) => !("type" in r), ki = (r, e, t) => ({ tr: n, dispatch: i, editor: s }) => {
4237
4286
  var o;
4238
4287
  if (i) {
4239
4288
  t = {
@@ -4274,7 +4323,7 @@ var pi = (r) => !("type" in r), mi = (r, e, t) => ({ tr: n, dispatch: i, editor:
4274
4323
  return a(g), !1;
4275
4324
  }
4276
4325
  let { from: f, to: u } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, d = !0, h = !0;
4277
- if ((pi(l) ? l : [l]).forEach((g) => {
4326
+ if ((wi(l) ? l : [l]).forEach((g) => {
4278
4327
  g.check(), d = d ? g.isText && g.marks.length === 0 : !1, h = h ? g.isBlock : !1;
4279
4328
  }), f === u && h) {
4280
4329
  const { parent: g } = n.doc.resolve(f);
@@ -4296,28 +4345,28 @@ var pi = (r) => !("type" in r), mi = (r, e, t) => ({ tr: n, dispatch: i, editor:
4296
4345
  const g = n.doc.resolve(f), y = g.node(), x = g.parentOffset === 0, v = y.isText || y.isTextblock, S = y.content.size > 0;
4297
4346
  x && v && S && h && (f = Math.max(0, f - 1)), n.replaceWith(f, u, m);
4298
4347
  }
4299
- t.updateSelection && hi(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: f, text: m }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: f, text: m });
4348
+ t.updateSelection && yi(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: f, text: m }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: f, text: m });
4300
4349
  }
4301
4350
  return !0;
4302
- }, gi = () => ({ state: r, dispatch: e }) => Er(r, e), yi = () => ({ state: r, dispatch: e }) => Cr(r, e), wi = () => ({ state: r, dispatch: e }) => on(r, e), ki = () => ({ state: r, dispatch: e }) => fn(r, e), xi = () => ({ state: r, dispatch: e, tr: t }) => {
4351
+ }, xi = () => ({ state: r, dispatch: e }) => Ir(r, e), vi = () => ({ state: r, dispatch: e }) => Rr(r, e), bi = () => ({ state: r, dispatch: e }) => cn(r, e), Si = () => ({ state: r, dispatch: e }) => hn(r, e), Mi = () => ({ state: r, dispatch: e, tr: t }) => {
4303
4352
  try {
4304
- const n = Re(r.doc, r.selection.$from.pos, -1);
4353
+ const n = Ne(r.doc, r.selection.$from.pos, -1);
4305
4354
  return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
4306
4355
  } catch {
4307
4356
  return !1;
4308
4357
  }
4309
- }, vi = () => ({ state: r, dispatch: e, tr: t }) => {
4358
+ }, Ei = () => ({ state: r, dispatch: e, tr: t }) => {
4310
4359
  try {
4311
- const n = Re(r.doc, r.selection.$from.pos, 1);
4360
+ const n = Ne(r.doc, r.selection.$from.pos, 1);
4312
4361
  return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
4313
4362
  } catch {
4314
4363
  return !1;
4315
4364
  }
4316
- }, bi = () => ({ state: r, dispatch: e }) => Sr(r, e), Si = () => ({ state: r, dispatch: e }) => Mr(r, e);
4317
- function vn() {
4365
+ }, Ci = () => ({ state: r, dispatch: e }) => Tr(r, e), Ti = () => ({ state: r, dispatch: e }) => Ar(r, e);
4366
+ function Mn() {
4318
4367
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
4319
4368
  }
4320
- function Mi(r) {
4369
+ function Ai(r) {
4321
4370
  const e = r.split(/-(?!$)/);
4322
4371
  let t = e[e.length - 1];
4323
4372
  t === "Space" && (t = " ");
@@ -4333,14 +4382,14 @@ function Mi(r) {
4333
4382
  else if (/^s(hift)?$/i.test(a))
4334
4383
  s = !0;
4335
4384
  else if (/^mod$/i.test(a))
4336
- ge() || vn() ? o = !0 : i = !0;
4385
+ ge() || Mn() ? o = !0 : i = !0;
4337
4386
  else
4338
4387
  throw new Error(`Unrecognized modifier name: ${a}`);
4339
4388
  }
4340
4389
  return n && (t = `Alt-${t}`), i && (t = `Ctrl-${t}`), o && (t = `Meta-${t}`), s && (t = `Shift-${t}`), t;
4341
4390
  }
4342
- var Ei = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
4343
- const s = Mi(r).split(/-(?!$)/), o = s.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
4391
+ var Ii = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
4392
+ const s = Ai(r).split(/-(?!$)/), o = s.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
4344
4393
  key: o === "Space" ? " " : o,
4345
4394
  altKey: s.includes("Alt"),
4346
4395
  ctrlKey: s.includes("Ctrl"),
@@ -4368,26 +4417,26 @@ function we(r, e, t = {}) {
4368
4417
  to: p
4369
4418
  });
4370
4419
  });
4371
- const a = i - n, c = l.filter((u) => o ? o.name === u.node.type.name : !0).filter((u) => Ie(u.node.attrs, t, { strict: !1 }));
4420
+ const a = i - n, c = l.filter((u) => o ? o.name === u.node.type.name : !0).filter((u) => Re(u.node.attrs, t, { strict: !1 }));
4372
4421
  return s ? !!c.length : c.reduce((u, d) => u + d.to - d.from, 0) >= a;
4373
4422
  }
4374
- var Ci = (r, e = {}) => ({ state: t, dispatch: n }) => {
4423
+ var Ri = (r, e = {}) => ({ state: t, dispatch: n }) => {
4375
4424
  const i = N(r, t.schema);
4376
- return we(t, i, e) ? Tr(t, n) : !1;
4377
- }, Ti = () => ({ state: r, dispatch: e }) => pn(r, e), Ai = (r) => ({ state: e, dispatch: t }) => {
4425
+ return we(t, i, e) ? Nr(t, n) : !1;
4426
+ }, Ni = () => ({ state: r, dispatch: e }) => yn(r, e), zi = (r) => ({ state: e, dispatch: t }) => {
4378
4427
  const n = N(r, e.schema);
4379
- return Lr(n)(e, t);
4380
- }, Ii = () => ({ state: r, dispatch: e }) => dn(r, e);
4381
- function Oe(r, e) {
4428
+ return Hr(n)(e, t);
4429
+ }, Oi = () => ({ state: r, dispatch: e }) => mn(r, e);
4430
+ function $e(r, e) {
4382
4431
  return e.nodes[r] ? "node" : e.marks[r] ? "mark" : null;
4383
4432
  }
4384
4433
  function Ot(r, e) {
4385
4434
  const t = typeof e == "string" ? [e] : e;
4386
4435
  return Object.keys(r).reduce((n, i) => (t.includes(i) || (n[i] = r[i]), n), {});
4387
4436
  }
4388
- var Ri = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4437
+ var $i = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4389
4438
  let s = null, o = null;
4390
- const l = Oe(
4439
+ const l = $e(
4391
4440
  typeof r == "string" ? r : r.name,
4392
4441
  n.schema
4393
4442
  );
@@ -4398,28 +4447,32 @@ var Ri = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4398
4447
  return t.selection.ranges.forEach((c) => {
4399
4448
  n.doc.nodesBetween(c.$from.pos, c.$to.pos, (f, u) => {
4400
4449
  s && s === f.type && (a = !0, i && t.setNodeMarkup(u, void 0, Ot(f.attrs, e))), o && f.marks.length && f.marks.forEach((d) => {
4401
- o === d.type && (a = !0, i && t.addMark(u, u + f.nodeSize, o.create(Ot(d.attrs, e))));
4450
+ o === d.type && (a = !0, i && t.addMark(
4451
+ u,
4452
+ u + f.nodeSize,
4453
+ o.create(Ot(d.attrs, e))
4454
+ ));
4402
4455
  });
4403
4456
  });
4404
4457
  }), a;
4405
- }, Ni = () => ({ tr: r, dispatch: e }) => (e && r.scrollIntoView(), !0), zi = () => ({ tr: r, dispatch: e }) => {
4458
+ }, Pi = () => ({ tr: r, dispatch: e }) => (e && r.scrollIntoView(), !0), Bi = () => ({ tr: r, dispatch: e }) => {
4406
4459
  if (e) {
4407
- const t = new $n(r.doc);
4460
+ const t = new Fn(r.doc);
4408
4461
  r.setSelection(t);
4409
4462
  }
4410
4463
  return !0;
4411
- }, Oi = () => ({ state: r, dispatch: e }) => an(r, e), $i = () => ({ state: r, dispatch: e }) => un(r, e), Pi = () => ({ state: r, dispatch: e }) => Nr(r, e), Bi = () => ({ state: r, dispatch: e }) => $r(r, e), Di = () => ({ state: r, dispatch: e }) => Or(r, e);
4412
- function Fi(r, e, t = {}, n = {}) {
4464
+ }, Di = () => ({ state: r, dispatch: e }) => un(r, e), Fi = () => ({ state: r, dispatch: e }) => pn(r, e), Li = () => ({ state: r, dispatch: e }) => Pr(r, e), Wi = () => ({ state: r, dispatch: e }) => Fr(r, e), Ji = () => ({ state: r, dispatch: e }) => Dr(r, e);
4465
+ function ji(r, e, t = {}, n = {}) {
4413
4466
  return ye(r, e, {
4414
4467
  slice: !1,
4415
4468
  parseOptions: t,
4416
4469
  errorOnInvalidContent: n.errorOnInvalidContent
4417
4470
  });
4418
4471
  }
4419
- var Li = (r, { errorOnInvalidContent: e, emitUpdate: t = !0, parseOptions: n = {} } = {}) => ({ editor: i, tr: s, dispatch: o, commands: l }) => {
4472
+ var Hi = (r, { errorOnInvalidContent: e, emitUpdate: t = !0, parseOptions: n = {} } = {}) => ({ editor: i, tr: s, dispatch: o, commands: l }) => {
4420
4473
  const { doc: a } = s;
4421
4474
  if (n.preserveWhitespace !== "full") {
4422
- const c = Fi(r, i.schema, n, {
4475
+ const c = ji(r, i.schema, n, {
4423
4476
  errorOnInvalidContent: e ?? i.options.enableContentCheck
4424
4477
  });
4425
4478
  return o && s.replaceWith(0, a.content.size, c).setMeta("preventUpdate", !t), !0;
@@ -4429,7 +4482,7 @@ var Li = (r, { errorOnInvalidContent: e, emitUpdate: t = !0, parseOptions: n = {
4429
4482
  errorOnInvalidContent: e ?? i.options.enableContentCheck
4430
4483
  });
4431
4484
  };
4432
- function bn(r, e) {
4485
+ function En(r, e) {
4433
4486
  const t = ee(e, r.schema), { from: n, to: i, empty: s } = r.selection, o = [];
4434
4487
  s ? (r.storedMarks && o.push(...r.storedMarks), o.push(...r.selection.$head.marks())) : r.doc.nodesBetween(n, i, (a) => {
4435
4488
  o.push(...a.marks);
@@ -4437,15 +4490,15 @@ function bn(r, e) {
4437
4490
  const l = o.find((a) => a.type.name === t.name);
4438
4491
  return l ? { ...l.attrs } : {};
4439
4492
  }
4440
- function Wi(r, e) {
4441
- const t = new xr(r);
4493
+ function _i(r, e) {
4494
+ const t = new Mr(r);
4442
4495
  return e.forEach((n) => {
4443
4496
  n.steps.forEach((i) => {
4444
4497
  t.step(i);
4445
4498
  });
4446
4499
  }), t;
4447
4500
  }
4448
- function Ji(r) {
4501
+ function Vi(r) {
4449
4502
  for (let e = 0; e < r.edgeCount; e += 1) {
4450
4503
  const { type: t } = r.edge(e);
4451
4504
  if (t.isTextblock && !t.hasRequiredAttrs())
@@ -4453,7 +4506,7 @@ function Ji(r) {
4453
4506
  }
4454
4507
  return null;
4455
4508
  }
4456
- function Ks(r, e) {
4509
+ function Gs(r, e) {
4457
4510
  const t = [];
4458
4511
  return r.descendants((n, i) => {
4459
4512
  e(n) && t.push({
@@ -4462,7 +4515,7 @@ function Ks(r, e) {
4462
4515
  });
4463
4516
  }), t;
4464
4517
  }
4465
- function Xs(r, e, t) {
4518
+ function Zs(r, e, t) {
4466
4519
  const n = [];
4467
4520
  return r.nodesBetween(e.from, e.to, (i, s) => {
4468
4521
  t(i) && n.push({
@@ -4471,7 +4524,7 @@ function Xs(r, e, t) {
4471
4524
  });
4472
4525
  }), n;
4473
4526
  }
4474
- function ji(r, e) {
4527
+ function qi(r, e) {
4475
4528
  for (let t = r.depth; t > 0; t -= 1) {
4476
4529
  const n = r.node(t);
4477
4530
  if (e(n))
@@ -4483,8 +4536,8 @@ function ji(r, e) {
4483
4536
  };
4484
4537
  }
4485
4538
  }
4486
- function $e(r) {
4487
- return (e) => ji(e.$from, r);
4539
+ function Pe(r) {
4540
+ return (e) => qi(e.$from, r);
4488
4541
  }
4489
4542
  function ke(r, e, t) {
4490
4543
  return r.config[e] === void 0 && r.parent ? ke(r.parent, e, t) : typeof r.config[e] == "function" ? r.config[e].bind({
@@ -4492,21 +4545,23 @@ function ke(r, e, t) {
4492
4545
  parent: r.parent ? ke(r.parent, e, t) : null
4493
4546
  }) : r.config[e];
4494
4547
  }
4495
- function Hi(r) {
4548
+ function Ui(r) {
4496
4549
  return typeof r == "function";
4497
4550
  }
4498
4551
  function V(r, e = void 0, ...t) {
4499
- return Hi(r) ? e ? r.bind(e)(...t) : r(...t) : r;
4552
+ return Ui(r) ? e ? r.bind(e)(...t) : r(...t) : r;
4500
4553
  }
4501
- function Sn(r) {
4502
- const e = r.filter((i) => i.type === "extension"), t = r.filter((i) => i.type === "node"), n = r.filter((i) => i.type === "mark");
4554
+ function Cn(r) {
4555
+ const e = r.filter(
4556
+ (i) => i.type === "extension"
4557
+ ), t = r.filter((i) => i.type === "node"), n = r.filter((i) => i.type === "mark");
4503
4558
  return {
4504
4559
  baseExtensions: e,
4505
4560
  nodeExtensions: t,
4506
4561
  markExtensions: n
4507
4562
  };
4508
4563
  }
4509
- function _i(r) {
4564
+ function Ki(r) {
4510
4565
  const e = [];
4511
4566
  let t = "", n = !1, i = !1, s = 0;
4512
4567
  const o = r.length;
@@ -4539,7 +4594,7 @@ function _i(r) {
4539
4594
  return t && e.push(t), e;
4540
4595
  }
4541
4596
  function $t(r) {
4542
- const e = [], t = _i(r || ""), n = t.length;
4597
+ const e = [], t = Ki(r || ""), n = t.length;
4543
4598
  for (let i = 0; i < n; i += 1) {
4544
4599
  const s = t[i], o = s.indexOf(":");
4545
4600
  if (o === -1)
@@ -4549,7 +4604,7 @@ function $t(r) {
4549
4604
  }
4550
4605
  return e;
4551
4606
  }
4552
- function Vi(...r) {
4607
+ function Xi(...r) {
4553
4608
  return r.filter((e) => !!e).reduce((e, t) => {
4554
4609
  const n = { ...e };
4555
4610
  return Object.entries(t).forEach(([i, s]) => {
@@ -4558,22 +4613,27 @@ function Vi(...r) {
4558
4613
  return;
4559
4614
  }
4560
4615
  if (i === "class") {
4561
- const l = s ? String(s).split(" ") : [], a = n[i] ? n[i].split(" ") : [], c = l.filter((f) => !a.includes(f));
4616
+ const l = s ? String(s).split(" ") : [], a = n[i] ? n[i].split(" ") : [], c = l.filter(
4617
+ (f) => !a.includes(f)
4618
+ );
4562
4619
  n[i] = [...a, ...c].join(" ");
4563
4620
  } else if (i === "style") {
4564
- const l = new Map([...$t(n[i]), ...$t(s)]);
4621
+ const l = new Map([
4622
+ ...$t(n[i]),
4623
+ ...$t(s)
4624
+ ]);
4565
4625
  n[i] = Array.from(l.entries()).map(([a, c]) => `${a}: ${c}`).join("; ");
4566
4626
  } else
4567
4627
  n[i] = s;
4568
4628
  }), n;
4569
4629
  }, {});
4570
4630
  }
4571
- function Ys(r, e) {
4631
+ function eo(r, e) {
4572
4632
  return e.filter((t) => t.type === r.type.name).filter((t) => t.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(r.attrs) || {} : {
4573
4633
  [t.name]: r.attrs[t.name]
4574
- }).reduce((t, n) => Vi(t, n), {});
4634
+ }).reduce((t, n) => Xi(t, n), {});
4575
4635
  }
4576
- function Mn(r, e, t) {
4636
+ function Tn(r, e, t) {
4577
4637
  const { from: n, to: i } = e, { blockSeparator: s = `
4578
4638
 
4579
4639
  `, textSerializers: o = {} } = t || {};
@@ -4593,19 +4653,19 @@ function Mn(r, e, t) {
4593
4653
  a.isText && (l += (d = a == null ? void 0 : a.text) == null ? void 0 : d.slice(Math.max(n, c) - c, i - c));
4594
4654
  }), l;
4595
4655
  }
4596
- function Qs(r, e) {
4656
+ function to(r, e) {
4597
4657
  const t = {
4598
4658
  from: 0,
4599
4659
  to: r.content.size
4600
4660
  };
4601
- return Mn(r, t, e);
4661
+ return Tn(r, t, e);
4602
4662
  }
4603
- function qi(r) {
4663
+ function Yi(r) {
4604
4664
  return Object.fromEntries(
4605
4665
  Object.entries(r.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText])
4606
4666
  );
4607
4667
  }
4608
- function Ui(r, e) {
4668
+ function Qi(r, e) {
4609
4669
  const t = N(e, r.schema), { from: n, to: i } = r.selection, s = [];
4610
4670
  r.doc.nodesBetween(n, i, (l) => {
4611
4671
  s.push(l);
@@ -4613,25 +4673,25 @@ function Ui(r, e) {
4613
4673
  const o = s.reverse().find((l) => l.type.name === t.name);
4614
4674
  return o ? { ...o.attrs } : {};
4615
4675
  }
4616
- function Zs(r, e) {
4617
- const t = Oe(
4676
+ function no(r, e) {
4677
+ const t = $e(
4618
4678
  typeof e == "string" ? e : e.name,
4619
4679
  r.schema
4620
4680
  );
4621
- return t === "node" ? Ui(r, e) : t === "mark" ? bn(r, e) : {};
4681
+ return t === "node" ? Qi(r, e) : t === "mark" ? En(r, e) : {};
4622
4682
  }
4623
- function Ki(r, e = JSON.stringify) {
4683
+ function Gi(r, e = JSON.stringify) {
4624
4684
  const t = {};
4625
4685
  return r.filter((n) => {
4626
4686
  const i = e(n);
4627
4687
  return Object.prototype.hasOwnProperty.call(t, i) ? !1 : t[i] = !0;
4628
4688
  });
4629
4689
  }
4630
- function Xi(r) {
4631
- const e = Ki(r);
4690
+ function Zi(r) {
4691
+ const e = Gi(r);
4632
4692
  return e.length === 1 ? e : e.filter((t, n) => !e.filter((s, o) => o !== n).some((s) => t.oldRange.from >= s.oldRange.from && t.oldRange.to <= s.oldRange.to && t.newRange.from >= s.newRange.from && t.newRange.to <= s.newRange.to));
4633
4693
  }
4634
- function Yi(r) {
4694
+ function es(r) {
4635
4695
  const { mapping: e, steps: t } = r, n = [];
4636
4696
  return e.maps.forEach((i, s) => {
4637
4697
  const o = [];
@@ -4658,9 +4718,9 @@ function Yi(r) {
4658
4718
  }
4659
4719
  });
4660
4720
  });
4661
- }), Xi(n);
4721
+ }), Zi(n);
4662
4722
  }
4663
- function En(r, e, t) {
4723
+ function An(r, e, t) {
4664
4724
  const n = [];
4665
4725
  return r === e ? t.resolve(r).marks().forEach((i) => {
4666
4726
  const s = t.resolve(r), o = ht(s, i.type);
@@ -4678,7 +4738,7 @@ function En(r, e, t) {
4678
4738
  );
4679
4739
  }), n;
4680
4740
  }
4681
- var Gs = (r, e, t, n = 20) => {
4741
+ var ro = (r, e, t, n = 20) => {
4682
4742
  const i = r.doc.resolve(t);
4683
4743
  let s = n, o = null;
4684
4744
  for (; s > 0 && o === null; ) {
@@ -4687,7 +4747,7 @@ var Gs = (r, e, t, n = 20) => {
4687
4747
  }
4688
4748
  return [o, s];
4689
4749
  };
4690
- function Te(r, e, t) {
4750
+ function Ae(r, e, t) {
4691
4751
  return Object.fromEntries(
4692
4752
  Object.entries(t).filter(([n]) => {
4693
4753
  const i = r.find((s) => s.type === e && s.name === n);
@@ -4698,7 +4758,7 @@ function Te(r, e, t) {
4698
4758
  function nt(r, e, t = {}) {
4699
4759
  const { empty: n, ranges: i } = r.selection, s = e ? ee(e, r.schema) : null;
4700
4760
  if (n)
4701
- return !!(r.storedMarks || r.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) => Ie(u.attrs, t, { strict: !1 }));
4761
+ return !!(r.storedMarks || r.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) => Re(u.attrs, t, { strict: !1 }));
4702
4762
  let o = 0;
4703
4763
  const l = [];
4704
4764
  if (i.forEach(({ $from: u, $to: d }) => {
@@ -4719,31 +4779,31 @@ function nt(r, e, t = {}) {
4719
4779
  });
4720
4780
  }), o === 0)
4721
4781
  return !1;
4722
- const a = l.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => Ie(u.mark.attrs, t, { strict: !1 })).reduce((u, d) => u + d.to - d.from, 0), c = l.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, d) => u + d.to - d.from, 0);
4782
+ const a = l.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => Re(u.mark.attrs, t, { strict: !1 })).reduce((u, d) => u + d.to - d.from, 0), c = l.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, d) => u + d.to - d.from, 0);
4723
4783
  return (a > 0 ? a + c : a) >= o;
4724
4784
  }
4725
- function eo(r, e, t = {}) {
4785
+ function io(r, e, t = {}) {
4726
4786
  if (!e)
4727
4787
  return we(r, null, t) || nt(r, null, t);
4728
- const n = Oe(e, r.schema);
4788
+ const n = $e(e, r.schema);
4729
4789
  return n === "node" ? we(r, e, t) : n === "mark" ? nt(r, e, t) : !1;
4730
4790
  }
4731
- var to = (r, e) => {
4791
+ var so = (r, e) => {
4732
4792
  const { $from: t, $to: n, $anchor: i } = r.selection;
4733
4793
  if (e) {
4734
- const s = $e((l) => l.type.name === e)(r.selection);
4794
+ const s = Pe((l) => l.type.name === e)(r.selection);
4735
4795
  if (!s)
4736
4796
  return !1;
4737
4797
  const o = r.doc.resolve(s.pos + 1);
4738
4798
  return i.pos + 1 === o.end();
4739
4799
  }
4740
4800
  return !(n.parentOffset < n.parent.nodeSize - 2 || t.pos !== n.pos);
4741
- }, no = (r) => {
4801
+ }, oo = (r) => {
4742
4802
  const { $from: e, $to: t } = r.selection;
4743
4803
  return !(e.parentOffset > 0 || e.pos !== t.pos);
4744
4804
  };
4745
4805
  function Ve(r, e) {
4746
- const { nodeExtensions: t } = Sn(e), n = t.find((o) => o.name === r);
4806
+ const { nodeExtensions: t } = Cn(e), n = t.find((o) => o.name === r);
4747
4807
  if (!n)
4748
4808
  return !1;
4749
4809
  const i = {
@@ -4753,7 +4813,7 @@ function Ve(r, e) {
4753
4813
  }, s = V(ke(n, "group", i));
4754
4814
  return typeof s != "string" ? !1 : s.split(" ").includes("list");
4755
4815
  }
4756
- function Cn(r, {
4816
+ function In(r, {
4757
4817
  checkChildren: e = !0,
4758
4818
  ignoreWhitespace: t = !1
4759
4819
  } = {}) {
@@ -4773,15 +4833,15 @@ function Cn(r, {
4773
4833
  if (e) {
4774
4834
  let i = !0;
4775
4835
  return r.content.forEach((s) => {
4776
- i !== !1 && (Cn(s, { ignoreWhitespace: t, checkChildren: e }) || (i = !1));
4836
+ i !== !1 && (In(s, { ignoreWhitespace: t, checkChildren: e }) || (i = !1));
4777
4837
  }), i;
4778
4838
  }
4779
4839
  return !1;
4780
4840
  }
4781
- function ro(r) {
4841
+ function lo(r) {
4782
4842
  return r instanceof oe;
4783
4843
  }
4784
- function io({
4844
+ function ao({
4785
4845
  selection: r,
4786
4846
  pos: e,
4787
4847
  nodeSize: t,
@@ -4790,7 +4850,7 @@ function io({
4790
4850
  const { from: i, to: s } = r;
4791
4851
  return !!(i <= e && s >= e + t || n && pt(r) && i > e && s < e + t);
4792
4852
  }
4793
- var Qi = class Tn {
4853
+ var ts = class Rn {
4794
4854
  constructor(e) {
4795
4855
  this.position = e;
4796
4856
  }
@@ -4798,7 +4858,7 @@ var Qi = class Tn {
4798
4858
  * Creates a MappablePosition from a JSON object.
4799
4859
  */
4800
4860
  static fromJSON(e) {
4801
- return new Tn(e.position);
4861
+ return new Rn(e.position);
4802
4862
  }
4803
4863
  /**
4804
4864
  * Converts the MappablePosition to a JSON object.
@@ -4809,14 +4869,14 @@ var Qi = class Tn {
4809
4869
  };
4810
4870
  }
4811
4871
  };
4812
- function so(r, e) {
4872
+ function co(r, e) {
4813
4873
  const t = e.mapping.mapResult(r.position);
4814
4874
  return {
4815
- position: new Qi(t.pos),
4875
+ position: new ts(t.pos),
4816
4876
  mapResult: t
4817
4877
  };
4818
4878
  }
4819
- function oo(r, e, t) {
4879
+ function fo(r, e, t) {
4820
4880
  const i = r.state.doc.content.size, s = U(e, 0, i), o = U(t, 0, i), l = r.coordsAtPos(s), a = r.coordsAtPos(o, -1), c = Math.min(l.top, a.top), f = Math.max(l.bottom, a.bottom), u = Math.min(l.left, a.left), d = Math.max(l.right, a.right), h = d - u, p = f - c, y = {
4821
4881
  top: c,
4822
4882
  bottom: f,
@@ -4832,7 +4892,7 @@ function oo(r, e, t) {
4832
4892
  toJSON: () => y
4833
4893
  };
4834
4894
  }
4835
- function Zi(r, e, t) {
4895
+ function ns(r, e, t) {
4836
4896
  var n;
4837
4897
  const { selection: i } = e;
4838
4898
  let s = null;
@@ -4854,11 +4914,11 @@ function Zi(r, e, t) {
4854
4914
  }), c;
4855
4915
  });
4856
4916
  }
4857
- var Gi = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
4917
+ var rs = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
4858
4918
  const { selection: s } = t, { empty: o, ranges: l } = s, a = ee(r, n.schema);
4859
4919
  if (i)
4860
4920
  if (o) {
4861
- const c = bn(n, a);
4921
+ const c = En(n, a);
4862
4922
  t.addStoredMark(
4863
4923
  a.create({
4864
4924
  ...c,
@@ -4882,18 +4942,18 @@ var Gi = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
4882
4942
  }) : t.addMark(p, m, a.create(e));
4883
4943
  });
4884
4944
  });
4885
- return Zi(n, t, a);
4886
- }, es = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), ts = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
4945
+ return ns(n, t, a);
4946
+ }, is = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), ss = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
4887
4947
  const s = N(r, t.schema);
4888
4948
  let o;
4889
4949
  return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => Rt(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Rt(s, { ...o, ...e })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
4890
- }, ns = (r) => ({ tr: e, dispatch: t }) => {
4950
+ }, ls = (r) => ({ tr: e, dispatch: t }) => {
4891
4951
  if (t) {
4892
4952
  const { doc: n } = e, i = U(r, 0, n.content.size), s = oe.create(n, i);
4893
4953
  e.setSelection(s);
4894
4954
  }
4895
4955
  return !0;
4896
- }, rs = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4956
+ }, as = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
4897
4957
  const { selection: s } = n;
4898
4958
  let o, l;
4899
4959
  return typeof e == "number" ? (o = e, l = e) : e && "from" in e && "to" in e ? (o = e.from, l = e.to) : (o = s.from, l = s.to), i && t.doc.nodesBetween(o, l, (a, c) => {
@@ -4902,15 +4962,15 @@ var Gi = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
4902
4962
  dir: r
4903
4963
  });
4904
4964
  }), !0;
4905
- }, is = (r) => ({ tr: e, dispatch: t }) => {
4965
+ }, cs = (r) => ({ tr: e, dispatch: t }) => {
4906
4966
  if (t) {
4907
4967
  const { doc: n } = e, { from: i, to: s } = typeof r == "number" ? { from: r, to: r } : r, o = J.atStart(n).from, l = J.atEnd(n).to, a = U(i, o, l), c = U(s, o, l), f = J.create(n, a, c);
4908
4968
  e.setSelection(f);
4909
4969
  }
4910
4970
  return !0;
4911
- }, ss = (r) => ({ state: e, dispatch: t }) => {
4971
+ }, fs = (r) => ({ state: e, dispatch: t }) => {
4912
4972
  const n = N(r, e.schema);
4913
- return jr(n)(e, t);
4973
+ return qr(n)(e, t);
4914
4974
  };
4915
4975
  function Pt(r, e) {
4916
4976
  const t = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
@@ -4919,13 +4979,17 @@ function Pt(r, e) {
4919
4979
  r.tr.ensureMarks(n);
4920
4980
  }
4921
4981
  }
4922
- var ls = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
4923
- const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, f = Te(c, l.node().type.name, l.node().attrs);
4982
+ var us = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
4983
+ const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, f = Ae(
4984
+ c,
4985
+ l.node().type.name,
4986
+ l.node().attrs
4987
+ );
4924
4988
  if (s instanceof oe && s.node.isBlock)
4925
4989
  return !l.parentOffset || !K(o, l.pos) ? !1 : (n && (r && Pt(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
4926
4990
  if (!l.parent.isBlock)
4927
4991
  return !1;
4928
- const u = a.parentOffset === a.parent.content.size, d = l.depth === 0 ? void 0 : Ji(l.node(-1).contentMatchAt(l.indexAfter(-1)));
4992
+ const u = a.parentOffset === a.parent.content.size, d = l.depth === 0 ? void 0 : Vi(l.node(-1).contentMatchAt(l.indexAfter(-1)));
4929
4993
  let h = u && d ? [
4930
4994
  {
4931
4995
  type: d,
@@ -4945,7 +5009,7 @@ var ls = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor
4945
5009
  r && Pt(t, i.extensionManager.splittableMarks), e.scrollIntoView();
4946
5010
  }
4947
5011
  return p;
4948
- }, as = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
5012
+ }, ds = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
4949
5013
  var o;
4950
5014
  const l = N(r, n.schema), { $from: a, $to: c } = n.selection, f = n.selection.node;
4951
5015
  if (f && f.isBlock || a.depth < 2 || !a.sameParent(c))
@@ -4963,15 +5027,15 @@ var ls = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor
4963
5027
  for (let O = a.depth - x; O >= a.depth - 3; O -= 1)
4964
5028
  y = ie.from(a.node(O).copy(y));
4965
5029
  const v = (
4966
- // eslint-disable-next-line no-nested-ternary
5030
+ // oxlint-disable-next-line no-nested-ternary
4967
5031
  a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3
4968
5032
  ), S = {
4969
- ...Te(d, a.node().type.name, a.node().attrs),
5033
+ ...Ae(d, a.node().type.name, a.node().attrs),
4970
5034
  ...e
4971
5035
  }, b = ((o = l.contentMatch.defaultType) == null ? void 0 : o.createAndFill(S)) || void 0;
4972
5036
  y = y.append(ie.from(l.createAndFill(null, b) || void 0));
4973
5037
  const I = a.before(a.depth - (x - 1));
4974
- t.replace(I, a.after(-v), new Pn(y, 4 - x, 0));
5038
+ t.replace(I, a.after(-v), new Ln(y, 4 - x, 0));
4975
5039
  let R = -1;
4976
5040
  t.doc.nodesBetween(I, t.doc.content.size, (O, L) => {
4977
5041
  if (R > -1)
@@ -4982,10 +5046,10 @@ var ls = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor
4982
5046
  return !0;
4983
5047
  }
4984
5048
  const h = c.pos === a.end() ? u.contentMatchAt(0).defaultType : null, p = {
4985
- ...Te(d, u.type.name, u.attrs),
5049
+ ...Ae(d, u.type.name, u.attrs),
4986
5050
  ...e
4987
5051
  }, m = {
4988
- ...Te(d, a.node().type.name, a.node().attrs),
5052
+ ...Ae(d, a.node().type.name, a.node().attrs),
4989
5053
  ...e
4990
5054
  };
4991
5055
  t.delete(a.pos, c.pos);
@@ -5003,44 +5067,51 @@ var ls = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor
5003
5067
  t.ensureMarks(b);
5004
5068
  }
5005
5069
  return !0;
5006
- }, qe = (r, e) => {
5007
- const t = $e((o) => o.type === e)(r.selection);
5070
+ };
5071
+ function Bt(r) {
5072
+ return !r || r === "1" ? null : r;
5073
+ }
5074
+ function Nn(r, e) {
5075
+ return Bt(r) === Bt(e);
5076
+ }
5077
+ var qe = (r, e) => {
5078
+ const t = Pe((o) => o.type === e)(r.selection);
5008
5079
  if (!t)
5009
5080
  return !0;
5010
5081
  const n = r.doc.resolve(Math.max(0, t.pos - 1)).before(t.depth);
5011
5082
  if (n === void 0)
5012
5083
  return !0;
5013
5084
  const i = r.doc.nodeAt(n);
5014
- return t.node.type === (i == null ? void 0 : i.type) && G(r.doc, t.pos) && r.join(t.pos), !0;
5085
+ return !(t.node.type === (i == null ? void 0 : i.type) && Z(r.doc, t.pos)) || !Nn(t.node.attrs.type, i == null ? void 0 : i.attrs.type) || r.join(t.pos), !0;
5015
5086
  }, Ue = (r, e) => {
5016
- const t = $e((o) => o.type === e)(r.selection);
5087
+ const t = Pe((o) => o.type === e)(r.selection);
5017
5088
  if (!t)
5018
5089
  return !0;
5019
5090
  const n = r.doc.resolve(t.start).after(t.depth);
5020
5091
  if (n === void 0)
5021
5092
  return !0;
5022
5093
  const i = r.doc.nodeAt(n);
5023
- return t.node.type === (i == null ? void 0 : i.type) && G(r.doc, n) && r.join(n), !0;
5094
+ return !(t.node.type === (i == null ? void 0 : i.type) && Z(r.doc, n)) || !Nn(t.node.attrs.type, i == null ? void 0 : i.attrs.type) || r.join(n), !0;
5024
5095
  };
5025
- function cs(r) {
5096
+ function hs(r) {
5026
5097
  const e = r.doc, t = e.firstChild;
5027
5098
  if (!t)
5028
5099
  return null;
5029
5100
  const n = e.resolve(1), i = e.resolve(t.nodeSize - 1);
5030
5101
  return J.between(n, i);
5031
5102
  }
5032
- var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: f }) => {
5103
+ var ps = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: f }) => {
5033
5104
  const { extensions: u, splittableMarks: d } = i.extensionManager, h = N(r, o.schema), p = N(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: x } = m, v = y.blockRange(x), S = g || m.$to.parentOffset && m.$from.marks();
5034
5105
  if (!v)
5035
5106
  return !1;
5036
- const b = $e((_) => Ve(_.type.name, u))(m), I = m.from === 0 && m.to === o.doc.content.size, R = o.doc.content.content, O = R.length === 1 ? R[0] : null, L = I && O && Ve(O.type.name, u) ? {
5107
+ const b = Pe((_) => Ve(_.type.name, u))(m), I = m.from === 0 && m.to === o.doc.content.size, R = o.doc.content.content, O = R.length === 1 ? R[0] : null, L = I && O && Ve(O.type.name, u) ? {
5037
5108
  node: O,
5038
5109
  pos: 0
5039
- } : null, H = b ?? L, Be = !!b && v.depth >= 1 && v.depth - b.depth <= 1, fe = !!L;
5040
- if ((Be || fe) && H) {
5110
+ } : null, H = b ?? L, De = !!b && v.depth >= 1 && v.depth - b.depth <= 1, fe = !!L;
5111
+ if ((De || fe) && H) {
5041
5112
  if (H.node.type === h)
5042
5113
  return I && fe ? a().command(({ tr: _, dispatch: B }) => {
5043
- const $ = cs(_);
5114
+ const $ = hs(_);
5044
5115
  return $ ? (_.setSelection($), B && B(_), !0) : !1;
5045
5116
  }).liftListItem(p).run() : c.liftListItem(p);
5046
5117
  if (Ve(H.node.type.name, u) && h.validContent(H.node.content))
@@ -5050,17 +5121,17 @@ var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain:
5050
5121
  const _ = f().wrapInList(h, n), B = S.filter(($) => d.includes($.type.name));
5051
5122
  return s.ensureMarks(B), _ ? !0 : c.clearNodes();
5052
5123
  }).wrapInList(h, n).command(() => qe(s, h)).command(() => Ue(s, h)).run();
5053
- }, us = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
5124
+ }, ms = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
5054
5125
  const { extendEmptyMarkRange: s = !1 } = t, o = ee(r, n.schema);
5055
5126
  return nt(n, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
5056
- }, ds = (r, e, t = {}) => ({ state: n, commands: i }) => {
5127
+ }, gs = (r, e, t = {}) => ({ state: n, commands: i }) => {
5057
5128
  const s = N(r, n.schema), o = N(e, n.schema), l = we(n, s, t);
5058
5129
  let a;
5059
5130
  return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
5060
- }, hs = (r, e = {}) => ({ state: t, commands: n }) => {
5131
+ }, ys = (r, e = {}) => ({ state: t, commands: n }) => {
5061
5132
  const i = N(r, t.schema);
5062
5133
  return we(t, i, e) ? n.lift(i) : n.wrapIn(i, e);
5063
- }, ps = () => ({ state: r, dispatch: e }) => {
5134
+ }, ws = () => ({ state: r, dispatch: e }) => {
5064
5135
  const t = r.plugins;
5065
5136
  for (let n = 0; n < t.length; n += 1) {
5066
5137
  const i = t[n];
@@ -5080,12 +5151,22 @@ var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain:
5080
5151
  }
5081
5152
  }
5082
5153
  return !1;
5083
- }, ms = () => ({ tr: r, dispatch: e }) => {
5084
- const { selection: t } = r, { empty: n, ranges: i } = t;
5085
- return n || e && i.forEach((s) => {
5086
- r.removeMark(s.$from.pos, s.$to.pos);
5087
- }), !0;
5088
- }, gs = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
5154
+ }, ks = (r = {}) => ({ tr: e, dispatch: t, editor: n }) => {
5155
+ const { ignoreClearable: i = !1 } = r, { selection: s } = e, { empty: o, ranges: l } = s;
5156
+ if (o)
5157
+ return !0;
5158
+ const { nonClearableMarks: a } = n.extensionManager;
5159
+ if (t) {
5160
+ const c = Object.values(n.schema.marks).filter(
5161
+ (f) => i || !a.includes(f.name)
5162
+ );
5163
+ l.forEach((f) => {
5164
+ for (const u of c)
5165
+ e.removeMark(f.$from.pos, f.$to.pos, u);
5166
+ });
5167
+ }
5168
+ return !0;
5169
+ }, xs = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
5089
5170
  var s;
5090
5171
  const { extendEmptyMarkRange: o = !1 } = e, { selection: l } = t, a = ee(r, n.schema), { $from: c, empty: f, ranges: u } = l;
5091
5172
  if (!i)
@@ -5099,7 +5180,7 @@ var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain:
5099
5180
  t.removeMark(d.$from.pos, d.$to.pos, a);
5100
5181
  });
5101
5182
  return t.removeStoredMark(a), !0;
5102
- }, ys = (r) => ({ tr: e, state: t, dispatch: n }) => {
5183
+ }, vs = (r) => ({ tr: e, state: t, dispatch: n }) => {
5103
5184
  const { selection: i } = t;
5104
5185
  let s, o;
5105
5186
  return typeof r == "number" ? (s = r, o = r) : r && "from" in r && "to" in r ? (s = r.from, o = r.to) : (s = i.from, o = i.to), n && e.doc.nodesBetween(s, o, (l, a) => {
@@ -5108,9 +5189,9 @@ var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain:
5108
5189
  const c = { ...l.attrs };
5109
5190
  delete c.dir, e.setNodeMarkup(a, void 0, c);
5110
5191
  }), !0;
5111
- }, ws = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
5192
+ }, bs = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
5112
5193
  let s = null, o = null;
5113
- const l = Oe(
5194
+ const l = $e(
5114
5195
  typeof r == "string" ? r : r.name,
5115
5196
  n.schema
5116
5197
  );
@@ -5154,264 +5235,660 @@ var fs = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain:
5154
5235
  );
5155
5236
  }));
5156
5237
  }), a;
5157
- }, ks = (r, e = {}) => ({ state: t, dispatch: n }) => {
5238
+ }, Ss = (r, e = {}) => ({ state: t, dispatch: n }) => {
5158
5239
  const i = N(r, t.schema);
5159
- return Pr(i, e)(t, n);
5160
- }, xs = (r, e = {}) => ({ state: t, dispatch: n }) => {
5240
+ return Lr(i, e)(t, n);
5241
+ }, Ms = (r, e = {}) => ({ state: t, dispatch: n }) => {
5161
5242
  const i = N(r, t.schema);
5162
- return Br(i, e)(t, n);
5163
- }, Pe = class {
5164
- constructor(r) {
5165
- var e;
5166
- this.find = r.find, this.handler = r.handler, this.undoable = (e = r.undoable) != null ? e : !0;
5167
- }
5243
+ return Wr(i, e)(t, n);
5168
5244
  };
5169
- function vs(r) {
5170
- return Object.prototype.toString.call(r).slice(8, -1);
5245
+ function uo(r, e) {
5246
+ const { selection: t } = r, { $from: n } = t;
5247
+ if (t instanceof oe) {
5248
+ const s = n.index();
5249
+ return n.parent.canReplaceWith(s, s + 1, e);
5250
+ }
5251
+ let i = n.depth;
5252
+ for (; i >= 0; ) {
5253
+ const s = n.index(i);
5254
+ if (n.node(i).contentMatchAt(s).matchType(e))
5255
+ return !0;
5256
+ i -= 1;
5257
+ }
5258
+ return !1;
5171
5259
  }
5172
- function Me(r) {
5173
- return vs(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
5260
+ function ho(r, e, t) {
5261
+ const n = document.querySelector(`style[data-tiptap-style${`-${t}`}]`);
5262
+ if (n !== null)
5263
+ return n;
5264
+ const i = document.createElement("style");
5265
+ return e && i.setAttribute("nonce", e), i.setAttribute(`data-tiptap-style${`-${t}`}`, ""), i.innerHTML = r, document.getElementsByTagName("head")[0].appendChild(i), i;
5174
5266
  }
5175
- function An(r, e) {
5176
- const t = { ...r };
5177
- return Me(r) && Me(e) && Object.keys(e).forEach((n) => {
5178
- Me(e[n]) && Me(r[n]) ? t[n] = An(r[n], e[n]) : t[n] = e[n];
5179
- }), t;
5267
+ function po(r) {
5268
+ return r.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
5180
5269
  }
5181
- var mt = class {
5182
- constructor(r = {}) {
5183
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
5184
- name: this.name
5185
- }, this.config = {
5186
- ...this.config,
5187
- ...r
5188
- }, this.name = this.config.name;
5189
- }
5190
- get options() {
5191
- return {
5192
- ...V(
5193
- ke(this, "addOptions", {
5194
- name: this.name
5195
- })
5196
- ) || {}
5197
- };
5198
- }
5199
- get storage() {
5200
- return {
5201
- ...V(
5202
- ke(this, "addStorage", {
5203
- name: this.name,
5204
- options: this.options
5205
- })
5206
- ) || {}
5207
- };
5208
- }
5209
- configure(r = {}) {
5210
- const e = this.extend({
5211
- ...this.config,
5212
- addOptions: () => An(this.options, r)
5213
- });
5214
- return e.name = this.name, e.parent = this.parent, this.child = null, e;
5215
- }
5216
- extend(r = {}) {
5217
- const e = new this.constructor({ ...this.config, ...r });
5218
- return e.parent = this, this.child = e, e.name = "name" in r ? r.name : e.parent.name, e;
5219
- }
5220
- }, lo = class In extends mt {
5221
- constructor() {
5222
- super(...arguments), this.type = "mark";
5223
- }
5224
- /**
5225
- * Create a new Mark instance
5226
- * @param config - Mark configuration object or a function that returns a configuration object
5227
- */
5228
- static create(e = {}) {
5229
- const t = typeof e == "function" ? e() : e;
5230
- return new In(t);
5231
- }
5232
- static handleExit({ editor: e, mark: t }) {
5233
- const { tr: n } = e.state, i = e.state.selection.$from;
5234
- if (i.pos === i.end()) {
5235
- const o = i.marks();
5236
- if (!!!o.find((c) => (c == null ? void 0 : c.type.name) === t.name))
5237
- return !1;
5238
- const a = o.find((c) => (c == null ? void 0 : c.type.name) === t.name);
5239
- return a && n.removeStoredMark(a), n.insertText(" ", i.pos), e.view.dispatch(n), !0;
5240
- }
5241
- return !1;
5242
- }
5243
- configure(e) {
5244
- return super.configure(e);
5245
- }
5246
- extend(e) {
5247
- const t = typeof e == "function" ? e() : e;
5248
- return super.extend(t);
5270
+ function mo(r, e) {
5271
+ const t = r.getAttribute("style");
5272
+ if (!t)
5273
+ return null;
5274
+ const n = t.split(";").map((s) => s.trim()).filter(Boolean), i = e.toLowerCase();
5275
+ for (let s = n.length - 1; s >= 0; s -= 1) {
5276
+ const o = n[s], l = o.indexOf(":");
5277
+ if (l === -1)
5278
+ continue;
5279
+ if (o.slice(0, l).trim().toLowerCase() === i)
5280
+ return o.slice(l + 1).trim();
5249
5281
  }
5250
- };
5251
- function ao(r) {
5282
+ return null;
5283
+ }
5284
+ function go() {
5285
+ return typeof navigator < "u" ? /Firefox/.test(navigator.userAgent) : !1;
5286
+ }
5287
+ function yo(r) {
5252
5288
  return typeof r == "number";
5253
5289
  }
5254
- var Rn = class {
5255
- constructor(r) {
5256
- this.find = r.find, this.handler = r.handler;
5257
- }
5258
- }, bs = {};
5259
- dt(bs, {
5260
- ClipboardTextSerializer: () => Ss,
5261
- Commands: () => Ms,
5262
- Delete: () => Es,
5263
- Drop: () => Cs,
5264
- Editable: () => Ts,
5265
- FocusEvents: () => As,
5266
- Keymap: () => Is,
5267
- Paste: () => Rs,
5268
- Tabindex: () => Ns,
5269
- TextDirection: () => zs,
5270
- focusEventsPluginKey: () => zn
5290
+ function Es(r) {
5291
+ return Object.prototype.toString.call(r).slice(8, -1);
5292
+ }
5293
+ function Ee(r) {
5294
+ return Es(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
5295
+ }
5296
+ var Cs = {};
5297
+ dt(Cs, {
5298
+ createAtomBlockMarkdownSpec: () => Ts,
5299
+ createBlockMarkdownSpec: () => As,
5300
+ createInlineMarkdownSpec: () => Ns,
5301
+ parseAttributes: () => mt,
5302
+ parseIndentedBlocks: () => zs,
5303
+ renderNestedMarkdownContent: () => Os,
5304
+ serializeAttributes: () => gt
5271
5305
  });
5272
- var q = class Nn extends mt {
5273
- constructor() {
5274
- super(...arguments), this.type = "extension";
5275
- }
5276
- /**
5277
- * Create a new Extension instance
5278
- * @param config - Extension configuration object or a function that returns a configuration object
5279
- */
5280
- static create(e = {}) {
5281
- const t = typeof e == "function" ? e() : e;
5282
- return new Nn(t);
5283
- }
5284
- configure(e) {
5285
- return super.configure(e);
5286
- }
5287
- extend(e) {
5288
- const t = typeof e == "function" ? e() : e;
5289
- return super.extend(t);
5290
- }
5291
- }, Ss = q.create({
5292
- name: "clipboardTextSerializer",
5293
- addOptions() {
5294
- return {
5295
- blockSeparator: void 0
5296
- };
5297
- },
5298
- addProseMirrorPlugins() {
5299
- return [
5300
- new Q({
5301
- key: new Z("clipboardTextSerializer"),
5302
- props: {
5303
- clipboardTextSerializer: () => {
5304
- const { editor: r } = this, { state: e, schema: t } = r, { doc: n, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((f) => f.$from.pos)), l = Math.max(...s.map((f) => f.$to.pos)), a = qi(t);
5305
- return Mn(n, { from: o, to: l }, {
5306
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
5307
- textSerializers: a
5308
- });
5309
- }
5310
- }
5311
- })
5312
- ];
5313
- }
5314
- }), Ms = q.create({
5315
- name: "commands",
5316
- addCommands() {
5317
- return {
5318
- ...wn
5319
- };
5320
- }
5321
- }), Es = q.create({
5322
- name: "delete",
5323
- onUpdate({ transaction: r, appendedTransactions: e }) {
5324
- var t, n, i;
5325
- const s = () => {
5326
- var o, l, a, c;
5327
- if ((c = (a = (l = (o = this.editor.options.coreExtensionOptions) == null ? void 0 : o.delete) == null ? void 0 : l.filterTransaction) == null ? void 0 : a.call(l, r)) != null ? c : r.getMeta("y-sync$"))
5328
- return;
5329
- const f = Wi(r.before, [r, ...e]);
5330
- Yi(f).forEach((h) => {
5331
- f.mapping.mapResult(h.oldRange.from).deletedAfter && f.mapping.mapResult(h.oldRange.to).deletedBefore && f.before.nodesBetween(h.oldRange.from, h.oldRange.to, (p, m) => {
5332
- const g = m + p.nodeSize - 2, y = h.oldRange.from <= m && g <= h.oldRange.to;
5333
- this.editor.emit("delete", {
5334
- type: "node",
5335
- node: p,
5336
- from: m,
5337
- to: g,
5338
- newFrom: f.mapping.map(m),
5339
- newTo: f.mapping.map(g),
5340
- deletedRange: h.oldRange,
5341
- newRange: h.newRange,
5342
- partial: !y,
5343
- editor: this.editor,
5344
- transaction: r,
5345
- combinedTransform: f
5346
- });
5347
- });
5348
- });
5349
- const d = f.mapping;
5350
- f.steps.forEach((h, p) => {
5351
- var m, g;
5352
- if (h instanceof W) {
5353
- const y = d.slice(p).map(h.from, -1), x = d.slice(p).map(h.to), v = d.invert().map(y, -1), S = d.invert().map(x), b = y > 0 ? (m = f.doc.nodeAt(y - 1)) == null ? void 0 : m.marks.some((R) => R.eq(h.mark)) : !1, I = (g = f.doc.nodeAt(x)) == null ? void 0 : g.marks.some((R) => R.eq(h.mark));
5354
- this.editor.emit("delete", {
5355
- type: "mark",
5356
- mark: h.mark,
5357
- from: h.from,
5358
- to: h.to,
5359
- deletedRange: {
5360
- from: v,
5361
- to: S
5362
- },
5363
- newRange: {
5364
- from: y,
5365
- to: x
5366
- },
5367
- partial: !!(I || b),
5368
- editor: this.editor,
5369
- transaction: r,
5370
- combinedTransform: f
5371
- });
5372
- }
5373
- });
5374
- };
5375
- (i = (n = (t = this.editor.options.coreExtensionOptions) == null ? void 0 : t.delete) == null ? void 0 : n.async) == null || i ? setTimeout(s, 0) : s();
5376
- }
5377
- }), Cs = q.create({
5378
- name: "drop",
5379
- addProseMirrorPlugins() {
5380
- return [
5381
- new Q({
5382
- key: new Z("tiptapDrop"),
5383
- props: {
5384
- handleDrop: (r, e, t, n) => {
5385
- this.editor.emit("drop", {
5386
- editor: this.editor,
5387
- event: e,
5388
- slice: t,
5389
- moved: n
5390
- });
5391
- }
5392
- }
5393
- })
5394
- ];
5306
+ function mt(r) {
5307
+ if (!(r != null && r.trim()))
5308
+ return {};
5309
+ const e = {}, t = [], n = r.replace(/["']([^"']*)["']/g, (c) => (t.push(c), `__QUOTED_${t.length - 1}__`)), i = n.match(/(?:^|\s)\.([\w-]+)/g);
5310
+ if (i) {
5311
+ const c = i.map((f) => f.trim().slice(1));
5312
+ e.class = c.join(" ");
5395
5313
  }
5396
- }), Ts = q.create({
5397
- name: "editable",
5398
- addProseMirrorPlugins() {
5399
- return [
5314
+ const s = n.match(/(?:^|\s)#([\w-]+)/);
5315
+ s && (e.id = s[1]);
5316
+ const o = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
5317
+ Array.from(n.matchAll(o)).forEach(([, c, f]) => {
5318
+ var u;
5319
+ const d = parseInt(((u = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), h = t[d];
5320
+ h && (e[c] = h.slice(1, -1));
5321
+ });
5322
+ const a = n.replace(/(?:^|\s)\.([\w-]+)/g, "").replace(/(?:^|\s)#([\w-]+)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
5323
+ return a && a.split(/\s+/).filter(Boolean).forEach((f) => {
5324
+ f.match(/^[a-zA-Z][\w-]*$/) && (e[f] = !0);
5325
+ }), e;
5326
+ }
5327
+ function gt(r) {
5328
+ if (!r || Object.keys(r).length === 0)
5329
+ return "";
5330
+ const e = [];
5331
+ return r.class && String(r.class).split(/\s+/).filter(Boolean).forEach((n) => e.push(`.${n}`)), r.id && e.push(`#${r.id}`), Object.entries(r).forEach(([t, n]) => {
5332
+ t === "class" || t === "id" || (n === !0 ? e.push(t) : n !== !1 && n != null && e.push(`${t}="${String(n)}"`));
5333
+ }), e.join(" ");
5334
+ }
5335
+ function Ts(r) {
5336
+ const {
5337
+ nodeName: e,
5338
+ name: t,
5339
+ parseAttributes: n = mt,
5340
+ serializeAttributes: i = gt,
5341
+ defaultAttributes: s = {},
5342
+ requiredAttributes: o = [],
5343
+ allowedAttributes: l
5344
+ } = r, a = t || e, c = (f) => {
5345
+ if (!l)
5346
+ return f;
5347
+ const u = {};
5348
+ return l.forEach((d) => {
5349
+ d in f && (u[d] = f[d]);
5350
+ }), u;
5351
+ };
5352
+ return {
5353
+ parseMarkdown: (f, u) => {
5354
+ const d = { ...s, ...f.attributes };
5355
+ return u.createNode(e, d, []);
5356
+ },
5357
+ markdownTokenizer: {
5358
+ name: e,
5359
+ level: "block",
5360
+ start(f) {
5361
+ var u;
5362
+ const d = new RegExp(`^:::${a}(?:\\s|$)`, "m"), h = (u = f.match(d)) == null ? void 0 : u.index;
5363
+ return h !== void 0 ? h : -1;
5364
+ },
5365
+ tokenize(f, u, d) {
5366
+ const h = new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), p = f.match(h);
5367
+ if (!p)
5368
+ return;
5369
+ const m = p[1] || "", g = n(m);
5370
+ if (!o.find((x) => !(x in g)))
5371
+ return {
5372
+ type: e,
5373
+ raw: p[0],
5374
+ attributes: g
5375
+ };
5376
+ }
5377
+ },
5378
+ renderMarkdown: (f) => {
5379
+ const u = c(f.attrs || {}), d = i(u), h = d ? ` {${d}}` : "";
5380
+ return `:::${a}${h} :::`;
5381
+ }
5382
+ };
5383
+ }
5384
+ function As(r) {
5385
+ const {
5386
+ nodeName: e,
5387
+ name: t,
5388
+ getContent: n,
5389
+ parseAttributes: i = mt,
5390
+ serializeAttributes: s = gt,
5391
+ defaultAttributes: o = {},
5392
+ content: l = "block",
5393
+ allowedAttributes: a
5394
+ } = r, c = t || e, f = (u) => {
5395
+ if (!a)
5396
+ return u;
5397
+ const d = {};
5398
+ return a.forEach((h) => {
5399
+ h in u && (d[h] = u[h]);
5400
+ }), d;
5401
+ };
5402
+ return {
5403
+ parseMarkdown: (u, d) => {
5404
+ let h;
5405
+ if (n) {
5406
+ const m = n(u);
5407
+ h = typeof m == "string" ? [{ type: "text", text: m }] : m;
5408
+ } else l === "block" ? h = d.parseChildren(u.tokens || []) : h = d.parseInline(u.tokens || []);
5409
+ const p = { ...o, ...u.attributes };
5410
+ return d.createNode(e, p, h);
5411
+ },
5412
+ markdownTokenizer: {
5413
+ name: e,
5414
+ level: "block",
5415
+ start(u) {
5416
+ var d;
5417
+ const h = new RegExp(`^:::${c}`, "m"), p = (d = u.match(h)) == null ? void 0 : d.index;
5418
+ return p !== void 0 ? p : -1;
5419
+ },
5420
+ tokenize(u, d, h) {
5421
+ var p;
5422
+ const m = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = u.match(m);
5423
+ if (!g)
5424
+ return;
5425
+ const [y, x = ""] = g, v = i(x);
5426
+ let S = 1;
5427
+ const b = y.length;
5428
+ let I = "";
5429
+ const R = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(b);
5430
+ for (R.lastIndex = 0; ; ) {
5431
+ const L = R.exec(O);
5432
+ if (L === null)
5433
+ break;
5434
+ const H = L.index, De = L[1];
5435
+ if (!((p = L[2]) != null && p.endsWith(":::"))) {
5436
+ if (De)
5437
+ S += 1;
5438
+ else if (S -= 1, S === 0) {
5439
+ const fe = O.slice(0, H);
5440
+ I = fe.trim();
5441
+ const _ = u.slice(0, b + H + L[0].length);
5442
+ let B = [];
5443
+ if (I)
5444
+ if (l === "block")
5445
+ for (B = h.blockTokens(fe), B.forEach(($) => {
5446
+ $.text && (!$.tokens || $.tokens.length === 0) && ($.tokens = h.inlineTokens($.text));
5447
+ }); B.length > 0; ) {
5448
+ const $ = B[B.length - 1];
5449
+ if ($.type === "paragraph" && (!$.text || $.text.trim() === ""))
5450
+ B.pop();
5451
+ else
5452
+ break;
5453
+ }
5454
+ else
5455
+ B = h.inlineTokens(I);
5456
+ return {
5457
+ type: e,
5458
+ raw: _,
5459
+ attributes: v,
5460
+ content: I,
5461
+ tokens: B
5462
+ };
5463
+ }
5464
+ }
5465
+ }
5466
+ }
5467
+ },
5468
+ renderMarkdown: (u, d) => {
5469
+ const h = f(u.attrs || {}), p = s(h), m = p ? ` {${p}}` : "", g = d.renderChildren(u.content || [], `
5470
+
5471
+ `);
5472
+ return `:::${c}${m}
5473
+
5474
+ ${g}
5475
+
5476
+ :::`;
5477
+ }
5478
+ };
5479
+ }
5480
+ function Is(r) {
5481
+ if (!r.trim())
5482
+ return {};
5483
+ const e = {}, t = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
5484
+ let n = t.exec(r);
5485
+ for (; n !== null; ) {
5486
+ const [, i, s, o] = n;
5487
+ e[i] = s || o, n = t.exec(r);
5488
+ }
5489
+ return e;
5490
+ }
5491
+ function Rs(r) {
5492
+ return Object.entries(r).filter(([, e]) => e != null).map(([e, t]) => `${e}="${t}"`).join(" ");
5493
+ }
5494
+ function Ns(r) {
5495
+ const {
5496
+ nodeName: e,
5497
+ name: t,
5498
+ getContent: n,
5499
+ parseAttributes: i = Is,
5500
+ serializeAttributes: s = Rs,
5501
+ defaultAttributes: o = {},
5502
+ selfClosing: l = !1,
5503
+ allowedAttributes: a
5504
+ } = r, c = t || e, f = (d) => {
5505
+ if (!a)
5506
+ return d;
5507
+ const h = {};
5508
+ return a.forEach((p) => {
5509
+ const m = typeof p == "string" ? p : p.name, g = typeof p == "string" ? void 0 : p.skipIfDefault;
5510
+ if (m in d) {
5511
+ const y = d[m];
5512
+ if (g !== void 0 && y === g)
5513
+ return;
5514
+ h[m] = y;
5515
+ }
5516
+ }), h;
5517
+ }, u = c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5518
+ return {
5519
+ parseMarkdown: (d, h) => {
5520
+ const p = { ...o, ...d.attributes };
5521
+ if (l)
5522
+ return h.createNode(e, p);
5523
+ const m = n ? n(d) : d.content || "";
5524
+ return m ? h.createNode(e, p, [h.createTextNode(m)]) : h.createNode(e, p, []);
5525
+ },
5526
+ markdownTokenizer: {
5527
+ name: e,
5528
+ level: "inline",
5529
+ start(d) {
5530
+ const h = l ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), p = d.match(h), m = p == null ? void 0 : p.index;
5531
+ return m !== void 0 ? m : -1;
5532
+ },
5533
+ tokenize(d, h, p) {
5534
+ const m = l ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
5535
+ `^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`
5536
+ ), g = d.match(m);
5537
+ if (!g)
5538
+ return;
5539
+ let y = "", x = "";
5540
+ if (l) {
5541
+ const [, S] = g;
5542
+ x = S;
5543
+ } else {
5544
+ const [, S, b] = g;
5545
+ x = S, y = b || "";
5546
+ }
5547
+ const v = i(x.trim());
5548
+ return {
5549
+ type: e,
5550
+ raw: g[0],
5551
+ content: y.trim(),
5552
+ attributes: v
5553
+ };
5554
+ }
5555
+ },
5556
+ renderMarkdown: (d) => {
5557
+ let h = "";
5558
+ n ? h = n(d) : d.content && d.content.length > 0 && (h = d.content.filter((y) => y.type === "text").map((y) => y.text).join(""));
5559
+ const p = f(d.attrs || {}), m = s(p), g = m ? ` ${m}` : "";
5560
+ return l ? `[${c}${g}]` : `[${c}${g}]${h}[/${c}]`;
5561
+ }
5562
+ };
5563
+ }
5564
+ function zs(r, e, t) {
5565
+ var n, i, s, o;
5566
+ const l = r.split(`
5567
+ `), a = [];
5568
+ let c = "", f = 0;
5569
+ const u = e.baseIndentSize || 2;
5570
+ for (; f < l.length; ) {
5571
+ const d = l[f], h = d.match(e.itemPattern);
5572
+ if (!h) {
5573
+ if (a.length > 0)
5574
+ break;
5575
+ if (d.trim() === "") {
5576
+ f += 1, c = `${c}${d}
5577
+ `;
5578
+ continue;
5579
+ } else
5580
+ return;
5581
+ }
5582
+ const p = e.extractItemData(h), { indentLevel: m, mainContent: g } = p;
5583
+ c = `${c}${d}
5584
+ `;
5585
+ const y = [g];
5586
+ for (f += 1; f < l.length; ) {
5587
+ const b = l[f];
5588
+ if (b.trim() === "") {
5589
+ const R = l.slice(f + 1).findIndex((H) => H.trim() !== "");
5590
+ if (R === -1)
5591
+ break;
5592
+ if ((((i = (n = l[f + 1 + R].match(/^(\s*)/)) == null ? void 0 : n[1]) == null ? void 0 : i.length) || 0) > m) {
5593
+ y.push(b), c = `${c}${b}
5594
+ `, f += 1;
5595
+ continue;
5596
+ } else
5597
+ break;
5598
+ }
5599
+ if ((((o = (s = b.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : o.length) || 0) > m)
5600
+ y.push(b), c = `${c}${b}
5601
+ `, f += 1;
5602
+ else
5603
+ break;
5604
+ }
5605
+ let x;
5606
+ const v = y.slice(1);
5607
+ if (v.length > 0) {
5608
+ const b = v.map((I) => I.slice(m + u)).join(`
5609
+ `);
5610
+ b.trim() && (e.customNestedParser ? x = e.customNestedParser(b) : x = t.blockTokens(b));
5611
+ }
5612
+ const S = e.createToken(p, x);
5613
+ a.push(S);
5614
+ }
5615
+ if (a.length !== 0)
5616
+ return {
5617
+ items: a,
5618
+ raw: c
5619
+ };
5620
+ }
5621
+ function Os(r, e, t, n) {
5622
+ if (!r || !Array.isArray(r.content))
5623
+ return "";
5624
+ const i = typeof t == "function" ? t(n) : t, [s, ...o] = r.content, l = e.renderChildren([s]);
5625
+ let a = `${i}${l}`;
5626
+ return o && o.length > 0 && o.forEach((c, f) => {
5627
+ var u, d;
5628
+ const h = (d = (u = e.renderChild) == null ? void 0 : u.call(e, c, f + 1)) != null ? d : e.renderChildren([c]);
5629
+ if (h != null) {
5630
+ const p = h.split(`
5631
+ `).map((m) => m ? e.indent(m) : e.indent("")).join(`
5632
+ `);
5633
+ a += c.type === "paragraph" ? `
5634
+
5635
+ ${p}` : `
5636
+ ${p}`;
5637
+ }
5638
+ }), a;
5639
+ }
5640
+ function zn(r, e) {
5641
+ const t = { ...r };
5642
+ return Ee(r) && Ee(e) && Object.keys(e).forEach((n) => {
5643
+ Ee(e[n]) && Ee(r[n]) ? t[n] = zn(r[n], e[n]) : t[n] = e[n];
5644
+ }), t;
5645
+ }
5646
+ var Be = class {
5647
+ constructor(r) {
5648
+ var e;
5649
+ this.find = r.find, this.handler = r.handler, this.undoable = (e = r.undoable) != null ? e : !0;
5650
+ }
5651
+ }, yt = class {
5652
+ constructor(r = {}) {
5653
+ this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
5654
+ name: this.name
5655
+ }, this.config = {
5656
+ ...this.config,
5657
+ ...r
5658
+ }, this.name = this.config.name;
5659
+ }
5660
+ get options() {
5661
+ return {
5662
+ ...V(
5663
+ ke(this, "addOptions", {
5664
+ name: this.name
5665
+ })
5666
+ )
5667
+ };
5668
+ }
5669
+ get storage() {
5670
+ return {
5671
+ ...V(
5672
+ ke(this, "addStorage", {
5673
+ name: this.name,
5674
+ options: this.options
5675
+ })
5676
+ )
5677
+ };
5678
+ }
5679
+ configure(r = {}) {
5680
+ const e = this.extend({
5681
+ ...this.config,
5682
+ addOptions: () => zn(this.options, r)
5683
+ });
5684
+ return e.name = this.name, e.parent = this.parent, this.child = null, e;
5685
+ }
5686
+ extend(r = {}) {
5687
+ const e = new this.constructor({ ...this.config, ...r });
5688
+ return e.parent = this, this.child = e, e.name = "name" in r ? r.name : e.parent.name, e;
5689
+ }
5690
+ }, wo = class On extends yt {
5691
+ constructor() {
5692
+ super(...arguments), this.type = "mark";
5693
+ }
5694
+ /**
5695
+ * Create a new Mark instance
5696
+ * @param config - Mark configuration object or a function that returns a configuration object
5697
+ */
5698
+ static create(e = {}) {
5699
+ const t = typeof e == "function" ? e() : e;
5700
+ return new On(t);
5701
+ }
5702
+ static handleExit({ editor: e, mark: t }) {
5703
+ const { tr: n } = e.state, i = e.state.selection.$from;
5704
+ if (i.pos === i.end()) {
5705
+ const o = i.marks();
5706
+ if (!!!o.find((c) => (c == null ? void 0 : c.type.name) === t.name))
5707
+ return !1;
5708
+ const a = o.find((c) => (c == null ? void 0 : c.type.name) === t.name);
5709
+ return a && n.removeStoredMark(a), n.insertText(" ", i.pos), e.view.dispatch(n), !0;
5710
+ }
5711
+ return !1;
5712
+ }
5713
+ configure(e) {
5714
+ return super.configure(e);
5715
+ }
5716
+ extend(e) {
5717
+ const t = typeof e == "function" ? e() : e;
5718
+ return super.extend(t);
5719
+ }
5720
+ }, $n = class {
5721
+ constructor(r) {
5722
+ this.find = r.find, this.handler = r.handler;
5723
+ }
5724
+ }, $s = {};
5725
+ dt($s, {
5726
+ ClipboardTextSerializer: () => Ps,
5727
+ Commands: () => Bs,
5728
+ Delete: () => Ds,
5729
+ Drop: () => Fs,
5730
+ Editable: () => Ls,
5731
+ FocusEvents: () => Ws,
5732
+ Keymap: () => Js,
5733
+ Paste: () => js,
5734
+ Tabindex: () => Hs,
5735
+ TextDirection: () => _s,
5736
+ focusEventsPluginKey: () => Bn
5737
+ });
5738
+ var q = class Pn extends yt {
5739
+ constructor() {
5740
+ super(...arguments), this.type = "extension";
5741
+ }
5742
+ /**
5743
+ * Create a new Extension instance
5744
+ * @param config - Extension configuration object or a function that returns a configuration object
5745
+ */
5746
+ static create(e = {}) {
5747
+ const t = typeof e == "function" ? e() : e;
5748
+ return new Pn(t);
5749
+ }
5750
+ configure(e) {
5751
+ return super.configure(e);
5752
+ }
5753
+ extend(e) {
5754
+ const t = typeof e == "function" ? e() : e;
5755
+ return super.extend(t);
5756
+ }
5757
+ }, Ps = q.create({
5758
+ name: "clipboardTextSerializer",
5759
+ addOptions() {
5760
+ return {
5761
+ blockSeparator: void 0
5762
+ };
5763
+ },
5764
+ addProseMirrorPlugins() {
5765
+ return [
5766
+ new Q({
5767
+ key: new G("clipboardTextSerializer"),
5768
+ props: {
5769
+ clipboardTextSerializer: () => {
5770
+ const { editor: r } = this, { state: e, schema: t } = r, { doc: n, selection: i } = e, s = Yi(t), { blockSeparator: o } = this.options, l = {
5771
+ ...o !== void 0 ? { blockSeparator: o } : {},
5772
+ textSerializers: s
5773
+ };
5774
+ return [...i.ranges].sort((c, f) => c.$from.pos - f.$from.pos).map(
5775
+ ({ $from: c, $to: f }) => Tn(n, { from: c.pos, to: f.pos }, l)
5776
+ ).join(o ?? `
5777
+
5778
+ `);
5779
+ }
5780
+ }
5781
+ })
5782
+ ];
5783
+ }
5784
+ }), Bs = q.create({
5785
+ name: "commands",
5786
+ addCommands() {
5787
+ return {
5788
+ ...vn
5789
+ };
5790
+ }
5791
+ }), Ds = q.create({
5792
+ name: "delete",
5793
+ onUpdate({ transaction: r, appendedTransactions: e }) {
5794
+ var t, n, i;
5795
+ const s = () => {
5796
+ var o, l, a, c;
5797
+ if ((c = (a = (l = (o = this.editor.options.coreExtensionOptions) == null ? void 0 : o.delete) == null ? void 0 : l.filterTransaction) == null ? void 0 : a.call(l, r)) != null ? c : r.getMeta("y-sync$"))
5798
+ return;
5799
+ const f = _i(r.before, [
5800
+ r,
5801
+ ...e
5802
+ ]);
5803
+ es(f).forEach((h) => {
5804
+ f.mapping.mapResult(h.oldRange.from).deletedAfter && f.mapping.mapResult(h.oldRange.to).deletedBefore && f.before.nodesBetween(
5805
+ h.oldRange.from,
5806
+ h.oldRange.to,
5807
+ (p, m) => {
5808
+ const g = m + p.nodeSize - 2, y = h.oldRange.from <= m && g <= h.oldRange.to;
5809
+ this.editor.emit("delete", {
5810
+ type: "node",
5811
+ node: p,
5812
+ from: m,
5813
+ to: g,
5814
+ newFrom: f.mapping.map(m),
5815
+ newTo: f.mapping.map(g),
5816
+ deletedRange: h.oldRange,
5817
+ newRange: h.newRange,
5818
+ partial: !y,
5819
+ editor: this.editor,
5820
+ transaction: r,
5821
+ combinedTransform: f
5822
+ });
5823
+ }
5824
+ );
5825
+ });
5826
+ const d = f.mapping;
5827
+ f.steps.forEach((h, p) => {
5828
+ var m, g;
5829
+ if (h instanceof W) {
5830
+ const y = d.slice(p).map(h.from, -1), x = d.slice(p).map(h.to), v = d.invert().map(y, -1), S = d.invert().map(x), b = y > 0 ? (m = f.doc.nodeAt(y - 1)) == null ? void 0 : m.marks.some((R) => R.eq(h.mark)) : !1, I = (g = f.doc.nodeAt(x)) == null ? void 0 : g.marks.some((R) => R.eq(h.mark));
5831
+ this.editor.emit("delete", {
5832
+ type: "mark",
5833
+ mark: h.mark,
5834
+ from: h.from,
5835
+ to: h.to,
5836
+ deletedRange: {
5837
+ from: v,
5838
+ to: S
5839
+ },
5840
+ newRange: {
5841
+ from: y,
5842
+ to: x
5843
+ },
5844
+ partial: !!(I || b),
5845
+ editor: this.editor,
5846
+ transaction: r,
5847
+ combinedTransform: f
5848
+ });
5849
+ }
5850
+ });
5851
+ };
5852
+ (i = (n = (t = this.editor.options.coreExtensionOptions) == null ? void 0 : t.delete) == null ? void 0 : n.async) == null || i ? setTimeout(s, 0) : s();
5853
+ }
5854
+ }), Fs = q.create({
5855
+ name: "drop",
5856
+ addProseMirrorPlugins() {
5857
+ return [
5858
+ new Q({
5859
+ key: new G("tiptapDrop"),
5860
+ props: {
5861
+ handleDrop: (r, e, t, n) => {
5862
+ this.editor.emit("drop", {
5863
+ editor: this.editor,
5864
+ event: e,
5865
+ slice: t,
5866
+ moved: n
5867
+ });
5868
+ }
5869
+ }
5870
+ })
5871
+ ];
5872
+ }
5873
+ }), Ls = q.create({
5874
+ name: "editable",
5875
+ addProseMirrorPlugins() {
5876
+ return [
5400
5877
  new Q({
5401
- key: new Z("editable"),
5878
+ key: new G("editable"),
5402
5879
  props: {
5403
5880
  editable: () => this.editor.options.editable
5404
5881
  }
5405
5882
  })
5406
5883
  ];
5407
5884
  }
5408
- }), zn = new Z("focusEvents"), As = q.create({
5885
+ }), Bn = new G("focusEvents"), Ws = q.create({
5409
5886
  name: "focusEvents",
5410
5887
  addProseMirrorPlugins() {
5411
5888
  const { editor: r } = this;
5412
5889
  return [
5413
5890
  new Q({
5414
- key: zn,
5891
+ key: Bn,
5415
5892
  props: {
5416
5893
  handleDOMEvents: {
5417
5894
  focus: (e, t) => {
@@ -5429,7 +5906,7 @@ var q = class Nn extends mt {
5429
5906
  })
5430
5907
  ];
5431
5908
  }
5432
- }), Is = q.create({
5909
+ }), Js = q.create({
5433
5910
  name: "keymap",
5434
5911
  addKeyboardShortcuts() {
5435
5912
  const r = () => this.editor.commands.first(({ commands: o }) => [
@@ -5474,7 +5951,7 @@ var q = class Nn extends mt {
5474
5951
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
5475
5952
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
5476
5953
  };
5477
- return ge() || vn() ? s : i;
5954
+ return ge() || Mn() ? s : i;
5478
5955
  },
5479
5956
  addProseMirrorPlugins() {
5480
5957
  return [
@@ -5484,20 +5961,22 @@ var q = class Nn extends mt {
5484
5961
  // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
5485
5962
  // with many other commands.
5486
5963
  new Q({
5487
- key: new Z("clearDocument"),
5964
+ key: new G("clearDocument"),
5488
5965
  appendTransaction: (r, e, t) => {
5489
5966
  if (r.some((m) => m.getMeta("composition")))
5490
5967
  return;
5491
- const n = r.some((m) => m.docChanged) && !e.doc.eq(t.doc), i = r.some((m) => m.getMeta("preventClearDocument"));
5968
+ const n = r.some((m) => m.docChanged) && !e.doc.eq(t.doc), i = r.some(
5969
+ (m) => m.getMeta("preventClearDocument")
5970
+ );
5492
5971
  if (!n || i)
5493
5972
  return;
5494
5973
  const { empty: s, from: o, to: l } = e.selection, a = re.atStart(e.doc).from, c = re.atEnd(e.doc).to;
5495
- if (s || !(o === a && l === c) || !Cn(t.doc))
5974
+ if (s || !(o === a && l === c) || !In(t.doc))
5496
5975
  return;
5497
- const d = t.tr, h = yn({
5976
+ const d = t.tr, h = xn({
5498
5977
  state: t,
5499
5978
  transaction: d
5500
- }), { commands: p } = new _r({
5979
+ }), { commands: p } = new Kr({
5501
5980
  editor: this.editor,
5502
5981
  state: h
5503
5982
  });
@@ -5507,12 +5986,12 @@ var q = class Nn extends mt {
5507
5986
  })
5508
5987
  ];
5509
5988
  }
5510
- }), Rs = q.create({
5989
+ }), js = q.create({
5511
5990
  name: "paste",
5512
5991
  addProseMirrorPlugins() {
5513
5992
  return [
5514
5993
  new Q({
5515
- key: new Z("tiptapPaste"),
5994
+ key: new G("tiptapPaste"),
5516
5995
  props: {
5517
5996
  handlePaste: (r, e, t) => {
5518
5997
  this.editor.emit("paste", {
@@ -5525,7 +6004,7 @@ var q = class Nn extends mt {
5525
6004
  })
5526
6005
  ];
5527
6006
  }
5528
- }), Ns = q.create({
6007
+ }), Hs = q.create({
5529
6008
  name: "tabindex",
5530
6009
  addOptions() {
5531
6010
  return {
@@ -5535,7 +6014,7 @@ var q = class Nn extends mt {
5535
6014
  addProseMirrorPlugins() {
5536
6015
  return [
5537
6016
  new Q({
5538
- key: new Z("tabindex"),
6017
+ key: new G("tabindex"),
5539
6018
  props: {
5540
6019
  attributes: () => {
5541
6020
  var r;
@@ -5545,7 +6024,7 @@ var q = class Nn extends mt {
5545
6024
  })
5546
6025
  ];
5547
6026
  }
5548
- }), zs = q.create({
6027
+ }), _s = q.create({
5549
6028
  name: "textDirection",
5550
6029
  addOptions() {
5551
6030
  return {
@@ -5555,7 +6034,7 @@ var q = class Nn extends mt {
5555
6034
  addGlobalAttributes() {
5556
6035
  if (!this.options.direction)
5557
6036
  return [];
5558
- const { nodeExtensions: r } = Sn(this.extensions);
6037
+ const { nodeExtensions: r } = Cn(this.extensions);
5559
6038
  return [
5560
6039
  {
5561
6040
  types: r.filter((e) => e.name !== "text").map((e) => e.name),
@@ -5577,7 +6056,7 @@ var q = class Nn extends mt {
5577
6056
  addProseMirrorPlugins() {
5578
6057
  return [
5579
6058
  new Q({
5580
- key: new Z("textDirection"),
6059
+ key: new G("textDirection"),
5581
6060
  props: {
5582
6061
  attributes: () => {
5583
6062
  const r = this.options.direction;
@@ -5590,8 +6069,8 @@ var q = class Nn extends mt {
5590
6069
  ];
5591
6070
  }
5592
6071
  });
5593
- function co(r) {
5594
- return new Pe({
6072
+ function ko(r) {
6073
+ return new Be({
5595
6074
  find: r.find,
5596
6075
  handler: ({ state: e, range: t, match: n }) => {
5597
6076
  const i = V(r.getAttributes, void 0, n);
@@ -5600,7 +6079,7 @@ function co(r) {
5600
6079
  const { tr: s } = e, o = n[n.length - 1], l = n[0];
5601
6080
  if (o) {
5602
6081
  const a = l.search(/\S/), c = t.from + l.indexOf(o), f = c + o.length;
5603
- if (En(t.from, t.to, e.doc).filter((h) => h.mark.type.excluded.find((m) => m === r.type && m !== h.mark.type)).filter((h) => h.to > c).length)
6082
+ if (An(t.from, t.to, e.doc).filter((h) => h.mark.type.excluded.find((m) => m === r.type && m !== h.mark.type)).filter((h) => h.to > c).length)
5604
6083
  return null;
5605
6084
  f < t.to && s.delete(f, t.to), c > t.from && s.delete(t.from + a, c);
5606
6085
  const d = t.from + a + o.length;
@@ -5610,8 +6089,8 @@ function co(r) {
5610
6089
  undoable: r.undoable
5611
6090
  });
5612
6091
  }
5613
- function fo(r) {
5614
- return new Pe({
6092
+ function xo(r) {
6093
+ return new Be({
5615
6094
  find: r.find,
5616
6095
  handler: ({ state: e, range: t, match: n }) => {
5617
6096
  const i = V(r.getAttributes, void 0, n) || {}, { tr: s } = e, o = t.from;
@@ -5625,15 +6104,18 @@ function fo(r) {
5625
6104
  s.insertText(u, o + n[0].length - 1), s.replaceWith(f, l, a);
5626
6105
  } else if (n[0]) {
5627
6106
  const c = r.type.isInline ? o : o - 1;
5628
- s.insert(c, r.type.create(i)).delete(s.mapping.map(o), s.mapping.map(l));
6107
+ s.insert(c, r.type.create(i)).delete(
6108
+ s.mapping.map(o),
6109
+ s.mapping.map(l)
6110
+ );
5629
6111
  }
5630
6112
  s.scrollIntoView();
5631
6113
  },
5632
6114
  undoable: r.undoable
5633
6115
  });
5634
6116
  }
5635
- function uo(r) {
5636
- return new Pe({
6117
+ function vo(r) {
6118
+ return new Be({
5637
6119
  find: r.find,
5638
6120
  handler: ({ state: e, range: t, match: n }) => {
5639
6121
  const i = e.doc.resolve(t.from), s = V(r.getAttributes, void 0, n) || {};
@@ -5644,8 +6126,8 @@ function uo(r) {
5644
6126
  undoable: r.undoable
5645
6127
  });
5646
6128
  }
5647
- function ho(r) {
5648
- return new Pe({
6129
+ function bo(r) {
6130
+ return new Be({
5649
6131
  find: r.find,
5650
6132
  handler: ({ state: e, range: t, match: n, chain: i }) => {
5651
6133
  const s = V(r.getAttributes, void 0, n) || {}, o = e.tr.delete(t.from, t.to), a = o.doc.resolve(t.from).blockRange(), c = a && ot(a, r.type, s);
@@ -5663,12 +6145,12 @@ function ho(r) {
5663
6145
  i().updateAttributes(u, s).run();
5664
6146
  }
5665
6147
  const f = o.doc.resolve(t.from - 1).nodeBefore;
5666
- f && f.type === r.type && G(o.doc, t.from - 1) && (!r.joinPredicate || r.joinPredicate(n, f)) && o.join(t.from - 1);
6148
+ f && f.type === r.type && Z(o.doc, t.from - 1) && (!r.joinPredicate || r.joinPredicate(n, f)) && o.join(t.from - 1);
5667
6149
  },
5668
6150
  undoable: r.undoable
5669
6151
  });
5670
6152
  }
5671
- var Os = (r) => "touches" in r, po = class {
6153
+ var Vs = (r) => "touches" in r, So = class {
5672
6154
  /**
5673
6155
  * Creates a new ResizableNodeView instance.
5674
6156
  *
@@ -5678,7 +6160,12 @@ var Os = (r) => "touches" in r, po = class {
5678
6160
  * @param options - Configuration options for the resizable node view
5679
6161
  */
5680
6162
  constructor(r) {
5681
- this.directions = ["bottom-left", "bottom-right", "top-left", "top-right"], this.minSize = {
6163
+ this.directions = [
6164
+ "bottom-left",
6165
+ "bottom-right",
6166
+ "top-left",
6167
+ "top-right"
6168
+ ], this.minSize = {
5682
6169
  height: 8,
5683
6170
  width: 8
5684
6171
  }, this.preserveAspectRatio = !1, this.classNames = {
@@ -5710,7 +6197,7 @@ var Os = (r) => "touches" in r, po = class {
5710
6197
  l.key === "Shift" && (this.isShiftKeyPressed = !1);
5711
6198
  };
5712
6199
  var e, t, n, i, s, o;
5713
- this.node = r.node, this.editor = r.editor, this.element = r.element, this.contentElement = r.contentElement, this.getPos = r.getPos, this.onResize = r.onResize, this.onCommit = r.onCommit, this.onUpdate = r.onUpdate, (e = r.options) != null && e.min && (this.minSize = {
6200
+ this.node = r.node, this.editor = r.editor, this.element = r.element, this.element.draggable = !1, this.contentElement = r.contentElement, this.getPos = r.getPos, this.onResize = r.onResize, this.onCommit = r.onCommit, this.onUpdate = r.onUpdate, (e = r.options) != null && e.min && (this.minSize = {
5714
6201
  ...this.minSize,
5715
6202
  ...r.options.min
5716
6203
  }), (t = r.options) != null && t.max && (this.maxSize = r.options.max), (n = r == null ? void 0 : r.options) != null && n.directions && (this.directions = r.options.directions), (i = r.options) != null && i.preserveAspectRatio && (this.preserveAspectRatio = r.options.preserveAspectRatio), (s = r.options) != null && s.className && (this.classNames = {
@@ -5788,532 +6275,157 @@ var Os = (r) => "touches" in r, po = class {
5788
6275
  createWrapper() {
5789
6276
  const r = document.createElement("div");
5790
6277
  return r.style.position = "relative", r.style.display = "block", r.dataset.resizeWrapper = "", this.classNames.wrapper && (r.className = this.classNames.wrapper), r.appendChild(this.element), r;
5791
- }
5792
- /**
5793
- * Creates a resize handle element for a specific direction.
5794
- *
5795
- * Each handle is absolutely positioned and includes a data attribute
5796
- * identifying its direction for styling purposes.
5797
- *
5798
- * @param direction - The resize direction for this handle
5799
- * @returns The handle element
5800
- */
5801
- createHandle(r) {
5802
- const e = document.createElement("div");
5803
- return e.dataset.resizeHandle = r, e.style.position = "absolute", this.classNames.handle && (e.className = this.classNames.handle), e;
5804
- }
5805
- /**
5806
- * Positions a handle element according to its direction.
5807
- *
5808
- * Corner handles (e.g., 'top-left') are positioned at the intersection
5809
- * of two edges. Edge handles (e.g., 'top') span the full width or height.
5810
- *
5811
- * @param handle - The handle element to position
5812
- * @param direction - The direction determining the position
5813
- */
5814
- positionHandle(r, e) {
5815
- const t = e.includes("top"), n = e.includes("bottom"), i = e.includes("left"), s = e.includes("right");
5816
- t && (r.style.top = "0"), n && (r.style.bottom = "0"), i && (r.style.left = "0"), s && (r.style.right = "0"), (e === "top" || e === "bottom") && (r.style.left = "0", r.style.right = "0"), (e === "left" || e === "right") && (r.style.top = "0", r.style.bottom = "0");
5817
- }
5818
- /**
5819
- * Creates and attaches all resize handles to the wrapper.
5820
- *
5821
- * Iterates through the configured directions, creates a handle for each,
5822
- * positions it, attaches the mousedown listener, and appends it to the DOM.
5823
- */
5824
- attachHandles() {
5825
- this.directions.forEach((r) => {
5826
- let e;
5827
- this.createCustomHandle ? e = this.createCustomHandle(r) : e = this.createHandle(r), e instanceof HTMLElement || (console.warn(
5828
- `[ResizableNodeView] createCustomHandle("${r}") did not return an HTMLElement. Falling back to default handle.`
5829
- ), e = this.createHandle(r)), this.createCustomHandle || this.positionHandle(e, r), e.addEventListener("mousedown", (t) => this.handleResizeStart(t, r)), e.addEventListener("touchstart", (t) => this.handleResizeStart(t, r)), this.handleMap.set(r, e), this.wrapper.appendChild(e);
5830
- });
5831
- }
5832
- /**
5833
- * Removes all resize handles from the wrapper.
5834
- *
5835
- * Cleans up the handle map and removes each handle element from the DOM.
5836
- */
5837
- removeHandles() {
5838
- this.handleMap.forEach((r) => r.remove()), this.handleMap.clear();
5839
- }
5840
- /**
5841
- * Applies initial sizing from node attributes to the element.
5842
- *
5843
- * If width/height attributes exist on the node, they're applied to the element.
5844
- * Otherwise, the element's natural/current dimensions are measured. The aspect
5845
- * ratio is calculated for later use in aspect-ratio-preserving resizes.
5846
- */
5847
- applyInitialSize() {
5848
- const r = this.node.attrs.width, e = this.node.attrs.height;
5849
- r ? (this.element.style.width = `${r}px`, this.initialWidth = r) : this.initialWidth = this.element.offsetWidth, e ? (this.element.style.height = `${e}px`, this.initialHeight = e) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
5850
- }
5851
- /**
5852
- * Initiates a resize operation when a handle is clicked.
5853
- *
5854
- * Captures the starting mouse position and element dimensions, sets up
5855
- * the resize state, adds the resizing class and state attribute, and
5856
- * attaches document-level listeners for mouse movement and keyboard input.
5857
- *
5858
- * @param event - The mouse down event
5859
- * @param direction - The direction of the handle being dragged
5860
- */
5861
- handleResizeStart(r, e) {
5862
- r.preventDefault(), r.stopPropagation(), this.isResizing = !0, this.activeHandle = e, Os(r) ? (this.startX = r.touches[0].clientX, this.startY = r.touches[0].clientY) : (this.startX = r.clientX, this.startY = r.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
5863
- }
5864
- handleResize(r, e) {
5865
- if (!this.activeHandle)
5866
- return;
5867
- const t = this.preserveAspectRatio || this.isShiftKeyPressed, { width: n, height: i } = this.calculateNewDimensions(this.activeHandle, r, e), s = this.applyConstraints(n, i, t);
5868
- this.element.style.width = `${s.width}px`, this.element.style.height = `${s.height}px`, this.onResize && this.onResize(s.width, s.height);
5869
- }
5870
- /**
5871
- * Calculates new dimensions based on mouse delta and resize direction.
5872
- *
5873
- * Takes the starting dimensions and applies the mouse movement delta
5874
- * according to the handle direction. For corner handles, both dimensions
5875
- * are affected. For edge handles, only one dimension changes. If aspect
5876
- * ratio should be preserved, delegates to applyAspectRatio.
5877
- *
5878
- * @param direction - The active resize handle direction
5879
- * @param deltaX - Horizontal mouse movement since resize start
5880
- * @param deltaY - Vertical mouse movement since resize start
5881
- * @returns The calculated width and height
5882
- */
5883
- calculateNewDimensions(r, e, t) {
5884
- let n = this.startWidth, i = this.startHeight;
5885
- const s = r.includes("right"), o = r.includes("left"), l = r.includes("bottom"), a = r.includes("top");
5886
- return s ? n = this.startWidth + e : o && (n = this.startWidth - e), l ? i = this.startHeight + t : a && (i = this.startHeight - t), (r === "right" || r === "left") && (n = this.startWidth + (s ? e : -e)), (r === "top" || r === "bottom") && (i = this.startHeight + (l ? t : -t)), this.preserveAspectRatio || this.isShiftKeyPressed ? this.applyAspectRatio(n, i, r) : { width: n, height: i };
5887
- }
5888
- /**
5889
- * Applies min/max constraints to dimensions.
5890
- *
5891
- * When aspect ratio is NOT preserved, constraints are applied independently
5892
- * to width and height. When aspect ratio IS preserved, constraints are
5893
- * applied while maintaining the aspect ratio—if one dimension hits a limit,
5894
- * the other is recalculated proportionally.
6278
+ }
6279
+ /**
6280
+ * Creates a resize handle element for a specific direction.
5895
6281
  *
5896
- * This ensures that aspect ratio is never broken when constrained.
6282
+ * Each handle is absolutely positioned and includes a data attribute
6283
+ * identifying its direction for styling purposes.
5897
6284
  *
5898
- * @param width - The unconstrained width
5899
- * @param height - The unconstrained height
5900
- * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
5901
- * @returns The constrained dimensions
6285
+ * @param direction - The resize direction for this handle
6286
+ * @returns The handle element
5902
6287
  */
5903
- applyConstraints(r, e, t) {
5904
- var n, i, s, o;
5905
- if (!t) {
5906
- let c = Math.max(this.minSize.width, r), f = Math.max(this.minSize.height, e);
5907
- return (n = this.maxSize) != null && n.width && (c = Math.min(this.maxSize.width, c)), (i = this.maxSize) != null && i.height && (f = Math.min(this.maxSize.height, f)), { width: c, height: f };
5908
- }
5909
- let l = r, a = e;
5910
- return l < this.minSize.width && (l = this.minSize.width, a = l / this.aspectRatio), a < this.minSize.height && (a = this.minSize.height, l = a * this.aspectRatio), (s = this.maxSize) != null && s.width && l > this.maxSize.width && (l = this.maxSize.width, a = l / this.aspectRatio), (o = this.maxSize) != null && o.height && a > this.maxSize.height && (a = this.maxSize.height, l = a * this.aspectRatio), { width: l, height: a };
6288
+ createHandle(r) {
6289
+ const e = document.createElement("div");
6290
+ return e.dataset.resizeHandle = r, e.style.position = "absolute", this.classNames.handle && (e.className = this.classNames.handle), e;
5911
6291
  }
5912
6292
  /**
5913
- * Adjusts dimensions to maintain the original aspect ratio.
6293
+ * Positions a handle element according to its direction.
5914
6294
  *
5915
- * For horizontal handles (left/right), uses width as the primary dimension
5916
- * and calculates height from it. For vertical handles (top/bottom), uses
5917
- * height as primary and calculates width. For corner handles, uses width
5918
- * as the primary dimension.
6295
+ * Corner handles (e.g., 'top-left') are positioned at the intersection
6296
+ * of two edges. Edge handles (e.g., 'top') span the full width or height.
5919
6297
  *
5920
- * @param width - The new width
5921
- * @param height - The new height
5922
- * @param direction - The active resize direction
5923
- * @returns Dimensions adjusted to preserve aspect ratio
6298
+ * @param handle - The handle element to position
6299
+ * @param direction - The direction determining the position
5924
6300
  */
5925
- applyAspectRatio(r, e, t) {
5926
- const n = t === "left" || t === "right", i = t === "top" || t === "bottom";
5927
- return n ? {
5928
- width: r,
5929
- height: r / this.aspectRatio
5930
- } : i ? {
5931
- width: e * this.aspectRatio,
5932
- height: e
5933
- } : {
5934
- width: r,
5935
- height: r / this.aspectRatio
5936
- };
5937
- }
5938
- };
5939
- function mo(r, e) {
5940
- const { selection: t } = r, { $from: n } = t;
5941
- if (t instanceof oe) {
5942
- const s = n.index();
5943
- return n.parent.canReplaceWith(s, s + 1, e);
5944
- }
5945
- let i = n.depth;
5946
- for (; i >= 0; ) {
5947
- const s = n.index(i);
5948
- if (n.node(i).contentMatchAt(s).matchType(e))
5949
- return !0;
5950
- i -= 1;
5951
- }
5952
- return !1;
5953
- }
5954
- function go(r) {
5955
- return r.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
5956
- }
5957
- function yo(r, e) {
5958
- const t = r.getAttribute("style");
5959
- if (!t)
5960
- return null;
5961
- const n = t.split(";").map((s) => s.trim()).filter(Boolean), i = e.toLowerCase();
5962
- for (let s = n.length - 1; s >= 0; s -= 1) {
5963
- const o = n[s], l = o.indexOf(":");
5964
- if (l === -1)
5965
- continue;
5966
- if (o.slice(0, l).trim().toLowerCase() === i)
5967
- return o.slice(l + 1).trim();
5968
- }
5969
- return null;
5970
- }
5971
- function wo() {
5972
- return typeof navigator < "u" ? /Firefox/.test(navigator.userAgent) : !1;
5973
- }
5974
- var $s = {};
5975
- dt($s, {
5976
- createAtomBlockMarkdownSpec: () => Ps,
5977
- createBlockMarkdownSpec: () => Bs,
5978
- createInlineMarkdownSpec: () => Ls,
5979
- parseAttributes: () => gt,
5980
- parseIndentedBlocks: () => Ws,
5981
- renderNestedMarkdownContent: () => Js,
5982
- serializeAttributes: () => yt
5983
- });
5984
- function gt(r) {
5985
- if (!(r != null && r.trim()))
5986
- return {};
5987
- const e = {}, t = [], n = r.replace(/["']([^"']*)["']/g, (c) => (t.push(c), `__QUOTED_${t.length - 1}__`)), i = n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
5988
- if (i) {
5989
- const c = i.map((f) => f.trim().slice(1));
5990
- e.class = c.join(" ");
6301
+ positionHandle(r, e) {
6302
+ const t = e.includes("top"), n = e.includes("bottom"), i = e.includes("left"), s = e.includes("right");
6303
+ t && (r.style.top = "0"), n && (r.style.bottom = "0"), i && (r.style.left = "0"), s && (r.style.right = "0"), (e === "top" || e === "bottom") && (r.style.left = "0", r.style.right = "0"), (e === "left" || e === "right") && (r.style.top = "0", r.style.bottom = "0");
5991
6304
  }
5992
- const s = n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
5993
- s && (e.id = s[1]);
5994
- const o = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
5995
- Array.from(n.matchAll(o)).forEach(([, c, f]) => {
5996
- var u;
5997
- const d = parseInt(((u = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), h = t[d];
5998
- h && (e[c] = h.slice(1, -1));
5999
- });
6000
- const a = n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
6001
- return a && a.split(/\s+/).filter(Boolean).forEach((f) => {
6002
- f.match(/^[a-zA-Z][\w-]*$/) && (e[f] = !0);
6003
- }), e;
6004
- }
6005
- function yt(r) {
6006
- if (!r || Object.keys(r).length === 0)
6007
- return "";
6008
- const e = [];
6009
- return r.class && String(r.class).split(/\s+/).filter(Boolean).forEach((n) => e.push(`.${n}`)), r.id && e.push(`#${r.id}`), Object.entries(r).forEach(([t, n]) => {
6010
- t === "class" || t === "id" || (n === !0 ? e.push(t) : n !== !1 && n != null && e.push(`${t}="${String(n)}"`));
6011
- }), e.join(" ");
6012
- }
6013
- function Ps(r) {
6014
- const {
6015
- nodeName: e,
6016
- name: t,
6017
- parseAttributes: n = gt,
6018
- serializeAttributes: i = yt,
6019
- defaultAttributes: s = {},
6020
- requiredAttributes: o = [],
6021
- allowedAttributes: l
6022
- } = r, a = t || e, c = (f) => {
6023
- if (!l)
6024
- return f;
6025
- const u = {};
6026
- return l.forEach((d) => {
6027
- d in f && (u[d] = f[d]);
6028
- }), u;
6029
- };
6030
- return {
6031
- parseMarkdown: (f, u) => {
6032
- const d = { ...s, ...f.attributes };
6033
- return u.createNode(e, d, []);
6034
- },
6035
- markdownTokenizer: {
6036
- name: e,
6037
- level: "block",
6038
- start(f) {
6039
- var u;
6040
- const d = new RegExp(`^:::${a}(?:\\s|$)`, "m"), h = (u = f.match(d)) == null ? void 0 : u.index;
6041
- return h !== void 0 ? h : -1;
6042
- },
6043
- tokenize(f, u, d) {
6044
- const h = new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), p = f.match(h);
6045
- if (!p)
6046
- return;
6047
- const m = p[1] || "", g = n(m);
6048
- if (!o.find((x) => !(x in g)))
6049
- return {
6050
- type: e,
6051
- raw: p[0],
6052
- attributes: g
6053
- };
6054
- }
6055
- },
6056
- renderMarkdown: (f) => {
6057
- const u = c(f.attrs || {}), d = i(u), h = d ? ` {${d}}` : "";
6058
- return `:::${a}${h} :::`;
6059
- }
6060
- };
6061
- }
6062
- function Bs(r) {
6063
- const {
6064
- nodeName: e,
6065
- name: t,
6066
- getContent: n,
6067
- parseAttributes: i = gt,
6068
- serializeAttributes: s = yt,
6069
- defaultAttributes: o = {},
6070
- content: l = "block",
6071
- allowedAttributes: a
6072
- } = r, c = t || e, f = (u) => {
6073
- if (!a)
6074
- return u;
6075
- const d = {};
6076
- return a.forEach((h) => {
6077
- h in u && (d[h] = u[h]);
6078
- }), d;
6079
- };
6080
- return {
6081
- parseMarkdown: (u, d) => {
6082
- let h;
6083
- if (n) {
6084
- const m = n(u);
6085
- h = typeof m == "string" ? [{ type: "text", text: m }] : m;
6086
- } else l === "block" ? h = d.parseChildren(u.tokens || []) : h = d.parseInline(u.tokens || []);
6087
- const p = { ...o, ...u.attributes };
6088
- return d.createNode(e, p, h);
6089
- },
6090
- markdownTokenizer: {
6091
- name: e,
6092
- level: "block",
6093
- start(u) {
6094
- var d;
6095
- const h = new RegExp(`^:::${c}`, "m"), p = (d = u.match(h)) == null ? void 0 : d.index;
6096
- return p !== void 0 ? p : -1;
6097
- },
6098
- tokenize(u, d, h) {
6099
- var p;
6100
- const m = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = u.match(m);
6101
- if (!g)
6102
- return;
6103
- const [y, x = ""] = g, v = i(x);
6104
- let S = 1;
6105
- const b = y.length;
6106
- let I = "";
6107
- const R = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(b);
6108
- for (R.lastIndex = 0; ; ) {
6109
- const L = R.exec(O);
6110
- if (L === null)
6111
- break;
6112
- const H = L.index, Be = L[1];
6113
- if (!((p = L[2]) != null && p.endsWith(":::"))) {
6114
- if (Be)
6115
- S += 1;
6116
- else if (S -= 1, S === 0) {
6117
- const fe = O.slice(0, H);
6118
- I = fe.trim();
6119
- const _ = u.slice(0, b + H + L[0].length);
6120
- let B = [];
6121
- if (I)
6122
- if (l === "block")
6123
- for (B = h.blockTokens(fe), B.forEach(($) => {
6124
- $.text && (!$.tokens || $.tokens.length === 0) && ($.tokens = h.inlineTokens($.text));
6125
- }); B.length > 0; ) {
6126
- const $ = B[B.length - 1];
6127
- if ($.type === "paragraph" && (!$.text || $.text.trim() === ""))
6128
- B.pop();
6129
- else
6130
- break;
6131
- }
6132
- else
6133
- B = h.inlineTokens(I);
6134
- return {
6135
- type: e,
6136
- raw: _,
6137
- attributes: v,
6138
- content: I,
6139
- tokens: B
6140
- };
6141
- }
6142
- }
6143
- }
6144
- }
6145
- },
6146
- renderMarkdown: (u, d) => {
6147
- const h = f(u.attrs || {}), p = s(h), m = p ? ` {${p}}` : "", g = d.renderChildren(u.content || [], `
6148
-
6149
- `);
6150
- return `:::${c}${m}
6151
-
6152
- ${g}
6153
-
6154
- :::`;
6155
- }
6156
- };
6157
- }
6158
- function Ds(r) {
6159
- if (!r.trim())
6160
- return {};
6161
- const e = {}, t = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
6162
- let n = t.exec(r);
6163
- for (; n !== null; ) {
6164
- const [, i, s, o] = n;
6165
- e[i] = s || o, n = t.exec(r);
6305
+ /**
6306
+ * Creates and attaches all resize handles to the wrapper.
6307
+ *
6308
+ * Iterates through the configured directions, creates a handle for each,
6309
+ * positions it, attaches the mousedown listener, and appends it to the DOM.
6310
+ */
6311
+ attachHandles() {
6312
+ this.directions.forEach((r) => {
6313
+ let e;
6314
+ this.createCustomHandle ? e = this.createCustomHandle(r) : e = this.createHandle(r), e instanceof HTMLElement || (console.warn(
6315
+ `[ResizableNodeView] createCustomHandle("${r}") did not return an HTMLElement. Falling back to default handle.`
6316
+ ), e = this.createHandle(r)), this.createCustomHandle || this.positionHandle(e, r), e.addEventListener("mousedown", (t) => this.handleResizeStart(t, r)), e.addEventListener(
6317
+ "touchstart",
6318
+ (t) => this.handleResizeStart(t, r)
6319
+ ), this.handleMap.set(r, e), this.wrapper.appendChild(e);
6320
+ });
6166
6321
  }
6167
- return e;
6168
- }
6169
- function Fs(r) {
6170
- return Object.entries(r).filter(([, e]) => e != null).map(([e, t]) => `${e}="${t}"`).join(" ");
6171
- }
6172
- function Ls(r) {
6173
- const {
6174
- nodeName: e,
6175
- name: t,
6176
- getContent: n,
6177
- parseAttributes: i = Ds,
6178
- serializeAttributes: s = Fs,
6179
- defaultAttributes: o = {},
6180
- selfClosing: l = !1,
6181
- allowedAttributes: a
6182
- } = r, c = t || e, f = (d) => {
6183
- if (!a)
6184
- return d;
6185
- const h = {};
6186
- return a.forEach((p) => {
6187
- const m = typeof p == "string" ? p : p.name, g = typeof p == "string" ? void 0 : p.skipIfDefault;
6188
- if (m in d) {
6189
- const y = d[m];
6190
- if (g !== void 0 && y === g)
6191
- return;
6192
- h[m] = y;
6193
- }
6194
- }), h;
6195
- }, u = c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6196
- return {
6197
- parseMarkdown: (d, h) => {
6198
- const p = { ...o, ...d.attributes };
6199
- if (l)
6200
- return h.createNode(e, p);
6201
- const m = n ? n(d) : d.content || "";
6202
- return m ? h.createNode(e, p, [h.createTextNode(m)]) : h.createNode(e, p, []);
6203
- },
6204
- markdownTokenizer: {
6205
- name: e,
6206
- level: "inline",
6207
- start(d) {
6208
- const h = l ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), p = d.match(h), m = p == null ? void 0 : p.index;
6209
- return m !== void 0 ? m : -1;
6210
- },
6211
- tokenize(d, h, p) {
6212
- const m = l ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`), g = d.match(m);
6213
- if (!g)
6214
- return;
6215
- let y = "", x = "";
6216
- if (l) {
6217
- const [, S] = g;
6218
- x = S;
6219
- } else {
6220
- const [, S, b] = g;
6221
- x = S, y = b || "";
6222
- }
6223
- const v = i(x.trim());
6224
- return {
6225
- type: e,
6226
- raw: g[0],
6227
- content: y.trim(),
6228
- attributes: v
6229
- };
6230
- }
6231
- },
6232
- renderMarkdown: (d) => {
6233
- let h = "";
6234
- n ? h = n(d) : d.content && d.content.length > 0 && (h = d.content.filter((y) => y.type === "text").map((y) => y.text).join(""));
6235
- const p = f(d.attrs || {}), m = s(p), g = m ? ` ${m}` : "";
6236
- return l ? `[${c}${g}]` : `[${c}${g}]${h}[/${c}]`;
6237
- }
6238
- };
6239
- }
6240
- function Ws(r, e, t) {
6241
- var n, i, s, o;
6242
- const l = r.split(`
6243
- `), a = [];
6244
- let c = "", f = 0;
6245
- const u = e.baseIndentSize || 2;
6246
- for (; f < l.length; ) {
6247
- const d = l[f], h = d.match(e.itemPattern);
6248
- if (!h) {
6249
- if (a.length > 0)
6250
- break;
6251
- if (d.trim() === "") {
6252
- f += 1, c = `${c}${d}
6253
- `;
6254
- continue;
6255
- } else
6256
- return;
6257
- }
6258
- const p = e.extractItemData(h), { indentLevel: m, mainContent: g } = p;
6259
- c = `${c}${d}
6260
- `;
6261
- const y = [g];
6262
- for (f += 1; f < l.length; ) {
6263
- const b = l[f];
6264
- if (b.trim() === "") {
6265
- const R = l.slice(f + 1).findIndex((H) => H.trim() !== "");
6266
- if (R === -1)
6267
- break;
6268
- if ((((i = (n = l[f + 1 + R].match(/^(\s*)/)) == null ? void 0 : n[1]) == null ? void 0 : i.length) || 0) > m) {
6269
- y.push(b), c = `${c}${b}
6270
- `, f += 1;
6271
- continue;
6272
- } else
6273
- break;
6274
- }
6275
- if ((((o = (s = b.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : o.length) || 0) > m)
6276
- y.push(b), c = `${c}${b}
6277
- `, f += 1;
6278
- else
6279
- break;
6280
- }
6281
- let x;
6282
- const v = y.slice(1);
6283
- if (v.length > 0) {
6284
- const b = v.map((I) => I.slice(m + u)).join(`
6285
- `);
6286
- b.trim() && (e.customNestedParser ? x = e.customNestedParser(b) : x = t.blockTokens(b));
6322
+ /**
6323
+ * Removes all resize handles from the wrapper.
6324
+ *
6325
+ * Cleans up the handle map and removes each handle element from the DOM.
6326
+ */
6327
+ removeHandles() {
6328
+ this.handleMap.forEach((r) => r.remove()), this.handleMap.clear();
6329
+ }
6330
+ /**
6331
+ * Applies initial sizing from node attributes to the element.
6332
+ *
6333
+ * If width/height attributes exist on the node, they're applied to the element.
6334
+ * Otherwise, the element's natural/current dimensions are measured. The aspect
6335
+ * ratio is calculated for later use in aspect-ratio-preserving resizes.
6336
+ */
6337
+ applyInitialSize() {
6338
+ const r = this.node.attrs.width, e = this.node.attrs.height;
6339
+ r ? (this.element.style.width = `${r}px`, this.initialWidth = r) : this.initialWidth = this.element.offsetWidth, e ? (this.element.style.height = `${e}px`, this.initialHeight = e) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
6340
+ }
6341
+ /**
6342
+ * Initiates a resize operation when a handle is clicked.
6343
+ *
6344
+ * Captures the starting mouse position and element dimensions, sets up
6345
+ * the resize state, adds the resizing class and state attribute, and
6346
+ * attaches document-level listeners for mouse movement and keyboard input.
6347
+ *
6348
+ * @param event - The mouse down event
6349
+ * @param direction - The direction of the handle being dragged
6350
+ */
6351
+ handleResizeStart(r, e) {
6352
+ r.preventDefault(), r.stopPropagation(), this.isResizing = !0, this.activeHandle = e, Vs(r) ? (this.startX = r.touches[0].clientX, this.startY = r.touches[0].clientY) : (this.startX = r.clientX, this.startY = r.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
6353
+ }
6354
+ handleResize(r, e) {
6355
+ if (!this.activeHandle)
6356
+ return;
6357
+ const t = this.preserveAspectRatio || this.isShiftKeyPressed, { width: n, height: i } = this.calculateNewDimensions(this.activeHandle, r, e), s = this.applyConstraints(n, i, t);
6358
+ this.element.style.width = `${s.width}px`, this.element.style.height = `${s.height}px`, this.onResize && this.onResize(s.width, s.height);
6359
+ }
6360
+ /**
6361
+ * Calculates new dimensions based on mouse delta and resize direction.
6362
+ *
6363
+ * Takes the starting dimensions and applies the mouse movement delta
6364
+ * according to the handle direction. For corner handles, both dimensions
6365
+ * are affected. For edge handles, only one dimension changes. If aspect
6366
+ * ratio should be preserved, delegates to applyAspectRatio.
6367
+ *
6368
+ * @param direction - The active resize handle direction
6369
+ * @param deltaX - Horizontal mouse movement since resize start
6370
+ * @param deltaY - Vertical mouse movement since resize start
6371
+ * @returns The calculated width and height
6372
+ */
6373
+ calculateNewDimensions(r, e, t) {
6374
+ let n = this.startWidth, i = this.startHeight;
6375
+ const s = r.includes("right"), o = r.includes("left"), l = r.includes("bottom"), a = r.includes("top");
6376
+ return s ? n = this.startWidth + e : o && (n = this.startWidth - e), l ? i = this.startHeight + t : a && (i = this.startHeight - t), (r === "right" || r === "left") && (n = this.startWidth + (s ? e : -e)), (r === "top" || r === "bottom") && (i = this.startHeight + (l ? t : -t)), this.preserveAspectRatio || this.isShiftKeyPressed ? this.applyAspectRatio(n, i, r) : { width: n, height: i };
6377
+ }
6378
+ /**
6379
+ * Applies min/max constraints to dimensions.
6380
+ *
6381
+ * When aspect ratio is NOT preserved, constraints are applied independently
6382
+ * to width and height. When aspect ratio IS preserved, constraints are
6383
+ * applied while maintaining the aspect ratio—if one dimension hits a limit,
6384
+ * the other is recalculated proportionally.
6385
+ *
6386
+ * This ensures that aspect ratio is never broken when constrained.
6387
+ *
6388
+ * @param width - The unconstrained width
6389
+ * @param height - The unconstrained height
6390
+ * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining
6391
+ * @returns The constrained dimensions
6392
+ */
6393
+ applyConstraints(r, e, t) {
6394
+ var n, i, s, o;
6395
+ if (!t) {
6396
+ let c = Math.max(this.minSize.width, r), f = Math.max(this.minSize.height, e);
6397
+ return (n = this.maxSize) != null && n.width && (c = Math.min(this.maxSize.width, c)), (i = this.maxSize) != null && i.height && (f = Math.min(this.maxSize.height, f)), { width: c, height: f };
6287
6398
  }
6288
- const S = e.createToken(p, x);
6289
- a.push(S);
6399
+ let l = r, a = e;
6400
+ return l < this.minSize.width && (l = this.minSize.width, a = l / this.aspectRatio), a < this.minSize.height && (a = this.minSize.height, l = a * this.aspectRatio), (s = this.maxSize) != null && s.width && l > this.maxSize.width && (l = this.maxSize.width, a = l / this.aspectRatio), (o = this.maxSize) != null && o.height && a > this.maxSize.height && (a = this.maxSize.height, l = a * this.aspectRatio), { width: l, height: a };
6290
6401
  }
6291
- if (a.length !== 0)
6292
- return {
6293
- items: a,
6294
- raw: c
6402
+ /**
6403
+ * Adjusts dimensions to maintain the original aspect ratio.
6404
+ *
6405
+ * For horizontal handles (left/right), uses width as the primary dimension
6406
+ * and calculates height from it. For vertical handles (top/bottom), uses
6407
+ * height as primary and calculates width. For corner handles, uses width
6408
+ * as the primary dimension.
6409
+ *
6410
+ * @param width - The new width
6411
+ * @param height - The new height
6412
+ * @param direction - The active resize direction
6413
+ * @returns Dimensions adjusted to preserve aspect ratio
6414
+ */
6415
+ applyAspectRatio(r, e, t) {
6416
+ const n = t === "left" || t === "right", i = t === "top" || t === "bottom";
6417
+ return n ? {
6418
+ width: r,
6419
+ height: r / this.aspectRatio
6420
+ } : i ? {
6421
+ width: e * this.aspectRatio,
6422
+ height: e
6423
+ } : {
6424
+ width: r,
6425
+ height: r / this.aspectRatio
6295
6426
  };
6296
- }
6297
- function Js(r, e, t, n) {
6298
- if (!r || !Array.isArray(r.content))
6299
- return "";
6300
- const i = typeof t == "function" ? t(n) : t, [s, ...o] = r.content, l = e.renderChildren([s]);
6301
- let a = `${i}${l}`;
6302
- return o && o.length > 0 && o.forEach((c, f) => {
6303
- var u, d;
6304
- const h = (d = (u = e.renderChild) == null ? void 0 : u.call(e, c, f + 1)) != null ? d : e.renderChildren([c]);
6305
- if (h != null) {
6306
- const p = h.split(`
6307
- `).map((m) => m ? e.indent(m) : e.indent("")).join(`
6308
- `);
6309
- a += c.type === "paragraph" ? `
6310
-
6311
- ${p}` : `
6312
- ${p}`;
6313
- }
6314
- }), a;
6315
- }
6316
- var ko = class On extends mt {
6427
+ }
6428
+ }, Mo = class Dn extends yt {
6317
6429
  constructor() {
6318
6430
  super(...arguments), this.type = "node";
6319
6431
  }
@@ -6323,7 +6435,7 @@ var ko = class On extends mt {
6323
6435
  */
6324
6436
  static create(e = {}) {
6325
6437
  const t = typeof e == "function" ? e() : e;
6326
- return new On(t);
6438
+ return new Dn(t);
6327
6439
  }
6328
6440
  configure(e) {
6329
6441
  return super.configure(e);
@@ -6332,7 +6444,7 @@ var ko = class On extends mt {
6332
6444
  const t = typeof e == "function" ? e() : e;
6333
6445
  return super.extend(t);
6334
6446
  }
6335
- }, xo = class {
6447
+ }, Eo = class {
6336
6448
  constructor(r, e, t) {
6337
6449
  this.isDragging = !1, this.component = r, this.editor = e.editor, this.options = {
6338
6450
  stopEvent: null,
@@ -6426,7 +6538,10 @@ var ko = class On extends mt {
6426
6538
  * @return `true` if it can safely be ignored.
6427
6539
  */
6428
6540
  ignoreMutation(r) {
6429
- return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: r }) : this.node.isLeaf || this.node.isAtom ? !0 : r.type === "selection" || this.dom.contains(r.target) && r.type === "childList" && (ge() || tt()) && this.editor.isFocused && [...Array.from(r.addedNodes), ...Array.from(r.removedNodes)].every((t) => t.isContentEditable) ? !1 : this.contentDOM === r.target && r.type === "attributes" ? !0 : !this.contentDOM.contains(r.target);
6541
+ return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: r }) : this.node.isLeaf || this.node.isAtom ? !0 : r.type === "selection" || this.dom.contains(r.target) && r.type === "childList" && (ge() || tt()) && this.editor.isFocused && [
6542
+ ...Array.from(r.addedNodes),
6543
+ ...Array.from(r.removedNodes)
6544
+ ].every((t) => t.isContentEditable) ? !1 : this.contentDOM === r.target && r.type === "attributes" ? !0 : !this.contentDOM.contains(r.target);
6430
6545
  }
6431
6546
  /**
6432
6547
  * Update the attributes of the prosemirror node.
@@ -6451,8 +6566,8 @@ var ko = class On extends mt {
6451
6566
  this.editor.commands.deleteRange({ from: r, to: e });
6452
6567
  }
6453
6568
  };
6454
- function vo(r) {
6455
- return new Rn({
6569
+ function Co(r) {
6570
+ return new $n({
6456
6571
  find: r.find,
6457
6572
  handler: ({ state: e, range: t, match: n, pasteEvent: i }) => {
6458
6573
  const s = V(r.getAttributes, void 0, n, i);
@@ -6462,15 +6577,15 @@ function vo(r) {
6462
6577
  let c = t.to;
6463
6578
  if (l) {
6464
6579
  const f = a.search(/\S/), u = t.from + a.indexOf(l), d = u + l.length;
6465
- if (En(t.from, t.to, e.doc).filter((m) => m.mark.type.excluded.find((y) => y === r.type && y !== m.mark.type)).filter((m) => m.to > u).length)
6580
+ if (An(t.from, t.to, e.doc).filter((m) => m.mark.type.excluded.find((y) => y === r.type && y !== m.mark.type)).filter((m) => m.to > u).length)
6466
6581
  return null;
6467
6582
  d < t.to && o.delete(d, t.to), u > t.from && o.delete(t.from + f, u), c = t.from + f + l.length, o.addMark(t.from + f, c, r.type.create(s || {})), n.index !== void 0 && n.input !== void 0 && n.index + n[0].length >= n.input.length || o.removeStoredMark(r.type);
6468
6583
  }
6469
6584
  }
6470
6585
  });
6471
6586
  }
6472
- function bo(r) {
6473
- return new Rn({
6587
+ function To(r) {
6588
+ return new $n({
6474
6589
  find: r.find,
6475
6590
  handler({ match: e, chain: t, range: n, pasteEvent: i }) {
6476
6591
  const s = V(r.getAttributes, void 0, e, i), o = V(r.getContent, void 0, s);
@@ -6482,68 +6597,69 @@ function bo(r) {
6482
6597
  });
6483
6598
  }
6484
6599
  export {
6485
- io as $,
6600
+ Eo as $,
6486
6601
  j as A,
6487
- Wi as B,
6488
- Yi as C,
6489
- jt as D,
6602
+ _i as B,
6603
+ es as C,
6604
+ Vt as D,
6490
6605
  q as E,
6491
6606
  w as F,
6492
- Xs as G,
6493
- En as H,
6494
- Zs as I,
6495
- go as J,
6496
- Ks as K,
6497
- Pe as L,
6498
- lo as M,
6499
- ko as N,
6500
- qs as O,
6501
- Rn as P,
6502
- Us as Q,
6503
- Ae as R,
6607
+ Zs as G,
6608
+ An as H,
6609
+ no as I,
6610
+ po as J,
6611
+ Gs as K,
6612
+ Be as L,
6613
+ wo as M,
6614
+ Mo as N,
6615
+ Ys as O,
6616
+ $n as P,
6617
+ Qs as Q,
6618
+ Ie as R,
6504
6619
  E as S,
6505
6620
  P as T,
6506
6621
  V as U,
6507
6622
  ke as V,
6508
- Cn as W,
6509
- vr as X,
6510
- xr as Y,
6511
- ji as Z,
6512
- xo as _,
6513
- Ys as a,
6514
- bo as a0,
6515
- pt as a1,
6516
- Qs as a2,
6517
- qi as a3,
6518
- rn as a4,
6519
- eo as a5,
6520
- so as a6,
6521
- Qi as a7,
6522
- wo as a8,
6523
- po as a9,
6524
- no as b,
6525
- to as c,
6526
- N as d,
6527
- Gs as e,
6528
- oo as f,
6529
- yo as g,
6530
- vo as h,
6623
+ ho as W,
6624
+ In as X,
6625
+ Er as Y,
6626
+ Mr as Z,
6627
+ qi as _,
6628
+ eo as a,
6629
+ ao as a0,
6630
+ To as a1,
6631
+ pt as a2,
6632
+ to as a3,
6633
+ Yi as a4,
6634
+ ln as a5,
6635
+ io as a6,
6636
+ co as a7,
6637
+ ts as a8,
6638
+ go as a9,
6639
+ So as aa,
6640
+ oo as b,
6641
+ so as c,
6642
+ ro as d,
6643
+ N as e,
6644
+ fo as f,
6645
+ mo as g,
6646
+ Co as h,
6531
6647
  we as i,
6532
- co as j,
6533
- $e as k,
6534
- mo as l,
6535
- Vi as m,
6536
- fo as n,
6537
- ro as o,
6538
- Ws as p,
6648
+ ko as j,
6649
+ Pe as k,
6650
+ uo as l,
6651
+ Xi as m,
6652
+ xo as n,
6653
+ lo as o,
6654
+ zs as p,
6539
6655
  Ve as q,
6540
- Js as r,
6541
- ao as s,
6542
- uo as t,
6656
+ Os as r,
6657
+ yo as s,
6658
+ vo as t,
6543
6659
  M as u,
6544
6660
  k as v,
6545
- ho as w,
6546
- Vs as x,
6661
+ bo as w,
6662
+ Xs as x,
6547
6663
  Qe as y,
6548
- Ls as z
6664
+ Ns as z
6549
6665
  };