@aquera/nile-elements 1.9.5 → 1.9.7

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 (565) hide show
  1. package/README.md +9 -0
  2. package/dist/index-178e1e57.cjs.js +2 -0
  3. package/dist/index-178e1e57.cjs.js.map +1 -0
  4. package/dist/index-1faa963c.esm.js +1 -0
  5. package/dist/index-249de90a.esm.js +1 -0
  6. package/dist/index-353172ed.esm.js +1 -0
  7. package/dist/index-6f3fa4ab.esm.js +1 -0
  8. package/dist/index-89c520e9.cjs.js +5 -0
  9. package/dist/index-89c520e9.cjs.js.map +1 -0
  10. package/dist/index-920675c4.esm.js +1 -0
  11. package/dist/index-b387a9f4.cjs.js +2 -0
  12. package/dist/index-b387a9f4.cjs.js.map +1 -0
  13. package/dist/index-cc1385e0.cjs.js +2 -0
  14. package/dist/index-cc1385e0.cjs.js.map +1 -0
  15. package/dist/index-dedc38a6.esm.js +1 -0
  16. package/dist/index-df196058.cjs.js +2 -0
  17. package/dist/index-df196058.cjs.js.map +1 -0
  18. package/dist/index-f956f56d.cjs.js +7 -0
  19. package/dist/index-f956f56d.cjs.js.map +1 -0
  20. package/dist/index.cjs.js +1 -1
  21. package/dist/index.esm.js +1 -1
  22. package/dist/index.js +3802 -664
  23. package/dist/internal/glyph.cjs.js +2 -0
  24. package/dist/internal/glyph.cjs.js.map +1 -0
  25. package/dist/internal/glyph.esm.js +5 -0
  26. package/dist/nile-auto-complete/index.cjs.js +1 -1
  27. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  28. package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
  29. package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
  30. package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
  31. package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
  32. package/dist/nile-chip/nile-chip.css.esm.js +8 -1
  33. package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
  34. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  35. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  36. package/dist/nile-code-editor/index.cjs.js +1 -1
  37. package/dist/nile-code-editor/index.esm.js +1 -1
  38. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  39. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  40. package/dist/nile-code-editor/nile-code-editor.esm.js +4 -4
  41. package/dist/nile-color-picker/index.cjs.js +1 -1
  42. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  43. package/dist/nile-combobox/index.cjs.js +1 -1
  44. package/dist/nile-combobox/index.esm.js +1 -1
  45. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  46. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  47. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  48. package/dist/nile-context-menu/index.cjs.js +1 -1
  49. package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
  50. package/dist/nile-context-submenu/index.cjs.js +1 -1
  51. package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
  52. package/dist/nile-detail/index.cjs.js +1 -1
  53. package/dist/nile-detail/index.esm.js +1 -1
  54. package/dist/nile-detail/nile-detail.cjs.js +1 -1
  55. package/dist/nile-detail/nile-detail.esm.js +1 -1
  56. package/dist/nile-dropdown/index.cjs.js +1 -1
  57. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  58. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  59. package/dist/nile-file-upload/index.cjs.js +1 -1
  60. package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
  61. package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
  62. package/dist/nile-floating-panel/index.cjs.js +1 -1
  63. package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
  64. package/dist/nile-hero/nile-hero.cjs.js +1 -1
  65. package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
  66. package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
  67. package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
  68. package/dist/nile-hero/nile-hero.css.esm.js +14 -14
  69. package/dist/nile-hero/nile-hero.esm.js +1 -1
  70. package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
  71. package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
  72. package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
  73. package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
  74. package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
  75. package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
  76. package/dist/nile-lite-tooltip/index.cjs.js +1 -1
  77. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
  78. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  79. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  80. package/dist/nile-popover/index.cjs.js +1 -1
  81. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  82. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  83. package/dist/nile-popup/index.cjs.js +1 -1
  84. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  85. package/dist/nile-rich-text-editor/index.cjs.js +1 -1
  86. package/dist/nile-rich-text-editor/index.esm.js +1 -1
  87. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
  88. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
  89. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
  90. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
  91. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
  92. package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
  93. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
  94. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
  95. package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
  96. package/dist/nile-select/index.cjs.js +1 -1
  97. package/dist/nile-select/nile-select.cjs.js +1 -1
  98. package/dist/nile-select/portal-manager.cjs.js +1 -1
  99. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  100. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  101. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  102. package/dist/nile-tooltip/index.cjs.js +1 -1
  103. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  104. package/dist/nile-virtual-select/index.cjs.js +1 -1
  105. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  106. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  107. package/dist/nile-virtual-select/renderer.cjs.js +1 -1
  108. package/dist/nile-wysiwyg-editor/emoji.cjs.js +2 -0
  109. package/dist/nile-wysiwyg-editor/emoji.cjs.js.map +1 -0
  110. package/dist/nile-wysiwyg-editor/emoji.esm.js +1 -0
  111. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +2 -0
  112. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -0
  113. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -0
  114. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +2 -0
  115. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -0
  116. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -0
  117. package/dist/nile-wysiwyg-editor/engine/export.cjs.js +2 -0
  118. package/dist/nile-wysiwyg-editor/engine/export.cjs.js.map +1 -0
  119. package/dist/nile-wysiwyg-editor/engine/export.esm.js +1 -0
  120. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +2 -0
  121. package/dist/nile-wysiwyg-editor/engine/index.cjs.js.map +1 -0
  122. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -0
  123. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +2 -0
  124. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -0
  125. package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -0
  126. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +2 -0
  127. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -0
  128. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -0
  129. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js +2 -0
  130. package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js.map +1 -0
  131. package/dist/nile-wysiwyg-editor/engine/markdown-parse.esm.js +1 -0
  132. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js +2 -0
  133. package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js.map +1 -0
  134. package/dist/nile-wysiwyg-editor/engine/markdown.esm.js +1 -0
  135. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js +2 -0
  136. package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js.map +1 -0
  137. package/dist/nile-wysiwyg-editor/engine/office-paste.esm.js +1 -0
  138. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +2 -0
  139. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -0
  140. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -0
  141. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +2 -0
  142. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -0
  143. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -0
  144. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +2 -0
  145. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -0
  146. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -0
  147. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +2 -0
  148. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -0
  149. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -0
  150. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +2 -0
  151. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -0
  152. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -0
  153. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +2 -0
  154. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -0
  155. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -0
  156. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +2 -0
  157. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -0
  158. package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -0
  159. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +2 -0
  160. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -0
  161. package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -0
  162. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +2 -0
  163. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -0
  164. package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -0
  165. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +2 -0
  166. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -0
  167. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -0
  168. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +2 -0
  169. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -0
  170. package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -0
  171. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +2 -0
  172. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -0
  173. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -0
  174. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +2 -0
  175. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -0
  176. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -0
  177. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +2 -0
  178. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -0
  179. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -0
  180. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +2 -0
  181. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -0
  182. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -0
  183. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js +2 -0
  184. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js.map +1 -0
  185. package/dist/nile-wysiwyg-editor/engine/plugins/task-list.esm.js +1 -0
  186. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -0
  187. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -0
  188. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -0
  189. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +2 -0
  190. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -0
  191. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -0
  192. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +2 -0
  193. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -0
  194. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -0
  195. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +2 -0
  196. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -0
  197. package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -0
  198. package/dist/nile-wysiwyg-editor/index.cjs.js +2 -0
  199. package/dist/nile-wysiwyg-editor/index.cjs.js.map +1 -0
  200. package/dist/nile-wysiwyg-editor/index.esm.js +1 -0
  201. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +2 -0
  202. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -0
  203. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +2 -0
  204. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -0
  205. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +780 -0
  206. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +97 -0
  207. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +2 -0
  208. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js.map +1 -0
  209. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -0
  210. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +2 -0
  211. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -0
  212. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +2 -0
  213. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -0
  214. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +244 -0
  215. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +137 -0
  216. package/dist/nile-wysiwyg-editor/types.cjs.js +2 -0
  217. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -0
  218. package/dist/nile-wysiwyg-editor/types.esm.js +1 -0
  219. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +2 -0
  220. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -0
  221. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +97 -0
  222. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +2 -0
  223. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -0
  224. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +67 -0
  225. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +2 -0
  226. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -0
  227. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +65 -0
  228. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +2 -0
  229. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -0
  230. package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +64 -0
  231. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +2 -0
  232. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -0
  233. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +68 -0
  234. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +2 -0
  235. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -0
  236. package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +96 -0
  237. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +2 -0
  238. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -0
  239. package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +112 -0
  240. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +2 -0
  241. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -0
  242. package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +64 -0
  243. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +2 -0
  244. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -0
  245. package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +171 -0
  246. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +2 -0
  247. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -0
  248. package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +90 -0
  249. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +2 -0
  250. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -0
  251. package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +114 -0
  252. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +2 -0
  253. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -0
  254. package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +80 -0
  255. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +2 -0
  256. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -0
  257. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +92 -0
  258. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +2 -0
  259. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -0
  260. package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +147 -0
  261. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +2 -0
  262. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -0
  263. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +79 -0
  264. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +2 -0
  265. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -0
  266. package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +96 -0
  267. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +2 -0
  268. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -0
  269. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +67 -0
  270. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +2 -0
  271. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -0
  272. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +100 -0
  273. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +2 -0
  274. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -0
  275. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +58 -0
  276. package/dist/src/index.d.ts +24 -0
  277. package/dist/src/index.js +19 -0
  278. package/dist/src/index.js.map +1 -1
  279. package/dist/src/internal/glyph.d.ts +6 -0
  280. package/dist/src/internal/glyph.js +13 -0
  281. package/dist/src/internal/glyph.js.map +1 -0
  282. package/dist/src/nile-chip/nile-chip.css.js +8 -1
  283. package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
  284. package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
  285. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  286. package/dist/src/nile-hero/nile-hero.css.js +12 -12
  287. package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
  288. package/dist/src/nile-hero/nile-hero.js +1 -1
  289. package/dist/src/nile-hero/nile-hero.js.map +1 -1
  290. package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
  291. package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
  292. package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
  293. package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
  294. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
  295. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
  296. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
  297. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
  298. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
  299. package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
  300. package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
  301. package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
  302. package/dist/src/nile-wysiwyg-editor/emoji.d.ts +5 -0
  303. package/dist/src/nile-wysiwyg-editor/emoji.js +138 -0
  304. package/dist/src/nile-wysiwyg-editor/emoji.js.map +1 -0
  305. package/dist/src/nile-wysiwyg-editor/engine/commands.d.ts +69 -0
  306. package/dist/src/nile-wysiwyg-editor/engine/commands.js +863 -0
  307. package/dist/src/nile-wysiwyg-editor/engine/commands.js.map +1 -0
  308. package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +35 -0
  309. package/dist/src/nile-wysiwyg-editor/engine/create-state.js +67 -0
  310. package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -0
  311. package/dist/src/nile-wysiwyg-editor/engine/export.d.ts +38 -0
  312. package/dist/src/nile-wysiwyg-editor/engine/export.js +208 -0
  313. package/dist/src/nile-wysiwyg-editor/engine/export.js.map +1 -0
  314. package/dist/src/nile-wysiwyg-editor/engine/export.test.d.ts +1 -0
  315. package/dist/src/nile-wysiwyg-editor/engine/export.test.js +96 -0
  316. package/dist/src/nile-wysiwyg-editor/engine/export.test.js.map +1 -0
  317. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +37 -0
  318. package/dist/src/nile-wysiwyg-editor/engine/index.js +29 -0
  319. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -0
  320. package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +12 -0
  321. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +144 -0
  322. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -0
  323. package/dist/src/nile-wysiwyg-editor/engine/keymap.d.ts +15 -0
  324. package/dist/src/nile-wysiwyg-editor/engine/keymap.js +94 -0
  325. package/dist/src/nile-wysiwyg-editor/engine/keymap.js.map +1 -0
  326. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.d.ts +22 -0
  327. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js +287 -0
  328. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js.map +1 -0
  329. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.d.ts +1 -0
  330. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js +106 -0
  331. package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js.map +1 -0
  332. package/dist/src/nile-wysiwyg-editor/engine/markdown.d.ts +10 -0
  333. package/dist/src/nile-wysiwyg-editor/engine/markdown.js +162 -0
  334. package/dist/src/nile-wysiwyg-editor/engine/markdown.js.map +1 -0
  335. package/dist/src/nile-wysiwyg-editor/engine/office-paste.d.ts +13 -0
  336. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js +182 -0
  337. package/dist/src/nile-wysiwyg-editor/engine/office-paste.js.map +1 -0
  338. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.d.ts +10 -0
  339. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js +165 -0
  340. package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js.map +1 -0
  341. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.d.ts +17 -0
  342. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +69 -0
  343. package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -0
  344. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +17 -0
  345. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +96 -0
  346. package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -0
  347. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.d.ts +26 -0
  348. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js +123 -0
  349. package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js.map +1 -0
  350. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.d.ts +28 -0
  351. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js +72 -0
  352. package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js.map +1 -0
  353. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.d.ts +41 -0
  354. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +176 -0
  355. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -0
  356. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.d.ts +15 -0
  357. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js +64 -0
  358. package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js.map +1 -0
  359. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +11 -0
  360. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +42 -0
  361. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -0
  362. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +18 -0
  363. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +46 -0
  364. package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -0
  365. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.d.ts +7 -0
  366. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js +26 -0
  367. package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js.map +1 -0
  368. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +31 -0
  369. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +55 -0
  370. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -0
  371. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.d.ts +7 -0
  372. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js +25 -0
  373. package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js.map +1 -0
  374. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.d.ts +10 -0
  375. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js +48 -0
  376. package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js.map +1 -0
  377. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.d.ts +29 -0
  378. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js +87 -0
  379. package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js.map +1 -0
  380. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.d.ts +8 -0
  381. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +11 -0
  382. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -0
  383. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.d.ts +16 -0
  384. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js +49 -0
  385. package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js.map +1 -0
  386. package/dist/src/nile-wysiwyg-editor/engine/pm.test.d.ts +1 -0
  387. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +883 -0
  388. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -0
  389. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.d.ts +1 -0
  390. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js +129 -0
  391. package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js.map +1 -0
  392. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +13 -0
  393. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +155 -0
  394. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -0
  395. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +20 -0
  396. package/dist/src/nile-wysiwyg-editor/engine/schema.js +823 -0
  397. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -0
  398. package/dist/src/nile-wysiwyg-editor/engine/selection-state.d.ts +70 -0
  399. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +138 -0
  400. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -0
  401. package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +18 -0
  402. package/dist/src/nile-wysiwyg-editor/engine/serializer.js +63 -0
  403. package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -0
  404. package/dist/src/nile-wysiwyg-editor/index.d.ts +3 -0
  405. package/dist/src/nile-wysiwyg-editor/index.js +3 -0
  406. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -0
  407. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.d.ts +1 -0
  408. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +782 -0
  409. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -0
  410. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +364 -0
  411. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +2038 -0
  412. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -0
  413. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.d.ts +1 -0
  414. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +636 -0
  415. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -0
  416. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +1 -0
  417. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +2 -0
  418. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -0
  419. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.d.ts +6 -0
  420. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +251 -0
  421. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -0
  422. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +41 -0
  423. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +700 -0
  424. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -0
  425. package/dist/src/nile-wysiwyg-editor/types.d.ts +49 -0
  426. package/dist/src/nile-wysiwyg-editor/types.js +8 -0
  427. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -0
  428. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.d.ts +20 -0
  429. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +159 -0
  430. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -0
  431. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +21 -0
  432. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +125 -0
  433. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -0
  434. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.d.ts +18 -0
  435. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +107 -0
  436. package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -0
  437. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.d.ts +19 -0
  438. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +123 -0
  439. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -0
  440. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +27 -0
  441. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +146 -0
  442. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -0
  443. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.d.ts +21 -0
  444. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +154 -0
  445. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -0
  446. package/dist/src/nile-wysiwyg-editor/ui/find-replace.d.ts +26 -0
  447. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +178 -0
  448. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -0
  449. package/dist/src/nile-wysiwyg-editor/ui/image-menu.d.ts +18 -0
  450. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +129 -0
  451. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -0
  452. package/dist/src/nile-wysiwyg-editor/ui/image-panel.d.ts +56 -0
  453. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +349 -0
  454. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -0
  455. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.d.ts +25 -0
  456. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +142 -0
  457. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -0
  458. package/dist/src/nile-wysiwyg-editor/ui/link-editor.d.ts +30 -0
  459. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +189 -0
  460. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -0
  461. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.d.ts +24 -0
  462. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +144 -0
  463. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -0
  464. package/dist/src/nile-wysiwyg-editor/ui/math-panel.d.ts +31 -0
  465. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +172 -0
  466. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -0
  467. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.d.ts +30 -0
  468. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +296 -0
  469. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -0
  470. package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +19 -0
  471. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +120 -0
  472. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -0
  473. package/dist/src/nile-wysiwyg-editor/ui/special-chars.d.ts +20 -0
  474. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +199 -0
  475. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -0
  476. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +31 -0
  477. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +133 -0
  478. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -0
  479. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +23 -0
  480. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +177 -0
  481. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -0
  482. package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +16 -0
  483. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +101 -0
  484. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -0
  485. package/dist/src/version.js +1 -1
  486. package/dist/src/version.js.map +1 -1
  487. package/dist/tsconfig.tsbuildinfo +1 -1
  488. package/package.json +18 -2
  489. package/src/index.ts +57 -1
  490. package/src/internal/glyph.ts +13 -0
  491. package/src/nile-chip/nile-chip.css.ts +8 -1
  492. package/src/nile-code-editor/nile-code-editor.ts +3 -3
  493. package/src/nile-hero/nile-hero.css.ts +12 -12
  494. package/src/nile-hero/nile-hero.ts +1 -1
  495. package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
  496. package/src/nile-hero-header/nile-hero-header.ts +1 -1
  497. package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
  498. package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
  499. package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
  500. package/src/nile-wysiwyg-editor/emoji.ts +137 -0
  501. package/src/nile-wysiwyg-editor/engine/commands.ts +1035 -0
  502. package/src/nile-wysiwyg-editor/engine/create-state.ts +117 -0
  503. package/src/nile-wysiwyg-editor/engine/export.test.ts +113 -0
  504. package/src/nile-wysiwyg-editor/engine/export.ts +242 -0
  505. package/src/nile-wysiwyg-editor/engine/index.ts +69 -0
  506. package/src/nile-wysiwyg-editor/engine/inputrules.ts +169 -0
  507. package/src/nile-wysiwyg-editor/engine/keymap.ts +146 -0
  508. package/src/nile-wysiwyg-editor/engine/markdown-parse.test.ts +148 -0
  509. package/src/nile-wysiwyg-editor/engine/markdown-parse.ts +337 -0
  510. package/src/nile-wysiwyg-editor/engine/markdown.ts +165 -0
  511. package/src/nile-wysiwyg-editor/engine/office-paste.ts +199 -0
  512. package/src/nile-wysiwyg-editor/engine/plugins/code-highlight.ts +173 -0
  513. package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +85 -0
  514. package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +99 -0
  515. package/src/nile-wysiwyg-editor/engine/plugins/find-replace.ts +155 -0
  516. package/src/nile-wysiwyg-editor/engine/plugins/format-painter.ts +80 -0
  517. package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +220 -0
  518. package/src/nile-wysiwyg-editor/engine/plugins/image.ts +80 -0
  519. package/src/nile-wysiwyg-editor/engine/plugins/link.ts +42 -0
  520. package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +56 -0
  521. package/src/nile-wysiwyg-editor/engine/plugins/max-length.ts +24 -0
  522. package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +74 -0
  523. package/src/nile-wysiwyg-editor/engine/plugins/placeholder.ts +24 -0
  524. package/src/nile-wysiwyg-editor/engine/plugins/single-line.ts +47 -0
  525. package/src/nile-wysiwyg-editor/engine/plugins/suggestions.ts +110 -0
  526. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +12 -0
  527. package/src/nile-wysiwyg-editor/engine/plugins/task-list.ts +65 -0
  528. package/src/nile-wysiwyg-editor/engine/pm.test.ts +1088 -0
  529. package/src/nile-wysiwyg-editor/engine/productivity.test.ts +163 -0
  530. package/src/nile-wysiwyg-editor/engine/sanitize.ts +156 -0
  531. package/src/nile-wysiwyg-editor/engine/schema.ts +859 -0
  532. package/src/nile-wysiwyg-editor/engine/selection-state.ts +210 -0
  533. package/src/nile-wysiwyg-editor/engine/serializer.ts +78 -0
  534. package/src/nile-wysiwyg-editor/index.ts +3 -0
  535. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +782 -0
  536. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +750 -0
  537. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +2155 -0
  538. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +1 -0
  539. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +251 -0
  540. package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +772 -0
  541. package/src/nile-wysiwyg-editor/types.ts +83 -0
  542. package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +155 -0
  543. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +135 -0
  544. package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +105 -0
  545. package/src/nile-wysiwyg-editor/ui/embed-menu.ts +133 -0
  546. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +143 -0
  547. package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +152 -0
  548. package/src/nile-wysiwyg-editor/ui/find-replace.ts +174 -0
  549. package/src/nile-wysiwyg-editor/ui/image-menu.ts +140 -0
  550. package/src/nile-wysiwyg-editor/ui/image-panel.ts +337 -0
  551. package/src/nile-wysiwyg-editor/ui/insert-menu.ts +142 -0
  552. package/src/nile-wysiwyg-editor/ui/link-editor.ts +180 -0
  553. package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +143 -0
  554. package/src/nile-wysiwyg-editor/ui/math-panel.ts +169 -0
  555. package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +311 -0
  556. package/src/nile-wysiwyg-editor/ui/source-view.ts +119 -0
  557. package/src/nile-wysiwyg-editor/ui/special-chars.ts +209 -0
  558. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +138 -0
  559. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +173 -0
  560. package/src/nile-wysiwyg-editor/ui/table-menu.ts +109 -0
  561. package/vscode-html-custom-data.json +491 -1
  562. package/web-dev-server.config.mjs +6 -2
  563. package/dist/index-5fef1a0d.esm.js +0 -1
  564. package/dist/index-8f38fae3.cjs.js +0 -2
  565. package/dist/index-8f38fae3.cjs.js.map +0 -1
package/README.md CHANGED
@@ -79,6 +79,15 @@ To run a local development server that serves the basic demo located in `demo/in
79
79
 
80
80
  In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
81
81
 
82
+ #### Version 1.9.7 (July 13, 2026)
83
+ - Nile WYSIWYG Editor: Added New Component (UIF-1303)
84
+
85
+ #### Version 1.9.6 (July 9, 2026)
86
+ - Nile Chip: Resolved the height issues caused because of the nile-input (UIF-1296)
87
+ - Nile Code Editor: Made the ng-icon method as fill (UIF-1294)
88
+ - Nile Hero: Migrated to nextgen and made the icon method as fill (UIF-1295)
89
+ - Nile Rich Text Editor - Added image functionality (UIF-1293)
90
+
82
91
  #### Version 1.9.5 (July 6, 2026)
83
92
  - Nile Command Menu: Added New Component (UIF-1285)
84
93
  - Nile Dot Stepper: Added New Component (UIF-1286)
@@ -0,0 +1,2 @@
1
+ System.register([],function(_export,_context){"use strict";var r,t,e,o,n,a;function i(n){var a=!(e&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||o&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?t:r)[n.keyCode]||n.key||"Unidentified";return"Esc"==a&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a;}_export("k",i);return{setters:[],execute:function execute(){for(_export("b",r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}),_export("s",t={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'}),e="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),o="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),n=0;n<10;n++)r[48+n]=r[96+n]=String(n);for(n=1;n<=24;n++)r[n+111]="F"+n;for(n=65;n<=90;n++)r[n]=String.fromCharCode(n+32),t[n]=String.fromCharCode(n);for(a in r)t.hasOwnProperty(a)||(t[a]=r[a]);}};});
2
+ //# sourceMappingURL=index-178e1e57.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-178e1e57.cjs.js","sources":["../../../node_modules/w3c-keyname/index.js"],"sourcesContent":["export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n}\n\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n}\n\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32)\n shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||\n ie && event.shiftKey && event.key && event.key.length == 1 ||\n event.key == \"Unidentified\"\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\"\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\"\n if (name == \"Del\") name = \"Delete\"\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\"\n if (name == \"Up\") name = \"ArrowUp\"\n if (name == \"Right\") name = \"ArrowRight\"\n if (name == \"Down\") name = \"ArrowDown\"\n return name\n}\n"],"names":["keyName","event","name","mac","metaKey","shiftKey","ctrlKey","altKey","ie","key","length","shift","base","keyCode","_export","navigator","test","platform","exec","userAgent","i","String","fromCharCode","code","hasOwnProperty"],"mappings":"2EAoGO,QAASA,CAAAA,CAAQC,CAAAA,CAAAA,CAAAA,CAGtB,GAGIC,CAAAA,CAAAA,CAAAA,EAHYC,CAAOF,EAAAA,CAAAA,CAAMG,OAAWH,EAAAA,CAAAA,CAAMI,WAAaJ,CAAMK,CAAAA,OAAAA,EAAAA,CAAYL,CAAMM,CAAAA,MAAAA,EAC/EC,CAAMP,EAAAA,CAAAA,CAAMI,QAAYJ,EAAAA,CAAAA,CAAMQ,KAA2B,CAApBR,EAAAA,CAAAA,CAAMQ,GAAIC,CAAAA,MAAAA,EAClC,cAAbT,EAAAA,CAAAA,CAAMQ,GACgBR,CAAAA,EAAAA,CAAAA,CAAMQ,MAC7BR,CAAMI,CAAAA,QAAAA,CAAWM,CAAQC,CAAAA,CAAAA,EAAMX,CAAMY,CAAAA,OAAAA,CAAAA,EACtCZ,CAAMQ,CAAAA,GAAAA,EAAO,eASf,MAPY,KAAA,EAARP,CAAeA,GAAAA,CAAAA,CAAO,QACd,CAAA,CAAA,KAAA,EAARA,CAAeA,GAAAA,CAAAA,CAAO,UAEd,MAARA,EAAAA,CAAAA,GAAgBA,CAAO,CAAA,WAAA,CAAA,CACf,IAARA,EAAAA,CAAAA,GAAcA,CAAO,CAAA,SAAA,CAAA,CACb,SAARA,CAAiBA,GAAAA,CAAAA,CAAO,YAChB,CAAA,CAAA,MAAA,EAARA,IAAgBA,CAAO,CAAA,WAAA,CAAA,CACpBA,CACT,EAAAY,OAAA,qDAhCA,IAAAA,OAAA,KAtFWF,CAAAA,CAAO,CAChB,CAAA,CAAG,YACH,CAAG,CAAA,KAAA,CACH,EAAI,CAAA,OAAA,CACJ,EAAI,CAAA,SAAA,CACJ,EAAI,CAAA,OAAA,CACJ,GAAI,OACJ,CAAA,EAAA,CAAI,SACJ,CAAA,EAAA,CAAI,KACJ,CAAA,EAAA,CAAI,UACJ,CAAA,EAAA,CAAI,SACJ,EAAI,CAAA,GAAA,CACJ,EAAI,CAAA,QAAA,CACJ,EAAI,CAAA,UAAA,CACJ,EAAI,CAAA,KAAA,CACJ,GAAI,MACJ,CAAA,EAAA,CAAI,WACJ,CAAA,EAAA,CAAI,SACJ,CAAA,EAAA,CAAI,YACJ,CAAA,EAAA,CAAI,YACJ,EAAI,CAAA,aAAA,CACJ,EAAI,CAAA,QAAA,CACJ,EAAI,CAAA,QAAA,CACJ,EAAI,CAAA,GAAA,CACJ,GAAI,GACJ,CAAA,EAAA,CAAI,MACJ,CAAA,EAAA,CAAI,MACJ,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,IACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,IAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,UACL,GAAK,CAAA,YAAA,CACL,GAAK,CAAA,OAAA,CACL,GAAK,CAAA,OAAA,CACL,GAAK,CAAA,SAAA,CACL,IAAK,SACL,CAAA,GAAA,CAAK,KACL,CAAA,GAAA,CAAK,KACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,IACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,IAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,IACL,CAAA,GAAA,CAAK,IACL,GAAK,CAAA,GAAA,CAAA,EAAAE,OAAA,KAGIH,CAAQ,CAAA,CACjB,EAAI,CAAA,GAAA,CACJ,EAAI,CAAA,GAAA,CACJ,GAAI,GACJ,CAAA,EAAA,CAAI,GACJ,CAAA,EAAA,CAAI,GACJ,CAAA,EAAA,CAAI,GACJ,CAAA,EAAA,CAAI,IACJ,EAAI,CAAA,GAAA,CACJ,EAAI,CAAA,GAAA,CACJ,EAAI,CAAA,GAAA,CACJ,EAAI,CAAA,GAAA,CACJ,GAAI,GACJ,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,IACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,IAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,GACL,CAAA,GAAA,CAAK,IACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CACL,GAAK,CAAA,GAAA,CAAA,EAGHR,CAA0B,CAAA,WAAA,EAAA,MAAbY,CAAAA,WAA4B,KAAMC,CAAAA,IAAAA,CAAKD,SAAUE,CAAAA,QAAAA,CAAAA,CAC9DT,CAAyB,CAAA,WAAA,EAAA,MAAbO,CAAAA,SAA4B,EAAA,+CAAA,CAAgDG,KAAKH,SAAUI,CAAAA,SAAAA,CAAAA,CAGlGC,CAAI,CAAA,CAAA,CAAGA,CAAI,CAAA,EAAA,CAAIA,CAAKR,EAAAA,CAAAA,CAAAA,CAAK,GAAKQ,CAAKR,CAAAA,CAAAA,CAAAA,CAAK,EAAKQ,CAAAA,CAAAA,CAAAA,CAAKC,MAAOD,CAAAA,CAAAA,CAAAA,CAGlE,IAASA,CAAAA,CAAI,EAAGA,CAAK,EAAA,EAAA,CAAIA,CAAKR,EAAAA,CAAAA,CAAAA,CAAKQ,CAAI,CAAA,GAAA,CAAA,CAAO,GAAMA,CAAAA,CAAAA,CAGpD,IAASA,CAAI,CAAA,EAAA,CAAIA,CAAK,EAAA,EAAA,CAAIA,CACxBR,EAAAA,CAAAA,CAAAA,CAAKQ,CAAKC,CAAAA,CAAAA,MAAAA,CAAOC,aAAaF,CAAI,CAAA,EAAA,CAAA,CAClCT,CAAMS,CAAAA,CAAAA,CAAAA,CAAKC,OAAOC,YAAaF,CAAAA,CAAAA,CAAAA,CAIjC,IAASG,IAAQX,CAAAA,CAAWD,CAAAA,CAAAA,CAAMa,cAAeD,CAAAA,CAAAA,CAAAA,GAAOZ,CAAMY,CAAAA,CAAAA,CAAAA,CAAQX,CAAKW,CAAAA,CAAAA,CAAAA,CAAAA,CAEpE","x_google_ignoreList":[0]}
@@ -0,0 +1 @@
1
+ import{b as t,f as n,g as e}from"./index-6f3fa4ab.esm.js";class i{constructor(t,n,e={}){var i;this.match=t,this.match=t,this.handler="string"==typeof n?(i=n,function(t,n,e,r){let l=i;if(n[1]){let t=n[0].lastIndexOf(n[1]);l+=n[0].slice(t+n[1].length);let i=(e+=t)-r;i>0&&(l=n[0].slice(t-i,t)+l,e=r)}return t.tr.insertText(l,e,r)}):n,this.undoable=!1!==e.undoable,this.inCode=e.inCode||!1,this.inCodeMark=!1!==e.inCodeMark}}function r({rules:n}){let e=new t({state:{init:()=>null,apply(t,n){let e=t.getMeta(this);return e||(t.selectionSet||t.docChanged?null:n)}},props:{handleTextInput:(t,i,r,u)=>l(t,i,r,u,n,e),handleDOMEvents:{compositionend:t=>{setTimeout((()=>{let{$cursor:i}=t.state.selection;i&&l(t,i.pos,i.pos,"",n,e)}))}}},isInputRules:!0});return e}function l(t,n,e,i,r,l){if(t.composing)return!1;let u=t.state,o=u.doc.resolve(n),s=o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,null,"")+i;for(let f=0;f<r.length;f++){let a=r[f];if(!a.inCodeMark&&o.marks().some((t=>t.type.spec.code)))continue;if(o.parent.type.spec.code){if(!a.inCode)continue}else if("only"===a.inCode)continue;let c=a.match.exec(s);if(!c||c[0].length<i.length)continue;let d=n-(c[0].length-i.length);if(!a.inCodeMark){let t=!1;if(u.doc.nodesBetween(d,o.pos,(n=>{n.isInline&&n.marks.some((t=>t.type.spec.code))&&(t=!0)})),t)continue}let h=a.handler(u,c,d,e);if(h)return a.undoable&&h.setMeta(l,{transform:h,from:n,to:e,text:i}),t.dispatch(h),!0}return!1}const u=(t,n)=>{let e=t.plugins;for(let i=0;i<e.length;i++){let r,l=e[i];if(l.spec.isInputRules&&(r=l.getState(t))){if(n){let e=t.tr,i=r.transform;for(let t=i.steps.length-1;t>=0;t--)e.step(i.steps[t].invert(i.docs[t]));if(r.text){let n=e.doc.resolve(r.from).marks();e.replaceWith(r.from,r.to,t.schema.text(r.text,n))}else e.delete(r.from,r.to);n(e)}return!0}}return!1};function o(t,r,l=null,u){return new i(t,((t,i,o,s)=>{let f=l instanceof Function?l(i):l,a=t.tr.delete(o,s),c=a.doc.resolve(o).blockRange(),d=c&&n(c,r,f);if(!d)return null;a.wrap(c,d);let h=a.doc.resolve(o-1).nodeBefore;return h&&h.type==r&&e(a.doc,o-1)&&(!u||u(i,h))&&a.join(o-1),a}))}function s(t,n,e=null){return new i(t,((t,i,r,l)=>{let u=t.doc.resolve(r),o=e instanceof Function?e(i):e;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),n)?t.tr.delete(r,l).setBlockType(r,r,n,o):null}))}new i(/--$/,"—",{inCodeMark:!1}),new i(/\.\.\.$/,"…",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new i(/"$/,"”",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new i(/'$/,"’",{inCodeMark:!1});export{i as I,r as i,s as t,u,o as w};
@@ -0,0 +1 @@
1
+ import{b as t,P as n,S as e,k as o,T as r,F as i,d as l,c as s,m as c}from"./index-6f3fa4ab.esm.js";import{D as f,a as u}from"./index-353172ed.esm.js";import{k as a,b as h}from"./index-920675c4.esm.js";const w="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),d="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function p(t){let n,e,o,r,i=t.split(/-(?!$)/),l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t<i.length-1;t++){let l=i[t];if(/^(cmd|meta|m)$/i.test(l))r=!0;else if(/^a(lt)?$/i.test(l))n=!0;else if(/^(c|ctrl|control)$/i.test(l))e=!0;else if(/^s(hift)?$/i.test(l))o=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);w?r=!0:e=!0}}return n&&(l="Alt-"+l),e&&(l="Ctrl-"+l),r&&(l="Meta-"+l),o&&(l="Shift-"+l),l}function m(t,n,e=!0){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),e&&n.shiftKey&&(t="Shift-"+t),t}function g(n){return new t({props:{handleKeyDown:b(n)}})}function b(t){let n=function(t){let n=Object.create(null);for(let e in t)n[p(e)]=t[e];return n}(t);return function(t,e){let o,r=a(e),i=n[m(r,e)];if(i&&i(t.state,t.dispatch,t))return!0;if(1==r.length&&" "!=r){if(e.shiftKey){let o=n[m(r,e,!1)];if(o&&o(t.state,t.dispatch,t))return!0}if((e.altKey||e.metaKey||e.ctrlKey)&&!(d&&e.ctrlKey&&e.altKey)&&(o=h[e.keyCode])&&o!=r){let r=n[m(o,e)];if(r&&r(t.state,t.dispatch,t))return!0}}return!1}}let v,M;if("undefined"!=typeof WeakMap){let t=new WeakMap;v=n=>t.get(n),M=(n,e)=>(t.set(n,e),e)}else{const t=[],n=10;let e=0;v=n=>{for(let e=0;e<t.length;e+=2)if(t[e]==n)return t[e+1]},M=(o,r)=>(e==n&&(e=0),t[e++]=o,t[e++]=r)}var y=class{constructor(t,n,e,o){this.width=t,this.height=n,this.map=e,this.problems=o}findCell(t){for(let n=0;n<this.map.length;n++){const e=this.map[n];if(e!=t)continue;const o=n%this.width,r=n/this.width|0;let i=o+1,l=r+1;for(let t=1;i<this.width&&this.map[n+t]==e;t++)i++;for(let t=1;l<this.height&&this.map[n+this.width*t]==e;t++)l++;return{left:o,top:r,right:i,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let n=0;n<this.map.length;n++)if(this.map[n]==t)return n%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,n,e){const{left:o,right:r,top:i,bottom:l}=this.findCell(t);return"horiz"==n?(e<0?0==o:r==this.width)?null:this.map[i*this.width+(e<0?o-1:r)]:(e<0?0==i:l==this.height)?null:this.map[o+this.width*(e<0?i-1:l)]}rectBetween(t,n){const{left:e,right:o,top:r,bottom:i}=this.findCell(t),{left:l,right:s,top:c,bottom:f}=this.findCell(n);return{left:Math.min(e,l),top:Math.min(r,c),right:Math.max(o,s),bottom:Math.max(i,f)}}cellsInRect(t){const n=[],e={};for(let o=t.top;o<t.bottom;o++)for(let r=t.left;r<t.right;r++){const i=o*this.width+r,l=this.map[i];e[l]||(e[l]=!0,r==t.left&&r&&this.map[i-1]==l||o==t.top&&o&&this.map[i-this.width]==l||n.push(l))}return n}positionAt(t,n,e){for(let o=0,r=0;;o++){const i=r+e.child(o).nodeSize;if(o==t){let e=n+t*this.width;const o=(t+1)*this.width;for(;e<o&&this.map[e]<r;)e++;return e==o?i-1:this.map[e]}r=i}}static get(t){return v(t)||M(t,function(t){if("table"!=t.type.spec.tableRole)throw new RangeError("Not a table node: "+t.type.name);const n=function(t){let n=-1,e=!1;for(let o=0;o<t.childCount;o++){const r=t.child(o);let i=0;if(e)for(let n=0;n<o;n++){const e=t.child(n);for(let t=0;t<e.childCount;t++){const r=e.child(t);n+r.attrs.rowspan>o&&(i+=r.attrs.colspan)}}for(let t=0;t<r.childCount;t++){const n=r.child(t);i+=n.attrs.colspan,n.attrs.rowspan>1&&(e=!0)}-1==n?n=i:n!=i&&(n=Math.max(n,i))}return n}(t),e=t.childCount,o=[];let r=0,i=null;const l=[];for(let t=0,r=n*e;t<r;t++)o[t]=0;for(let s=0,c=0;s<e;s++){const f=t.child(s);c++;for(let t=0;;t++){for(;r<o.length&&0!=o[r];)r++;if(t==f.childCount)break;const u=f.child(t),{colspan:a,rowspan:h,colwidth:w}=u.attrs;for(let t=0;t<h;t++){if(t+s>=e){(i||(i=[])).push({type:"overlong_rowspan",pos:c,n:h-t});break}const f=r+t*n;for(let t=0;t<a;t++){0==o[f+t]?o[f+t]=c:(i||(i=[])).push({type:"collision",row:s,pos:c,n:a-t});const e=w&&w[t];if(e){const o=(f+t)%n*2,r=l[o];null==r||r!=e&&1==l[o+1]?(l[o]=e,l[o+1]=1):r==e&&l[o+1]++}}}r+=a,c+=u.nodeSize}const u=(s+1)*n;let a=0;for(;r<u;)0==o[r++]&&a++;a&&(i||(i=[])).push({type:"missing",row:s,n:a}),c++}0!==n&&0!==e||(i||(i=[])).push({type:"zero_sized"});const s=new y(n,e,o,i);let c=!1;for(let t=0;!c&&t<l.length;t+=2)null!=l[t]&&l[t+1]<e&&(c=!0);c&&function(t,n,e){t.problems||(t.problems=[]);const o={};for(let r=0;r<t.map.length;r++){const i=t.map[r];if(o[i])continue;o[i]=!0;const l=e.nodeAt(i);if(!l)throw new RangeError(`No cell with offset ${i} found`);let s=null;const c=l.attrs;for(let e=0;e<c.colspan;e++){const o=n[(r+e)%t.width*2];null==o||c.colwidth&&c.colwidth[e]==o||((s||(s=D(c)))[e]=o)}s&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:s})}}(s,l,t);return s}(t))}};function D(t){if(t.colwidth)return t.colwidth.slice();const n=[];for(let e=0;e<t.colspan;e++)n.push(0);return n}function S(t,n){if("string"==typeof t)return{};const e=t.getAttribute("data-colwidth"),o=e&&/^\d+(,\d+)*$/.test(e)?e.split(",").map((t=>Number(t))):null,r=Number(t.getAttribute("colspan")||1),i={colspan:r,rowspan:Number(t.getAttribute("rowspan")||1),colwidth:o&&o.length==r?o:null};for(const e in n){const o=n[e].getFromDOM,r=o&&o(t);null!=r&&(i[e]=r)}return i}function $(t,n){const e={};1!=t.attrs.colspan&&(e.colspan=t.attrs.colspan),1!=t.attrs.rowspan&&(e.rowspan=t.attrs.rowspan),t.attrs.colwidth&&(e["data-colwidth"]=t.attrs.colwidth.join(","));for(const o in n){const r=n[o].setDOMAttr;r&&r(t.attrs[o],e)}return e}function E(t){if(null!==t){if(!Array.isArray(t))throw new TypeError("colwidth must be null or an array");for(const n of t)if("number"!=typeof n)throw new TypeError("colwidth must be null or an array of numbers")}}function R(t){const n=t.cellAttributes||{},e={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:E}};for(const t in n)e[t]={default:n[t].default,validate:n[t].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:t.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:t.cellContent,attrs:e,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:t=>S(t,n)}],toDOM:t=>["td",$(t,n),0]},table_header:{content:t.cellContent,attrs:e,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:t=>S(t,n)}],toDOM:t=>["th",$(t,n),0]}}}function _(t){let n=t.cached.tableNodeTypes;if(!n){n=t.cached.tableNodeTypes={};for(const e in t.nodes){const o=t.nodes[e],r=o.spec.tableRole;r&&(n[r]=o)}}return n}const N=new n("selectingCells");function z(t){for(let n=t.depth-1;n>0;n--)if("row"==t.node(n).type.spec.tableRole)return t.node(0).resolve(t.before(n+1));return null}function k(t){const n=t.selection.$head;for(let t=n.depth;t>0;t--)if("row"==n.node(t).type.spec.tableRole)return!0;return!1}function A(t){const n=t.selection;if("$anchorCell"in n&&n.$anchorCell)return n.$anchorCell.pos>n.$headCell.pos?n.$anchorCell:n.$headCell;if("node"in n&&n.node&&"cell"==n.node.type.spec.tableRole)return n.$anchor;const e=z(n.$head)||function(t){for(let n=t.nodeAfter,e=t.pos;n;n=n.firstChild,e++){const o=n.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(e)}for(let n=t.nodeBefore,e=t.pos;n;n=n.lastChild,e--){const o=n.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(e-n.nodeSize)}}(n.$head);if(e)return e;throw new RangeError(`No cell found around position ${n.head}`)}function C(t){return"row"==t.parent.type.spec.tableRole&&!!t.nodeAfter}function O(t,n){return t.depth==n.depth&&t.pos>=n.start(-1)&&t.pos<=n.end(-1)}function x(t,n,e){const o=t.node(-1),r=y.get(o),i=t.start(-1),l=r.nextCell(t.pos-i,n,e);return null==l?null:t.node(0).resolve(i+l)}function T(t,n,e=1){const o={...t,colspan:t.colspan-e};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(n,e),o.colwidth.some((t=>t>0))||(o.colwidth=null)),o}function W(t,n,e=1){const o={...t,colspan:t.colspan+e};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let t=0;t<e;t++)o.colwidth.splice(n,0,0)}return o}var L=class t extends e{constructor(t,n=t){const e=t.node(-1),r=y.get(e),i=t.start(-1),l=r.rectBetween(t.pos-i,n.pos-i),s=t.node(0),c=r.cellsInRect(l).filter((t=>t!=n.pos-i));c.unshift(n.pos-i);const f=c.map((t=>{const n=e.nodeAt(t);if(!n)throw new RangeError(`No cell with offset ${t} found`);const r=i+t+1;return new o(s.resolve(r),s.resolve(r+n.content.size))}));super(f[0].$from,f[0].$to,f),this.$anchorCell=t,this.$headCell=n}map(n,e){const o=n.resolve(e.map(this.$anchorCell.pos)),i=n.resolve(e.map(this.$headCell.pos));if(C(o)&&C(i)&&O(o,i)){const n=this.$anchorCell.node(-1)!=o.node(-1);return n&&this.isRowSelection()?t.rowSelection(o,i):n&&this.isColSelection()?t.colSelection(o,i):new t(o,i)}return r.between(o,i)}content(){const t=this.$anchorCell.node(-1),n=y.get(t),e=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-e,this.$headCell.pos-e),r={},s=[];for(let e=o.top;e<o.bottom;e++){const l=[];for(let i=e*n.width+o.left,s=o.left;s<o.right;s++,i++){const e=n.map[i];if(r[e])continue;r[e]=!0;const s=n.findCell(e);let c=t.nodeAt(e);if(!c)throw new RangeError(`No cell with offset ${e} found`);const f=o.left-s.left,u=s.right-o.right;if(f>0||u>0){let t=c.attrs;if(f>0&&(t=T(t,0,f)),u>0&&(t=T(t,t.colspan-u,u)),s.left<o.left){if(c=c.type.createAndFill(t),!c)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(t)}`)}else c=c.type.create(t,c.content)}if(s.top<o.top||s.bottom>o.bottom){const t={...c.attrs,rowspan:Math.min(s.bottom,o.bottom)-Math.max(s.top,o.top)};c=s.top<o.top?c.type.createAndFill(t):c.type.create(t,c.content)}l.push(c)}s.push(t.child(e).copy(i.from(l)))}const c=this.isColSelection()&&this.isRowSelection()?t:s;return new l(i.from(c),1,1)}replace(t,n=l.empty){const o=t.steps.length,r=this.ranges;for(let e=0;e<r.length;e++){const{$from:i,$to:s}=r[e],c=t.mapping.slice(o);t.replace(c.map(i.pos),c.map(s.pos),e?l.empty:n)}const i=e.findFrom(t.doc.resolve(t.mapping.slice(o).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new l(i.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),e=y.get(n),o=this.$anchorCell.start(-1),r=e.cellsInRect(e.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let e=0;e<r.length;e++)t(n.nodeAt(r[e]),o+r[e])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const e=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(e,o)==this.$headCell.node(-1).childCount}static colSelection(n,e=n){const o=n.node(-1),r=y.get(o),i=n.start(-1),l=r.findCell(n.pos-i),s=r.findCell(e.pos-i),c=n.node(0);return l.top<=s.top?(l.top>0&&(n=c.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=c.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))):(s.top>0&&(e=c.resolve(i+r.map[s.left])),l.bottom<r.height&&(n=c.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))),new t(n,e)}isRowSelection(){const t=this.$anchorCell.node(-1),n=y.get(t),e=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-e),r=n.colCount(this.$headCell.pos-e);if(Math.min(o,r)>0)return!1;const i=o+this.$anchorCell.nodeAfter.attrs.colspan,l=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==n.width}eq(n){return n instanceof t&&n.$anchorCell.pos==this.$anchorCell.pos&&n.$headCell.pos==this.$headCell.pos}static rowSelection(n,e=n){const o=n.node(-1),r=y.get(o),i=n.start(-1),l=r.findCell(n.pos-i),s=r.findCell(e.pos-i),c=n.node(0);return l.left<=s.left?(l.left>0&&(n=c.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=c.resolve(i+r.map[r.width*(s.top+1)-1]))):(s.left>0&&(e=c.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(n=c.resolve(i+r.map[r.width*(l.top+1)-1]))),new t(n,e)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(n,e){return new t(n.resolve(e.anchor),n.resolve(e.head))}static create(n,e,o=e){return new t(n.resolve(e),n.resolve(o))}getBookmark(){return new B(this.$anchorCell.pos,this.$headCell.pos)}};L.prototype.visible=!1,e.jsonID("cell",L);var B=class t{constructor(t,n){this.anchor=t,this.head=n}map(n){return new t(n.map(this.anchor),n.map(this.head))}resolve(t){const n=t.resolve(this.anchor),o=t.resolve(this.head);return"row"==n.parent.type.spec.tableRole&&"row"==o.parent.type.spec.tableRole&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&O(n,o)?new L(n,o):e.near(o,1)}};function j(t){if(!(t.selection instanceof L))return null;const n=[];return t.selection.forEachCell(((t,e)=>{n.push(u.node(e,e+t.nodeSize,{class:"selectedCell"}))})),f.create(t.doc,n)}const P=new n("fix-tables");function H(t,n,e,o){const r=t.childCount,i=n.childCount;t:for(let l=0,s=0;l<i;l++){const i=n.child(l);for(let n=s,o=Math.min(r,l+3);n<o;n++)if(t.child(n)==i){s=n+1,e+=i.nodeSize;continue t}o(i,e),s<r&&t.child(s).sameMarkup(i)?H(t.child(s),i,e+1,o):i.nodesBetween(0,i.content.size,o,e+1),e+=i.nodeSize}}function J(t,n){let e;const o=(n,o)=>{"table"==n.type.spec.tableRole&&(e=function(t,n,e,o){const r=y.get(n);if(!r.problems)return o;o||(o=t.tr);const i=[];for(let t=0;t<r.height;t++)i.push(0);for(let t=0;t<r.problems.length;t++){const l=r.problems[t];if("collision"==l.type){const t=n.nodeAt(l.pos);if(!t)continue;const r=t.attrs;for(let t=0;t<r.rowspan;t++)i[l.row+t]+=l.n;o.setNodeMarkup(o.mapping.map(e+1+l.pos),null,T(r,r.colspan-l.n,l.n))}else if("missing"==l.type)i[l.row]+=l.n;else if("overlong_rowspan"==l.type){const t=n.nodeAt(l.pos);if(!t)continue;o.setNodeMarkup(o.mapping.map(e+1+l.pos),null,{...t.attrs,rowspan:t.attrs.rowspan-l.n})}else if("colwidth mismatch"==l.type){const t=n.nodeAt(l.pos);if(!t)continue;o.setNodeMarkup(o.mapping.map(e+1+l.pos),null,{...t.attrs,colwidth:l.colwidth})}else if("zero_sized"==l.type){const t=o.mapping.map(e);o.delete(t,t+n.nodeSize)}}let l,s;for(let t=0;t<i.length;t++)i[t]&&(null==l&&(l=t),s=t);for(let c=0,f=e+1;c<r.height;c++){const e=n.child(c),r=f+e.nodeSize,u=i[c];if(u>0){let n="cell";e.firstChild&&(n=e.firstChild.type.spec.tableRole);const i=[];for(let e=0;e<u;e++){const e=_(t.schema)[n].createAndFill();e&&i.push(e)}const a=0!=c&&l!=c-1||s!=c?r-1:f+1;o.insert(o.mapping.map(a),i)}f=r}return o.setMeta(P,{fixTables:!0})}(t,n,o,e))};return n?n.doc!=t.doc&&H(n.doc,t.doc,0,o):t.doc.descendants(o),e}function U(t){const n=t.selection,e=A(t),o=e.node(-1),r=e.start(-1),i=y.get(o);return{...n instanceof L?i.rectBetween(n.$anchorCell.pos-r,n.$headCell.pos-r):i.findCell(e.pos-r),tableStart:r,map:i,table:o}}function K(t,{map:n,tableStart:e,table:o},r){let i=r>0?-1:0;(function(t,n,e){const o=_(n.type.schema).header_cell;for(let r=0;r<t.height;r++)if(n.nodeAt(t.map[e+r*t.width]).type!=o)return!1;return!0})(n,o,r+i)&&(i=0==r||r==n.width?null:0);for(let l=0;l<n.height;l++){const s=l*n.width+r;if(r>0&&r<n.width&&n.map[s-1]==n.map[s]){const i=n.map[s],c=o.nodeAt(i);t.setNodeMarkup(t.mapping.map(e+i),null,W(c.attrs,r-n.colCount(i))),l+=c.attrs.rowspan-1}else{const c=null==i?_(o.type.schema).cell:o.nodeAt(n.map[s+i]).type,f=n.positionAt(l,r,o);t.insert(t.mapping.map(e+f),c.createAndFill())}}return t}function V(t,n){if(!k(t))return!1;if(n){const e=U(t);n(K(t.tr,e,e.left))}return!0}function q(t,n){if(!k(t))return!1;if(n){const e=U(t);n(K(t.tr,e,e.right))}return!0}function F(t,{map:n,table:e,tableStart:o},r){const i=t.mapping.maps.length;for(let l=0;l<n.height;){const s=l*n.width+r,c=n.map[s],f=e.nodeAt(c),u=f.attrs;if(r>0&&n.map[s-1]==c||r<n.width-1&&n.map[s+1]==c)t.setNodeMarkup(t.mapping.slice(i).map(o+c),null,T(u,r-n.colCount(c)));else{const n=t.mapping.slice(i).map(o+c);t.delete(n,n+f.nodeSize)}l+=u.rowspan}}function I(t,n){if(!k(t))return!1;if(n){const e=U(t),o=t.tr;if(0==e.left&&e.right==e.map.width)return!1;for(let t=e.right-1;F(o,e,t),t!=e.left;t--){const t=e.tableStart?o.doc.nodeAt(e.tableStart-1):o.doc;if(!t)throw new RangeError("No table found");e.table=t,e.map=y.get(t)}n(o)}return!0}function X(t,{map:n,tableStart:e,table:o},r){let i=e;for(let t=0;t<r;t++)i+=o.child(t).nodeSize;const l=[];let s=r>0?-1:0;(function(t,n,e){var o;const r=_(n.type.schema).header_cell;for(let i=0;i<t.width;i++)if((null===(o=n.nodeAt(t.map[i+e*t.width]))||void 0===o?void 0:o.type)!=r)return!1;return!0})(n,o,r+s)&&(s=0==r||r==n.height?null:0);for(let i=0,f=n.width*r;i<n.width;i++,f++)if(r>0&&r<n.height&&n.map[f]==n.map[f-n.width]){const r=n.map[f],l=o.nodeAt(r).attrs;t.setNodeMarkup(e+r,null,{...l,rowspan:l.rowspan+1}),i+=l.colspan-1}else{var c;const t=null==s?_(o.type.schema).cell:null===(c=o.nodeAt(n.map[f+s*n.width]))||void 0===c?void 0:c.type,e=null==t?void 0:t.createAndFill();e&&l.push(e)}return t.insert(i,_(o.type.schema).row.create(null,l)),t}function G(t,n){if(!k(t))return!1;if(n){const e=U(t);n(X(t.tr,e,e.top))}return!0}function Q(t,n){if(!k(t))return!1;if(n){const e=U(t);n(X(t.tr,e,e.bottom))}return!0}function Y(t,{map:n,table:e,tableStart:o},r){let i=0;for(let t=0;t<r;t++)i+=e.child(t).nodeSize;const l=i+e.child(r).nodeSize,s=t.mapping.maps.length;t.delete(i+o,l+o);const c=new Set;for(let i=0,l=r*n.width;i<n.width;i++,l++){const f=n.map[l];if(!c.has(f))if(c.add(f),r>0&&f==n.map[l-n.width]){const n=e.nodeAt(f).attrs;t.setNodeMarkup(t.mapping.slice(s).map(f+o),null,{...n,rowspan:n.rowspan-1}),i+=n.colspan-1}else if(r<n.height&&f==n.map[l+n.width]){const l=e.nodeAt(f),c=l.attrs,u=l.type.create({...c,rowspan:l.attrs.rowspan-1},l.content),a=n.positionAt(r+1,i,e);t.insert(t.mapping.slice(s).map(o+a),u),i+=c.colspan-1}}}function Z(t,n){if(!k(t))return!1;if(n){const e=U(t),o=t.tr;if(0==e.top&&e.bottom==e.map.height)return!1;for(let t=e.bottom-1;Y(o,e,t),t!=e.top;t--){const t=e.tableStart?o.doc.nodeAt(e.tableStart-1):o.doc;if(!t)throw new RangeError("No table found");e.table=t,e.map=y.get(e.table)}n(o)}return!0}function tt(t){const n=t.content;return 1==n.childCount&&n.child(0).isTextblock&&0==n.child(0).childCount}function nt(t,n){const e=t.selection;if(!(e instanceof L)||e.$anchorCell.pos==e.$headCell.pos)return!1;const o=U(t),{map:r}=o;if(function({width:t,height:n,map:e},o){let r=o.top*t+o.left,i=r,l=(o.bottom-1)*t+o.left,s=r+(o.right-o.left-1);for(let n=o.top;n<o.bottom;n++){if(o.left>0&&e[i]==e[i-1]||o.right<t&&e[s]==e[s+1])return!0;i+=t,s+=t}for(let i=o.left;i<o.right;i++){if(o.top>0&&e[r]==e[r-t]||o.bottom<n&&e[l]==e[l+t])return!0;r++,l++}return!1}(r,o))return!1;if(n){const e=t.tr,l={};let s,c,f=i.empty;for(let t=o.top;t<o.bottom;t++)for(let n=o.left;n<o.right;n++){const i=r.map[t*r.width+n],u=o.table.nodeAt(i);if(!l[i]&&u)if(l[i]=!0,null==s)s=i,c=u;else{tt(u)||(f=f.append(u.content));const t=e.mapping.map(i+o.tableStart);e.delete(t,t+u.nodeSize)}}if(null==s||null==c)return!0;if(e.setNodeMarkup(s+o.tableStart,null,{...W(c.attrs,c.attrs.colspan,o.right-o.left-c.attrs.colspan),rowspan:o.bottom-o.top}),f.size>0){const t=s+1+c.content.size,n=tt(c)?s+1:t;e.replaceWith(n+o.tableStart,t+o.tableStart,f)}e.setSelection(new L(e.doc.resolve(s+o.tableStart))),n(e)}return!0}function et(t,n){const e=_(t.schema);return(o=({node:t})=>e[t.type.spec.tableRole],(t,n)=>{const e=t.selection;let r,i;if(e instanceof L){if(e.$anchorCell.pos!=e.$headCell.pos)return!1;r=e.$anchorCell.nodeAfter,i=e.$anchorCell.pos}else{var l;if(r=function(t){for(let n=t.depth;n>0;n--){const e=t.node(n).type.spec.tableRole;if("cell"===e||"header_cell"===e)return t.node(n)}return null}(e.$from),!r)return!1;i=null===(l=z(e.$from))||void 0===l?void 0:l.pos}if(null==r||null==i)return!1;if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(n){let l=r.attrs;const s=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=U(t),u=t.tr;for(let t=0;t<f.right-f.left;t++)s.push(c?{...l,colwidth:c&&c[t]?[c[t]]:null}:l);let a;for(let t=f.top;t<f.bottom;t++){let n=f.map.positionAt(t,f.left,f.table);t==f.top&&(n+=r.nodeSize);for(let e=f.left,i=0;e<f.right;e++,i++)e==f.left&&t==f.top||u.insert(a=u.mapping.map(n+f.tableStart,1),o({node:r,row:t,col:e}).createAndFill(s[i]))}u.setNodeMarkup(i,o({node:r,row:f.top,col:f.left}),s[0]),e instanceof L&&u.setSelection(new L(u.doc.resolve(e.$anchorCell.pos),a?u.doc.resolve(a):void 0)),n(u)}return!0})(t,n);var o}function ot(t,n,e){const o=n.map.cellsInRect({left:0,top:0,right:"row"==t?n.map.width:1,bottom:"column"==t?n.map.height:1});for(let t=0;t<o.length;t++){const r=n.table.nodeAt(o[t]);if(r&&r.type!==e.header_cell)return!1}return!0}function rt(t,n){return(n=n||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(t){return function(n,e){if(!k(n))return!1;if(e){const o=_(n.schema),r=U(n),i=n.tr,l=r.map.cellsInRect("column"==t?{left:r.left,top:0,right:r.right,bottom:r.map.height}:"row"==t?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),s=l.map((t=>r.table.nodeAt(t)));for(let t=0;t<l.length;t++)s[t].type==o.header_cell&&i.setNodeMarkup(r.tableStart+l[t],o.cell,s[t].attrs);if(0===i.steps.length)for(let t=0;t<l.length;t++)i.setNodeMarkup(r.tableStart+l[t],o.header_cell,s[t].attrs);e(i)}return!0}}(t):function(n,e){if(!k(n))return!1;if(e){const o=_(n.schema),r=U(n),i=n.tr,l=ot("row",r,o),s=ot("column",r,o),c=("column"===t?l:"row"===t&&s)?1:0,f="column"==t?{left:0,top:c,right:1,bottom:r.map.height}:"row"==t?{left:c,top:0,right:r.map.width,bottom:1}:r,u="column"==t?s?o.cell:o.header_cell:"row"==t?l?o.cell:o.header_cell:o.cell;r.map.cellsInRect(f).forEach((t=>{const n=t+r.tableStart,e=i.doc.nodeAt(n);e&&i.setNodeMarkup(n,u,e.attrs)})),e(i)}return!0}}const it=rt("row",{useDeprecatedLogic:!0});function lt(t,n){const e=t.selection.$anchor;for(let o=e.depth;o>0;o--)if("table"==e.node(o).type.spec.tableRole)return n&&n(t.tr.delete(e.before(o),e.after(o)).scrollIntoView()),!0;return!1}function st(t,n){const e=t.selection;if(!(e instanceof L))return!1;if(n){const o=t.tr,r=_(t.schema).cell.createAndFill().content;e.forEachCell(((t,n)=>{t.content.eq(r)||o.replace(o.mapping.map(n+1),o.mapping.map(n+t.nodeSize-1),new l(r,0,0))})),o.docChanged&&n(o)}return!0}function ct(t){if(0===t.size)return null;let{content:n,openStart:e,openEnd:o}=t;for(;1==n.childCount&&(e>0&&o>0||"table"==n.child(0).type.spec.tableRole);)e--,o--,n=n.child(0).content;const r=n.child(0),s=r.type.spec.tableRole,c=r.type.schema,f=[];if("row"==s)for(let t=0;t<n.childCount;t++){let r=n.child(t).content;const i=t?0:Math.max(0,e-1),s=t<n.childCount-1?0:Math.max(0,o-1);(i||s)&&(r=ft(_(c).row,new l(r,i,s)).content),f.push(r)}else{if("cell"!=s&&"header_cell"!=s)return null;f.push(e||o?ft(_(c).row,new l(n,e,o)).content:n)}return function(t,n){const e=[];for(let t=0;t<n.length;t++){const o=n[t];for(let n=o.childCount-1;n>=0;n--){const{rowspan:r,colspan:i}=o.child(n).attrs;for(let n=t;n<t+r;n++)e[n]=(e[n]||0)+i}}let o=0;for(let t=0;t<e.length;t++)o=Math.max(o,e[t]);for(let r=0;r<e.length;r++)if(r>=n.length&&n.push(i.empty),e[r]<o){const l=_(t).cell.createAndFill(),s=[];for(let t=e[r];t<o;t++)s.push(l);n[r]=n[r].append(i.from(s))}return{height:n.length,width:o,rows:n}}(c,f)}function ft(t,n){const e=t.createAndFill();return new c(e).replace(0,e.content.size,n).doc}function ut(t,n,e,o,r,i,l,s){if(0==l||l==n.height)return!1;let c=!1;for(let f=r;f<i;f++){const r=l*n.width+f,i=n.map[r];if(n.map[r-n.width]==i){c=!0;const r=e.nodeAt(i),{top:u,left:a}=n.findCell(i);t.setNodeMarkup(t.mapping.slice(s).map(i+o),null,{...r.attrs,rowspan:l-u}),t.insert(t.mapping.slice(s).map(n.positionAt(l,a,e)),r.type.createAndFill({...r.attrs,rowspan:u+r.attrs.rowspan-l})),f+=r.attrs.colspan-1}}return c}function at(t,n,e,o,r,i,l,s){if(0==l||l==n.width)return!1;let c=!1;for(let f=r;f<i;f++){const r=f*n.width+l,i=n.map[r];if(n.map[r-1]==i){c=!0;const r=e.nodeAt(i),u=n.colCount(i),a=t.mapping.slice(s).map(i+o);t.setNodeMarkup(a,null,T(r.attrs,l-u,r.attrs.colspan-(l-u))),t.insert(a+r.nodeSize,r.type.createAndFill(T(r.attrs,0,l-u))),f+=r.attrs.rowspan-1}}return c}function ht(t,n,e,o,r){let s=e?t.doc.nodeAt(e-1):t.doc;if(!s)throw new Error("No table found");let c=y.get(s);const{top:f,left:u}=o,a=u+r.width,h=f+r.height,w=t.tr;let d=0;function p(){if(s=e?w.doc.nodeAt(e-1):w.doc,!s)throw new Error("No table found");c=y.get(s),d=w.mapping.maps.length}(function(t,n,e,o,r,l,s){const c=_(t.doc.type.schema);let f,u;if(r>n.width)for(let i=0,l=0;i<n.height;i++){const a=e.child(i);l+=a.nodeSize;const h=[];let w;w=null==a.lastChild||a.lastChild.type==c.cell?f||(f=c.cell.createAndFill()):u||(u=c.header_cell.createAndFill());for(let t=n.width;t<r;t++)h.push(w);t.insert(t.mapping.slice(s).map(l-1+o),h)}if(l>n.height){const a=[];for(let t=0,o=(n.height-1)*n.width;t<Math.max(n.width,r);t++){const r=!(t>=n.width)&&e.nodeAt(n.map[o+t]).type==c.header_cell;a.push(r?u||(u=c.header_cell.createAndFill()):f||(f=c.cell.createAndFill()))}const h=c.row.create(null,i.from(a)),w=[];for(let t=n.height;t<l;t++)w.push(h);t.insert(t.mapping.slice(s).map(o+e.nodeSize-2),w)}return!(!f&&!u)})(w,c,s,e,a,h,d)&&p(),ut(w,c,s,e,u,a,f,d)&&p(),ut(w,c,s,e,u,a,h,d)&&p(),at(w,c,s,e,f,h,u,d)&&p(),at(w,c,s,e,f,h,a,d)&&p();for(let t=f;t<h;t++){const n=c.positionAt(t,u,s),o=c.positionAt(t,a,s);w.replace(w.mapping.slice(d).map(n+e),w.mapping.slice(d).map(o+e),new l(r.rows[t-f],0,0))}p(),w.setSelection(new L(w.doc.resolve(e+c.positionAt(f,u,s)),w.doc.resolve(e+c.positionAt(h-1,a-1,s)))),n(w)}rt("column",{useDeprecatedLogic:!0}),rt("cell",{useDeprecatedLogic:!0});const wt=b({ArrowLeft:pt("horiz",-1),ArrowRight:pt("horiz",1),ArrowUp:pt("vert",-1),ArrowDown:pt("vert",1),"Shift-ArrowLeft":mt("horiz",-1),"Shift-ArrowRight":mt("horiz",1),"Shift-ArrowUp":mt("vert",-1),"Shift-ArrowDown":mt("vert",1),Backspace:st,"Mod-Backspace":st,Delete:st,"Mod-Delete":st});function dt(t,n,e){return!e.eq(t.selection)&&(n&&n(t.tr.setSelection(e).scrollIntoView()),!0)}function pt(t,n){return(o,r,i)=>{if(!i)return!1;const l=o.selection;if(l instanceof L)return dt(o,r,e.near(l.$headCell,n));if("horiz"!=t&&!l.empty)return!1;const s=Mt(i,t,n);if(null==s)return!1;if("horiz"==t)return dt(o,r,e.near(o.doc.resolve(l.head+n),n));{const i=o.doc.resolve(s),l=x(i,t,n);let c;return c=l?e.near(l,1):n<0?e.near(o.doc.resolve(i.before(-1)),-1):e.near(o.doc.resolve(i.after(-1)),1),dt(o,r,c)}}}function mt(t,n){return(e,o,r)=>{if(!r)return!1;const i=e.selection;let l;if(i instanceof L)l=i;else{const o=Mt(r,t,n);if(null==o)return!1;l=new L(e.doc.resolve(o))}const s=x(l.$headCell,t,n);return!!s&&dt(e,o,new L(l.$anchorCell,s))}}function gt(t,n){const e=z(t.state.doc.resolve(n));return!!e&&(t.dispatch(t.state.tr.setSelection(new L(e))),!0)}function bt(t,n,e){if(!k(t.state))return!1;let o=ct(e);const r=t.state.selection;if(r instanceof L){o||(o={width:1,height:1,rows:[i.from(ft(_(t.state.schema).cell,e))]});const n=r.$anchorCell.node(-1),l=r.$anchorCell.start(-1),s=y.get(n).rectBetween(r.$anchorCell.pos-l,r.$headCell.pos-l);return o=function({width:t,height:n,rows:e},o,r){if(t!=o){const n=[],r=[];for(let t=0;t<e.length;t++){const l=e[t],s=[];for(let e=n[t]||0,r=0;e<o;r++){let i=l.child(r%l.childCount);e+i.attrs.colspan>o&&(i=i.type.createChecked(T(i.attrs,i.attrs.colspan,e+i.attrs.colspan-o),i.content)),s.push(i),e+=i.attrs.colspan;for(let e=1;e<i.attrs.rowspan;e++)n[t+e]=(n[t+e]||0)+i.attrs.colspan}r.push(i.from(s))}e=r,t=o}if(n!=r){const t=[];for(let o=0,l=0;o<r;o++,l++){const s=[],c=e[l%n];for(let t=0;t<c.childCount;t++){let n=c.child(t);o+n.attrs.rowspan>r&&(n=n.type.create({...n.attrs,rowspan:Math.max(1,r-n.attrs.rowspan)},n.content)),s.push(n)}t.push(i.from(s))}e=t,n=r}return{width:t,height:n,rows:e}}(o,s.right-s.left,s.bottom-s.top),ht(t.state,t.dispatch,l,s,o),!0}if(o){const n=A(t.state),e=n.start(-1);return ht(t.state,t.dispatch,e,y.get(n.node(-1)).findCell(n.pos-e),o),!0}return!1}function vt(t,n){var e;if(0!=n.button)return;if(n.ctrlKey||n.metaKey)return;const o=yt(t,n.target);let r;if(n.shiftKey&&t.state.selection instanceof L)i(t.state.selection.$anchorCell,n),n.preventDefault();else if(n.shiftKey&&o&&null!=(r=z(t.state.selection.$anchor))&&(null===(e=Dt(t,n))||void 0===e?void 0:e.pos)!=r.pos)i(r,n),n.preventDefault();else if(!o)return;function i(n,e){let o=Dt(t,e);const r=null==N.getState(t.state);if(!o||!O(n,o)){if(!r)return;o=n}const i=new L(n,o);if(r||!t.state.selection.eq(i)){const e=t.state.tr.setSelection(i);r&&e.setMeta(N,n.pos),t.dispatch(e)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",s),null!=N.getState(t.state)&&t.dispatch(t.state.tr.setMeta(N,-1))}function s(e){const r=e,s=N.getState(t.state);let c;if(null!=s)c=t.state.doc.resolve(s);else if(yt(t,r.target)!=o&&(c=Dt(t,n),!c))return l();c&&i(c,r)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",s)}function Mt(t,n,e){if(!(t.state.selection instanceof r))return null;const{$head:o}=t.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((e<0?o.index(r):o.indexAfter(r))!=(e<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=o.before(r),l="vert"==n?e>0?"down":"up":e>0?"right":"left";return t.endOfTextblock(l)?i:null}}return null}function yt(t,n){for(;n&&n!=t.dom;n=n.parentNode)if("TD"==n.nodeName||"TH"==n.nodeName)return n;return null}function Dt(t,n){const e=t.posAtCoords({left:n.clientX,top:n.clientY});if(!e)return null;let{inside:o,pos:r}=e;return o>=0&&z(t.state.doc.resolve(o))||z(t.state.doc.resolve(r))}var St=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),$t(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type==this.node.type&&(this.node=t,$t(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))}};function $t(t,n,e,o,r,i){let l=0,s=!0,c=n.firstChild;const f=t.firstChild;if(f){for(let t=0,e=0;t<f.childCount;t++){const{colspan:u,colwidth:a}=f.child(t).attrs;for(let t=0;t<u;t++,e++){const f=r==e?i:a&&a[t],u=f?f+"px":"";if(l+=f||o,f||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{const t=document.createElement("col");t.style.width=u,n.appendChild(t)}}}for(;c;){var u;const t=c.nextSibling;null===(u=c.parentNode)||void 0===u||u.removeChild(c),c=t}s?(e.style.width=l+"px",e.style.minWidth=""):(e.style.width="",e.style.minWidth=l+"px")}}const Et=new n("tableColumnResizing");function Rt({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:o=100,View:r=St,lastColumnResizable:i=!0}={}){const l=new t({key:Et,state:{init(t,n){var e;const i=null===(e=l.spec)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.nodeViews,s=_(n.schema).table.name;return r&&i&&(i[s]=(t,n)=>new r(t,o,n)),new _t(-1,!1)},apply:(t,n)=>n.apply(t)},props:{attributes:t=>{const n=Et.getState(t);return n&&n.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,e)=>{!function(t,n,e,o){if(!t.editable)return;const r=Et.getState(t.state);if(!r)return;if(!r.dragging){const i=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}(n.target);let l=-1;if(i){const{left:o,right:r}=i.getBoundingClientRect();n.clientX-o<=e?l=Nt(t,n,"left",e):r-n.clientX<=e&&(l=Nt(t,n,"right",e))}if(l!=r.activeHandle){if(!o&&-1!==l){const n=t.state.doc.resolve(l),e=n.node(-1),o=y.get(e),r=n.start(-1);if(o.colCount(n.pos-r)+n.nodeAfter.attrs.colspan-1==o.width-1)return}kt(t,l)}}}(t,e,n,i)},mouseleave:t=>{!function(t){if(!t.editable)return;const n=Et.getState(t.state);n&&n.activeHandle>-1&&!n.dragging&&kt(t,-1)}(t)},mousedown:(t,n)=>{!function(t,n,e,o){var r;if(!t.editable)return!1;const i=null!==(r=t.dom.ownerDocument.defaultView)&&void 0!==r?r:window,l=Et.getState(t.state);if(!l||-1==l.activeHandle||l.dragging)return!1;const s=t.state.doc.nodeAt(l.activeHandle),c=function(t,n,{colspan:e,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=t.domAtPos(n);let l=i.node.childNodes[i.offset].offsetWidth,s=e;if(o)for(let t=0;t<e;t++)o[t]&&(l-=o[t],s--);return l/s}(t,l.activeHandle,s.attrs);function f(n){i.removeEventListener("mouseup",f),i.removeEventListener("mousemove",u);const o=Et.getState(t.state);(null==o?void 0:o.dragging)&&(!function(t,n,e){const o=t.state.doc.resolve(n),r=o.node(-1),i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1,c=t.state.tr;for(let t=0;t<i.height;t++){const n=t*i.width+s;if(t&&i.map[n]==i.map[n-i.width])continue;const o=i.map[n],f=r.nodeAt(o).attrs,u=1==f.colspan?0:s-i.colCount(o);if(f.colwidth&&f.colwidth[u]==e)continue;const a=f.colwidth?f.colwidth.slice():Ct(f.colspan);a[u]=e,c.setNodeMarkup(l+o,null,{...f,colwidth:a})}c.docChanged&&t.dispatch(c)}(t,o.activeHandle,zt(o.dragging,n,e)),t.dispatch(t.state.tr.setMeta(Et,{setDragging:null})))}function u(n){if(!n.which)return f(n);const r=Et.getState(t.state);if(r&&r.dragging){const i=zt(r.dragging,n,e);At(t,r.activeHandle,i,o)}}t.dispatch(t.state.tr.setMeta(Et,{setDragging:{startX:n.clientX,startWidth:c}})),At(t,l.activeHandle,c,o),i.addEventListener("mouseup",f),i.addEventListener("mousemove",u),n.preventDefault()}(t,n,e,o)}},decorations:t=>{const n=Et.getState(t);if(n&&n.activeHandle>-1)return function(t,n){const e=[],o=t.doc.resolve(n),r=o.node(-1);if(!r)return f.empty;const i=y.get(r),l=o.start(-1),s=i.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let n=0;n<i.height;n++){const o=s+n*i.width;if(!(s!=i.width-1&&i.map[o]==i.map[o+1]||0!=n&&i.map[o]==i.map[o-i.width])){var c;const n=i.map[o],s=l+n+r.nodeAt(n).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(null===(c=Et.getState(t))||void 0===c?void 0:c.dragging)&&e.push(u.node(l+n,l+n+r.nodeAt(n).nodeSize,{class:"column-resize-dragging"})),e.push(u.widget(s,f))}}return f.create(t.doc,e)}(t,n.activeHandle)},nodeViews:{}}});return l}var _t=class t{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(n){const e=this,o=n.getMeta(Et);if(o&&null!=o.setHandle)return new t(o.setHandle,!1);if(o&&void 0!==o.setDragging)return new t(e.activeHandle,o.setDragging);if(e.activeHandle>-1&&n.docChanged){let o=n.mapping.map(e.activeHandle,-1);return C(n.doc.resolve(o))||(o=-1),new t(o,e.dragging)}return e}};function Nt(t,n,e,o){const r="right"==e?-o:o,i=t.posAtCoords({left:n.clientX+r,top:n.clientY});if(!i)return-1;const{pos:l}=i,s=z(t.state.doc.resolve(l));if(!s)return-1;if("right"==e)return s.pos;const c=y.get(s.node(-1)),f=s.start(-1),u=c.map.indexOf(s.pos-f);return u%c.width==0?-1:f+c.map[u-1]}function zt(t,n,e){const o=n.clientX-t.startX;return Math.max(e,t.startWidth+o)}function kt(t,n){t.dispatch(t.state.tr.setMeta(Et,{setHandle:n}))}function At(t,n,e,o){const r=t.state.doc.resolve(n),i=r.node(-1),l=r.start(-1),s=y.get(i).colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;let c=t.domAtPos(r.start(-1)).node;for(;c&&"TABLE"!=c.nodeName;)c=c.parentNode;c&&$t(i,c.firstChild,c,o,s,e)}function Ct(t){return Array(t).fill(0)}function Ot({allowTableNodeSelection:n=!1}={}){return new t({key:N,state:{init:()=>null,apply(t,n){const e=t.getMeta(N);if(null!=e)return-1==e?null:e;if(null==n||!t.docChanged)return n;const{deleted:o,pos:r}=t.mapping.mapResult(n);return o?null:r}},props:{decorations:j,handleDOMEvents:{mousedown:vt},createSelectionBetween:t=>null!=N.getState(t.state)?t.state.selection:null,handleTripleClick:gt,handleKeyDown:wt,handlePaste:bt},appendTransaction:(t,e,o)=>function(t,n,e){const o=(n||t).selection,i=(n||t).doc;let l,c;if(o instanceof s&&(c=o.node.type.spec.tableRole)){if("cell"==c||"header_cell"==c)l=L.create(i,o.from);else if("row"==c){const t=i.resolve(o.from+1);l=L.rowSelection(t,t)}else if(!e){const t=y.get(o.node),n=o.from+1,e=n+t.map[t.width*t.height-1];l=L.create(i,n+1,e)}}else o instanceof r&&function({$from:t,$to:n}){if(t.pos==n.pos||t.pos<n.pos-6)return!1;let e=t.pos,o=n.pos,r=t.depth;for(;r>=0&&!(t.after(r+1)<t.end(r));r--,e++);for(let t=n.depth;t>=0&&!(n.before(t+1)>n.start(t));t--,o--);return e==o&&/row|table/.test(t.node(r).type.spec.tableRole)}(o)?l=r.create(i,o.from):o instanceof r&&function({$from:t,$to:n}){let e,o;for(let n=t.depth;n>0;n--){const o=t.node(n);if("cell"===o.type.spec.tableRole||"header_cell"===o.type.spec.tableRole){e=o;break}}for(let t=n.depth;t>0;t--){const e=n.node(t);if("cell"===e.type.spec.tableRole||"header_cell"===e.type.spec.tableRole){o=e;break}}return e!==o&&0===n.parentOffset}(o)&&(l=r.create(i,o.$from.start(),o.$from.end()));return l&&(n||(n=t.tr)).setSelection(l),n}(o,J(o,e),n)})}export{R as a,b,Rt as c,lt as d,it as e,I as f,Z as g,q as h,V as i,Q as j,g as k,G as l,nt as m,et as s,Ot as t};
@@ -0,0 +1 @@
1
+ import{c as t,T as e,a as i,S as r,d as n,e as s,F as l,D as o,M as h,A as f}from"./index-6f3fa4ab.esm.js";const u=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},c=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let a=null;const d=function(t,e,i){let r=a||(a=document.createRange());return r.setEnd(t,null==i?t.nodeValue.length:i),r.setStart(t,e||0),r},p=function(t,e,i,r){return i&&(b(t,e,i,r,-1)||b(t,e,i,r,1))},m=/^(img|br|input|textarea|hr)$/i;function b(t,e,i,r,n){for(var s;;){if(t==i&&e==r)return!0;if(e==(n<0?0:g(t))){let i=t.parentNode;if(!i||1!=i.nodeType||w(t)||m.test(t.nodeName)||"false"==t.contentEditable)return!1;e=u(t)+(n<0?0:1),t=i}else{if(1!=t.nodeType)return!1;{let i=t.childNodes[e+(n<0?-1:0)];if(1==i.nodeType&&"false"==i.contentEditable){if(!(null===(s=i.pmViewDesc)||void 0===s?void 0:s.ignoreForSelection))return!1;e+=n}else t=i,e=n<0?g(t):0}}}}function g(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function w(t){let e;for(let i=t;i&&!(e=i.pmViewDesc);i=i.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const k=function(t){return t.focusNode&&p(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function M(t,e){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=t,i.key=i.code=e,i}const y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,D=y&&y.userAgent||"",x=/Edge\/(\d+)/.exec(D),O=/MSIE \d/.exec(D),S=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(D),T=!!(O||S||x),C=O?document.documentMode:S?+S[1]:x?+x[1]:0,P=!T&&/gecko\/(\d+)/i.test(D);P&&(/Firefox\/(\d+)/.exec(D)||[0,0])[1];const E=!T&&/Chrome\/(\d+)/.exec(D),N=!!E,R=E?+E[1]:0,A=!T&&!!y&&/Apple Computer/.test(y.vendor),B=A&&(/Mobile\/\w+/.test(D)||!!y&&y.maxTouchPoints>2),$=B||!!y&&/Mac/.test(y.platform),I=!!y&&/Win/.test(y.platform),F=/Android \d/.test(D),K=!!v&&"webkitFontSmoothing"in v.documentElement.style,L=K?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function q(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function H(t,e){return"number"==typeof t?t:t[e]}function W(t){let e=t.getBoundingClientRect(),i=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*i,top:e.top,bottom:e.top+t.clientHeight*r}}function V(t,e,i){if(!X(e)&&0==e.left)return;let r=t.someProp("scrollThreshold")||0,n=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=i||t.dom;l;){if(1!=l.nodeType){l=c(l);continue}let t=l,i=t==s.body,o=i?q(s):W(t),h=0,f=0;if(e.top<o.top+H(r,"top")?f=-(o.top-e.top+H(n,"top")):e.bottom>o.bottom-H(r,"bottom")&&(f=e.bottom-e.top>o.bottom-o.top?e.top+H(n,"top")-o.top:e.bottom-o.bottom+H(n,"bottom")),e.left<o.left+H(r,"left")?h=-(o.left-e.left+H(n,"left")):e.right>o.right-H(r,"right")&&(h=e.right-o.right+H(n,"right")),h||f)if(i)s.defaultView.scrollBy(h,f);else{let i=t.scrollLeft,r=t.scrollTop;f&&(t.scrollTop+=f),h&&(t.scrollLeft+=h);let n=t.scrollLeft-i,s=t.scrollTop-r;e={left:e.left-n,top:e.top-s,right:e.right-n,bottom:e.bottom-s}}let u=i?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(u))break;l="absolute"==u?l.offsetParent:c(l)}}function j(t){let e=[],i=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=i);r=c(r));return e}function z(t,e){for(let i=0;i<t.length;i++){let{dom:r,top:n,left:s}=t[i];r.scrollTop!=n+e&&(r.scrollTop=n+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let G=null;function U(t,e){let i,r,n,s,l=2e8,o=0,h=e.top,f=e.top;for(let u=t.firstChild,c=0;u;u=u.nextSibling,c++){let t;if(1==u.nodeType)t=u.getClientRects();else{if(3!=u.nodeType)continue;t=d(u).getClientRects()}for(let a=0;a<t.length;a++){let d=t[a];if(d.top<=h&&d.bottom>=f){h=Math.max(d.bottom,h),f=Math.min(d.top,f);let t=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(t<l){i=u,l=t,r=t&&3==i.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==u.nodeType&&t&&(o=c+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!n&&d.left<=e.left&&d.right>=e.left&&(n=u,s={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!i&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(o=c+1)}}return!i&&n&&(i=n,r=s,l=0),i&&3==i.nodeType?function(t,e){let i,r=t.nodeValue.length,n=document.createRange();for(let s=0;s<r;s++){n.setEnd(t,s+1),n.setStart(t,s);let r=Z(n,1);if(r.top!=r.bottom&&J(e,r)){i={node:t,offset:s+(e.left>=(r.left+r.right)/2?1:0)};break}}return n.detach(),i||{node:t,offset:0}}(i,r):!i||l&&1==i.nodeType?{node:t,offset:o}:U(i,r)}function J(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Y(t,e,i){let r=t.childNodes.length;if(r&&i.top<i.bottom)for(let n=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-i.top)/(i.bottom-i.top))-2)),s=n;;){let i=t.childNodes[s];if(1==i.nodeType){let t=i.getClientRects();for(let r=0;r<t.length;r++){let n=t[r];if(J(e,n))return Y(i,e,n)}}if((s=(s+1)%r)==n)break}return t}function Q(t,e){let i,r=t.dom.ownerDocument,n=0,s=function(t,e,i){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,i);if(r)return{node:r.offsetNode,offset:Math.min(g(r.offsetNode),r.offset)}}catch(t){}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,i);if(r)return{node:r.startContainer,offset:Math.min(g(r.startContainer),r.startOffset)}}}(r,e.left,e.top);s&&({node:i,offset:n}=s);let l,o=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!o||!t.dom.contains(1!=o.nodeType?o.parentNode:o)){let i=t.dom.getBoundingClientRect();if(!J(e,i))return null;if(o=Y(t.dom,e,i),!o)return null}if(A)for(let t=o;i&&t;t=c(t))t.draggable&&(i=void 0);if(o=function(t,e){let i=t.parentNode;return i&&/^li$/i.test(i.nodeName)&&e.left<t.getBoundingClientRect().left?i:t}(o,e),i){if(P&&1==i.nodeType&&(n=Math.min(n,i.childNodes.length),n<i.childNodes.length)){let t,r=i.childNodes[n];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&n++}let r;K&&n&&1==i.nodeType&&1==(r=i.childNodes[n-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=e.top&&n--,i==t.dom&&n==i.childNodes.length-1&&1==i.lastChild.nodeType&&e.top>i.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=n&&1==i.nodeType&&"BR"==i.childNodes[n-1].nodeName||(l=function(t,e,i,r){let n=-1;for(let i=e,s=!1;i!=t.dom;){let e,l=t.docView.nearestDesc(i,!0);if(!l)return null;if(1==l.dom.nodeType&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((e=l.dom.getBoundingClientRect()).width||e.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&e.left>r.left||e.top>r.top?n=l.posBefore:(!s&&e.right<r.left||e.bottom<r.top)&&(n=l.posAfter),s=!0),!l.contentDOM&&n<0&&!l.node.isText))return(l.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return n>-1?n:t.docView.posFromDOM(e,i,-1)}(t,i,n,e))}null==l&&(l=function(t,e,i){let{node:r,offset:n}=U(e,i),s=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();s=t.left!=t.right&&i.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,n,s)}(t,o,e));let h=t.docView.nearestDesc(o,!0);return{pos:l,inside:h?h.posAtStart-h.border:-1}}function X(t){return t.top<t.bottom||t.left<t.right}function Z(t,e){let i=t.getClientRects();if(i.length){let t=i[e<0?0:i.length-1];if(X(t))return t}return Array.prototype.find.call(i,X)||t.getBoundingClientRect()}const _=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tt(t,e,i){let{node:r,offset:n,atom:s}=t.docView.domFromPos(e,i<0?-1:1),l=K||P;if(3==r.nodeType){if(!l||!_.test(r.nodeValue)&&(i<0?n:n!=r.nodeValue.length)){let t=n,e=n,s=i<0?1:-1;return i<0&&!n?(e++,s=-1):i>=0&&n==r.nodeValue.length?(t--,s=1):i<0?t--:e++,et(Z(d(r,t,e),s),s<0)}{let t=Z(d(r,n,n),i);if(P&&n&&/\s/.test(r.nodeValue[n-1])&&n<r.nodeValue.length){let e=Z(d(r,n-1,n-1),-1);if(e.top==t.top){let i=Z(d(r,n,n+1),-1);if(i.top!=t.top)return et(i,i.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(null==s&&n&&(i<0||n==g(r))){let t=r.childNodes[n-1];if(1==t.nodeType)return it(t.getBoundingClientRect(),!1)}if(null==s&&n<g(r)){let t=r.childNodes[n];if(1==t.nodeType)return it(t.getBoundingClientRect(),!0)}return it(r.getBoundingClientRect(),i>=0)}if(null==s&&n&&(i<0||n==g(r))){let t=r.childNodes[n-1],e=3==t.nodeType?d(t,g(t)-(l?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return et(Z(e,1),!1)}if(null==s&&n<g(r)){let t=r.childNodes[n];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?d(t,0,l?0:1):1==t.nodeType?t:null:null;if(e)return et(Z(e,-1),!0)}return et(Z(3==r.nodeType?d(r):r,-i),i>=0)}function et(t,e){if(0==t.width)return t;let i=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:i,right:i}}function it(t,e){if(0==t.height)return t;let i=e?t.top:t.bottom;return{top:i,bottom:i,left:t.left,right:t.right}}function rt(t,e,i){let r=t.state,n=t.root.activeElement;r!=e&&t.updateState(e),n!=t.dom&&t.focus();try{return i()}finally{r!=e&&t.updateState(r),n!=t.dom&&n&&n.focus()}}const nt=/[\u0590-\u08ac]/;let st=null,lt=null,ot=!1;function ht(t,e,i){return st==e&&lt==i?ot:(st=e,lt=i,ot="up"==i||"down"==i?function(t,e,i){let r=e.selection,n="up"==i?r.$from:r.$to;return rt(t,e,(()=>{let{node:e}=t.docView.domFromPos(n.pos,"up"==i?-1:1);for(;;){let i=t.docView.nearestDesc(e,!0);if(!i)break;if(i.node.isBlock){e=i.contentDOM||i.dom;break}e=i.dom.parentNode}let r=tt(t,n.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=d(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let n=e[t];if(n.bottom>n.top+1&&("up"==i?r.top-n.top>2*(n.bottom-r.top):n.bottom-r.bottom>2*(r.bottom-n.top)))return!1}}return!0}))}(t,e,i):function(t,e,i){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let n=r.parentOffset,s=!n,l=n==r.parent.content.size,o=t.domSelection();return o?nt.test(r.parent.textContent)&&o.modify?rt(t,e,(()=>{let{focusNode:e,focusOffset:n,anchorNode:s,anchorOffset:l}=t.domSelectionRange(),h=o.caretBidiLevel;o.modify("move",i,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:u,focusOffset:c}=t.domSelectionRange(),a=u&&!f.contains(1==u.nodeType?u:u.parentNode)||e==u&&n==c;try{o.collapse(s,l),e&&(e!=s||n!=l)&&o.extend&&o.extend(e,n)}catch(t){}return null!=h&&(o.caretBidiLevel=h),a})):"left"==i||"backward"==i?s:l:r.pos==r.start()||r.pos==r.end()}(t,e,i))}class ft{constructor(t,e,i,r){this.parent=t,this.children=e,this.dom=i,this.contentDOM=r,this.dirty=0,i.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,i){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,i=this.posAtStart;;e++){let r=this.children[e];if(r==t)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,i){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(i<0){let i,r;if(t==this.contentDOM)i=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&(!(r=i.pmViewDesc)||r.parent!=this);)i=i.previousSibling;return i?this.posBeforeChild(r)+r.size:this.posAtStart}{let i,r;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(r=i.pmViewDesc)||r.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>u(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?i>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let i=!0,r=t;r;r=r.parentNode){let n,s=this.getDesc(r);if(s&&(!e||s.node)){if(!i||!(n=s.nodeDOM)||(1==n.nodeType?n.contains(1==t.nodeType?t:t.parentNode):n==t))return s;i=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,i){for(let r=t;r;r=r.parentNode){let n=this.getDesc(r);if(n)return n.localPosFromDOM(t,e,i)}return-1}descAt(t){for(let e=0,i=0;e<this.children.length;e++){let r=this.children[e],n=i+r.size;if(i==t&&n!=i){for(;!r.border&&r.children.length;)for(let t=0;t<r.children.length;t++){let e=r.children[t];if(e.size){r=e;break}}return r}if(t<n)return r.descAt(t-i-r.border);i=n}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let i=0,r=0;for(let e=0;i<this.children.length;i++){let n=this.children[i],s=e+n.size;if(s>t||n instanceof bt){r=t-e;break}e=s}if(r)return this.children[i].domFromPos(r-this.children[i].border,e);for(let t;i&&!(t=this.children[i-1]).size&&t instanceof ut&&t.side>=0;i--);if(e<=0){let t,r=!0;for(;t=i?this.children[i-1]:null,t&&t.dom.parentNode!=this.contentDOM;i--,r=!1);return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?u(t.dom)+1:0}}{let t,r=!0;for(;t=i<this.children.length?this.children[i]:null,t&&t.dom.parentNode!=this.contentDOM;i++,r=!1);return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?u(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,i=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,n=-1;for(let s=i,l=0;;l++){let i=this.children[l],o=s+i.size;if(-1==r&&t<=o){let n=s+i.border;if(t>=n&&e<=o-i.border&&i.node&&i.contentDOM&&this.contentDOM.contains(i.contentDOM))return i.parseRange(t,e,n);t=s;for(let e=l;e>0;e--){let i=this.children[e-1];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(1)){r=u(i.dom)+1;break}t-=i.size}-1==r&&(r=0)}if(r>-1&&(o>e||l==this.children.length-1)){e=o;for(let t=l+1;t<this.children.length;t++){let i=this.children[t];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(-1)){n=u(i.dom);break}e+=i.size}-1==n&&(n=this.contentDOM.childNodes.length);break}s=o}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:n}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:i}=this.domFromPos(t,0);if(1!=e.nodeType||i==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[i]}setSelection(t,e,i,r=!1){let n=Math.min(t,e),s=Math.max(t,e);for(let l=0,o=0;l<this.children.length;l++){let h=this.children[l],f=o+h.size;if(n>o&&s<f)return h.setSelection(t-o-h.border,e-o-h.border,i,r);o=f}let l=this.domFromPos(t,t?-1:1),o=e==t?l:this.domFromPos(e,e?-1:1),h=i.root.getSelection(),f=i.domSelectionRange(),c=!1;if((P||A)&&t==e){let{node:t,offset:e}=l;if(3==t.nodeType){if(c=!(!e||"\n"!=t.nodeValue[e-1]),c&&e==t.nodeValue.length)for(let e,i=t;i;i=i.parentNode){if(e=i.nextSibling){"BR"==e.nodeName&&(l=o={node:e.parentNode,offset:u(e)+1});break}let t=i.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let i=t.childNodes[e-1];c=i&&("BR"==i.nodeName||"false"==i.contentEditable)}}if(P&&f.focusNode&&f.focusNode!=o.node&&1==f.focusNode.nodeType){let t=f.focusNode.childNodes[f.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||c&&A)&&p(l.node,l.offset,f.anchorNode,f.anchorOffset)&&p(o.node,o.offset,f.focusNode,f.focusOffset))return;let a=!1;if((h.extend||t==e)&&(!c||!P)){h.collapse(l.node,l.offset);try{t!=e&&h.extend(o.node,o.offset),a=!0}catch(t){}}if(!a){if(t>e){let t=l;l=o,o=t}let i=document.createRange();i.setEnd(o.node,o.offset),i.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(i)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let i=0,r=0;r<this.children.length;r++){let n=this.children[r],s=i+n.size;if(i==s?t<=s&&e>=i:t<s&&e>i){let r=i+n.border,l=s-n.border;if(t>=r&&e<=l)return this.dirty=t==i||e==s?2:1,void(t!=r||e!=l||!n.contentLost&&n.dom.parentNode==this.contentDOM?n.markDirty(t-r,e-r):n.dirty=3);n.dirty=n.dom!=n.contentDOM||n.dom.parentNode!=this.contentDOM||n.children.length?3:2}i=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let i=1==t?2:1;e.dirty<i&&(e.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class ut extends ft{constructor(t,e,i,r){let n,s=e.type.toDOM;if("function"==typeof s&&(s=s(i,(()=>n?n.parent?n.parent.posBeforeChild(n):void 0:r))),!e.type.spec.raw){if(1!=s.nodeType){let t=document.createElement("span");t.appendChild(s),s=t}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,n=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ct extends ft{constructor(t,e,i,r){super(t,[],e,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class at extends ft{constructor(t,e,i,r,n){super(t,[],i,r),this.mark=e,this.spec=n}static create(t,e,r,n){let s=n.nodeViews[e.type.name],l=s&&s(e,n,r);return l&&l.dom||(l=i.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs)),new at(t,e,l.dom,l.contentDOM||l.dom,l)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,i){let r=at.create(this.parent,this.mark,!0,i),n=this.children,s=this.size;e<s&&(n=Pt(n,e,s,i)),t>0&&(n=Pt(n,0,t,i));for(let t=0;t<n.length;t++)n[t].parent=r;return r.children=n,r}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class dt extends ft{constructor(t,e,i,r,n,s,l){super(t,[],n,s),this.node=e,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=l}static create(t,e,r,n,s,l){let o,h=s.nodeViews[e.type.name],f=h&&h(e,s,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:l),r,n),u=f&&f.dom,c=f&&f.contentDOM;if(e.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(e.text);else if(!u){let t=i.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:u,contentDOM:c}=t)}c||e.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),e.type.spec.draggable&&(u.draggable=!0));let a=u;return u=xt(u,r,e),f?o=new gt(t,e,r,n,u,c||null,a,f):e.isText?new mt(t,e,r,n,u,a):new dt(t,e,r,n,u,c||null,a)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let i=this.children[e];if(this.dom.contains(i.dom.parentNode)){t.contentElement=i.dom.parentNode;break}}t.contentElement||(t.getContent=()=>l.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,i){return 0==this.dirty&&t.eq(this.node)&&Ot(e,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let i=this.node.inlineContent,r=e,n=t.composing?this.localCompositionInfo(t,e):null,s=n&&n.pos>-1?n:null,l=n&&n.pos<0,o=new Tt(this,s&&s.node,t);!function(t,e,i,r){let n=e.locals(t),s=0;if(0==n.length){for(let i=0;i<t.childCount;i++){let l=t.child(i);r(l,n,e.forChild(s,l),i),s+=l.nodeSize}return}let l=0,o=[],h=null;for(let f=0;;){let u,c,a,d;for(;l<n.length&&n[l].to==s;){let t=n[l++];t.widget&&(u?(c||(c=[u])).push(t):u=t)}if(u)if(c){c.sort(Ct);for(let t=0;t<c.length;t++)i(c[t],f,!!h)}else i(u,f,!!h);if(h)d=-1,a=h,h=null;else{if(!(f<t.childCount))break;d=f,a=t.child(f++)}for(let t=0;t<o.length;t++)o[t].to<=s&&o.splice(t--,1);for(;l<n.length&&n[l].from<=s&&n[l].to>s;)o.push(n[l++]);let p=s+a.nodeSize;if(a.isText){let t=p;l<n.length&&n[l].from<t&&(t=n[l].from);for(let e=0;e<o.length;e++)o[e].to<t&&(t=o[e].to);t<p&&(h=a.cut(t-s),a=a.cut(0,t-s),p=t,d=-1)}else for(;l<n.length&&n[l].to<p;)l++;r(a,a.isInline&&!a.isLeaf?o.filter((t=>!t.inline)):o.slice(),e.forChild(s,a),d),s=p}}(this.node,this.innerDeco,((e,n,s)=>{e.spec.marks?o.syncToMarks(e.spec.marks,i,t,n):e.type.side>=0&&!s&&o.syncToMarks(n==this.node.childCount?h.none:this.node.child(n).marks,i,t,n),o.placeWidget(e,t,r)}),((e,s,h,f)=>{let u;o.syncToMarks(e.marks,i,t,f),o.findNodeMatch(e,s,h,f)||l&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(u=o.findIndexWithChild(n.node))>-1&&o.updateNodeAt(e,s,h,u,t)||o.updateNextNode(e,s,h,t,f,r)||o.addNode(e,s,h,t,r),r+=e.nodeSize})),o.syncToMarks([],i,t,0),this.node.isTextblock&&o.addTextblockHacks(),o.destroyRest(),(o.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),wt(this.contentDOM,this.children,t),B&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,i){let{from:r,to:n}=t.state.selection;if(!(t.state.selection instanceof e)||r<i||n>i+this.node.content.size)return null;let s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let t=s.nodeValue,e=function(t,e,i,r){for(let n=0,s=0;n<t.childCount&&s<=r;){let l=t.child(n++),o=s;if(s+=l.nodeSize,!l.isText)continue;let h=l.text;for(;n<t.childCount;){let e=t.child(n++);if(s+=e.nodeSize,!e.isText)break;h+=e.text}if(s>=i){if(s>=r&&h.slice(r-e.length-o,r-o)==e)return r-e.length;let t=o<r?h.lastIndexOf(e,r-o-1):-1;if(t>=0&&t+e.length+o>=i)return o+t;if(i==r&&h.length>=r+e.length-o&&h.slice(r-o,r-o+e.length)==e)return r}}return-1}(this.node.content,t,r-i,n-i);return e<0?null:{node:s,pos:e,text:t}}return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:i,text:r}){if(this.getDesc(e))return;let n=e;for(;n.parentNode!=this.contentDOM;n=n.parentNode){for(;n.previousSibling;)n.parentNode.removeChild(n.previousSibling);for(;n.nextSibling;)n.parentNode.removeChild(n.nextSibling);n.pmViewDesc&&(n.pmViewDesc=void 0)}let s=new ct(this,n,e,r);t.input.compositionNodes.push(s),this.children=Pt(this.children,i,i+r.length,t,s)}update(t,e,i,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,i,r),!0)}updateInner(t,e,i,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Ot(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=vt(this.dom,this.nodeDOM,yt(this.outerDeco,this.node,e),yt(t,this.node,e)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function pt(t,e,i,r,n){xt(r,e,t);let s=new dt(void 0,t,e,i,r,r,r);return s.contentDOM&&s.updateChildren(n,0),s}class mt extends dt{constructor(t,e,i,r,n,s){super(t,e,i,r,n,null,s)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,i,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,i){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,i)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,i){let r=this.node.cut(t,e),n=document.createTextNode(r.text);return new mt(this.parent,r,this.outerDeco,this.innerDeco,n,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class bt extends ft{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class gt extends dt{constructor(t,e,i,r,n,s,l,o){super(t,e,i,r,n,s,l),this.spec=o}update(t,e,i,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let n=this.spec.update(t,e,i);return n&&this.updateInner(t,e,i,r),n}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,i,r){this.spec.setSelection?this.spec.setSelection(t,e,i.root):super.setSelection(t,e,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function wt(t,e,i){let r=t.firstChild,n=!1;for(let s=0;s<e.length;s++){let l=e[s],o=l.dom;if(o.parentNode==t){for(;o!=r;)r=St(r),n=!0;r=r.nextSibling}else n=!0,t.insertBefore(o,r);if(l instanceof at){let e=r?r.previousSibling:t.lastChild;wt(l.contentDOM,l.children,i),r=e?e.nextSibling:t.firstChild}}for(;r;)r=St(r),n=!0;n&&i.trackWrites==t&&(i.trackWrites=null)}const kt=function(t){t&&(this.nodeName=t)};kt.prototype=Object.create(null);const Mt=[new kt];function yt(t,e,i){if(0==t.length)return Mt;let r=i?Mt[0]:new kt,n=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&n.push(r=new kt(l.nodeName));for(let t in l){let s=l[t];null!=s&&(i&&1==n.length&&n.push(r=new kt(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+s:"style"==t?r.style=(r.style?r.style+";":"")+s:"nodeName"!=t&&(r[t]=s))}}}return n}function vt(t,e,i,r){if(i==Mt&&r==Mt)return e;let n=e;for(let e=0;e<r.length;e++){let s=r[e],l=i[e];if(e){let e;l&&l.nodeName==s.nodeName&&n!=t&&(e=n.parentNode)&&e.nodeName.toLowerCase()==s.nodeName||(e=document.createElement(s.nodeName),e.pmIsDeco=!0,e.appendChild(n),l=Mt[0]),n=e}Dt(n,l||Mt[0],s)}return n}function Dt(t,e,i){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in i||t.removeAttribute(r);for(let r in i)"class"!=r&&"style"!=r&&"nodeName"!=r&&i[r]!=e[r]&&t.setAttribute(r,i[r]);if(e.class!=i.class){let r=e.class?e.class.split(" ").filter(Boolean):[],n=i.class?i.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==n.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<n.length;e++)-1==r.indexOf(n[e])&&t.classList.add(n[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=i.style){if(e.style){let i,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}i.style&&(t.style.cssText+=i.style)}}function xt(t,e,i){return vt(t,t,Mt,yt(e,i,1!=t.nodeType))}function Ot(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].type.eq(e[i].type))return!1;return!0}function St(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Tt{constructor(t,e,i){this.lock=e,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){let i=e,r=i.children.length,n=t.childCount,s=new Map,l=[];t:for(;n>0;){let o;for(;;)if(r){let t=i.children[r-1];if(!(t instanceof at)){o=t,r--;break}i=t,r=t.children.length}else{if(i==e)break t;r=i.parent.children.indexOf(i),i=i.parent}let h=o.node;if(h){if(h!=t.child(n-1))break;--n,s.set(o,n),l.push(o)}}return{index:n,matched:s,matches:l.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let i=t;i<e;i++)this.top.children[i].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,i,r){let n=0,s=this.stack.length>>1,l=Math.min(s,t.length);for(;n<l&&(n==s-1?this.top:this.stack[n+1<<1]).matchesMark(t[n])&&!1!==t[n].type.spec.spanning;)n++;for(;n<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let n=-1,l=this.top.children.length;r<this.preMatch.index&&(l=Math.min(this.index+3,l));for(let e=this.index;e<l;e++){let i=this.top.children[e];if(i.matchesMark(t[s])&&!this.isLocked(i.dom)){n=e;break}}if(n<0&&this.index<this.top.children.length){let e=this.top.children[this.index];e instanceof at&&3!=e.dirty&&e.mark.type==t[s].type&&e.spec.update&&!this.isLocked(e.dom)&&e.spec.update(t[s])&&(e.mark=t[s],n=this.index,this.changed=!0)}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let r=at.create(this.top,t[s],e,i);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,s++}}findNodeMatch(t,e,i,r){let n,s=-1;if(r>=this.preMatch.index&&(n=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&n.matchesNode(t,e,i))s=this.top.children.indexOf(n,this.index);else for(let r=this.index,n=Math.min(this.top.children.length,r+5);r<n;r++){let n=this.top.children[r];if(n.matchesNode(t,e,i)&&!this.preMatch.matched.has(n)){s=r;break}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,i,r,n){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,i,n)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,i,r,n,s){for(let l=this.index;l<this.top.children.length;l++){let o=this.top.children[l];if(o instanceof dt){let h=this.preMatch.matched.get(o);if(null!=h&&h!=n)return!1;let f,u=o.dom,c=this.isLocked(u)&&!(t.isText&&o.node&&o.node.isText&&o.nodeDOM.nodeValue==t.text&&3!=o.dirty&&Ot(e,o.outerDeco));if(!c&&o.update(t,e,i,r))return this.destroyBetween(this.index,l),o.dom!=u&&(this.changed=!0),this.index++,!0;if(!c&&(f=this.recreateWrapper(o,t,e,i,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=2,f.updateChildren(r,s+1),f.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,i,r,n,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Ot(i,t.outerDeco)||!r.eq(t.innerDeco))return null;let l=dt.create(this.top,e,i,r,n,s);if(l.contentDOM){l.children=t.children,t.children=[];for(let t of l.children)t.parent=l}return t.destroy(),l}addNode(t,e,i,r,n){let s=dt.create(this.top,t,e,i,r,n);s.contentDOM&&s.updateChildren(r,n+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ut(this.top,t,e,i);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof at;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof mt)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((A||N)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let i=document.createElement(t);"IMG"==t&&(i.className="ProseMirror-separator",i.alt=""),"BR"==t&&(i.className="ProseMirror-trailingBreak");let r=new bt(this.top,[],i,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Ct(t,e){return t.type.side-e.type.side}function Pt(t,e,i,r,n){let s=[];for(let l=0,o=0;l<t.length;l++){let h=t[l],f=o,u=o+=h.size;f>=i||u<=e?s.push(h):(f<e&&s.push(h.slice(0,e-f,r)),n&&(s.push(n),n=void 0),u>i&&s.push(h.slice(i-f,h.size,r)))}return s}function Et(e,i=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let s=e.docView.nearestDesc(r.focusNode),l=s&&0==s.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let h,f,c=n.resolve(o);if(k(r)){for(h=o;s&&!s.node;)s=s.parent;let e=s.node;if(s&&e.isAtom&&t.isSelectable(e)&&s.parent&&(!e.isInline||!function(t,e,i){for(let r=0==e,n=e==g(t);r||n;){if(t==i)return!0;let e=u(t);if(!(t=t.parentNode))return!1;r=r&&0==e,n=n&&e==g(t)}}(r.focusNode,r.focusOffset,s.dom))){let e=s.posBefore;f=new t(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=o,i=o;for(let n=0;n<r.rangeCount;n++){let s=r.getRangeAt(n);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[h,o]=i==e.state.selection.anchor?[i,t]:[t,i],c=n.resolve(o)}else h=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(h<0)return null}let a=n.resolve(h);if(!f){f=Lt(e,a,c,"pointer"==i||e.state.selection.head<c.pos&&!l?1:-1)}return f}function Nt(t){return t.editable?t.hasFocus():Ht(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Rt(t,i=!1){let r=t.state.selection;if(Ft(t,r),!Nt(t))return;let n=t.input.mouseDown;if(!i&&N&&n){let e=t.domSelectionRange(),i=t.domObserver.currentSelection;if(e.anchorNode&&i.anchorNode&&p(e.anchorNode,e.anchorOffset,i.anchorNode,i.anchorOffset)&&n.delaySelUpdate())return void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection();if(!e)return;let i=t.cursorWrapper.dom,r="IMG"==i.nodeName;r?e.collapse(i.parentNode,u(i)+1):e.collapse(i,0);!r&&!t.state.selection.visible&&T&&C<=11&&(i.disabled=!0,i.disabled=!1)}(t);else{let n,s,{anchor:l,head:o}=r;!At||r instanceof e||(r.$from.parent.inlineContent||(n=Bt(t,r.from)),r.empty||r.$from.parent.inlineContent||(s=Bt(t,r.to))),t.docView.setSelection(l,o,t,i),At&&(n&&It(n),s&&It(s)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let i=t.domSelectionRange(),r=i.anchorNode,n=i.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{i.anchorNode==r&&i.anchorOffset==n||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Nt(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const At=A||N&&R<63;function Bt(t,e){let{node:i,offset:r}=t.docView.domFromPos(e,0),n=r<i.childNodes.length?i.childNodes[r]:null,s=r?i.childNodes[r-1]:null;if(A&&n&&"false"==n.contentEditable)return $t(n);if(!(n&&"false"!=n.contentEditable||s&&"false"!=s.contentEditable)){if(n)return $t(n);if(s)return $t(s)}}function $t(t){return t.contentEditable="true",A&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function It(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ft(e,i){if(i instanceof t){let t=e.docView.descAt(i.from);t!=e.lastSelectedViewDesc&&(Kt(e),t&&t.selectNode(),e.lastSelectedViewDesc=t)}else Kt(e)}function Kt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Lt(t,i,r,n){return t.someProp("createSelectionBetween",(e=>e(t,i,r)))||e.between(i,r,n)}function qt(t){return!(t.editable&&!t.hasFocus())&&Ht(t)}function Ht(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Wt(t,e){let{$anchor:i,$head:n}=t.selection,s=e>0?i.max(n):i.min(n),l=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return l&&r.findFrom(l,e)}function Vt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function jt(i,r,n){let s=i.state.selection;if(!(s instanceof e)){if(s instanceof t&&s.node.isInline)return Vt(i,new e(r>0?s.$to:s.$from));{let t=Wt(i.state,r);return!!t&&Vt(i,t)}}if(n.indexOf("s")>-1){let{$head:t}=s,n=t.textOffset?null:r<0?t.nodeBefore:t.nodeAfter;if(!n||n.isText||!n.isLeaf)return!1;let l=i.state.doc.resolve(t.pos+n.nodeSize*(r<0?-1:1));return Vt(i,new e(s.$anchor,l))}if(!s.empty)return!1;if(i.endOfTextblock(r>0?"forward":"backward")){let e=Wt(i.state,r);return!!(e&&e instanceof t)&&Vt(i,e)}if(!($&&n.indexOf("m")>-1)){let n,l=s.$head,o=l.textOffset?null:r<0?l.nodeBefore:l.nodeAfter;if(!o||o.isText)return!1;let h=r<0?l.pos-o.nodeSize:l.pos;return!!(o.isAtom||(n=i.docView.descAt(h))&&!n.contentDOM)&&(t.isSelectable(o)?Vt(i,new t(r<0?i.state.doc.resolve(l.pos-o.nodeSize):l)):!!K&&Vt(i,new e(i.state.doc.resolve(r<0?h:h+o.nodeSize))))}}function zt(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Gt(t,e){let i=t.pmViewDesc;return i&&0==i.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function Ut(t,e){return e<0?function(t){let e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;let n,s,l=!1;P&&1==i.nodeType&&r<zt(i)&&Gt(i.childNodes[r],-1)&&(l=!0);for(;;)if(r>0){if(1!=i.nodeType)break;{let t=i.childNodes[r-1];if(Gt(t,-1))n=i,s=--r;else{if(3!=t.nodeType)break;i=t,r=i.nodeValue.length}}}else{if(Jt(i))break;{let e=i.previousSibling;for(;e&&Gt(e,-1);)n=i.parentNode,s=u(e),e=e.previousSibling;if(e)i=e,r=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=0}}}l?Yt(t,i,r):n&&Yt(t,n,s)}(t):function(t){let e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;let n,s,l=zt(i);for(;;)if(r<l){if(1!=i.nodeType)break;if(!Gt(i.childNodes[r],1))break;n=i,s=++r}else{if(Jt(i))break;{let e=i.nextSibling;for(;e&&Gt(e,1);)n=e.parentNode,s=u(e)+1,e=e.nextSibling;if(e)i=e,r=0,l=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=l=0}}}n&&Yt(t,n,s)}(t)}function Jt(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Yt(t,e,i){if(3!=e.nodeType){let t,r;(r=function(t,e){for(;t&&e==t.childNodes.length&&!w(t);)e=u(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let i=t.childNodes[e];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;t=i,e=0}}(e,i))?(e=r,i=0):(t=function(t,e){for(;t&&!e&&!w(t);)e=u(t),t=t.parentNode;for(;t&&e;){let i=t.childNodes[e-1];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;e=(t=i).childNodes.length}}(e,i))&&(e=t,i=t.nodeValue.length)}let r=t.domSelection();if(!r)return;if(k(r)){let t=document.createRange();t.setEnd(e,i),t.setStart(e,i),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,i);t.domObserver.setCurSelection();let{state:n}=t;setTimeout((()=>{t.state==n&&Rt(t)}),50)}function Qt(t,e){let i=t.state.doc.resolve(e);if(!N&&!I&&i.parent.inlineContent){let r=t.coordsAtPos(e);if(e>i.start()){let i=t.coordsAtPos(e-1),n=(i.top+i.bottom)/2;if(n>r.top&&n<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<i.end()){let i=t.coordsAtPos(e+1),n=(i.top+i.bottom)/2;if(n>r.top&&n<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function Xt(i,n,s){let l=i.state.selection;if(l instanceof e&&!l.empty||s.indexOf("s")>-1)return!1;if($&&s.indexOf("m")>-1)return!1;let{$from:o,$to:h}=l;if(!o.parent.inlineContent||i.endOfTextblock(n<0?"up":"down")){let e=Wt(i.state,n);if(e&&e instanceof t)return Vt(i,e)}if(!o.parent.inlineContent){let t=n<0?o:h,e=l instanceof f?r.near(t,n):r.findFrom(t,n);return!!e&&Vt(i,e)}return!1}function Zt(t,i){if(!(t.state.selection instanceof e))return!0;let{$head:r,$anchor:n,empty:s}=t.state.selection;if(!r.sameParent(n))return!0;if(!s)return!1;if(t.endOfTextblock(i>0?"forward":"backward"))return!0;let l=!r.textOffset&&(i<0?r.nodeBefore:r.nodeAfter);if(l&&!l.isText){let e=t.state.tr;return i<0?e.delete(r.pos-l.nodeSize,r.pos):e.delete(r.pos,r.pos+l.nodeSize),t.dispatch(e),!0}return!1}function _t(t,e,i){t.domObserver.stop(),e.contentEditable=i,t.domObserver.start()}function te(t,e){let i=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==i||$&&72==i&&"c"==r)return Zt(t,-1)||Ut(t,-1);if(46==i&&!e.shiftKey||$&&68==i&&"c"==r)return Zt(t,1)||Ut(t,1);if(13==i||27==i)return!0;if(37==i||$&&66==i&&"c"==r){let e=37==i?"ltr"==Qt(t,t.state.selection.from)?-1:1:-1;return jt(t,e,r)||Ut(t,e)}if(39==i||$&&70==i&&"c"==r){let e=39==i?"ltr"==Qt(t,t.state.selection.from)?1:-1:1;return jt(t,e,r)||Ut(t,e)}return 38==i||$&&80==i&&"c"==r?Xt(t,-1,r)||Ut(t,-1):40==i||$&&78==i&&"c"==r?function(t){if(!A||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(e&&1==e.nodeType&&0==i&&e.firstChild&&"false"==e.firstChild.contentEditable){let i=e.firstChild;_t(t,i,"true"),setTimeout((()=>_t(t,i,"false")),20)}return!1}(t)||Xt(t,1,r)||Ut(t,1):r==($?"m":"c")&&(66==i||73==i||89==i||90==i)}function ee(t,e){t.someProp("transformCopied",(i=>{e=i(e,t)}));let r=[],{content:n,openStart:s,openEnd:l}=e;for(;s>1&&l>1&&1==n.childCount&&1==n.firstChild.childCount;){s--,l--;let t=n.firstChild;r.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),n=t.content}let o=t.someProp("clipboardSerializer")||i.fromSchema(t.state.schema),h=ue(),f=h.createElement("div");f.appendChild(o.serializeFragment(n,{document:h}));let u,c=f.firstChild,a=0;for(;c&&1==c.nodeType&&(u=fe[c.nodeName.toLowerCase()]);){for(let t=u.length-1;t>=0;t--){let e=h.createElement(u[t]);for(;f.firstChild;)e.appendChild(f.firstChild);f.appendChild(e),a++}c=f.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${s} ${l}${a?` -${a}`:""} ${JSON.stringify(r)}`),{dom:f,text:t.someProp("clipboardTextSerializer",(i=>i(e,t)))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function ie(t,e,r,s,h){let f,u,c=h.parent.type.spec.code;if(!r&&!e)return null;let a=!!e&&(s||c||!r);if(a){if(t.someProp("transformPastedText",(i=>{e=i(e,c||s,t)})),c)return u=new n(l.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",(e=>{u=e(u,t,!0)})),u;let r=t.someProp("clipboardTextParser",(i=>i(e,h,s,t)));if(r)u=r;else{let r=h.marks(),{schema:n}=t.state,s=i.fromSchema(n);f=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=f.appendChild(document.createElement("p"));t&&e.appendChild(s.serializeNode(n.text(t,r)))}))}}else t.someProp("transformPastedHTML",(e=>{r=e(r,t)})),f=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let i,r=ue(),n=r.body,s=/<([a-z][^>\s]+)/i.exec(t);(i=s&&fe[s[1].toLowerCase()])&&(t=i.map((t=>"<"+t+">")).join("")+t+i.map((t=>"</"+t+">")).reverse().join(""));if(n.innerHTML=function(t){let e=window.trustedTypes;if(!e)return t;ce||(ce=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t}));return ce.createHTML(t)}(t),i)for(let t=0;t<i.length;t++)n=n.querySelector(i[t])||n;for(let t=0;t<r.styleSheets.length;t++){let e=r.styleSheets[t];for(let t=0;t<e.rules.length;t++){let i=e.rules[t];if(i instanceof CSSStyleRule){let t=n.querySelectorAll(i.selectorText);for(let e=0;e<t.length;e++)t[e].style.cssText+=i.style.cssText}}}return n}(r),K&&function(t){let e=t.querySelectorAll(N?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<e.length;i++){let r=e[i];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(f);let d=f&&f.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let t=+p[3];t>0;t--){let t=f.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;f=t}if(!u){let e=t.someProp("clipboardParser")||t.someProp("domParser")||o.fromSchema(t.state.schema);u=e.parseSlice(f,{preserveWhitespace:!(!a&&!p),context:h,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||re.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(p)u=function(t,e){if(!t.size)return t;let i,r=t.content.firstChild.type.schema;try{i=JSON.parse(e)}catch(e){return t}let{content:s,openStart:o,openEnd:h}=t;for(let t=i.length-2;t>=0;t-=2){let e=r.nodes[i[t]];if(!e||e.hasRequiredAttrs())break;s=l.from(e.create(i[t+1],s)),o++,h++}return new n(s,o,h)}(he(u,+p[1],+p[2]),p[4]);else if(u=n.maxOpen(function(t,e){if(t.childCount<2)return t;for(let i=e.depth;i>=0;i--){let r,n=e.node(i).contentMatchAt(e.index(i)),s=[];if(t.forEach((t=>{if(!s)return;let e,i=n.findWrapping(t.type);if(!i)return s=null;if(e=s.length&&r.length&&se(i,r,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=le(s[s.length-1],r.length));let e=ne(t,i);s.push(e),n=n.matchType(e.type),r=i}})),s)return l.from(s)}return t}(u.content,h),!0),u.openStart||u.openEnd){let t=0,e=0;for(let e=u.content.firstChild;t<u.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=u.content.lastChild;e<u.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);u=he(u,t,e)}return t.someProp("transformPasted",(e=>{u=e(u,t,a)})),u}const re=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ne(t,e,i=0){for(let r=e.length-1;r>=i;r--)t=e[r].create(null,l.from(t));return t}function se(t,e,i,r,n){if(n<t.length&&n<e.length&&t[n]==e[n]){let s=se(t,e,i,r.lastChild,n+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(n==t.length-1?i.type:t[n+1]))return r.copy(r.content.append(l.from(ne(i,t,n+1))))}}function le(t,e){if(0==e)return t;let i=t.content.replaceChild(t.childCount-1,le(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(l.empty,!0);return t.copy(i.append(r))}function oe(t,e,i,r,n,s){let o=e<0?t.firstChild:t.lastChild,h=o.content;return t.childCount>1&&(s=0),n<r-1&&(h=oe(h,e,i,r,n+1,s)),n>=i&&(h=e<0?o.contentMatchAt(0).fillBefore(h,s<=n).append(h):h.append(o.contentMatchAt(o.childCount).fillBefore(l.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(h))}function he(t,e,i){return e<t.openStart&&(t=new n(oe(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),i<t.openEnd&&(t=new n(oe(t.content,1,i,t.openEnd,0,0),t.openStart,i)),t}const fe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function ue(){return document.implementation.createHTMLDocument("title")}let ce=null;const ae={},de={},pe={touchstart:!0,touchmove:!0};class me{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function be(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ge(t){t.someProp("handleDOMEvents",(e=>{for(let i in e)t.input.eventHandlers[i]||t.dom.addEventListener(i,t.input.eventHandlers[i]=e=>we(t,e))}))}function we(t,e){return t.someProp("handleDOMEvents",(i=>{let r=i[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function ke(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target;i!=t.dom;i=i.parentNode)if(!i||11==i.nodeType||i.pmViewDesc&&i.pmViewDesc.stopEvent(e))return!1;return!0}function Me(t){return{left:t.clientX,top:t.clientY}}function ye(t,e,i,r,n){if(-1==r)return!1;let s=t.state.doc.resolve(r);for(let r=s.depth+1;r>0;r--)if(t.someProp(e,(e=>r>s.depth?e(t,i,s.nodeAfter,s.before(r),n,!0):e(t,i,s.node(r),s.before(r),n,!1))))return!0;return!1}function ve(t,e,i){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);"pointer"==i&&r.setMeta("pointer",!0),t.dispatch(r)}function De(e,i,r,n,s){return ye(e,"handleClickOn",i,r,n)||e.someProp("handleClick",(t=>t(e,i,n)))||(s?function(e,i){if(-1==i)return!1;let r,n,s=e.state.selection;s instanceof t&&(r=s.node);let l=e.state.doc.resolve(i);for(let e=l.depth+1;e>0;e--){let i=e>l.depth?l.nodeAfter:l.node(e);if(t.isSelectable(i)){n=r&&s.$from.depth>0&&e>=s.$from.depth&&l.before(s.$from.depth+1)==s.$from.pos?l.before(s.$from.depth):l.before(e);break}}return null!=n&&(ve(e,t.create(e.state.doc,n),"pointer"),!0)}(e,r):function(e,i){if(-1==i)return!1;let r=e.state.doc.resolve(i),n=r.nodeAfter;return!!(n&&n.isAtom&&t.isSelectable(n))&&(ve(e,new t(r),"pointer"),!0)}(e,r))}function xe(t,e,i,r){return ye(t,"handleDoubleClickOn",e,i,r)||t.someProp("handleDoubleClick",(i=>i(t,e,r)))}function Oe(t,i,r,n){return ye(t,"handleTripleClickOn",i,r,n)||t.someProp("handleTripleClick",(e=>e(t,i,n)))||function(t,i,r){if(0!=r.button)return!1;let n=Se(t,i,!0),s=t.state.doc;if(!n)return!1;ve(t,n,"pointer"),n instanceof e&&s.eq(t.state.doc)&&(t.input.mouseDown=new Ne(t,n));return!0}(t,r,n)}function Se(i,r,n){let s=i.state.doc;if(-1==r)return s.inlineContent?e.create(s,0,s.content.size):null;let l=s.resolve(r);for(let i=l.depth+1;i>0;i--){let r=i>l.depth?l.nodeAfter:l.node(i),o=l.before(i);if(r.inlineContent)return e.create(s,o+1,o+1+r.content.size);if(n&&t.isSelectable(r))return t.create(s,o)}return null}function Te(t){return Fe(t)}de.keydown=(t,e)=>{let i=e;if(t.input.shiftKey=16==i.keyCode||i.shiftKey,!Re(t)&&(t.input.lastKeyCode=i.keyCode,t.input.lastKeyCodeTime=Date.now(),!F||!N||13!=i.keyCode))if(229!=i.keyCode&&t.domObserver.forceFlush(),!B||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)t.someProp("handleKeyDown",(e=>e(t,i)))||te(t,i)?i.preventDefault():be(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},de.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},de.keypress=(t,i)=>{let r=i;if(Re(t)||!r.charCode||r.ctrlKey&&!r.altKey||$&&r.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,r))))return void r.preventDefault();let n=t.state.selection;if(!(n instanceof e&&n.$from.sameParent(n.$to))){let e=String.fromCharCode(r.charCode),i=()=>t.state.tr.insertText(e).scrollIntoView();/[\r\n]/.test(e)||t.someProp("handleTextInput",(r=>r(t,n.$from.pos,n.$to.pos,e,i)))||t.dispatch(i()),r.preventDefault()}};const Ce=$?"metaKey":"ctrlKey";ae.mousedown=(t,e)=>{let i=e;t.input.shiftKey=i.shiftKey;let r=Te(t),n=Date.now(),s="singleClick";n-t.input.lastClick.time<500&&function(t,e){let i=e.x-t.clientX,r=e.y-t.clientY;return i*i+r*r<100}(i,t.input.lastClick)&&!i[Ce]&&t.input.lastClick.button==i.button&&("singleClick"==t.input.lastClick.type?s="doubleClick":"doubleClick"==t.input.lastClick.type&&(s="tripleClick")),t.input.lastClick={time:n,x:i.clientX,y:i.clientY,type:s,button:i.button},t.input.mouseDown&&t.input.mouseDown.done();let l=t.posAtCoords(Me(i));l&&("singleClick"==s?t.input.mouseDown=new Ee(t,l,i,!!r):("doubleClick"==s?xe:Oe)(t,l.pos,l.inside,i)?i.preventDefault():be(t,"pointer"))};class Pe{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){0==t.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class Ee extends Pe{constructor(e,i,r,n){let s,l;if(super(e),this.pos=i,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Ce],this.allowDefault=r.shiftKey,i.inside>-1)s=e.state.doc.nodeAt(i.inside),l=i.inside;else{let t=e.state.doc.resolve(i.pos);s=t.parent,l=t.depth?t.before():0}const o=n?null:r.target,h=o?e.docView.nearestDesc(o,!0):null;this.target=h&&1==h.nodeDOM.nodeType?h.nodeDOM:null;let{selection:f}=e.state;0==r.button&&(s.type.spec.draggable&&!1!==s.type.spec.selectable||f instanceof t&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!P||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),be(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>{this.view.isDestroyed||Rt(this.view)}))}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Me(t))),this.updateAllowDefault(t),this.allowDefault||!e?be(this.view,"pointer"):De(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||N&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ve(this.view,r.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):be(this.view,"pointer")}move(t){this.updateAllowDefault(t),be(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class Ne extends Pe{constructor(t,e){super(t),this.startSelection=e,this.startDoc=t.state.doc}move(t){if(0==t.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();t.preventDefault(),be(this.view,"pointer");let i=this.view.posAtCoords(Me(t)),r=i&&Se(this.view,i.inside,!1);if(!r)return;let{doc:n}=this.view.state,s=this.startSelection,[l,o]=r.from<s.from?[s.to,r.from]:[s.from,r.to];ve(this.view,e.create(n,l,o),"pointer")}}function Re(t,e){return!!t.composing||!!(A&&Math.abs(Date.now()-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}ae.touchstart=t=>{t.input.lastTouch=Date.now(),Te(t),be(t,"pointer")},ae.touchmove=t=>{t.input.lastTouch=Date.now(),be(t,"pointer")},ae.contextmenu=t=>Te(t);const Ae=F?5e3:-1;function Be(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>Fe(t)),e))}function $e(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Ie(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let i=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=g(t=t.childNodes[e-1])}else{if(!t.parentNode||w(t))return null;e=u(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),r=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0}else{if(!t.parentNode||w(t))return null;e=u(t)+1,t=t.parentNode}}}(e.focusNode,e.focusOffset);if(i&&r&&i!=r){let e=r.pmViewDesc,n=t.domObserver.lastChangedTextNode;if(i==n||r==n)return n;if(!e||!e.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let t=i.pmViewDesc;if(t&&t.isText(i.nodeValue))return r}}return i||r}function Fe(t,e=!1){if(!(F&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),$e(t),e||t.docView&&t.docView.dirty){let i=Et(t),r=t.state.selection;return i&&!i.eq(r)?t.dispatch(t.state.tr.setSelection(i)):!t.markCursor&&!e||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}de.compositionstart=de.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:i}=t,r=i.selection.$to;if(i.selection instanceof e&&(i.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))||N&&I&&function(t){let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(!e||1!=e.nodeType||i>=e.childNodes.length)return!1;let r=e.childNodes[i];return 1==r.nodeType&&"false"==r.contentEditable}(t)))t.markCursor=t.state.storedMarks||r.marks(),Fe(t,!0),t.markCursor=null;else if(Fe(t,!i.selection.empty),P&&i.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let e=t.domSelectionRange();for(let i=e.focusNode,r=e.focusOffset;i&&1==i.nodeType&&0!=r;){let e=r<0?i.lastChild:i.childNodes[r-1];if(!e)break;if(3==e.nodeType){let i=t.domSelection();i&&i.collapse(e,e.nodeValue.length);break}i=e,r=-1}}t.input.composing=!0}Be(t,Ae)},de.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,Be(t,20))};const Ke=T&&C<15||B&&L<604;function Le(t,e,i,r,s){let l=ie(t,e,i,r,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,s,l||n.empty))))return!0;if(!l)return!1;let o=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(l),h=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(l);return t.dispatch(h.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function qe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let i=t.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):""}ae.copy=de.cut=(t,e)=>{let i=e,r=t.state.selection,n="cut"==i.type;if(r.empty)return;let s=Ke?null:i.clipboardData,l=r.content(),{dom:o,text:h}=ee(t,l);s?(i.preventDefault(),s.clearData(),s.setData("text/html",o.innerHTML),s.setData("text/plain",h)):function(t,e){if(!t.dom.parentNode)return;let i=t.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(e),i.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),n=document.createRange();n.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(n),setTimeout((()=>{i.parentNode&&i.parentNode.removeChild(i),t.focus()}),50)}(t,o),n&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},de.paste=(t,e)=>{let i=e;if(t.composing&&!F)return;let r=Ke?null:i.clipboardData,n=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&Le(t,qe(r),r.getData("text/html"),n,i)?i.preventDefault():function(t,e){if(!t.dom.parentNode)return;let i=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let n=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),i?Le(t,r.value,null,n,e):Le(t,r.textContent,r.innerHTML,n,e)}),50)}(t,i)};class He{constructor(t,e,i){this.slice=t,this.move=e,this.node=i}}const We=$?"altKey":"ctrlKey";function Ve(t,e){let i;return t.someProp("dragCopies",(t=>{i=i||t(e)})),null!=i?!i:!e[We]}ae.dragstart=(e,i)=>{let r=i,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let s,l=e.state.selection,o=l.empty?null:e.posAtCoords(Me(r));if(o&&o.pos>=l.from&&o.pos<=(l instanceof t?l.to-1:l.to));else if(n&&n.mightDrag)s=t.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let i=e.docView.nearestDesc(r.target,!0);i&&i.node.type.spec.draggable&&i!=e.docView&&(s=t.create(e.state.doc,i.posBefore))}let h=(s||e.state.selection).content(),{dom:f,text:u,slice:c}=ee(e,h);(!r.dataTransfer.files.length||!N||R>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Ke?"Text":"text/html",f.innerHTML),r.dataTransfer.effectAllowed="copyMove",Ke||r.dataTransfer.setData("text/plain",u),e.dragging=new He(c,Ve(e,r),s)},ae.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},de.dragover=de.dragenter=(t,e)=>e.preventDefault(),de.drop=(e,i)=>{try{!function(e,i,r){if(!i.dataTransfer)return;let l=e.posAtCoords(Me(i));if(!l)return;let o=e.state.doc.resolve(l.pos),h=r&&r.slice;h?e.someProp("transformPasted",(t=>{h=t(h,e,!1)})):h=ie(e,qe(i.dataTransfer),Ke?null:i.dataTransfer.getData("text/html"),!1,o);let f=!(!r||!Ve(e,i));if(e.someProp("handleDrop",(t=>t(e,i,h||n.empty,f))))return void i.preventDefault();if(!h)return;i.preventDefault();let u=h?s(e.state.doc,o.pos,h):o.pos;null==u&&(u=o.pos);let c=e.state.tr;if(f){let{node:t}=r;t?t.replace(c):c.deleteSelection()}let a=c.mapping.map(u),d=0==h.openStart&&0==h.openEnd&&1==h.content.childCount,p=c.doc;d?c.replaceRangeWith(a,a,h.content.firstChild):c.replaceRange(a,a,h);if(c.doc.eq(p))return;let m=c.doc.resolve(a);if(d&&t.isSelectable(h.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(h.content.firstChild))c.setSelection(new t(m));else{let t=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,i,r,n)=>t=n)),c.setSelection(Lt(e,m,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,i,e.dragging)}finally{e.dragging=null}},ae.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Rt(t)}),20))},ae.blur=(t,e)=>{let i=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),i.relatedTarget&&t.dom.contains(i.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},ae.beforeinput=(t,e)=>{if(N&&F&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,M(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())}),50)}};for(let t in de)ae[t]=de[t];function je(t,e){if(t==e)return!0;for(let i in t)if(t[i]!==e[i])return!1;for(let i in e)if(!(i in t))return!1;return!0}class ze{constructor(t,e){this.toDOM=t,this.spec=e||Qe,this.side=this.spec.side||0}map(t,e,i,r){let{pos:n,deleted:s}=t.mapResult(e.from+r,this.side<0?-1:1);return s?null:new Je(n-i,n-i,this)}valid(){return!0}eq(t){return this==t||t instanceof ze&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&je(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Ge{constructor(t,e){this.attrs=t,this.spec=e||Qe}map(t,e,i,r){let n=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-i,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-i;return n>=s?null:new Je(n,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Ge&&je(this.attrs,t.attrs)&&je(this.spec,t.spec)}static is(t){return t.type instanceof Ge}destroy(){}}class Ue{constructor(t,e){this.attrs=t,this.spec=e||Qe}map(t,e,i,r){let n=t.mapResult(e.from+r,1);if(n.deleted)return null;let s=t.mapResult(e.to+r,-1);return s.deleted||s.pos<=n.pos?null:new Je(n.pos-i,s.pos-i,this)}valid(t,e){let i,{index:r,offset:n}=t.content.findIndex(e.from);return n==e.from&&!(i=t.child(r)).isText&&n+i.nodeSize==e.to}eq(t){return this==t||t instanceof Ue&&je(this.attrs,t.attrs)&&je(this.spec,t.spec)}destroy(){}}class Je{constructor(t,e,i){this.from=t,this.to=e,this.type=i}copy(t,e){return new Je(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,i){return this.type.map(t,this,e,i)}static widget(t,e,i){return new Je(t,t,new ze(e,i))}static inline(t,e,i,r){return new Je(t,e,new Ge(i,r))}static node(t,e,i,r){return new Je(t,e,new Ue(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ge}get widget(){return this.type instanceof ze}}const Ye=[],Qe={};class Xe{constructor(t,e){this.local=t.length?t:Ye,this.children=e.length?e:Ye}static create(t,e){return e.length?ri(e,t,0,Qe):Ze}find(t,e,i){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,i),r}findInner(t,e,i,r,n){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=e&&l.to>=t&&(!n||n(l.spec))&&i.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,i,r+l,n)}}map(t,e,i){return this==Ze||0==t.maps.length?this:this.mapInner(t,e,0,0,i||Qe)}mapInner(t,e,i,r,n){let s;for(let l=0;l<this.local.length;l++){let o=this.local[l].map(t,i,r);o&&o.type.valid(e,o)?(s||(s=[])).push(o):n.onRemove&&n.onRemove(this.local[l].spec)}return this.children.length?function(t,e,i,r,n,s,l){let o=t.slice();for(let t=0,e=s;t<i.maps.length;t++){let r=0;i.maps[t].forEach(((t,i,n,s)=>{let l=s-n-(i-t);for(let n=0;n<o.length;n+=3){let s=o[n+1];if(s<0||t>s+e-r)continue;let h=o[n]+e-r;i>=h?o[n+1]=t<=h?-2:-1:t>=e&&l&&(o[n]+=l,o[n+1]+=l)}r+=l})),e=i.maps[t].map(e,-1)}let h=!1;for(let e=0;e<o.length;e+=3)if(o[e+1]<0){if(-2==o[e+1]){h=!0,o[e+1]=-1;continue}let f=i.map(t[e]+s),u=f-n;if(u<0||u>=r.content.size){h=!0;continue}let c=i.map(t[e+1]+s,-1)-n,{index:a,offset:d}=r.content.findIndex(u),p=r.maybeChild(a);if(p&&d==u&&d+p.nodeSize==c){let r=o[e+2].mapInner(i,p,f+1,t[e]+s+1,l);r!=Ze?(o[e]=u,o[e+1]=c,o[e+2]=r):(o[e+1]=-2,h=!0)}else h=!0}if(h){let h=function(t,e,i,r,n,s,l){function o(t,e){for(let s=0;s<t.local.length;s++){let o=t.local[s].map(r,n,e);o?i.push(o):l.onRemove&&l.onRemove(t.local[s].spec)}for(let i=0;i<t.children.length;i+=3)o(t.children[i+2],t.children[i]+e+1)}for(let i=0;i<t.length;i+=3)-1==t[i+1]&&o(t[i+2],e[i]+s+1);return i}(o,t,e,i,n,s,l),f=ri(h,r,0,l);e=f.local;for(let t=0;t<o.length;t+=3)o[t+1]<0&&(o.splice(t,3),t-=3);for(let t=0,e=0;t<f.children.length;t+=3){let i=f.children[t];for(;e<o.length&&o[e]<i;)e+=3;o.splice(e,0,f.children[t],f.children[t+1],f.children[t+2])}}return new Xe(e.sort(ni),o)}(this.children,s||[],t,e,i,r,n):s?new Xe(s.sort(ni),Ye):Ze}add(t,e){return e.length?this==Ze?Xe.create(t,e):this.addInner(t,e,0):this}addInner(t,e,i){let r,n=0;t.forEach(((t,s)=>{let l,o=s+i;if(l=ei(e,t,o)){for(r||(r=this.children.slice());n<r.length&&r[n]<s;)n+=3;r[n]==s?r[n+2]=r[n+2].addInner(t,l,o+1):r.splice(n,0,s,s+t.nodeSize,ri(l,t,o+1,Qe)),n+=3}}));let s=ti(n?ii(e):e,-i);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||s.splice(e--,1);return new Xe(s.length?this.local.concat(s).sort(ni):this.local,r||this.children)}remove(t){return 0==t.length||this==Ze?this:this.removeInner(t,0)}removeInner(t,e){let i=this.children,r=this.local;for(let r=0;r<i.length;r+=3){let n,s=i[r]+e,l=i[r+1]+e;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>s&&e.to<l&&(t[i]=null,(n||(n=[])).push(e));if(!n)continue;i==this.children&&(i=this.children.slice());let o=i[r+2].removeInner(n,s+1);o!=Ze?i[r+2]=o:(i.splice(r,3),r-=3)}if(r.length)for(let i,n=0;n<t.length;n++)if(i=t[n])for(let t=0;t<r.length;t++)r[t].eq(i,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return i==this.children&&r==this.local?this:r.length||i.length?new Xe(r,i):Ze}forChild(t,e){if(this==Ze)return this;if(e.isLeaf)return Xe.empty;let i,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(i=this.children[e+2]);break}let n=t+1,s=n+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<s&&e.to>n&&e.type instanceof Ge){let t=Math.max(n,e.from)-n,i=Math.min(s,e.to)-n;t<i&&(r||(r=[])).push(e.copy(t,i))}}if(r){let t=new Xe(r.sort(ni),Ye);return i?new _e([t,i]):t}return i||Ze}eq(t){if(this==t)return!0;if(!(t instanceof Xe)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return si(this.localsInner(t))}localsInner(t){if(this==Ze)return Ye;if(t.inlineContent||!this.local.some(Ge.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof Ge||e.push(this.local[t]);return e}forEachSet(t){t(this)}}Xe.empty=new Xe([],[]),Xe.removeOverlap=si;const Ze=Xe.empty;class _e{constructor(t){this.members=t}map(t,e){const i=this.members.map((i=>i.map(t,e,Qe)));return _e.from(i)}forChild(t,e){if(e.isLeaf)return Xe.empty;let i=[];for(let r=0;r<this.members.length;r++){let n=this.members[r].forChild(t,e);n!=Ze&&(n instanceof _e?i=i.concat(n.members):i.push(n))}return _e.from(i)}eq(t){if(!(t instanceof _e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,i=!0;for(let r=0;r<this.members.length;r++){let n=this.members[r].localsInner(t);if(n.length)if(e){i&&(e=e.slice(),i=!1);for(let t=0;t<n.length;t++)e.push(n[t])}else e=n}return e?si(i?e:e.sort(ni)):Ye}static from(t){switch(t.length){case 0:return Ze;case 1:return t[0];default:return new _e(t.every((t=>t instanceof Xe))?t:t.reduce(((t,e)=>t.concat(e instanceof Xe?e:e.members)),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function ti(t,e){if(!e||!t.length)return t;let i=[];for(let r=0;r<t.length;r++){let n=t[r];i.push(new Je(n.from+e,n.to+e,n.type))}return i}function ei(t,e,i){if(e.isLeaf)return null;let r=i+e.nodeSize,n=null;for(let e,s=0;s<t.length;s++)(e=t[s])&&e.from>i&&e.to<r&&((n||(n=[])).push(e),t[s]=null);return n}function ii(t){let e=[];for(let i=0;i<t.length;i++)null!=t[i]&&e.push(t[i]);return e}function ri(t,e,i,r){let n=[],s=!1;e.forEach(((e,l)=>{let o=ei(t,e,l+i);if(o){s=!0;let t=ri(o,e,i+l+1,r);t!=Ze&&n.push(l,l+e.nodeSize,t)}}));let l=ti(s?ii(t):t,-i).sort(ni);for(let t=0;t<l.length;t++)l[t].type.valid(e,l[t])||(r.onRemove&&r.onRemove(l[t].spec),l.splice(t--,1));return l.length||n.length?new Xe(l,n):Ze}function ni(t,e){return t.from-e.from||t.to-e.to}function si(t){let e=t;for(let i=0;i<e.length-1;i++){let r=e[i];if(r.from!=r.to)for(let n=i+1;n<e.length;n++){let s=e[n];if(s.from!=r.from){s.from<r.to&&(e==t&&(e=t.slice()),e[i]=r.copy(r.from,s.from),li(e,n,r.copy(s.from,r.to)));break}s.to!=r.to&&(e==t&&(e=t.slice()),e[n]=s.copy(s.from,r.to),li(e,n+1,s.copy(r.to,s.to)))}}return e}function li(t,e,i){for(;e<t.length&&ni(i,t[e])>0;)e++;t.splice(e,0,i)}function oi(t){let e=[];return t.someProp("decorations",(i=>{let r=i(t.state);r&&r!=Ze&&e.push(r)})),t.cursorWrapper&&e.push(Xe.create(t.state.doc,[t.cursorWrapper.deco])),_e.from(e)}const hi={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fi=T&&C<=11;class ui{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ci{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ui,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);T&&C<=11&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():A&&t.composing&&e.some((t=>"childList"==t.type&&"TR"==t.target.nodeName))?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()})),fi&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,hi)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(qt(this.view)){if(this.suppressingSelectionUpdates)return Rt(this.view);if(T&&C<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&p(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,i=new Set;for(let e=t.focusNode;e;e=c(e))i.add(e);for(let r=t.anchorNode;r;r=c(r))if(i.has(r)){e=r;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let i=t.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&qt(t)&&!this.ignoreSelectionChange(i),s=-1,l=-1,o=!1,h=[];if(t.editable)for(let t=0;t<e.length;t++){let i=this.registerMutation(e[t],h);i&&(s=s<0?i.from:Math.min(i.from,s),l=l<0?i.to:Math.max(i.to,l),i.typeOver&&(o=!0))}if(h.some((t=>"BR"==t.nodeName))&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||N&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.some((t=>"childList"==t.type&&t.removedNodes.length)))){for(let t of h)if("BR"==t.nodeName&&t.parentNode){let e=t.nextSibling;for(;e&&1==e.nodeType;){if("false"==e.contentEditable){t.parentNode.removeChild(t);break}e=e.firstChild}}}else if(P&&h.length){let e=h.filter((t=>"BR"==t.nodeName));if(2==e.length){let[t,i]=e;t.parentNode&&t.parentNode.parentNode==i.parentNode?i.remove():t.remove()}else{let{focusNode:i}=this.currentSelection;for(let r of e){let e=r.parentNode;!e||"LI"!=e.nodeName||i&&mi(t,i)==e||r.remove()}}}let f=null;s<0&&n&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&k(i)&&(f=Et(t))&&f.eq(r.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Rt(t),this.currentSelection.set(i),t.scrollToSelection()):(s>-1||n)&&(s>-1&&(t.docView.markDirty(s,l),function(t){if(ai.has(t))return;if(ai.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)){if(t.requiresGeckoHackNode=P,di)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),di=!0}}(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(t,e){var i;let{focusNode:r,focusOffset:n}=t.domSelectionRange();for(let s of e)if("TR"==(null===(i=s.parentNode)||void 0===i?void 0:i.nodeName)){let e=s.nextSibling;for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.nextSibling;if(e){let i=e;for(;;){let t=i.firstChild;if(!t||1!=t.nodeType||"false"==t.contentEditable||/^(BR|IMG)$/.test(t.nodeName))break;i=t}i.insertBefore(s,i.firstChild),r==s&&t.domSelection().collapse(s,n)}else s.parentNode.removeChild(s)}}(t,h)),this.handleDOMChange(s,l,o,h),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(i)||Rt(t),this.currentSelection.set(i))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let i=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(i==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!i||i.ignoreMutation(t))return null;if("childList"==t.type){for(let i=0;i<t.addedNodes.length;i++){let r=t.addedNodes[i];e.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(t.target))return{from:i.posBefore,to:i.posAfter};let r=t.previousSibling,n=t.nextSibling;if(T&&C<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:i,nextSibling:s}=t.addedNodes[e];(!i||Array.prototype.indexOf.call(t.addedNodes,i)<0)&&(r=i),(!s||Array.prototype.indexOf.call(t.addedNodes,s)<0)&&(n=s)}let s=r&&r.parentNode==t.target?u(r)+1:0,l=i.localPosFromDOM(t.target,s,-1),o=n&&n.parentNode==t.target?u(n):t.target.childNodes.length;return{from:l,to:i.localPosFromDOM(t.target,o,1)}}return"attributes"==t.type?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=t.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let ai=new WeakMap,di=!1;function pi(t,e){let i=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return p(l.node,l.offset,n,s)&&([i,r,n,s]=[n,s,i,r]),{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:s}}function mi(t,e){for(let i=e.parentNode;i&&i!=t.dom;i=i.parentNode){let e=t.docView.nearestDesc(i,!0);if(e&&e.node.isBlock)return i}return null}function bi(t){let e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(A&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||A&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const gi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function wi(t,i,r,n,s){let h=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,i<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,i=Et(t,e);if(i&&!t.state.selection.eq(i)){if(N&&F&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return;let r=t.state.tr.setSelection(i);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),h&&r.setMeta("composition",h),t.dispatch(r)}return}let f=t.state.doc.resolve(i),u=f.sharedDepth(r);i=f.before(u+1),r=t.state.doc.resolve(r).after(u+1);let c,a,d=t.state.selection,p=function(t,e,i){let r,{node:n,fromOffset:s,toOffset:l,from:h,to:f}=t.docView.parseRange(e,i),u=t.domSelectionRange(),c=u.anchorNode;if(c&&t.dom.contains(1==c.nodeType?c:c.parentNode)&&(r=[{node:c,offset:u.anchorOffset}],k(u)||r.push({node:u.focusNode,offset:u.focusOffset})),N&&8===t.input.lastKeyCode)for(let t=l;t>s;t--){let e=n.childNodes[t-1],i=e.pmViewDesc;if("BR"==e.nodeName&&!i){l=t;break}if(!i||i.size)break}let a=t.state.doc,d=t.someProp("domParser")||o.fromSchema(t.state.schema),p=a.resolve(h),m=null,b=d.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:l,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:bi,context:p});if(r&&null!=r[0].pos){let t=r[0].pos,e=r[1]&&r[1].pos;null==e&&(e=t),m={anchor:t+h,head:e+h}}return{doc:b,sel:m,from:h,to:f}}(t,i,r),m=t.state.doc,b=m.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(c=t.state.selection.to,a="end"):(c=t.state.selection.from,a="start"),t.input.lastKeyCode=null;let g=function(t,e,i,r,n){let s=t.findDiffStart(e,i),l=i+t.size,o=i+e.size;if(null==s)return null;let{a:h,b:f}=t.findDiffEnd(e,l,o);if("end"==n){r-=h+Math.max(0,s-Math.min(h,f))-s}if(h<s&&l<o){s-=r<=s&&r>=h?s-r:0,f=s+(f-h),h=s}else if(f<s){s-=r<=s&&r>=f?s-r:0,h=s+(h-f),f=s}return{start:s,endA:h,endB:f}}(b.content,p.doc.content,p.from,c,a);if(g&&t.input.domChangeCount++,(B&&t.input.lastIOSEnter>Date.now()-225||F)&&s.some((t=>1==t.nodeType&&!gi.test(t.nodeName)))&&(!g||g.endA>=g.endB)&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof e&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let e=ki(t,t.state.doc,p.sel);if(e&&!e.eq(t.state.selection)){let i=t.state.tr.setSelection(e);h&&i.setMeta("composition",h),t.dispatch(i)}}return}g={start:d.from,endA:d.to,endB:d.to}}t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof e&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&t.state.selection.to<=p.to&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),T&&C<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let w=p.doc.resolveNoCache(g.start-p.from),y=p.doc.resolveNoCache(g.endB-p.from),v=m.resolve(g.start),D=w.sameParent(y)&&w.parent.inlineContent&&v.end()>=g.endA;if((B&&t.input.lastIOSEnter>Date.now()-225&&(!D||s.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!D&&w.pos<p.doc.content.size&&(!w.sameParent(y)||!w.parent.inlineContent)&&w.pos<y.pos&&!/\S/.test(p.doc.textBetween(w.pos,y.pos,"","")))&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>g.start&&function(t,e,i,r,n){if(i-e<=n.pos-r.pos||Mi(r,!0,!1)<n.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let t=s.nodeAfter;return null!=t&&i==e+t.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(Mi(s,!0,!0));return!(!l.parent.isTextblock||l.pos>i||Mi(l,!0,!1)<i)&&r.parent.content.cut(r.parentOffset).eq(l.parent.content)}(m,g.start,g.endA,w,y)&&t.someProp("handleKeyDown",(e=>e(t,M(8,"Backspace")))))return void(F&&N&&t.domObserver.suppressSelectionUpdates());N&&g.endB==g.start&&(t.input.lastChromeDelete=Date.now()),F&&!D&&w.start()!=y.start()&&0==y.parentOffset&&w.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,y=p.doc.resolveNoCache(g.endB-p.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,M(13,"Enter"))}))}),20));let x,O=g.start,S=g.endA,P=e=>{let i=e||t.state.tr.replace(O,S,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let e=ki(t,i.doc,p.sel);e&&!(N&&t.composing&&e.empty&&(g.start!=g.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==O||e.head==i.mapping.map(S)-1)||T&&e.empty&&e.head==O)&&i.setSelection(e)}return h&&i.setMeta("composition",h),i.scrollIntoView()};if(D)if(w.pos==y.pos){T&&C<=11&&0==w.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>Rt(t)),20));let e=P(t.state.tr.delete(O,S)),i=m.resolve(g.start).marksAcross(m.resolve(g.endA));i&&e.ensureMarks(i),t.dispatch(e)}else if(g.endA==g.endB&&(x=function(t,e){let i,r,n,s=t.firstChild.marks,o=e.firstChild.marks,h=s,f=o;for(let t=0;t<o.length;t++)h=o[t].removeFromSet(h);for(let t=0;t<s.length;t++)f=s[t].removeFromSet(f);if(1==h.length&&0==f.length)r=h[0],i="add",n=t=>t.mark(r.addToSet(t.marks));else{if(0!=h.length||1!=f.length)return null;r=f[0],i="remove",n=t=>t.mark(r.removeFromSet(t.marks))}let u=[];for(let t=0;t<e.childCount;t++)u.push(n(e.child(t)));if(l.from(u).eq(t))return{mark:r,type:i}}(w.parent.content.cut(w.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){let e=P(t.state.tr);"add"==x.type?e.addMark(O,S,x.mark):e.removeMark(O,S,x.mark),t.dispatch(e)}else if(w.parent.child(w.index()).isText&&w.index()==y.index()-(y.textOffset?0:1)){let e=w.parent.textBetween(w.parentOffset,y.parentOffset),i=()=>P(t.state.tr.insertText(e,O,S));t.someProp("handleTextInput",(r=>r(t,O,S,e,i)))||t.dispatch(i())}else t.dispatch(P());else t.dispatch(P())}function ki(t,e,i){return Math.max(i.anchor,i.head)>e.content.size?null:Lt(t,e.resolve(i.anchor),e.resolve(i.head))}function Mi(t,e,i){let r=t.depth,n=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,n++,e=!1;if(i){let e=t.node(r).maybeChild(t.indexAfter(r));for(;e&&!e.isLeaf;)e=e.firstChild,n++}return n}class yi{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new me,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Si),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=xi(this),Di(this),this.nodeViews=Oi(this),this.docView=pt(this.state.doc,vi(this),oi(this),this.dom,this),this.domObserver=new ci(this,((t,e,i,r)=>wi(this,t,e,i,r))),this.domObserver.start(),function(t){for(let e in ae){let i=ae[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!ke(t,e)||we(t,e)||!t.editable&&e.type in de||i(t,e)},pe[e]?{passive:!0}:void 0)}A&&t.dom.addEventListener("input",(()=>null)),ge(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ge(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Si),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let i in t)e[i]=t[i];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var i;let r=this.state,n=!1,s=!1;t.storedMarks&&this.composing&&($e(this),s=!0),this.state=t;let l=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(l||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=Oi(this);(function(t,e){let i=0,r=0;for(let r in t){if(t[r]!=e[r])return!0;i++}for(let t in e)r++;return i!=r})(t,this.nodeViews)&&(this.nodeViews=t,n=!0)}(l||e.handleDOMEvents!=this._props.handleDOMEvents)&&ge(this),this.editable=xi(this),Di(this);let o=oi(this),h=vi(this),f=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=n||!this.docView.matchesNode(t.doc,h,o);!u&&t.selection.eq(r.selection)||(s=!0);let c="preserve"==f&&s&&null==this.dom.style.overflowAnchor&&function(t){let e,i,r=t.dom.getBoundingClientRect(),n=Math.max(0,r.top);for(let s=(r.left+r.right)/2,l=n+1;l<Math.min(innerHeight,r.bottom);l+=5){let r=t.root.elementFromPoint(s,l);if(!r||r==t.dom||!t.dom.contains(r))continue;let o=r.getBoundingClientRect();if(o.top>=n-20){e=r,i=o.top;break}}return{refDOM:e,refTop:i,stack:j(t.dom)}}(this);if(s){this.domObserver.stop();let e=u&&(T||N)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){let i=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(i)!=e.$anchor.start(i)}(r.selection,t.selection);if(u){let i=N?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ie(this)),!n&&this.docView.update(t.doc,h,o,this)||(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=pt(t.doc,h,o,this.dom,this)),!i||this.trackWrites&&this.dom.contains(this.trackWrites)||(e=!0)}let i=this.input.mouseDown;e||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),i=t.domSelectionRange();return p(e.node,e.offset,i.anchorNode,i.anchorOffset)}(this)&&i.delaySelUpdate())?Rt(this,e):(Ft(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(i=this.dragging)||void 0===i?void 0:i.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==f?this.dom.scrollTop=0:"to selection"==f?this.scrollToSelection():c&&function({refDOM:t,refTop:e,stack:i}){let r=t?t.getBoundingClientRect().top:0;z(i,0==r?0:r-e)}(c)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof t){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&V(this,t.getBoundingClientRect(),e)}else V(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let i=this.pluginViews[e];i.update&&i.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(e,i){let r=e.node,n=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let t=r.from+(this.state.doc.content.size-i.doc.content.size);(t>0&&t<this.state.doc.content.size&&this.state.doc.nodeAt(t))==r.node&&(n=t)}this.dragging=new He(e.slice,e.move,n<0?void 0:t.create(this.state.doc,n))}someProp(t,e){let i,r=this._props&&this._props[t];if(null!=r&&(i=e?e(r):r))return i;for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r].props[t];if(null!=n&&(i=e?e(n):n))return i}let n=this.state.plugins;if(n)for(let r=0;r<n.length;r++){let s=n[r].props[t];if(null!=s&&(i=e?e(s):s))return i}}hasFocus(){if(T){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(G)return t.focus(G);let e=j(t);t.focus(null==G?{get preventScroll(){return G={preventScroll:!0},!0}}:void 0),G||(G=!1,z(e,0))}(this.dom),Rt(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return Q(this,t)}coordsAtPos(t,e=1){return tt(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,i=-1){let r=this.docView.posFromDOM(t,e,i);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return ht(this,e||this.state,t)}pasteHTML(t,e){return Le(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Le(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return ee(this,t)}destroy(){this.docView&&(!function(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],oi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,a=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){we(t,e)||!ae[e.type]||!t.editable&&e.type in de||ae[e.type](t,e)}(this,t)}domSelectionRange(){let t=this.domSelection();return t?A&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return pi(t,i)}let i;function r(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),i?pi(t,i):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function vi(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(i=>{if("function"==typeof i&&(i=i(t.state)),i)for(let t in i)"class"==t?e.class+=" "+i[t]:"style"==t?e.style=(e.style?e.style+";":"")+i[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(i[t]))})),e.translate||(e.translate="no"),[Je.node(0,t.state.doc.content.size,e)]}function Di(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Je.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xi(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function Oi(t){let e=Object.create(null);function i(t){for(let i in t)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=t[i])}return t.someProp("nodeViews",i),t.someProp("markViews",i),e}function Si(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}yi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};export{Xe as D,yi as E,Je as a};