@blocknote/core 0.51.4 → 0.52.0

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 (396) hide show
  1. package/dist/BlockNoteExtension-B_IEJHS8.js +38 -0
  2. package/dist/BlockNoteExtension-B_IEJHS8.js.map +1 -0
  3. package/dist/BlockNoteExtension-M0znTzxP.cjs +2 -0
  4. package/dist/BlockNoteExtension-M0znTzxP.cjs.map +1 -0
  5. package/dist/ThreadStore-Bx-gSEh1.cjs +2 -0
  6. package/dist/ThreadStore-Bx-gSEh1.cjs.map +1 -0
  7. package/dist/ThreadStore-et9wB5Xt.js +11 -0
  8. package/dist/ThreadStore-et9wB5Xt.js.map +1 -0
  9. package/dist/UserStore-DCG6lsla.cjs +2 -0
  10. package/dist/UserStore-DCG6lsla.cjs.map +1 -0
  11. package/dist/UserStore-QbbPFj0z.js +73 -0
  12. package/dist/UserStore-QbbPFj0z.js.map +1 -0
  13. package/dist/blocknote.cjs +1 -1
  14. package/dist/blocknote.js +6 -7
  15. package/dist/blocks-BqHv0xhc.cjs +12 -0
  16. package/dist/blocks-BqHv0xhc.cjs.map +1 -0
  17. package/dist/{blocks-DGsP5WKr.js → blocks-CiuUGa1E.js} +1093 -994
  18. package/dist/blocks-CiuUGa1E.js.map +1 -0
  19. package/dist/blocks.cjs +1 -1
  20. package/dist/blocks.js +2 -2
  21. package/dist/comments.cjs +1 -1
  22. package/dist/comments.cjs.map +1 -1
  23. package/dist/comments.js +75 -340
  24. package/dist/comments.js.map +1 -1
  25. package/dist/{en-Cj5r8sW_.cjs → en-C5Z4Ag9_.cjs} +2 -2
  26. package/dist/en-C5Z4Ag9_.cjs.map +1 -0
  27. package/dist/{en-B9hMApn4.js → en-CGKXfWma.js} +9 -1
  28. package/dist/en-CGKXfWma.js.map +1 -0
  29. package/dist/{extensions-Co4y7P63.js → extensions-CrUGDOks.js} +655 -583
  30. package/dist/extensions-CrUGDOks.js.map +1 -0
  31. package/dist/extensions-Ghr9QqqR.cjs +52 -0
  32. package/dist/extensions-Ghr9QqqR.cjs.map +1 -0
  33. package/dist/extensions.cjs +1 -1
  34. package/dist/extensions.js +4 -4
  35. package/dist/locales.cjs +1 -1
  36. package/dist/locales.cjs.map +1 -1
  37. package/dist/locales.js +177 -1
  38. package/dist/locales.js.map +1 -1
  39. package/dist/{src-Bcud0PIg.js → src-DTF83Cl9.js} +1243 -1297
  40. package/dist/src-DTF83Cl9.js.map +1 -0
  41. package/dist/src-OfbaVbMw.cjs +21 -0
  42. package/dist/src-OfbaVbMw.cjs.map +1 -0
  43. package/dist/style.css +1 -1
  44. package/dist/webpack-stats.json +1 -1
  45. package/dist/y.cjs +2 -0
  46. package/dist/y.cjs.map +1 -0
  47. package/dist/y.js +989 -0
  48. package/dist/y.js.map +1 -0
  49. package/dist/yjs.cjs +1 -1
  50. package/dist/yjs.cjs.map +1 -1
  51. package/dist/yjs.js +535 -14
  52. package/dist/yjs.js.map +1 -1
  53. package/package.json +46 -19
  54. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +1 -1
  55. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +1 -1
  56. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
  57. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +25 -20
  58. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +39 -29
  59. package/src/api/blockManipulation/commands/nestBlock/nestBlock.test.ts +2 -2
  60. package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +4 -8
  61. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +1 -1
  62. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +21 -9
  63. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +6 -5
  64. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +362 -4
  65. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +240 -30
  66. package/src/api/blockManipulation/getBlock/getBlock.ts +4 -9
  67. package/src/api/blockManipulation/selections/selection.ts +3 -6
  68. package/src/api/blockManipulation/selections/textCursorPosition.ts +10 -10
  69. package/src/api/blockManipulation/setupTestEnv.ts +1 -1
  70. package/src/api/blockManipulation/tables/tables.test.ts +1 -1
  71. package/src/api/clipboard/fromClipboard/fileDropExtension.ts +1 -1
  72. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +8 -4
  73. package/src/api/clipboard/fromClipboard/pasteExtension.ts +1 -1
  74. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +2 -1
  75. package/src/api/exporters/markdown/htmlToMarkdown.ts +79 -43
  76. package/src/api/getBlockInfoFromPos.test.ts +256 -0
  77. package/src/api/getBlockInfoFromPos.ts +53 -15
  78. package/src/api/getBlocksChangedByTransaction.test.ts +2 -1
  79. package/src/api/getBlocksChangedByTransaction.ts +6 -6
  80. package/src/api/nodeConversions/blockToNode.test.ts +113 -0
  81. package/src/api/nodeConversions/blockToNode.ts +15 -3
  82. package/src/api/nodeConversions/fragmentToBlocks.ts +2 -4
  83. package/src/api/nodeConversions/nodeToBlock.ts +28 -58
  84. package/src/api/nodeUtil.ts +6 -2
  85. package/src/api/parsers/html/parseHTML.ts +1 -1
  86. package/src/api/parsers/html/util/nestedLists.test.ts +1 -1
  87. package/src/api/parsers/markdown/detectMarkdown.test.ts +1 -1
  88. package/src/api/parsers/markdown/markdownToHtml.ts +228 -82
  89. package/src/api/pmUtil.ts +18 -1
  90. package/src/api/positionMapping.test.ts +20 -345
  91. package/src/api/positionMapping.ts +13 -83
  92. package/src/blocks/Audio/block.ts +1 -1
  93. package/src/blocks/Code/block.test.ts +14 -7
  94. package/src/blocks/Code/block.ts +2 -2
  95. package/src/blocks/Image/block.ts +1 -1
  96. package/src/blocks/ListItem/CheckListItem/block.test.ts +1 -1
  97. package/src/blocks/ListItem/ListItemKeyboardShortcuts.ts +2 -2
  98. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.test.ts +4 -11
  99. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +47 -50
  100. package/src/blocks/Table/TableExtension.test.ts +9 -6
  101. package/src/blocks/Table/TableExtension.ts +20 -6
  102. package/src/blocks/Table/block.ts +18 -5
  103. package/src/blocks/Video/block.ts +1 -1
  104. package/src/blocks/utils/listItemEnterHandler.ts +3 -2
  105. package/src/comments/extension.ts +30 -21
  106. package/src/comments/index.ts +0 -3
  107. package/src/comments/mark.ts +4 -0
  108. package/src/comments/threadstore/ThreadStore.ts +4 -8
  109. package/src/comments/types.ts +0 -8
  110. package/src/editor/Block.css +307 -3
  111. package/src/editor/BlockNoteEditor.test.ts +21 -18
  112. package/src/editor/BlockNoteEditor.ts +22 -57
  113. package/src/editor/BlockNoteExtension.test.ts +1 -1
  114. package/src/editor/managers/BlockManager.ts +1 -1
  115. package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +249 -0
  116. package/src/editor/managers/ExtensionManager/extensions.ts +7 -18
  117. package/src/editor/managers/ExtensionManager/index.ts +168 -68
  118. package/src/editor/managers/StateManager.ts +4 -3
  119. package/src/editor/performance.test.ts +14 -1
  120. package/src/editor/transformPasted.test.ts +1 -1
  121. package/src/extensions/Placeholder/Placeholder.ts +1 -0
  122. package/src/extensions/PositionMapping/PositionMapping.ts +68 -0
  123. package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +14 -1
  124. package/src/extensions/PreviousBlockType/PreviousBlockType.ts +14 -11
  125. package/src/extensions/SideMenu/SideMenu.ts +9 -2
  126. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +1 -1
  127. package/src/extensions/TableHandles/TableHandles.ts +18 -20
  128. package/src/extensions/TrailingNode/TrailingNode.ts +33 -1
  129. package/src/extensions/Versioning/Versioning.test.ts +435 -0
  130. package/src/extensions/Versioning/Versioning.ts +628 -0
  131. package/src/extensions/Versioning/inMemoryVersioning.test.ts +469 -0
  132. package/src/extensions/Versioning/inMemoryVersioning.ts +263 -0
  133. package/src/extensions/Versioning/index.ts +2 -0
  134. package/src/extensions/index.ts +6 -9
  135. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +155 -0
  136. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +6 -8
  137. package/src/extensions/tiptap-extensions/Link/helpers/autolink.ts +9 -9
  138. package/src/extensions/tiptap-extensions/Link/helpers/linkDetector.ts +8 -10
  139. package/src/extensions/tiptap-extensions/Link/helpers/whitespace.ts +2 -2
  140. package/src/extensions/tiptap-extensions/Link/link.test.ts +26 -22
  141. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.ts +187 -0
  142. package/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts +37 -24
  143. package/src/extensions/tiptap-extensions/index.ts +1 -25
  144. package/src/i18n/locales/ar.ts +9 -0
  145. package/src/i18n/locales/de.ts +9 -0
  146. package/src/i18n/locales/en.ts +10 -1
  147. package/src/i18n/locales/es.ts +9 -0
  148. package/src/i18n/locales/fa.ts +11 -1
  149. package/src/i18n/locales/fr.ts +9 -0
  150. package/src/i18n/locales/he.ts +10 -1
  151. package/src/i18n/locales/hr.ts +10 -0
  152. package/src/i18n/locales/is.ts +10 -0
  153. package/src/i18n/locales/it.ts +9 -0
  154. package/src/i18n/locales/ja.ts +9 -0
  155. package/src/i18n/locales/ko.ts +9 -0
  156. package/src/i18n/locales/nl.ts +10 -0
  157. package/src/i18n/locales/no.ts +10 -0
  158. package/src/i18n/locales/pl.ts +9 -0
  159. package/src/i18n/locales/pt.ts +10 -0
  160. package/src/i18n/locales/ru.ts +10 -0
  161. package/src/i18n/locales/sk.ts +10 -1
  162. package/src/i18n/locales/uk.ts +9 -0
  163. package/src/i18n/locales/uz.ts +9 -0
  164. package/src/i18n/locales/vi.ts +9 -0
  165. package/src/i18n/locales/zh-tw.ts +9 -0
  166. package/src/i18n/locales/zh.ts +9 -0
  167. package/src/index.ts +2 -0
  168. package/src/pm-nodes/BlockContainer.ts +4 -1
  169. package/src/pm-nodes/BlockGroup.ts +4 -1
  170. package/src/pm-nodes/Doc.ts +4 -1
  171. package/src/pm-nodes/suggestionMarks.ts +43 -0
  172. package/src/schema/blocks/createSpec.test.ts +123 -0
  173. package/src/schema/blocks/createSpec.ts +82 -24
  174. package/src/schema/blocks/extendBlockSpec.test.ts +188 -0
  175. package/src/schema/blocks/internal.ts +13 -43
  176. package/src/schema/blocks/types.ts +69 -22
  177. package/src/schema/contentTypePropagation.test.ts +182 -0
  178. package/src/schema/index.ts +1 -0
  179. package/src/schema/inlineContent/internal.ts +1 -1
  180. package/src/schema/inlineContent/types.ts +3 -3
  181. package/src/schema/markGroups.ts +50 -0
  182. package/src/user/UserStore.ts +199 -0
  183. package/src/user/createUserStore.test.ts +126 -0
  184. package/src/user/index.ts +2 -0
  185. package/src/user/userColors.ts +72 -0
  186. package/src/util/string.ts +1 -1
  187. package/src/util/topo-sort.test.ts +1 -1
  188. package/src/util/typescript.ts +2 -1
  189. package/src/vite-env.d.ts +1 -1
  190. package/src/y/README.md +5 -0
  191. package/src/{comments/threadstore/yjs → y/comments}/RESTYjsThreadStore.ts +8 -14
  192. package/src/y/comments/YjsThreadStore.test.ts +295 -0
  193. package/src/y/comments/YjsThreadStore.ts +358 -0
  194. package/src/y/comments/YjsThreadStoreBase.ts +50 -0
  195. package/src/y/comments/index.ts +3 -0
  196. package/src/y/comments/yjsHelpers.ts +125 -0
  197. package/src/y/extensions/AttributionExtension.test.ts +86 -0
  198. package/src/y/extensions/AttributionExtension.ts +378 -0
  199. package/src/y/extensions/DiffVersioningExtension.test.ts +193 -0
  200. package/src/y/extensions/DiffVersioningExtension.ts +228 -0
  201. package/src/y/extensions/ForkYDoc.test.ts +253 -0
  202. package/src/y/extensions/ForkYDoc.ts +108 -0
  203. package/src/y/extensions/RelativePositionMapping.test.ts +418 -0
  204. package/src/y/extensions/RelativePositionMapping.ts +49 -0
  205. package/src/y/extensions/Suggestions.ts +174 -0
  206. package/src/y/extensions/Versioning.test.ts +395 -0
  207. package/src/y/extensions/Versioning.ts +115 -0
  208. package/src/y/extensions/YAttributionMarks.ts +320 -0
  209. package/src/{extensions/Collaboration → y/extensions}/YCursorPlugin.ts +15 -7
  210. package/src/y/extensions/YSync.ts +125 -0
  211. package/src/y/extensions/blockMatchNodes.ts +182 -0
  212. package/src/y/extensions/index.ts +156 -0
  213. package/src/y/index.ts +4 -0
  214. package/src/y/utils.test.ts +1042 -0
  215. package/src/y/utils.ts +242 -0
  216. package/src/y/versioning/__test__/fixtures/activity-all-after.bin +0 -0
  217. package/src/y/versioning/__test__/fixtures/activity-all-after.json +50 -0
  218. package/src/y/versioning/__test__/fixtures/activity-all.bin +0 -0
  219. package/src/y/versioning/__test__/fixtures/activity-all.json +20 -0
  220. package/src/y/versioning/__test__/fixtures/activity-filtered-after.bin +0 -0
  221. package/src/y/versioning/__test__/fixtures/activity-filtered-after.json +32 -0
  222. package/src/y/versioning/__test__/fixtures/activity-filtered-before.json +1 -0
  223. package/src/y/versioning/__test__/fixtures/changeset.bin +0 -0
  224. package/src/y/versioning/__test__/fixtures/patch-response.json +4 -0
  225. package/src/y/versioning/__test__/yhub.test.ts +752 -0
  226. package/src/y/versioning/index.ts +1 -0
  227. package/src/y/versioning/yhub.ts +631 -0
  228. package/src/yjs/README.md +5 -0
  229. package/src/yjs/comments/RESTYjsThreadStore.ts +166 -0
  230. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.test.ts +3 -3
  231. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.ts +7 -3
  232. package/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.ts +3 -3
  233. package/src/yjs/comments/index.ts +3 -0
  234. package/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.ts +5 -1
  235. package/src/yjs/extensions/FixUpSchema.test.ts +421 -0
  236. package/src/yjs/extensions/FixUpSchema.ts +88 -0
  237. package/src/yjs/extensions/ForkYDoc.test.ts +216 -0
  238. package/src/{extensions/Collaboration → yjs/extensions}/ForkYDoc.ts +38 -57
  239. package/src/yjs/extensions/RelativePositionMapping.test.ts +418 -0
  240. package/src/yjs/extensions/RelativePositionMapping.ts +71 -0
  241. package/src/yjs/extensions/Versioning.test.ts +549 -0
  242. package/src/yjs/extensions/Versioning.ts +83 -0
  243. package/src/yjs/extensions/YCursorPlugin.ts +201 -0
  244. package/src/{extensions/Collaboration → yjs/extensions}/YSync.ts +1 -1
  245. package/src/yjs/extensions/index.ts +89 -0
  246. package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.test.ts +1 -1
  247. package/src/yjs/index.ts +2 -0
  248. package/src/yjs/utils.test.ts +5 -15
  249. package/src/yjs/utils.ts +36 -0
  250. package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +3 -1
  251. package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
  252. package/types/src/api/getBlockInfoFromPos.d.ts +5 -9
  253. package/types/src/api/nodeConversions/nodeToBlock.d.ts +4 -6
  254. package/types/src/api/pmUtil.d.ts +12 -1
  255. package/types/src/blocks/Audio/block.d.ts +2 -2
  256. package/types/src/blocks/Code/block.d.ts +2 -2
  257. package/types/src/blocks/File/block.d.ts +2 -2
  258. package/types/src/blocks/Heading/block.d.ts +21 -21
  259. package/types/src/blocks/Image/block.d.ts +3 -3
  260. package/types/src/blocks/ListItem/CheckListItem/block.d.ts +6 -6
  261. package/types/src/blocks/ListItem/NumberedListItem/block.d.ts +6 -6
  262. package/types/src/blocks/Video/block.d.ts +3 -3
  263. package/types/src/blocks/defaultBlocks.d.ts +17 -17
  264. package/types/src/comments/extension.d.ts +18 -5
  265. package/types/src/comments/index.d.ts +0 -3
  266. package/types/src/comments/threadstore/ThreadStore.d.ts +4 -8
  267. package/types/src/comments/types.d.ts +0 -8
  268. package/types/src/editor/BlockNoteEditor.d.ts +8 -9
  269. package/types/src/editor/managers/BlockManager.d.ts +1 -1
  270. package/types/src/editor/managers/ExtensionManager/extensions.d.ts +2 -2
  271. package/types/src/editor/managers/ExtensionManager/index.d.ts +13 -0
  272. package/types/src/editor/managers/SelectionManager.d.ts +1 -1
  273. package/types/src/extensions/PositionMapping/PositionMapping.d.ts +4 -0
  274. package/types/src/extensions/TableHandles/TableHandles.d.ts +6 -6
  275. package/types/src/extensions/Versioning/Versioning.d.ts +352 -0
  276. package/types/src/extensions/Versioning/Versioning.test.d.ts +1 -0
  277. package/types/src/extensions/Versioning/inMemoryVersioning.d.ts +37 -0
  278. package/types/src/extensions/Versioning/inMemoryVersioning.test.d.ts +1 -0
  279. package/types/src/extensions/Versioning/index.d.ts +2 -0
  280. package/types/src/extensions/index.d.ts +6 -9
  281. package/types/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.d.ts +1 -0
  282. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.d.ts +6 -1
  283. package/types/src/extensions/tiptap-extensions/UniqueID/UniqueID.test.d.ts +4 -0
  284. package/types/src/extensions/tiptap-extensions/index.d.ts +1 -5
  285. package/types/src/i18n/locales/en.d.ts +9 -1
  286. package/types/src/i18n/locales/fa.d.ts +9 -1
  287. package/types/src/i18n/locales/sk.d.ts +9 -1
  288. package/types/src/index.d.ts +2 -0
  289. package/types/src/pm-nodes/suggestionMarks.d.ts +26 -0
  290. package/types/src/schema/blocks/createSpec.d.ts +4 -4
  291. package/types/src/schema/blocks/createSpec.test.d.ts +1 -0
  292. package/types/src/schema/blocks/extendBlockSpec.test.d.ts +1 -0
  293. package/types/src/schema/blocks/internal.d.ts +5 -7
  294. package/types/src/schema/blocks/types.d.ts +22 -14
  295. package/types/src/schema/contentTypePropagation.test.d.ts +1 -0
  296. package/types/src/schema/index.d.ts +1 -0
  297. package/types/src/schema/inlineContent/types.d.ts +3 -3
  298. package/types/src/schema/markGroups.d.ts +33 -0
  299. package/types/src/user/UserStore.d.ts +105 -0
  300. package/types/src/user/createUserStore.test.d.ts +1 -0
  301. package/types/src/user/index.d.ts +2 -0
  302. package/types/src/user/userColors.d.ts +36 -0
  303. package/types/src/y/comments/RESTYjsThreadStore.d.ts +77 -0
  304. package/types/src/y/comments/YjsThreadStore.d.ts +79 -0
  305. package/types/src/y/comments/YjsThreadStore.test.d.ts +1 -0
  306. package/types/src/y/comments/YjsThreadStoreBase.d.ts +15 -0
  307. package/types/src/y/comments/index.d.ts +3 -0
  308. package/types/src/y/comments/yjsHelpers.d.ts +13 -0
  309. package/types/src/y/extensions/AttributionExtension.d.ts +74 -0
  310. package/types/src/y/extensions/AttributionExtension.test.d.ts +1 -0
  311. package/types/src/y/extensions/DiffVersioningExtension.d.ts +69 -0
  312. package/types/src/y/extensions/DiffVersioningExtension.test.d.ts +1 -0
  313. package/types/src/{extensions/Collaboration → y/extensions}/ForkYDoc.d.ts +4 -2
  314. package/types/src/y/extensions/ForkYDoc.test.d.ts +1 -0
  315. package/types/src/y/extensions/RelativePositionMapping.d.ts +4 -0
  316. package/types/src/y/extensions/RelativePositionMapping.test.d.ts +1 -0
  317. package/types/src/y/extensions/Suggestions.d.ts +36 -0
  318. package/types/src/y/extensions/Versioning.d.ts +17 -0
  319. package/types/src/y/extensions/Versioning.test.d.ts +1 -0
  320. package/types/src/y/extensions/YAttributionMarks.d.ts +67 -0
  321. package/types/src/y/extensions/YCursorPlugin.d.ts +14 -0
  322. package/types/src/y/extensions/YSync.d.ts +32 -0
  323. package/types/src/y/extensions/blockMatchNodes.d.ts +25 -0
  324. package/types/src/y/extensions/index.d.ts +189 -0
  325. package/types/src/y/index.d.ts +4 -0
  326. package/types/src/y/utils.d.ts +82 -0
  327. package/types/src/y/utils.test.d.ts +1 -0
  328. package/types/src/y/versioning/__test__/yhub.test.d.ts +1 -0
  329. package/types/src/y/versioning/index.d.ts +1 -0
  330. package/types/src/y/versioning/yhub.d.ts +87 -0
  331. package/types/src/{comments/threadstore/yjs → yjs/comments}/RESTYjsThreadStore.d.ts +6 -10
  332. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStore.d.ts +3 -3
  333. package/types/src/yjs/comments/YjsThreadStore.test.d.ts +1 -0
  334. package/types/src/{comments/threadstore/yjs → yjs/comments}/YjsThreadStoreBase.d.ts +3 -3
  335. package/types/src/yjs/comments/index.d.ts +3 -0
  336. package/types/src/{comments/threadstore/yjs → yjs/comments}/yjsHelpers.d.ts +1 -1
  337. package/types/src/yjs/extensions/FixUpSchema.d.ts +3 -0
  338. package/types/src/yjs/extensions/FixUpSchema.test.d.ts +1 -0
  339. package/types/src/yjs/extensions/ForkYDoc.d.ts +27 -0
  340. package/types/src/yjs/extensions/ForkYDoc.test.d.ts +1 -0
  341. package/types/src/yjs/extensions/RelativePositionMapping.d.ts +4 -0
  342. package/types/src/yjs/extensions/RelativePositionMapping.test.d.ts +1 -0
  343. package/types/src/yjs/extensions/Versioning.d.ts +26 -0
  344. package/types/src/yjs/extensions/Versioning.test.d.ts +1 -0
  345. package/types/src/{extensions/Collaboration → yjs/extensions}/YCursorPlugin.d.ts +5 -2
  346. package/types/src/{extensions/Collaboration → yjs/extensions}/YSync.d.ts +1 -1
  347. package/types/src/{extensions/Collaboration/Collaboration.d.ts → yjs/extensions/index.d.ts} +36 -15
  348. package/types/src/yjs/extensions/schemaMigration/migrationRules/moveColorAttributes.test.d.ts +1 -0
  349. package/types/src/yjs/index.d.ts +2 -0
  350. package/types/src/yjs/utils.d.ts +5 -0
  351. package/dist/BlockNoteExtension-B6RhuQ3V.js +0 -27
  352. package/dist/BlockNoteExtension-B6RhuQ3V.js.map +0 -1
  353. package/dist/BlockNoteExtension-ab0REuob.cjs +0 -2
  354. package/dist/BlockNoteExtension-ab0REuob.cjs.map +0 -1
  355. package/dist/EventEmitter-CuPnGDYt.js +0 -22
  356. package/dist/EventEmitter-CuPnGDYt.js.map +0 -1
  357. package/dist/EventEmitter-DHdSnYCD.cjs +0 -2
  358. package/dist/EventEmitter-DHdSnYCD.cjs.map +0 -1
  359. package/dist/ShowSelection-BsHFfdMi.js +0 -29
  360. package/dist/ShowSelection-BsHFfdMi.js.map +0 -1
  361. package/dist/ShowSelection-DhXglbt8.cjs +0 -2
  362. package/dist/ShowSelection-DhXglbt8.cjs.map +0 -1
  363. package/dist/blocks-Bm6IfL1R.cjs +0 -11
  364. package/dist/blocks-Bm6IfL1R.cjs.map +0 -1
  365. package/dist/blocks-DGsP5WKr.js.map +0 -1
  366. package/dist/en-B9hMApn4.js.map +0 -1
  367. package/dist/en-Cj5r8sW_.cjs.map +0 -1
  368. package/dist/extensions-Co4y7P63.js.map +0 -1
  369. package/dist/extensions-IJK3t0sz.cjs +0 -52
  370. package/dist/extensions-IJK3t0sz.cjs.map +0 -1
  371. package/dist/src-B6rlChSc.cjs +0 -21
  372. package/dist/src-B6rlChSc.cjs.map +0 -1
  373. package/dist/src-Bcud0PIg.js.map +0 -1
  374. package/src/comments/userstore/UserStore.ts +0 -72
  375. package/src/extensions/Collaboration/Collaboration.ts +0 -55
  376. package/src/extensions/Collaboration/ForkYDoc.test.ts +0 -179
  377. package/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.ts +0 -175
  378. package/types/src/comments/userstore/UserStore.d.ts +0 -31
  379. package/types/src/extensions/tiptap-extensions/Suggestions/SuggestionMarks.d.ts +0 -4
  380. /package/src/{extensions/Collaboration → yjs/extensions}/YUndo.ts +0 -0
  381. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor-forked.json +0 -0
  382. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-editor.json +0 -0
  383. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap-forked.html +0 -0
  384. /package/src/{extensions/Collaboration → yjs/extensions}/__snapshots__/fork-yjs-snap.html +0 -0
  385. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.ts +0 -0
  386. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.ts +0 -0
  387. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.ts +0 -0
  388. /package/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.ts +0 -0
  389. /package/types/src/{comments/threadstore/yjs/YjsThreadStore.test.d.ts → api/getBlockInfoFromPos.test.d.ts} +0 -0
  390. /package/types/src/{extensions/Collaboration/ForkYDoc.test.d.ts → api/nodeConversions/blockToNode.test.d.ts} +0 -0
  391. /package/types/src/{extensions/Collaboration/schemaMigration/migrationRules/moveColorAttributes.test.d.ts → editor/managers/ExtensionManager/ExtensionManager.test.d.ts} +0 -0
  392. /package/types/src/{extensions/Collaboration → yjs/extensions}/YUndo.d.ts +0 -0
  393. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/SchemaMigration.d.ts +0 -0
  394. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/index.d.ts +0 -0
  395. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/migrationRule.d.ts +0 -0
  396. /package/types/src/{extensions/Collaboration → yjs/extensions}/schemaMigration/migrationRules/moveColorAttributes.d.ts +0 -0
@@ -1,9 +1,9 @@
1
- import { n as e, t } from "./BlockNoteExtension-B6RhuQ3V.js";
2
- import { DOMParser as n, Fragment as r, Slice as i } from "prosemirror-model";
3
- import { Mapping as a, ReplaceStep as o } from "prosemirror-transform";
1
+ import { a as e, n as t, t as n } from "./BlockNoteExtension-B_IEJHS8.js";
2
+ import { DOMParser as r, Fragment as i, Slice as a } from "prosemirror-model";
3
+ import { ReplaceStep as o } from "prosemirror-transform";
4
4
  import { Extension as s, InputRule as c, Mark as l, Node as u, callOrReturn as d, combineTransactionSteps as f, findChildrenInRange as p, findParentNode as m, getChangedRanges as h, getExtensionField as g, markInputRule as _, mergeAttributes as v } from "@tiptap/core";
5
- import { Plugin as ee, PluginKey as te, TextSelection as y } from "prosemirror-state";
6
- import { uuidv4 as ne } from "lib0/random";
5
+ import { uuidv4 as ee } from "lib0/random";
6
+ import { Plugin as te, PluginKey as ne, TextSelection as y } from "prosemirror-state";
7
7
  import { DOMParser as re, DOMSerializer as ie, Fragment as ae } from "@tiptap/pm/model";
8
8
  import { CellSelection as oe, TableMap as se, TableView as ce, columnResizing as le, goToNextCell as ue, isInTable as de, moveCellForward as fe, nextCell as pe, selectionCell as me, tableEditing as he } from "prosemirror-tables";
9
9
  import { createHighlightPlugin as ge } from "prosemirror-highlight";
@@ -11,29 +11,132 @@ import { createParser as _e } from "prosemirror-highlight/shiki";
11
11
  import { Plugin as ve, PluginKey as ye } from "@tiptap/pm/state";
12
12
  import { Decoration as be, DecorationSet as xe } from "@tiptap/pm/view";
13
13
  import { Decoration as Se, DecorationSet as Ce } from "prosemirror-view";
14
- import { absolutePositionToRelativePosition as we, relativePositionToAbsolutePosition as Te, ySyncPluginKey as Ee } from "y-prosemirror";
15
- import De from "@tiptap/extension-bold";
16
- import Oe from "@tiptap/extension-code";
17
- import ke from "@tiptap/extension-italic";
18
- import Ae from "@tiptap/extension-strike";
19
- import je from "@tiptap/extension-underline";
14
+ import we from "@tiptap/extension-bold";
15
+ import Te from "@tiptap/extension-code";
16
+ import Ee from "@tiptap/extension-italic";
17
+ import De from "@tiptap/extension-strike";
18
+ import Oe from "@tiptap/extension-underline";
19
+ //#region src/api/getBlockInfoFromPos.ts
20
+ function ke(e) {
21
+ return e.marks.some((e) => ["y-attributed-delete"].includes(e.type.name));
22
+ }
23
+ function Ae(e, t) {
24
+ let n = e.attrs.id;
25
+ if (!n) throw Error(`Node ${e.type.name} does not have an ID`);
26
+ if (ke(e)) {
27
+ let r = 0, i = !1;
28
+ if (t.descendants((t) => {
29
+ if (i) return !1;
30
+ if (t.attrs.id === n) {
31
+ if (t === e) return i = !0, !1;
32
+ r++;
33
+ }
34
+ return !0;
35
+ }), !i) throw Error(`Node ${e.type.name} with ID ${n} not found in document`);
36
+ return `${n}-${r}`;
37
+ }
38
+ return n;
39
+ }
40
+ function je(e, t) {
41
+ let n = e.resolve(t);
42
+ if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
43
+ posBeforeNode: n.pos,
44
+ node: n.nodeAfter
45
+ };
46
+ let r = n.depth, i = n.node(r);
47
+ for (; r > 0;) {
48
+ if (i.type.isInGroup("bnBlock")) return {
49
+ posBeforeNode: n.before(r),
50
+ node: i
51
+ };
52
+ r--, i = n.node(r);
53
+ }
54
+ let a = [];
55
+ e.descendants((e, t) => {
56
+ e.type.isInGroup("bnBlock") && a.push(t);
57
+ }), console.warn(`Position ${t} is not within a blockContainer node.`);
58
+ let o = e.resolve(a.find((e) => e >= t) || a[a.length - 1]);
59
+ return {
60
+ posBeforeNode: o.pos,
61
+ node: o.nodeAfter
62
+ };
63
+ }
64
+ function Me(e, t) {
65
+ if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
66
+ let n = e, r = t, i = {
67
+ node: n,
68
+ beforePos: r,
69
+ afterPos: r + n.nodeSize
70
+ };
71
+ if (n.type.name === "blockContainer") {
72
+ let e, t;
73
+ if (n.forEach((n, i) => {
74
+ if (n.type.spec.group === "blockContent") {
75
+ let t = n, a = r + i + 1;
76
+ e = {
77
+ node: t,
78
+ beforePos: a,
79
+ afterPos: a + n.nodeSize
80
+ };
81
+ } else if (n.type.name === "blockGroup") {
82
+ let e = n, a = r + i + 1;
83
+ t = {
84
+ node: e,
85
+ beforePos: a,
86
+ afterPos: a + n.nodeSize
87
+ };
88
+ }
89
+ }), !e) throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);
90
+ return {
91
+ isBlockContainer: !0,
92
+ bnBlock: i,
93
+ blockContent: e,
94
+ childContainer: t,
95
+ blockNoteType: e.node.type.name
96
+ };
97
+ } else {
98
+ if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
99
+ return {
100
+ isBlockContainer: !1,
101
+ bnBlock: i,
102
+ childContainer: i,
103
+ blockNoteType: i.node.type.name
104
+ };
105
+ }
106
+ }
107
+ function b(e) {
108
+ return Me(e.node, e.posBeforeNode);
109
+ }
110
+ function Ne(e) {
111
+ if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
112
+ return Me(e.nodeAfter, e.pos);
113
+ }
114
+ function x(e) {
115
+ return Pe(e, e.selection.anchor);
116
+ }
117
+ function Pe(e, t) {
118
+ return b(je(e.doc, t));
119
+ }
120
+ //#endregion
20
121
  //#region src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
21
- function Me(e, t = JSON.stringify) {
122
+ function Fe(e, t = JSON.stringify) {
22
123
  let n = {};
23
124
  return e.filter((e) => {
24
125
  let r = t(e);
25
126
  return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
26
127
  });
27
128
  }
28
- function Ne(e) {
29
- return Me(e.filter((t, n) => e.indexOf(t) !== n));
129
+ function Ie(e) {
130
+ return Fe(e.filter((t, n) => e.indexOf(t) !== n));
30
131
  }
31
- var Pe = s.create({
132
+ function Le(e) {
133
+ return e.marks.some((e) => e.type.name === "y-attributed-delete");
134
+ }
135
+ var Re = s.create({
32
136
  name: "uniqueID",
33
137
  priority: 1e4,
34
138
  addOptions() {
35
139
  return {
36
- attributeName: "id",
37
140
  types: [],
38
141
  setIdAttribute: !1,
39
142
  isWithinEditor: void 0,
@@ -42,22 +145,21 @@ var Pe = s.create({
42
145
  let e = window.__TEST_OPTIONS;
43
146
  return e.mockID === void 0 ? e.mockID = 0 : e.mockID++, e.mockID.toString();
44
147
  }
45
- return ne();
46
- },
47
- filterTransaction: null
148
+ return ee();
149
+ }
48
150
  };
49
151
  },
50
152
  addGlobalAttributes() {
51
153
  return [{
52
154
  types: this.options.types,
53
- attributes: { [this.options.attributeName]: {
155
+ attributes: { id: {
54
156
  default: null,
55
- parseHTML: (e) => e.getAttribute(`data-${this.options.attributeName}`),
157
+ parseHTML: (e) => e.getAttribute("data-id"),
56
158
  renderHTML: (e) => {
57
- let t = { [`data-${this.options.attributeName}`]: e[this.options.attributeName] };
159
+ let t = { "data-id": e.id };
58
160
  return this.options.setIdAttribute ? {
59
161
  ...t,
60
- id: e[this.options.attributeName]
162
+ id: e.id
61
163
  } : t;
62
164
  }
63
165
  } }
@@ -65,41 +167,41 @@ var Pe = s.create({
65
167
  },
66
168
  addProseMirrorPlugins() {
67
169
  let { isWithinEditor: e } = this.options, t = null, n = !1;
68
- return [new ee({
69
- key: new te("uniqueID"),
170
+ return [new te({
171
+ key: new ne("uniqueID"),
70
172
  appendTransaction: (e, t, n) => {
71
- let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = this.options.filterTransaction && e.some((e) => !this.options.filterTransaction?.(e));
72
- if (!r || i) return;
73
- let { tr: a } = n, { types: o, attributeName: s, generateID: c } = this.options, l = f(t.doc, e), { mapping: u } = l;
74
- if (h(l).forEach(({ newRange: e }) => {
75
- let r = p(n.doc, e, (e) => o.includes(e.type.name)), i = Ne(r.map(({ node: e }) => e.attrs[s]).filter((e) => e !== null));
76
- r.forEach(({ node: e, pos: r }) => {
77
- let o = a.doc.nodeAt(r)?.attrs[s];
173
+ if (!(e.some((e) => e.docChanged) && !t.doc.eq(n.doc))) return;
174
+ let { tr: r } = n, { types: i, generateID: a } = this.options, o = f(t.doc, e), { mapping: s } = o;
175
+ if (h(o).forEach(({ newRange: e }) => {
176
+ let o = p(n.doc, e, (e) => i.includes(e.type.name)), c = Ie(o.map(({ node: e }) => e.attrs.id).filter((e) => e !== null));
177
+ o.forEach(({ node: e, pos: i }) => {
178
+ if (Le(e)) return;
179
+ let o = r.doc.nodeAt(i)?.attrs.id;
78
180
  if (o === null) {
79
- let i = t.doc.type.createAndFill().content;
80
- if (t.doc.content.findDiffStart(i) === null) {
181
+ let o = t.doc.type.createAndFill().content;
182
+ if (t.doc.content.findDiffStart(o) === null) {
81
183
  let t = JSON.parse(JSON.stringify(n.doc.toJSON()));
82
- if (t.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(t.content) === JSON.stringify(i.toJSON())) {
83
- a.setNodeMarkup(r, void 0, {
184
+ if (t.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(t.content) === JSON.stringify(o.toJSON())) {
185
+ r.setNodeMarkup(i, void 0, {
84
186
  ...e.attrs,
85
- [s]: "initialBlockId"
187
+ id: "initialBlockId"
86
188
  });
87
189
  return;
88
190
  }
89
191
  }
90
- a.setNodeMarkup(r, void 0, {
192
+ r.setNodeMarkup(i, void 0, {
91
193
  ...e.attrs,
92
- [s]: c()
194
+ id: a()
93
195
  });
94
196
  return;
95
197
  }
96
- let { deleted: l } = u.invert().mapResult(r);
97
- l && i.includes(o) && a.setNodeMarkup(r, void 0, {
198
+ let { deleted: l } = s.invert().mapResult(i);
199
+ l && c.includes(o) && !ke(e) && r.setNodeMarkup(i, void 0, {
98
200
  ...e.attrs,
99
- [s]: c()
201
+ id: a()
100
202
  });
101
203
  });
102
- }), a.steps.length) return a.setMeta("uniqueID", !0), a;
204
+ }), r.steps.length) return r.setMeta("uniqueID", !0), r;
103
205
  },
104
206
  view(n) {
105
207
  let r = (r) => {
@@ -117,7 +219,7 @@ var Pe = s.create({
117
219
  },
118
220
  transformPasted: (e) => {
119
221
  if (!n) return e;
120
- let { types: t, attributeName: a } = this.options, o = (e) => {
222
+ let { types: t } = this.options, r = (e) => {
121
223
  let n = [];
122
224
  return e.forEach((e) => {
123
225
  if (e.isText) {
@@ -125,17 +227,17 @@ var Pe = s.create({
125
227
  return;
126
228
  }
127
229
  if (!t.includes(e.type.name)) {
128
- n.push(e.copy(o(e.content)));
230
+ n.push(e.copy(r(e.content)));
129
231
  return;
130
232
  }
131
- let r = e.type.create({
233
+ let i = e.type.create({
132
234
  ...e.attrs,
133
- [a]: null
134
- }, o(e.content), e.marks);
135
- n.push(r);
136
- }), r.from(n);
235
+ id: null
236
+ }, r(e.content), e.marks);
237
+ n.push(i);
238
+ }), i.from(n);
137
239
  };
138
- return n = !1, new i(o(e.content), e.openStart, e.openEnd);
240
+ return n = !1, new a(r(e.content), e.openStart, e.openEnd);
139
241
  }
140
242
  }
141
243
  })];
@@ -143,19 +245,19 @@ var Pe = s.create({
143
245
  });
144
246
  //#endregion
145
247
  //#region src/schema/inlineContent/types.ts
146
- function Fe(e) {
248
+ function ze(e) {
147
249
  return e.type === "link";
148
250
  }
149
- function Ie(e) {
251
+ function Be(e) {
150
252
  return typeof e != "string" && e.type === "link";
151
253
  }
152
- function b(e) {
254
+ function S(e) {
153
255
  return typeof e != "string" && e.type === "text";
154
256
  }
155
257
  //#endregion
156
258
  //#region src/util/table.ts
157
- function x(e) {
158
- return C(e) ? { ...e } : S(e) ? {
259
+ function C(e) {
260
+ return Ve(e) ? { ...e } : w(e) ? {
159
261
  type: "tableCell",
160
262
  content: [].concat(e.content),
161
263
  props: {
@@ -176,390 +278,102 @@ function x(e) {
176
278
  rowspan: 1
177
279
  }
178
280
  };
179
- }
180
- function S(e) {
181
- return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
182
- }
183
- function C(e) {
184
- return S(e) && e.props !== void 0 && e.content !== void 0;
185
- }
186
- function w(e) {
187
- return C(e) ? e.props.colspan ?? 1 : 1;
188
- }
189
- function Le(e) {
190
- return C(e) ? e.props.rowspan ?? 1 : 1;
191
- }
192
- //#endregion
193
- //#region src/util/typescript.ts
194
- var T = class extends Error {
195
- constructor(e) {
196
- super(`Unreachable case: ${e}`);
197
- }
198
- };
199
- function Re(e, t = !0) {
200
- let { "data-test": n, ...r } = e;
201
- if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
202
- }
203
- //#endregion
204
- //#region src/util/browser.ts
205
- var ze = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
206
- function E(e, t = "Ctrl") {
207
- return ze() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
208
- }
209
- function D(...e) {
210
- return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
211
- }
212
- var Be = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
213
- //#endregion
214
- //#region src/blocks/defaultBlockHelpers.ts
215
- function Ve(e, t, n, r) {
216
- let i = document.createElement("div");
217
- i.className = D("bn-block-content", n.class), i.setAttribute("data-content-type", e);
218
- for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
219
- let a = document.createElement(t);
220
- a.className = D("bn-inline-content", r.class);
221
- for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
222
- return i.appendChild(a), {
223
- dom: i,
224
- contentDOM: a
225
- };
226
- }
227
- var He = (e, t) => {
228
- let n = W(e, t.pmSchema);
229
- n.type.name === "blockContainer" && (n = n.firstChild);
230
- let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
231
- if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
232
- let i = r(n);
233
- if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
234
- return i;
235
- };
236
- function Ue(e, t = "<br>") {
237
- let n = e.querySelectorAll("p");
238
- if (n.length > 1) {
239
- let e = n[0];
240
- for (let r = 1; r < n.length; r++) {
241
- let i = n[r];
242
- e.innerHTML += t + i.innerHTML, i.remove();
243
- }
244
- }
245
- }
246
- //#endregion
247
- //#region src/util/string.ts
248
- function O(e) {
249
- return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
250
- }
251
- function We(e) {
252
- let t = e.split("/");
253
- return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
254
- }
255
- function Ge(e) {
256
- let t = [
257
- "mp4",
258
- "webm",
259
- "ogg",
260
- "mov",
261
- "mkv",
262
- "flv",
263
- "avi",
264
- "wmv",
265
- "m4v"
266
- ];
267
- try {
268
- let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
269
- return t.includes(n);
270
- } catch {
271
- return !1;
272
- }
273
- }
274
- //#endregion
275
- //#region src/schema/blocks/internal.ts
276
- function Ke(e) {
277
- let t = {};
278
- return Object.entries(e).forEach(([e, n]) => {
279
- t[e] = {
280
- default: n.default,
281
- keepOnSplit: !0,
282
- parseHTML: (t) => {
283
- let r = t.getAttribute(O(e));
284
- if (r === null) return null;
285
- if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" ? !0 : r === "false" ? !1 : null;
286
- if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
287
- let e = parseFloat(r);
288
- return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
289
- }
290
- return r;
291
- },
292
- renderHTML: (t) => t[e] === n.default ? {} : { [O(e)]: t[e] }
293
- };
294
- }), t;
295
- }
296
- function qe(e, t, n, r) {
297
- let i = e();
298
- if (i === void 0) throw Error("Cannot find node position");
299
- let a = n.state.doc.resolve(i).node().attrs.id;
300
- if (!a) throw Error("Block doesn't have id");
301
- let o = t.getBlock(a);
302
- if (o.type !== r) throw Error("Block type does not match");
303
- return o;
304
- }
305
- function k(e, t, n, r, i = !1, a) {
306
- let o = document.createElement("div");
307
- if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
308
- o.className = D("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
309
- for (let [e, t] of Object.entries(n)) t !== r[e].default && o.setAttribute(O(e), t);
310
- return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D("bn-inline-content", e.contentDOM.className)), {
311
- ...e,
312
- dom: o
313
- };
314
- }
315
- function Je(e, t, n) {
316
- return {
317
- config: {
318
- type: e.type,
319
- content: e.content,
320
- propSchema: t
321
- },
322
- implementation: {
323
- node: e.node,
324
- render: He,
325
- toExternalHTML: He
326
- },
327
- extensions: n
328
- };
329
- }
330
- //#endregion
331
- //#region src/schema/blocks/createSpec.ts
332
- function Ye(e, t) {
333
- e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
334
- t.view.dom.blur();
335
- }, 10), !0);
336
- }
337
- function Xe(e, t) {
338
- let n = [{
339
- tag: "[data-content-type=" + e.type + "]",
340
- contentElement: ".bn-inline-content"
341
- }];
342
- return t.parse && n.push({
343
- tag: "*",
344
- getAttrs(e) {
345
- if (typeof e == "string") return !1;
346
- let n = t.parse?.(e);
347
- return n === void 0 ? !1 : n;
348
- },
349
- preserveWhitespace: !0,
350
- getContent: e.content === "inline" || e.content === "none" ? (n, r) => {
351
- if (t.parseContent) {
352
- let e = t.parseContent({
353
- el: n,
354
- schema: r
355
- });
356
- if (e !== void 0) return e;
357
- }
358
- if (e.content === "inline") {
359
- let e = n.cloneNode(!0);
360
- return Ue(e, t.meta?.code ? "\n" : "<br>"), re.fromSchema(r).parse(e, {
361
- topNode: r.nodes.paragraph.create(),
362
- preserveWhitespace: !0
363
- }).content;
364
- }
365
- return ae.empty;
366
- } : void 0
367
- }), n;
368
- }
369
- function Ze(e, t, n, r) {
370
- let i = t.node || u.create({
371
- name: e.type,
372
- content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
373
- group: "blockContent",
374
- selectable: t.meta?.selectable ?? !0,
375
- isolating: t.meta?.isolating ?? !0,
376
- code: t.meta?.code ?? !1,
377
- defining: t.meta?.defining ?? !0,
378
- priority: r,
379
- addAttributes() {
380
- return Ke(e.propSchema);
381
- },
382
- parseHTML() {
383
- return Xe(e, t);
384
- },
385
- renderHTML({ HTMLAttributes: n }) {
386
- let r = document.createElement("div");
387
- return k({
388
- dom: r,
389
- contentDOM: e.content === "inline" ? r : void 0
390
- }, e.type, {}, e.propSchema, t.meta?.fileBlockAccept !== void 0, n);
391
- },
392
- addNodeView() {
393
- return (n) => {
394
- let r = this.options.editor, i = qe(n.getPos, r, this.editor, e.type), a = this.options.domAttributes?.blockContent || {}, o = t.render.call({
395
- blockContentDOMAttributes: a,
396
- props: n,
397
- renderType: "nodeView"
398
- }, i, r);
399
- return t.meta?.selectable === !1 && Ye(o, this.editor), o;
400
- };
401
- }
402
- });
403
- if (i.name !== e.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
404
- return {
405
- config: e,
406
- implementation: {
407
- ...t,
408
- node: i,
409
- render(e, n) {
410
- let r = i.options.domAttributes?.blockContent || {};
411
- return t.render.call({
412
- blockContentDOMAttributes: r,
413
- props: void 0,
414
- renderType: "dom"
415
- }, e, n);
416
- },
417
- toExternalHTML: (e, n, r) => {
418
- let a = i.options.domAttributes?.blockContent || {};
419
- return t.toExternalHTML?.call({ blockContentDOMAttributes: a }, e, n, r) ?? t.render.call({
420
- blockContentDOMAttributes: a,
421
- renderType: "dom",
422
- props: void 0
423
- }, e, n);
424
- }
425
- },
426
- extensions: n
427
- };
428
- }
429
- function A(e) {
430
- return e;
431
- }
432
- function j(e, t, n) {
433
- return (r = {}) => {
434
- let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0;
435
- return {
436
- config: i,
437
- implementation: {
438
- ...a,
439
- toExternalHTML(e, t, n) {
440
- let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
441
- if (r !== void 0) return k(r, e.type, e.props, i.propSchema, a.meta?.fileBlockAccept !== void 0);
442
- },
443
- render(e, t) {
444
- return k(a.render.call({
445
- blockContentDOMAttributes: this.blockContentDOMAttributes,
446
- renderType: this.renderType,
447
- props: this.props
448
- }, e, t), e.type, e.props, i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
449
- }
450
- },
451
- extensions: o
452
- };
453
- };
454
- }
455
- //#endregion
456
- //#region src/api/getBlockInfoFromPos.ts
457
- function Qe(e, t) {
458
- let n = e.resolve(t);
459
- if (n.nodeAfter && n.nodeAfter.type.isInGroup("bnBlock")) return {
460
- posBeforeNode: n.pos,
461
- node: n.nodeAfter
462
- };
463
- let r = n.depth, i = n.node(r);
464
- for (; r > 0;) {
465
- if (i.type.isInGroup("bnBlock")) return {
466
- posBeforeNode: n.before(r),
467
- node: i
468
- };
469
- r--, i = n.node(r);
470
- }
471
- let a = [];
472
- e.descendants((e, t) => {
473
- e.type.isInGroup("bnBlock") && a.push(t);
474
- }), console.warn(`Position ${t} is not within a blockContainer node.`);
475
- let o = e.resolve(a.find((e) => e >= t) || a[a.length - 1]);
476
- return {
477
- posBeforeNode: o.pos,
478
- node: o.nodeAfter
479
- };
480
- }
481
- function $e(e, t) {
482
- if (!e.type.isInGroup("bnBlock")) throw Error(`Attempted to get bnBlock node at position but found node of different type ${e.type.name}`);
483
- let n = e, r = t, i = {
484
- node: n,
485
- beforePos: r,
486
- afterPos: r + n.nodeSize
487
- };
488
- if (n.type.name === "blockContainer") {
489
- let e, t;
490
- if (n.forEach((n, i) => {
491
- if (n.type.spec.group === "blockContent") {
492
- let t = n, a = r + i + 1;
493
- e = {
494
- node: t,
495
- beforePos: a,
496
- afterPos: a + n.nodeSize
497
- };
498
- } else if (n.type.name === "blockGroup") {
499
- let e = n, a = r + i + 1;
500
- t = {
501
- node: e,
502
- beforePos: a,
503
- afterPos: a + n.nodeSize
504
- };
505
- }
506
- }), !e) throw Error(`blockContainer node does not contain a blockContent node in its children: ${n}`);
507
- return {
508
- isBlockContainer: !0,
509
- bnBlock: i,
510
- blockContent: e,
511
- childContainer: t,
512
- blockNoteType: e.node.type.name
513
- };
514
- } else {
515
- if (!i.node.type.isInGroup("childContainer")) throw Error(`bnBlock node is not in the childContainer group: ${i.node}`);
516
- return {
517
- isBlockContainer: !1,
518
- bnBlock: i,
519
- childContainer: i,
520
- blockNoteType: i.node.type.name
521
- };
281
+ }
282
+ function w(e) {
283
+ return e != null && typeof e != "string" && !Array.isArray(e) && e.type === "tableCell";
284
+ }
285
+ function Ve(e) {
286
+ return w(e) && e.props !== void 0 && e.content !== void 0;
287
+ }
288
+ function T(e) {
289
+ return Ve(e) ? e.props.colspan ?? 1 : 1;
290
+ }
291
+ function He(e) {
292
+ return Ve(e) ? e.props.rowspan ?? 1 : 1;
293
+ }
294
+ //#endregion
295
+ //#region src/util/typescript.ts
296
+ var E = class extends Error {
297
+ constructor(e) {
298
+ super(`Unreachable case: ${e}`);
522
299
  }
300
+ };
301
+ function Ue(e, t = !0) {
302
+ let { "data-test": n, ...r } = e;
303
+ if (Object.keys(r).length > 0 && t) throw Error("Object must be empty " + JSON.stringify(e));
523
304
  }
524
- function M(e) {
525
- return $e(e.node, e.posBeforeNode);
305
+ //#endregion
306
+ //#region src/util/browser.ts
307
+ var We = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
308
+ function D(e, t = "Ctrl") {
309
+ return We() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
526
310
  }
527
- function et(e) {
528
- if (!e.nodeAfter) throw Error(`Attempted to get blockContainer node at position ${e.pos} but a node at this position does not exist`);
529
- return $e(e.nodeAfter, e.pos);
311
+ function O(...e) {
312
+ return [...new Set(e.filter((e) => e).join(" ").split(" "))].join(" ");
530
313
  }
531
- function tt(e) {
532
- return M(Qe(e.doc, e.selection.anchor));
314
+ var Ge = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
315
+ //#endregion
316
+ //#region src/blocks/defaultBlockHelpers.ts
317
+ function Ke(e, t, n, r) {
318
+ let i = document.createElement("div");
319
+ i.className = O("bn-block-content", n.class), i.setAttribute("data-content-type", e);
320
+ for (let [e, t] of Object.entries(n)) e !== "class" && i.setAttribute(e, t);
321
+ let a = document.createElement(t);
322
+ a.className = O("bn-inline-content", r.class);
323
+ for (let [e, t] of Object.entries(r)) e !== "class" && a.setAttribute(e, t);
324
+ return i.appendChild(a), {
325
+ dom: i,
326
+ contentDOM: a
327
+ };
533
328
  }
534
- function nt(e) {
535
- return M(Qe(e.doc, e.selection.anchor));
329
+ var qe = (e, t) => {
330
+ let n = U(e, t.pmSchema);
331
+ n.type.name === "blockContainer" && (n = n.firstChild);
332
+ let r = t.pmSchema.nodes[n.type.name].spec.toDOM;
333
+ if (r === void 0) throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");
334
+ let i = r(n);
335
+ if (typeof i != "object" || !("dom" in i)) throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");
336
+ return i;
337
+ };
338
+ function Je(e, t = "<br>") {
339
+ let n = e.querySelectorAll("p");
340
+ if (n.length > 1) {
341
+ let e = n[0];
342
+ for (let r = 1; r < n.length; r++) {
343
+ let i = n[r];
344
+ e.innerHTML += t + i.innerHTML, i.remove();
345
+ }
346
+ }
536
347
  }
537
348
  //#endregion
538
349
  //#region src/api/pmUtil.ts
539
- function N(e) {
350
+ function k(e) {
540
351
  return "doc" in e ? e.doc.type.schema : e.type.schema;
541
352
  }
542
- function rt(e) {
353
+ function Ye(e) {
543
354
  return e.cached.blockNoteEditor;
544
355
  }
545
- function it(e) {
546
- return rt(e).schema;
356
+ function Xe(e) {
357
+ return Ye(e).schema;
547
358
  }
548
- function at(e) {
549
- return it(e).blockSchema;
359
+ function Ze(e) {
360
+ return Xe(e).blockSchema;
550
361
  }
551
- function ot(e) {
552
- return it(e).inlineContentSchema;
362
+ function Qe(e) {
363
+ return Xe(e).inlineContentSchema;
553
364
  }
554
- function P(e) {
555
- return it(e).styleSchema;
365
+ function A(e) {
366
+ return Xe(e).styleSchema;
556
367
  }
557
- function F(e) {
558
- return rt(e).blockCache;
368
+ function $e(e) {
369
+ return Ye(e).blockCache;
370
+ }
371
+ function et(e, t) {
372
+ return Ze(e)[t.name]?.content === "plain";
559
373
  }
560
374
  //#endregion
561
375
  //#region src/api/nodeConversions/nodeToBlock.ts
562
- function st(e, t, n) {
376
+ function tt(e, t, n) {
563
377
  let r = {
564
378
  type: "tableContent",
565
379
  columnWidths: [],
@@ -574,10 +388,10 @@ function st(e, t, n) {
574
388
  t ??= Array(e.attrs.colspan ?? 1).fill(void 0), r.columnWidths.push(...t);
575
389
  }), s.cells = e.content.content.map((e, r) => (i[o] || (i[o] = []), i[o][r] = e.type.name === "tableHeader", {
576
390
  type: "tableCell",
577
- content: e.content.content.map((e) => I(e, t, n)).reduce((e, t) => {
391
+ content: e.content.content.map((e) => j(e, t, n)).reduce((e, t) => {
578
392
  if (!e.length) return t;
579
393
  let n = e[e.length - 1], r = t[0];
580
- return r && b(n) && b(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
394
+ return r && S(n) && S(r) && JSON.stringify(n.styles) === JSON.stringify(r.styles) ? (n.text += "\n" + r.text, e.push(...t.slice(1)), e) : (e.push(...t), e);
581
395
  }, []),
582
396
  props: {
583
397
  colspan: e.attrs.colspan,
@@ -592,12 +406,12 @@ function st(e, t, n) {
592
406
  for (let e = 0; e < i[0]?.length; e++) i?.every((t) => t[e]) && (r.headerCols = (r.headerCols ?? 0) + 1);
593
407
  return r;
594
408
  }
595
- function I(e, t, n) {
409
+ function j(e, t, n) {
596
410
  let r = [], i;
597
411
  return e.content.forEach((e) => {
598
412
  if (e.type.name === "hardBreak") {
599
- if (i) if (b(i)) i.text += "\n";
600
- else if (Fe(i)) i.content[i.content.length - 1].text += "\n";
413
+ if (i) if (S(i)) i.text += "\n";
414
+ else if (ze(i)) i.content[i.content.length - 1].text += "\n";
601
415
  else throw Error("unexpected");
602
416
  else i = {
603
417
  type: "text",
@@ -611,7 +425,7 @@ function I(e, t, n) {
611
425
  console.warn("unrecognized inline content type", e.type.name);
612
426
  return;
613
427
  }
614
- i &&= (r.push(i), void 0), r.push(ct(e, t, n));
428
+ i &&= (r.push(i), void 0), r.push(nt(e, t, n));
615
429
  return;
616
430
  }
617
431
  let a = {}, o;
@@ -624,9 +438,9 @@ function I(e, t, n) {
624
438
  }
625
439
  if (e.propSchema === "boolean") a[e.type] = !0;
626
440
  else if (e.propSchema === "string") a[e.type] = t.attrs.stringValue;
627
- else throw new T(e.propSchema);
441
+ else throw new E(e.propSchema);
628
442
  }
629
- i ? b(i) ? o ? (r.push(i), i = {
443
+ i ? S(i) ? o ? (r.push(i), i = {
630
444
  type: "link",
631
445
  href: o.attrs.href,
632
446
  content: [{
@@ -638,7 +452,7 @@ function I(e, t, n) {
638
452
  type: "text",
639
453
  text: e.textContent,
640
454
  styles: a
641
- }) : Fe(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
455
+ }) : ze(i) && (o ? i.href === o.attrs.href ? JSON.stringify(i.content[i.content.length - 1].styles) === JSON.stringify(a) ? i.content[i.content.length - 1].text += e.textContent : i.content.push({
642
456
  type: "text",
643
457
  text: e.textContent,
644
458
  styles: a
@@ -669,7 +483,7 @@ function I(e, t, n) {
669
483
  };
670
484
  }), i && r.push(i), r;
671
485
  }
672
- function ct(e, t, n) {
486
+ function nt(e, t, n) {
673
487
  if (e.type.name === "text" || e.type.name === "link") throw Error("unexpected");
674
488
  let r = {}, i = t[e.type.name];
675
489
  for (let [t, n] of Object.entries(e.attrs)) {
@@ -677,82 +491,95 @@ function ct(e, t, n) {
677
491
  t in i.propSchema && (r[t] = n);
678
492
  }
679
493
  let a;
680
- return a = i.content === "styled" ? I(e, t, n) : void 0, {
494
+ return a = i.content === "styled" ? j(e, t, n) : void 0, {
681
495
  type: e.type.name,
682
496
  props: r,
683
497
  content: a
684
498
  };
685
499
  }
686
- function L(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
500
+ function M(e, t) {
501
+ let n = e.type.schema, r = Ze(n), i = Qe(n), a = A(n), o = $e(n);
687
502
  if (!e.type.isInGroup("bnBlock")) throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
688
- let o = a?.get(e);
689
- if (o) return o;
690
- let s = $e(e, 0), c = s.bnBlock.node.attrs.id;
691
- c === null && (c = Pe.options.generateID());
692
- let l = n[s.blockNoteType];
693
- if (!l) throw Error("Block is of an unrecognized type: " + s.blockNoteType);
694
- let u = {};
503
+ let s = o?.get(e);
504
+ if (s) return s;
505
+ let c = Me(e, 0), l;
506
+ try {
507
+ l = Ae(c.bnBlock.node, t);
508
+ } catch {
509
+ l = Re.options.generateID();
510
+ }
511
+ let u = r[c.blockNoteType];
512
+ if (!u) throw Error("Block is of an unrecognized type: " + c.blockNoteType);
513
+ let d = {};
695
514
  for (let [t, n] of Object.entries({
696
515
  ...e.attrs,
697
- ...s.isBlockContainer ? s.blockContent.node.attrs : {}
516
+ ...c.isBlockContainer ? c.blockContent.node.attrs : {}
698
517
  })) {
699
- let e = l.propSchema;
700
- t in e && !(e[t].default === void 0 && n === void 0) && (u[t] = n);
518
+ let e = u.propSchema;
519
+ t in e && !(e[t].default === void 0 && n === void 0) && (d[t] = n);
701
520
  }
702
- let d = n[s.blockNoteType], f = [];
703
- s.childContainer?.node.forEach((e) => {
704
- f.push(L(e, t, n, r, i, a));
521
+ let f = r[c.blockNoteType], p = [];
522
+ c.childContainer?.node.forEach((e) => {
523
+ p.push(M(e, t));
705
524
  });
706
- let p;
707
- if (d.content === "inline") {
708
- if (!s.isBlockContainer) throw Error("impossible");
709
- p = I(s.blockContent.node, r, i);
710
- } else if (d.content === "table") {
711
- if (!s.isBlockContainer) throw Error("impossible");
712
- p = st(s.blockContent.node, r, i);
713
- } else if (d.content === "none") p = void 0;
714
- else throw new T(d.content);
715
- let m = {
716
- id: c,
717
- type: d.type,
718
- props: u,
719
- content: p,
720
- children: f
525
+ let m;
526
+ if (f.content === "inline") {
527
+ if (!c.isBlockContainer) throw Error("impossible");
528
+ m = j(c.blockContent.node, i, a);
529
+ } else if (f.content === "table") {
530
+ if (!c.isBlockContainer) throw Error("impossible");
531
+ m = tt(c.blockContent.node, i, a);
532
+ } else if (f.content === "plain") {
533
+ if (!c.isBlockContainer) throw Error("impossible");
534
+ let e = c.blockContent.node.textContent;
535
+ m = e.length > 0 ? [{
536
+ type: "text",
537
+ text: e,
538
+ styles: {}
539
+ }] : [];
540
+ } else if (f.content === "none") m = void 0;
541
+ else throw new E(f.content);
542
+ let h = {
543
+ id: l,
544
+ type: f.type,
545
+ props: d,
546
+ content: m,
547
+ children: p
721
548
  };
722
- return a?.set(e, m), m;
723
- }
724
- function lt(e, t = N(e), n = at(t), r = ot(t), i = P(t), a = F(t)) {
725
- let o = [];
726
- return e.firstChild && e.firstChild.descendants((e) => (o.push(L(e, t, n, r, i, a)), !1)), o;
727
- }
728
- function ut(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
729
- function o(e, s, c) {
730
- if (e.type.name !== "blockGroup") throw Error("unexpected");
731
- let l = [], u, d;
732
- return e.forEach((f, p, m) => {
733
- if (f.type.name !== "blockContainer") throw Error("unexpected");
734
- if (f.childCount === 0) return;
735
- if (f.childCount === 0 || f.childCount > 2) throw Error("unexpected, blockContainer.childCount: " + f.childCount);
736
- let h = m === 0, g = m === e.childCount - 1;
737
- if (f.firstChild.type.name === "blockGroup") {
738
- if (!h) throw Error("unexpected");
739
- let e = o(f.firstChild, Math.max(0, s - 1), g ? Math.max(0, c - 1) : 0);
740
- u = e.blockCutAtStart, g && (d = e.blockCutAtEnd), l.push(...e.blocks);
549
+ return o?.set(e, h), h;
550
+ }
551
+ function rt(e) {
552
+ let t = [];
553
+ return e.firstChild && e.firstChild.descendants((n) => (t.push(M(n, e)), !1)), t;
554
+ }
555
+ function it(e) {
556
+ function t(n, r, i) {
557
+ if (n.type.name !== "blockGroup") throw Error("unexpected");
558
+ let a = [], o, s;
559
+ return n.forEach((c, l, u) => {
560
+ if (c.type.name !== "blockContainer") throw Error("unexpected");
561
+ if (c.childCount === 0) return;
562
+ if (c.childCount === 0 || c.childCount > 2) throw Error("unexpected, blockContainer.childCount: " + c.childCount);
563
+ let d = u === 0, f = u === n.childCount - 1;
564
+ if (c.firstChild.type.name === "blockGroup") {
565
+ if (!d) throw Error("unexpected");
566
+ let e = t(c.firstChild, Math.max(0, r - 1), f ? Math.max(0, i - 1) : 0);
567
+ o = e.blockCutAtStart, f && (s = e.blockCutAtEnd), a.push(...e.blocks);
741
568
  return;
742
569
  }
743
- let _ = L(f, t, n, r, i, a), v = f.childCount > 1 ? f.child(1) : void 0, ee = [];
744
- if (v) {
745
- let e = o(v, 0, g ? Math.max(0, c - 1) : 0);
746
- ee = e.blocks, g && (d = e.blockCutAtEnd);
570
+ let p = M(c, e.content.firstChild), m = c.childCount > 1 ? c.child(1) : void 0, h = [];
571
+ if (m) {
572
+ let e = t(m, 0, f ? Math.max(0, i - 1) : 0);
573
+ h = e.blocks, f && (s = e.blockCutAtEnd);
747
574
  }
748
- g && !v && c > 1 && (d = _.id), h && s > 1 && (u = _.id), l.push({
749
- ..._,
750
- children: ee
575
+ f && !m && i > 1 && (s = p.id), d && r > 1 && (o = p.id), a.push({
576
+ ...p,
577
+ children: h
751
578
  });
752
579
  }), {
753
- blocks: l,
754
- blockCutAtStart: u,
755
- blockCutAtEnd: d
580
+ blocks: a,
581
+ blockCutAtStart: o,
582
+ blockCutAtEnd: s
756
583
  };
757
584
  }
758
585
  if (e.content.childCount === 0) return {
@@ -761,27 +588,255 @@ function ut(e, t, n = at(t), r = ot(t), i = P(t), a = F(t)) {
761
588
  blockCutAtEnd: void 0
762
589
  };
763
590
  if (e.content.childCount !== 1) throw Error("slice must be a single block, did you forget includeParents=true?");
764
- return o(e.content.firstChild, Math.max(e.openStart - 1, 0), Math.max(e.openEnd - 1, 0));
591
+ return t(e.content.firstChild, Math.max(e.openStart - 1, 0), Math.max(e.openEnd - 1, 0));
592
+ }
593
+ //#endregion
594
+ //#region src/util/string.ts
595
+ function N(e) {
596
+ return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
597
+ }
598
+ function at(e) {
599
+ let t = e.split("/");
600
+ return !t.length || t[t.length - 1] === "" ? e : t[t.length - 1];
601
+ }
602
+ function ot(e) {
603
+ let t = [
604
+ "mp4",
605
+ "webm",
606
+ "ogg",
607
+ "mov",
608
+ "mkv",
609
+ "flv",
610
+ "avi",
611
+ "wmv",
612
+ "m4v"
613
+ ];
614
+ try {
615
+ let n = new URL(e).pathname.split(".").pop()?.toLowerCase() || "";
616
+ return t.includes(n);
617
+ } catch {
618
+ return !1;
619
+ }
620
+ }
621
+ //#endregion
622
+ //#region src/schema/blocks/internal.ts
623
+ function st(e) {
624
+ let t = {};
625
+ return Object.entries(e).forEach(([e, n]) => {
626
+ t[e] = {
627
+ default: n.default,
628
+ keepOnSplit: !0,
629
+ parseHTML: (t) => {
630
+ let r = t.getAttribute(N(e));
631
+ if (r === null) return null;
632
+ if (n.default === void 0 && n.type === "boolean" || n.default !== void 0 && typeof n.default == "boolean") return r === "true" ? !0 : r === "false" ? !1 : null;
633
+ if (n.default === void 0 && n.type === "number" || n.default !== void 0 && typeof n.default == "number") {
634
+ let e = parseFloat(r);
635
+ return !Number.isNaN(e) && Number.isFinite(e) ? e : null;
636
+ }
637
+ return r;
638
+ },
639
+ renderHTML: (t) => t[e] === n.default ? {} : { [N(e)]: t[e] }
640
+ };
641
+ }), t;
642
+ }
643
+ function ct(e, t) {
644
+ let n = e();
645
+ if (n === void 0) throw Error("Cannot find node position");
646
+ let r = t.resolve(n).node();
647
+ if (!r) throw Error("Cannot find block container");
648
+ return M(r, t);
649
+ }
650
+ function P(e, t, n, r, i = !1, a) {
651
+ let o = document.createElement("div");
652
+ if (a !== void 0) for (let [e, t] of Object.entries(a)) e !== "class" && o.setAttribute(e, t);
653
+ o.className = O("bn-block-content", a?.class || ""), o.setAttribute("data-content-type", t);
654
+ for (let [e, t] of Object.entries(n)) t !== r[e]?.default && o.setAttribute(N(e), t);
655
+ return i && o.setAttribute("data-file-block", ""), o.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = O("bn-inline-content", e.contentDOM.className)), {
656
+ ...e,
657
+ dom: o
658
+ };
659
+ }
660
+ function lt(e, t, n) {
661
+ return {
662
+ config: {
663
+ type: e.type,
664
+ content: e.content,
665
+ propSchema: t
666
+ },
667
+ implementation: {
668
+ node: e.node,
669
+ render: qe,
670
+ toExternalHTML: qe
671
+ },
672
+ extensions: n
673
+ };
674
+ }
675
+ //#endregion
676
+ //#region src/schema/blocks/createSpec.ts
677
+ function ut(e, t) {
678
+ e.stopEvent = (e) => (e.type === "mousedown" && setTimeout(() => {
679
+ t.view.dom.blur();
680
+ }, 10), !0);
681
+ }
682
+ function dt(e, t) {
683
+ let n = [{
684
+ tag: "[data-content-type=" + e.type + "]",
685
+ contentElement: ".bn-inline-content"
686
+ }];
687
+ return t.parse && n.push({
688
+ tag: "*",
689
+ getAttrs(e) {
690
+ if (typeof e == "string") return !1;
691
+ let n = t.parse?.(e);
692
+ return n === void 0 ? !1 : n;
693
+ },
694
+ preserveWhitespace: !0,
695
+ getContent: e.content === "inline" || e.content === "none" || e.content === "plain" ? (n, r) => {
696
+ if (t.parseContent) {
697
+ let e = t.parseContent({
698
+ el: n,
699
+ schema: r
700
+ });
701
+ if (e !== void 0) return e;
702
+ }
703
+ if (e.content === "inline" || e.content === "plain") {
704
+ let i = n.cloneNode(!0);
705
+ Je(i, e.content === "plain" || t.meta?.code ? "\n" : "<br>");
706
+ let a = re.fromSchema(r).parse(i, {
707
+ topNode: r.nodes.paragraph.create(),
708
+ preserveWhitespace: !0
709
+ });
710
+ if (e.content === "plain") {
711
+ let e = [];
712
+ return a.content.forEach((t) => {
713
+ if (t.isText) e.push(t);
714
+ else {
715
+ let n = t.type === r.linebreakReplacement ? "\n" : t.textContent;
716
+ n && e.push(r.text(n, t.marks));
717
+ }
718
+ }), ae.fromArray(e);
719
+ }
720
+ return a.content;
721
+ }
722
+ return ae.empty;
723
+ } : void 0
724
+ }), n;
725
+ }
726
+ function ft(t, n, r, i) {
727
+ let a = n.node || u.create({
728
+ name: t.type,
729
+ content: t.content === "inline" ? "inline*" : t.content === "plain" ? "text*" : t.content === "none" ? "" : t.content,
730
+ marks() {
731
+ return t.content === "plain" ? e(this.editor) : void 0;
732
+ },
733
+ group: "blockContent",
734
+ selectable: n.meta?.selectable ?? !0,
735
+ isolating: n.meta?.isolating ?? !0,
736
+ code: n.meta?.code ?? !1,
737
+ defining: n.meta?.defining ?? !0,
738
+ priority: i,
739
+ addAttributes() {
740
+ return st(t.propSchema);
741
+ },
742
+ parseHTML() {
743
+ return dt(t, n);
744
+ },
745
+ renderHTML({ HTMLAttributes: e }) {
746
+ let r = document.createElement("div");
747
+ return P({
748
+ dom: r,
749
+ contentDOM: t.content === "inline" || t.content === "plain" ? r : void 0
750
+ }, t.type, {}, t.propSchema, n.meta?.fileBlockAccept !== void 0, e);
751
+ },
752
+ addNodeView() {
753
+ return (e) => {
754
+ let r = this.options.editor, i = ct(e.getPos, e.view.state.doc), a = this.options.domAttributes?.blockContent || {}, o = n.render.call({
755
+ blockContentDOMAttributes: a,
756
+ props: e,
757
+ renderType: "nodeView",
758
+ propSchema: t.propSchema
759
+ }, i, r);
760
+ return n.meta?.selectable === !1 && ut(o, this.editor), o;
761
+ };
762
+ }
763
+ });
764
+ if (a.name !== t.type) throw Error("Node name does not match block type. This is a bug in BlockNote.");
765
+ return {
766
+ config: t,
767
+ implementation: {
768
+ ...n,
769
+ node: a,
770
+ render(e, r) {
771
+ let i = a.options.domAttributes?.blockContent || {};
772
+ return n.render.call({
773
+ blockContentDOMAttributes: i,
774
+ props: void 0,
775
+ renderType: "dom",
776
+ propSchema: t.propSchema
777
+ }, e, r);
778
+ },
779
+ toExternalHTML: (e, r, i) => {
780
+ let o = a.options.domAttributes?.blockContent || {};
781
+ return n.toExternalHTML?.call({
782
+ blockContentDOMAttributes: o,
783
+ propSchema: t.propSchema
784
+ }, e, r, i) ?? n.render.call({
785
+ blockContentDOMAttributes: o,
786
+ renderType: "dom",
787
+ props: void 0,
788
+ propSchema: t.propSchema
789
+ }, e, r);
790
+ }
791
+ },
792
+ extensions: r
793
+ };
794
+ }
795
+ function F(e) {
796
+ return e;
797
+ }
798
+ function I(e, t, n) {
799
+ return (r = {}) => {
800
+ let i = typeof e == "function" ? e(r) : e, a = typeof t == "function" ? t(r) : t, o = n ? typeof n == "function" ? n(r) : n : void 0;
801
+ return {
802
+ config: i,
803
+ implementation: {
804
+ ...a,
805
+ toExternalHTML(e, t, n) {
806
+ let r = a.toExternalHTML?.call({ blockContentDOMAttributes: this.blockContentDOMAttributes }, e, t, n);
807
+ if (r !== void 0) return P(r, e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0);
808
+ },
809
+ render(e, t) {
810
+ return P(a.render.call({
811
+ blockContentDOMAttributes: this.blockContentDOMAttributes,
812
+ renderType: this.renderType,
813
+ props: this.props
814
+ }, e, t), e.type, e.props, this.propSchema ?? i.propSchema, a.meta?.fileBlockAccept !== void 0, this.blockContentDOMAttributes);
815
+ }
816
+ },
817
+ extensions: o
818
+ };
819
+ };
765
820
  }
766
821
  //#endregion
767
822
  //#region src/schema/inlineContent/internal.ts
768
- function dt(e, t, n, r) {
769
- return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e].default).map(([e, t]) => [O(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
823
+ function pt(e, t, n, r) {
824
+ return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([e, t]) => t !== r[e]?.default).map(([e, t]) => [N(e), t]).forEach(([t, n]) => e.dom.setAttribute(t, n)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
770
825
  }
771
- function ft(e) {
826
+ function mt(e) {
772
827
  return { Backspace: ({ editor: t }) => {
773
828
  let n = t.state.selection.$from;
774
829
  return t.state.selection.empty && n.node().type.name === e.type && n.parentOffset === 0;
775
830
  } };
776
831
  }
777
- function pt(e, t) {
832
+ function ht(e, t) {
778
833
  return {
779
834
  config: e,
780
835
  implementation: t
781
836
  };
782
837
  }
783
- function mt(e, t, n) {
784
- return pt({
838
+ function gt(e, t, n) {
839
+ return ht({
785
840
  type: e.name,
786
841
  propSchema: t,
787
842
  content: e.config.content === "inline*" ? "styled" : "none"
@@ -790,12 +845,12 @@ function mt(e, t, n) {
790
845
  node: e
791
846
  });
792
847
  }
793
- function ht(e) {
848
+ function _t(e) {
794
849
  return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
795
850
  }
796
851
  //#endregion
797
852
  //#region src/schema/styles/internal.ts
798
- function gt(e) {
853
+ function vt(e) {
799
854
  return e === "boolean" ? {} : { stringValue: {
800
855
  default: void 0,
801
856
  keepOnSplit: !0,
@@ -803,17 +858,17 @@ function gt(e) {
803
858
  renderHTML: (e) => e.stringValue === void 0 ? {} : { "data-value": e.stringValue }
804
859
  } };
805
860
  }
806
- function R(e, t, n, r) {
861
+ function L(e, t, n, r) {
807
862
  return e.dom.setAttribute("data-style-type", t), r === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
808
863
  }
809
- function _t(e, t) {
864
+ function yt(e, t) {
810
865
  return {
811
866
  config: e,
812
867
  implementation: t
813
868
  };
814
869
  }
815
- function z(e, t) {
816
- return _t({
870
+ function R(e, t) {
871
+ return yt({
817
872
  type: e.name,
818
873
  propSchema: t
819
874
  }, {
@@ -834,12 +889,12 @@ function z(e, t) {
834
889
  }
835
890
  });
836
891
  }
837
- function vt(e) {
892
+ function bt(e) {
838
893
  return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.config]));
839
894
  }
840
895
  //#endregion
841
896
  //#region src/schema/styles/createSpec.ts
842
- function yt(e, t) {
897
+ function xt(e, t) {
843
898
  let n = [{
844
899
  tag: `[data-style-type="${e.type}"]`,
845
900
  contentElement: (e) => {
@@ -857,33 +912,33 @@ function yt(e, t) {
857
912
  }
858
913
  }), n;
859
914
  }
860
- function bt(e, t) {
915
+ function St(e, t) {
861
916
  let n = l.create({
862
917
  name: e.type,
863
918
  addAttributes() {
864
- return gt(e.propSchema);
919
+ return vt(e.propSchema);
865
920
  },
866
921
  parseHTML() {
867
- return yt(e, t.parse);
922
+ return xt(e, t.parse);
868
923
  },
869
924
  renderHTML({ mark: n }) {
870
- return R((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
925
+ return L((t.toExternalHTML || t.render)(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
871
926
  },
872
927
  addMarkView() {
873
- return ({ mark: n }) => R(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
928
+ return ({ mark: n }) => L(t.render(n.attrs.stringValue), e.type, n.attrs.stringValue, e.propSchema);
874
929
  }
875
930
  });
876
- return _t(e, {
931
+ return yt(e, {
877
932
  ...t,
878
933
  mark: n,
879
- render: (n) => R(t.render(n), e.type, n, e.propSchema),
880
- toExternalHTML: (n) => R((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
934
+ render: (n) => L(t.render(n), e.type, n, e.propSchema),
935
+ toExternalHTML: (n) => L((t.toExternalHTML || t.render)(n), e.type, n, e.propSchema)
881
936
  });
882
937
  }
883
938
  //#endregion
884
939
  //#region src/util/topo-sort.ts
885
- function xt(e) {
886
- let t = Ct(e), { roots: n, nonRoots: r } = wt(t), i = [];
940
+ function Ct(e) {
941
+ let t = Tt(e), { roots: n, nonRoots: r } = Et(t), i = [];
887
942
  for (; n.size;) {
888
943
  i.push(n);
889
944
  let r = /* @__PURE__ */ new Set();
@@ -898,13 +953,13 @@ function xt(e) {
898
953
  }
899
954
  n = r;
900
955
  }
901
- if (r = wt(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
956
+ if (r = Et(t).nonRoots, r.size) throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(r).join(", ")}`);
902
957
  return i;
903
958
  }
904
- function St(e) {
905
- return xt(Tt(e));
959
+ function wt(e) {
960
+ return Ct(Dt(e));
906
961
  }
907
- function Ct(e) {
962
+ function Tt(e) {
908
963
  let t = /* @__PURE__ */ new Map();
909
964
  for (let [n, r] of e.entries()) {
910
965
  t.has(n) || t.set(n, 0);
@@ -915,7 +970,7 @@ function Ct(e) {
915
970
  }
916
971
  return t;
917
972
  }
918
- function wt(e) {
973
+ function Et(e) {
919
974
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
920
975
  for (let [r, i] of e.entries()) i === 0 ? t.add(r) : n.add(r);
921
976
  return {
@@ -923,7 +978,7 @@ function wt(e) {
923
978
  nonRoots: n
924
979
  };
925
980
  }
926
- function Tt(e) {
981
+ function Dt(e) {
927
982
  let t = /* @__PURE__ */ new Map();
928
983
  for (let [n, r] of e.entries()) {
929
984
  t.has(n) || t.set(n, /* @__PURE__ */ new Set());
@@ -931,26 +986,27 @@ function Tt(e) {
931
986
  }
932
987
  return t;
933
988
  }
934
- function Et() {
989
+ function Ot() {
935
990
  return /* @__PURE__ */ new Map();
936
991
  }
937
- function Dt(e, t, n) {
992
+ function kt(e, t, n) {
938
993
  return e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n), e;
939
994
  }
940
- function Ot(e) {
941
- let t = Et();
995
+ function At(e) {
996
+ let t = Ot();
942
997
  for (let n of e) Array.isArray(n.runsBefore) && n.runsBefore.length > 0 ? n.runsBefore.forEach((e) => {
943
- Dt(t, n.key, e);
944
- }) : Dt(t, "default", n.key);
945
- let n = St(t), r = n.findIndex((e) => e.has("default"));
998
+ kt(t, n.key, e);
999
+ }) : kt(t, "default", n.key);
1000
+ let n = wt(t), r = n.findIndex((e) => e.has("default"));
946
1001
  return (e) => 91 + (n.findIndex((t) => t.has(e)) + r) * 10;
947
1002
  }
948
1003
  //#endregion
949
1004
  //#region src/schema/schema.ts
950
- function kt(e) {
1005
+ function jt(e) {
951
1006
  return e && Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
952
1007
  }
953
- var At = class {
1008
+ var Mt = class {
1009
+ opts;
954
1010
  BlockNoteEditor = "only for types";
955
1011
  Block = "only for types";
956
1012
  PartialBlock = "only for types";
@@ -966,14 +1022,14 @@ var At = class {
966
1022
  this.blockSpecs = t, this.styleSpecs = r, this.styleSchema = o, this.inlineContentSpecs = n, this.blockSchema = i, this.inlineContentSchema = a;
967
1023
  }
968
1024
  init() {
969
- let e = Ot(Object.entries({
1025
+ let e = At(Object.entries({
970
1026
  ...this.opts.blockSpecs,
971
1027
  ...this.opts.inlineContentSpecs,
972
1028
  ...this.opts.styleSpecs
973
1029
  }).map(([e, t]) => ({
974
1030
  key: e,
975
1031
  runsBefore: t.implementation?.runsBefore ?? []
976
- }))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, Ze(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
1032
+ }))), t = Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t, n]) => [t, ft(n.config, n.implementation, n.extensions, e(t))])), n = Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t, n]) => typeof n.config == "object" ? [t, {
977
1033
  ...n,
978
1034
  implementation: {
979
1035
  ...n.implementation,
@@ -989,10 +1045,10 @@ var At = class {
989
1045
  return {
990
1046
  blockSpecs: t,
991
1047
  blockSchema: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.config])),
992
- inlineContentSpecs: kt(n),
993
- styleSpecs: kt(r),
994
- inlineContentSchema: ht(n),
995
- styleSchema: vt(r)
1048
+ inlineContentSpecs: jt(n),
1049
+ styleSpecs: jt(r),
1050
+ inlineContentSchema: _t(n),
1051
+ styleSchema: bt(r)
996
1052
  };
997
1053
  }
998
1054
  extend(e) {
@@ -1003,8 +1059,8 @@ var At = class {
1003
1059
  };
1004
1060
  //#endregion
1005
1061
  //#region src/api/blockManipulation/tables/tables.ts
1006
- function B(e) {
1007
- let { height: t, width: n } = jt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
1062
+ function z(e) {
1063
+ let { height: t, width: n } = Nt(e), r = Array(t).fill(!1).map(() => Array(n).fill(null)), i = (e, i) => {
1008
1064
  for (let a = e; a < t; a++) for (let e = i; e < n; e++) if (!r[a][e]) return {
1009
1065
  row: a,
1010
1066
  col: e
@@ -1012,7 +1068,7 @@ function B(e) {
1012
1068
  throw Error("Unable to create occupancy grid for table, no more available cells");
1013
1069
  };
1014
1070
  for (let t = 0; t < e.content.rows.length; t++) for (let n = 0; n < e.content.rows[t].cells.length; n++) {
1015
- let a = x(e.content.rows[t].cells[n]), o = Le(a), s = w(a), { row: c, col: l } = i(t, n);
1071
+ let a = C(e.content.rows[t].cells[n]), o = He(a), s = T(a), { row: c, col: l } = i(t, n);
1016
1072
  for (let e = c; e < c + o; e++) for (let i = l; i < l + s; i++) {
1017
1073
  if (r[e][i]) throw Error(`Unable to create occupancy grid for table, cell at ${e},${i} is already occupied`);
1018
1074
  r[e][i] = {
@@ -1026,11 +1082,11 @@ function B(e) {
1026
1082
  }
1027
1083
  return r;
1028
1084
  }
1029
- function V(e) {
1085
+ function B(e) {
1030
1086
  let t = /* @__PURE__ */ new Set();
1031
1087
  return e.map((e) => ({ cells: e.map((e) => t.has(e.row + ":" + e.col) ? !1 : (t.add(e.row + ":" + e.col), e.cell)).filter((e) => e !== !1) }));
1032
1088
  }
1033
- function H(e, t, n = B(t)) {
1089
+ function V(e, t, n = z(t)) {
1034
1090
  for (let t = 0; t < n.length; t++) for (let r = 0; r < n[t].length; r++) {
1035
1091
  let i = n[t][r];
1036
1092
  if (i && i.row === e.row && i.col === e.col) return {
@@ -1041,19 +1097,19 @@ function H(e, t, n = B(t)) {
1041
1097
  }
1042
1098
  throw Error(`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`);
1043
1099
  }
1044
- function jt(e) {
1100
+ function Nt(e) {
1045
1101
  let t = e.content.rows.length, n = 0;
1046
1102
  return e.content.rows.forEach((e) => {
1047
1103
  let t = 0;
1048
1104
  e.cells.forEach((e) => {
1049
- t += w(e);
1105
+ t += T(e);
1050
1106
  }), n = Math.max(n, t);
1051
1107
  }), {
1052
1108
  height: t,
1053
1109
  width: n
1054
1110
  };
1055
1111
  }
1056
- function Mt(e, t, n = B(t)) {
1112
+ function Pt(e, t, n = z(t)) {
1057
1113
  let r = n[e.row]?.[e.col];
1058
1114
  if (r) return {
1059
1115
  row: r.row,
@@ -1061,8 +1117,8 @@ function Mt(e, t, n = B(t)) {
1061
1117
  cell: r.cell
1062
1118
  };
1063
1119
  }
1064
- function Nt(e, t) {
1065
- let n = B(e);
1120
+ function Ft(e, t) {
1121
+ let n = z(e);
1066
1122
  if (t < 0 || t >= n.length) return [];
1067
1123
  let r = 0;
1068
1124
  for (let e = 0; e < t; e++) {
@@ -1070,14 +1126,14 @@ function Nt(e, t) {
1070
1126
  if (!e) return [];
1071
1127
  r += e.rowspan;
1072
1128
  }
1073
- let i = Array(n[0].length).fill(!1).map((t, i) => Mt({
1129
+ let i = Array(n[0].length).fill(!1).map((t, i) => Pt({
1074
1130
  row: r,
1075
1131
  col: i
1076
1132
  }, e, n)).filter((e) => e !== void 0);
1077
1133
  return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
1078
1134
  }
1079
- function Pt(e, t) {
1080
- let n = B(e);
1135
+ function It(e, t) {
1136
+ let n = z(e);
1081
1137
  if (t < 0 || t >= n[0].length) return [];
1082
1138
  let r = 0;
1083
1139
  for (let e = 0; e < t; e++) {
@@ -1085,62 +1141,62 @@ function Pt(e, t) {
1085
1141
  if (!e) return [];
1086
1142
  r += e.colspan;
1087
1143
  }
1088
- let i = Array(n.length).fill(!1).map((t, i) => Mt({
1144
+ let i = Array(n.length).fill(!1).map((t, i) => Pt({
1089
1145
  row: i,
1090
1146
  col: r
1091
1147
  }, e, n)).filter((e) => e !== void 0);
1092
1148
  return i.filter((e, t) => i.findIndex((t) => t.row === e.row && t.col === e.col) === t);
1093
1149
  }
1094
- function Ft(e, t, n, r = B(e)) {
1095
- let { col: i } = H({
1150
+ function Lt(e, t, n, r = z(e)) {
1151
+ let { col: i } = V({
1096
1152
  row: 0,
1097
1153
  col: t
1098
- }, e, r), { col: a } = H({
1154
+ }, e, r), { col: a } = V({
1099
1155
  row: 0,
1100
1156
  col: n
1101
1157
  }, e, r);
1102
1158
  return r.forEach((e) => {
1103
1159
  let [t] = e.splice(i, 1);
1104
1160
  e.splice(a, 0, t);
1105
- }), V(r);
1161
+ }), B(r);
1106
1162
  }
1107
- function It(e, t, n, r = B(e)) {
1108
- let { row: i } = H({
1163
+ function Rt(e, t, n, r = z(e)) {
1164
+ let { row: i } = V({
1109
1165
  row: t,
1110
1166
  col: 0
1111
- }, e, r), { row: a } = H({
1167
+ }, e, r), { row: a } = V({
1112
1168
  row: n,
1113
1169
  col: 0
1114
1170
  }, e, r), [o] = r.splice(i, 1);
1115
- return r.splice(a, 0, o), V(r);
1171
+ return r.splice(a, 0, o), B(r);
1116
1172
  }
1117
- function Lt(e) {
1118
- return e ? S(e) ? Lt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : b(e) ? e.text.length === 0 : Ie(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
1173
+ function zt(e) {
1174
+ return e ? w(e) ? zt(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every((e) => typeof e == "string" ? e.length === 0 : S(e) ? e.text.length === 0 : Be(e) ? typeof e.content == "string" ? e.content.length === 0 : e.content.every((e) => e.text.length === 0) : !1) : !1 : !0;
1119
1175
  }
1120
- function Rt(e, t, n = B(e)) {
1176
+ function Bt(e, t, n = z(e)) {
1121
1177
  if (t === "columns") {
1122
1178
  let e = 0;
1123
- for (let t = n[0].length - 1; t >= 0 && n.every((e) => Lt(e[t].cell) && e[t].colspan === 1); t--) e++;
1179
+ for (let t = n[0].length - 1; t >= 0 && n.every((e) => zt(e[t].cell) && e[t].colspan === 1); t--) e++;
1124
1180
  for (let t = n.length - 1; t >= 0; t--) {
1125
1181
  let r = Math.max(n[t].length - e, 1);
1126
1182
  n[t] = n[t].slice(0, r);
1127
1183
  }
1128
- return V(n);
1184
+ return B(n);
1129
1185
  }
1130
1186
  let r = 0;
1131
- for (let e = n.length - 1; e >= 0 && n[e].every((e) => Lt(e.cell) && e.rowspan === 1); e--) r++;
1187
+ for (let e = n.length - 1; e >= 0 && n[e].every((e) => zt(e.cell) && e.rowspan === 1); e--) r++;
1132
1188
  let i = Math.min(r, n.length - 1);
1133
- return n.splice(n.length - i, i), V(n);
1189
+ return n.splice(n.length - i, i), B(n);
1134
1190
  }
1135
- function zt(e, t, n, r = B(e)) {
1136
- let { width: i, height: a } = jt(e);
1191
+ function Vt(e, t, n, r = z(e)) {
1192
+ let { width: i, height: a } = Nt(e);
1137
1193
  if (t === "columns") r.forEach((e, t) => {
1138
1194
  if (n >= 0) for (let r = 0; r < n; r++) e.push({
1139
1195
  row: t,
1140
1196
  col: Math.max(...e.map((e) => e.col)) + 1,
1141
1197
  rowspan: 1,
1142
1198
  colspan: 1,
1143
- cell: x("")
1199
+ cell: C("")
1144
1200
  });
1145
1201
  else e.splice(i + n, -1 * n);
1146
1202
  });
@@ -1150,77 +1206,78 @@ function zt(e, t, n, r = B(e)) {
1150
1206
  col: n,
1151
1207
  rowspan: 1,
1152
1208
  colspan: 1,
1153
- cell: x("")
1209
+ cell: C("")
1154
1210
  }));
1155
1211
  r.push(t);
1156
1212
  }
1157
1213
  else n < 0 && r.splice(a + n, -1 * n);
1158
- return V(r);
1214
+ return B(r);
1159
1215
  }
1160
- function Bt(e, t, n) {
1161
- let r = Nt(e, n);
1162
- if (!r.some((e) => Le(e.cell) > 1)) return !0;
1216
+ function Ht(e, t, n) {
1217
+ let r = Ft(e, n);
1218
+ if (!r.some((e) => He(e.cell) > 1)) return !0;
1163
1219
  let i = n, a = n;
1164
1220
  return r.forEach((e) => {
1165
- let t = Le(e.cell);
1221
+ let t = He(e.cell);
1166
1222
  i = Math.max(i, e.row + t - 1), a = Math.min(a, e.row);
1167
1223
  }), t < n ? n === i : n === a;
1168
1224
  }
1169
- function Vt(e, t, n) {
1170
- let r = Pt(e, n);
1171
- if (!r.some((e) => w(e.cell) > 1)) return !0;
1225
+ function Ut(e, t, n) {
1226
+ let r = It(e, n);
1227
+ if (!r.some((e) => T(e.cell) > 1)) return !0;
1172
1228
  let i = n, a = n;
1173
1229
  return r.forEach((e) => {
1174
- let t = w(e.cell);
1230
+ let t = T(e.cell);
1175
1231
  i = Math.max(i, e.col + t - 1), a = Math.min(a, e.col);
1176
1232
  }), t < n ? n === i : n === a;
1177
1233
  }
1178
- function Ht(e, t, n) {
1179
- let r = H(e, n), i = H(t, n);
1234
+ function Wt(e, t, n) {
1235
+ let r = V(e, n), i = V(t, n);
1180
1236
  return r.col === i.col;
1181
1237
  }
1182
1238
  //#endregion
1183
1239
  //#region src/api/nodeConversions/blockToNode.ts
1184
- function Ut(e, t, n, r) {
1240
+ function Gt(e, t, n, r) {
1185
1241
  let i = [];
1186
1242
  for (let [r, a] of Object.entries(e.styles || {})) {
1187
1243
  let e = n[r];
1188
1244
  if (!e) throw Error(`style ${r} not found in styleSchema`);
1189
1245
  if (e.propSchema === "boolean") a && i.push(t.mark(r));
1190
1246
  else if (e.propSchema === "string") a && i.push(t.mark(r, { stringValue: a }));
1191
- else throw new T(e.propSchema);
1247
+ else throw new E(e.propSchema);
1192
1248
  }
1193
- return !r || !t.nodes[r].spec.code ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, i)) : e.text.length > 0 ? [t.text(e.text, i)] : [];
1249
+ let a = r && t.nodes[r] && et(t, t.nodes[r]) ? [...t.nodes[r].allowedMarks(i)] : i;
1250
+ return !r || !t.nodes[r].spec.code ? e.text.split(/(\n)/g).filter((e) => e.length > 0).map((e) => e === "\n" ? t.nodes.hardBreak.createChecked() : t.text(e, a)) : e.text.length > 0 ? [t.text(e.text, a)] : [];
1194
1251
  }
1195
- function Wt(e, t, n) {
1252
+ function Kt(e, t, n) {
1196
1253
  let r = t.marks.link.create({ href: e.href });
1197
- return Gt(e.content, t, n).map((e) => {
1254
+ return qt(e.content, t, n).map((e) => {
1198
1255
  if (e.type.name === "text") return e.mark([...e.marks, r]);
1199
1256
  if (e.type.name === "hardBreak") return e;
1200
1257
  throw Error("unexpected node type");
1201
1258
  });
1202
1259
  }
1203
- function Gt(e, t, n, r) {
1260
+ function qt(e, t, n, r) {
1204
1261
  let i = [];
1205
- if (typeof e == "string") return i.push(...Ut({
1262
+ if (typeof e == "string") return i.push(...Gt({
1206
1263
  type: "text",
1207
1264
  text: e,
1208
1265
  styles: {}
1209
1266
  }, t, n, r)), i;
1210
- for (let a of e) i.push(...Ut(a, t, n, r));
1267
+ for (let a of e) i.push(...Gt(a, t, n, r));
1211
1268
  return i;
1212
1269
  }
1213
- function U(e, t, n, r = P(t)) {
1270
+ function H(e, t, n, r = A(t)) {
1214
1271
  let i = [];
1215
- for (let a of e) typeof a == "string" ? i.push(...Gt(a, t, r, n)) : Ie(a) ? i.push(...Wt(a, t, r)) : b(a) ? i.push(...Gt([a], t, r, n)) : i.push(qt(a, t, r));
1272
+ for (let a of e) typeof a == "string" ? i.push(...qt(a, t, r, n)) : Be(a) ? i.push(...Kt(a, t, r)) : S(a) ? i.push(...qt([a], t, r, n)) : i.push(Yt(a, t, r));
1216
1273
  return i;
1217
1274
  }
1218
- function Kt(e, t, n = P(t)) {
1275
+ function Jt(e, t, n = A(t)) {
1219
1276
  let r = [], i = Array(e.headerRows ?? 0).fill(!0), a = Array(e.headerCols ?? 0).fill(!0), o = e.columnWidths ?? [];
1220
1277
  for (let s = 0; s < e.rows.length; s++) {
1221
1278
  let c = e.rows[s], l = [], u = i[s];
1222
1279
  for (let r = 0; r < c.cells.length; r++) {
1223
- let i = c.cells[r], d = a[r], f = null, p = H({
1280
+ let i = c.cells[r], d = a[r], f = null, p = V({
1224
1281
  row: s,
1225
1282
  col: r
1226
1283
  }, {
@@ -1228,13 +1285,13 @@ function Kt(e, t, n = P(t)) {
1228
1285
  content: e
1229
1286
  }), m = o[p.col] ? [o[p.col]] : null;
1230
1287
  if (i) if (typeof i == "string") f = t.text(i);
1231
- else if (S(i)) {
1232
- i.content && (f = U(i.content, t, "tableParagraph", n));
1233
- let e = w(i);
1288
+ else if (w(i)) {
1289
+ i.content && (f = H(i.content, t, "tableParagraph", n));
1290
+ let e = T(i);
1234
1291
  e > 1 && (m = Array(e).fill(!1).map((e, t) => o[p.col + t] ?? void 0));
1235
- } else f = U(i, t, "tableParagraph", n);
1292
+ } else f = H(i, t, "tableParagraph", n);
1236
1293
  let h = t.nodes[d || u ? "tableHeader" : "tableCell"].createChecked({
1237
- ...S(i) ? i.props : {},
1294
+ ...w(i) ? i.props : {},
1238
1295
  colwidth: m
1239
1296
  }, t.nodes.tableParagraph.createChecked(void 0, f));
1240
1297
  l.push(h);
@@ -1244,29 +1301,29 @@ function Kt(e, t, n = P(t)) {
1244
1301
  }
1245
1302
  return r;
1246
1303
  }
1247
- function qt(e, t, n) {
1304
+ function Yt(e, t, n) {
1248
1305
  let r, i = e.type;
1249
1306
  if (i === void 0 && (i = "paragraph"), !t.nodes[i]) throw Error(`node type ${i} not found in schema`);
1250
1307
  if (!e.content) r = t.nodes[i].createChecked(e.props);
1251
1308
  else if (typeof e.content == "string") {
1252
- let a = U([e.content], t, i, n);
1309
+ let a = H([e.content], t, i, n);
1253
1310
  r = t.nodes[i].createChecked(e.props, a);
1254
1311
  } else if (Array.isArray(e.content)) {
1255
- let a = U(e.content, t, i, n);
1312
+ let a = H(e.content, t, i, n);
1256
1313
  r = t.nodes[i].createChecked(e.props, a);
1257
1314
  } else if (e.content.type === "tableContent") {
1258
- let a = Kt(e.content, t, n);
1315
+ let a = Jt(e.content, t, n);
1259
1316
  r = t.nodes[i].createChecked(e.props, a);
1260
- } else throw new T(e.content.type);
1317
+ } else throw new E(e.content.type);
1261
1318
  return r;
1262
1319
  }
1263
- function W(e, t, n = P(t)) {
1320
+ function U(e, t, n = A(t)) {
1264
1321
  let r = e.id;
1265
- r === void 0 && (r = Pe.options.generateID());
1322
+ r === void 0 && (r = Re.options.generateID());
1266
1323
  let i = [];
1267
- if (e.children) for (let r of e.children) i.push(W(r, t, n));
1324
+ if (e.children) for (let r of e.children) i.push(U(r, t, n));
1268
1325
  if (!e.type || t.nodes[e.type].isInGroup("blockContent")) {
1269
- let a = qt(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
1326
+ let a = Yt(e, t, n), o = i.length > 0 ? t.nodes.blockGroup.createChecked({}, i) : void 0;
1270
1327
  return t.nodes.blockContainer.createChecked({
1271
1328
  id: r,
1272
1329
  ...e.props
@@ -1279,85 +1336,118 @@ function W(e, t, n = P(t)) {
1279
1336
  }
1280
1337
  //#endregion
1281
1338
  //#region src/api/nodeUtil.ts
1282
- function Jt(e, t) {
1339
+ function Xt(e, t) {
1283
1340
  let n, r;
1284
- if (t.firstChild.descendants((t, i) => n ? !1 : !Yt(t) || t.attrs.id !== e ? !0 : (n = t, r = i + 1, !1)), !(n === void 0 || r === void 0)) return {
1341
+ if (t.firstChild.descendants((i, a) => n ? !1 : !Zt(i) || !i.attrs.id || Ae(i, t) !== e ? !0 : (n = i, r = a + 1, !1)), !(n === void 0 || r === void 0)) return {
1285
1342
  node: n,
1286
1343
  posBeforeNode: r
1287
1344
  };
1288
1345
  }
1289
- function Yt(e) {
1346
+ function Zt(e) {
1290
1347
  return e.type.isInGroup("bnBlock");
1291
1348
  }
1292
1349
  //#endregion
1293
1350
  //#region src/api/blockManipulation/commands/updateBlock/updateBlock.ts
1294
- var Xt = (e, t) => ({ tr: n, dispatch: r }) => (r && Zt(n, e, t), !0);
1295
- function Zt(e, t, n, r, i) {
1296
- let a = et(e.doc.resolve(t)), o = null;
1297
- a.blockNoteType === "table" && (o = tn(e));
1298
- let s = N(e);
1351
+ var Qt = (e, t) => ({ tr: n, dispatch: r }) => (r && $t(n, e, t), !0);
1352
+ function $t(e, t, n, r, i) {
1353
+ let a = Ne(e.doc.resolve(t)), o = null;
1354
+ a.blockNoteType === "table" && (o = sn(e));
1355
+ let s = k(e);
1299
1356
  if (r !== void 0 && i !== void 0 && r > i) throw Error("Invalid replaceFromPos or replaceToPos");
1300
1357
  let c = s.nodes[a.blockNoteType], l = s.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : s.nodes.blockContainer;
1301
1358
  if (a.isBlockContainer && l.isInGroup("blockContent")) {
1302
1359
  let t = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0, o = i !== void 0 && i > a.blockContent.beforePos && i < a.blockContent.afterPos ? i - a.blockContent.beforePos - 1 : void 0;
1303
- $t(n, e, a), Qt(n, e, c, l, a, t, o);
1304
- } else if (!a.isBlockContainer && l.isInGroup("bnBlock")) $t(n, e, a);
1360
+ an(n, e, a), en(n, e, c, l, a, t, o);
1361
+ } else if (!a.isBlockContainer && l.isInGroup("bnBlock")) an(n, e, a);
1305
1362
  else {
1306
- let t = W({
1307
- children: L(a.bnBlock.node, s).children,
1363
+ let t = U({
1364
+ children: M(a.bnBlock.node, e.doc).children,
1308
1365
  ...n
1309
1366
  }, s);
1310
1367
  t.check(), e.replaceWith(a.bnBlock.beforePos, a.bnBlock.afterPos, t);
1311
1368
  return;
1312
1369
  }
1313
- e.setNodeMarkup(a.bnBlock.beforePos, u, {
1314
- ...a.bnBlock.node.attrs,
1315
- ...n.props
1316
- }), o && nn(e, a, o);
1317
- }
1318
- function Qt(e, t, n, a, o, s, c) {
1319
- let l = N(t), u = "keep";
1320
- if (e.content) if (typeof e.content == "string") u = U([e.content], l, a.name);
1321
- else if (Array.isArray(e.content)) u = U(e.content, l, a.name);
1322
- else if (e.content.type === "tableContent") u = Kt(e.content, l);
1323
- else throw new T(e.content.type);
1324
- else n.spec.content === "" || a.spec.content !== n.spec.content && (u = []);
1325
- if (u === "keep") t.setNodeMarkup(o.blockContent.beforePos, a, {
1326
- ...o.blockContent.node.attrs,
1327
- ...e.props
1328
- });
1370
+ nn(e, a.bnBlock.beforePos, u, { ...n.props }), o && cn(e, a, o);
1371
+ }
1372
+ function en(e, t, n, r, o, s, c) {
1373
+ let l = k(t), u = "keep";
1374
+ if (e.content) if (typeof e.content == "string") u = H([e.content], l, r.name);
1375
+ else if (Array.isArray(e.content)) u = H(e.content, l, r.name);
1376
+ else if (e.content.type === "tableContent") u = Jt(e.content, l);
1377
+ else throw new E(e.content.type);
1378
+ else n.spec.content === "" || r.spec.content !== n.spec.content && (u = []);
1379
+ if (u === "keep") nn(t, o.blockContent.beforePos, r, { ...e.props });
1329
1380
  else if (s !== void 0 || c !== void 0) {
1330
- t.setNodeMarkup(o.blockContent.beforePos, a, {
1331
- ...o.blockContent.node.attrs,
1332
- ...e.props
1333
- });
1334
- let n = o.blockContent.beforePos + 1 + (s ?? 0), l = o.blockContent.beforePos + 1 + (c ?? o.blockContent.node.content.size), d = t.doc.resolve(o.blockContent.beforePos).depth, f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth;
1335
- t.replace(n, l, new i(r.from(u), f - d - 1, p - d - 1));
1336
- } else t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, a.createChecked({
1381
+ let n = rn(t, o.blockContent.beforePos, r, { ...e.props }), l = n + 1 + (s ?? 0), d = n + 1 + (c ?? o.blockContent.node.content.size), f = t.doc.resolve(n).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(d).depth;
1382
+ t.replace(l, d, new a(i.from(u), p - f - 1, m - f - 1));
1383
+ } else r === n || r.validContent(o.blockContent.node.content) ? tn(t, rn(t, o.blockContent.beforePos, r, { ...e.props }), i.from(u)) : t.replaceWith(o.blockContent.beforePos, o.blockContent.afterPos, r.createChecked({
1337
1384
  ...o.blockContent.node.attrs,
1338
1385
  ...e.props
1339
1386
  }, u));
1340
1387
  }
1341
- function $t(e, t, n) {
1342
- let a = N(t);
1388
+ function tn(e, t, n) {
1389
+ let r = e.doc.nodeAt(t);
1390
+ if (!r) throw RangeError("No node at given position");
1391
+ let s = r.content, c = t + 1;
1392
+ if (r.isTextblock) {
1393
+ let t = s.findDiffStart(n);
1394
+ if (t === null) return;
1395
+ let { a: r, b: i } = s.findDiffEnd(n), o = Math.max(0, t - r, t - i);
1396
+ o > 0 && (r += o, i += o), e.replace(c + t, c + r, new a(n.cut(t, i), 0, 0));
1397
+ return;
1398
+ }
1399
+ let l = s.childCount, u = n.childCount, d = 0;
1400
+ for (; d < l && d < u && s.child(d).eq(n.child(d));) d++;
1401
+ let f = l, p = u;
1402
+ for (; f > d && p > d && s.child(f - 1).eq(n.child(p - 1));) f--, p--;
1403
+ if (d === f && d === p) return;
1404
+ let m = c;
1405
+ for (let e = 0; e < d; e++) m += s.child(e).nodeSize;
1406
+ let h = m;
1407
+ for (let e = d; e < f; e++) h += s.child(e).nodeSize;
1408
+ let g = [];
1409
+ for (let e = d; e < p; e++) g.push(n.child(e));
1410
+ e.step(new o(m, h, new a(i.from(g), 0, 0)));
1411
+ }
1412
+ function nn(e, t, n, r) {
1413
+ let i = e.doc.nodeAt(t);
1414
+ if (!i) throw RangeError("No node at given position");
1415
+ let a = n.spec.attrs ?? {}, o = {};
1416
+ for (let e of Object.keys(r)) e in a && (o[e] = r[e]);
1417
+ let s = {
1418
+ ...i.attrs,
1419
+ ...o
1420
+ };
1421
+ if (i.type === n) {
1422
+ for (let n of Object.keys(s)) s[n] !== i.attrs[n] && e.setNodeAttribute(t, n, s[n]);
1423
+ return;
1424
+ }
1425
+ e.setNodeMarkup(t, n, s);
1426
+ }
1427
+ function rn(e, t, n, r) {
1428
+ let i = e.mapping.maps.length;
1429
+ return nn(e, t, n, r), e.mapping.slice(i).map(t, -1);
1430
+ }
1431
+ function an(e, t, n) {
1432
+ let r = k(t);
1343
1433
  if (e.children !== void 0 && e.children.length > 0) {
1344
- let s = e.children.map((e) => {
1345
- let t = W(e, a);
1434
+ let a = e.children.map((e) => {
1435
+ let t = U(e, r);
1346
1436
  return t.check(), t;
1347
1437
  });
1348
- if (n.childContainer) t.step(new o(n.childContainer.beforePos + 1, n.childContainer.afterPos - 1, new i(r.from(s), 0, 0)));
1438
+ if (n.childContainer) tn(t, n.childContainer.beforePos, i.from(a));
1349
1439
  else {
1350
1440
  if (!n.isBlockContainer) throw Error("impossible");
1351
- t.insert(n.blockContent.afterPos, a.nodes.blockGroup.createChecked({}, s));
1441
+ t.insert(n.blockContent.afterPos, r.nodes.blockGroup.createChecked({}, a));
1352
1442
  }
1353
1443
  }
1354
1444
  }
1355
- function en(e, t, n, r, i) {
1356
- let a = typeof t == "string" ? t : t.id, o = Jt(a, e.doc);
1445
+ function on(e, t, n, r, i) {
1446
+ let a = typeof t == "string" ? t : t.id, o = Xt(a, e.doc);
1357
1447
  if (!o) throw Error(`Block with ID ${a} not found`);
1358
- return Zt(e, o.posBeforeNode, n, r, i), L(e.doc.resolve(o.posBeforeNode + 1).node(), N(e));
1448
+ return $t(e, o.posBeforeNode, n, r, i), M(e.doc.resolve(o.posBeforeNode + 1).node(), e.doc);
1359
1449
  }
1360
- function tn(e) {
1450
+ function sn(e) {
1361
1451
  let t = "selection" in e ? e.selection : null;
1362
1452
  if (!(t instanceof y)) return null;
1363
1453
  let n = e.doc.resolve(t.head), r = -1, i = -1;
@@ -1380,7 +1470,7 @@ function tn(e) {
1380
1470
  offset: Math.max(0, t.head - p)
1381
1471
  };
1382
1472
  }
1383
- function nn(e, t, n) {
1473
+ function cn(e, t, n) {
1384
1474
  if (t.blockNoteType !== "table") return !1;
1385
1475
  let r = -1;
1386
1476
  if (t.isBlockContainer) r = e.mapping.map(t.blockContent.beforePos);
@@ -1397,7 +1487,7 @@ function nn(e, t, n) {
1397
1487
  }
1398
1488
  //#endregion
1399
1489
  //#region src/editor/defaultColors.ts
1400
- var G = {
1490
+ var W = {
1401
1491
  gray: {
1402
1492
  text: "#9b9a97",
1403
1493
  background: "#ebeced"
@@ -1434,7 +1524,7 @@ var G = {
1434
1524
  text: "#ad1a72",
1435
1525
  background: "#f4dfeb"
1436
1526
  }
1437
- }, rn = {
1527
+ }, ln = {
1438
1528
  gray: {
1439
1529
  text: "#bebdb8",
1440
1530
  background: "#9b9a97"
@@ -1471,7 +1561,7 @@ var G = {
1471
1561
  text: "#da208f",
1472
1562
  background: "#ad1a72"
1473
1563
  }
1474
- }, K = {
1564
+ }, G = {
1475
1565
  backgroundColor: { default: "default" },
1476
1566
  textColor: { default: "default" },
1477
1567
  textAlignment: {
@@ -1483,40 +1573,40 @@ var G = {
1483
1573
  "justify"
1484
1574
  ]
1485
1575
  }
1486
- }, q = (e) => {
1576
+ }, K = (e) => {
1487
1577
  let t = {};
1488
- return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = K.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
1489
- }, J = (e, t) => {
1490
- e.backgroundColor && e.backgroundColor !== K.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in G ? G[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== K.textColor.default && (t.style.color = e.textColor in G ? G[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== K.textAlignment.default && (t.style.textAlign = e.textAlignment);
1491
- }, an = (e = "backgroundColor") => ({
1492
- default: K.backgroundColor.default,
1493
- parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : K.backgroundColor.default,
1494
- renderHTML: (t) => t[e] === K.backgroundColor.default ? {} : { "data-background-color": t[e] }
1495
- }), on = (e = "textColor") => ({
1496
- default: K.textColor.default,
1497
- parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : K.textColor.default,
1498
- renderHTML: (t) => t[e] === K.textColor.default ? {} : { "data-text-color": t[e] }
1499
- }), sn = (e = "textAlignment") => ({
1500
- default: K.textAlignment.default,
1501
- parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : K.textAlignment.default,
1502
- renderHTML: (t) => t[e] === K.textAlignment.default ? {} : { "data-text-alignment": t[e] }
1503
- }), cn = (e, t) => {
1578
+ return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = G.textAlignment.values.includes(e.style.textAlign) ? e.style.textAlign : void 0, t;
1579
+ }, q = (e, t) => {
1580
+ e.backgroundColor && e.backgroundColor !== G.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in W ? W[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== G.textColor.default && (t.style.color = e.textColor in W ? W[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== G.textAlignment.default && (t.style.textAlign = e.textAlignment);
1581
+ }, un = (e = "backgroundColor") => ({
1582
+ default: G.backgroundColor.default,
1583
+ parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : e.style.backgroundColor ? e.style.backgroundColor : G.backgroundColor.default,
1584
+ renderHTML: (t) => t[e] === G.backgroundColor.default ? {} : { "data-background-color": t[e] }
1585
+ }), dn = (e = "textColor") => ({
1586
+ default: G.textColor.default,
1587
+ parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : e.style.color ? e.style.color : G.textColor.default,
1588
+ renderHTML: (t) => t[e] === G.textColor.default ? {} : { "data-text-color": t[e] }
1589
+ }), fn = (e = "textAlignment") => ({
1590
+ default: G.textAlignment.default,
1591
+ parseHTML: (e) => e.hasAttribute("data-text-alignment") ? e.getAttribute("data-text-alignment") : e.style.textAlign ? e.style.textAlign : G.textAlignment.default,
1592
+ renderHTML: (t) => t[e] === G.textAlignment.default ? {} : { "data-text-alignment": t[e] }
1593
+ }), pn = (e, t) => {
1504
1594
  let n = e.querySelector(t);
1505
1595
  if (n) return {
1506
1596
  targetElement: n,
1507
1597
  caption: e.querySelector("figcaption")?.textContent ?? void 0
1508
1598
  };
1509
- }, Y = t(({ editor: t }) => {
1510
- let n = e(void 0);
1599
+ }, J = n(({ editor: e }) => {
1600
+ let n = t(void 0);
1511
1601
  function r() {
1512
1602
  n.setState(void 0);
1513
1603
  }
1514
1604
  return {
1515
1605
  key: "filePanel",
1516
1606
  store: n,
1517
- mount({ signal: e }) {
1518
- let n = t.onChange(r, !1), i = t.onSelectionChange(r, !1);
1519
- e.addEventListener("abort", () => {
1607
+ mount({ signal: t }) {
1608
+ let n = e.onChange(r, !1), i = e.onSelectionChange(r, !1);
1609
+ t.addEventListener("abort", () => {
1520
1610
  n(), i();
1521
1611
  });
1522
1612
  },
@@ -1525,7 +1615,7 @@ var G = {
1525
1615
  n.setState(e);
1526
1616
  }
1527
1617
  };
1528
- }), ln = (e, t, n) => {
1618
+ }), mn = (e, t, n) => {
1529
1619
  let r = document.createElement("div");
1530
1620
  r.className = "bn-add-file-button";
1531
1621
  let i = document.createElement("div");
@@ -1535,7 +1625,7 @@ var G = {
1535
1625
  let o = (e) => {
1536
1626
  e.preventDefault(), e.stopPropagation();
1537
1627
  }, s = () => {
1538
- t.isEditable && t.getExtension(Y)?.showMenu(e.id);
1628
+ t.isEditable && t.getExtension(J)?.showMenu(e.id);
1539
1629
  };
1540
1630
  return r.addEventListener("mousedown", o, !0), r.addEventListener("click", s, !0), {
1541
1631
  dom: r,
@@ -1543,17 +1633,17 @@ var G = {
1543
1633
  r.removeEventListener("mousedown", o, !0), r.removeEventListener("click", s, !0);
1544
1634
  }
1545
1635
  };
1546
- }, un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", dn = (e) => {
1636
+ }, hn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>", gn = (e) => {
1547
1637
  let t = document.createElement("div");
1548
1638
  t.className = "bn-file-name-with-icon";
1549
1639
  let n = document.createElement("div");
1550
- n.className = "bn-file-icon", n.innerHTML = un, t.appendChild(n);
1640
+ n.className = "bn-file-icon", n.innerHTML = hn, t.appendChild(n);
1551
1641
  let r = document.createElement("p");
1552
1642
  return r.className = "bn-file-name", r.textContent = e.props.name, t.appendChild(r), { dom: t };
1553
- }, fn = (e, t, n, r) => {
1643
+ }, _n = (e, t, n, r) => {
1554
1644
  let i = e.props.url !== "" && !!e.props.caption, a = document.createElement(i ? "figure" : "div");
1555
1645
  if (a.className = "bn-file-block-content-wrapper", e.props.url === "") {
1556
- let n = ln(e, t, r);
1646
+ let n = mn(e, t, r);
1557
1647
  a.appendChild(n.dom);
1558
1648
  let i = t.onUploadStart((t) => {
1559
1649
  if (t === e.id) {
@@ -1571,7 +1661,7 @@ var G = {
1571
1661
  }
1572
1662
  let o = { dom: a };
1573
1663
  if (e.props.showPreview === !1 || !n) {
1574
- let t = dn(e);
1664
+ let t = gn(e);
1575
1665
  a.appendChild(t.dom), o.destroy = () => {
1576
1666
  t.destroy?.();
1577
1667
  };
@@ -1581,69 +1671,69 @@ var G = {
1581
1671
  t.className = "bn-file-caption", t.textContent = e.props.caption, a.appendChild(t);
1582
1672
  }
1583
1673
  return o;
1584
- }, pn = (e, t) => {
1674
+ }, vn = (e, t) => {
1585
1675
  let n = document.createElement("figure"), r = document.createElement("figcaption");
1586
1676
  return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
1587
- }, mn = (e, t) => {
1677
+ }, yn = (e, t) => {
1588
1678
  let n = document.createElement("div"), r = document.createElement("p");
1589
1679
  return r.textContent = t, n.appendChild(e), n.appendChild(r), { dom: n };
1590
- }, hn = (e) => ({ url: e.src || void 0 }), gn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", _n = A((e) => ({
1680
+ }, bn = (e) => ({ url: e.src || void 0 }), xn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>", Sn = F((e) => ({
1591
1681
  type: "audio",
1592
1682
  propSchema: {
1593
- backgroundColor: K.backgroundColor,
1683
+ backgroundColor: G.backgroundColor,
1594
1684
  name: { default: "" },
1595
1685
  url: { default: "" },
1596
1686
  caption: { default: "" },
1597
1687
  showPreview: { default: !0 }
1598
1688
  },
1599
1689
  content: "none"
1600
- })), vn = (e = {}) => (e) => {
1690
+ })), Cn = (e = {}) => (e) => {
1601
1691
  if (e.tagName === "AUDIO") {
1602
1692
  if (e.closest("figure")) return;
1603
- let { backgroundColor: t } = q(e);
1693
+ let { backgroundColor: t } = K(e);
1604
1694
  return {
1605
- ...hn(e),
1695
+ ...bn(e),
1606
1696
  backgroundColor: t
1607
1697
  };
1608
1698
  }
1609
1699
  if (e.tagName === "FIGURE") {
1610
- let t = cn(e, "audio");
1700
+ let t = pn(e, "audio");
1611
1701
  if (!t) return;
1612
- let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
1702
+ let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
1613
1703
  return {
1614
- ...hn(n),
1704
+ ...bn(n),
1615
1705
  backgroundColor: i,
1616
1706
  caption: r
1617
1707
  };
1618
1708
  }
1619
- }, yn = (e = {}) => (t, n) => {
1709
+ }, wn = (e = {}) => (t, n) => {
1620
1710
  let r = document.createElement("div");
1621
1711
  r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>";
1622
1712
  let i = document.createElement("audio");
1623
1713
  return i.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
1624
1714
  i.src = e;
1625
- }) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, fn(t, n, { dom: i }, r.firstElementChild);
1626
- }, bn = (e = {}) => (e, t) => {
1715
+ }) : i.src = t.props.url, i.controls = !0, i.contentEditable = "false", i.draggable = !1, _n(t, n, { dom: i }, r.firstElementChild);
1716
+ }, Tn = (e = {}) => (e, t) => {
1627
1717
  if (!e.props.url) return { dom: document.createElement("audio") };
1628
1718
  let n;
1629
- return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
1630
- }, xn = j(_n, (e) => ({
1719
+ return e.props.showPreview ? (n = document.createElement("audio"), n.src = e.props.url) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? vn(n, e.props.caption) : yn(n, e.props.caption) : { dom: n };
1720
+ }, En = I(Sn, (e) => ({
1631
1721
  meta: { fileBlockAccept: ["audio/*"] },
1632
- parse: vn(e),
1633
- render: yn(e),
1634
- toExternalHTML: bn(e),
1722
+ parse: Cn(e),
1723
+ render: wn(e),
1724
+ toExternalHTML: Tn(e),
1635
1725
  runsBefore: ["file"]
1636
- })), Sn = Symbol.for("blocknote.shikiParser"), Cn = Symbol.for("blocknote.shikiHighlighterPromise");
1637
- function wn(e) {
1726
+ })), Dn = Symbol.for("blocknote.shikiParser"), On = Symbol.for("blocknote.shikiHighlighterPromise");
1727
+ function kn(e) {
1638
1728
  let t = globalThis, n, r, i = !1;
1639
1729
  return ge({
1640
1730
  parser: (a) => {
1641
1731
  if (!e.createHighlighter) return process.env.NODE_ENV === "development" && !i && (console.log("For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"), i = !0), [];
1642
- if (!n) return t[Cn] = t[Cn] || e.createHighlighter(), t[Cn].then((e) => {
1732
+ if (!n) return t[On] = t[On] || e.createHighlighter(), t[On].then((e) => {
1643
1733
  n = e;
1644
1734
  });
1645
- let o = Dn(e, a.language);
1646
- return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[Sn] || _e(n), t[Sn] = r), r(a)) : n.loadLanguage(o);
1735
+ let o = Mn(e, a.language);
1736
+ return !o || o === "text" || o === "none" || o === "plaintext" || o === "txt" ? [] : n.getLoadedLanguages().includes(o) ? (r || (r = t[Dn] || _e(n), t[Dn] = r), r(a)) : n.loadLanguage(o);
1647
1737
  },
1648
1738
  languageExtractor: (e) => e.attrs.language,
1649
1739
  nodeTypes: ["codeBlock"]
@@ -1651,11 +1741,11 @@ function wn(e) {
1651
1741
  }
1652
1742
  //#endregion
1653
1743
  //#region src/blocks/Code/block.ts
1654
- var Tn = A(({ defaultLanguage: e = "text" }) => ({
1744
+ var An = F(({ defaultLanguage: e = "text" }) => ({
1655
1745
  type: "codeBlock",
1656
1746
  propSchema: { language: { default: e } },
1657
- content: "inline"
1658
- })), En = j(Tn, (e) => ({
1747
+ content: "plain"
1748
+ })), jn = I(An, (e) => ({
1659
1749
  meta: {
1660
1750
  code: !0,
1661
1751
  defining: !0,
@@ -1707,10 +1797,10 @@ var Tn = A(({ defaultLanguage: e = "text" }) => ({
1707
1797
  contentDOM: n
1708
1798
  };
1709
1799
  }
1710
- }), (e) => [t({
1800
+ }), (e) => [n({
1711
1801
  key: "code-block-highlighter",
1712
- prosemirrorPlugins: [wn(e)]
1713
- }), t({
1802
+ prosemirrorPlugins: [kn(e)]
1803
+ }), n({
1714
1804
  key: "code-block-keyboard-shortcuts",
1715
1805
  keyboardShortcuts: {
1716
1806
  Delete: ({ editor: e }) => e.transact((t) => {
@@ -1747,22 +1837,22 @@ var Tn = A(({ defaultLanguage: e = "text" }) => ({
1747
1837
  let n = t[1].trim();
1748
1838
  return {
1749
1839
  type: "codeBlock",
1750
- props: { language: { language: Dn(e, n) ?? n }.language },
1840
+ props: { language: { language: Mn(e, n) ?? n }.language },
1751
1841
  content: []
1752
1842
  };
1753
1843
  }
1754
1844
  }]
1755
1845
  })]);
1756
- function Dn(e, t) {
1846
+ function Mn(e, t) {
1757
1847
  return Object.entries(e.supportedLanguages ?? {}).find(([e, { aliases: n }]) => n?.includes(t) || e === t)?.[0];
1758
1848
  }
1759
1849
  //#endregion
1760
1850
  //#region src/blocks/Divider/block.ts
1761
- var On = A(() => ({
1851
+ var Nn = F(() => ({
1762
1852
  type: "divider",
1763
1853
  propSchema: {},
1764
1854
  content: "none"
1765
- })), kn = j(On, {
1855
+ })), Pn = I(Nn, {
1766
1856
  meta: { isolating: !1 },
1767
1857
  parse(e) {
1768
1858
  if (e.tagName === "HR") return {};
@@ -1770,10 +1860,10 @@ var On = A(() => ({
1770
1860
  render() {
1771
1861
  return { dom: document.createElement("hr") };
1772
1862
  }
1773
- }, [t({
1863
+ }, [n({
1774
1864
  key: "divider-block-shortcuts",
1775
1865
  inputRules: [{
1776
- find: RegExp("^---$"),
1866
+ find: /* @__PURE__ */ RegExp("^---$"),
1777
1867
  replace() {
1778
1868
  return {
1779
1869
  type: "divider",
@@ -1782,72 +1872,72 @@ var On = A(() => ({
1782
1872
  };
1783
1873
  }
1784
1874
  }]
1785
- })]), An = (e) => ({ url: e.src || void 0 }), jn = A(() => ({
1875
+ })]), Fn = (e) => ({ url: e.src || void 0 }), In = F(() => ({
1786
1876
  type: "file",
1787
1877
  propSchema: {
1788
- backgroundColor: K.backgroundColor,
1878
+ backgroundColor: G.backgroundColor,
1789
1879
  name: { default: "" },
1790
1880
  url: { default: "" },
1791
1881
  caption: { default: "" }
1792
1882
  },
1793
1883
  content: "none"
1794
- })), Mn = () => (e) => {
1884
+ })), Ln = () => (e) => {
1795
1885
  if (e.tagName === "EMBED") {
1796
1886
  if (e.closest("figure")) return;
1797
- let { backgroundColor: t } = q(e);
1887
+ let { backgroundColor: t } = K(e);
1798
1888
  return {
1799
- ...An(e),
1889
+ ...Fn(e),
1800
1890
  backgroundColor: t
1801
1891
  };
1802
1892
  }
1803
1893
  if (e.tagName === "FIGURE") {
1804
- let t = cn(e, "embed");
1894
+ let t = pn(e, "embed");
1805
1895
  if (!t) return;
1806
- let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
1896
+ let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
1807
1897
  return {
1808
- ...An(n),
1898
+ ...Fn(n),
1809
1899
  backgroundColor: i,
1810
1900
  caption: r
1811
1901
  };
1812
1902
  }
1813
- }, Nn = j(jn, {
1903
+ }, Rn = I(In, {
1814
1904
  meta: { fileBlockAccept: ["*/*"] },
1815
- parse: Mn(),
1905
+ parse: Ln(),
1816
1906
  render(e, t) {
1817
- return fn(e, t);
1907
+ return _n(e, t);
1818
1908
  },
1819
1909
  toExternalHTML(e) {
1820
1910
  if (!e.props.url) return { dom: document.createElement("embed") };
1821
1911
  let t = document.createElement("a");
1822
- return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? mn(t, e.props.caption) : { dom: t };
1912
+ return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? yn(t, e.props.caption) : { dom: t };
1823
1913
  }
1824
1914
  });
1825
1915
  //#endregion
1826
1916
  //#region src/blocks/getDetailsContent.ts
1827
- function Pn(e, t, i) {
1828
- let a = n.fromSchema(t), o = e.querySelector(":scope > summary"), s;
1917
+ function zn(e, t, n) {
1918
+ let a = r.fromSchema(t), o = e.querySelector(":scope > summary"), s;
1829
1919
  if (o) {
1830
1920
  let e = o.cloneNode(!0);
1831
- Ue(e), s = a.parse(e, {
1921
+ Je(e), s = a.parse(e, {
1832
1922
  topNode: t.nodes.paragraph.create(),
1833
1923
  preserveWhitespace: !0
1834
1924
  }).content;
1835
- } else s = r.empty;
1925
+ } else s = i.empty;
1836
1926
  let c = document.createElement("div");
1837
1927
  c.setAttribute("data-node-type", "blockGroup");
1838
1928
  let l = !1;
1839
1929
  for (let t of Array.from(e.childNodes)) t.tagName !== "SUMMARY" && (t.nodeType === 3 && !t.textContent?.trim() || (l = !0, c.appendChild(t.cloneNode(!0))));
1840
- let u = t.nodes[i].create({}, s);
1930
+ let u = t.nodes[n].create({}, s);
1841
1931
  if (!l) return u.content;
1842
1932
  let d = a.parse(c, { topNode: t.nodes.blockGroup.create() });
1843
1933
  return d.content.size > 0 ? u.content.addToEnd(d) : u.content;
1844
1934
  }
1845
1935
  //#endregion
1846
1936
  //#region src/blocks/ToggleWrapper/createToggleWrapper.ts
1847
- var Fn = {
1937
+ var Bn = {
1848
1938
  set: (e, t) => window.localStorage.setItem(`toggle-${e.id}`, t ? "true" : "false"),
1849
1939
  get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
1850
- }, In = (e, t, n, r = Fn) => {
1940
+ }, Vn = (e, t, n, r = Bn) => {
1851
1941
  if ("isToggleable" in e.props && !e.props.isToggleable) return { dom: n };
1852
1942
  let i = document.createElement("div"), a = document.createElement("div");
1853
1943
  a.className = "bn-toggle-wrapper";
@@ -1881,23 +1971,23 @@ var Fn = {
1881
1971
  o.removeEventListener("mousedown", s), o.removeEventListener("click", c), l.removeEventListener("mousedown", u), l.removeEventListener("click", d), p?.();
1882
1972
  }
1883
1973
  };
1884
- }, Ln = [
1974
+ }, Hn = [
1885
1975
  1,
1886
1976
  2,
1887
1977
  3,
1888
1978
  4,
1889
1979
  5,
1890
1980
  6
1891
- ], Rn = (e) => ({ editor: t }) => {
1981
+ ], Un = (e) => ({ editor: t }) => {
1892
1982
  let n = t.getTextCursorPosition();
1893
1983
  return t.schema.blockSchema[n.block.type].content === "inline" ? (t.updateBlock(n.block, {
1894
1984
  type: "heading",
1895
1985
  props: { level: e }
1896
1986
  }), !0) : !1;
1897
- }, zn = A(({ defaultLevel: e = 1, levels: t = Ln, allowToggleHeadings: n = !0 } = {}) => ({
1987
+ }, Wn = F(({ defaultLevel: e = 1, levels: t = Hn, allowToggleHeadings: n = !0 } = {}) => ({
1898
1988
  type: "heading",
1899
1989
  propSchema: {
1900
- ...K,
1990
+ ...G,
1901
1991
  level: {
1902
1992
  default: e,
1903
1993
  values: t
@@ -1908,7 +1998,7 @@ var Fn = {
1908
1998
  } } : {}
1909
1999
  },
1910
2000
  content: "inline"
1911
- })), Bn = j(zn, ({ allowToggleHeadings: e = !0 } = {}) => ({
2001
+ })), Gn = I(Wn, ({ allowToggleHeadings: e = !0 } = {}) => ({
1912
2002
  meta: { isolating: !1 },
1913
2003
  parse(t) {
1914
2004
  if (e && t.tagName === "DETAILS") {
@@ -1916,7 +2006,7 @@ var Fn = {
1916
2006
  if (!e) return;
1917
2007
  let n = e.querySelector("h1, h2, h3, h4, h5, h6");
1918
2008
  return n ? {
1919
- ...q(n),
2009
+ ...K(n),
1920
2010
  level: parseInt(n.tagName[1]),
1921
2011
  isToggleable: !0
1922
2012
  } : void 0;
@@ -1944,18 +2034,18 @@ var Fn = {
1944
2034
  default: return;
1945
2035
  }
1946
2036
  return {
1947
- ...q(t),
2037
+ ...K(t),
1948
2038
  level: n
1949
2039
  };
1950
2040
  },
1951
2041
  ...e ? { parseContent: ({ el: e, schema: t }) => {
1952
- if (e.tagName === "DETAILS") return Pn(e, t, "heading");
2042
+ if (e.tagName === "DETAILS") return zn(e, t, "heading");
1953
2043
  } } : {},
1954
2044
  runsBefore: ["toggleListItem"],
1955
2045
  render(t, n) {
1956
2046
  let r = document.createElement(`h${t.props.level}`);
1957
2047
  return e ? {
1958
- ...In(t, n, r),
2048
+ ...Vn(t, n, r),
1959
2049
  contentDOM: r
1960
2050
  } : {
1961
2051
  dom: r,
@@ -1964,7 +2054,7 @@ var Fn = {
1964
2054
  },
1965
2055
  toExternalHTML(t) {
1966
2056
  let n = document.createElement(`h${t.props.level}`);
1967
- if (J(t.props, n), e && t.props.isToggleable) {
2057
+ if (q(t.props, n), e && t.props.isToggleable) {
1968
2058
  let e = document.createElement("details");
1969
2059
  e.setAttribute("open", "");
1970
2060
  let t = document.createElement("summary");
@@ -1979,9 +2069,9 @@ var Fn = {
1979
2069
  contentDOM: n
1980
2070
  };
1981
2071
  }
1982
- }), ({ levels: e = Ln } = {}) => [t({
2072
+ }), ({ levels: e = Hn } = {}) => [n({
1983
2073
  key: "heading-shortcuts",
1984
- keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Rn(e)]) ?? []),
2074
+ keyboardShortcuts: Object.fromEntries(e.map((e) => [`Mod-Alt-${e}`, Un(e)]) ?? []),
1985
2075
  inputRules: e.map((e) => ({
1986
2076
  find: RegExp(`^(#{${e}})\\s$`),
1987
2077
  replace({ match: e }) {
@@ -1991,8 +2081,8 @@ var Fn = {
1991
2081
  };
1992
2082
  }
1993
2083
  }))
1994
- })]), Vn = (e, t, n, r, i) => {
1995
- let { dom: a, destroy: o } = fn(e, t, n, i), s = a;
2084
+ })]), Kn = (e, t, n, r, i) => {
2085
+ let { dom: a, destroy: o } = _n(e, t, n, i), s = a;
1996
2086
  s.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? s.style.width = `${e.props.previewWidth}px` : s.style.width = "fit-content");
1997
2087
  let c = document.createElement("div");
1998
2088
  c.className = "bn-resize-handle", c.style.left = "4px", c.style.display = "none", r.appendChild(c);
@@ -2036,15 +2126,15 @@ var Fn = {
2036
2126
  o?.(), window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", m), window.removeEventListener("touchend", m), s.removeEventListener("mouseenter", h), s.removeEventListener("mouseleave", g), c.removeEventListener("mousedown", _), c.removeEventListener("touchstart", _), l.removeEventListener("mousedown", v), l.removeEventListener("touchstart", v);
2037
2127
  }
2038
2128
  };
2039
- }, Hn = (e) => ({
2129
+ }, qn = (e) => ({
2040
2130
  url: e.src || void 0,
2041
2131
  previewWidth: e.width || void 0,
2042
2132
  name: e.alt || void 0
2043
- }), Un = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", Wn = A((e = {}) => ({
2133
+ }), Jn = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>", Yn = F((e = {}) => ({
2044
2134
  type: "image",
2045
2135
  propSchema: {
2046
- textAlignment: K.textAlignment,
2047
- backgroundColor: K.backgroundColor,
2136
+ textAlignment: G.textAlignment,
2137
+ backgroundColor: G.backgroundColor,
2048
2138
  name: { default: "" },
2049
2139
  url: { default: "" },
2050
2140
  caption: { default: "" },
@@ -2055,26 +2145,26 @@ var Fn = {
2055
2145
  }
2056
2146
  },
2057
2147
  content: "none"
2058
- })), Gn = (e = {}) => (e) => {
2148
+ })), Xn = (e = {}) => (e) => {
2059
2149
  if (e.tagName === "IMG") {
2060
2150
  if (e.closest("figure")) return;
2061
- let { backgroundColor: t } = q(e);
2151
+ let { backgroundColor: t } = K(e);
2062
2152
  return {
2063
- ...Hn(e),
2153
+ ...qn(e),
2064
2154
  backgroundColor: t
2065
2155
  };
2066
2156
  }
2067
2157
  if (e.tagName === "FIGURE") {
2068
- let t = cn(e, "img");
2158
+ let t = pn(e, "img");
2069
2159
  if (!t) return;
2070
- let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
2160
+ let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
2071
2161
  return {
2072
- ...Hn(n),
2162
+ ...qn(n),
2073
2163
  backgroundColor: i,
2074
2164
  caption: r
2075
2165
  };
2076
2166
  }
2077
- }, Kn = (e = {}) => (t, n) => {
2167
+ }, Zn = (e = {}) => (t, n) => {
2078
2168
  let r = document.createElement("div");
2079
2169
  r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>";
2080
2170
  let i = document.createElement("div");
@@ -2082,21 +2172,21 @@ var Fn = {
2082
2172
  let a = document.createElement("img");
2083
2173
  return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
2084
2174
  a.src = e;
2085
- }) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
2086
- }, qn = (e = {}) => (e, t) => {
2175
+ }) : a.src = t.props.url, a.alt = t.props.name || "", a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Kn(t, n, { dom: i }, i, r.firstElementChild);
2176
+ }, Qn = (e = {}) => (e, t) => {
2087
2177
  if (!e.props.url) return { dom: document.createElement("img") };
2088
2178
  let n;
2089
- return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(n, e.props.caption) : mn(n, e.props.caption) : { dom: n };
2090
- }, Jn = j(Wn, (e) => ({
2179
+ return e.props.showPreview ? (n = document.createElement("img"), n.src = e.props.url, n.alt = e.props.name || "", e.props.previewWidth && (n.width = e.props.previewWidth)) : (n = document.createElement("a"), n.href = e.props.url, n.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? vn(n, e.props.caption) : yn(n, e.props.caption) : { dom: n };
2180
+ }, $n = I(Yn, (e) => ({
2091
2181
  meta: { fileBlockAccept: ["image/*"] },
2092
- parse: Gn(e),
2093
- render: Kn(e),
2094
- toExternalHTML: qn(e),
2182
+ parse: Xn(e),
2183
+ render: Zn(e),
2184
+ toExternalHTML: Qn(e),
2095
2185
  runsBefore: ["file"]
2096
- })), Yn = (e, t, n) => ({ state: r, dispatch: i }) => i ? Xn(r.tr, e, t, n) : !0, Xn = (e, t, n, r) => {
2097
- let i = M(Qe(e.doc, t));
2186
+ })), er = (e, t, n) => ({ state: r, dispatch: i }) => i ? tr(r.tr, e, t, n) : !0, tr = (e, t, n, r) => {
2187
+ let i = b(je(e.doc, t));
2098
2188
  if (!i.isBlockContainer) return !1;
2099
- let a = N(e), o = [{
2189
+ let a = k(e), o = [{
2100
2190
  type: i.bnBlock.node.type,
2101
2191
  attrs: r ? {
2102
2192
  ...i.bnBlock.node.attrs,
@@ -2107,31 +2197,31 @@ var Fn = {
2107
2197
  attrs: r ? { ...i.blockContent.node.attrs } : {}
2108
2198
  }];
2109
2199
  return e.split(t, 2, o), !0;
2110
- }, Zn = (e, t) => {
2200
+ }, nr = (e, t) => {
2111
2201
  let { blockInfo: n, selectionEmpty: r } = e.transact((e) => ({
2112
- blockInfo: nt(e),
2202
+ blockInfo: x(e),
2113
2203
  selectionEmpty: e.selection.anchor === e.selection.head
2114
2204
  }));
2115
2205
  if (!n.isBlockContainer) return !1;
2116
2206
  let { bnBlock: i, blockContent: a } = n;
2117
2207
  return a.node.type.name !== t || !r ? !1 : a.node.childCount === 0 ? (e.transact((e) => {
2118
- Zt(e, i.beforePos, {
2208
+ $t(e, i.beforePos, {
2119
2209
  type: "paragraph",
2120
2210
  props: {}
2121
2211
  });
2122
- }), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(), Xn(e, e.selection.from, !0))) : !1;
2212
+ }), !0) : a.node.childCount > 0 ? e.transact((e) => (e.deleteSelection(), e.scrollIntoView(), tr(e, e.selection.from, !0))) : !1;
2123
2213
  };
2124
2214
  //#endregion
2125
2215
  //#region src/blocks/ListItem/getListItemContent.ts
2126
- function Qn(e, t, i) {
2127
- let a = n.fromSchema(t), o = e, s = document.createElement("div");
2216
+ function rr(e, t, n) {
2217
+ let a = r.fromSchema(t), o = e, s = document.createElement("div");
2128
2218
  s.setAttribute("data-node-type", "blockGroup");
2129
2219
  for (let e of Array.from(o.childNodes)) s.appendChild(e.cloneNode(!0));
2130
2220
  let c = a.parse(s, { topNode: t.nodes.blockGroup.create() });
2131
2221
  c.firstChild?.firstChild?.type.name === "checkListItem" && (c = c.copy(c.content.cut(c.firstChild.firstChild.nodeSize + 2)));
2132
2222
  let l = c.firstChild?.firstChild;
2133
- if (!l?.isTextblock) return r.from(c);
2134
- let u = t.nodes[i].create({}, l.content), d = c.content.cut(l.nodeSize + 2);
2223
+ if (!l?.isTextblock) return i.from(c);
2224
+ let u = t.nodes[n].create({}, l.content), d = c.content.cut(l.nodeSize + 2);
2135
2225
  if (d.size > 0) {
2136
2226
  let e = c.copy(d);
2137
2227
  return u.content.addToEnd(e);
@@ -2140,18 +2230,18 @@ function Qn(e, t, i) {
2140
2230
  }
2141
2231
  //#endregion
2142
2232
  //#region src/blocks/ListItem/BulletListItem/block.ts
2143
- var $n = A(() => ({
2233
+ var ir = F(() => ({
2144
2234
  type: "bulletListItem",
2145
- propSchema: { ...K },
2235
+ propSchema: { ...G },
2146
2236
  content: "inline"
2147
- })), er = j($n, {
2237
+ })), ar = I(ir, {
2148
2238
  meta: { isolating: !1 },
2149
2239
  parse(e) {
2150
2240
  if (e.tagName !== "LI") return;
2151
2241
  let t = e.parentElement;
2152
- if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return q(e);
2242
+ if (t === null || t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL" || !e.closest("ul, ol")) return K(e);
2153
2243
  },
2154
- parseContent: ({ el: e, schema: t }) => Qn(e, t, "bulletListItem"),
2244
+ parseContent: ({ el: e, schema: t }) => rr(e, t, "bulletListItem"),
2155
2245
  render() {
2156
2246
  let e = document.createElement("p");
2157
2247
  return {
@@ -2161,15 +2251,15 @@ var $n = A(() => ({
2161
2251
  },
2162
2252
  toExternalHTML(e) {
2163
2253
  let t = document.createElement("li"), n = document.createElement("p");
2164
- return J(e.props, t), t.appendChild(n), {
2254
+ return q(e.props, t), t.appendChild(n), {
2165
2255
  dom: t,
2166
2256
  contentDOM: n
2167
2257
  };
2168
2258
  }
2169
- }, [t({
2259
+ }, [n({
2170
2260
  key: "bullet-list-item-shortcuts",
2171
2261
  keyboardShortcuts: {
2172
- Enter: ({ editor: e }) => Zn(e, "bulletListItem"),
2262
+ Enter: ({ editor: e }) => nr(e, "bulletListItem"),
2173
2263
  "Mod-Shift-8": ({ editor: e }) => {
2174
2264
  let t = e.getTextCursorPosition();
2175
2265
  return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
@@ -2181,23 +2271,23 @@ var $n = A(() => ({
2181
2271
  inputRules: [{
2182
2272
  find: /^\s?[-+*]\s$/,
2183
2273
  replace({ editor: e }) {
2184
- if (tt(e.prosemirrorState).blockNoteType !== "heading") return {
2274
+ if (x(e.prosemirrorState).blockNoteType !== "heading") return {
2185
2275
  type: "bulletListItem",
2186
2276
  props: {}
2187
2277
  };
2188
2278
  }
2189
2279
  }]
2190
- })]), tr = A(() => ({
2280
+ })]), or = F(() => ({
2191
2281
  type: "checkListItem",
2192
2282
  propSchema: {
2193
- ...K,
2283
+ ...G,
2194
2284
  checked: {
2195
2285
  default: !1,
2196
2286
  type: "boolean"
2197
2287
  }
2198
2288
  },
2199
2289
  content: "inline"
2200
- })), nr = j(tr, {
2290
+ })), sr = I(or, {
2201
2291
  meta: { isolating: !1 },
2202
2292
  parse(e) {
2203
2293
  if (e.tagName === "input") return e.closest("[data-content-type]") || e.closest("li") ? void 0 : e.type === "checkbox" ? { checked: e.checked } : void 0;
@@ -2206,12 +2296,12 @@ var $n = A(() => ({
2206
2296
  if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL")) {
2207
2297
  let t = e.querySelector("input[type=checkbox]") || null;
2208
2298
  return t === null ? void 0 : {
2209
- ...q(e),
2299
+ ...K(e),
2210
2300
  checked: t.checked
2211
2301
  };
2212
2302
  }
2213
2303
  },
2214
- parseContent: ({ el: e, schema: t }) => Qn(e, t, "checkListItem"),
2304
+ parseContent: ({ el: e, schema: t }) => rr(e, t, "checkListItem"),
2215
2305
  render(e, t) {
2216
2306
  let n = document.createDocumentFragment(), r = document.createElement("input");
2217
2307
  r.type = "checkbox", r.checked = e.props.checked, e.props.checked && r.setAttribute("checked", ""), r.disabled = !t.isEditable, r.addEventListener("change", () => {
@@ -2227,16 +2317,16 @@ var $n = A(() => ({
2227
2317
  let t = document.createElement("li"), n = document.createElement("input");
2228
2318
  n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
2229
2319
  let r = document.createElement("p");
2230
- return J(e.props, t), t.appendChild(n), t.appendChild(r), {
2320
+ return q(e.props, t), t.appendChild(n), t.appendChild(r), {
2231
2321
  dom: t,
2232
2322
  contentDOM: r
2233
2323
  };
2234
2324
  },
2235
2325
  runsBefore: ["bulletListItem"]
2236
- }, [t({
2326
+ }, [n({
2237
2327
  key: "check-list-item-shortcuts",
2238
2328
  keyboardShortcuts: {
2239
- Enter: ({ editor: e }) => Zn(e, "checkListItem"),
2329
+ Enter: ({ editor: e }) => nr(e, "checkListItem"),
2240
2330
  "Mod-Shift-9": ({ editor: e }) => {
2241
2331
  let t = e.getTextCursorPosition();
2242
2332
  return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
@@ -2265,8 +2355,8 @@ var $n = A(() => ({
2265
2355
  })]);
2266
2356
  //#endregion
2267
2357
  //#region src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts
2268
- function rr(e, t, n, r) {
2269
- let i = !!e.firstChild.attrs.start, a = M({
2358
+ function cr(e, t, n, r) {
2359
+ let i = !!e.firstChild.attrs.start, a = b({
2270
2360
  posBeforeNode: t,
2271
2361
  node: e
2272
2362
  });
@@ -2285,7 +2375,7 @@ function rr(e, t, n, r) {
2285
2375
  pos: t
2286
2376
  }], l = o, u = a.bnBlock.beforePos;
2287
2377
  for (; l && r.get(l) === void 0;) {
2288
- let e = M({
2378
+ let e = b({
2289
2379
  posBeforeNode: u - l.nodeSize,
2290
2380
  node: l
2291
2381
  });
@@ -2297,7 +2387,7 @@ function rr(e, t, n, r) {
2297
2387
  let t = n.doc.resolve(e.bnBlock.beforePos).nodeBefore;
2298
2388
  u = e.bnBlock.beforePos, l = t;
2299
2389
  }
2300
- let d, f, p = c[c.length - 1], m = M({
2390
+ let d, f, p = c[c.length - 1], m = b({
2301
2391
  posBeforeNode: p.pos,
2302
2392
  node: p.node
2303
2393
  });
@@ -2314,7 +2404,7 @@ function rr(e, t, n, r) {
2314
2404
  hasStart: i
2315
2405
  };
2316
2406
  }
2317
- function ir(e, t) {
2407
+ function lr(e, t) {
2318
2408
  let n = /* @__PURE__ */ new Map(), r = t.decorations.map(e.mapping, e.doc), i = e.changedRange() ?? {
2319
2409
  from: 0,
2320
2410
  to: e.doc.nodeSize - 2
@@ -2322,7 +2412,7 @@ function ir(e, t) {
2322
2412
  e.doc.nodesBetween(i.from, e.doc.nodeSize - 2, (t, s, c) => {
2323
2413
  if (c && o.has(c)) return !1;
2324
2414
  if (t.type.name === "blockContainer" && t.firstChild.type.name === "numberedListItem") {
2325
- let { index: l, isFirst: u, hasStart: d } = rr(t, s, e, n), f = e.doc.nodeAt(s + 1);
2415
+ let { index: l, isFirst: u, hasStart: d } = cr(t, s, e, n), f = e.doc.nodeAt(s + 1);
2326
2416
  if (r.find(s + 1, s + 1 + f.nodeSize, (e) => e.index === l && e.isFirst === u && e.hasStart === d).length === 0) a.push(be.node(s + 1, s + 1 + f.nodeSize, { "data-index": l.toString() }, {
2327
2417
  index: l,
2328
2418
  isFirst: u,
@@ -2334,43 +2424,43 @@ function ir(e, t) {
2334
2424
  let s = a.flatMap((e) => r.find(e.from, e.to));
2335
2425
  return { decorations: r.remove(s).add(e.doc, a) };
2336
2426
  }
2337
- var ar = () => new ve({
2427
+ var ur = () => new ve({
2338
2428
  key: new ye("numbered-list-indexing-decorations"),
2339
2429
  state: {
2340
2430
  init(e, t) {
2341
- return ir(t.tr, { decorations: xe.empty });
2431
+ return lr(t.tr, { decorations: xe.empty });
2342
2432
  },
2343
2433
  apply(e, t) {
2344
- return !e.docChanged && t.decorations ? t : ir(e, t);
2434
+ return !e.docChanged && t.decorations ? t : lr(e, t);
2345
2435
  }
2346
2436
  },
2347
2437
  props: { decorations(e) {
2348
2438
  return this.getState(e)?.decorations ?? xe.empty;
2349
2439
  } }
2350
- }), or = A(() => ({
2440
+ }), dr = F(() => ({
2351
2441
  type: "numberedListItem",
2352
2442
  propSchema: {
2353
- ...K,
2443
+ ...G,
2354
2444
  start: {
2355
2445
  default: void 0,
2356
2446
  type: "number"
2357
2447
  }
2358
2448
  },
2359
2449
  content: "inline"
2360
- })), sr = j(or, {
2450
+ })), fr = I(dr, {
2361
2451
  meta: { isolating: !1 },
2362
2452
  parse(e) {
2363
2453
  if (e.tagName !== "LI") return;
2364
2454
  let t = e.parentElement;
2365
2455
  if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && t.parentElement?.tagName === "OL")) {
2366
- let n = parseInt(t.getAttribute("start") || "1"), r = q(e);
2456
+ let n = parseInt(t.getAttribute("start") || "1"), r = K(e);
2367
2457
  return e.previousElementSibling || n === 1 ? r : {
2368
2458
  ...r,
2369
2459
  start: n
2370
2460
  };
2371
2461
  }
2372
2462
  },
2373
- parseContent: ({ el: e, schema: t }) => Qn(e, t, "numberedListItem"),
2463
+ parseContent: ({ el: e, schema: t }) => rr(e, t, "numberedListItem"),
2374
2464
  render() {
2375
2465
  let e = document.createElement("p");
2376
2466
  return {
@@ -2380,17 +2470,17 @@ var ar = () => new ve({
2380
2470
  },
2381
2471
  toExternalHTML(e) {
2382
2472
  let t = document.createElement("li"), n = document.createElement("p");
2383
- return J(e.props, t), t.appendChild(n), {
2473
+ return q(e.props, t), t.appendChild(n), {
2384
2474
  dom: t,
2385
2475
  contentDOM: n
2386
2476
  };
2387
2477
  }
2388
- }, [t({
2478
+ }, [n({
2389
2479
  key: "numbered-list-item-shortcuts",
2390
2480
  inputRules: [{
2391
2481
  find: /^\s?(\d+)\.\s$/,
2392
2482
  replace({ match: e, editor: t }) {
2393
- if (tt(t.prosemirrorState).blockNoteType === "heading") return;
2483
+ if (x(t.prosemirrorState).blockNoteType === "heading") return;
2394
2484
  let n = parseInt(e[1]);
2395
2485
  return {
2396
2486
  type: "numberedListItem",
@@ -2399,7 +2489,7 @@ var ar = () => new ve({
2399
2489
  }
2400
2490
  }],
2401
2491
  keyboardShortcuts: {
2402
- Enter: ({ editor: e }) => Zn(e, "numberedListItem"),
2492
+ Enter: ({ editor: e }) => nr(e, "numberedListItem"),
2403
2493
  "Mod-Shift-7": ({ editor: e }) => {
2404
2494
  let t = e.getTextCursorPosition();
2405
2495
  return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
@@ -2408,30 +2498,30 @@ var ar = () => new ve({
2408
2498
  }), !0) : !1;
2409
2499
  }
2410
2500
  },
2411
- prosemirrorPlugins: [ar()]
2412
- })]), cr = A(() => ({
2501
+ prosemirrorPlugins: [ur()]
2502
+ })]), pr = F(() => ({
2413
2503
  type: "toggleListItem",
2414
- propSchema: { ...K },
2504
+ propSchema: { ...G },
2415
2505
  content: "inline"
2416
- })), lr = j(cr, {
2506
+ })), mr = I(pr, {
2417
2507
  meta: { isolating: !1 },
2418
2508
  parse(e) {
2419
- if (e.tagName === "DETAILS") return q(e);
2509
+ if (e.tagName === "DETAILS") return K(e);
2420
2510
  if (e.tagName === "LI") {
2421
2511
  let t = e.parentElement;
2422
- if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return q(e);
2512
+ if (t && (t.tagName === "UL" || t.tagName === "DIV" && t.parentElement?.tagName === "UL") && e.querySelector(":scope > details")) return K(e);
2423
2513
  }
2424
2514
  },
2425
2515
  parseContent: ({ el: e, schema: t }) => {
2426
2516
  let n = e.tagName === "DETAILS" ? e : e.querySelector(":scope > details");
2427
2517
  if (!n) throw Error("No details found in toggleListItem parseContent");
2428
- return Pn(n, t, "toggleListItem");
2518
+ return zn(n, t, "toggleListItem");
2429
2519
  },
2430
2520
  runsBefore: ["bulletListItem"],
2431
2521
  render(e, t) {
2432
2522
  let n = document.createElement("p");
2433
2523
  return {
2434
- ...In(e, t, n),
2524
+ ...Vn(e, t, n),
2435
2525
  contentDOM: n
2436
2526
  };
2437
2527
  },
@@ -2439,16 +2529,16 @@ var ar = () => new ve({
2439
2529
  let t = document.createElement("li"), n = document.createElement("details");
2440
2530
  n.setAttribute("open", "");
2441
2531
  let r = document.createElement("summary"), i = document.createElement("p");
2442
- return r.appendChild(i), n.appendChild(r), J(e.props, t), t.appendChild(n), {
2532
+ return r.appendChild(i), n.appendChild(r), q(e.props, t), t.appendChild(n), {
2443
2533
  dom: t,
2444
2534
  contentDOM: i,
2445
2535
  childrenDOM: n
2446
2536
  };
2447
2537
  }
2448
- }, [t({
2538
+ }, [n({
2449
2539
  key: "toggle-list-item-shortcuts",
2450
2540
  keyboardShortcuts: {
2451
- Enter: ({ editor: e }) => Zn(e, "toggleListItem"),
2541
+ Enter: ({ editor: e }) => nr(e, "toggleListItem"),
2452
2542
  "Mod-Shift-6": ({ editor: e }) => {
2453
2543
  let t = e.getTextCursorPosition();
2454
2544
  return e.schema.blockSchema[t.block.type].content === "inline" ? (e.updateBlock(t.block, {
@@ -2457,11 +2547,11 @@ var ar = () => new ve({
2457
2547
  }), !0) : !1;
2458
2548
  }
2459
2549
  }
2460
- })]), ur = A(() => ({
2550
+ })]), hr = F(() => ({
2461
2551
  type: "pageBreak",
2462
2552
  propSchema: {},
2463
2553
  content: "none"
2464
- })), dr = j(ur, {
2554
+ })), gr = I(hr, {
2465
2555
  parse(e) {
2466
2556
  if (e.tagName === "DIV" && e.hasAttribute("data-page-break")) return {};
2467
2557
  },
@@ -2473,14 +2563,14 @@ var ar = () => new ve({
2473
2563
  let e = document.createElement("div");
2474
2564
  return e.setAttribute("data-page-break", ""), { dom: e };
2475
2565
  }
2476
- }), fr = (e) => e.extend({ blockSpecs: { pageBreak: dr() } }), pr = A(() => ({
2566
+ }), _r = (e) => e.extend({ blockSpecs: { pageBreak: gr() } }), vr = F(() => ({
2477
2567
  type: "paragraph",
2478
- propSchema: K,
2568
+ propSchema: G,
2479
2569
  content: "inline"
2480
- })), mr = j(pr, {
2570
+ })), yr = I(vr, {
2481
2571
  meta: { isolating: !1 },
2482
2572
  parse: (e) => {
2483
- if (e.tagName === "P" && e.textContent?.trim()) return q(e);
2573
+ if (e.tagName === "P" && e.textContent?.trim()) return K(e);
2484
2574
  },
2485
2575
  render: () => {
2486
2576
  let e = document.createElement("p");
@@ -2491,13 +2581,13 @@ var ar = () => new ve({
2491
2581
  },
2492
2582
  toExternalHTML: (e) => {
2493
2583
  let t = document.createElement("p");
2494
- return J(e.props, t), {
2584
+ return q(e.props, t), {
2495
2585
  dom: t,
2496
2586
  contentDOM: t
2497
2587
  };
2498
2588
  },
2499
2589
  runsBefore: ["default", "heading"]
2500
- }, [t({
2590
+ }, [n({
2501
2591
  key: "paragraph-shortcuts",
2502
2592
  keyboardShortcuts: { "Mod-Alt-0": ({ editor: e }) => {
2503
2593
  let t = e.getTextCursorPosition();
@@ -2506,18 +2596,18 @@ var ar = () => new ve({
2506
2596
  props: {}
2507
2597
  }), !0) : !1;
2508
2598
  } }
2509
- })]), hr = A(() => ({
2599
+ })]), br = F(() => ({
2510
2600
  type: "quote",
2511
2601
  propSchema: {
2512
- backgroundColor: K.backgroundColor,
2513
- textColor: K.textColor
2602
+ backgroundColor: G.backgroundColor,
2603
+ textColor: G.textColor
2514
2604
  },
2515
2605
  content: "inline"
2516
- })), gr = j(hr, {
2606
+ })), xr = I(br, {
2517
2607
  meta: { isolating: !1 },
2518
2608
  parse(e) {
2519
2609
  if (e.tagName === "BLOCKQUOTE") {
2520
- let { backgroundColor: t, textColor: n } = q(e);
2610
+ let { backgroundColor: t, textColor: n } = K(e);
2521
2611
  return {
2522
2612
  backgroundColor: t,
2523
2613
  textColor: n
@@ -2533,12 +2623,12 @@ var ar = () => new ve({
2533
2623
  },
2534
2624
  toExternalHTML(e) {
2535
2625
  let t = document.createElement("blockquote");
2536
- return J(e.props, t), {
2626
+ return q(e.props, t), {
2537
2627
  dom: t,
2538
2628
  contentDOM: t
2539
2629
  };
2540
2630
  }
2541
- }, [t({
2631
+ }, [n({
2542
2632
  key: "quote-block-shortcuts",
2543
2633
  keyboardShortcuts: { "Mod-Alt-q": ({ editor: e }) => {
2544
2634
  let t = e.getTextCursorPosition();
@@ -2548,7 +2638,7 @@ var ar = () => new ve({
2548
2638
  }), !0) : !1;
2549
2639
  } },
2550
2640
  inputRules: [{
2551
- find: RegExp("^>\\s$"),
2641
+ find: /* @__PURE__ */ RegExp("^>\\s$"),
2552
2642
  replace() {
2553
2643
  return {
2554
2644
  type: "quote",
@@ -2556,7 +2646,7 @@ var ar = () => new ve({
2556
2646
  };
2557
2647
  }
2558
2648
  }, {
2559
- find: RegExp("^\\p{Quotation_Mark}\\s$", "u"),
2649
+ find: /* @__PURE__ */ RegExp("^\\p{Quotation_Mark}\\s$", "u"),
2560
2650
  replace() {
2561
2651
  return {
2562
2652
  type: "quote",
@@ -2564,7 +2654,15 @@ var ar = () => new ve({
2564
2654
  };
2565
2655
  }
2566
2656
  }]
2567
- })]), _r = 120, vr = 31, yr = s.create({
2657
+ })]), Sr = "blockLevelSuggestion";
2658
+ function Y(e) {
2659
+ return e && e.options.extensions.some((e) => {
2660
+ if (e.type !== "mark") return !1;
2661
+ let t = g(e, "group");
2662
+ return typeof t == "string" && t.split(" ").includes("blockLevelSuggestion");
2663
+ }) ? Sr : "";
2664
+ }
2665
+ var Cr = 120, wr = 31, Tr = s.create({
2568
2666
  name: "BlockNoteTableExtension",
2569
2667
  addProseMirrorPlugins: () => [le({
2570
2668
  cellMinWidth: 35,
@@ -2581,8 +2679,8 @@ var ar = () => new ve({
2581
2679
  let e = this.editor.state.selection, t = e.empty, n = e.$head.parentOffset === 0, r = e.$head.node().type.name === "tableParagraph";
2582
2680
  return t && n && r;
2583
2681
  },
2584
- Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(1)(e, t, n)),
2585
- "Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => ue(-1)(e, t, n))
2682
+ Tab: () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => de(e) ? (ue(1)(e, t, n), !0) : !1),
2683
+ "Shift-Tab": () => this.editor.commands.command(({ state: e, dispatch: t, view: n }) => de(e) ? (ue(-1)(e, t, n), !0) : !1)
2586
2684
  };
2587
2685
  },
2588
2686
  extendNodeSchema(e) {
@@ -2592,12 +2690,15 @@ var ar = () => new ve({
2592
2690
  storage: e.storage
2593
2691
  })) };
2594
2692
  }
2595
- }), br = { textColor: K.textColor }, xr = u.create({
2693
+ }), Er = { textColor: G.textColor }, Dr = u.create({
2596
2694
  name: "tableHeader",
2597
2695
  addOptions() {
2598
2696
  return { HTMLAttributes: {} };
2599
2697
  },
2600
2698
  content: "tableContent+",
2699
+ marks() {
2700
+ return Y(this.editor);
2701
+ },
2601
2702
  addAttributes() {
2602
2703
  return {
2603
2704
  colspan: { default: 1 },
@@ -2616,7 +2717,7 @@ var ar = () => new ve({
2616
2717
  parseHTML() {
2617
2718
  return [{
2618
2719
  tag: "th",
2619
- getContent: (e, t) => Er(e, t)
2720
+ getContent: (e, t) => Mr(e, t)
2620
2721
  }];
2621
2722
  },
2622
2723
  renderHTML({ HTMLAttributes: e }) {
@@ -2626,12 +2727,15 @@ var ar = () => new ve({
2626
2727
  0
2627
2728
  ];
2628
2729
  }
2629
- }), Sr = u.create({
2730
+ }), Or = u.create({
2630
2731
  name: "tableCell",
2631
2732
  addOptions() {
2632
2733
  return { HTMLAttributes: {} };
2633
2734
  },
2634
2735
  content: "tableContent+",
2736
+ marks() {
2737
+ return Y(this.editor);
2738
+ },
2635
2739
  addAttributes() {
2636
2740
  return {
2637
2741
  colspan: { default: 1 },
@@ -2650,7 +2754,7 @@ var ar = () => new ve({
2650
2754
  parseHTML() {
2651
2755
  return [{
2652
2756
  tag: "td",
2653
- getContent: (e, t) => Er(e, t)
2757
+ getContent: (e, t) => Mr(e, t)
2654
2758
  }];
2655
2759
  },
2656
2760
  renderHTML({ HTMLAttributes: e }) {
@@ -2660,18 +2764,20 @@ var ar = () => new ve({
2660
2764
  0
2661
2765
  ];
2662
2766
  }
2663
- }), Cr = u.create({
2767
+ }), kr = u.create({
2664
2768
  name: "table",
2665
2769
  content: "tableRow+",
2666
2770
  group: "blockContent",
2667
2771
  tableRole: "table",
2668
- marks: "deletion insertion modification",
2772
+ marks() {
2773
+ return Y(this.editor);
2774
+ },
2669
2775
  isolating: !0,
2670
2776
  parseHTML() {
2671
2777
  return [{ tag: "table" }];
2672
2778
  },
2673
2779
  renderHTML({ node: e, HTMLAttributes: t }) {
2674
- let n = Ve(this.name, "table", {
2780
+ let n = Ke(this.name, "table", {
2675
2781
  ...this.options.domAttributes?.blockContent || {},
2676
2782
  ...t
2677
2783
  }, this.options.domAttributes?.inlineContent || {}), r = document.createElement("colgroup");
@@ -2685,10 +2791,13 @@ var ar = () => new ve({
2685
2791
  addNodeView() {
2686
2792
  return ({ node: e, HTMLAttributes: t }) => {
2687
2793
  class n extends ce {
2794
+ node;
2795
+ cellMinWidth;
2796
+ blockContentHTMLAttributes;
2688
2797
  constructor(e, t, n) {
2689
2798
  super(e, t), this.node = e, this.cellMinWidth = t, this.blockContentHTMLAttributes = n;
2690
2799
  let r = document.createElement("div");
2691
- r.className = D("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
2800
+ r.className = O("bn-block-content", n.class), r.setAttribute("data-content-type", "table");
2692
2801
  for (let [e, t] of Object.entries(n)) e !== "class" && r.setAttribute(e, t);
2693
2802
  let i = this.dom, a = document.createElement("div");
2694
2803
  a.className = "tableWrapper-inner", a.appendChild(i.firstChild), i.appendChild(a), r.appendChild(i);
@@ -2700,8 +2809,8 @@ var ar = () => new ve({
2700
2809
  }
2701
2810
  update(e) {
2702
2811
  if (!super.update(e)) return !1;
2703
- for (let [t, n] of Object.entries(br)) {
2704
- let r = O(t), i = e.attrs[t];
2812
+ for (let [t, n] of Object.entries(Er)) {
2813
+ let r = N(t), i = e.attrs[t];
2705
2814
  i === n.default ? this.dom.removeAttribute(r) : this.dom.setAttribute(r, String(i));
2706
2815
  }
2707
2816
  return !0;
@@ -2713,7 +2822,7 @@ var ar = () => new ve({
2713
2822
  });
2714
2823
  };
2715
2824
  }
2716
- }), wr = u.create({
2825
+ }), Ar = u.create({
2717
2826
  name: "tableParagraph",
2718
2827
  group: "tableContent",
2719
2828
  content: "inline*",
@@ -2735,14 +2844,16 @@ var ar = () => new ve({
2735
2844
  0
2736
2845
  ];
2737
2846
  }
2738
- }), Tr = u.create({
2847
+ }), jr = u.create({
2739
2848
  name: "tableRow",
2740
2849
  addOptions() {
2741
2850
  return { HTMLAttributes: {} };
2742
2851
  },
2743
2852
  content: "(tableCell | tableHeader)+",
2744
2853
  tableRole: "row",
2745
- marks: "deletion insertion modification",
2854
+ marks() {
2855
+ return Y(this.editor);
2856
+ },
2746
2857
  parseHTML() {
2747
2858
  return [{ tag: "tr" }];
2748
2859
  },
@@ -2754,26 +2865,26 @@ var ar = () => new ve({
2754
2865
  ];
2755
2866
  }
2756
2867
  });
2757
- function Er(e, t) {
2758
- let i = n.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
2759
- return i.content.descendants((e) => {
2868
+ function Mr(e, t) {
2869
+ let n = r.fromSchema(t).parse(e, { topNode: t.nodes.blockGroup.create() }), a = [];
2870
+ return n.content.descendants((e) => {
2760
2871
  if (e.isInline) return a.push(e), !1;
2761
- }), r.fromArray(a);
2872
+ }), i.fromArray(a);
2762
2873
  }
2763
- var Dr = () => Je({
2764
- node: Cr,
2874
+ var Nr = () => lt({
2875
+ node: kr,
2765
2876
  type: "table",
2766
2877
  content: "table"
2767
- }, br, [t({
2878
+ }, Er, [n({
2768
2879
  key: "table-extensions",
2769
2880
  tiptapExtensions: [
2770
- yr,
2771
- wr,
2772
- xr,
2773
- Sr,
2774
- Tr
2881
+ Tr,
2882
+ Ar,
2883
+ Dr,
2884
+ Or,
2885
+ jr
2775
2886
  ]
2776
- }), t({
2887
+ }), n({
2777
2888
  key: "table-keyboard-delete",
2778
2889
  keyboardShortcuts: { Backspace: ({ editor: e }) => {
2779
2890
  if (!(e.prosemirrorState.selection instanceof oe)) return !1;
@@ -2789,15 +2900,15 @@ var Dr = () => Je({
2789
2900
  (e.getPrevBlock(t) || e.getNextBlock(t)) && e.setTextCursorPosition(t), e.removeBlocks([t]);
2790
2901
  }), !0);
2791
2902
  } }
2792
- })]), Or = (e) => ({
2903
+ })]), Pr = (e) => ({
2793
2904
  url: e.src || void 0,
2794
2905
  previewWidth: e.width || void 0,
2795
2906
  name: e.getAttribute("data-name") || void 0
2796
- }), kr = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>", Ar = A((e) => ({
2907
+ }), Fr = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>", Ir = F((e) => ({
2797
2908
  type: "video",
2798
2909
  propSchema: {
2799
- textAlignment: K.textAlignment,
2800
- backgroundColor: K.backgroundColor,
2910
+ textAlignment: G.textAlignment,
2911
+ backgroundColor: G.backgroundColor,
2801
2912
  name: { default: "" },
2802
2913
  url: { default: "" },
2803
2914
  caption: { default: "" },
@@ -2808,28 +2919,28 @@ var Dr = () => Je({
2808
2919
  }
2809
2920
  },
2810
2921
  content: "none"
2811
- })), jr = (e) => (e) => {
2922
+ })), Lr = (e) => (e) => {
2812
2923
  if (e.tagName === "VIDEO") {
2813
2924
  if (e.closest("figure")) return;
2814
- let { backgroundColor: t } = q(e);
2925
+ let { backgroundColor: t } = K(e);
2815
2926
  return {
2816
- ...Or(e),
2927
+ ...Pr(e),
2817
2928
  backgroundColor: t
2818
2929
  };
2819
2930
  }
2820
2931
  if (e.tagName === "FIGURE") {
2821
- let t = cn(e, "video");
2932
+ let t = pn(e, "video");
2822
2933
  if (!t) return;
2823
- let { targetElement: n, caption: r } = t, { backgroundColor: i } = q(e);
2934
+ let { targetElement: n, caption: r } = t, { backgroundColor: i } = K(e);
2824
2935
  return {
2825
- ...Or(n),
2936
+ ...Pr(n),
2826
2937
  backgroundColor: i,
2827
2938
  caption: r
2828
2939
  };
2829
2940
  }
2830
- }, Mr = j(Ar, (e) => ({
2941
+ }, Rr = I(Ir, (e) => ({
2831
2942
  meta: { fileBlockAccept: ["video/*"] },
2832
- parse: jr(e),
2943
+ parse: Lr(e),
2833
2944
  render(t, n) {
2834
2945
  let r = document.createElement("div");
2835
2946
  r.innerHTML = e.icon ?? "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>";
@@ -2838,15 +2949,15 @@ var Dr = () => Je({
2838
2949
  let a = document.createElement("video");
2839
2950
  return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((e) => {
2840
2951
  a.src = e;
2841
- }) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Vn(t, n, { dom: i }, i, r.firstElementChild);
2952
+ }) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, t.props.previewWidth && (a.width = t.props.previewWidth), i.appendChild(a), Kn(t, n, { dom: i }, i, r.firstElementChild);
2842
2953
  },
2843
2954
  toExternalHTML(e) {
2844
2955
  if (!e.props.url) return { dom: document.createElement("video") };
2845
2956
  let t;
2846
- return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? pn(t, e.props.caption) : mn(t, e.props.caption) : { dom: t };
2957
+ return e.props.showPreview ? (t = document.createElement("video"), t.src = e.props.url, e.props.previewWidth && (t.width = e.props.previewWidth)) : (t = document.createElement("a"), t.href = e.props.url, t.textContent = e.props.name || e.props.url), e.props.caption ? e.props.showPreview ? vn(t, e.props.caption) : yn(t, e.props.caption) : { dom: t };
2847
2958
  },
2848
2959
  runsBefore: ["file"]
2849
- })), Nr = async (e) => {
2960
+ })), zr = async (e) => {
2850
2961
  let t = new FormData();
2851
2962
  return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
2852
2963
  method: "POST",
@@ -2871,16 +2982,16 @@ function X(e, t, n) {
2871
2982
  }
2872
2983
  return !0;
2873
2984
  }
2874
- function Pr(e, t, n, r) {
2985
+ function Br(e, t, n, r) {
2875
2986
  return X(t, n, r) && e.type === n;
2876
2987
  }
2877
- function Fr(e) {
2988
+ function Vr(e) {
2878
2989
  return e instanceof oe;
2879
2990
  }
2880
2991
  //#endregion
2881
2992
  //#region src/extensions/FormattingToolbar/FormattingToolbar.ts
2882
- var Z = t(({ editor: t }) => {
2883
- let n = e(!1), r = () => t.transact((e) => {
2993
+ var Z = n(({ editor: e }) => {
2994
+ let n = t(!1), r = () => e.transact((e) => {
2884
2995
  if (e.selection.empty || e.selection instanceof y && e.doc.textBetween(e.selection.from, e.selection.to).length === 0) return !1;
2885
2996
  let t = !1;
2886
2997
  return e.selection.content().content.descendants((e) => (e.type.spec.code && (t = !0), !t)), !t;
@@ -2888,59 +2999,47 @@ var Z = t(({ editor: t }) => {
2888
2999
  return {
2889
3000
  key: "formattingToolbar",
2890
3001
  store: n,
2891
- mount({ dom: e, signal: i }) {
2892
- let a = !1, o = !1, s = t.onChange(() => {
3002
+ mount({ dom: t, signal: i }) {
3003
+ let a = !1, o = !1, s = e.onChange(() => {
2893
3004
  a || o || n.setState(r());
2894
- }), c = t.onSelectionChange(() => {
3005
+ }), c = e.onSelectionChange(() => {
2895
3006
  a || o || n.setState(r());
2896
3007
  });
2897
- e.addEventListener("pointerdown", () => {
3008
+ t.addEventListener("pointerdown", () => {
2898
3009
  a = !0, n.setState(!1);
2899
- }, { signal: i }), t.prosemirrorView.root.addEventListener("pointerup", () => {
2900
- a = !1, t.isFocused() && n.setState(r());
3010
+ }, { signal: i }), e.prosemirrorView.root.addEventListener("pointerup", () => {
3011
+ a = !1, e.isFocused() && n.setState(r());
2901
3012
  }, {
2902
3013
  signal: i,
2903
3014
  capture: !0
2904
- }), e.addEventListener("pointercancel", () => {
3015
+ }), t.addEventListener("pointercancel", () => {
2905
3016
  a = !0;
2906
3017
  }, {
2907
3018
  signal: i,
2908
3019
  capture: !0
2909
- }), t.prosemirrorView.root.addEventListener("dragstart", () => {
3020
+ }), e.prosemirrorView.root.addEventListener("dragstart", () => {
2910
3021
  o = !0, n.setState(!1);
2911
- }, { signal: i }), t.prosemirrorView.root.addEventListener("dragend", () => {
3022
+ }, { signal: i }), e.prosemirrorView.root.addEventListener("dragend", () => {
2912
3023
  o = !1;
2913
3024
  }, { signal: i }), i.addEventListener("abort", () => {
2914
3025
  s(), c();
2915
3026
  });
2916
3027
  }
2917
3028
  };
2918
- }), Ir = /* @__PURE__ */ new Map();
2919
- function Lr(e) {
2920
- if (Ir.has(e)) return Ir.get(e);
2921
- let t = new a();
2922
- return e._tiptapEditor.on("transaction", ({ transaction: e }) => {
2923
- t.appendMapping(e.mapping);
2924
- }), e._tiptapEditor.on("destroy", () => {
2925
- Ir.delete(e);
2926
- }), Ir.set(e, t), t;
2927
- }
2928
- function Rr(e, t, n = "left") {
2929
- let r = Ee.getState(e.prosemirrorState);
2930
- if (!r) {
2931
- let r = Lr(e), i = r.maps.length;
2932
- return () => r.slice(i).map(t, n === "left" ? -1 : 1);
2933
- }
2934
- let i = we(t + (n === "right" ? 1 : -1), r.binding.type, r.binding.mapping);
2935
- return () => {
2936
- let t = Ee.getState(e.prosemirrorState), r = Te(t.doc, t.binding.type, i, t.binding.mapping);
2937
- if (r === null) throw Error("Position not found, cannot track positions");
2938
- return r + (n === "right" ? -1 : 1);
2939
- };
3029
+ });
3030
+ //#endregion
3031
+ //#region src/api/positionMapping.ts
3032
+ function Hr(e, t, n = "left") {
3033
+ let r = e.getExtension("yPositionMapping");
3034
+ if (r) return r.mapPosition(t, n);
3035
+ let i = e.getExtension("positionMapping");
3036
+ if (i) return i.mapPosition(t, n);
3037
+ throw Error("No position mapping extension found");
2940
3038
  }
2941
3039
  //#endregion
2942
3040
  //#region src/extensions/SuggestionMenu/SuggestionMenu.ts
2943
- var zr = m((e) => e.type.name === "blockContainer"), Br = class {
3041
+ var Ur = m((e) => e.type.name === "blockContainer"), Wr = class {
3042
+ editor;
2944
3043
  state;
2945
3044
  emitUpdate;
2946
3045
  rootEl;
@@ -2987,8 +3086,8 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
2987
3086
  to: this.editor.transact((e) => e.selection.from)
2988
3087
  }).run();
2989
3088
  };
2990
- }, Q = new te("SuggestionMenuPlugin"), Vr = t(({ editor: t }) => {
2991
- let n = /* @__PURE__ */ new Map(), r, i = e(void 0);
3089
+ }, Q = new ne("SuggestionMenuPlugin"), Gr = n(({ editor: e }) => {
3090
+ let n = /* @__PURE__ */ new Map(), r, i = t(void 0);
2992
3091
  return {
2993
3092
  key: "suggestionMenu",
2994
3093
  store: i,
@@ -3005,42 +3104,42 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
3005
3104
  r?.clearQuery();
3006
3105
  },
3007
3106
  shown: () => r?.state?.show || !1,
3008
- openSuggestionMenu: (e, n) => {
3009
- t.headless || (t.focus(), t.transact((t) => {
3010
- n?.deleteTriggerCharacter && t.insertText(e), t.scrollIntoView().setMeta(Q, {
3011
- triggerCharacter: e,
3107
+ openSuggestionMenu: (t, n) => {
3108
+ e.headless || (e.focus(), e.transact((e) => {
3109
+ n?.deleteTriggerCharacter && e.insertText(t), e.scrollIntoView().setMeta(Q, {
3110
+ triggerCharacter: t,
3012
3111
  deleteTriggerCharacter: n?.deleteTriggerCharacter || !1,
3013
3112
  ignoreQueryLength: n?.ignoreQueryLength || !1
3014
3113
  });
3015
3114
  }));
3016
3115
  },
3017
- prosemirrorPlugins: [new ee({
3116
+ prosemirrorPlugins: [new te({
3018
3117
  key: Q,
3019
- view: (e) => (r = new Br(t, (e, t) => {
3118
+ view: (t) => (r = new Wr(e, (e, t) => {
3020
3119
  i.setState({
3021
3120
  ...t,
3022
3121
  triggerCharacter: e
3023
3122
  });
3024
- }, e), r),
3123
+ }, t), r),
3025
3124
  state: {
3026
3125
  init() {},
3027
- apply: (e, n, i, a) => {
3028
- if (e.selection.$from.parent.type.spec.code) return n;
3029
- let o = e.getMeta(Q);
3126
+ apply: (t, n, i, a) => {
3127
+ if (t.selection.$from.parent.type.spec.code) return n;
3128
+ let o = t.getMeta(Q);
3030
3129
  if (typeof o == "object" && o) {
3031
3130
  n && r?.closeMenu();
3032
- let e = Rr(t, a.selection.from - o.triggerCharacter.length);
3131
+ let t = Hr(e, a.selection.from - o.triggerCharacter.length);
3033
3132
  return {
3034
3133
  triggerCharacter: o.triggerCharacter,
3035
3134
  deleteTriggerCharacter: o.deleteTriggerCharacter !== !1,
3036
- queryStartPos: () => e() + o.triggerCharacter.length,
3135
+ queryStartPos: () => t() + o.triggerCharacter.length,
3037
3136
  query: "",
3038
3137
  decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
3039
3138
  ignoreQueryLength: o?.ignoreQueryLength
3040
3139
  };
3041
3140
  }
3042
3141
  if (n === void 0) return n;
3043
- if (a.selection.from !== a.selection.to || o === null || e.getMeta("focus") || e.getMeta("blur") || e.getMeta("pointer") || n.triggerCharacter !== void 0 && a.selection.from < n.queryStartPos() || !a.selection.$from.sameParent(a.doc.resolve(n.queryStartPos()))) return;
3142
+ if (a.selection.from !== a.selection.to || o === null || t.getMeta("focus") || t.getMeta("blur") || t.getMeta("pointer") || n.triggerCharacter !== void 0 && a.selection.from < n.queryStartPos() || !a.selection.$from.sameParent(a.doc.resolve(n.queryStartPos()))) return;
3044
3143
  let s = { ...n };
3045
3144
  return s.query = a.doc.textBetween(n.queryStartPos(), a.selection.from), s;
3046
3145
  }
@@ -3063,7 +3162,7 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
3063
3162
  let t = this.getState(e);
3064
3163
  if (t === void 0) return null;
3065
3164
  if (!t.deleteTriggerCharacter) {
3066
- let n = zr(e.selection);
3165
+ let n = Ur(e.selection);
3067
3166
  if (n) return Ce.create(e.doc, [Se.node(n.pos, n.pos + n.node.nodeSize, {
3068
3167
  nodeName: "span",
3069
3168
  class: "bn-suggestion-decorator",
@@ -3082,7 +3181,7 @@ var zr = m((e) => e.type.name === "blockContainer"), Br = class {
3082
3181
  });
3083
3182
  //#endregion
3084
3183
  //#region src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts
3085
- function Hr(e) {
3184
+ function Kr(e) {
3086
3185
  let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
3087
3186
  for (; n === "none";) {
3088
3187
  if (t = e.getTextCursorPosition().nextBlock, t === void 0) return;
@@ -3093,9 +3192,9 @@ function $(e, t) {
3093
3192
  let n = e.getTextCursorPosition().block;
3094
3193
  if (n.content === void 0) throw Error("Slash Menu open in a block that doesn't contain content.");
3095
3194
  let r;
3096
- return Array.isArray(n.content) && (n.content.length === 1 && b(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Hr(e), r;
3195
+ return Array.isArray(n.content) && (n.content.length === 1 && S(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (r = e.updateBlock(n, t), e.setTextCursorPosition(r)) : (r = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Kr(e), r;
3097
3196
  }
3098
- function Ur(e) {
3197
+ function qr(e) {
3099
3198
  let t = [];
3100
3199
  return X(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((e) => e <= 3).forEach((n) => {
3101
3200
  t.push({
@@ -3105,7 +3204,7 @@ function Ur(e) {
3105
3204
  props: { level: n }
3106
3205
  });
3107
3206
  },
3108
- badge: E(`Mod-Alt-${n}`),
3207
+ badge: D(`Mod-Alt-${n}`),
3109
3208
  key: n === 1 ? "heading" : `heading_${n}`,
3110
3209
  ...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
3111
3210
  });
@@ -3119,42 +3218,42 @@ function Ur(e) {
3119
3218
  onItemClick: () => {
3120
3219
  $(e, { type: "toggleListItem" });
3121
3220
  },
3122
- badge: E("Mod-Shift-6"),
3221
+ badge: D("Mod-Shift-6"),
3123
3222
  key: "toggle_list",
3124
3223
  ...e.dictionary.slash_menu.toggle_list
3125
3224
  }), X(e, "numberedListItem") && t.push({
3126
3225
  onItemClick: () => {
3127
3226
  $(e, { type: "numberedListItem" });
3128
3227
  },
3129
- badge: E("Mod-Shift-7"),
3228
+ badge: D("Mod-Shift-7"),
3130
3229
  key: "numbered_list",
3131
3230
  ...e.dictionary.slash_menu.numbered_list
3132
3231
  }), X(e, "bulletListItem") && t.push({
3133
3232
  onItemClick: () => {
3134
3233
  $(e, { type: "bulletListItem" });
3135
3234
  },
3136
- badge: E("Mod-Shift-8"),
3235
+ badge: D("Mod-Shift-8"),
3137
3236
  key: "bullet_list",
3138
3237
  ...e.dictionary.slash_menu.bullet_list
3139
3238
  }), X(e, "checkListItem") && t.push({
3140
3239
  onItemClick: () => {
3141
3240
  $(e, { type: "checkListItem" });
3142
3241
  },
3143
- badge: E("Mod-Shift-9"),
3242
+ badge: D("Mod-Shift-9"),
3144
3243
  key: "check_list",
3145
3244
  ...e.dictionary.slash_menu.check_list
3146
3245
  }), X(e, "paragraph") && t.push({
3147
3246
  onItemClick: () => {
3148
3247
  $(e, { type: "paragraph" });
3149
3248
  },
3150
- badge: E("Mod-Alt-0"),
3249
+ badge: D("Mod-Alt-0"),
3151
3250
  key: "paragraph",
3152
3251
  ...e.dictionary.slash_menu.paragraph
3153
3252
  }), X(e, "codeBlock") && t.push({
3154
3253
  onItemClick: () => {
3155
3254
  $(e, { type: "codeBlock" });
3156
3255
  },
3157
- badge: E("Mod-Alt-c"),
3256
+ badge: D("Mod-Alt-c"),
3158
3257
  key: "code_block",
3159
3258
  ...e.dictionary.slash_menu.code_block
3160
3259
  }), X(e, "divider") && t.push({
@@ -3187,28 +3286,28 @@ function Ur(e) {
3187
3286
  }), X(e, "image", { url: "string" }) && t.push({
3188
3287
  onItemClick: () => {
3189
3288
  let t = $(e, { type: "image" });
3190
- e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3289
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3191
3290
  },
3192
3291
  key: "image",
3193
3292
  ...e.dictionary.slash_menu.image
3194
3293
  }), X(e, "video", { url: "string" }) && t.push({
3195
3294
  onItemClick: () => {
3196
3295
  let t = $(e, { type: "video" });
3197
- e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3296
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3198
3297
  },
3199
3298
  key: "video",
3200
3299
  ...e.dictionary.slash_menu.video
3201
3300
  }), X(e, "audio", { url: "string" }) && t.push({
3202
3301
  onItemClick: () => {
3203
3302
  let t = $(e, { type: "audio" });
3204
- e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3303
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3205
3304
  },
3206
3305
  key: "audio",
3207
3306
  ...e.dictionary.slash_menu.audio
3208
3307
  }), X(e, "file", { url: "string" }) && t.push({
3209
3308
  onItemClick: () => {
3210
3309
  let t = $(e, { type: "file" });
3211
- e.getExtension(Y)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3310
+ e.getExtension(J)?.showMenu(t.id), e.getExtension(Z)?.store.setState(!1);
3212
3311
  },
3213
3312
  key: "file",
3214
3313
  ...e.dictionary.slash_menu.file
@@ -3237,13 +3336,13 @@ function Ur(e) {
3237
3336
  props: { level: n }
3238
3337
  });
3239
3338
  },
3240
- badge: E(`Mod-Alt-${n}`),
3339
+ badge: D(`Mod-Alt-${n}`),
3241
3340
  key: `heading_${n}`,
3242
3341
  ...e.dictionary.slash_menu[`heading_${n}`]
3243
3342
  });
3244
3343
  }), t.push({
3245
3344
  onItemClick: () => {
3246
- e.getExtension(Vr)?.openSuggestionMenu(":", {
3345
+ e.getExtension(Gr)?.openSuggestionMenu(":", {
3247
3346
  deleteTriggerCharacter: !0,
3248
3347
  ignoreQueryLength: !0
3249
3348
  });
@@ -3252,17 +3351,17 @@ function Ur(e) {
3252
3351
  ...e.dictionary.slash_menu.emoji
3253
3352
  }), t;
3254
3353
  }
3255
- function Wr(e, t) {
3354
+ function Jr(e, t) {
3256
3355
  return e.filter(({ title: e, aliases: n }) => e.toLowerCase().includes(t.toLowerCase()) || n && n.filter((e) => e.toLowerCase().includes(t.toLowerCase())).length !== 0);
3257
3356
  }
3258
3357
  //#endregion
3259
3358
  //#region src/blocks/PageBreak/getPageBreakSlashMenuItems.ts
3260
- function Gr(e) {
3359
+ function Yr(e) {
3261
3360
  return "pageBreak" in e.schema.blockSchema;
3262
3361
  }
3263
- function Kr(e) {
3362
+ function Xr(e) {
3264
3363
  let t = [];
3265
- return Gr(e) && t.push({
3364
+ return Yr(e) && t.push({
3266
3365
  ...e.dictionary.slash_menu.page_break,
3267
3366
  onItemClick: () => {
3268
3367
  $(e, { type: "pageBreak" });
@@ -3272,22 +3371,22 @@ function Kr(e) {
3272
3371
  }
3273
3372
  //#endregion
3274
3373
  //#region src/blocks/defaultBlocks.ts
3275
- var qr = {
3276
- audio: xn(),
3277
- bulletListItem: er(),
3278
- checkListItem: nr(),
3279
- codeBlock: En(),
3280
- divider: kn(),
3281
- file: Nn(),
3282
- heading: Bn(),
3283
- image: Jn(),
3284
- numberedListItem: sr(),
3285
- paragraph: mr(),
3286
- quote: gr(),
3287
- table: Dr(),
3288
- toggleListItem: lr(),
3289
- video: Mr()
3290
- }, Jr = bt({
3374
+ var Zr = {
3375
+ audio: En(),
3376
+ bulletListItem: ar(),
3377
+ checkListItem: sr(),
3378
+ codeBlock: jn(),
3379
+ divider: Pn(),
3380
+ file: Rn(),
3381
+ heading: Gn(),
3382
+ image: $n(),
3383
+ numberedListItem: fr(),
3384
+ paragraph: yr(),
3385
+ quote: xr(),
3386
+ table: Nr(),
3387
+ toggleListItem: mr(),
3388
+ video: Rr()
3389
+ }, Qr = St({
3291
3390
  type: "textColor",
3292
3391
  propSchema: "string"
3293
3392
  }, {
@@ -3300,7 +3399,7 @@ var qr = {
3300
3399
  },
3301
3400
  toExternalHTML: (e) => {
3302
3401
  let t = document.createElement("span");
3303
- return e !== K.textColor.default && (t.style.color = e in G ? G[e].text : e), {
3402
+ return e !== G.textColor.default && (t.style.color = e in W ? W[e].text : e), {
3304
3403
  dom: t,
3305
3404
  contentDOM: t
3306
3405
  };
@@ -3308,7 +3407,7 @@ var qr = {
3308
3407
  parse: (e) => {
3309
3408
  if (e.tagName === "SPAN" && e.style.color) return e.style.color;
3310
3409
  }
3311
- }), Yr = bt({
3410
+ }), $r = St({
3312
3411
  type: "backgroundColor",
3313
3412
  propSchema: "string"
3314
3413
  }, {
@@ -3321,7 +3420,7 @@ var qr = {
3321
3420
  },
3322
3421
  toExternalHTML: (e) => {
3323
3422
  let t = document.createElement("span");
3324
- return e !== K.backgroundColor.default && (t.style.backgroundColor = e in G ? G[e].background : e), {
3423
+ return e !== G.backgroundColor.default && (t.style.backgroundColor = e in W ? W[e].background : e), {
3325
3424
  dom: t,
3326
3425
  contentDOM: t
3327
3426
  };
@@ -3329,12 +3428,12 @@ var qr = {
3329
3428
  parse: (e) => {
3330
3429
  if (e.tagName === "SPAN" && e.style.backgroundColor) return e.style.backgroundColor;
3331
3430
  }
3332
- }), Xr = {
3333
- bold: z(De, "boolean"),
3334
- italic: z(ke, "boolean"),
3335
- underline: z(je, "boolean"),
3336
- strike: z(Ae, "boolean"),
3337
- code: z(Oe.extend({ addInputRules() {
3431
+ }), ei = {
3432
+ bold: R(we, "boolean"),
3433
+ italic: R(Ee, "boolean"),
3434
+ underline: R(Oe, "boolean"),
3435
+ strike: R(De, "boolean"),
3436
+ code: R(Te.extend({ addInputRules() {
3338
3437
  return [_({
3339
3438
  find: /(^|[^`])`([^`]+)`(?!`)$/,
3340
3439
  type: this.type
@@ -3346,9 +3445,9 @@ var qr = {
3346
3445
  }
3347
3446
  })];
3348
3447
  } }), "boolean"),
3349
- textColor: Jr,
3350
- backgroundColor: Yr
3351
- }, Zr = vt(Xr), Qr = {
3448
+ textColor: Qr,
3449
+ backgroundColor: $r
3450
+ }, ti = bt(ei), ni = {
3352
3451
  text: {
3353
3452
  config: "text",
3354
3453
  implementation: {}
@@ -3357,16 +3456,16 @@ var qr = {
3357
3456
  config: "link",
3358
3457
  implementation: {}
3359
3458
  }
3360
- }, $r = ht(Qr), ei = class e extends At {
3459
+ }, ri = _t(ni), ii = class e extends Mt {
3361
3460
  static create(t) {
3362
3461
  return new e({
3363
- blockSpecs: t?.blockSpecs ?? qr,
3364
- inlineContentSpecs: t?.inlineContentSpecs ?? Qr,
3365
- styleSpecs: t?.styleSpecs ?? Xr
3462
+ blockSpecs: t?.blockSpecs ?? Zr,
3463
+ inlineContentSpecs: t?.inlineContentSpecs ?? ni,
3464
+ styleSpecs: t?.styleSpecs ?? ei
3366
3465
  });
3367
3466
  }
3368
3467
  };
3369
3468
  //#endregion
3370
- export { jn as $, mt as $t, mr as A, We as An, U as At, $n as B, Re as Bn, Ft as Bt, Dr as C, j as Cn, tn as Ct, hr as D, Ke as Dn, Jt as Dt, _r as E, qe as En, Zt as Et, lr as F, E as Fn, Bt as Ft, Jn as G, x as Gn, yt as Gt, Yn as H, Le as Hn, At as Ht, or as I, ze as In, Rt as It, qn as J, b as Jn, z as Jt, Gn as K, Fe as Kn, R as Kt, sr as L, Be as Ln, Pt as Lt, dr as M, Ve as Mn, zt as Mt, fr as N, He as Nn, Ht as Nt, gr as O, k as On, Yt as Ot, cr as P, Ue as Pn, Vt as Pt, Fn as Q, ft as Qt, nr as R, D as Rn, Nt as Rt, jr as S, A as Sn, G as St, vr as T, Je as Tn, Xt as Tt, Un as U, S as Un, Ot as Ut, er as V, w as Vn, It as Vt, Wn as W, C as Wn, bt as Wt, Bn as X, gt as Xt, zn as Y, Pe as Yn, vt as Yt, In as Z, dt as Zt, Fr as _, nt as _n, an as _t, Zr as a, L as an, En as at, Ar as b, Ze as bn, q as bt, Kr as c, F as cn, vn as ct, $ as d, ot as dn, _n as dt, pt as en, Nn as et, Vr as f, N as fn, xn as ft, X as g, tt as gn, K as gt, Pr as h, et as hn, J as ht, Qr as i, lt as in, Tn as it, ur as j, Ge as jn, Kt as jt, pr as k, O as kn, W as kt, Wr as l, it as ln, yn as lt, Z as m, M as mn, Y as mt, qr as n, I as nn, On as nt, Xr as o, ct as on, Dn as ot, Rr as p, P as pn, hn as pt, Kn as q, Ie as qn, _t as qt, $r as r, st as rn, kn as rt, Gr as s, ut as sn, gn as st, ei as t, ht as tn, Mn as tt, Ur as u, at as un, bn as ut, Nr as v, $e as vn, sn as vt, br as w, Xe as wn, en as wt, Mr as x, Ye as xn, rn as xt, kr as y, Qe as yn, on as yt, tr as z, T as zn, jt as zt };
3469
+ export { Vn as $, Ae as $n, pt as $t, xr as A, qe as An, Zt as At, sr as B, w as Bn, Ft as Bt, Nr as C, Xe as Cn, ln as Ct, Sr as D, A as Dn, Qt as Dt, Cr as E, k as En, on as Et, _r as F, O as Fn, Wt as Ft, Jn as G, S as Gn, At as Gt, ir as H, C as Hn, Lt as Ht, pr as I, E as In, Ut as It, Xn as J, Pe as Jn, L as Jt, Yn as K, Re as Kn, St as Kt, mr as L, Ue as Ln, Ht as Lt, yr as M, D as Mn, H as Mt, hr as N, We as Nn, Jt as Nt, Y as O, et as On, $t as Ot, gr as P, Ge as Pn, Vt as Pt, Gn as Q, je as Qn, vt as Qt, dr as R, T as Rn, Bt as Rt, Lr as S, $e as Sn, K as St, wr as T, Qe as Tn, sn as Tt, ar as U, ze as Un, Rt as Ut, or as V, Ve as Vn, Nt as Vt, er as W, Be as Wn, Mt as Wt, Qn as X, x as Xn, R as Xt, Zn as Y, Ne as Yn, yt as Yt, Wn as Z, Me as Zn, bt as Zt, Vr as _, tt as _n, q as _t, ti as a, ut as an, Pn as at, Ir as b, nt as bn, fn as bt, Xr as c, dt as cn, Mn as ct, $ as d, st as dn, wn as dt, mt as en, ke as er, Bn as et, Gr as f, P as fn, Tn as ft, X as g, j as gn, J as gt, Br as h, ot as hn, bn as ht, ni as i, ft as in, Nn as it, vr as j, Je as jn, U as jt, br as k, Ke as kn, Xt as kt, Jr as l, lt as ln, xn as lt, Z as m, at as mn, En as mt, Zr as n, ht as nn, Rn as nt, ei as o, F as on, An as ot, Hr as p, N as pn, Sn as pt, $n as q, b as qn, xt as qt, ri as r, _t as rn, Ln as rt, Yr as s, I as sn, jn as st, ii as t, gt as tn, In as tt, qr as u, ct as un, Cn as ut, zr as v, rt as vn, G as vt, Er as w, Ze as wn, W as wt, Rr as x, it as xn, dn as xt, Fr as y, M as yn, un as yt, fr as z, He as zn, It as zt };
3371
3470
 
3372
- //# sourceMappingURL=blocks-DGsP5WKr.js.map
3471
+ //# sourceMappingURL=blocks-CiuUGa1E.js.map