@blade-hq/agent-react 2612.0.0-beta.5 → 2612.0.0-beta.6

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 (1139) hide show
  1. package/README.md +8 -0
  2. package/dist/chat/ChatPanel.d.ts +1 -3
  3. package/dist/chat/LightComposer.d.ts +1 -1
  4. package/dist/chat/ai-elements/reasoning.d.ts +4 -4
  5. package/dist/chat/customization.d.ts +1 -5
  6. package/dist/chat/lib/citations.d.ts +6 -2
  7. package/dist/chat/runtime/actions.d.ts +1 -0
  8. package/dist/chat/runtime/input-cache-reset.d.ts +1 -1
  9. package/dist/chat/runtime/input-history-storage.d.ts +2 -0
  10. package/dist/{chunk-7IPINZHT.js → chunk-IRBOKMF5.js} +2 -2
  11. package/dist/{chunk-XULCQP3Q.js → chunk-UKQFSXGC.js} +147 -35
  12. package/dist/chunk-UKQFSXGC.js.map +1 -0
  13. package/dist/{chunk-T5WGKZN4.js → chunk-XJLFFRQP.js} +299 -183
  14. package/dist/chunk-XJLFFRQP.js.map +1 -0
  15. package/dist/components/ChatInput.d.ts +3 -1
  16. package/dist/components/plugin-connector.d.ts +1 -0
  17. package/dist/embed/entry.d.ts +1 -0
  18. package/dist/index.js +2 -2
  19. package/dist/internal.js +3 -3
  20. package/dist/internal.js.map +1 -1
  21. package/dist/lib/agent-computer-command.d.ts +1 -3
  22. package/dist/rich-input/ChatInput.d.ts +1 -1
  23. package/dist/rich-input/FileCompletionMenu.d.ts +3 -2
  24. package/dist/rich-input/SkillStatusBar.d.ts +2 -4
  25. package/dist/rich-input/extensions/plugin-mention.d.ts +15 -0
  26. package/dist/rich-input/extensions/skill-mention.d.ts +0 -1
  27. package/dist/rich-input/index.d.ts +4 -0
  28. package/dist/rich-input/lib/composer-content.d.ts +5 -1
  29. package/dist/rich-input/lib/input-history-document.d.ts +3 -0
  30. package/dist/rich-input/lib/plugin-suggestions.d.ts +7 -0
  31. package/dist/rich-input/lib/reference-candidates.d.ts +30 -0
  32. package/dist/rich-input/use-input-history.d.ts +8 -10
  33. package/dist/rich-input/use-reference-candidates.d.ts +8 -0
  34. package/dist/rich-input.js +559 -323
  35. package/dist/rich-input.js.map +1 -1
  36. package/node_modules/@floating-ui/core/LICENSE +20 -0
  37. package/node_modules/@floating-ui/core/README.md +4 -0
  38. package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs +1 -0
  39. package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs +1184 -0
  40. package/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +531 -0
  41. package/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +531 -0
  42. package/node_modules/@floating-ui/core/dist/floating-ui.core.esm.js +1058 -0
  43. package/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1058 -0
  44. package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.js +1203 -0
  45. package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.min.js +1 -0
  46. package/node_modules/@floating-ui/core/package.json +63 -0
  47. package/node_modules/@floating-ui/dom/LICENSE +20 -0
  48. package/node_modules/@floating-ui/dom/README.md +4 -0
  49. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs +1 -0
  50. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs +956 -0
  51. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +358 -0
  52. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts +358 -0
  53. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js +781 -0
  54. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +781 -0
  55. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.js +975 -0
  56. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js +1 -0
  57. package/node_modules/@floating-ui/dom/package.json +71 -0
  58. package/node_modules/@floating-ui/utils/LICENSE +20 -0
  59. package/node_modules/@floating-ui/utils/README.md +4 -0
  60. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +103 -0
  61. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +103 -0
  62. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
  63. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
  64. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js +165 -0
  65. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
  66. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js +192 -0
  67. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js +1 -0
  68. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.esm.js +136 -0
  69. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
  70. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.js +167 -0
  71. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.min.js +1 -0
  72. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
  73. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.esm.js +165 -0
  74. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.umd.js +192 -0
  75. package/node_modules/@floating-ui/utils/dom/package.json +6 -0
  76. package/node_modules/@floating-ui/utils/package.json +70 -0
  77. package/node_modules/@radix-ui/primitive/LICENSE +21 -0
  78. package/node_modules/@radix-ui/primitive/README.md +3 -0
  79. package/node_modules/@radix-ui/primitive/dist/index.d.mts +20 -0
  80. package/node_modules/@radix-ui/primitive/dist/index.d.ts +20 -0
  81. package/node_modules/@radix-ui/primitive/dist/index.js +76 -0
  82. package/node_modules/@radix-ui/primitive/dist/index.js.map +7 -0
  83. package/node_modules/@radix-ui/primitive/dist/index.mjs +53 -0
  84. package/node_modules/@radix-ui/primitive/dist/index.mjs.map +7 -0
  85. package/node_modules/@radix-ui/primitive/package.json +47 -0
  86. package/node_modules/@radix-ui/react-collapsible/LICENSE +21 -0
  87. package/node_modules/@radix-ui/react-collapsible/README.md +3 -0
  88. package/node_modules/@radix-ui/react-collapsible/dist/index.d.mts +33 -0
  89. package/node_modules/@radix-ui/react-collapsible/dist/index.d.ts +33 -0
  90. package/node_modules/@radix-ui/react-collapsible/dist/index.js +187 -0
  91. package/node_modules/@radix-ui/react-collapsible/dist/index.js.map +7 -0
  92. package/node_modules/@radix-ui/react-collapsible/dist/index.mjs +155 -0
  93. package/node_modules/@radix-ui/react-collapsible/dist/index.mjs.map +7 -0
  94. package/node_modules/@radix-ui/react-collapsible/package.json +75 -0
  95. package/node_modules/@radix-ui/react-compose-refs/README.md +13 -0
  96. package/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts +15 -0
  97. package/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts +15 -0
  98. package/node_modules/@radix-ui/react-compose-refs/dist/index.js +74 -0
  99. package/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +7 -0
  100. package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +41 -0
  101. package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map +7 -0
  102. package/node_modules/@radix-ui/react-compose-refs/package.json +75 -0
  103. package/node_modules/@radix-ui/react-context/README.md +13 -0
  104. package/node_modules/@radix-ui/react-context/dist/index.d.mts +21 -0
  105. package/node_modules/@radix-ui/react-context/dist/index.d.ts +21 -0
  106. package/node_modules/@radix-ui/react-context/dist/index.js +114 -0
  107. package/node_modules/@radix-ui/react-context/dist/index.js.map +7 -0
  108. package/node_modules/@radix-ui/react-context/dist/index.mjs +81 -0
  109. package/node_modules/@radix-ui/react-context/dist/index.mjs.map +7 -0
  110. package/node_modules/@radix-ui/react-context/package.json +75 -0
  111. package/node_modules/@radix-ui/react-id/README.md +13 -0
  112. package/node_modules/@radix-ui/react-id/dist/index.d.mts +3 -0
  113. package/node_modules/@radix-ui/react-id/dist/index.d.ts +3 -0
  114. package/node_modules/@radix-ui/react-id/dist/index.js +49 -0
  115. package/node_modules/@radix-ui/react-id/dist/index.js.map +7 -0
  116. package/node_modules/@radix-ui/react-id/dist/index.mjs +16 -0
  117. package/node_modules/@radix-ui/react-id/dist/index.mjs.map +7 -0
  118. package/node_modules/@radix-ui/react-id/package.json +78 -0
  119. package/node_modules/@radix-ui/react-presence/LICENSE +21 -0
  120. package/node_modules/@radix-ui/react-presence/README.md +3 -0
  121. package/node_modules/@radix-ui/react-presence/dist/index.d.mts +12 -0
  122. package/node_modules/@radix-ui/react-presence/dist/index.d.ts +12 -0
  123. package/node_modules/@radix-ui/react-presence/dist/index.js +171 -0
  124. package/node_modules/@radix-ui/react-presence/dist/index.js.map +7 -0
  125. package/node_modules/@radix-ui/react-presence/dist/index.mjs +139 -0
  126. package/node_modules/@radix-ui/react-presence/dist/index.mjs.map +7 -0
  127. package/node_modules/@radix-ui/react-presence/package.json +69 -0
  128. package/node_modules/@radix-ui/react-primitive/LICENSE +21 -0
  129. package/node_modules/@radix-ui/react-primitive/README.md +3 -0
  130. package/node_modules/@radix-ui/react-primitive/dist/index.d.mts +52 -0
  131. package/node_modules/@radix-ui/react-primitive/dist/index.d.ts +52 -0
  132. package/node_modules/@radix-ui/react-primitive/dist/index.js +80 -0
  133. package/node_modules/@radix-ui/react-primitive/dist/index.js.map +7 -0
  134. package/node_modules/@radix-ui/react-primitive/dist/index.mjs +47 -0
  135. package/node_modules/@radix-ui/react-primitive/dist/index.mjs.map +7 -0
  136. package/node_modules/@radix-ui/react-primitive/package.json +68 -0
  137. package/node_modules/@radix-ui/react-slot/LICENSE +21 -0
  138. package/node_modules/@radix-ui/react-slot/README.md +3 -0
  139. package/node_modules/@radix-ui/react-slot/dist/index.d.mts +17 -0
  140. package/node_modules/@radix-ui/react-slot/dist/index.d.ts +17 -0
  141. package/node_modules/@radix-ui/react-slot/dist/index.js +138 -0
  142. package/node_modules/@radix-ui/react-slot/dist/index.js.map +7 -0
  143. package/node_modules/@radix-ui/react-slot/dist/index.mjs +105 -0
  144. package/node_modules/@radix-ui/react-slot/dist/index.mjs.map +7 -0
  145. package/node_modules/@radix-ui/react-slot/package.json +63 -0
  146. package/node_modules/@radix-ui/react-use-controllable-state/LICENSE +21 -0
  147. package/node_modules/@radix-ui/react-use-controllable-state/README.md +3 -0
  148. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.mts +40 -0
  149. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.ts +40 -0
  150. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +169 -0
  151. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +7 -0
  152. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +136 -0
  153. package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs.map +7 -0
  154. package/node_modules/@radix-ui/react-use-controllable-state/package.json +64 -0
  155. package/node_modules/@radix-ui/react-use-effect-event/LICENSE +21 -0
  156. package/node_modules/@radix-ui/react-use-effect-event/README.md +5 -0
  157. package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.mts +8 -0
  158. package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.ts +8 -0
  159. package/node_modules/@radix-ui/react-use-effect-event/dist/index.js +60 -0
  160. package/node_modules/@radix-ui/react-use-effect-event/dist/index.js.map +7 -0
  161. package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs +27 -0
  162. package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs.map +7 -0
  163. package/node_modules/@radix-ui/react-use-effect-event/package.json +65 -0
  164. package/node_modules/@radix-ui/react-use-effect-event/src/index.ts +1 -0
  165. package/node_modules/@radix-ui/react-use-effect-event/src/use-effect-event.tsx +36 -0
  166. package/node_modules/@radix-ui/react-use-layout-effect/README.md +13 -0
  167. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.mts +12 -0
  168. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.ts +12 -0
  169. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +41 -0
  170. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +7 -0
  171. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +8 -0
  172. package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.map +7 -0
  173. package/node_modules/@radix-ui/react-use-layout-effect/package.json +75 -0
  174. package/node_modules/@remirror/core-constants/LICENSE +21 -0
  175. package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.cts +612 -0
  176. package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.ts +612 -0
  177. package/node_modules/@remirror/core-constants/dist/remirror-core-constants.cjs +314 -0
  178. package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.cts +20 -0
  179. package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.ts +20 -0
  180. package/node_modules/@remirror/core-constants/dist/remirror-core-constants.js +269 -0
  181. package/node_modules/@remirror/core-constants/dist-types/core-constants.d.ts +431 -0
  182. package/node_modules/@remirror/core-constants/dist-types/error-constants.d.ts +119 -0
  183. package/node_modules/@remirror/core-constants/dist-types/index.d.ts +2 -0
  184. package/node_modules/@remirror/core-constants/dist-types/tsconfig.tsbuildinfo +1 -0
  185. package/node_modules/@remirror/core-constants/package.json +45 -0
  186. package/node_modules/@remirror/core-constants/readme.md +17 -0
  187. package/node_modules/@tiptap/core/LICENSE.md +21 -0
  188. package/node_modules/@tiptap/core/README.md +18 -0
  189. package/node_modules/@tiptap/core/dist/index.cjs +7126 -0
  190. package/node_modules/@tiptap/core/dist/index.cjs.map +1 -0
  191. package/node_modules/@tiptap/core/dist/index.d.cts +4954 -0
  192. package/node_modules/@tiptap/core/dist/index.d.ts +4954 -0
  193. package/node_modules/@tiptap/core/dist/index.js +6992 -0
  194. package/node_modules/@tiptap/core/dist/index.js.map +1 -0
  195. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +56 -0
  196. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs.map +1 -0
  197. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +23 -0
  198. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +23 -0
  199. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +26 -0
  200. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  201. package/node_modules/@tiptap/core/jsx-dev-runtime/index.cjs +1 -0
  202. package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.cts +1 -0
  203. package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.ts +1 -0
  204. package/node_modules/@tiptap/core/jsx-dev-runtime/index.js +1 -0
  205. package/node_modules/@tiptap/core/jsx-runtime/index.cjs +1 -0
  206. package/node_modules/@tiptap/core/jsx-runtime/index.d.cts +1 -0
  207. package/node_modules/@tiptap/core/jsx-runtime/index.d.ts +1 -0
  208. package/node_modules/@tiptap/core/jsx-runtime/index.js +1 -0
  209. package/node_modules/@tiptap/core/package.json +70 -0
  210. package/node_modules/@tiptap/core/src/CommandManager.ts +138 -0
  211. package/node_modules/@tiptap/core/src/Editor.ts +806 -0
  212. package/node_modules/@tiptap/core/src/EventEmitter.ts +58 -0
  213. package/node_modules/@tiptap/core/src/Extendable.ts +602 -0
  214. package/node_modules/@tiptap/core/src/Extension.ts +55 -0
  215. package/node_modules/@tiptap/core/src/ExtensionManager.ts +440 -0
  216. package/node_modules/@tiptap/core/src/InputRule.ts +290 -0
  217. package/node_modules/@tiptap/core/src/Mark.ts +211 -0
  218. package/node_modules/@tiptap/core/src/MarkView.ts +122 -0
  219. package/node_modules/@tiptap/core/src/Node.ts +377 -0
  220. package/node_modules/@tiptap/core/src/NodePos.ts +257 -0
  221. package/node_modules/@tiptap/core/src/NodeView.ts +339 -0
  222. package/node_modules/@tiptap/core/src/PasteRule.ts +373 -0
  223. package/node_modules/@tiptap/core/src/Tracker.ts +36 -0
  224. package/node_modules/@tiptap/core/src/__tests__/transformPastedHTML.test.ts +575 -0
  225. package/node_modules/@tiptap/core/src/commands/blur.ts +29 -0
  226. package/node_modules/@tiptap/core/src/commands/clearContent.ts +25 -0
  227. package/node_modules/@tiptap/core/src/commands/clearNodes.ts +57 -0
  228. package/node_modules/@tiptap/core/src/commands/command.ts +22 -0
  229. package/node_modules/@tiptap/core/src/commands/createParagraphNear.ts +21 -0
  230. package/node_modules/@tiptap/core/src/commands/cut.ts +36 -0
  231. package/node_modules/@tiptap/core/src/commands/deleteCurrentNode.ts +44 -0
  232. package/node_modules/@tiptap/core/src/commands/deleteNode.ts +41 -0
  233. package/node_modules/@tiptap/core/src/commands/deleteRange.ts +26 -0
  234. package/node_modules/@tiptap/core/src/commands/deleteSelection.ts +21 -0
  235. package/node_modules/@tiptap/core/src/commands/enter.ts +19 -0
  236. package/node_modules/@tiptap/core/src/commands/exitCode.ts +21 -0
  237. package/node_modules/@tiptap/core/src/commands/extendMarkRange.ts +51 -0
  238. package/node_modules/@tiptap/core/src/commands/first.ts +26 -0
  239. package/node_modules/@tiptap/core/src/commands/focus.ts +108 -0
  240. package/node_modules/@tiptap/core/src/commands/forEach.ts +24 -0
  241. package/node_modules/@tiptap/core/src/commands/index.ts +57 -0
  242. package/node_modules/@tiptap/core/src/commands/insertContent.ts +46 -0
  243. package/node_modules/@tiptap/core/src/commands/insertContentAt.ts +212 -0
  244. package/node_modules/@tiptap/core/src/commands/join.ts +69 -0
  245. package/node_modules/@tiptap/core/src/commands/joinItemBackward.ts +37 -0
  246. package/node_modules/@tiptap/core/src/commands/joinItemForward.ts +37 -0
  247. package/node_modules/@tiptap/core/src/commands/joinTextblockBackward.ts +20 -0
  248. package/node_modules/@tiptap/core/src/commands/joinTextblockForward.ts +20 -0
  249. package/node_modules/@tiptap/core/src/commands/keyboardShortcut.ts +100 -0
  250. package/node_modules/@tiptap/core/src/commands/lift.ts +34 -0
  251. package/node_modules/@tiptap/core/src/commands/liftEmptyBlock.ts +21 -0
  252. package/node_modules/@tiptap/core/src/commands/liftListItem.ts +26 -0
  253. package/node_modules/@tiptap/core/src/commands/newlineInCode.ts +21 -0
  254. package/node_modules/@tiptap/core/src/commands/resetAttributes.ts +73 -0
  255. package/node_modules/@tiptap/core/src/commands/scrollIntoView.ts +23 -0
  256. package/node_modules/@tiptap/core/src/commands/selectAll.ts +27 -0
  257. package/node_modules/@tiptap/core/src/commands/selectNodeBackward.ts +21 -0
  258. package/node_modules/@tiptap/core/src/commands/selectNodeForward.ts +21 -0
  259. package/node_modules/@tiptap/core/src/commands/selectParentNode.ts +21 -0
  260. package/node_modules/@tiptap/core/src/commands/selectTextblockEnd.ts +23 -0
  261. package/node_modules/@tiptap/core/src/commands/selectTextblockStart.ts +23 -0
  262. package/node_modules/@tiptap/core/src/commands/setContent.ts +76 -0
  263. package/node_modules/@tiptap/core/src/commands/setMark.ts +118 -0
  264. package/node_modules/@tiptap/core/src/commands/setMeta.ts +25 -0
  265. package/node_modules/@tiptap/core/src/commands/setNode.ts +57 -0
  266. package/node_modules/@tiptap/core/src/commands/setNodeSelection.ts +31 -0
  267. package/node_modules/@tiptap/core/src/commands/setTextDirection.ts +51 -0
  268. package/node_modules/@tiptap/core/src/commands/setTextSelection.ts +35 -0
  269. package/node_modules/@tiptap/core/src/commands/sinkListItem.ts +26 -0
  270. package/node_modules/@tiptap/core/src/commands/splitBlock.ts +115 -0
  271. package/node_modules/@tiptap/core/src/commands/splitListItem.ts +149 -0
  272. package/node_modules/@tiptap/core/src/commands/toggleList.ts +159 -0
  273. package/node_modules/@tiptap/core/src/commands/toggleMark.ts +51 -0
  274. package/node_modules/@tiptap/core/src/commands/toggleNode.ts +47 -0
  275. package/node_modules/@tiptap/core/src/commands/toggleWrap.ts +32 -0
  276. package/node_modules/@tiptap/core/src/commands/undoInputRule.ts +49 -0
  277. package/node_modules/@tiptap/core/src/commands/unsetAllMarks.ts +32 -0
  278. package/node_modules/@tiptap/core/src/commands/unsetMark.ts +65 -0
  279. package/node_modules/@tiptap/core/src/commands/unsetTextDirection.ts +51 -0
  280. package/node_modules/@tiptap/core/src/commands/updateAttributes.ts +150 -0
  281. package/node_modules/@tiptap/core/src/commands/wrapIn.ts +27 -0
  282. package/node_modules/@tiptap/core/src/commands/wrapInList.ts +27 -0
  283. package/node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.ts +44 -0
  284. package/node_modules/@tiptap/core/src/extensions/commands.ts +14 -0
  285. package/node_modules/@tiptap/core/src/extensions/delete.ts +89 -0
  286. package/node_modules/@tiptap/core/src/extensions/drop.ts +26 -0
  287. package/node_modules/@tiptap/core/src/extensions/editable.ts +18 -0
  288. package/node_modules/@tiptap/core/src/extensions/focusEvents.ts +41 -0
  289. package/node_modules/@tiptap/core/src/extensions/index.ts +10 -0
  290. package/node_modules/@tiptap/core/src/extensions/keymap.ts +160 -0
  291. package/node_modules/@tiptap/core/src/extensions/paste.ts +25 -0
  292. package/node_modules/@tiptap/core/src/extensions/tabindex.ts +18 -0
  293. package/node_modules/@tiptap/core/src/extensions/textDirection.ts +86 -0
  294. package/node_modules/@tiptap/core/src/helpers/MappablePosition.ts +66 -0
  295. package/node_modules/@tiptap/core/src/helpers/combineTransactionSteps.ts +21 -0
  296. package/node_modules/@tiptap/core/src/helpers/createChainableState.ts +39 -0
  297. package/node_modules/@tiptap/core/src/helpers/createDocument.ts +24 -0
  298. package/node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts +119 -0
  299. package/node_modules/@tiptap/core/src/helpers/defaultBlockAt.ts +18 -0
  300. package/node_modules/@tiptap/core/src/helpers/findChildren.ts +24 -0
  301. package/node_modules/@tiptap/core/src/helpers/findChildrenInRange.ts +36 -0
  302. package/node_modules/@tiptap/core/src/helpers/findParentNode.ts +18 -0
  303. package/node_modules/@tiptap/core/src/helpers/findParentNodeClosestToPos.ts +37 -0
  304. package/node_modules/@tiptap/core/src/helpers/flattenExtensions.ts +30 -0
  305. package/node_modules/@tiptap/core/src/helpers/generateHTML.ts +18 -0
  306. package/node_modules/@tiptap/core/src/helpers/generateJSON.ts +18 -0
  307. package/node_modules/@tiptap/core/src/helpers/generateText.ts +34 -0
  308. package/node_modules/@tiptap/core/src/helpers/getAttributes.ts +29 -0
  309. package/node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts +122 -0
  310. package/node_modules/@tiptap/core/src/helpers/getChangedRanges.ts +85 -0
  311. package/node_modules/@tiptap/core/src/helpers/getDebugJSON.ts +54 -0
  312. package/node_modules/@tiptap/core/src/helpers/getExtensionField.ts +32 -0
  313. package/node_modules/@tiptap/core/src/helpers/getHTMLFromFragment.ts +13 -0
  314. package/node_modules/@tiptap/core/src/helpers/getMarkAttributes.ts +30 -0
  315. package/node_modules/@tiptap/core/src/helpers/getMarkRange.ts +90 -0
  316. package/node_modules/@tiptap/core/src/helpers/getMarkType.ts +13 -0
  317. package/node_modules/@tiptap/core/src/helpers/getMarksBetween.ts +44 -0
  318. package/node_modules/@tiptap/core/src/helpers/getNodeAtPosition.ts +29 -0
  319. package/node_modules/@tiptap/core/src/helpers/getNodeAttributes.ts +22 -0
  320. package/node_modules/@tiptap/core/src/helpers/getNodeType.ts +13 -0
  321. package/node_modules/@tiptap/core/src/helpers/getRenderedAttributes.ts +23 -0
  322. package/node_modules/@tiptap/core/src/helpers/getSchema.ts +12 -0
  323. package/node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts +183 -0
  324. package/node_modules/@tiptap/core/src/helpers/getSchemaTypeByName.ts +11 -0
  325. package/node_modules/@tiptap/core/src/helpers/getSchemaTypeNameByName.ts +19 -0
  326. package/node_modules/@tiptap/core/src/helpers/getSplittedAttributes.ts +28 -0
  327. package/node_modules/@tiptap/core/src/helpers/getText.ts +28 -0
  328. package/node_modules/@tiptap/core/src/helpers/getTextBetween.ts +52 -0
  329. package/node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts +29 -0
  330. package/node_modules/@tiptap/core/src/helpers/getTextSerializersFromSchema.ts +16 -0
  331. package/node_modules/@tiptap/core/src/helpers/index.ts +55 -0
  332. package/node_modules/@tiptap/core/src/helpers/injectExtensionAttributesToParseRule.ts +47 -0
  333. package/node_modules/@tiptap/core/src/helpers/isActive.ts +23 -0
  334. package/node_modules/@tiptap/core/src/helpers/isAtEndOfNode.ts +29 -0
  335. package/node_modules/@tiptap/core/src/helpers/isAtStartOfNode.ts +11 -0
  336. package/node_modules/@tiptap/core/src/helpers/isExtensionRulesEnabled.ts +13 -0
  337. package/node_modules/@tiptap/core/src/helpers/isList.ts +27 -0
  338. package/node_modules/@tiptap/core/src/helpers/isMarkActive.ts +94 -0
  339. package/node_modules/@tiptap/core/src/helpers/isNodeActive.ts +51 -0
  340. package/node_modules/@tiptap/core/src/helpers/isNodeEmpty.ts +62 -0
  341. package/node_modules/@tiptap/core/src/helpers/isNodeSelection.ts +5 -0
  342. package/node_modules/@tiptap/core/src/helpers/isTextSelection.ts +5 -0
  343. package/node_modules/@tiptap/core/src/helpers/posToDOMRect.ts +35 -0
  344. package/node_modules/@tiptap/core/src/helpers/resolveExtensions.ts +25 -0
  345. package/node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts +31 -0
  346. package/node_modules/@tiptap/core/src/helpers/rewriteUnknownContent.ts +149 -0
  347. package/node_modules/@tiptap/core/src/helpers/selectionToInsertionEnd.ts +29 -0
  348. package/node_modules/@tiptap/core/src/helpers/sortExtensions.ts +26 -0
  349. package/node_modules/@tiptap/core/src/helpers/splitExtensions.ts +16 -0
  350. package/node_modules/@tiptap/core/src/index.ts +28 -0
  351. package/node_modules/@tiptap/core/src/inputRules/index.ts +5 -0
  352. package/node_modules/@tiptap/core/src/inputRules/markInputRule.ts +68 -0
  353. package/node_modules/@tiptap/core/src/inputRules/nodeInputRule.ts +73 -0
  354. package/node_modules/@tiptap/core/src/inputRules/textInputRule.ts +35 -0
  355. package/node_modules/@tiptap/core/src/inputRules/textblockTypeInputRule.ts +35 -0
  356. package/node_modules/@tiptap/core/src/inputRules/wrappingInputRule.ts +82 -0
  357. package/node_modules/@tiptap/core/src/jsx-runtime.ts +65 -0
  358. package/node_modules/@tiptap/core/src/lib/ResizableNodeView.ts +1060 -0
  359. package/node_modules/@tiptap/core/src/lib/index.ts +1 -0
  360. package/node_modules/@tiptap/core/src/pasteRules/index.ts +3 -0
  361. package/node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts +71 -0
  362. package/node_modules/@tiptap/core/src/pasteRules/nodePasteRule.ts +44 -0
  363. package/node_modules/@tiptap/core/src/pasteRules/textPasteRule.ts +34 -0
  364. package/node_modules/@tiptap/core/src/style.ts +71 -0
  365. package/node_modules/@tiptap/core/src/types.ts +1058 -0
  366. package/node_modules/@tiptap/core/src/utilities/callOrReturn.ts +21 -0
  367. package/node_modules/@tiptap/core/src/utilities/canInsertNode.ts +30 -0
  368. package/node_modules/@tiptap/core/src/utilities/createStyleTag.ts +21 -0
  369. package/node_modules/@tiptap/core/src/utilities/deleteProps.ts +16 -0
  370. package/node_modules/@tiptap/core/src/utilities/elementFromString.ts +27 -0
  371. package/node_modules/@tiptap/core/src/utilities/escapeForRegEx.ts +4 -0
  372. package/node_modules/@tiptap/core/src/utilities/findDuplicates.ts +8 -0
  373. package/node_modules/@tiptap/core/src/utilities/fromString.ts +19 -0
  374. package/node_modules/@tiptap/core/src/utilities/index.ts +26 -0
  375. package/node_modules/@tiptap/core/src/utilities/isAndroid.ts +3 -0
  376. package/node_modules/@tiptap/core/src/utilities/isEmptyObject.ts +3 -0
  377. package/node_modules/@tiptap/core/src/utilities/isFirefox.ts +11 -0
  378. package/node_modules/@tiptap/core/src/utilities/isFunction.ts +4 -0
  379. package/node_modules/@tiptap/core/src/utilities/isMacOS.ts +3 -0
  380. package/node_modules/@tiptap/core/src/utilities/isNumber.ts +3 -0
  381. package/node_modules/@tiptap/core/src/utilities/isPlainObject.ts +13 -0
  382. package/node_modules/@tiptap/core/src/utilities/isRegExp.ts +3 -0
  383. package/node_modules/@tiptap/core/src/utilities/isSafari.ts +11 -0
  384. package/node_modules/@tiptap/core/src/utilities/isString.ts +3 -0
  385. package/node_modules/@tiptap/core/src/utilities/isiOS.ts +7 -0
  386. package/node_modules/@tiptap/core/src/utilities/markdown/attributeUtils.ts +130 -0
  387. package/node_modules/@tiptap/core/src/utilities/markdown/createAtomBlockMarkdownSpec.ts +141 -0
  388. package/node_modules/@tiptap/core/src/utilities/markdown/createBlockMarkdownSpec.ts +225 -0
  389. package/node_modules/@tiptap/core/src/utilities/markdown/createInlineMarkdownSpec.ts +282 -0
  390. package/node_modules/@tiptap/core/src/utilities/markdown/index.ts +13 -0
  391. package/node_modules/@tiptap/core/src/utilities/markdown/parseIndentedBlocks.ts +194 -0
  392. package/node_modules/@tiptap/core/src/utilities/markdown/renderNestedMarkdownContent.ts +96 -0
  393. package/node_modules/@tiptap/core/src/utilities/mergeAttributes.ts +109 -0
  394. package/node_modules/@tiptap/core/src/utilities/mergeDeep.ts +17 -0
  395. package/node_modules/@tiptap/core/src/utilities/minMax.ts +3 -0
  396. package/node_modules/@tiptap/core/src/utilities/objectIncludes.ts +30 -0
  397. package/node_modules/@tiptap/core/src/utilities/removeDuplicates.ts +13 -0
  398. package/node_modules/@tiptap/extension-bubble-menu/LICENSE.md +21 -0
  399. package/node_modules/@tiptap/extension-bubble-menu/README.md +18 -0
  400. package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +462 -0
  401. package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs.map +1 -0
  402. package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +169 -0
  403. package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +169 -0
  404. package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +443 -0
  405. package/node_modules/@tiptap/extension-bubble-menu/dist/index.js.map +1 -0
  406. package/node_modules/@tiptap/extension-bubble-menu/package.json +54 -0
  407. package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu-plugin.ts +650 -0
  408. package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu.ts +50 -0
  409. package/node_modules/@tiptap/extension-bubble-menu/src/index.ts +6 -0
  410. package/node_modules/@tiptap/extension-floating-menu/LICENSE.md +21 -0
  411. package/node_modules/@tiptap/extension-floating-menu/README.md +18 -0
  412. package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +380 -0
  413. package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs.map +1 -0
  414. package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +179 -0
  415. package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +179 -0
  416. package/node_modules/@tiptap/extension-floating-menu/dist/index.js +361 -0
  417. package/node_modules/@tiptap/extension-floating-menu/dist/index.js.map +1 -0
  418. package/node_modules/@tiptap/extension-floating-menu/package.json +53 -0
  419. package/node_modules/@tiptap/extension-floating-menu/src/floating-menu-plugin.ts +525 -0
  420. package/node_modules/@tiptap/extension-floating-menu/src/floating-menu.ts +77 -0
  421. package/node_modules/@tiptap/extension-floating-menu/src/index.ts +6 -0
  422. package/node_modules/@tiptap/extension-mention/LICENSE.md +21 -0
  423. package/node_modules/@tiptap/extension-mention/README.md +18 -0
  424. package/node_modules/@tiptap/extension-mention/dist/index.cjs +277 -0
  425. package/node_modules/@tiptap/extension-mention/dist/index.cjs.map +1 -0
  426. package/node_modules/@tiptap/extension-mention/dist/index.d.cts +93 -0
  427. package/node_modules/@tiptap/extension-mention/dist/index.d.ts +93 -0
  428. package/node_modules/@tiptap/extension-mention/dist/index.js +250 -0
  429. package/node_modules/@tiptap/extension-mention/dist/index.js.map +1 -0
  430. package/node_modules/@tiptap/extension-mention/package.json +52 -0
  431. package/node_modules/@tiptap/extension-mention/src/index.ts +5 -0
  432. package/node_modules/@tiptap/extension-mention/src/mention.ts +357 -0
  433. package/node_modules/@tiptap/extension-mention/src/utils/get-default-suggestion-attributes.ts +89 -0
  434. package/node_modules/@tiptap/pm/LICENSE.md +21 -0
  435. package/node_modules/@tiptap/pm/README.md +22 -0
  436. package/node_modules/@tiptap/pm/changeset/index.ts +1 -0
  437. package/node_modules/@tiptap/pm/collab/index.ts +1 -0
  438. package/node_modules/@tiptap/pm/commands/index.ts +1 -0
  439. package/node_modules/@tiptap/pm/dist/changeset/index.cjs +2 -0
  440. package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +18 -0
  441. package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +18 -0
  442. package/node_modules/@tiptap/pm/dist/changeset/index.js +2 -0
  443. package/node_modules/@tiptap/pm/dist/collab/index.cjs +2 -0
  444. package/node_modules/@tiptap/pm/dist/collab/index.d.cts +1 -0
  445. package/node_modules/@tiptap/pm/dist/collab/index.d.ts +1 -0
  446. package/node_modules/@tiptap/pm/dist/collab/index.js +2 -0
  447. package/node_modules/@tiptap/pm/dist/commands/index.cjs +2 -0
  448. package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -0
  449. package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -0
  450. package/node_modules/@tiptap/pm/dist/commands/index.js +2 -0
  451. package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +2 -0
  452. package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -0
  453. package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -0
  454. package/node_modules/@tiptap/pm/dist/dropcursor/index.js +2 -0
  455. package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +2 -0
  456. package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -0
  457. package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -0
  458. package/node_modules/@tiptap/pm/dist/gapcursor/index.js +2 -0
  459. package/node_modules/@tiptap/pm/dist/history/index.cjs +2 -0
  460. package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -0
  461. package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -0
  462. package/node_modules/@tiptap/pm/dist/history/index.js +2 -0
  463. package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +2 -0
  464. package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -0
  465. package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -0
  466. package/node_modules/@tiptap/pm/dist/inputrules/index.js +2 -0
  467. package/node_modules/@tiptap/pm/dist/keymap/index.cjs +2 -0
  468. package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -0
  469. package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -0
  470. package/node_modules/@tiptap/pm/dist/keymap/index.js +2 -0
  471. package/node_modules/@tiptap/pm/dist/markdown/index.cjs +2 -0
  472. package/node_modules/@tiptap/pm/dist/markdown/index.d.cts +1 -0
  473. package/node_modules/@tiptap/pm/dist/markdown/index.d.ts +1 -0
  474. package/node_modules/@tiptap/pm/dist/markdown/index.js +2 -0
  475. package/node_modules/@tiptap/pm/dist/menu/index.cjs +2 -0
  476. package/node_modules/@tiptap/pm/dist/menu/index.d.cts +1 -0
  477. package/node_modules/@tiptap/pm/dist/menu/index.d.ts +1 -0
  478. package/node_modules/@tiptap/pm/dist/menu/index.js +2 -0
  479. package/node_modules/@tiptap/pm/dist/model/index.cjs +2 -0
  480. package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -0
  481. package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -0
  482. package/node_modules/@tiptap/pm/dist/model/index.js +2 -0
  483. package/node_modules/@tiptap/pm/dist/schema-basic/index.cjs +2 -0
  484. package/node_modules/@tiptap/pm/dist/schema-basic/index.d.cts +1 -0
  485. package/node_modules/@tiptap/pm/dist/schema-basic/index.d.ts +1 -0
  486. package/node_modules/@tiptap/pm/dist/schema-basic/index.js +2 -0
  487. package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +2 -0
  488. package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -0
  489. package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -0
  490. package/node_modules/@tiptap/pm/dist/schema-list/index.js +2 -0
  491. package/node_modules/@tiptap/pm/dist/state/index.cjs +2 -0
  492. package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -0
  493. package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -0
  494. package/node_modules/@tiptap/pm/dist/state/index.js +2 -0
  495. package/node_modules/@tiptap/pm/dist/tables/index.cjs +2 -0
  496. package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -0
  497. package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -0
  498. package/node_modules/@tiptap/pm/dist/tables/index.js +2 -0
  499. package/node_modules/@tiptap/pm/dist/trailing-node/index.cjs +2 -0
  500. package/node_modules/@tiptap/pm/dist/trailing-node/index.d.cts +1 -0
  501. package/node_modules/@tiptap/pm/dist/trailing-node/index.d.ts +1 -0
  502. package/node_modules/@tiptap/pm/dist/trailing-node/index.js +2 -0
  503. package/node_modules/@tiptap/pm/dist/transform/index.cjs +2 -0
  504. package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -0
  505. package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -0
  506. package/node_modules/@tiptap/pm/dist/transform/index.js +2 -0
  507. package/node_modules/@tiptap/pm/dist/view/index.cjs +2 -0
  508. package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -0
  509. package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -0
  510. package/node_modules/@tiptap/pm/dist/view/index.js +2 -0
  511. package/node_modules/@tiptap/pm/dropcursor/index.ts +1 -0
  512. package/node_modules/@tiptap/pm/gapcursor/index.ts +1 -0
  513. package/node_modules/@tiptap/pm/history/index.ts +1 -0
  514. package/node_modules/@tiptap/pm/inputrules/index.ts +1 -0
  515. package/node_modules/@tiptap/pm/keymap/index.ts +1 -0
  516. package/node_modules/@tiptap/pm/markdown/index.ts +1 -0
  517. package/node_modules/@tiptap/pm/menu/index.ts +1 -0
  518. package/node_modules/@tiptap/pm/model/index.ts +1 -0
  519. package/node_modules/@tiptap/pm/package.json +211 -0
  520. package/node_modules/@tiptap/pm/schema-basic/index.ts +1 -0
  521. package/node_modules/@tiptap/pm/schema-list/index.ts +1 -0
  522. package/node_modules/@tiptap/pm/state/index.ts +1 -0
  523. package/node_modules/@tiptap/pm/tables/index.ts +1 -0
  524. package/node_modules/@tiptap/pm/trailing-node/index.ts +1 -0
  525. package/node_modules/@tiptap/pm/transform/index.ts +1 -0
  526. package/node_modules/@tiptap/pm/view/index.ts +1 -0
  527. package/node_modules/@tiptap/react/LICENSE.md +21 -0
  528. package/node_modules/@tiptap/react/README.md +18 -0
  529. package/node_modules/@tiptap/react/dist/index.cjs +1195 -0
  530. package/node_modules/@tiptap/react/dist/index.cjs.map +1 -0
  531. package/node_modules/@tiptap/react/dist/index.d.cts +534 -0
  532. package/node_modules/@tiptap/react/dist/index.d.ts +534 -0
  533. package/node_modules/@tiptap/react/dist/index.js +1131 -0
  534. package/node_modules/@tiptap/react/dist/index.js.map +1 -0
  535. package/node_modules/@tiptap/react/dist/menus/index.cjs +499 -0
  536. package/node_modules/@tiptap/react/dist/menus/index.cjs.map +1 -0
  537. package/node_modules/@tiptap/react/dist/menus/index.d.cts +19 -0
  538. package/node_modules/@tiptap/react/dist/menus/index.d.ts +19 -0
  539. package/node_modules/@tiptap/react/dist/menus/index.js +461 -0
  540. package/node_modules/@tiptap/react/dist/menus/index.js.map +1 -0
  541. package/node_modules/@tiptap/react/package.json +76 -0
  542. package/node_modules/@tiptap/react/src/Context.tsx +60 -0
  543. package/node_modules/@tiptap/react/src/Editor.ts +13 -0
  544. package/node_modules/@tiptap/react/src/EditorContent.tsx +229 -0
  545. package/node_modules/@tiptap/react/src/NodeViewContent.tsx +30 -0
  546. package/node_modules/@tiptap/react/src/NodeViewWrapper.tsx +27 -0
  547. package/node_modules/@tiptap/react/src/ReactMarkViewRenderer.tsx +106 -0
  548. package/node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx +387 -0
  549. package/node_modules/@tiptap/react/src/ReactRenderer.tsx +282 -0
  550. package/node_modules/@tiptap/react/src/Tiptap.tsx +224 -0
  551. package/node_modules/@tiptap/react/src/index.ts +13 -0
  552. package/node_modules/@tiptap/react/src/menus/BubbleMenu.spec.ts +174 -0
  553. package/node_modules/@tiptap/react/src/menus/BubbleMenu.tsx +153 -0
  554. package/node_modules/@tiptap/react/src/menus/FloatingMenu.spec.ts +164 -0
  555. package/node_modules/@tiptap/react/src/menus/FloatingMenu.tsx +137 -0
  556. package/node_modules/@tiptap/react/src/menus/getAutoPluginKey.ts +5 -0
  557. package/node_modules/@tiptap/react/src/menus/index.ts +2 -0
  558. package/node_modules/@tiptap/react/src/menus/useMenuElementProps.ts +354 -0
  559. package/node_modules/@tiptap/react/src/types.ts +6 -0
  560. package/node_modules/@tiptap/react/src/useEditor.ts +382 -0
  561. package/node_modules/@tiptap/react/src/useEditorState.ts +173 -0
  562. package/node_modules/@tiptap/react/src/useReactNodeView.ts +28 -0
  563. package/node_modules/@tiptap/suggestion/LICENSE.md +21 -0
  564. package/node_modules/@tiptap/suggestion/README.md +18 -0
  565. package/node_modules/@tiptap/suggestion/dist/index.cjs +369 -0
  566. package/node_modules/@tiptap/suggestion/dist/index.cjs.map +1 -0
  567. package/node_modules/@tiptap/suggestion/dist/index.d.cts +213 -0
  568. package/node_modules/@tiptap/suggestion/dist/index.d.ts +213 -0
  569. package/node_modules/@tiptap/suggestion/dist/index.js +339 -0
  570. package/node_modules/@tiptap/suggestion/dist/index.js.map +1 -0
  571. package/node_modules/@tiptap/suggestion/package.json +50 -0
  572. package/node_modules/@tiptap/suggestion/src/__tests__/suggestion.test.ts +127 -0
  573. package/node_modules/@tiptap/suggestion/src/findSuggestionMatch.ts +79 -0
  574. package/node_modules/@tiptap/suggestion/src/index.ts +8 -0
  575. package/node_modules/@tiptap/suggestion/src/suggestion.ts +585 -0
  576. package/node_modules/@types/linkify-it/LICENSE +21 -0
  577. package/node_modules/@types/linkify-it/README.md +15 -0
  578. package/node_modules/@types/linkify-it/build/index.cjs.d.ts +178 -0
  579. package/node_modules/@types/linkify-it/index.d.mts +174 -0
  580. package/node_modules/@types/linkify-it/index.d.ts +3 -0
  581. package/node_modules/@types/linkify-it/package.json +50 -0
  582. package/node_modules/@types/markdown-it/LICENSE +21 -0
  583. package/node_modules/@types/markdown-it/README.md +15 -0
  584. package/node_modules/@types/markdown-it/dist/index.cjs.d.ts +1236 -0
  585. package/node_modules/@types/markdown-it/dist/markdown-it.d.ts +5 -0
  586. package/node_modules/@types/markdown-it/dist/markdown-it.min.d.ts +5 -0
  587. package/node_modules/@types/markdown-it/index.d.mts +1 -0
  588. package/node_modules/@types/markdown-it/index.d.ts +3 -0
  589. package/node_modules/@types/markdown-it/lib/common/html_blocks.d.mts +7 -0
  590. package/node_modules/@types/markdown-it/lib/common/html_re.d.mts +2 -0
  591. package/node_modules/@types/markdown-it/lib/common/utils.d.mts +62 -0
  592. package/node_modules/@types/markdown-it/lib/helpers/index.d.mts +5 -0
  593. package/node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.mts +7 -0
  594. package/node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.mts +3 -0
  595. package/node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.mts +29 -0
  596. package/node_modules/@types/markdown-it/lib/index.d.mts +404 -0
  597. package/node_modules/@types/markdown-it/lib/parser_block.d.mts +25 -0
  598. package/node_modules/@types/markdown-it/lib/parser_core.d.mts +18 -0
  599. package/node_modules/@types/markdown-it/lib/parser_inline.d.mts +38 -0
  600. package/node_modules/@types/markdown-it/lib/renderer.d.mts +96 -0
  601. package/node_modules/@types/markdown-it/lib/ruler.d.mts +158 -0
  602. package/node_modules/@types/markdown-it/lib/rules_block/state_block.d.mts +124 -0
  603. package/node_modules/@types/markdown-it/lib/rules_core/state_core.d.mts +18 -0
  604. package/node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.mts +73 -0
  605. package/node_modules/@types/markdown-it/lib/token.d.mts +108 -0
  606. package/node_modules/@types/markdown-it/package.json +54 -0
  607. package/node_modules/@types/mdurl/LICENSE +21 -0
  608. package/node_modules/@types/mdurl/README.md +15 -0
  609. package/node_modules/@types/mdurl/build/index.cjs.d.ts +52 -0
  610. package/node_modules/@types/mdurl/index.d.mts +6 -0
  611. package/node_modules/@types/mdurl/index.d.ts +3 -0
  612. package/node_modules/@types/mdurl/lib/decode.d.mts +10 -0
  613. package/node_modules/@types/mdurl/lib/encode.d.mts +15 -0
  614. package/node_modules/@types/mdurl/lib/format.d.mts +3 -0
  615. package/node_modules/@types/mdurl/lib/parse.d.mts +18 -0
  616. package/node_modules/@types/mdurl/package.json +36 -0
  617. package/node_modules/@types/use-sync-external-store/LICENSE +21 -0
  618. package/node_modules/@types/use-sync-external-store/README.md +15 -0
  619. package/node_modules/@types/use-sync-external-store/index.d.ts +5 -0
  620. package/node_modules/@types/use-sync-external-store/package.json +30 -0
  621. package/node_modules/@types/use-sync-external-store/shim/index.d.ts +1 -0
  622. package/node_modules/@types/use-sync-external-store/shim/with-selector.d.ts +1 -0
  623. package/node_modules/@types/use-sync-external-store/with-selector.d.ts +7 -0
  624. package/node_modules/argparse/LICENSE +254 -0
  625. package/node_modules/argparse/README.md +84 -0
  626. package/node_modules/argparse/argparse.js +3707 -0
  627. package/node_modules/argparse/lib/sub.js +67 -0
  628. package/node_modules/argparse/lib/textwrap.js +440 -0
  629. package/node_modules/argparse/package.json +31 -0
  630. package/node_modules/crelt/LICENSE +19 -0
  631. package/node_modules/crelt/README.md +23 -0
  632. package/node_modules/crelt/dist/index.cjs +31 -0
  633. package/node_modules/crelt/dist/index.d.cts +4 -0
  634. package/node_modules/crelt/index.d.ts +4 -0
  635. package/node_modules/crelt/index.js +28 -0
  636. package/node_modules/crelt/package.json +35 -0
  637. package/node_modules/crelt/rollup.config.js +13 -0
  638. package/node_modules/entities/LICENSE +11 -0
  639. package/node_modules/entities/lib/decode.d.ts +211 -0
  640. package/node_modules/entities/lib/decode.d.ts.map +1 -0
  641. package/node_modules/entities/lib/decode.js +536 -0
  642. package/node_modules/entities/lib/decode.js.map +1 -0
  643. package/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
  644. package/node_modules/entities/lib/decode_codepoint.d.ts.map +1 -0
  645. package/node_modules/entities/lib/decode_codepoint.js +76 -0
  646. package/node_modules/entities/lib/decode_codepoint.js.map +1 -0
  647. package/node_modules/entities/lib/encode.d.ts +22 -0
  648. package/node_modules/entities/lib/encode.d.ts.map +1 -0
  649. package/node_modules/entities/lib/encode.js +77 -0
  650. package/node_modules/entities/lib/encode.js.map +1 -0
  651. package/node_modules/entities/lib/escape.d.ts +43 -0
  652. package/node_modules/entities/lib/escape.d.ts.map +1 -0
  653. package/node_modules/entities/lib/escape.js +122 -0
  654. package/node_modules/entities/lib/escape.js.map +1 -0
  655. package/node_modules/entities/lib/esm/decode.d.ts +211 -0
  656. package/node_modules/entities/lib/esm/decode.d.ts.map +1 -0
  657. package/node_modules/entities/lib/esm/decode.js +496 -0
  658. package/node_modules/entities/lib/esm/decode.js.map +1 -0
  659. package/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
  660. package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +1 -0
  661. package/node_modules/entities/lib/esm/decode_codepoint.js +71 -0
  662. package/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
  663. package/node_modules/entities/lib/esm/encode.d.ts +22 -0
  664. package/node_modules/entities/lib/esm/encode.d.ts.map +1 -0
  665. package/node_modules/entities/lib/esm/encode.js +69 -0
  666. package/node_modules/entities/lib/esm/encode.js.map +1 -0
  667. package/node_modules/entities/lib/esm/escape.d.ts +43 -0
  668. package/node_modules/entities/lib/esm/escape.d.ts.map +1 -0
  669. package/node_modules/entities/lib/esm/escape.js +116 -0
  670. package/node_modules/entities/lib/esm/escape.js.map +1 -0
  671. package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
  672. package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +1 -0
  673. package/node_modules/entities/lib/esm/generated/decode-data-html.js +7 -0
  674. package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
  675. package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
  676. package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +1 -0
  677. package/node_modules/entities/lib/esm/generated/decode-data-xml.js +7 -0
  678. package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
  679. package/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
  680. package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +1 -0
  681. package/node_modules/entities/lib/esm/generated/encode-html.js +10 -0
  682. package/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
  683. package/node_modules/entities/lib/esm/index.d.ts +96 -0
  684. package/node_modules/entities/lib/esm/index.d.ts.map +1 -0
  685. package/node_modules/entities/lib/esm/index.js +99 -0
  686. package/node_modules/entities/lib/esm/index.js.map +1 -0
  687. package/node_modules/entities/lib/esm/package.json +1 -0
  688. package/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
  689. package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +1 -0
  690. package/node_modules/entities/lib/generated/decode-data-html.js +9 -0
  691. package/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
  692. package/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
  693. package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +1 -0
  694. package/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
  695. package/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
  696. package/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
  697. package/node_modules/entities/lib/generated/encode-html.d.ts.map +1 -0
  698. package/node_modules/entities/lib/generated/encode-html.js +12 -0
  699. package/node_modules/entities/lib/generated/encode-html.js.map +1 -0
  700. package/node_modules/entities/lib/index.d.ts +96 -0
  701. package/node_modules/entities/lib/index.d.ts.map +1 -0
  702. package/node_modules/entities/lib/index.js +126 -0
  703. package/node_modules/entities/lib/index.js.map +1 -0
  704. package/node_modules/entities/package.json +90 -0
  705. package/node_modules/entities/readme.md +122 -0
  706. package/node_modules/escape-string-regexp/index.d.ts +18 -0
  707. package/node_modules/escape-string-regexp/index.js +13 -0
  708. package/node_modules/escape-string-regexp/license +9 -0
  709. package/node_modules/escape-string-regexp/package.json +38 -0
  710. package/node_modules/escape-string-regexp/readme.md +34 -0
  711. package/node_modules/fast-equals/LICENSE +21 -0
  712. package/node_modules/fast-equals/README.md +477 -0
  713. package/node_modules/fast-equals/dist/cjs/comparator.d.cts +60 -0
  714. package/node_modules/fast-equals/dist/cjs/equals.d.cts +62 -0
  715. package/node_modules/fast-equals/dist/cjs/index.cjs +653 -0
  716. package/node_modules/fast-equals/dist/cjs/index.cjs.map +1 -0
  717. package/node_modules/fast-equals/dist/cjs/index.d.cts +66 -0
  718. package/node_modules/fast-equals/dist/cjs/internalTypes.d.cts +178 -0
  719. package/node_modules/fast-equals/dist/cjs/utils.d.cts +33 -0
  720. package/node_modules/fast-equals/dist/es/comparator.d.mts +60 -0
  721. package/node_modules/fast-equals/dist/es/equals.d.mts +62 -0
  722. package/node_modules/fast-equals/dist/es/index.d.mts +66 -0
  723. package/node_modules/fast-equals/dist/es/index.mjs +642 -0
  724. package/node_modules/fast-equals/dist/es/index.mjs.map +1 -0
  725. package/node_modules/fast-equals/dist/es/internalTypes.d.mts +178 -0
  726. package/node_modules/fast-equals/dist/es/utils.d.mts +33 -0
  727. package/node_modules/fast-equals/dist/umd/comparator.d.ts +26 -0
  728. package/node_modules/fast-equals/dist/umd/equals.d.ts +62 -0
  729. package/node_modules/fast-equals/dist/umd/index.d.ts +47 -0
  730. package/node_modules/fast-equals/dist/umd/index.js +659 -0
  731. package/node_modules/fast-equals/dist/umd/index.js.map +1 -0
  732. package/node_modules/fast-equals/dist/umd/internalTypes.d.ts +159 -0
  733. package/node_modules/fast-equals/dist/umd/utils.d.ts +28 -0
  734. package/node_modules/fast-equals/index.d.ts +260 -0
  735. package/node_modules/fast-equals/package.json +113 -0
  736. package/node_modules/linkify-it/LICENSE +22 -0
  737. package/node_modules/linkify-it/README.md +196 -0
  738. package/node_modules/linkify-it/build/index.cjs.js +832 -0
  739. package/node_modules/linkify-it/index.mjs +642 -0
  740. package/node_modules/linkify-it/lib/re.mjs +189 -0
  741. package/node_modules/linkify-it/package.json +58 -0
  742. package/node_modules/markdown-it/LICENSE +22 -0
  743. package/node_modules/markdown-it/README.md +324 -0
  744. package/node_modules/markdown-it/bin/markdown-it.mjs +107 -0
  745. package/node_modules/markdown-it/dist/index.cjs.js +5547 -0
  746. package/node_modules/markdown-it/dist/markdown-it.js +6969 -0
  747. package/node_modules/markdown-it/dist/markdown-it.min.js +2 -0
  748. package/node_modules/markdown-it/index.mjs +1 -0
  749. package/node_modules/markdown-it/lib/common/html_blocks.mjs +67 -0
  750. package/node_modules/markdown-it/lib/common/html_re.mjs +25 -0
  751. package/node_modules/markdown-it/lib/common/utils.mjs +304 -0
  752. package/node_modules/markdown-it/lib/helpers/index.mjs +11 -0
  753. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +77 -0
  754. package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +49 -0
  755. package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +66 -0
  756. package/node_modules/markdown-it/lib/index.mjs +565 -0
  757. package/node_modules/markdown-it/lib/parser_block.mjs +134 -0
  758. package/node_modules/markdown-it/lib/parser_core.mjs +62 -0
  759. package/node_modules/markdown-it/lib/parser_inline.mjs +197 -0
  760. package/node_modules/markdown-it/lib/presets/commonmark.mjs +88 -0
  761. package/node_modules/markdown-it/lib/presets/default.mjs +47 -0
  762. package/node_modules/markdown-it/lib/presets/zero.mjs +70 -0
  763. package/node_modules/markdown-it/lib/renderer.mjs +322 -0
  764. package/node_modules/markdown-it/lib/ruler.mjs +340 -0
  765. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +209 -0
  766. package/node_modules/markdown-it/lib/rules_block/code.mjs +30 -0
  767. package/node_modules/markdown-it/lib/rules_block/fence.mjs +94 -0
  768. package/node_modules/markdown-it/lib/rules_block/heading.mjs +51 -0
  769. package/node_modules/markdown-it/lib/rules_block/hr.mjs +40 -0
  770. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +69 -0
  771. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +82 -0
  772. package/node_modules/markdown-it/lib/rules_block/list.mjs +331 -0
  773. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +46 -0
  774. package/node_modules/markdown-it/lib/rules_block/reference.mjs +212 -0
  775. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +220 -0
  776. package/node_modules/markdown-it/lib/rules_block/table.mjs +228 -0
  777. package/node_modules/markdown-it/lib/rules_core/block.mjs +13 -0
  778. package/node_modules/markdown-it/lib/rules_core/inline.mjs +11 -0
  779. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +134 -0
  780. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +17 -0
  781. package/node_modules/markdown-it/lib/rules_core/replacements.mjs +101 -0
  782. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +193 -0
  783. package/node_modules/markdown-it/lib/rules_core/state_core.mjs +17 -0
  784. package/node_modules/markdown-it/lib/rules_core/text_join.mjs +43 -0
  785. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +72 -0
  786. package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +60 -0
  787. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +124 -0
  788. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +123 -0
  789. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +51 -0
  790. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +69 -0
  791. package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +38 -0
  792. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +50 -0
  793. package/node_modules/markdown-it/lib/rules_inline/image.mjs +138 -0
  794. package/node_modules/markdown-it/lib/rules_inline/link.mjs +139 -0
  795. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +63 -0
  796. package/node_modules/markdown-it/lib/rules_inline/newline.mjs +42 -0
  797. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +123 -0
  798. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +127 -0
  799. package/node_modules/markdown-it/lib/rules_inline/text.mjs +86 -0
  800. package/node_modules/markdown-it/lib/token.mjs +191 -0
  801. package/node_modules/markdown-it/package.json +92 -0
  802. package/node_modules/mdurl/LICENSE +45 -0
  803. package/node_modules/mdurl/README.md +102 -0
  804. package/node_modules/mdurl/build/index.cjs.js +534 -0
  805. package/node_modules/mdurl/index.mjs +11 -0
  806. package/node_modules/mdurl/lib/decode.mjs +112 -0
  807. package/node_modules/mdurl/lib/encode.mjs +89 -0
  808. package/node_modules/mdurl/lib/format.mjs +21 -0
  809. package/node_modules/mdurl/lib/parse.mjs +308 -0
  810. package/node_modules/mdurl/package.json +37 -0
  811. package/node_modules/orderedmap/LICENSE +19 -0
  812. package/node_modules/orderedmap/README.md +69 -0
  813. package/node_modules/orderedmap/dist/index.cjs +139 -0
  814. package/node_modules/orderedmap/dist/index.d.cts +33 -0
  815. package/node_modules/orderedmap/dist/index.d.ts +33 -0
  816. package/node_modules/orderedmap/dist/index.js +137 -0
  817. package/node_modules/orderedmap/package.json +39 -0
  818. package/node_modules/prosemirror-changeset/CHANGELOG.md +147 -0
  819. package/node_modules/prosemirror-changeset/LICENSE +19 -0
  820. package/node_modules/prosemirror-changeset/README.md +175 -0
  821. package/node_modules/prosemirror-changeset/dist/index.cjs +585 -0
  822. package/node_modules/prosemirror-changeset/dist/index.d.cts +186 -0
  823. package/node_modules/prosemirror-changeset/dist/index.d.ts +186 -0
  824. package/node_modules/prosemirror-changeset/dist/index.js +715 -0
  825. package/node_modules/prosemirror-changeset/package.json +40 -0
  826. package/node_modules/prosemirror-changeset/src/README.md +32 -0
  827. package/node_modules/prosemirror-changeset/src/change.ts +189 -0
  828. package/node_modules/prosemirror-changeset/src/changeset.ts +212 -0
  829. package/node_modules/prosemirror-changeset/src/diff.ts +151 -0
  830. package/node_modules/prosemirror-changeset/src/simplify.ts +132 -0
  831. package/node_modules/prosemirror-changeset/test/test-changed-range.ts +48 -0
  832. package/node_modules/prosemirror-changeset/test/test-changes.ts +211 -0
  833. package/node_modules/prosemirror-changeset/test/test-diff.ts +69 -0
  834. package/node_modules/prosemirror-changeset/test/test-merge.ts +56 -0
  835. package/node_modules/prosemirror-changeset/test/test-simplify.ts +71 -0
  836. package/node_modules/prosemirror-collab/.tern-project +8 -0
  837. package/node_modules/prosemirror-collab/CHANGELOG.md +77 -0
  838. package/node_modules/prosemirror-collab/CONTRIBUTING.md +104 -0
  839. package/node_modules/prosemirror-collab/LICENSE +19 -0
  840. package/node_modules/prosemirror-collab/README.md +28 -0
  841. package/node_modules/prosemirror-collab/dist/index.cjs +155 -0
  842. package/node_modules/prosemirror-collab/dist/index.d.cts +60 -0
  843. package/node_modules/prosemirror-collab/dist/index.d.ts +60 -0
  844. package/node_modules/prosemirror-collab/dist/index.js +156 -0
  845. package/node_modules/prosemirror-collab/package.json +40 -0
  846. package/node_modules/prosemirror-collab/src/README.md +11 -0
  847. package/node_modules/prosemirror-collab/src/collab.ts +184 -0
  848. package/node_modules/prosemirror-commands/.tern-project +8 -0
  849. package/node_modules/prosemirror-commands/CHANGELOG.md +322 -0
  850. package/node_modules/prosemirror-commands/CONTRIBUTING.md +104 -0
  851. package/node_modules/prosemirror-commands/LICENSE +19 -0
  852. package/node_modules/prosemirror-commands/README.md +28 -0
  853. package/node_modules/prosemirror-commands/dist/index.cjs +687 -0
  854. package/node_modules/prosemirror-commands/dist/index.d.cts +215 -0
  855. package/node_modules/prosemirror-commands/dist/index.d.ts +215 -0
  856. package/node_modules/prosemirror-commands/dist/index.js +850 -0
  857. package/node_modules/prosemirror-commands/package.json +39 -0
  858. package/node_modules/prosemirror-commands/src/README.md +40 -0
  859. package/node_modules/prosemirror-commands/src/commands.ts +783 -0
  860. package/node_modules/prosemirror-dropcursor/CHANGELOG.md +137 -0
  861. package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +100 -0
  862. package/node_modules/prosemirror-dropcursor/LICENSE +19 -0
  863. package/node_modules/prosemirror-dropcursor/README.md +50 -0
  864. package/node_modules/prosemirror-dropcursor/dist/index.cjs +185 -0
  865. package/node_modules/prosemirror-dropcursor/dist/index.d.cts +38 -0
  866. package/node_modules/prosemirror-dropcursor/dist/index.d.ts +38 -0
  867. package/node_modules/prosemirror-dropcursor/dist/index.js +146 -0
  868. package/node_modules/prosemirror-dropcursor/package.json +38 -0
  869. package/node_modules/prosemirror-dropcursor/src/dropcursor.ts +170 -0
  870. package/node_modules/prosemirror-gapcursor/CHANGELOG.md +122 -0
  871. package/node_modules/prosemirror-gapcursor/CONTRIBUTING.md +104 -0
  872. package/node_modules/prosemirror-gapcursor/LICENSE +19 -0
  873. package/node_modules/prosemirror-gapcursor/README.md +31 -0
  874. package/node_modules/prosemirror-gapcursor/dist/index.cjs +239 -0
  875. package/node_modules/prosemirror-gapcursor/dist/index.d.cts +31 -0
  876. package/node_modules/prosemirror-gapcursor/dist/index.d.ts +31 -0
  877. package/node_modules/prosemirror-gapcursor/dist/index.js +239 -0
  878. package/node_modules/prosemirror-gapcursor/package.json +43 -0
  879. package/node_modules/prosemirror-gapcursor/src/README.md +21 -0
  880. package/node_modules/prosemirror-gapcursor/src/gapcursor.ts +141 -0
  881. package/node_modules/prosemirror-gapcursor/src/index.ts +91 -0
  882. package/node_modules/prosemirror-gapcursor/style/gapcursor.css +25 -0
  883. package/node_modules/prosemirror-history/.tern-project +8 -0
  884. package/node_modules/prosemirror-history/CHANGELOG.md +170 -0
  885. package/node_modules/prosemirror-history/CONTRIBUTING.md +104 -0
  886. package/node_modules/prosemirror-history/LICENSE +19 -0
  887. package/node_modules/prosemirror-history/README.md +27 -0
  888. package/node_modules/prosemirror-history/dist/index.cjs +382 -0
  889. package/node_modules/prosemirror-history/dist/index.d.cts +64 -0
  890. package/node_modules/prosemirror-history/dist/index.d.ts +64 -0
  891. package/node_modules/prosemirror-history/dist/index.js +453 -0
  892. package/node_modules/prosemirror-history/package.json +40 -0
  893. package/node_modules/prosemirror-history/src/README.md +23 -0
  894. package/node_modules/prosemirror-history/src/history.ts +465 -0
  895. package/node_modules/prosemirror-inputrules/.tern-project +8 -0
  896. package/node_modules/prosemirror-inputrules/CHANGELOG.md +127 -0
  897. package/node_modules/prosemirror-inputrules/CONTRIBUTING.md +104 -0
  898. package/node_modules/prosemirror-inputrules/LICENSE +19 -0
  899. package/node_modules/prosemirror-inputrules/README.md +29 -0
  900. package/node_modules/prosemirror-inputrules/dist/index.cjs +194 -0
  901. package/node_modules/prosemirror-inputrules/dist/index.d.cts +131 -0
  902. package/node_modules/prosemirror-inputrules/dist/index.d.ts +131 -0
  903. package/node_modules/prosemirror-inputrules/dist/index.js +239 -0
  904. package/node_modules/prosemirror-inputrules/package.json +36 -0
  905. package/node_modules/prosemirror-inputrules/src/README.md +23 -0
  906. package/node_modules/prosemirror-inputrules/src/index.ts +4 -0
  907. package/node_modules/prosemirror-inputrules/src/inputrules.ts +167 -0
  908. package/node_modules/prosemirror-inputrules/src/rulebuilders.ts +59 -0
  909. package/node_modules/prosemirror-inputrules/src/rules.ts +17 -0
  910. package/node_modules/prosemirror-keymap/.tern-project +8 -0
  911. package/node_modules/prosemirror-keymap/CHANGELOG.md +104 -0
  912. package/node_modules/prosemirror-keymap/CONTRIBUTING.md +104 -0
  913. package/node_modules/prosemirror-keymap/LICENSE +19 -0
  914. package/node_modules/prosemirror-keymap/README.md +27 -0
  915. package/node_modules/prosemirror-keymap/dist/index.cjs +65 -0
  916. package/node_modules/prosemirror-keymap/dist/index.d.cts +47 -0
  917. package/node_modules/prosemirror-keymap/dist/index.d.ts +47 -0
  918. package/node_modules/prosemirror-keymap/dist/index.js +128 -0
  919. package/node_modules/prosemirror-keymap/package.json +38 -0
  920. package/node_modules/prosemirror-keymap/src/README.md +5 -0
  921. package/node_modules/prosemirror-keymap/src/keymap.ts +105 -0
  922. package/node_modules/prosemirror-markdown/.tern-project +8 -0
  923. package/node_modules/prosemirror-markdown/CHANGELOG.md +311 -0
  924. package/node_modules/prosemirror-markdown/CONTRIBUTING.md +100 -0
  925. package/node_modules/prosemirror-markdown/LICENSE +19 -0
  926. package/node_modules/prosemirror-markdown/README.md +276 -0
  927. package/node_modules/prosemirror-markdown/dist/index.cjs +966 -0
  928. package/node_modules/prosemirror-markdown/dist/index.d.cts +335 -0
  929. package/node_modules/prosemirror-markdown/dist/index.d.ts +335 -0
  930. package/node_modules/prosemirror-markdown/dist/index.js +878 -0
  931. package/node_modules/prosemirror-markdown/package.json +40 -0
  932. package/node_modules/prosemirror-markdown/src/README.md +42 -0
  933. package/node_modules/prosemirror-markdown/src/from_markdown.ts +272 -0
  934. package/node_modules/prosemirror-markdown/src/index.ts +5 -0
  935. package/node_modules/prosemirror-markdown/src/schema.ts +156 -0
  936. package/node_modules/prosemirror-markdown/src/to_markdown.ts +483 -0
  937. package/node_modules/prosemirror-menu/.tern-project +8 -0
  938. package/node_modules/prosemirror-menu/CHANGELOG.md +107 -0
  939. package/node_modules/prosemirror-menu/CONTRIBUTING.md +100 -0
  940. package/node_modules/prosemirror-menu/LICENSE +19 -0
  941. package/node_modules/prosemirror-menu/README.md +235 -0
  942. package/node_modules/prosemirror-menu/dist/index.cjs +798 -0
  943. package/node_modules/prosemirror-menu/dist/index.d.cts +281 -0
  944. package/node_modules/prosemirror-menu/dist/index.d.ts +281 -0
  945. package/node_modules/prosemirror-menu/dist/index.js +795 -0
  946. package/node_modules/prosemirror-menu/package.json +42 -0
  947. package/node_modules/prosemirror-menu/src/README.md +60 -0
  948. package/node_modules/prosemirror-menu/src/icons.ts +53 -0
  949. package/node_modules/prosemirror-menu/src/index.ts +4 -0
  950. package/node_modules/prosemirror-menu/src/menu.ts +628 -0
  951. package/node_modules/prosemirror-menu/src/menubar.ts +210 -0
  952. package/node_modules/prosemirror-menu/style/menu.css +169 -0
  953. package/node_modules/prosemirror-model/.tern-project +8 -0
  954. package/node_modules/prosemirror-model/CHANGELOG.md +730 -0
  955. package/node_modules/prosemirror-model/CONTRIBUTING.md +104 -0
  956. package/node_modules/prosemirror-model/LICENSE +19 -0
  957. package/node_modules/prosemirror-model/README.md +29 -0
  958. package/node_modules/prosemirror-model/dist/index.cjs +2898 -0
  959. package/node_modules/prosemirror-model/dist/index.d.cts +1679 -0
  960. package/node_modules/prosemirror-model/dist/index.d.ts +1679 -0
  961. package/node_modules/prosemirror-model/dist/index.js +3464 -0
  962. package/node_modules/prosemirror-model/package.json +38 -0
  963. package/node_modules/prosemirror-model/src/README.md +62 -0
  964. package/node_modules/prosemirror-model/src/comparedeep.ts +15 -0
  965. package/node_modules/prosemirror-model/src/content.ts +413 -0
  966. package/node_modules/prosemirror-model/src/diff.ts +52 -0
  967. package/node_modules/prosemirror-model/src/dom.ts +1 -0
  968. package/node_modules/prosemirror-model/src/fragment.ts +268 -0
  969. package/node_modules/prosemirror-model/src/from_dom.ts +848 -0
  970. package/node_modules/prosemirror-model/src/index.ts +11 -0
  971. package/node_modules/prosemirror-model/src/mark.ts +111 -0
  972. package/node_modules/prosemirror-model/src/node.ts +402 -0
  973. package/node_modules/prosemirror-model/src/replace.ts +225 -0
  974. package/node_modules/prosemirror-model/src/resolvedpos.ts +289 -0
  975. package/node_modules/prosemirror-model/src/schema.ts +705 -0
  976. package/node_modules/prosemirror-model/src/to_dom.ts +238 -0
  977. package/node_modules/prosemirror-schema-basic/.tern-project +8 -0
  978. package/node_modules/prosemirror-schema-basic/CHANGELOG.md +81 -0
  979. package/node_modules/prosemirror-schema-basic/CONTRIBUTING.md +100 -0
  980. package/node_modules/prosemirror-schema-basic/LICENSE +19 -0
  981. package/node_modules/prosemirror-schema-basic/README.md +28 -0
  982. package/node_modules/prosemirror-schema-basic/dist/index.cjs +246 -0
  983. package/node_modules/prosemirror-schema-basic/dist/index.d.cts +87 -0
  984. package/node_modules/prosemirror-schema-basic/dist/index.d.ts +87 -0
  985. package/node_modules/prosemirror-schema-basic/dist/index.js +183 -0
  986. package/node_modules/prosemirror-schema-basic/package.json +37 -0
  987. package/node_modules/prosemirror-schema-basic/src/README.md +8 -0
  988. package/node_modules/prosemirror-schema-basic/src/schema-basic.ts +166 -0
  989. package/node_modules/prosemirror-schema-list/.tern-project +8 -0
  990. package/node_modules/prosemirror-schema-list/CHANGELOG.md +140 -0
  991. package/node_modules/prosemirror-schema-list/CONTRIBUTING.md +100 -0
  992. package/node_modules/prosemirror-schema-list/LICENSE +19 -0
  993. package/node_modules/prosemirror-schema-list/README.md +28 -0
  994. package/node_modules/prosemirror-schema-list/dist/index.cjs +253 -0
  995. package/node_modules/prosemirror-schema-list/dist/index.d.cts +71 -0
  996. package/node_modules/prosemirror-schema-list/dist/index.d.ts +71 -0
  997. package/node_modules/prosemirror-schema-list/dist/index.js +289 -0
  998. package/node_modules/prosemirror-schema-list/package.json +40 -0
  999. package/node_modules/prosemirror-schema-list/src/README.md +29 -0
  1000. package/node_modules/prosemirror-schema-list/src/schema-list.ts +267 -0
  1001. package/node_modules/prosemirror-state/.tern-project +8 -0
  1002. package/node_modules/prosemirror-state/CHANGELOG.md +296 -0
  1003. package/node_modules/prosemirror-state/CONTRIBUTING.md +104 -0
  1004. package/node_modules/prosemirror-state/LICENSE +19 -0
  1005. package/node_modules/prosemirror-state/README.md +28 -0
  1006. package/node_modules/prosemirror-state/dist/index.cjs +884 -0
  1007. package/node_modules/prosemirror-state/dist/index.d.cts +709 -0
  1008. package/node_modules/prosemirror-state/dist/index.d.ts +709 -0
  1009. package/node_modules/prosemirror-state/dist/index.js +1002 -0
  1010. package/node_modules/prosemirror-state/package.json +39 -0
  1011. package/node_modules/prosemirror-state/src/README.md +42 -0
  1012. package/node_modules/prosemirror-state/src/index.ts +7 -0
  1013. package/node_modules/prosemirror-state/src/plugin.ts +142 -0
  1014. package/node_modules/prosemirror-state/src/selection.ts +462 -0
  1015. package/node_modules/prosemirror-state/src/state.ts +266 -0
  1016. package/node_modules/prosemirror-state/src/transaction.ts +215 -0
  1017. package/node_modules/prosemirror-tables/LICENSE +19 -0
  1018. package/node_modules/prosemirror-tables/README.md +254 -0
  1019. package/node_modules/prosemirror-tables/dist/index.cjs +2683 -0
  1020. package/node_modules/prosemirror-tables/dist/index.d.cts +751 -0
  1021. package/node_modules/prosemirror-tables/dist/index.d.cts.map +1 -0
  1022. package/node_modules/prosemirror-tables/dist/index.d.ts +751 -0
  1023. package/node_modules/prosemirror-tables/dist/index.d.ts.map +1 -0
  1024. package/node_modules/prosemirror-tables/dist/index.js +2626 -0
  1025. package/node_modules/prosemirror-tables/dist/index.js.map +1 -0
  1026. package/node_modules/prosemirror-tables/package.json +80 -0
  1027. package/node_modules/prosemirror-tables/style/tables.css +48 -0
  1028. package/node_modules/prosemirror-trailing-node/LICENSE +21 -0
  1029. package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.cts +41 -0
  1030. package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.ts +41 -0
  1031. package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.cjs +70 -0
  1032. package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.cts +2 -0
  1033. package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.ts +2 -0
  1034. package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.js +43 -0
  1035. package/node_modules/prosemirror-trailing-node/dist-types/index.d.ts +2 -0
  1036. package/node_modules/prosemirror-trailing-node/dist-types/trailing-node-plugin.d.ts +33 -0
  1037. package/node_modules/prosemirror-trailing-node/dist-types/tsconfig.tsbuildinfo +1 -0
  1038. package/node_modules/prosemirror-trailing-node/package.json +57 -0
  1039. package/node_modules/prosemirror-trailing-node/readme.md +55 -0
  1040. package/node_modules/prosemirror-transform/.tern-project +8 -0
  1041. package/node_modules/prosemirror-transform/CHANGELOG.md +502 -0
  1042. package/node_modules/prosemirror-transform/CONTRIBUTING.md +104 -0
  1043. package/node_modules/prosemirror-transform/LICENSE +19 -0
  1044. package/node_modules/prosemirror-transform/README.md +29 -0
  1045. package/node_modules/prosemirror-transform/dist/index.cjs +1888 -0
  1046. package/node_modules/prosemirror-transform/dist/index.d.cts +847 -0
  1047. package/node_modules/prosemirror-transform/dist/index.d.ts +847 -0
  1048. package/node_modules/prosemirror-transform/dist/index.js +2181 -0
  1049. package/node_modules/prosemirror-transform/package.json +37 -0
  1050. package/node_modules/prosemirror-transform/src/README.md +59 -0
  1051. package/node_modules/prosemirror-transform/src/attr_step.ts +98 -0
  1052. package/node_modules/prosemirror-transform/src/index.ts +11 -0
  1053. package/node_modules/prosemirror-transform/src/map.ts +284 -0
  1054. package/node_modules/prosemirror-transform/src/mark.ts +106 -0
  1055. package/node_modules/prosemirror-transform/src/mark_step.ts +224 -0
  1056. package/node_modules/prosemirror-transform/src/replace.ts +460 -0
  1057. package/node_modules/prosemirror-transform/src/replace_step.ts +178 -0
  1058. package/node_modules/prosemirror-transform/src/step.ts +97 -0
  1059. package/node_modules/prosemirror-transform/src/structure.ts +349 -0
  1060. package/node_modules/prosemirror-transform/src/transform.ts +271 -0
  1061. package/node_modules/prosemirror-view/.tern-project +8 -0
  1062. package/node_modules/prosemirror-view/CHANGELOG.md +2447 -0
  1063. package/node_modules/prosemirror-view/CONTRIBUTING.md +104 -0
  1064. package/node_modules/prosemirror-view/LICENSE +19 -0
  1065. package/node_modules/prosemirror-view/README.md +28 -0
  1066. package/node_modules/prosemirror-view/dist/index.cjs +5381 -0
  1067. package/node_modules/prosemirror-view/dist/index.d.cts +904 -0
  1068. package/node_modules/prosemirror-view/dist/index.d.ts +904 -0
  1069. package/node_modules/prosemirror-view/dist/index.js +5900 -0
  1070. package/node_modules/prosemirror-view/package.json +43 -0
  1071. package/node_modules/prosemirror-view/src/README.md +38 -0
  1072. package/node_modules/prosemirror-view/src/browser.ts +24 -0
  1073. package/node_modules/prosemirror-view/src/capturekeys.ts +345 -0
  1074. package/node_modules/prosemirror-view/src/clipboard.ts +263 -0
  1075. package/node_modules/prosemirror-view/src/decoration.ts +793 -0
  1076. package/node_modules/prosemirror-view/src/dom.ts +159 -0
  1077. package/node_modules/prosemirror-view/src/domchange.ts +383 -0
  1078. package/node_modules/prosemirror-view/src/domcoords.ts +515 -0
  1079. package/node_modules/prosemirror-view/src/domobserver.ts +392 -0
  1080. package/node_modules/prosemirror-view/src/index.ts +825 -0
  1081. package/node_modules/prosemirror-view/src/input.ts +830 -0
  1082. package/node_modules/prosemirror-view/src/selection.ts +216 -0
  1083. package/node_modules/prosemirror-view/src/viewdesc.ts +1590 -0
  1084. package/node_modules/prosemirror-view/style/prosemirror.css +54 -0
  1085. package/node_modules/punycode.js/LICENSE-MIT.txt +20 -0
  1086. package/node_modules/punycode.js/README.md +148 -0
  1087. package/node_modules/punycode.js/package.json +58 -0
  1088. package/node_modules/punycode.js/punycode.es6.js +444 -0
  1089. package/node_modules/punycode.js/punycode.js +443 -0
  1090. package/node_modules/rope-sequence/LICENSE +19 -0
  1091. package/node_modules/rope-sequence/README.md +63 -0
  1092. package/node_modules/rope-sequence/dist/index.cjs +209 -0
  1093. package/node_modules/rope-sequence/dist/index.d.cts +11 -0
  1094. package/node_modules/rope-sequence/dist/index.d.ts +11 -0
  1095. package/node_modules/rope-sequence/dist/index.js +207 -0
  1096. package/node_modules/rope-sequence/index.js +190 -0
  1097. package/node_modules/rope-sequence/package.json +34 -0
  1098. package/node_modules/rope-sequence/test.js +78 -0
  1099. package/node_modules/uc.micro/LICENSE.txt +20 -0
  1100. package/node_modules/uc.micro/README.md +14 -0
  1101. package/node_modules/uc.micro/build/index.cjs.js +20 -0
  1102. package/node_modules/uc.micro/categories/Cc/regex.mjs +1 -0
  1103. package/node_modules/uc.micro/categories/Cf/regex.mjs +1 -0
  1104. package/node_modules/uc.micro/categories/P/regex.mjs +1 -0
  1105. package/node_modules/uc.micro/categories/S/regex.mjs +1 -0
  1106. package/node_modules/uc.micro/categories/Z/regex.mjs +1 -0
  1107. package/node_modules/uc.micro/index.mjs +8 -0
  1108. package/node_modules/uc.micro/package.json +37 -0
  1109. package/node_modules/uc.micro/properties/Any/regex.mjs +1 -0
  1110. package/node_modules/use-sync-external-store/LICENSE +21 -0
  1111. package/node_modules/use-sync-external-store/README.md +5 -0
  1112. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +97 -0
  1113. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +85 -0
  1114. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +95 -0
  1115. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +88 -0
  1116. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.js +59 -0
  1117. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +66 -0
  1118. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +96 -0
  1119. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +84 -0
  1120. package/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js +27 -0
  1121. package/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.js +13 -0
  1122. package/node_modules/use-sync-external-store/index.js +7 -0
  1123. package/node_modules/use-sync-external-store/package.json +43 -0
  1124. package/node_modules/use-sync-external-store/shim/index.js +7 -0
  1125. package/node_modules/use-sync-external-store/shim/index.native.js +7 -0
  1126. package/node_modules/use-sync-external-store/shim/with-selector.js +7 -0
  1127. package/node_modules/use-sync-external-store/with-selector.js +7 -0
  1128. package/node_modules/w3c-keyname/.tern-port +1 -0
  1129. package/node_modules/w3c-keyname/LICENSE +19 -0
  1130. package/node_modules/w3c-keyname/README.md +18 -0
  1131. package/node_modules/w3c-keyname/index.cjs +127 -0
  1132. package/node_modules/w3c-keyname/index.d.cts +5 -0
  1133. package/node_modules/w3c-keyname/index.d.ts +5 -0
  1134. package/node_modules/w3c-keyname/index.js +119 -0
  1135. package/node_modules/w3c-keyname/package.json +37 -0
  1136. package/package.json +120 -3
  1137. package/dist/chunk-T5WGKZN4.js.map +0 -1
  1138. package/dist/chunk-XULCQP3Q.js.map +0 -1
  1139. /package/dist/{chunk-7IPINZHT.js.map → chunk-IRBOKMF5.js.map} +0 -0
@@ -0,0 +1,2898 @@
1
+ 'use strict';
2
+
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
7
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
13
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
14
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
+ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
16
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
17
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
18
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
21
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24
+ var OrderedMap = require('orderedmap');
25
+ function _findDiffStart(a, b, pos) {
26
+ for (var i = 0;; i++) {
27
+ if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
28
+ var childA = a.child(i),
29
+ childB = b.child(i);
30
+ if (childA == childB) {
31
+ pos += childA.nodeSize;
32
+ continue;
33
+ }
34
+ if (!childA.sameMarkup(childB)) return pos;
35
+ if (childA.isText && childA.text != childB.text) {
36
+ for (var j = 0; childA.text[j] == childB.text[j]; j++) pos++;
37
+ return pos;
38
+ }
39
+ if (childA.content.size || childB.content.size) {
40
+ var inner = _findDiffStart(childA.content, childB.content, pos + 1);
41
+ if (inner != null) return inner;
42
+ }
43
+ pos += childA.nodeSize;
44
+ }
45
+ }
46
+ function _findDiffEnd(a, b, posA, posB) {
47
+ for (var iA = a.childCount, iB = b.childCount;;) {
48
+ if (iA == 0 || iB == 0) return iA == iB ? null : {
49
+ a: posA,
50
+ b: posB
51
+ };
52
+ var childA = a.child(--iA),
53
+ childB = b.child(--iB),
54
+ size = childA.nodeSize;
55
+ if (childA == childB) {
56
+ posA -= size;
57
+ posB -= size;
58
+ continue;
59
+ }
60
+ if (!childA.sameMarkup(childB)) return {
61
+ a: posA,
62
+ b: posB
63
+ };
64
+ if (childA.isText && childA.text != childB.text) {
65
+ var same = 0,
66
+ minSize = Math.min(childA.text.length, childB.text.length);
67
+ while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
68
+ same++;
69
+ posA--;
70
+ posB--;
71
+ }
72
+ return {
73
+ a: posA,
74
+ b: posB
75
+ };
76
+ }
77
+ if (childA.content.size || childB.content.size) {
78
+ var inner = _findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);
79
+ if (inner) return inner;
80
+ }
81
+ posA -= size;
82
+ posB -= size;
83
+ }
84
+ }
85
+ var Fragment = function () {
86
+ function Fragment(content, size) {
87
+ _classCallCheck(this, Fragment);
88
+ this.content = content;
89
+ this.size = size || 0;
90
+ if (size == null) for (var i = 0; i < content.length; i++) this.size += content[i].nodeSize;
91
+ }
92
+ _createClass(Fragment, [{
93
+ key: "nodesBetween",
94
+ value: function nodesBetween(from, to, f) {
95
+ var nodeStart = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
96
+ var parent = arguments.length > 4 ? arguments[4] : undefined;
97
+ for (var i = 0, pos = 0; pos < to; i++) {
98
+ var child = this.content[i],
99
+ end = pos + child.nodeSize;
100
+ if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
101
+ var start = pos + 1;
102
+ child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
103
+ }
104
+ pos = end;
105
+ }
106
+ }
107
+ }, {
108
+ key: "descendants",
109
+ value: function descendants(f) {
110
+ this.nodesBetween(0, this.size, f);
111
+ }
112
+ }, {
113
+ key: "textBetween",
114
+ value: function textBetween(from, to, blockSeparator, leafText) {
115
+ var text = "",
116
+ first = true;
117
+ this.nodesBetween(from, to, function (node, pos) {
118
+ var nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
119
+ if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {
120
+ if (first) first = false;else text += blockSeparator;
121
+ }
122
+ text += nodeText;
123
+ }, 0);
124
+ return text;
125
+ }
126
+ }, {
127
+ key: "append",
128
+ value: function append(other) {
129
+ if (!other.size) return this;
130
+ if (!this.size) return other;
131
+ var last = this.lastChild,
132
+ first = other.firstChild,
133
+ content = this.content.slice(),
134
+ i = 0;
135
+ if (last.isText && last.sameMarkup(first)) {
136
+ content[content.length - 1] = last.withText(last.text + first.text);
137
+ i = 1;
138
+ }
139
+ for (; i < other.content.length; i++) content.push(other.content[i]);
140
+ return new Fragment(content, this.size + other.size);
141
+ }
142
+ }, {
143
+ key: "cut",
144
+ value: function cut(from) {
145
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.size;
146
+ if (from == 0 && to == this.size) return this;
147
+ var result = [],
148
+ size = 0;
149
+ if (to > from) for (var i = 0, pos = 0; pos < to; i++) {
150
+ var child = this.content[i],
151
+ end = pos + child.nodeSize;
152
+ if (end > from) {
153
+ if (pos < from || end > to) {
154
+ if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
155
+ }
156
+ result.push(child);
157
+ size += child.nodeSize;
158
+ }
159
+ pos = end;
160
+ }
161
+ return new Fragment(result, size);
162
+ }
163
+ }, {
164
+ key: "cutByIndex",
165
+ value: function cutByIndex(from, to) {
166
+ if (from == to) return Fragment.empty;
167
+ if (from == 0 && to == this.content.length) return this;
168
+ return new Fragment(this.content.slice(from, to));
169
+ }
170
+ }, {
171
+ key: "replaceChild",
172
+ value: function replaceChild(index, node) {
173
+ var current = this.content[index];
174
+ if (current == node) return this;
175
+ var copy = this.content.slice();
176
+ var size = this.size + node.nodeSize - current.nodeSize;
177
+ copy[index] = node;
178
+ return new Fragment(copy, size);
179
+ }
180
+ }, {
181
+ key: "addToStart",
182
+ value: function addToStart(node) {
183
+ return new Fragment([node].concat(this.content), this.size + node.nodeSize);
184
+ }
185
+ }, {
186
+ key: "addToEnd",
187
+ value: function addToEnd(node) {
188
+ return new Fragment(this.content.concat(node), this.size + node.nodeSize);
189
+ }
190
+ }, {
191
+ key: "eq",
192
+ value: function eq(other) {
193
+ if (this.content.length != other.content.length) return false;
194
+ for (var i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;
195
+ return true;
196
+ }
197
+ }, {
198
+ key: "firstChild",
199
+ get: function get() {
200
+ return this.content.length ? this.content[0] : null;
201
+ }
202
+ }, {
203
+ key: "lastChild",
204
+ get: function get() {
205
+ return this.content.length ? this.content[this.content.length - 1] : null;
206
+ }
207
+ }, {
208
+ key: "childCount",
209
+ get: function get() {
210
+ return this.content.length;
211
+ }
212
+ }, {
213
+ key: "child",
214
+ value: function child(index) {
215
+ var found = this.content[index];
216
+ if (!found) throw new RangeError("Index " + index + " out of range for " + this);
217
+ return found;
218
+ }
219
+ }, {
220
+ key: "maybeChild",
221
+ value: function maybeChild(index) {
222
+ return this.content[index] || null;
223
+ }
224
+ }, {
225
+ key: "forEach",
226
+ value: function forEach(f) {
227
+ for (var i = 0, p = 0; i < this.content.length; i++) {
228
+ var child = this.content[i];
229
+ f(child, p, i);
230
+ p += child.nodeSize;
231
+ }
232
+ }
233
+ }, {
234
+ key: "findDiffStart",
235
+ value: function findDiffStart(other) {
236
+ var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
237
+ return _findDiffStart(this, other, pos);
238
+ }
239
+ }, {
240
+ key: "findDiffEnd",
241
+ value: function findDiffEnd(other) {
242
+ var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.size;
243
+ var otherPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : other.size;
244
+ return _findDiffEnd(this, other, pos, otherPos);
245
+ }
246
+ }, {
247
+ key: "findIndex",
248
+ value: function findIndex(pos) {
249
+ if (pos == 0) return retIndex(0, pos);
250
+ if (pos == this.size) return retIndex(this.content.length, pos);
251
+ if (pos > this.size || pos < 0) throw new RangeError("Position ".concat(pos, " outside of fragment (").concat(this, ")"));
252
+ for (var i = 0, curPos = 0;; i++) {
253
+ var cur = this.child(i),
254
+ end = curPos + cur.nodeSize;
255
+ if (end >= pos) {
256
+ if (end == pos) return retIndex(i + 1, end);
257
+ return retIndex(i, curPos);
258
+ }
259
+ curPos = end;
260
+ }
261
+ }
262
+ }, {
263
+ key: "toString",
264
+ value: function toString() {
265
+ return "<" + this.toStringInner() + ">";
266
+ }
267
+ }, {
268
+ key: "toStringInner",
269
+ value: function toStringInner() {
270
+ return this.content.join(", ");
271
+ }
272
+ }, {
273
+ key: "toJSON",
274
+ value: function toJSON() {
275
+ return this.content.length ? this.content.map(function (n) {
276
+ return n.toJSON();
277
+ }) : null;
278
+ }
279
+ }], [{
280
+ key: "fromJSON",
281
+ value: function fromJSON(schema, value) {
282
+ if (!value) return Fragment.empty;
283
+ if (!Array.isArray(value)) throw new RangeError("Invalid input for Fragment.fromJSON");
284
+ return new Fragment(value.map(schema.nodeFromJSON));
285
+ }
286
+ }, {
287
+ key: "fromArray",
288
+ value: function fromArray(array) {
289
+ if (!array.length) return Fragment.empty;
290
+ var joined,
291
+ size = 0;
292
+ for (var i = 0; i < array.length; i++) {
293
+ var node = array[i];
294
+ size += node.nodeSize;
295
+ if (i && node.isText && array[i - 1].sameMarkup(node)) {
296
+ if (!joined) joined = array.slice(0, i);
297
+ joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);
298
+ } else if (joined) {
299
+ joined.push(node);
300
+ }
301
+ }
302
+ return new Fragment(joined || array, size);
303
+ }
304
+ }, {
305
+ key: "from",
306
+ value: function from(nodes) {
307
+ if (!nodes) return Fragment.empty;
308
+ if (nodes instanceof Fragment) return nodes;
309
+ if (Array.isArray(nodes)) return this.fromArray(nodes);
310
+ if (nodes.attrs) return new Fragment([nodes], nodes.nodeSize);
311
+ throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
312
+ }
313
+ }]);
314
+ return Fragment;
315
+ }();
316
+ Fragment.empty = new Fragment([], 0);
317
+ var found = {
318
+ index: 0,
319
+ offset: 0
320
+ };
321
+ function retIndex(index, offset) {
322
+ found.index = index;
323
+ found.offset = offset;
324
+ return found;
325
+ }
326
+ function compareDeep(a, b) {
327
+ if (a === b) return true;
328
+ if (!(a && _typeof(a) == "object") || !(b && _typeof(b) == "object")) return false;
329
+ var array = Array.isArray(a);
330
+ if (Array.isArray(b) != array) return false;
331
+ if (array) {
332
+ if (a.length != b.length) return false;
333
+ for (var i = 0; i < a.length; i++) if (!compareDeep(a[i], b[i])) return false;
334
+ } else {
335
+ for (var p in a) if (!(p in b) || !compareDeep(a[p], b[p])) return false;
336
+ for (var _p in b) if (!(_p in a)) return false;
337
+ }
338
+ return true;
339
+ }
340
+ var Mark = function () {
341
+ function Mark(type, attrs) {
342
+ _classCallCheck(this, Mark);
343
+ this.type = type;
344
+ this.attrs = attrs;
345
+ }
346
+ _createClass(Mark, [{
347
+ key: "addToSet",
348
+ value: function addToSet(set) {
349
+ var copy,
350
+ placed = false;
351
+ for (var i = 0; i < set.length; i++) {
352
+ var other = set[i];
353
+ if (this.eq(other)) return set;
354
+ if (this.type.excludes(other.type)) {
355
+ if (!copy) copy = set.slice(0, i);
356
+ } else if (other.type.excludes(this.type)) {
357
+ return set;
358
+ } else {
359
+ if (!placed && other.type.rank > this.type.rank) {
360
+ if (!copy) copy = set.slice(0, i);
361
+ copy.push(this);
362
+ placed = true;
363
+ }
364
+ if (copy) copy.push(other);
365
+ }
366
+ }
367
+ if (!copy) copy = set.slice();
368
+ if (!placed) copy.push(this);
369
+ return copy;
370
+ }
371
+ }, {
372
+ key: "removeFromSet",
373
+ value: function removeFromSet(set) {
374
+ for (var i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));
375
+ return set;
376
+ }
377
+ }, {
378
+ key: "isInSet",
379
+ value: function isInSet(set) {
380
+ for (var i = 0; i < set.length; i++) if (this.eq(set[i])) return true;
381
+ return false;
382
+ }
383
+ }, {
384
+ key: "eq",
385
+ value: function eq(other) {
386
+ return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);
387
+ }
388
+ }, {
389
+ key: "toJSON",
390
+ value: function toJSON() {
391
+ var obj = {
392
+ type: this.type.name
393
+ };
394
+ for (var _ in this.attrs) {
395
+ obj.attrs = this.attrs;
396
+ break;
397
+ }
398
+ return obj;
399
+ }
400
+ }], [{
401
+ key: "fromJSON",
402
+ value: function fromJSON(schema, json) {
403
+ if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
404
+ var type = schema.marks[json.type];
405
+ if (!type) throw new RangeError("There is no mark type ".concat(json.type, " in this schema"));
406
+ var mark = type.create(json.attrs);
407
+ type.checkAttrs(mark.attrs);
408
+ return mark;
409
+ }
410
+ }, {
411
+ key: "sameSet",
412
+ value: function sameSet(a, b) {
413
+ if (a == b) return true;
414
+ if (a.length != b.length) return false;
415
+ for (var i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;
416
+ return true;
417
+ }
418
+ }, {
419
+ key: "setFrom",
420
+ value: function setFrom(marks) {
421
+ if (!marks || Array.isArray(marks) && marks.length == 0) return Mark.none;
422
+ if (marks instanceof Mark) return [marks];
423
+ var copy = marks.slice();
424
+ copy.sort(function (a, b) {
425
+ return a.type.rank - b.type.rank;
426
+ });
427
+ return copy;
428
+ }
429
+ }]);
430
+ return Mark;
431
+ }();
432
+ Mark.none = [];
433
+ var ReplaceError = function (_Error) {
434
+ _inherits(ReplaceError, _Error);
435
+ var _super = _createSuper(ReplaceError);
436
+ function ReplaceError() {
437
+ _classCallCheck(this, ReplaceError);
438
+ return _super.apply(this, arguments);
439
+ }
440
+ return _createClass(ReplaceError);
441
+ }(_wrapNativeSuper(Error));
442
+ var Slice = function () {
443
+ function Slice(content, openStart, openEnd) {
444
+ _classCallCheck(this, Slice);
445
+ this.content = content;
446
+ this.openStart = openStart;
447
+ this.openEnd = openEnd;
448
+ }
449
+ _createClass(Slice, [{
450
+ key: "size",
451
+ get: function get() {
452
+ return this.content.size - this.openStart - this.openEnd;
453
+ }
454
+ }, {
455
+ key: "insertAt",
456
+ value: function insertAt(pos, fragment) {
457
+ var content = insertInto(this.content, pos + this.openStart, fragment);
458
+ return content && new Slice(content, this.openStart, this.openEnd);
459
+ }
460
+ }, {
461
+ key: "removeBetween",
462
+ value: function removeBetween(from, to) {
463
+ return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
464
+ }
465
+ }, {
466
+ key: "eq",
467
+ value: function eq(other) {
468
+ return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;
469
+ }
470
+ }, {
471
+ key: "toString",
472
+ value: function toString() {
473
+ return this.content + "(" + this.openStart + "," + this.openEnd + ")";
474
+ }
475
+ }, {
476
+ key: "toJSON",
477
+ value: function toJSON() {
478
+ if (!this.content.size) return null;
479
+ var json = {
480
+ content: this.content.toJSON()
481
+ };
482
+ if (this.openStart > 0) json.openStart = this.openStart;
483
+ if (this.openEnd > 0) json.openEnd = this.openEnd;
484
+ return json;
485
+ }
486
+ }], [{
487
+ key: "fromJSON",
488
+ value: function fromJSON(schema, json) {
489
+ if (!json) return Slice.empty;
490
+ var openStart = json.openStart || 0,
491
+ openEnd = json.openEnd || 0;
492
+ if (typeof openStart != "number" || typeof openEnd != "number") throw new RangeError("Invalid input for Slice.fromJSON");
493
+ return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);
494
+ }
495
+ }, {
496
+ key: "maxOpen",
497
+ value: function maxOpen(fragment) {
498
+ var openIsolating = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
499
+ var openStart = 0,
500
+ openEnd = 0;
501
+ for (var n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;
502
+ for (var _n = fragment.lastChild; _n && !_n.isLeaf && (openIsolating || !_n.type.spec.isolating); _n = _n.lastChild) openEnd++;
503
+ return new Slice(fragment, openStart, openEnd);
504
+ }
505
+ }]);
506
+ return Slice;
507
+ }();
508
+ Slice.empty = new Slice(Fragment.empty, 0, 0);
509
+ function removeRange(content, from, to) {
510
+ var _content$findIndex = content.findIndex(from),
511
+ index = _content$findIndex.index,
512
+ offset = _content$findIndex.offset,
513
+ child = content.maybeChild(index);
514
+ var _content$findIndex2 = content.findIndex(to),
515
+ indexTo = _content$findIndex2.index,
516
+ offsetTo = _content$findIndex2.offset;
517
+ if (offset == from || child.isText) {
518
+ if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError("Removing non-flat range");
519
+ return content.cut(0, from).append(content.cut(to));
520
+ }
521
+ if (index != indexTo) throw new RangeError("Removing non-flat range");
522
+ return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
523
+ }
524
+ function insertInto(content, dist, insert, parent) {
525
+ var _content$findIndex3 = content.findIndex(dist),
526
+ index = _content$findIndex3.index,
527
+ offset = _content$findIndex3.offset,
528
+ child = content.maybeChild(index);
529
+ if (offset == dist || child.isText) {
530
+ if (parent && !parent.canReplace(index, index, insert)) return null;
531
+ return content.cut(0, dist).append(insert).append(content.cut(dist));
532
+ }
533
+ var inner = insertInto(child.content, dist - offset - 1, insert, child);
534
+ return inner && content.replaceChild(index, child.copy(inner));
535
+ }
536
+ function _replace($from, $to, slice) {
537
+ if (slice.openStart > $from.depth) throw new ReplaceError("Inserted content deeper than insertion position");
538
+ if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError("Inconsistent open depths");
539
+ return replaceOuter($from, $to, slice, 0);
540
+ }
541
+ function replaceOuter($from, $to, slice, depth) {
542
+ var index = $from.index(depth),
543
+ node = $from.node(depth);
544
+ if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
545
+ var inner = replaceOuter($from, $to, slice, depth + 1);
546
+ return node.copy(node.content.replaceChild(index, inner));
547
+ } else if (!slice.content.size) {
548
+ return close(node, replaceTwoWay($from, $to, depth));
549
+ } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {
550
+ var parent = $from.parent,
551
+ content = parent.content;
552
+ return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
553
+ } else {
554
+ var _prepareSliceForRepla = prepareSliceForReplace(slice, $from),
555
+ start = _prepareSliceForRepla.start,
556
+ end = _prepareSliceForRepla.end;
557
+ return close(node, replaceThreeWay($from, start, end, $to, depth));
558
+ }
559
+ }
560
+ function checkJoin(main, sub) {
561
+ if (!sub.type.compatibleContent(main.type)) throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name);
562
+ }
563
+ function joinable($before, $after, depth) {
564
+ var node = $before.node(depth);
565
+ checkJoin(node, $after.node(depth));
566
+ return node;
567
+ }
568
+ function addNode(child, target) {
569
+ var last = target.length - 1;
570
+ if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);else target.push(child);
571
+ }
572
+ function addRange($start, $end, depth, target) {
573
+ var node = ($end || $start).node(depth);
574
+ var startIndex = 0,
575
+ endIndex = $end ? $end.index(depth) : node.childCount;
576
+ if ($start) {
577
+ startIndex = $start.index(depth);
578
+ if ($start.depth > depth) {
579
+ startIndex++;
580
+ } else if ($start.textOffset) {
581
+ addNode($start.nodeAfter, target);
582
+ startIndex++;
583
+ }
584
+ }
585
+ for (var i = startIndex; i < endIndex; i++) addNode(node.child(i), target);
586
+ if ($end && $end.depth == depth && $end.textOffset) addNode($end.nodeBefore, target);
587
+ }
588
+ function close(node, content) {
589
+ node.type.checkContent(content);
590
+ return node.copy(content);
591
+ }
592
+ function replaceThreeWay($from, $start, $end, $to, depth) {
593
+ var openStart = $from.depth > depth && joinable($from, $start, depth + 1);
594
+ var openEnd = $to.depth > depth && joinable($end, $to, depth + 1);
595
+ var content = [];
596
+ addRange(null, $from, depth, content);
597
+ if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {
598
+ checkJoin(openStart, openEnd);
599
+ addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);
600
+ } else {
601
+ if (openStart) addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);
602
+ addRange($start, $end, depth, content);
603
+ if (openEnd) addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
604
+ }
605
+ addRange($to, null, depth, content);
606
+ return new Fragment(content);
607
+ }
608
+ function replaceTwoWay($from, $to, depth) {
609
+ var content = [];
610
+ addRange(null, $from, depth, content);
611
+ if ($from.depth > depth) {
612
+ var type = joinable($from, $to, depth + 1);
613
+ addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
614
+ }
615
+ addRange($to, null, depth, content);
616
+ return new Fragment(content);
617
+ }
618
+ function prepareSliceForReplace(slice, $along) {
619
+ var extra = $along.depth - slice.openStart,
620
+ parent = $along.node(extra);
621
+ var node = parent.copy(slice.content);
622
+ for (var i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment.from(node));
623
+ return {
624
+ start: node.resolveNoCache(slice.openStart + extra),
625
+ end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
626
+ };
627
+ }
628
+ var ResolvedPos = function () {
629
+ function ResolvedPos(pos, path, parentOffset) {
630
+ _classCallCheck(this, ResolvedPos);
631
+ this.pos = pos;
632
+ this.path = path;
633
+ this.parentOffset = parentOffset;
634
+ this.depth = path.length / 3 - 1;
635
+ }
636
+ _createClass(ResolvedPos, [{
637
+ key: "resolveDepth",
638
+ value: function resolveDepth(val) {
639
+ if (val == null) return this.depth;
640
+ if (val < 0) return this.depth + val;
641
+ return val;
642
+ }
643
+ }, {
644
+ key: "parent",
645
+ get: function get() {
646
+ return this.node(this.depth);
647
+ }
648
+ }, {
649
+ key: "doc",
650
+ get: function get() {
651
+ return this.node(0);
652
+ }
653
+ }, {
654
+ key: "node",
655
+ value: function node(depth) {
656
+ return this.path[this.resolveDepth(depth) * 3];
657
+ }
658
+ }, {
659
+ key: "index",
660
+ value: function index(depth) {
661
+ return this.path[this.resolveDepth(depth) * 3 + 1];
662
+ }
663
+ }, {
664
+ key: "indexAfter",
665
+ value: function indexAfter(depth) {
666
+ depth = this.resolveDepth(depth);
667
+ return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);
668
+ }
669
+ }, {
670
+ key: "start",
671
+ value: function start(depth) {
672
+ depth = this.resolveDepth(depth);
673
+ return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
674
+ }
675
+ }, {
676
+ key: "end",
677
+ value: function end(depth) {
678
+ depth = this.resolveDepth(depth);
679
+ return this.start(depth) + this.node(depth).content.size;
680
+ }
681
+ }, {
682
+ key: "before",
683
+ value: function before(depth) {
684
+ depth = this.resolveDepth(depth);
685
+ if (!depth) throw new RangeError("There is no position before the top-level node");
686
+ return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];
687
+ }
688
+ }, {
689
+ key: "after",
690
+ value: function after(depth) {
691
+ depth = this.resolveDepth(depth);
692
+ if (!depth) throw new RangeError("There is no position after the top-level node");
693
+ return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;
694
+ }
695
+ }, {
696
+ key: "textOffset",
697
+ get: function get() {
698
+ return this.pos - this.path[this.path.length - 1];
699
+ }
700
+ }, {
701
+ key: "nodeAfter",
702
+ get: function get() {
703
+ var parent = this.parent,
704
+ index = this.index(this.depth);
705
+ if (index == parent.childCount) return null;
706
+ var dOff = this.pos - this.path[this.path.length - 1],
707
+ child = parent.child(index);
708
+ return dOff ? parent.child(index).cut(dOff) : child;
709
+ }
710
+ }, {
711
+ key: "nodeBefore",
712
+ get: function get() {
713
+ var index = this.index(this.depth);
714
+ var dOff = this.pos - this.path[this.path.length - 1];
715
+ if (dOff) return this.parent.child(index).cut(0, dOff);
716
+ return index == 0 ? null : this.parent.child(index - 1);
717
+ }
718
+ }, {
719
+ key: "posAtIndex",
720
+ value: function posAtIndex(index, depth) {
721
+ depth = this.resolveDepth(depth);
722
+ var node = this.path[depth * 3],
723
+ pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
724
+ for (var i = 0; i < index; i++) pos += node.child(i).nodeSize;
725
+ return pos;
726
+ }
727
+ }, {
728
+ key: "marks",
729
+ value: function marks() {
730
+ var parent = this.parent,
731
+ index = this.index();
732
+ if (parent.content.size == 0) return Mark.none;
733
+ if (this.textOffset) return parent.child(index).marks;
734
+ var main = parent.maybeChild(index - 1),
735
+ other = parent.maybeChild(index);
736
+ if (!main) {
737
+ var tmp = main;
738
+ main = other;
739
+ other = tmp;
740
+ }
741
+ var marks = main.marks;
742
+ for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);
743
+ return marks;
744
+ }
745
+ }, {
746
+ key: "marksAcross",
747
+ value: function marksAcross($end) {
748
+ var after = this.parent.maybeChild(this.index());
749
+ if (!after || !after.isInline) return null;
750
+ var marks = after.marks,
751
+ next = $end.parent.maybeChild($end.index());
752
+ for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);
753
+ return marks;
754
+ }
755
+ }, {
756
+ key: "sharedDepth",
757
+ value: function sharedDepth(pos) {
758
+ for (var depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;
759
+ return 0;
760
+ }
761
+ }, {
762
+ key: "blockRange",
763
+ value: function blockRange() {
764
+ var other = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this;
765
+ var pred = arguments.length > 1 ? arguments[1] : undefined;
766
+ if (other.pos < this.pos) return other.blockRange(this);
767
+ for (var d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange(this, other, d);
768
+ return null;
769
+ }
770
+ }, {
771
+ key: "sameParent",
772
+ value: function sameParent(other) {
773
+ return this.pos - this.parentOffset == other.pos - other.parentOffset;
774
+ }
775
+ }, {
776
+ key: "max",
777
+ value: function max(other) {
778
+ return other.pos > this.pos ? other : this;
779
+ }
780
+ }, {
781
+ key: "min",
782
+ value: function min(other) {
783
+ return other.pos < this.pos ? other : this;
784
+ }
785
+ }, {
786
+ key: "toString",
787
+ value: function toString() {
788
+ var str = "";
789
+ for (var i = 1; i <= this.depth; i++) str += (str ? "/" : "") + this.node(i).type.name + "_" + this.index(i - 1);
790
+ return str + ":" + this.parentOffset;
791
+ }
792
+ }], [{
793
+ key: "resolve",
794
+ value: function resolve(doc, pos) {
795
+ if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError("Position " + pos + " out of range");
796
+ var path = [];
797
+ var start = 0,
798
+ parentOffset = pos;
799
+ for (var node = doc;;) {
800
+ var _node$content$findInd = node.content.findIndex(parentOffset),
801
+ index = _node$content$findInd.index,
802
+ offset = _node$content$findInd.offset;
803
+ var rem = parentOffset - offset;
804
+ path.push(node, index, start + offset);
805
+ if (!rem) break;
806
+ node = node.child(index);
807
+ if (node.isText) break;
808
+ parentOffset = rem - 1;
809
+ start += offset + 1;
810
+ }
811
+ return new ResolvedPos(pos, path, parentOffset);
812
+ }
813
+ }, {
814
+ key: "resolveCached",
815
+ value: function resolveCached(doc, pos) {
816
+ var cache = resolveCache.get(doc);
817
+ if (cache) {
818
+ for (var i = 0; i < cache.elts.length; i++) {
819
+ var elt = cache.elts[i];
820
+ if (elt.pos == pos) return elt;
821
+ }
822
+ } else {
823
+ resolveCache.set(doc, cache = new ResolveCache());
824
+ }
825
+ var result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);
826
+ cache.i = (cache.i + 1) % resolveCacheSize;
827
+ return result;
828
+ }
829
+ }]);
830
+ return ResolvedPos;
831
+ }();
832
+ var ResolveCache = _createClass(function ResolveCache() {
833
+ _classCallCheck(this, ResolveCache);
834
+ this.elts = [];
835
+ this.i = 0;
836
+ });
837
+ var resolveCacheSize = 12,
838
+ resolveCache = new WeakMap();
839
+ var NodeRange = function () {
840
+ function NodeRange($from, $to, depth) {
841
+ _classCallCheck(this, NodeRange);
842
+ this.$from = $from;
843
+ this.$to = $to;
844
+ this.depth = depth;
845
+ }
846
+ _createClass(NodeRange, [{
847
+ key: "start",
848
+ get: function get() {
849
+ return this.$from.before(this.depth + 1);
850
+ }
851
+ }, {
852
+ key: "end",
853
+ get: function get() {
854
+ return this.$to.after(this.depth + 1);
855
+ }
856
+ }, {
857
+ key: "parent",
858
+ get: function get() {
859
+ return this.$from.node(this.depth);
860
+ }
861
+ }, {
862
+ key: "startIndex",
863
+ get: function get() {
864
+ return this.$from.index(this.depth);
865
+ }
866
+ }, {
867
+ key: "endIndex",
868
+ get: function get() {
869
+ return this.$to.indexAfter(this.depth);
870
+ }
871
+ }]);
872
+ return NodeRange;
873
+ }();
874
+ var emptyAttrs = Object.create(null);
875
+ var Node = function () {
876
+ function Node(type, attrs, content) {
877
+ var marks = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Mark.none;
878
+ _classCallCheck(this, Node);
879
+ this.type = type;
880
+ this.attrs = attrs;
881
+ this.marks = marks;
882
+ this.content = content || Fragment.empty;
883
+ }
884
+ _createClass(Node, [{
885
+ key: "children",
886
+ get: function get() {
887
+ return this.content.content;
888
+ }
889
+ }, {
890
+ key: "nodeSize",
891
+ get: function get() {
892
+ return this.isLeaf ? 1 : 2 + this.content.size;
893
+ }
894
+ }, {
895
+ key: "childCount",
896
+ get: function get() {
897
+ return this.content.childCount;
898
+ }
899
+ }, {
900
+ key: "child",
901
+ value: function child(index) {
902
+ return this.content.child(index);
903
+ }
904
+ }, {
905
+ key: "maybeChild",
906
+ value: function maybeChild(index) {
907
+ return this.content.maybeChild(index);
908
+ }
909
+ }, {
910
+ key: "forEach",
911
+ value: function forEach(f) {
912
+ this.content.forEach(f);
913
+ }
914
+ }, {
915
+ key: "nodesBetween",
916
+ value: function nodesBetween(from, to, f) {
917
+ var startPos = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
918
+ this.content.nodesBetween(from, to, f, startPos, this);
919
+ }
920
+ }, {
921
+ key: "descendants",
922
+ value: function descendants(f) {
923
+ this.nodesBetween(0, this.content.size, f);
924
+ }
925
+ }, {
926
+ key: "textContent",
927
+ get: function get() {
928
+ return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
929
+ }
930
+ }, {
931
+ key: "textBetween",
932
+ value: function textBetween(from, to, blockSeparator, leafText) {
933
+ return this.content.textBetween(from, to, blockSeparator, leafText);
934
+ }
935
+ }, {
936
+ key: "firstChild",
937
+ get: function get() {
938
+ return this.content.firstChild;
939
+ }
940
+ }, {
941
+ key: "lastChild",
942
+ get: function get() {
943
+ return this.content.lastChild;
944
+ }
945
+ }, {
946
+ key: "eq",
947
+ value: function eq(other) {
948
+ return this == other || this.sameMarkup(other) && this.content.eq(other.content);
949
+ }
950
+ }, {
951
+ key: "sameMarkup",
952
+ value: function sameMarkup(other) {
953
+ return this.hasMarkup(other.type, other.attrs, other.marks);
954
+ }
955
+ }, {
956
+ key: "hasMarkup",
957
+ value: function hasMarkup(type, attrs, marks) {
958
+ return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark.sameSet(this.marks, marks || Mark.none);
959
+ }
960
+ }, {
961
+ key: "copy",
962
+ value: function copy() {
963
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
964
+ if (content == this.content) return this;
965
+ return new Node(this.type, this.attrs, content, this.marks);
966
+ }
967
+ }, {
968
+ key: "mark",
969
+ value: function mark(marks) {
970
+ return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);
971
+ }
972
+ }, {
973
+ key: "cut",
974
+ value: function cut(from) {
975
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.content.size;
976
+ if (from == 0 && to == this.content.size) return this;
977
+ return this.copy(this.content.cut(from, to));
978
+ }
979
+ }, {
980
+ key: "slice",
981
+ value: function slice(from) {
982
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.content.size;
983
+ var includeParents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
984
+ if (from == to) return Slice.empty;
985
+ var $from = this.resolve(from),
986
+ $to = this.resolve(to);
987
+ var depth = includeParents ? 0 : $from.sharedDepth(to);
988
+ var start = $from.start(depth),
989
+ node = $from.node(depth);
990
+ var content = node.content.cut($from.pos - start, $to.pos - start);
991
+ return new Slice(content, $from.depth - depth, $to.depth - depth);
992
+ }
993
+ }, {
994
+ key: "replace",
995
+ value: function replace(from, to, slice) {
996
+ return _replace(this.resolve(from), this.resolve(to), slice);
997
+ }
998
+ }, {
999
+ key: "nodeAt",
1000
+ value: function nodeAt(pos) {
1001
+ for (var node = this;;) {
1002
+ var _node$content$findInd2 = node.content.findIndex(pos),
1003
+ index = _node$content$findInd2.index,
1004
+ offset = _node$content$findInd2.offset;
1005
+ node = node.maybeChild(index);
1006
+ if (!node) return null;
1007
+ if (offset == pos || node.isText) return node;
1008
+ pos -= offset + 1;
1009
+ }
1010
+ }
1011
+ }, {
1012
+ key: "childAfter",
1013
+ value: function childAfter(pos) {
1014
+ var _this$content$findInd = this.content.findIndex(pos),
1015
+ index = _this$content$findInd.index,
1016
+ offset = _this$content$findInd.offset;
1017
+ return {
1018
+ node: this.content.maybeChild(index),
1019
+ index: index,
1020
+ offset: offset
1021
+ };
1022
+ }
1023
+ }, {
1024
+ key: "childBefore",
1025
+ value: function childBefore(pos) {
1026
+ if (pos == 0) return {
1027
+ node: null,
1028
+ index: 0,
1029
+ offset: 0
1030
+ };
1031
+ var _this$content$findInd2 = this.content.findIndex(pos),
1032
+ index = _this$content$findInd2.index,
1033
+ offset = _this$content$findInd2.offset;
1034
+ if (offset < pos) return {
1035
+ node: this.content.child(index),
1036
+ index: index,
1037
+ offset: offset
1038
+ };
1039
+ var node = this.content.child(index - 1);
1040
+ return {
1041
+ node: node,
1042
+ index: index - 1,
1043
+ offset: offset - node.nodeSize
1044
+ };
1045
+ }
1046
+ }, {
1047
+ key: "resolve",
1048
+ value: function resolve(pos) {
1049
+ return ResolvedPos.resolveCached(this, pos);
1050
+ }
1051
+ }, {
1052
+ key: "resolveNoCache",
1053
+ value: function resolveNoCache(pos) {
1054
+ return ResolvedPos.resolve(this, pos);
1055
+ }
1056
+ }, {
1057
+ key: "rangeHasMark",
1058
+ value: function rangeHasMark(from, to, type) {
1059
+ var found = false;
1060
+ if (to > from) this.nodesBetween(from, to, function (node) {
1061
+ if (type.isInSet(node.marks)) found = true;
1062
+ return !found;
1063
+ });
1064
+ return found;
1065
+ }
1066
+ }, {
1067
+ key: "isBlock",
1068
+ get: function get() {
1069
+ return this.type.isBlock;
1070
+ }
1071
+ }, {
1072
+ key: "isTextblock",
1073
+ get: function get() {
1074
+ return this.type.isTextblock;
1075
+ }
1076
+ }, {
1077
+ key: "inlineContent",
1078
+ get: function get() {
1079
+ return this.type.inlineContent;
1080
+ }
1081
+ }, {
1082
+ key: "isInline",
1083
+ get: function get() {
1084
+ return this.type.isInline;
1085
+ }
1086
+ }, {
1087
+ key: "isText",
1088
+ get: function get() {
1089
+ return this.type.isText;
1090
+ }
1091
+ }, {
1092
+ key: "isLeaf",
1093
+ get: function get() {
1094
+ return this.type.isLeaf;
1095
+ }
1096
+ }, {
1097
+ key: "isAtom",
1098
+ get: function get() {
1099
+ return this.type.isAtom;
1100
+ }
1101
+ }, {
1102
+ key: "toString",
1103
+ value: function toString() {
1104
+ if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
1105
+ var name = this.type.name;
1106
+ if (this.content.size) name += "(" + this.content.toStringInner() + ")";
1107
+ return wrapMarks(this.marks, name);
1108
+ }
1109
+ }, {
1110
+ key: "contentMatchAt",
1111
+ value: function contentMatchAt(index) {
1112
+ var match = this.type.contentMatch.matchFragment(this.content, 0, index);
1113
+ if (!match) throw new Error("Called contentMatchAt on a node with invalid content");
1114
+ return match;
1115
+ }
1116
+ }, {
1117
+ key: "canReplace",
1118
+ value: function canReplace(from, to) {
1119
+ var replacement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Fragment.empty;
1120
+ var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1121
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : replacement.childCount;
1122
+ var one = this.contentMatchAt(from).matchFragment(replacement, start, end);
1123
+ var two = one && one.matchFragment(this.content, to);
1124
+ if (!two || !two.validEnd) return false;
1125
+ for (var i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;
1126
+ return true;
1127
+ }
1128
+ }, {
1129
+ key: "canReplaceWith",
1130
+ value: function canReplaceWith(from, to, type, marks) {
1131
+ if (marks && !this.type.allowsMarks(marks)) return false;
1132
+ var start = this.contentMatchAt(from).matchType(type);
1133
+ var end = start && start.matchFragment(this.content, to);
1134
+ return end ? end.validEnd : false;
1135
+ }
1136
+ }, {
1137
+ key: "canAppend",
1138
+ value: function canAppend(other) {
1139
+ if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);else return this.type.compatibleContent(other.type);
1140
+ }
1141
+ }, {
1142
+ key: "check",
1143
+ value: function check() {
1144
+ this.type.checkContent(this.content);
1145
+ this.type.checkAttrs(this.attrs);
1146
+ var copy = Mark.none;
1147
+ for (var i = 0; i < this.marks.length; i++) {
1148
+ var mark = this.marks[i];
1149
+ mark.type.checkAttrs(mark.attrs);
1150
+ copy = mark.addToSet(copy);
1151
+ }
1152
+ if (!Mark.sameSet(copy, this.marks)) throw new RangeError("Invalid collection of marks for node ".concat(this.type.name, ": ").concat(this.marks.map(function (m) {
1153
+ return m.type.name;
1154
+ })));
1155
+ this.content.forEach(function (node) {
1156
+ return node.check();
1157
+ });
1158
+ }
1159
+ }, {
1160
+ key: "toJSON",
1161
+ value: function toJSON() {
1162
+ var obj = {
1163
+ type: this.type.name
1164
+ };
1165
+ for (var _ in this.attrs) {
1166
+ obj.attrs = this.attrs;
1167
+ break;
1168
+ }
1169
+ if (this.content.size) obj.content = this.content.toJSON();
1170
+ if (this.marks.length) obj.marks = this.marks.map(function (n) {
1171
+ return n.toJSON();
1172
+ });
1173
+ return obj;
1174
+ }
1175
+ }], [{
1176
+ key: "fromJSON",
1177
+ value: function fromJSON(schema, json) {
1178
+ if (!json) throw new RangeError("Invalid input for Node.fromJSON");
1179
+ var marks = undefined;
1180
+ if (json.marks) {
1181
+ if (!Array.isArray(json.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
1182
+ marks = json.marks.map(schema.markFromJSON);
1183
+ }
1184
+ if (json.type == "text") {
1185
+ if (typeof json.text != "string") throw new RangeError("Invalid text node in JSON");
1186
+ return schema.text(json.text, marks);
1187
+ }
1188
+ var content = Fragment.fromJSON(schema, json.content);
1189
+ var node = schema.nodeType(json.type).create(json.attrs, content, marks);
1190
+ node.type.checkAttrs(node.attrs);
1191
+ return node;
1192
+ }
1193
+ }]);
1194
+ return Node;
1195
+ }();
1196
+ Node.prototype.text = undefined;
1197
+ var TextNode = function (_Node) {
1198
+ _inherits(TextNode, _Node);
1199
+ var _super2 = _createSuper(TextNode);
1200
+ function TextNode(type, attrs, content, marks) {
1201
+ var _this;
1202
+ _classCallCheck(this, TextNode);
1203
+ _this = _super2.call(this, type, attrs, null, marks);
1204
+ if (!content) throw new RangeError("Empty text nodes are not allowed");
1205
+ _this.text = content;
1206
+ return _this;
1207
+ }
1208
+ _createClass(TextNode, [{
1209
+ key: "toString",
1210
+ value: function toString() {
1211
+ if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
1212
+ return wrapMarks(this.marks, JSON.stringify(this.text));
1213
+ }
1214
+ }, {
1215
+ key: "textContent",
1216
+ get: function get() {
1217
+ return this.text;
1218
+ }
1219
+ }, {
1220
+ key: "textBetween",
1221
+ value: function textBetween(from, to) {
1222
+ return this.text.slice(from, to);
1223
+ }
1224
+ }, {
1225
+ key: "nodeSize",
1226
+ get: function get() {
1227
+ return this.text.length;
1228
+ }
1229
+ }, {
1230
+ key: "mark",
1231
+ value: function mark(marks) {
1232
+ return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);
1233
+ }
1234
+ }, {
1235
+ key: "withText",
1236
+ value: function withText(text) {
1237
+ if (text == this.text) return this;
1238
+ return new TextNode(this.type, this.attrs, text, this.marks);
1239
+ }
1240
+ }, {
1241
+ key: "cut",
1242
+ value: function cut() {
1243
+ var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1244
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.text.length;
1245
+ if (from == 0 && to == this.text.length) return this;
1246
+ return this.withText(this.text.slice(from, to));
1247
+ }
1248
+ }, {
1249
+ key: "eq",
1250
+ value: function eq(other) {
1251
+ return this.sameMarkup(other) && this.text == other.text;
1252
+ }
1253
+ }, {
1254
+ key: "toJSON",
1255
+ value: function toJSON() {
1256
+ var base = _get(_getPrototypeOf(TextNode.prototype), "toJSON", this).call(this);
1257
+ base.text = this.text;
1258
+ return base;
1259
+ }
1260
+ }]);
1261
+ return TextNode;
1262
+ }(Node);
1263
+ function wrapMarks(marks, str) {
1264
+ for (var i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
1265
+ return str;
1266
+ }
1267
+ var ContentMatch = function () {
1268
+ function ContentMatch(validEnd) {
1269
+ _classCallCheck(this, ContentMatch);
1270
+ this.validEnd = validEnd;
1271
+ this.next = [];
1272
+ this.wrapCache = [];
1273
+ }
1274
+ _createClass(ContentMatch, [{
1275
+ key: "matchType",
1276
+ value: function matchType(type) {
1277
+ for (var i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;
1278
+ return null;
1279
+ }
1280
+ }, {
1281
+ key: "matchFragment",
1282
+ value: function matchFragment(frag) {
1283
+ var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1284
+ var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : frag.childCount;
1285
+ var cur = this;
1286
+ for (var i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);
1287
+ return cur;
1288
+ }
1289
+ }, {
1290
+ key: "inlineContent",
1291
+ get: function get() {
1292
+ return this.next.length != 0 && this.next[0].type.isInline;
1293
+ }
1294
+ }, {
1295
+ key: "defaultType",
1296
+ get: function get() {
1297
+ for (var i = 0; i < this.next.length; i++) {
1298
+ var type = this.next[i].type;
1299
+ if (!(type.isText || type.hasRequiredAttrs())) return type;
1300
+ }
1301
+ return null;
1302
+ }
1303
+ }, {
1304
+ key: "compatible",
1305
+ value: function compatible(other) {
1306
+ for (var i = 0; i < this.next.length; i++) for (var j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;
1307
+ return false;
1308
+ }
1309
+ }, {
1310
+ key: "fillBefore",
1311
+ value: function fillBefore(after) {
1312
+ var toEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1313
+ var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1314
+ var seen = [this];
1315
+ function search(match, types) {
1316
+ var finished = match.matchFragment(after, startIndex);
1317
+ if (finished && (!toEnd || finished.validEnd)) return Fragment.from(types.map(function (tp) {
1318
+ return tp.createAndFill();
1319
+ }));
1320
+ for (var i = 0; i < match.next.length; i++) {
1321
+ var _match$next$i = match.next[i],
1322
+ type = _match$next$i.type,
1323
+ next = _match$next$i.next;
1324
+ if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
1325
+ seen.push(next);
1326
+ var _found = search(next, types.concat(type));
1327
+ if (_found) return _found;
1328
+ }
1329
+ }
1330
+ return null;
1331
+ }
1332
+ return search(this, []);
1333
+ }
1334
+ }, {
1335
+ key: "findWrapping",
1336
+ value: function findWrapping(target) {
1337
+ for (var i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];
1338
+ var computed = this.computeWrapping(target);
1339
+ this.wrapCache.push(target, computed);
1340
+ return computed;
1341
+ }
1342
+ }, {
1343
+ key: "computeWrapping",
1344
+ value: function computeWrapping(target) {
1345
+ var seen = Object.create(null),
1346
+ active = [{
1347
+ match: this,
1348
+ type: null,
1349
+ via: null
1350
+ }];
1351
+ while (active.length) {
1352
+ var current = active.shift(),
1353
+ match = current.match;
1354
+ if (match.matchType(target)) {
1355
+ var result = [];
1356
+ for (var obj = current; obj.type; obj = obj.via) result.push(obj.type);
1357
+ return result.reverse();
1358
+ }
1359
+ for (var i = 0; i < match.next.length; i++) {
1360
+ var _match$next$i2 = match.next[i],
1361
+ type = _match$next$i2.type,
1362
+ next = _match$next$i2.next;
1363
+ if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {
1364
+ active.push({
1365
+ match: type.contentMatch,
1366
+ type: type,
1367
+ via: current
1368
+ });
1369
+ seen[type.name] = true;
1370
+ }
1371
+ }
1372
+ }
1373
+ return null;
1374
+ }
1375
+ }, {
1376
+ key: "edgeCount",
1377
+ get: function get() {
1378
+ return this.next.length;
1379
+ }
1380
+ }, {
1381
+ key: "edge",
1382
+ value: function edge(n) {
1383
+ if (n >= this.next.length) throw new RangeError("There's no ".concat(n, "th edge in this content match"));
1384
+ return this.next[n];
1385
+ }
1386
+ }, {
1387
+ key: "toString",
1388
+ value: function toString() {
1389
+ var seen = [];
1390
+ function scan(m) {
1391
+ seen.push(m);
1392
+ for (var i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);
1393
+ }
1394
+ scan(this);
1395
+ return seen.map(function (m, i) {
1396
+ var out = i + (m.validEnd ? "*" : " ") + " ";
1397
+ for (var _i = 0; _i < m.next.length; _i++) out += (_i ? ", " : "") + m.next[_i].type.name + "->" + seen.indexOf(m.next[_i].next);
1398
+ return out;
1399
+ }).join("\n");
1400
+ }
1401
+ }], [{
1402
+ key: "parse",
1403
+ value: function parse(string, nodeTypes) {
1404
+ var stream = new TokenStream(string, nodeTypes);
1405
+ if (stream.next == null) return ContentMatch.empty;
1406
+ var expr = parseExpr(stream);
1407
+ if (stream.next) stream.err("Unexpected trailing text");
1408
+ var match = dfa(nfa(expr));
1409
+ checkForDeadEnds(match, stream);
1410
+ return match;
1411
+ }
1412
+ }]);
1413
+ return ContentMatch;
1414
+ }();
1415
+ ContentMatch.empty = new ContentMatch(true);
1416
+ var TokenStream = function () {
1417
+ function TokenStream(string, nodeTypes) {
1418
+ _classCallCheck(this, TokenStream);
1419
+ this.string = string;
1420
+ this.nodeTypes = nodeTypes;
1421
+ this.inline = null;
1422
+ this.pos = 0;
1423
+ this.tokens = string.split(/\s*(?=\b|\W|$)/);
1424
+ if (this.tokens[this.tokens.length - 1] == "") this.tokens.pop();
1425
+ if (this.tokens[0] == "") this.tokens.shift();
1426
+ }
1427
+ _createClass(TokenStream, [{
1428
+ key: "next",
1429
+ get: function get() {
1430
+ return this.tokens[this.pos];
1431
+ }
1432
+ }, {
1433
+ key: "eat",
1434
+ value: function eat(tok) {
1435
+ return this.next == tok && (this.pos++ || true);
1436
+ }
1437
+ }, {
1438
+ key: "err",
1439
+ value: function err(str) {
1440
+ throw new SyntaxError(str + " (in content expression '" + this.string + "')");
1441
+ }
1442
+ }]);
1443
+ return TokenStream;
1444
+ }();
1445
+ function parseExpr(stream) {
1446
+ var exprs = [];
1447
+ do {
1448
+ exprs.push(parseExprSeq(stream));
1449
+ } while (stream.eat("|"));
1450
+ return exprs.length == 1 ? exprs[0] : {
1451
+ type: "choice",
1452
+ exprs: exprs
1453
+ };
1454
+ }
1455
+ function parseExprSeq(stream) {
1456
+ var exprs = [];
1457
+ do {
1458
+ exprs.push(parseExprSubscript(stream));
1459
+ } while (stream.next && stream.next != ")" && stream.next != "|");
1460
+ return exprs.length == 1 ? exprs[0] : {
1461
+ type: "seq",
1462
+ exprs: exprs
1463
+ };
1464
+ }
1465
+ function parseExprSubscript(stream) {
1466
+ var expr = parseExprAtom(stream);
1467
+ for (;;) {
1468
+ if (stream.eat("+")) expr = {
1469
+ type: "plus",
1470
+ expr: expr
1471
+ };else if (stream.eat("*")) expr = {
1472
+ type: "star",
1473
+ expr: expr
1474
+ };else if (stream.eat("?")) expr = {
1475
+ type: "opt",
1476
+ expr: expr
1477
+ };else if (stream.eat("{")) expr = parseExprRange(stream, expr);else break;
1478
+ }
1479
+ return expr;
1480
+ }
1481
+ function parseNum(stream) {
1482
+ if (/\D/.test(stream.next)) stream.err("Expected number, got '" + stream.next + "'");
1483
+ var result = Number(stream.next);
1484
+ stream.pos++;
1485
+ return result;
1486
+ }
1487
+ function parseExprRange(stream, expr) {
1488
+ var min = parseNum(stream),
1489
+ max = min;
1490
+ if (stream.eat(",")) {
1491
+ if (stream.next != "}") max = parseNum(stream);else max = -1;
1492
+ }
1493
+ if (!stream.eat("}")) stream.err("Unclosed braced range");
1494
+ return {
1495
+ type: "range",
1496
+ min: min,
1497
+ max: max,
1498
+ expr: expr
1499
+ };
1500
+ }
1501
+ function resolveName(stream, name) {
1502
+ var types = stream.nodeTypes,
1503
+ type = types[name];
1504
+ if (type) return [type];
1505
+ var result = [];
1506
+ for (var typeName in types) {
1507
+ var _type = types[typeName];
1508
+ if (_type.isInGroup(name)) result.push(_type);
1509
+ }
1510
+ if (result.length == 0) stream.err("No node type or group '" + name + "' found");
1511
+ return result;
1512
+ }
1513
+ function parseExprAtom(stream) {
1514
+ if (stream.eat("(")) {
1515
+ var expr = parseExpr(stream);
1516
+ if (!stream.eat(")")) stream.err("Missing closing paren");
1517
+ return expr;
1518
+ } else if (!/\W/.test(stream.next)) {
1519
+ var exprs = resolveName(stream, stream.next).map(function (type) {
1520
+ if (stream.inline == null) stream.inline = type.isInline;else if (stream.inline != type.isInline) stream.err("Mixing inline and block content");
1521
+ return {
1522
+ type: "name",
1523
+ value: type
1524
+ };
1525
+ });
1526
+ stream.pos++;
1527
+ return exprs.length == 1 ? exprs[0] : {
1528
+ type: "choice",
1529
+ exprs: exprs
1530
+ };
1531
+ } else {
1532
+ stream.err("Unexpected token '" + stream.next + "'");
1533
+ }
1534
+ }
1535
+ function nfa(expr) {
1536
+ var nfa = [[]];
1537
+ connect(compile(expr, 0), node());
1538
+ return nfa;
1539
+ function node() {
1540
+ return nfa.push([]) - 1;
1541
+ }
1542
+ function edge(from, to, term) {
1543
+ var edge = {
1544
+ term: term,
1545
+ to: to
1546
+ };
1547
+ nfa[from].push(edge);
1548
+ return edge;
1549
+ }
1550
+ function connect(edges, to) {
1551
+ edges.forEach(function (edge) {
1552
+ return edge.to = to;
1553
+ });
1554
+ }
1555
+ function compile(expr, from) {
1556
+ if (expr.type == "choice") {
1557
+ return expr.exprs.reduce(function (out, expr) {
1558
+ return out.concat(compile(expr, from));
1559
+ }, []);
1560
+ } else if (expr.type == "seq") {
1561
+ for (var i = 0;; i++) {
1562
+ var next = compile(expr.exprs[i], from);
1563
+ if (i == expr.exprs.length - 1) return next;
1564
+ connect(next, from = node());
1565
+ }
1566
+ } else if (expr.type == "star") {
1567
+ var loop = node();
1568
+ edge(from, loop);
1569
+ connect(compile(expr.expr, loop), loop);
1570
+ return [edge(loop)];
1571
+ } else if (expr.type == "plus") {
1572
+ var _loop = node();
1573
+ connect(compile(expr.expr, from), _loop);
1574
+ connect(compile(expr.expr, _loop), _loop);
1575
+ return [edge(_loop)];
1576
+ } else if (expr.type == "opt") {
1577
+ return [edge(from)].concat(compile(expr.expr, from));
1578
+ } else if (expr.type == "range") {
1579
+ var cur = from;
1580
+ for (var _i2 = 0; _i2 < expr.min; _i2++) {
1581
+ var _next = node();
1582
+ connect(compile(expr.expr, cur), _next);
1583
+ cur = _next;
1584
+ }
1585
+ if (expr.max == -1) {
1586
+ connect(compile(expr.expr, cur), cur);
1587
+ } else {
1588
+ for (var _i3 = expr.min; _i3 < expr.max; _i3++) {
1589
+ var _next2 = node();
1590
+ edge(cur, _next2);
1591
+ connect(compile(expr.expr, cur), _next2);
1592
+ cur = _next2;
1593
+ }
1594
+ }
1595
+ return [edge(cur)];
1596
+ } else if (expr.type == "name") {
1597
+ return [edge(from, undefined, expr.value)];
1598
+ } else {
1599
+ throw new Error("Unknown expr type");
1600
+ }
1601
+ }
1602
+ }
1603
+ function cmp(a, b) {
1604
+ return b - a;
1605
+ }
1606
+ function nullFrom(nfa, node) {
1607
+ var result = [];
1608
+ scan(node);
1609
+ return result.sort(cmp);
1610
+ function scan(node) {
1611
+ var edges = nfa[node];
1612
+ if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);
1613
+ result.push(node);
1614
+ for (var i = 0; i < edges.length; i++) {
1615
+ var _edges$i = edges[i],
1616
+ term = _edges$i.term,
1617
+ to = _edges$i.to;
1618
+ if (!term && result.indexOf(to) == -1) scan(to);
1619
+ }
1620
+ }
1621
+ }
1622
+ function dfa(nfa) {
1623
+ var labeled = Object.create(null);
1624
+ return explore(nullFrom(nfa, 0));
1625
+ function explore(states) {
1626
+ var out = [];
1627
+ states.forEach(function (node) {
1628
+ nfa[node].forEach(function (_ref) {
1629
+ var term = _ref.term,
1630
+ to = _ref.to;
1631
+ if (!term) return;
1632
+ var set;
1633
+ for (var i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];
1634
+ nullFrom(nfa, to).forEach(function (node) {
1635
+ if (!set) out.push([term, set = []]);
1636
+ if (set.indexOf(node) == -1) set.push(node);
1637
+ });
1638
+ });
1639
+ });
1640
+ var state = labeled[states.join(",")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);
1641
+ for (var i = 0; i < out.length; i++) {
1642
+ var _states = out[i][1].sort(cmp);
1643
+ state.next.push({
1644
+ type: out[i][0],
1645
+ next: labeled[_states.join(",")] || explore(_states)
1646
+ });
1647
+ }
1648
+ return state;
1649
+ }
1650
+ }
1651
+ function checkForDeadEnds(match, stream) {
1652
+ for (var i = 0, work = [match]; i < work.length; i++) {
1653
+ var state = work[i],
1654
+ dead = !state.validEnd,
1655
+ nodes = [];
1656
+ for (var j = 0; j < state.next.length; j++) {
1657
+ var _state$next$j = state.next[j],
1658
+ type = _state$next$j.type,
1659
+ next = _state$next$j.next;
1660
+ nodes.push(type.name);
1661
+ if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;
1662
+ if (work.indexOf(next) == -1) work.push(next);
1663
+ }
1664
+ if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1665
+ }
1666
+ }
1667
+ function defaultAttrs(attrs) {
1668
+ var defaults = Object.create(null);
1669
+ for (var attrName in attrs) {
1670
+ var attr = attrs[attrName];
1671
+ if (!attr.hasDefault) return null;
1672
+ defaults[attrName] = attr["default"];
1673
+ }
1674
+ return defaults;
1675
+ }
1676
+ function _computeAttrs(attrs, value) {
1677
+ var built = Object.create(null);
1678
+ for (var name in attrs) {
1679
+ var given = value && value[name];
1680
+ if (given === undefined) {
1681
+ var attr = attrs[name];
1682
+ if (attr.hasDefault) given = attr["default"];else throw new RangeError("No value supplied for attribute " + name);
1683
+ }
1684
+ built[name] = given;
1685
+ }
1686
+ return built;
1687
+ }
1688
+ function _checkAttrs(attrs, values, type, name) {
1689
+ for (var _name in values) if (!(_name in attrs)) throw new RangeError("Unsupported attribute ".concat(_name, " for ").concat(type, " of type ").concat(_name));
1690
+ for (var _name2 in attrs) {
1691
+ var attr = attrs[_name2];
1692
+ if (attr.validate) attr.validate(values[_name2]);
1693
+ }
1694
+ }
1695
+ function initAttrs(typeName, attrs) {
1696
+ var result = Object.create(null);
1697
+ if (attrs) for (var name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
1698
+ return result;
1699
+ }
1700
+ var NodeType = function () {
1701
+ function NodeType(name, schema, spec) {
1702
+ _classCallCheck(this, NodeType);
1703
+ this.name = name;
1704
+ this.schema = schema;
1705
+ this.spec = spec;
1706
+ this.markSet = null;
1707
+ this.groups = spec.group ? spec.group.split(" ") : [];
1708
+ this.attrs = initAttrs(name, spec.attrs);
1709
+ this.defaultAttrs = defaultAttrs(this.attrs);
1710
+ this.contentMatch = null;
1711
+ this.inlineContent = null;
1712
+ this.isBlock = !(spec.inline || name == "text");
1713
+ this.isText = name == "text";
1714
+ }
1715
+ _createClass(NodeType, [{
1716
+ key: "isInline",
1717
+ get: function get() {
1718
+ return !this.isBlock;
1719
+ }
1720
+ }, {
1721
+ key: "isTextblock",
1722
+ get: function get() {
1723
+ return this.isBlock && this.inlineContent;
1724
+ }
1725
+ }, {
1726
+ key: "isLeaf",
1727
+ get: function get() {
1728
+ return this.contentMatch == ContentMatch.empty;
1729
+ }
1730
+ }, {
1731
+ key: "isAtom",
1732
+ get: function get() {
1733
+ return this.isLeaf || !!this.spec.atom;
1734
+ }
1735
+ }, {
1736
+ key: "isInGroup",
1737
+ value: function isInGroup(group) {
1738
+ return this.groups.indexOf(group) > -1;
1739
+ }
1740
+ }, {
1741
+ key: "whitespace",
1742
+ get: function get() {
1743
+ return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
1744
+ }
1745
+ }, {
1746
+ key: "hasRequiredAttrs",
1747
+ value: function hasRequiredAttrs() {
1748
+ for (var n in this.attrs) if (this.attrs[n].isRequired) return true;
1749
+ return false;
1750
+ }
1751
+ }, {
1752
+ key: "compatibleContent",
1753
+ value: function compatibleContent(other) {
1754
+ return this == other || this.contentMatch.compatible(other.contentMatch);
1755
+ }
1756
+ }, {
1757
+ key: "computeAttrs",
1758
+ value: function computeAttrs(attrs) {
1759
+ if (!attrs && this.defaultAttrs) return this.defaultAttrs;else return _computeAttrs(this.attrs, attrs);
1760
+ }
1761
+ }, {
1762
+ key: "create",
1763
+ value: function create() {
1764
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1765
+ var content = arguments.length > 1 ? arguments[1] : undefined;
1766
+ var marks = arguments.length > 2 ? arguments[2] : undefined;
1767
+ if (this.isText) throw new Error("NodeType.create can't construct text nodes");
1768
+ return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));
1769
+ }
1770
+ }, {
1771
+ key: "createChecked",
1772
+ value: function createChecked() {
1773
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1774
+ var content = arguments.length > 1 ? arguments[1] : undefined;
1775
+ var marks = arguments.length > 2 ? arguments[2] : undefined;
1776
+ content = Fragment.from(content);
1777
+ this.checkContent(content);
1778
+ return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));
1779
+ }
1780
+ }, {
1781
+ key: "createAndFill",
1782
+ value: function createAndFill() {
1783
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1784
+ var content = arguments.length > 1 ? arguments[1] : undefined;
1785
+ var marks = arguments.length > 2 ? arguments[2] : undefined;
1786
+ attrs = this.computeAttrs(attrs);
1787
+ content = Fragment.from(content);
1788
+ if (content.size) {
1789
+ var before = this.contentMatch.fillBefore(content);
1790
+ if (!before) return null;
1791
+ content = before.append(content);
1792
+ }
1793
+ var matched = this.contentMatch.matchFragment(content);
1794
+ var after = matched && matched.fillBefore(Fragment.empty, true);
1795
+ if (!after) return null;
1796
+ return new Node(this, attrs, content.append(after), Mark.setFrom(marks));
1797
+ }
1798
+ }, {
1799
+ key: "validContent",
1800
+ value: function validContent(content) {
1801
+ var result = this.contentMatch.matchFragment(content);
1802
+ if (!result || !result.validEnd) return false;
1803
+ for (var i = 0; i < content.childCount; i++) if (!this.allowsMarks(content.child(i).marks)) return false;
1804
+ return true;
1805
+ }
1806
+ }, {
1807
+ key: "checkContent",
1808
+ value: function checkContent(content) {
1809
+ if (!this.validContent(content)) throw new RangeError("Invalid content for node ".concat(this.name, ": ").concat(content.toString().slice(0, 50)));
1810
+ }
1811
+ }, {
1812
+ key: "checkAttrs",
1813
+ value: function checkAttrs(attrs) {
1814
+ _checkAttrs(this.attrs, attrs, "node", this.name);
1815
+ }
1816
+ }, {
1817
+ key: "allowsMarkType",
1818
+ value: function allowsMarkType(markType) {
1819
+ return this.markSet == null || this.markSet.indexOf(markType) > -1;
1820
+ }
1821
+ }, {
1822
+ key: "allowsMarks",
1823
+ value: function allowsMarks(marks) {
1824
+ if (this.markSet == null) return true;
1825
+ for (var i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) return false;
1826
+ return true;
1827
+ }
1828
+ }, {
1829
+ key: "allowedMarks",
1830
+ value: function allowedMarks(marks) {
1831
+ if (this.markSet == null) return marks;
1832
+ var copy;
1833
+ for (var i = 0; i < marks.length; i++) {
1834
+ if (!this.allowsMarkType(marks[i].type)) {
1835
+ if (!copy) copy = marks.slice(0, i);
1836
+ } else if (copy) {
1837
+ copy.push(marks[i]);
1838
+ }
1839
+ }
1840
+ return !copy ? marks : copy.length ? copy : Mark.none;
1841
+ }
1842
+ }], [{
1843
+ key: "compile",
1844
+ value: function compile(nodes, schema) {
1845
+ var result = Object.create(null);
1846
+ nodes.forEach(function (name, spec) {
1847
+ return result[name] = new NodeType(name, schema, spec);
1848
+ });
1849
+ var topType = schema.spec.topNode || "doc";
1850
+ if (!result[topType]) throw new RangeError("Schema is missing its top node type ('" + topType + "')");
1851
+ if (!result.text) throw new RangeError("Every schema needs a 'text' type");
1852
+ for (var _ in result.text.attrs) throw new RangeError("The text node type should not have attributes");
1853
+ return result;
1854
+ }
1855
+ }]);
1856
+ return NodeType;
1857
+ }();
1858
+ function validateType(typeName, attrName, type) {
1859
+ var types = type.split("|");
1860
+ return function (value) {
1861
+ var name = value === null ? "null" : _typeof(value);
1862
+ if (types.indexOf(name) < 0) throw new RangeError("Expected value of type ".concat(types, " for attribute ").concat(attrName, " on type ").concat(typeName, ", got ").concat(name));
1863
+ };
1864
+ }
1865
+ var Attribute = function () {
1866
+ function Attribute(typeName, attrName, options) {
1867
+ _classCallCheck(this, Attribute);
1868
+ this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
1869
+ this["default"] = options["default"];
1870
+ this.validate = typeof options.validate == "string" ? validateType(typeName, attrName, options.validate) : options.validate;
1871
+ }
1872
+ _createClass(Attribute, [{
1873
+ key: "isRequired",
1874
+ get: function get() {
1875
+ return !this.hasDefault;
1876
+ }
1877
+ }]);
1878
+ return Attribute;
1879
+ }();
1880
+ var MarkType = function () {
1881
+ function MarkType(name, rank, schema, spec) {
1882
+ _classCallCheck(this, MarkType);
1883
+ this.name = name;
1884
+ this.rank = rank;
1885
+ this.schema = schema;
1886
+ this.spec = spec;
1887
+ this.attrs = initAttrs(name, spec.attrs);
1888
+ this.excluded = null;
1889
+ var defaults = defaultAttrs(this.attrs);
1890
+ this.instance = defaults ? new Mark(this, defaults) : null;
1891
+ }
1892
+ _createClass(MarkType, [{
1893
+ key: "create",
1894
+ value: function create() {
1895
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1896
+ if (!attrs && this.instance) return this.instance;
1897
+ return new Mark(this, _computeAttrs(this.attrs, attrs));
1898
+ }
1899
+ }, {
1900
+ key: "removeFromSet",
1901
+ value: function removeFromSet(set) {
1902
+ for (var i = 0; i < set.length; i++) if (set[i].type == this) {
1903
+ set = set.slice(0, i).concat(set.slice(i + 1));
1904
+ i--;
1905
+ }
1906
+ return set;
1907
+ }
1908
+ }, {
1909
+ key: "isInSet",
1910
+ value: function isInSet(set) {
1911
+ for (var i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
1912
+ }
1913
+ }, {
1914
+ key: "checkAttrs",
1915
+ value: function checkAttrs(attrs) {
1916
+ _checkAttrs(this.attrs, attrs, "mark", this.name);
1917
+ }
1918
+ }, {
1919
+ key: "excludes",
1920
+ value: function excludes(other) {
1921
+ return this.excluded.indexOf(other) > -1;
1922
+ }
1923
+ }], [{
1924
+ key: "compile",
1925
+ value: function compile(marks, schema) {
1926
+ var result = Object.create(null),
1927
+ rank = 0;
1928
+ marks.forEach(function (name, spec) {
1929
+ return result[name] = new MarkType(name, rank++, schema, spec);
1930
+ });
1931
+ return result;
1932
+ }
1933
+ }]);
1934
+ return MarkType;
1935
+ }();
1936
+ var Schema = function () {
1937
+ function Schema(spec) {
1938
+ var _this2 = this;
1939
+ _classCallCheck(this, Schema);
1940
+ this.linebreakReplacement = null;
1941
+ this.cached = Object.create(null);
1942
+ var instanceSpec = this.spec = {};
1943
+ for (var prop in spec) instanceSpec[prop] = spec[prop];
1944
+ instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType.compile(this.spec.nodes, this);
1945
+ this.marks = MarkType.compile(this.spec.marks, this);
1946
+ var contentExprCache = Object.create(null);
1947
+ for (var _prop in this.nodes) {
1948
+ if (_prop in this.marks) throw new RangeError(_prop + " can not be both a node and a mark");
1949
+ var type = this.nodes[_prop],
1950
+ contentExpr = type.spec.content || "",
1951
+ markExpr = type.spec.marks;
1952
+ type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
1953
+ type.inlineContent = type.contentMatch.inlineContent;
1954
+ if (type.spec.linebreakReplacement) {
1955
+ if (this.linebreakReplacement) throw new RangeError("Multiple linebreak nodes defined");
1956
+ if (!type.isInline || !type.isLeaf) throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
1957
+ this.linebreakReplacement = type;
1958
+ }
1959
+ type.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type.inlineContent ? [] : null;
1960
+ }
1961
+ for (var _prop2 in this.marks) {
1962
+ var _type2 = this.marks[_prop2],
1963
+ excl = _type2.spec.excludes;
1964
+ _type2.excluded = excl == null ? [_type2] : excl == "" ? [] : gatherMarks(this, excl.split(" "));
1965
+ }
1966
+ this.nodeFromJSON = function (json) {
1967
+ return Node.fromJSON(_this2, json);
1968
+ };
1969
+ this.markFromJSON = function (json) {
1970
+ return Mark.fromJSON(_this2, json);
1971
+ };
1972
+ this.topNodeType = this.nodes[this.spec.topNode || "doc"];
1973
+ this.cached.wrappings = Object.create(null);
1974
+ }
1975
+ _createClass(Schema, [{
1976
+ key: "node",
1977
+ value: function node(type) {
1978
+ var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1979
+ var content = arguments.length > 2 ? arguments[2] : undefined;
1980
+ var marks = arguments.length > 3 ? arguments[3] : undefined;
1981
+ if (typeof type == "string") type = this.nodeType(type);else if (!(type instanceof NodeType)) throw new RangeError("Invalid node type: " + type);else if (type.schema != this) throw new RangeError("Node type from different schema used (" + type.name + ")");
1982
+ return type.createChecked(attrs, content, marks);
1983
+ }
1984
+ }, {
1985
+ key: "text",
1986
+ value: function text(_text, marks) {
1987
+ var type = this.nodes.text;
1988
+ return new TextNode(type, type.defaultAttrs, _text, Mark.setFrom(marks));
1989
+ }
1990
+ }, {
1991
+ key: "mark",
1992
+ value: function mark(type, attrs) {
1993
+ if (typeof type == "string") type = this.marks[type];
1994
+ return type.create(attrs);
1995
+ }
1996
+ }, {
1997
+ key: "nodeType",
1998
+ value: function nodeType(name) {
1999
+ var found = this.nodes[name];
2000
+ if (!found) throw new RangeError("Unknown node type: " + name);
2001
+ return found;
2002
+ }
2003
+ }]);
2004
+ return Schema;
2005
+ }();
2006
+ function gatherMarks(schema, marks) {
2007
+ var found = [];
2008
+ for (var i = 0; i < marks.length; i++) {
2009
+ var name = marks[i],
2010
+ mark = schema.marks[name],
2011
+ ok = mark;
2012
+ if (mark) {
2013
+ found.push(mark);
2014
+ } else {
2015
+ for (var prop in schema.marks) {
2016
+ var _mark = schema.marks[prop];
2017
+ if (name == "_" || _mark.spec.group && _mark.spec.group.split(" ").indexOf(name) > -1) found.push(ok = _mark);
2018
+ }
2019
+ }
2020
+ if (!ok) throw new SyntaxError("Unknown mark type: '" + marks[i] + "'");
2021
+ }
2022
+ return found;
2023
+ }
2024
+ function isTagRule(rule) {
2025
+ return rule.tag != null;
2026
+ }
2027
+ function isStyleRule(rule) {
2028
+ return rule.style != null;
2029
+ }
2030
+ var DOMParser = function () {
2031
+ function DOMParser(schema, rules) {
2032
+ var _this3 = this;
2033
+ _classCallCheck(this, DOMParser);
2034
+ this.schema = schema;
2035
+ this.rules = rules;
2036
+ this.tags = [];
2037
+ this.styles = [];
2038
+ var matchedStyles = this.matchedStyles = [];
2039
+ rules.forEach(function (rule) {
2040
+ if (isTagRule(rule)) {
2041
+ _this3.tags.push(rule);
2042
+ } else if (isStyleRule(rule)) {
2043
+ var prop = /[^=]*/.exec(rule.style)[0];
2044
+ if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop);
2045
+ _this3.styles.push(rule);
2046
+ }
2047
+ });
2048
+ this.normalizeLists = !this.tags.some(function (r) {
2049
+ if (!/^(ul|ol)\b/.test(r.tag) || !r.node) return false;
2050
+ var node = schema.nodes[r.node];
2051
+ return node.contentMatch.matchType(node);
2052
+ });
2053
+ }
2054
+ _createClass(DOMParser, [{
2055
+ key: "parse",
2056
+ value: function parse(dom) {
2057
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2058
+ var context = new ParseContext(this, options, false);
2059
+ context.addAll(dom, Mark.none, options.from, options.to);
2060
+ return context.finish();
2061
+ }
2062
+ }, {
2063
+ key: "parseSlice",
2064
+ value: function parseSlice(dom) {
2065
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2066
+ var context = new ParseContext(this, options, true);
2067
+ context.addAll(dom, Mark.none, options.from, options.to);
2068
+ return Slice.maxOpen(context.finish());
2069
+ }
2070
+ }, {
2071
+ key: "matchTag",
2072
+ value: function matchTag(dom, context, after) {
2073
+ for (var i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {
2074
+ var rule = this.tags[i];
2075
+ if (matches(dom, rule.tag) && (rule.namespace === undefined || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) {
2076
+ if (rule.getAttrs) {
2077
+ var result = rule.getAttrs(dom);
2078
+ if (result === false) continue;
2079
+ rule.attrs = result || undefined;
2080
+ }
2081
+ return rule;
2082
+ }
2083
+ }
2084
+ }
2085
+ }, {
2086
+ key: "matchStyle",
2087
+ value: function matchStyle(prop, value, context, after) {
2088
+ for (var i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {
2089
+ var rule = this.styles[i],
2090
+ style = rule.style;
2091
+ if (style.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) || style.length > prop.length && (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value)) continue;
2092
+ if (rule.getAttrs) {
2093
+ var result = rule.getAttrs(value);
2094
+ if (result === false) continue;
2095
+ rule.attrs = result || undefined;
2096
+ }
2097
+ return rule;
2098
+ }
2099
+ }
2100
+ }], [{
2101
+ key: "schemaRules",
2102
+ value: function schemaRules(schema) {
2103
+ var result = [];
2104
+ function insert(rule) {
2105
+ var priority = rule.priority == null ? 50 : rule.priority,
2106
+ i = 0;
2107
+ for (; i < result.length; i++) {
2108
+ var next = result[i],
2109
+ nextPriority = next.priority == null ? 50 : next.priority;
2110
+ if (nextPriority < priority) break;
2111
+ }
2112
+ result.splice(i, 0, rule);
2113
+ }
2114
+ var _loop2 = function _loop2(name) {
2115
+ var rules = schema.marks[name].spec.parseDOM;
2116
+ if (rules) rules.forEach(function (rule) {
2117
+ insert(rule = copy(rule));
2118
+ if (!(rule.mark || rule.ignore || rule.clearMark)) rule.mark = name;
2119
+ });
2120
+ };
2121
+ for (var name in schema.marks) {
2122
+ _loop2(name);
2123
+ }
2124
+ var _loop3 = function _loop3(_name3) {
2125
+ var rules = schema.nodes[_name3].spec.parseDOM;
2126
+ if (rules) rules.forEach(function (rule) {
2127
+ insert(rule = copy(rule));
2128
+ if (!(rule.node || rule.ignore || rule.mark)) rule.node = _name3;
2129
+ });
2130
+ };
2131
+ for (var _name3 in schema.nodes) {
2132
+ _loop3(_name3);
2133
+ }
2134
+ return result;
2135
+ }
2136
+ }, {
2137
+ key: "fromSchema",
2138
+ value: function fromSchema(schema) {
2139
+ return schema.cached.domParser || (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));
2140
+ }
2141
+ }]);
2142
+ return DOMParser;
2143
+ }();
2144
+ var blockTags = {
2145
+ address: true,
2146
+ article: true,
2147
+ aside: true,
2148
+ blockquote: true,
2149
+ canvas: true,
2150
+ dd: true,
2151
+ div: true,
2152
+ dl: true,
2153
+ fieldset: true,
2154
+ figcaption: true,
2155
+ figure: true,
2156
+ footer: true,
2157
+ form: true,
2158
+ h1: true,
2159
+ h2: true,
2160
+ h3: true,
2161
+ h4: true,
2162
+ h5: true,
2163
+ h6: true,
2164
+ header: true,
2165
+ hgroup: true,
2166
+ hr: true,
2167
+ li: true,
2168
+ noscript: true,
2169
+ ol: true,
2170
+ output: true,
2171
+ p: true,
2172
+ pre: true,
2173
+ section: true,
2174
+ table: true,
2175
+ tfoot: true,
2176
+ ul: true
2177
+ };
2178
+ var ignoreTags = {
2179
+ head: true,
2180
+ noscript: true,
2181
+ object: true,
2182
+ script: true,
2183
+ style: true,
2184
+ title: true
2185
+ };
2186
+ var listTags = {
2187
+ ol: true,
2188
+ ul: true
2189
+ };
2190
+ var OPT_PRESERVE_WS = 1,
2191
+ OPT_PRESERVE_WS_FULL = 2,
2192
+ OPT_OPEN_LEFT = 4;
2193
+ function wsOptionsFor(type, preserveWhitespace, base) {
2194
+ if (preserveWhitespace != null) return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
2195
+ return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;
2196
+ }
2197
+ var NodeContext = function () {
2198
+ function NodeContext(type, attrs, marks, solid, match, options) {
2199
+ _classCallCheck(this, NodeContext);
2200
+ this.type = type;
2201
+ this.attrs = attrs;
2202
+ this.marks = marks;
2203
+ this.solid = solid;
2204
+ this.options = options;
2205
+ this.content = [];
2206
+ this.activeMarks = Mark.none;
2207
+ this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
2208
+ }
2209
+ _createClass(NodeContext, [{
2210
+ key: "findWrapping",
2211
+ value: function findWrapping(node) {
2212
+ if (!this.match) {
2213
+ if (!this.type) return [];
2214
+ var fill = this.type.contentMatch.fillBefore(Fragment.from(node));
2215
+ if (fill) {
2216
+ this.match = this.type.contentMatch.matchFragment(fill);
2217
+ } else {
2218
+ var start = this.type.contentMatch,
2219
+ wrap;
2220
+ if (wrap = start.findWrapping(node.type)) {
2221
+ this.match = start;
2222
+ return wrap;
2223
+ } else {
2224
+ return null;
2225
+ }
2226
+ }
2227
+ }
2228
+ return this.match.findWrapping(node.type);
2229
+ }
2230
+ }, {
2231
+ key: "finish",
2232
+ value: function finish(openEnd) {
2233
+ if (!(this.options & OPT_PRESERVE_WS)) {
2234
+ var last = this.content[this.content.length - 1],
2235
+ m;
2236
+ if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
2237
+ var text = last;
2238
+ if (last.text.length == m[0].length) this.content.pop();else this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
2239
+ }
2240
+ }
2241
+ var content = Fragment.from(this.content);
2242
+ if (!openEnd && this.match) content = content.append(this.match.fillBefore(Fragment.empty, true));
2243
+ return this.type ? this.type.create(this.attrs, content, this.marks) : content;
2244
+ }
2245
+ }, {
2246
+ key: "inlineContext",
2247
+ value: function inlineContext(node) {
2248
+ if (this.type) return this.type.inlineContent;
2249
+ if (this.content.length) return this.content[0].isInline;
2250
+ return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());
2251
+ }
2252
+ }]);
2253
+ return NodeContext;
2254
+ }();
2255
+ var ParseContext = function () {
2256
+ function ParseContext(parser, options, isOpen) {
2257
+ _classCallCheck(this, ParseContext);
2258
+ this.parser = parser;
2259
+ this.options = options;
2260
+ this.isOpen = isOpen;
2261
+ this.open = 0;
2262
+ this.localPreserveWS = false;
2263
+ var topNode = options.topNode,
2264
+ topContext;
2265
+ var topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
2266
+ if (topNode) topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);else if (isOpen) topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);else topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);
2267
+ this.nodes = [topContext];
2268
+ this.find = options.findPositions;
2269
+ this.needsBlock = false;
2270
+ }
2271
+ _createClass(ParseContext, [{
2272
+ key: "top",
2273
+ get: function get() {
2274
+ return this.nodes[this.open];
2275
+ }
2276
+ }, {
2277
+ key: "addDOM",
2278
+ value: function addDOM(dom, marks) {
2279
+ if (dom.nodeType == 3) this.addTextNode(dom, marks);else if (dom.nodeType == 1) this.addElement(dom, marks);
2280
+ }
2281
+ }, {
2282
+ key: "addTextNode",
2283
+ value: function addTextNode(dom, marks) {
2284
+ var value = dom.nodeValue;
2285
+ var top = this.top,
2286
+ preserveWS = top.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;
2287
+ var schema = this.parser.schema;
2288
+ if (preserveWS === "full" || top.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
2289
+ if (!preserveWS) {
2290
+ value = value.replace(/[ \t\r\n\u000c]+/g, " ");
2291
+ if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
2292
+ var nodeBefore = top.content[top.content.length - 1];
2293
+ var domNodeBefore = dom.previousSibling;
2294
+ if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == 'BR' || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text)) value = value.slice(1);
2295
+ }
2296
+ } else if (preserveWS === "full") {
2297
+ value = value.replace(/\r\n?/g, "\n");
2298
+ } else if (schema.linebreakReplacement && /[\r\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {
2299
+ var lines = value.split(/\r?\n|\r/);
2300
+ for (var i = 0; i < lines.length; i++) {
2301
+ if (i) this.insertNode(schema.linebreakReplacement.create(), marks, true);
2302
+ if (lines[i]) this.insertNode(schema.text(lines[i]), marks, !/\S/.test(lines[i]));
2303
+ }
2304
+ value = "";
2305
+ } else {
2306
+ value = value.replace(/\r?\n|\r/g, " ");
2307
+ }
2308
+ if (value) this.insertNode(schema.text(value), marks, !/\S/.test(value));
2309
+ this.findInText(dom);
2310
+ } else {
2311
+ this.findInside(dom);
2312
+ }
2313
+ }
2314
+ }, {
2315
+ key: "addElement",
2316
+ value: function addElement(dom, marks, matchAfter) {
2317
+ var outerWS = this.localPreserveWS,
2318
+ top = this.top;
2319
+ if (dom.tagName == "PRE" || /pre/.test(dom.style && dom.style.whiteSpace)) this.localPreserveWS = true;
2320
+ var name = dom.nodeName.toLowerCase(),
2321
+ ruleID;
2322
+ if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom);
2323
+ var rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
2324
+ out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
2325
+ this.findInside(dom);
2326
+ this.ignoreFallback(dom, marks);
2327
+ } else if (!rule || rule.skip || rule.closeParent) {
2328
+ if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1);else if (rule && rule.skip.nodeType) dom = rule.skip;
2329
+ var sync,
2330
+ oldNeedsBlock = this.needsBlock;
2331
+ if (blockTags.hasOwnProperty(name)) {
2332
+ if (top.content.length && top.content[0].isInline && this.open) {
2333
+ this.open--;
2334
+ top = this.top;
2335
+ }
2336
+ sync = true;
2337
+ if (!top.type) this.needsBlock = true;
2338
+ } else if (!dom.firstChild) {
2339
+ this.leafFallback(dom, marks);
2340
+ break out;
2341
+ }
2342
+ var innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
2343
+ if (innerMarks) this.addAll(dom, innerMarks);
2344
+ if (sync) this.sync(top);
2345
+ this.needsBlock = oldNeedsBlock;
2346
+ } else {
2347
+ var _innerMarks = this.readStyles(dom, marks);
2348
+ if (_innerMarks) this.addElementByRule(dom, rule, _innerMarks, rule.consuming === false ? ruleID : undefined);
2349
+ }
2350
+ this.localPreserveWS = outerWS;
2351
+ }
2352
+ }, {
2353
+ key: "leafFallback",
2354
+ value: function leafFallback(dom, marks) {
2355
+ if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent) this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
2356
+ }
2357
+ }, {
2358
+ key: "ignoreFallback",
2359
+ value: function ignoreFallback(dom, marks) {
2360
+ if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent)) this.findPlace(this.parser.schema.text("-"), marks, true);
2361
+ }
2362
+ }, {
2363
+ key: "readStyles",
2364
+ value: function readStyles(dom, marks) {
2365
+ var _this4 = this;
2366
+ var styles = dom.style;
2367
+ if (styles && styles.length) for (var i = 0; i < this.parser.matchedStyles.length; i++) {
2368
+ var name = this.parser.matchedStyles[i],
2369
+ value = styles.getPropertyValue(name);
2370
+ if (value) {
2371
+ var _loop4 = function _loop4(_after) {
2372
+ var rule = _this4.parser.matchStyle(name, value, _this4, _after);
2373
+ if (!rule) {
2374
+ after = _after;
2375
+ return 0;
2376
+ }
2377
+ if (rule.ignore) return {
2378
+ v: null
2379
+ };
2380
+ if (rule.clearMark) marks = marks.filter(function (m) {
2381
+ return !rule.clearMark(m);
2382
+ });else marks = marks.concat(_this4.parser.schema.marks[rule.mark].create(rule.attrs));
2383
+ if (rule.consuming === false) _after = rule;else {
2384
+ after = _after;
2385
+ return 0;
2386
+ }
2387
+ after = _after;
2388
+ },
2389
+ _ret;
2390
+ for (var after = undefined;;) {
2391
+ _ret = _loop4(after);
2392
+ if (_ret === 0) break;
2393
+ if (_ret) return _ret.v;
2394
+ }
2395
+ }
2396
+ }
2397
+ return marks;
2398
+ }
2399
+ }, {
2400
+ key: "addElementByRule",
2401
+ value: function addElementByRule(dom, rule, marks, continueAfter) {
2402
+ var _this5 = this;
2403
+ var sync, nodeType;
2404
+ if (rule.node) {
2405
+ nodeType = this.parser.schema.nodes[rule.node];
2406
+ if (!nodeType.isLeaf) {
2407
+ var inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
2408
+ if (inner) {
2409
+ sync = true;
2410
+ marks = inner;
2411
+ }
2412
+ } else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) {
2413
+ this.leafFallback(dom, marks);
2414
+ }
2415
+ } else {
2416
+ var markType = this.parser.schema.marks[rule.mark];
2417
+ marks = marks.concat(markType.create(rule.attrs));
2418
+ }
2419
+ var startIn = this.top;
2420
+ if (nodeType && nodeType.isLeaf) {
2421
+ this.findInside(dom);
2422
+ } else if (continueAfter) {
2423
+ this.addElement(dom, marks, continueAfter);
2424
+ } else if (rule.getContent) {
2425
+ this.findInside(dom);
2426
+ rule.getContent(dom, this.parser.schema).forEach(function (node) {
2427
+ return _this5.insertNode(node, marks, false);
2428
+ });
2429
+ } else {
2430
+ var contentDOM = dom;
2431
+ if (typeof rule.contentElement == "string") contentDOM = dom.querySelector(rule.contentElement);else if (typeof rule.contentElement == "function") contentDOM = rule.contentElement(dom);else if (rule.contentElement) contentDOM = rule.contentElement;
2432
+ this.findAround(dom, contentDOM, true);
2433
+ this.addAll(contentDOM, marks);
2434
+ this.findAround(dom, contentDOM, false);
2435
+ }
2436
+ if (sync && this.sync(startIn)) this.open--;
2437
+ }
2438
+ }, {
2439
+ key: "addAll",
2440
+ value: function addAll(parent, marks, startIndex, endIndex) {
2441
+ var index = startIndex || 0;
2442
+ for (var dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {
2443
+ this.findAtPoint(parent, index);
2444
+ this.addDOM(dom, marks);
2445
+ }
2446
+ this.findAtPoint(parent, index);
2447
+ }
2448
+ }, {
2449
+ key: "findPlace",
2450
+ value: function findPlace(node, marks, cautious) {
2451
+ var route, sync;
2452
+ for (var depth = this.open, penalty = 0; depth >= 0; depth--) {
2453
+ var cx = this.nodes[depth];
2454
+ var _found2 = cx.findWrapping(node);
2455
+ if (_found2 && (!route || route.length > _found2.length + penalty)) {
2456
+ route = _found2;
2457
+ sync = cx;
2458
+ if (!_found2.length) break;
2459
+ }
2460
+ if (cx.solid) {
2461
+ if (cautious) break;
2462
+ penalty += 2;
2463
+ }
2464
+ }
2465
+ if (!route) return null;
2466
+ this.sync(sync);
2467
+ for (var i = 0; i < route.length; i++) marks = this.enterInner(route[i], null, marks, false);
2468
+ return marks;
2469
+ }
2470
+ }, {
2471
+ key: "insertNode",
2472
+ value: function insertNode(node, marks, cautious) {
2473
+ if (node.isInline && this.needsBlock && !this.top.type) {
2474
+ var block = this.textblockFromContext();
2475
+ if (block) marks = this.enterInner(block, null, marks);
2476
+ }
2477
+ var innerMarks = this.findPlace(node, marks, cautious);
2478
+ if (innerMarks) {
2479
+ this.closeExtra();
2480
+ var top = this.top;
2481
+ if (top.match) top.match = top.match.matchType(node.type);
2482
+ var nodeMarks = Mark.none;
2483
+ var _iterator = _createForOfIteratorHelper(innerMarks.concat(node.marks)),
2484
+ _step;
2485
+ try {
2486
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2487
+ var m = _step.value;
2488
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type)) nodeMarks = m.addToSet(nodeMarks);
2489
+ }
2490
+ } catch (err) {
2491
+ _iterator.e(err);
2492
+ } finally {
2493
+ _iterator.f();
2494
+ }
2495
+ top.content.push(node.mark(nodeMarks));
2496
+ return true;
2497
+ }
2498
+ return false;
2499
+ }
2500
+ }, {
2501
+ key: "enter",
2502
+ value: function enter(type, attrs, marks, preserveWS) {
2503
+ var innerMarks = this.findPlace(type.create(attrs), marks, false);
2504
+ if (innerMarks) innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
2505
+ return innerMarks;
2506
+ }
2507
+ }, {
2508
+ key: "enterInner",
2509
+ value: function enterInner(type, attrs, marks) {
2510
+ var solid = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2511
+ var preserveWS = arguments.length > 4 ? arguments[4] : undefined;
2512
+ this.closeExtra();
2513
+ var top = this.top;
2514
+ top.match = top.match && top.match.matchType(type);
2515
+ var options = wsOptionsFor(type, preserveWS, top.options);
2516
+ if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options |= OPT_OPEN_LEFT;
2517
+ var applyMarks = Mark.none;
2518
+ marks = marks.filter(function (m) {
2519
+ if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
2520
+ applyMarks = m.addToSet(applyMarks);
2521
+ return false;
2522
+ }
2523
+ return true;
2524
+ });
2525
+ this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
2526
+ this.open++;
2527
+ return marks;
2528
+ }
2529
+ }, {
2530
+ key: "closeExtra",
2531
+ value: function closeExtra() {
2532
+ var openEnd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2533
+ var i = this.nodes.length - 1;
2534
+ if (i > this.open) {
2535
+ for (; i > this.open; i--) this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));
2536
+ this.nodes.length = this.open + 1;
2537
+ }
2538
+ }
2539
+ }, {
2540
+ key: "finish",
2541
+ value: function finish() {
2542
+ this.open = 0;
2543
+ this.closeExtra(this.isOpen);
2544
+ return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
2545
+ }
2546
+ }, {
2547
+ key: "sync",
2548
+ value: function sync(to) {
2549
+ for (var i = this.open; i >= 0; i--) {
2550
+ if (this.nodes[i] == to) {
2551
+ this.open = i;
2552
+ return true;
2553
+ } else if (this.localPreserveWS) {
2554
+ this.nodes[i].options |= OPT_PRESERVE_WS;
2555
+ }
2556
+ }
2557
+ return false;
2558
+ }
2559
+ }, {
2560
+ key: "currentPos",
2561
+ get: function get() {
2562
+ this.closeExtra();
2563
+ var pos = 0;
2564
+ for (var i = this.open; i >= 0; i--) {
2565
+ var content = this.nodes[i].content;
2566
+ for (var j = content.length - 1; j >= 0; j--) pos += content[j].nodeSize;
2567
+ if (i) pos++;
2568
+ }
2569
+ return pos;
2570
+ }
2571
+ }, {
2572
+ key: "findAtPoint",
2573
+ value: function findAtPoint(parent, offset) {
2574
+ if (this.find) for (var i = 0; i < this.find.length; i++) {
2575
+ if (this.find[i].node == parent && this.find[i].offset == offset) this.find[i].pos = this.currentPos;
2576
+ }
2577
+ }
2578
+ }, {
2579
+ key: "findInside",
2580
+ value: function findInside(parent) {
2581
+ if (this.find) for (var i = 0; i < this.find.length; i++) {
2582
+ if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) this.find[i].pos = this.currentPos;
2583
+ }
2584
+ }
2585
+ }, {
2586
+ key: "findAround",
2587
+ value: function findAround(parent, content, before) {
2588
+ if (parent != content && this.find) for (var i = 0; i < this.find.length; i++) {
2589
+ if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {
2590
+ var pos = content.compareDocumentPosition(this.find[i].node);
2591
+ if (pos & (before ? 2 : 4)) this.find[i].pos = this.currentPos;
2592
+ }
2593
+ }
2594
+ }
2595
+ }, {
2596
+ key: "findInText",
2597
+ value: function findInText(textNode) {
2598
+ if (this.find) for (var i = 0; i < this.find.length; i++) {
2599
+ if (this.find[i].node == textNode) this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);
2600
+ }
2601
+ }
2602
+ }, {
2603
+ key: "matchesContext",
2604
+ value: function matchesContext(context) {
2605
+ var _this6 = this;
2606
+ if (context.indexOf("|") > -1) return context.split(/\s*\|\s*/).some(this.matchesContext, this);
2607
+ var parts = context.split("/");
2608
+ var option = this.options.context;
2609
+ var useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);
2610
+ var minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);
2611
+ var match = function match(i, depth) {
2612
+ for (; i >= 0; i--) {
2613
+ var part = parts[i];
2614
+ if (part == "") {
2615
+ if (i == parts.length - 1 || i == 0) continue;
2616
+ for (; depth >= minDepth; depth--) if (match(i - 1, depth)) return true;
2617
+ return false;
2618
+ } else {
2619
+ var next = depth > 0 || depth == 0 && useRoot ? _this6.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null;
2620
+ if (!next || next.name != part && !next.isInGroup(part)) return false;
2621
+ depth--;
2622
+ }
2623
+ }
2624
+ return true;
2625
+ };
2626
+ return match(parts.length - 1, this.open);
2627
+ }
2628
+ }, {
2629
+ key: "textblockFromContext",
2630
+ value: function textblockFromContext() {
2631
+ var $context = this.options.context;
2632
+ if ($context) for (var d = $context.depth; d >= 0; d--) {
2633
+ var deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;
2634
+ if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt;
2635
+ }
2636
+ for (var name in this.parser.schema.nodes) {
2637
+ var type = this.parser.schema.nodes[name];
2638
+ if (type.isTextblock && type.defaultAttrs) return type;
2639
+ }
2640
+ }
2641
+ }]);
2642
+ return ParseContext;
2643
+ }();
2644
+ function normalizeList(dom) {
2645
+ for (var child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
2646
+ var name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;
2647
+ if (name && listTags.hasOwnProperty(name) && prevItem) {
2648
+ prevItem.appendChild(child);
2649
+ child = prevItem;
2650
+ } else if (name == "li") {
2651
+ prevItem = child;
2652
+ } else if (name) {
2653
+ prevItem = null;
2654
+ }
2655
+ }
2656
+ }
2657
+ function matches(dom, selector) {
2658
+ return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);
2659
+ }
2660
+ function copy(obj) {
2661
+ var copy = {};
2662
+ for (var prop in obj) copy[prop] = obj[prop];
2663
+ return copy;
2664
+ }
2665
+ function markMayApply(markType, nodeType) {
2666
+ var nodes = nodeType.schema.nodes;
2667
+ var _loop5 = function _loop5() {
2668
+ var parent = nodes[name];
2669
+ if (!parent.allowsMarkType(markType)) return 0;
2670
+ var seen = [],
2671
+ scan = function scan(match) {
2672
+ seen.push(match);
2673
+ for (var i = 0; i < match.edgeCount; i++) {
2674
+ var _match$edge = match.edge(i),
2675
+ type = _match$edge.type,
2676
+ next = _match$edge.next;
2677
+ if (type == nodeType) return true;
2678
+ if (seen.indexOf(next) < 0 && scan(next)) return true;
2679
+ }
2680
+ };
2681
+ if (scan(parent.contentMatch)) return {
2682
+ v: true
2683
+ };
2684
+ },
2685
+ _ret2;
2686
+ for (var name in nodes) {
2687
+ _ret2 = _loop5();
2688
+ if (_ret2 === 0) continue;
2689
+ if (_ret2) return _ret2.v;
2690
+ }
2691
+ }
2692
+ var DOMSerializer = function () {
2693
+ function DOMSerializer(nodes, marks) {
2694
+ _classCallCheck(this, DOMSerializer);
2695
+ this.nodes = nodes;
2696
+ this.marks = marks;
2697
+ }
2698
+ _createClass(DOMSerializer, [{
2699
+ key: "serializeFragment",
2700
+ value: function serializeFragment(fragment) {
2701
+ var _this7 = this;
2702
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2703
+ var target = arguments.length > 2 ? arguments[2] : undefined;
2704
+ if (!target) target = doc(options).createDocumentFragment();
2705
+ var top = target,
2706
+ active = [];
2707
+ fragment.forEach(function (node) {
2708
+ if (active.length || node.marks.length) {
2709
+ var keep = 0,
2710
+ rendered = 0;
2711
+ while (keep < active.length && rendered < node.marks.length) {
2712
+ var next = node.marks[rendered];
2713
+ if (!_this7.marks[next.type.name]) {
2714
+ rendered++;
2715
+ continue;
2716
+ }
2717
+ if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) break;
2718
+ keep++;
2719
+ rendered++;
2720
+ }
2721
+ while (keep < active.length) top = active.pop()[1];
2722
+ while (rendered < node.marks.length) {
2723
+ var add = node.marks[rendered++];
2724
+ var markDOM = _this7.serializeMark(add, node.isInline, options);
2725
+ if (markDOM) {
2726
+ active.push([add, top]);
2727
+ top.appendChild(markDOM.dom);
2728
+ top = markDOM.contentDOM || markDOM.dom;
2729
+ }
2730
+ }
2731
+ }
2732
+ top.appendChild(_this7.serializeNodeInner(node, options));
2733
+ });
2734
+ return target;
2735
+ }
2736
+ }, {
2737
+ key: "serializeNodeInner",
2738
+ value: function serializeNodeInner(node, options) {
2739
+ var _renderSpec2 = _renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs),
2740
+ dom = _renderSpec2.dom,
2741
+ contentDOM = _renderSpec2.contentDOM;
2742
+ if (contentDOM) {
2743
+ if (node.isLeaf) throw new RangeError("Content hole not allowed in a leaf node spec");
2744
+ this.serializeFragment(node.content, options, contentDOM);
2745
+ }
2746
+ return dom;
2747
+ }
2748
+ }, {
2749
+ key: "serializeNode",
2750
+ value: function serializeNode(node) {
2751
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2752
+ var dom = this.serializeNodeInner(node, options);
2753
+ for (var i = node.marks.length - 1; i >= 0; i--) {
2754
+ var wrap = this.serializeMark(node.marks[i], node.isInline, options);
2755
+ if (wrap) {
2756
+ (wrap.contentDOM || wrap.dom).appendChild(dom);
2757
+ dom = wrap.dom;
2758
+ }
2759
+ }
2760
+ return dom;
2761
+ }
2762
+ }, {
2763
+ key: "serializeMark",
2764
+ value: function serializeMark(mark, inline) {
2765
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2766
+ var toDOM = this.marks[mark.type.name];
2767
+ return toDOM && _renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);
2768
+ }
2769
+ }], [{
2770
+ key: "renderSpec",
2771
+ value: function renderSpec(doc, structure) {
2772
+ var xmlNS = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2773
+ var blockArraysIn = arguments.length > 3 ? arguments[3] : undefined;
2774
+ return _renderSpec(doc, structure, xmlNS, blockArraysIn);
2775
+ }
2776
+ }, {
2777
+ key: "fromSchema",
2778
+ value: function fromSchema(schema) {
2779
+ return schema.cached.domSerializer || (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));
2780
+ }
2781
+ }, {
2782
+ key: "nodesFromSchema",
2783
+ value: function nodesFromSchema(schema) {
2784
+ var result = gatherToDOM(schema.nodes);
2785
+ if (!result.text) result.text = function (node) {
2786
+ return node.text;
2787
+ };
2788
+ return result;
2789
+ }
2790
+ }, {
2791
+ key: "marksFromSchema",
2792
+ value: function marksFromSchema(schema) {
2793
+ return gatherToDOM(schema.marks);
2794
+ }
2795
+ }]);
2796
+ return DOMSerializer;
2797
+ }();
2798
+ function gatherToDOM(obj) {
2799
+ var result = {};
2800
+ for (var name in obj) {
2801
+ var toDOM = obj[name].spec.toDOM;
2802
+ if (toDOM) result[name] = toDOM;
2803
+ }
2804
+ return result;
2805
+ }
2806
+ function doc(options) {
2807
+ return options.document || window.document;
2808
+ }
2809
+ var suspiciousAttributeCache = new WeakMap();
2810
+ function suspiciousAttributes(attrs) {
2811
+ var value = suspiciousAttributeCache.get(attrs);
2812
+ if (value === undefined) suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
2813
+ return value;
2814
+ }
2815
+ function suspiciousAttributesInner(attrs) {
2816
+ var result = null;
2817
+ function scan(value) {
2818
+ if (value && _typeof(value) == "object") {
2819
+ if (Array.isArray(value)) {
2820
+ if (typeof value[0] == "string") {
2821
+ if (!result) result = [];
2822
+ result.push(value);
2823
+ } else {
2824
+ for (var i = 0; i < value.length; i++) scan(value[i]);
2825
+ }
2826
+ } else {
2827
+ for (var prop in value) scan(value[prop]);
2828
+ }
2829
+ }
2830
+ }
2831
+ scan(attrs);
2832
+ return result;
2833
+ }
2834
+ function _renderSpec(doc, structure, xmlNS, blockArraysIn) {
2835
+ if (typeof structure == "string") return {
2836
+ dom: doc.createTextNode(structure)
2837
+ };
2838
+ if (structure.nodeType != null) return {
2839
+ dom: structure
2840
+ };
2841
+ if (structure.dom && structure.dom.nodeType != null) return structure;
2842
+ var tagName = structure[0],
2843
+ suspicious;
2844
+ if (typeof tagName != "string") throw new RangeError("Invalid array passed to renderSpec");
2845
+ if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
2846
+ var space = tagName.indexOf(" ");
2847
+ if (space > 0) {
2848
+ xmlNS = tagName.slice(0, space);
2849
+ tagName = tagName.slice(space + 1);
2850
+ }
2851
+ var contentDOM;
2852
+ var dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);
2853
+ var attrs = structure[1],
2854
+ start = 1;
2855
+ if (attrs && _typeof(attrs) == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
2856
+ start = 2;
2857
+ for (var name in attrs) if (attrs[name] != null) {
2858
+ var _space = name.indexOf(" ");
2859
+ if (_space > 0) dom.setAttributeNS(name.slice(0, _space), name.slice(_space + 1), attrs[name]);else if (name == "style" && dom.style) dom.style.cssText = attrs[name];else dom.setAttribute(name, attrs[name]);
2860
+ }
2861
+ }
2862
+ for (var i = start; i < structure.length; i++) {
2863
+ var child = structure[i];
2864
+ if (child === 0) {
2865
+ if (i < structure.length - 1 || i > start) throw new RangeError("Content hole must be the only child of its parent node");
2866
+ return {
2867
+ dom: dom,
2868
+ contentDOM: dom
2869
+ };
2870
+ } else {
2871
+ var _renderSpec3 = _renderSpec(doc, child, xmlNS, blockArraysIn),
2872
+ inner = _renderSpec3.dom,
2873
+ innerContent = _renderSpec3.contentDOM;
2874
+ dom.appendChild(inner);
2875
+ if (innerContent) {
2876
+ if (contentDOM) throw new RangeError("Multiple content holes");
2877
+ contentDOM = innerContent;
2878
+ }
2879
+ }
2880
+ }
2881
+ return {
2882
+ dom: dom,
2883
+ contentDOM: contentDOM
2884
+ };
2885
+ }
2886
+ exports.ContentMatch = ContentMatch;
2887
+ exports.DOMParser = DOMParser;
2888
+ exports.DOMSerializer = DOMSerializer;
2889
+ exports.Fragment = Fragment;
2890
+ exports.Mark = Mark;
2891
+ exports.MarkType = MarkType;
2892
+ exports.Node = Node;
2893
+ exports.NodeRange = NodeRange;
2894
+ exports.NodeType = NodeType;
2895
+ exports.ReplaceError = ReplaceError;
2896
+ exports.ResolvedPos = ResolvedPos;
2897
+ exports.Schema = Schema;
2898
+ exports.Slice = Slice;