@notectl/core 1.0.5 → 1.0.8

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 (250) hide show
  1. package/README.md +78 -55
  2. package/custom-elements.json +344 -0
  3. package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs → AttrRegistry-D-przlzb.mjs} +4 -4
  4. package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs.map → AttrRegistry-D-przlzb.mjs.map} +1 -1
  5. package/dist/chunks/ColorNames-iaWsSZx1.mjs +35 -0
  6. package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +1 -0
  7. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +140 -0
  8. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +1 -0
  9. package/dist/chunks/{Commands-DLP85Mp5.mjs → Commands-CSpSwGXv.mjs} +13 -13
  10. package/dist/chunks/{Commands-DLP85Mp5.mjs.map → Commands-CSpSwGXv.mjs.map} +1 -1
  11. package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs +46 -0
  12. package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs.map +1 -0
  13. package/dist/chunks/{ToolbarPlugin-D5VqeBPT.mjs → ToolbarPlugin-DY2xaJiu.mjs} +63 -93
  14. package/dist/chunks/ToolbarPlugin-DY2xaJiu.mjs.map +1 -0
  15. package/dist/chunks/index-BAk1EG1x.mjs +541 -0
  16. package/dist/chunks/index-BAk1EG1x.mjs.map +1 -0
  17. package/dist/chunks/index-BRYzYOYC.mjs +63 -0
  18. package/dist/chunks/index-BRYzYOYC.mjs.map +1 -0
  19. package/dist/chunks/index-BSFLNveF.mjs +953 -0
  20. package/dist/chunks/index-BSFLNveF.mjs.map +1 -0
  21. package/dist/chunks/index-BYgspns5.mjs +209 -0
  22. package/dist/chunks/index-BYgspns5.mjs.map +1 -0
  23. package/dist/chunks/index-B_3qDrUN.mjs +64 -0
  24. package/dist/chunks/index-B_3qDrUN.mjs.map +1 -0
  25. package/dist/chunks/index-Bsp4LC5t.mjs +130 -0
  26. package/dist/chunks/index-Bsp4LC5t.mjs.map +1 -0
  27. package/dist/chunks/index-C-YWHOcC.mjs +100 -0
  28. package/dist/chunks/index-C-YWHOcC.mjs.map +1 -0
  29. package/dist/chunks/index-C2GQoHot.mjs +92 -0
  30. package/dist/chunks/index-C2GQoHot.mjs.map +1 -0
  31. package/dist/chunks/index-CT3HGdQt.mjs +39 -0
  32. package/dist/chunks/index-CT3HGdQt.mjs.map +1 -0
  33. package/dist/chunks/index-Ct0ivLhO.mjs +407 -0
  34. package/dist/chunks/index-Ct0ivLhO.mjs.map +1 -0
  35. package/dist/chunks/index-CxiWyUho.mjs +191 -0
  36. package/dist/chunks/index-CxiWyUho.mjs.map +1 -0
  37. package/dist/chunks/index-D3CQWJiw.mjs +200 -0
  38. package/dist/chunks/index-D3CQWJiw.mjs.map +1 -0
  39. package/dist/chunks/index-DC1EK22F.mjs +41 -0
  40. package/dist/chunks/index-DC1EK22F.mjs.map +1 -0
  41. package/dist/chunks/index-Dh76rR13.mjs +196 -0
  42. package/dist/chunks/index-Dh76rR13.mjs.map +1 -0
  43. package/dist/chunks/index-o6hDR07y.mjs +41 -0
  44. package/dist/chunks/index-o6hDR07y.mjs.map +1 -0
  45. package/dist/chunks/index-uTnc9y7M.mjs +62 -0
  46. package/dist/chunks/index-uTnc9y7M.mjs.map +1 -0
  47. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs +34 -0
  48. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -0
  49. package/dist/editor/EditorDOM.d.ts.map +1 -1
  50. package/dist/editor/NotectlEditor.d.ts +15 -1
  51. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  52. package/dist/editor/PaperLayoutController.d.ts +27 -0
  53. package/dist/editor/PaperLayoutController.d.ts.map +1 -0
  54. package/dist/editor/PaperSize.d.ts +35 -0
  55. package/dist/editor/PaperSize.d.ts.map +1 -0
  56. package/dist/editor/styles/color-picker.d.ts +1 -1
  57. package/dist/editor/styles/color-picker.d.ts.map +1 -1
  58. package/dist/editor/styles/paper.d.ts +3 -0
  59. package/dist/editor/styles/paper.d.ts.map +1 -0
  60. package/dist/editor/styles/table.d.ts +1 -1
  61. package/dist/editor/styles/table.d.ts.map +1 -1
  62. package/dist/editor/styles/toolbar.d.ts +1 -1
  63. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  64. package/dist/editor/styles.d.ts.map +1 -1
  65. package/dist/i18n/Locale.d.ts +17 -0
  66. package/dist/i18n/Locale.d.ts.map +1 -0
  67. package/dist/i18n/LocaleService.d.ts +8 -0
  68. package/dist/i18n/LocaleService.d.ts.map +1 -0
  69. package/dist/i18n/index.d.ts +4 -0
  70. package/dist/i18n/index.d.ts.map +1 -0
  71. package/dist/i18n/resolvePluginLocale.d.ts +3 -0
  72. package/dist/i18n/resolvePluginLocale.d.ts.map +1 -0
  73. package/dist/index.d.ts +44 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  76. package/dist/input/InputHandler.d.ts.map +1 -1
  77. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  78. package/dist/input/PasteHandler.d.ts.map +1 -1
  79. package/dist/notectl-core.mjs +1145 -837
  80. package/dist/notectl-core.mjs.map +1 -1
  81. package/dist/notectl-core.umd.js +2368 -1826
  82. package/dist/notectl-core.umd.js.map +1 -1
  83. package/dist/plugins/PluginManager.d.ts +8 -1
  84. package/dist/plugins/PluginManager.d.ts.map +1 -1
  85. package/dist/plugins/alignment/AlignmentLocale.d.ts +19 -0
  86. package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -0
  87. package/dist/plugins/alignment/AlignmentPlugin.d.ts +4 -0
  88. package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
  89. package/dist/plugins/alignment.mjs +3 -89
  90. package/dist/plugins/alignment.mjs.map +1 -1
  91. package/dist/plugins/blockquote/BlockquoteLocale.d.ts +17 -0
  92. package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -0
  93. package/dist/plugins/blockquote/BlockquotePlugin.d.ts +3 -0
  94. package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
  95. package/dist/plugins/blockquote.mjs +2 -55
  96. package/dist/plugins/blockquote.mjs.map +1 -1
  97. package/dist/plugins/code-block/CodeBlockCommands.d.ts +5 -0
  98. package/dist/plugins/code-block/CodeBlockCommands.d.ts.map +1 -0
  99. package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts +10 -0
  100. package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -0
  101. package/dist/plugins/code-block/CodeBlockLocale.d.ts +17 -0
  102. package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -0
  103. package/dist/plugins/code-block/CodeBlockNodeView.d.ts +1 -1
  104. package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
  105. package/dist/plugins/code-block/CodeBlockPlugin.d.ts +4 -111
  106. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  107. package/dist/plugins/code-block/CodeBlockService.d.ts +5 -0
  108. package/dist/plugins/code-block/CodeBlockService.d.ts.map +1 -0
  109. package/dist/plugins/code-block/CodeBlockTypes.d.ts +71 -0
  110. package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -0
  111. package/dist/plugins/code-block.mjs +3 -3
  112. package/dist/plugins/font/FontLocale.d.ts +15 -0
  113. package/dist/plugins/font/FontLocale.d.ts.map +1 -0
  114. package/dist/plugins/font/FontPlugin.d.ts +3 -0
  115. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  116. package/dist/plugins/font-size/FontSizeLocale.d.ts +17 -0
  117. package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -0
  118. package/dist/plugins/font-size/FontSizeOperations.d.ts +22 -0
  119. package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -0
  120. package/dist/plugins/font-size/FontSizePlugin.d.ts +4 -10
  121. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
  122. package/dist/plugins/font-size/FontSizePopup.d.ts +11 -0
  123. package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -0
  124. package/dist/plugins/font-size.mjs +2 -217
  125. package/dist/plugins/font-size.mjs.map +1 -1
  126. package/dist/plugins/font.mjs +2 -183
  127. package/dist/plugins/font.mjs.map +1 -1
  128. package/dist/plugins/hard-break.mjs +1 -1
  129. package/dist/plugins/heading/HeadingLocale.d.ts +26 -0
  130. package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -0
  131. package/dist/plugins/heading/HeadingPlugin.d.ts +4 -0
  132. package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
  133. package/dist/plugins/heading.mjs +1 -184
  134. package/dist/plugins/heading.mjs.map +1 -1
  135. package/dist/plugins/highlight/HighlightLocale.d.ts +17 -0
  136. package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -0
  137. package/dist/plugins/highlight/HighlightPlugin.d.ts +3 -5
  138. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  139. package/dist/plugins/highlight.mjs +2 -123
  140. package/dist/plugins/highlight.mjs.map +1 -1
  141. package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts +15 -0
  142. package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -0
  143. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +4 -0
  144. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
  145. package/dist/plugins/horizontal-rule.mjs +2 -56
  146. package/dist/plugins/horizontal-rule.mjs.map +1 -1
  147. package/dist/plugins/image/ImageLocale.d.ts +25 -0
  148. package/dist/plugins/image/ImageLocale.d.ts.map +1 -0
  149. package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
  150. package/dist/plugins/image/ImagePlugin.d.ts +1 -0
  151. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  152. package/dist/plugins/image/ImageUpload.d.ts +3 -0
  153. package/dist/plugins/image/ImageUpload.d.ts.map +1 -1
  154. package/dist/plugins/image.mjs +4 -378
  155. package/dist/plugins/image.mjs.map +1 -1
  156. package/dist/plugins/link/LinkLocale.d.ts +23 -0
  157. package/dist/plugins/link/LinkLocale.d.ts.map +1 -0
  158. package/dist/plugins/link/LinkPlugin.d.ts +3 -0
  159. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  160. package/dist/plugins/link.mjs +2 -124
  161. package/dist/plugins/link.mjs.map +1 -1
  162. package/dist/plugins/list/ListLocale.d.ts +18 -0
  163. package/dist/plugins/list/ListLocale.d.ts.map +1 -0
  164. package/dist/plugins/list/ListPlugin.d.ts +4 -0
  165. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  166. package/dist/plugins/list.mjs +2 -190
  167. package/dist/plugins/list.mjs.map +1 -1
  168. package/dist/plugins/print/PrintContentPreparer.d.ts +12 -0
  169. package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -0
  170. package/dist/plugins/print/PrintLocale.d.ts +16 -0
  171. package/dist/plugins/print/PrintLocale.d.ts.map +1 -0
  172. package/dist/plugins/print/PrintPlugin.d.ts +13 -0
  173. package/dist/plugins/print/PrintPlugin.d.ts.map +1 -0
  174. package/dist/plugins/print/PrintServiceImpl.d.ts +7 -0
  175. package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -0
  176. package/dist/plugins/print/PrintStyleCollector.d.ts +17 -0
  177. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -0
  178. package/dist/plugins/print/PrintTypes.d.ts +61 -0
  179. package/dist/plugins/print/PrintTypes.d.ts.map +1 -0
  180. package/dist/plugins/shared/ColorMarkOperations.d.ts +28 -0
  181. package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -0
  182. package/dist/plugins/shared/ColorNames.d.ts +22 -0
  183. package/dist/plugins/shared/ColorNames.d.ts.map +1 -0
  184. package/dist/plugins/shared/ColorPickerPopup.d.ts +31 -0
  185. package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -0
  186. package/dist/plugins/shared/ColorValidation.d.ts +14 -0
  187. package/dist/plugins/shared/ColorValidation.d.ts.map +1 -0
  188. package/dist/plugins/strikethrough/StrikethroughLocale.d.ts +17 -0
  189. package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -0
  190. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +3 -0
  191. package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
  192. package/dist/plugins/strikethrough.mjs +2 -32
  193. package/dist/plugins/strikethrough.mjs.map +1 -1
  194. package/dist/plugins/super-sub/SuperSubLocale.d.ts +19 -0
  195. package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -0
  196. package/dist/plugins/super-sub/SuperSubPlugin.d.ts +3 -0
  197. package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
  198. package/dist/plugins/super-sub.mjs +2 -78
  199. package/dist/plugins/super-sub.mjs.map +1 -1
  200. package/dist/plugins/table/TableBorderColor.d.ts +24 -0
  201. package/dist/plugins/table/TableBorderColor.d.ts.map +1 -0
  202. package/dist/plugins/table/TableCommands.d.ts +9 -8
  203. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  204. package/dist/plugins/table/TableContextMenu.d.ts +14 -0
  205. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -0
  206. package/dist/plugins/table/TableControls.d.ts +3 -1
  207. package/dist/plugins/table/TableControls.d.ts.map +1 -1
  208. package/dist/plugins/table/TableControlsDOM.d.ts +13 -1
  209. package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
  210. package/dist/plugins/table/TableLocale.d.ts +48 -0
  211. package/dist/plugins/table/TableLocale.d.ts.map +1 -0
  212. package/dist/plugins/table/TableNavigation.d.ts +2 -1
  213. package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
  214. package/dist/plugins/table/TableNodeViews.d.ts +3 -1
  215. package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
  216. package/dist/plugins/table/TablePlugin.d.ts +7 -1
  217. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  218. package/dist/plugins/table/index.d.ts +3 -0
  219. package/dist/plugins/table/index.d.ts.map +1 -1
  220. package/dist/plugins/table.mjs +18 -660
  221. package/dist/plugins/table.mjs.map +1 -1
  222. package/dist/plugins/text-color/TextColorLocale.d.ts +17 -0
  223. package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -0
  224. package/dist/plugins/text-color/TextColorPlugin.d.ts +3 -5
  225. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  226. package/dist/plugins/text-color.mjs +2 -123
  227. package/dist/plugins/text-color.mjs.map +1 -1
  228. package/dist/plugins/text-formatting/TextFormattingLocale.d.ts +18 -0
  229. package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -0
  230. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +4 -0
  231. package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
  232. package/dist/plugins/text-formatting.mjs +2 -49
  233. package/dist/plugins/text-formatting.mjs.map +1 -1
  234. package/dist/plugins/toolbar/ToolbarLocale.d.ts +14 -0
  235. package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -0
  236. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +1 -0
  237. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  238. package/dist/plugins/toolbar.mjs +1 -1
  239. package/dist/state/EditorState.d.ts +4 -1
  240. package/dist/state/EditorState.d.ts.map +1 -1
  241. package/dist/view/EditorView.d.ts.map +1 -1
  242. package/dist/view/Reconciler.d.ts.map +1 -1
  243. package/package.json +3 -2
  244. package/dist/chunks/Plugin-B9OZ6Y4c.mjs +0 -15
  245. package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +0 -1
  246. package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs.map +0 -1
  247. package/dist/chunks/color-picker-Csf0wx5a.mjs +0 -5
  248. package/dist/chunks/color-picker-Csf0wx5a.mjs.map +0 -1
  249. package/dist/chunks/index-CPPb-Jah.mjs +0 -569
  250. package/dist/chunks/index-CPPb-Jah.mjs.map +0 -1
@@ -1,41 +1,42 @@
1
- import { j as e, n as s, g as r, c as o, a as l, i as d, d as g, k as m, m as k, r as T, o as N, p as M, e as I, l as R, q as P, s as D, b as L, t as _, u as O } from "./chunks/Document-CI3iCwEP.mjs";
1
+ import { j as t, n as s, g as r, c as o, a as m, i as E, d as N, k as M, m as P, r as R, o as _, p as O, e as $, l as U, q as K, s as V, b as q, t as W, u as G } from "./chunks/Document-CI3iCwEP.mjs";
2
2
  import { f, v, h } from "./chunks/Document-CI3iCwEP.mjs";
3
- import { b as H, c as F, i as $, d as j, e as U, f as K, a as V, s as q, g as W } from "./chunks/Selection-D5ZjXoB7.mjs";
3
+ import { b as X, c as J, i as Q, d as Y, e as Z, f as ee, a as te, s as ne, g as se } from "./chunks/Selection-D5ZjXoB7.mjs";
4
4
  import { h as h2 } from "./chunks/Selection-D5ZjXoB7.mjs";
5
- import { d as X, s as J, n as Q, a as G, b as Y, i as Z, c as ee, e as te, f as ne, g as se, h as re, j as oe, k as ie, l as ae, m as ce, o as le, p as he, q as de, r as ue } from "./chunks/Commands-DLP85Mp5.mjs";
6
- import { t, u, v as v2, w, x, y, z, A, B } from "./chunks/Commands-DLP85Mp5.mjs";
7
- import { b as pe, n as fe, m as ge } from "./chunks/TypeBrands-C09nE2qO.mjs";
5
+ import { d as re, s as oe, n as ie, a as ae, b as ce, i as le, c as he, e as de, g as ue, h as pe, j as fe, k as ge, l as me, m as ye, o as ke, p as be, q as Se, r as ve, t as we } from "./chunks/Commands-CSpSwGXv.mjs";
6
+ import { f as f2, u, v as v2, w, x, y, z, A, B } from "./chunks/Commands-CSpSwGXv.mjs";
7
+ import { b as Ee, n as Te, m as xe } from "./chunks/TypeBrands-C09nE2qO.mjs";
8
8
  import { c, i, p } from "./chunks/TypeBrands-C09nE2qO.mjs";
9
- import { i as me } from "./chunks/AttrRegistry-DTsHyDVA.mjs";
10
- import { a, b } from "./chunks/AttrRegistry-DTsHyDVA.mjs";
11
- import { c as ye } from "./chunks/NodeSpec-NZVvcCuH.mjs";
12
- import { e as ke } from "./chunks/HTMLUtils-0wvCRvJc.mjs";
13
- import { a as be, r as Se, f as ve } from "./chunks/NodeResolver-D68ZLXti.mjs";
9
+ import { a as Ne } from "./chunks/AttrRegistry-D-przlzb.mjs";
10
+ import { b, i as i2 } from "./chunks/AttrRegistry-D-przlzb.mjs";
11
+ import { c as Ce } from "./chunks/NodeSpec-NZVvcCuH.mjs";
12
+ import { e as Le } from "./chunks/HTMLUtils-0wvCRvJc.mjs";
13
+ import { a as Ae, r as Ie, f as Me } from "./chunks/NodeResolver-D68ZLXti.mjs";
14
14
  import { b as b2, c as c2, w as w2 } from "./chunks/NodeResolver-D68ZLXti.mjs";
15
- import { E, S } from "./chunks/Plugin-B9OZ6Y4c.mjs";
16
- import { D as we, d as Te } from "./chunks/index-CPPb-Jah.mjs";
17
- import { C, a as a2, i as i2, n, w as w3 } from "./chunks/index-CPPb-Jah.mjs";
18
- import { T as Ee } from "./chunks/ToolbarPlugin-D5VqeBPT.mjs";
19
- import { a as a3 } from "./chunks/ToolbarPlugin-D5VqeBPT.mjs";
20
- import { f as f2 } from "./chunks/ToolbarItem-ugDymuXi.mjs";
21
- import { TextFormattingPlugin as xe } from "./plugins/text-formatting.mjs";
22
- import { HeadingPlugin } from "./plugins/heading.mjs";
23
- import { LinkPlugin } from "./plugins/link.mjs";
24
- import { ListPlugin } from "./plugins/list.mjs";
25
- import { BlockquotePlugin } from "./plugins/blockquote.mjs";
26
- import { StrikethroughPlugin } from "./plugins/strikethrough.mjs";
27
- import { TextColorPlugin } from "./plugins/text-color.mjs";
28
- import { HorizontalRulePlugin } from "./plugins/horizontal-rule.mjs";
29
- import { ALIGNMENT_ICONS, AlignmentPlugin, AlignmentPlugin as AlignmentPlugin2 } from "./plugins/alignment.mjs";
30
- import { FontPlugin } from "./plugins/font.mjs";
31
- import { FontSizePlugin } from "./plugins/font-size.mjs";
32
- import { TablePlugin, TableSelectionServiceKey, findTableContext, isInsideTable } from "./plugins/table.mjs";
33
- import { HighlightPlugin } from "./plugins/highlight.mjs";
34
- import { SuperSubPlugin } from "./plugins/super-sub.mjs";
35
- import { DEFAULT_IMAGE_KEYMAP, IMAGE_UPLOAD_SERVICE, ImagePlugin } from "./plugins/image.mjs";
15
+ import { E as Be, S as Pe, r as Re, L as _e, a as Oe } from "./chunks/resolvePluginLocale-B4w1OkPy.mjs";
16
+ import { D as De, d as He } from "./chunks/index-BAk1EG1x.mjs";
17
+ import { C, a, b as b3, c as c3, i as i3, n, w as w3 } from "./chunks/index-BAk1EG1x.mjs";
18
+ import { T as ze } from "./chunks/ToolbarPlugin-DY2xaJiu.mjs";
19
+ import { b as b4, c as c4, a as a2 } from "./chunks/ToolbarPlugin-DY2xaJiu.mjs";
20
+ import { f as $e } from "./chunks/ToolbarItem-ugDymuXi.mjs";
21
+ import { T as je } from "./chunks/index-B_3qDrUN.mjs";
22
+ import { a as a3, b as b5 } from "./chunks/index-B_3qDrUN.mjs";
23
+ import { H, a as a4, b as b6 } from "./chunks/index-Dh76rR13.mjs";
24
+ import { L, a as a5, b as b7 } from "./chunks/index-Bsp4LC5t.mjs";
25
+ import { L as L2, a as a6, b as b8 } from "./chunks/index-D3CQWJiw.mjs";
26
+ import { B as B2, a as a7, b as b9 } from "./chunks/index-uTnc9y7M.mjs";
27
+ import { S, a as a8, b as b10 } from "./chunks/index-CT3HGdQt.mjs";
28
+ import { T, a as a9, b as b11 } from "./chunks/index-DC1EK22F.mjs";
29
+ import { H as H2, a as a10, b as b12 } from "./chunks/index-BRYzYOYC.mjs";
30
+ import { A as A2, a as a11, b as b13, c as c5, d, d as d2 } from "./chunks/index-C-YWHOcC.mjs";
31
+ import { F, a as a12, b as b14 } from "./chunks/index-CxiWyUho.mjs";
32
+ import { F as F2, a as a13, b as b15 } from "./chunks/index-BYgspns5.mjs";
33
+ import { T as T2, a as a14, b as b16, c as c6, d as d3, e, f as f3, g, h as h3, i as i4, j, k, l } from "./chunks/index-BSFLNveF.mjs";
34
+ import { H as H3, a as a15, b as b17 } from "./chunks/index-o6hDR07y.mjs";
35
+ import { S as S2, a as a16, b as b18 } from "./chunks/index-C2GQoHot.mjs";
36
+ import { D, I, a as a17, b as b19, c as c7 } from "./chunks/index-Ct0ivLhO.mjs";
36
37
  import { HardBreakPlugin } from "./plugins/hard-break.mjs";
37
- import Ne from "dompurify";
38
- class Me {
38
+ import Fe from "dompurify";
39
+ class Ue {
39
40
  _nodeSpecs = /* @__PURE__ */ new Map();
40
41
  _markSpecs = /* @__PURE__ */ new Map();
41
42
  _inlineNodeSpecs = /* @__PURE__ */ new Map();
@@ -158,7 +159,7 @@ class Me {
158
159
  }
159
160
  matchFileHandlers(e2) {
160
161
  const t2 = [];
161
- for (const n2 of this._fileHandlers) Ie(n2.pattern, e2) && t2.push(n2.handler);
162
+ for (const n2 of this._fileHandlers) Ke(n2.pattern, e2) && t2.push(n2.handler);
162
163
  return t2;
163
164
  }
164
165
  removeFileHandler(e2) {
@@ -208,7 +209,7 @@ class Me {
208
209
  this._nodeSpecs.clear(), this._markSpecs.clear(), this._inlineNodeSpecs.clear(), this._nodeViews.clear(), this._keymaps.length = 0, this._inputRules.length = 0, this._toolbarItems.clear(), this._toolbarItemPluginMap.clear(), this._fileHandlers.length = 0, this._blockTypePickerEntries.clear();
209
210
  }
210
211
  }
211
- function Ie(e2, t2) {
212
+ function Ke(e2, t2) {
212
213
  if ("*" === e2 || "*/*" === e2) return true;
213
214
  if (e2 === t2) return true;
214
215
  if (e2.endsWith("/*")) {
@@ -217,7 +218,7 @@ function Ie(e2, t2) {
217
218
  }
218
219
  return false;
219
220
  }
220
- function Ce(e2, t2, n2) {
221
+ function Ve(e2, t2, n2) {
221
222
  const s2 = e2.getNodeSpec(t2);
222
223
  if (!s2?.content) return true;
223
224
  const r2 = e2.getNodeSpec(n2), o2 = r2?.group;
@@ -227,257 +228,257 @@ function Ce(e2, t2, n2) {
227
228
  }
228
229
  return false;
229
230
  }
230
- function Be(e2, t2, n2) {
231
+ function qe(e2, t2, n2) {
231
232
  const s2 = e2.getNodeSpec(t2);
232
233
  if (!s2?.content) return true;
233
- const { min: r2 = 0, max: o2 = Number.POSITIVE_INFINITY } = s2.content, i3 = n2.filter((e3) => "text" !== e3);
234
- if (i3.length < r2 || i3.length > o2) return false;
235
- for (const n3 of i3) if (!Ce(e2, t2, n3)) return false;
234
+ const { min: r2 = 0, max: o2 = Number.POSITIVE_INFINITY } = s2.content, i5 = n2.filter((e3) => "text" !== e3);
235
+ if (i5.length < r2 || i5.length > o2) return false;
236
+ for (const n3 of i5) if (!Ve(e2, t2, n3)) return false;
236
237
  return true;
237
238
  }
238
- function Re(e2) {
239
- e2.registerNodeSpec({ type: "paragraph", group: "block", content: { allow: ["text"] }, toDOM: (e3) => ye("p", e3.id), toHTML: (e3, t2) => `<p>${t2 || "<br>"}</p>`, parseHTML: [{ tag: "p" }, { tag: "div", priority: 10 }], sanitize: { tags: ["p"] } });
239
+ function We(e2) {
240
+ e2.registerNodeSpec({ type: "paragraph", group: "block", content: { allow: ["text"] }, toDOM: (e3) => Ce("p", e3.id), toHTML: (e3, t2) => `<p>${t2 || "<br>"}</p>`, parseHTML: [{ tag: "p" }, { tag: "div", priority: 10 }], sanitize: { tags: ["p"] } });
240
241
  }
241
- function Ae(t2, n2) {
242
+ function Ge(e2, n2) {
242
243
  switch (n2.type) {
243
244
  case "insertText":
244
- return (function(t3, n3) {
245
- return Le(t3, n3.blockId, (t4) => {
246
- const r2 = e(t4), o2 = n3.segments ? (function(e2, t5, n4) {
245
+ return (function(e3, n3) {
246
+ return Qe(e3, n3.blockId, (e4) => {
247
+ const r2 = t(e4), o2 = n3.segments ? (function(e5, t2, n4) {
247
248
  const s2 = [];
248
249
  let r3 = 0, o3 = false;
249
- for (const i3 of e2) {
250
- if (d(i3)) {
251
- if (!o3 && t5 === r3) {
252
- for (const e4 of n4) s2.push(g(e4.text, e4.marks));
250
+ for (const i5 of e5) {
251
+ if (E(i5)) {
252
+ if (!o3 && t2 === r3) {
253
+ for (const e7 of n4) s2.push(N(e7.text, e7.marks));
253
254
  o3 = true;
254
255
  }
255
- s2.push(i3), r3 += 1;
256
+ s2.push(i5), r3 += 1;
256
257
  continue;
257
258
  }
258
- const e3 = r3 + i3.text.length;
259
- if (!o3 && t5 >= r3 && t5 <= e3) {
260
- const e4 = t5 - r3, a4 = i3.text.slice(0, e4), c3 = i3.text.slice(e4);
261
- a4 && s2.push(g(a4, i3.marks));
262
- for (const e5 of n4) s2.push(g(e5.text, e5.marks));
263
- c3 && s2.push(g(c3, i3.marks)), o3 = true;
264
- } else s2.push(i3);
265
- r3 = e3;
259
+ const e6 = r3 + i5.text.length;
260
+ if (!o3 && t2 >= r3 && t2 <= e6) {
261
+ const e7 = t2 - r3, a18 = i5.text.slice(0, e7), c8 = i5.text.slice(e7);
262
+ a18 && s2.push(N(a18, i5.marks));
263
+ for (const e8 of n4) s2.push(N(e8.text, e8.marks));
264
+ c8 && s2.push(N(c8, i5.marks)), o3 = true;
265
+ } else s2.push(i5);
266
+ r3 = e6;
266
267
  }
267
- if (!o3) for (const e3 of n4) s2.push(g(e3.text, e3.marks));
268
+ if (!o3) for (const e6 of n4) s2.push(N(e6.text, e6.marks));
268
269
  return s2;
269
- })(r2, n3.offset, n3.segments) : (function(e2, t5, n4, s2) {
270
+ })(r2, n3.offset, n3.segments) : (function(e5, t2, n4, s2) {
270
271
  const r3 = [];
271
- let o3 = 0, i3 = false;
272
- for (const a4 of e2) {
273
- if (d(a4)) {
274
- i3 || t5 !== o3 || (r3.push(g(n4, s2)), i3 = true), r3.push(a4), o3 += 1;
272
+ let o3 = 0, i5 = false;
273
+ for (const a18 of e5) {
274
+ if (E(a18)) {
275
+ i5 || t2 !== o3 || (r3.push(N(n4, s2)), i5 = true), r3.push(a18), o3 += 1;
275
276
  continue;
276
277
  }
277
- const e3 = o3 + a4.text.length;
278
- if (!i3 && t5 >= o3 && t5 <= e3) {
279
- const e4 = t5 - o3, c3 = a4.text.slice(0, e4), l2 = a4.text.slice(e4);
280
- c3 && r3.push(g(c3, a4.marks)), r3.push(g(n4, s2)), l2 && r3.push(g(l2, a4.marks)), i3 = true;
281
- } else r3.push(a4);
282
- o3 = e3;
278
+ const e6 = o3 + a18.text.length;
279
+ if (!i5 && t2 >= o3 && t2 <= e6) {
280
+ const e7 = t2 - o3, c8 = a18.text.slice(0, e7), l2 = a18.text.slice(e7);
281
+ c8 && r3.push(N(c8, a18.marks)), r3.push(N(n4, s2)), l2 && r3.push(N(l2, a18.marks)), i5 = true;
282
+ } else r3.push(a18);
283
+ o3 = e6;
283
284
  }
284
- return i3 || r3.push(g(n4, s2)), r3;
285
+ return i5 || r3.push(N(n4, s2)), r3;
285
286
  })(r2, n3.offset, n3.text, n3.marks);
286
- return { ...t4, children: Oe(t4.children, s(o2)) };
287
+ return { ...e4, children: Ze(e4.children, s(o2)) };
287
288
  });
288
- })(t2, n2);
289
+ })(e2, n2);
289
290
  case "deleteText":
290
- return (function(t3, n3) {
291
- return Le(t3, n3.blockId, (t4) => {
292
- const r2 = (function(e2, t5, n4) {
291
+ return (function(e3, n3) {
292
+ return Qe(e3, n3.blockId, (e4) => {
293
+ const r2 = (function(e5, t2, n4) {
293
294
  const s2 = [];
294
295
  let r3 = 0;
295
- for (const o2 of e2) {
296
- if (d(o2)) {
297
- const e4 = r3 + 1;
298
- (e4 <= t5 || r3 >= n4) && s2.push(o2), r3 = e4;
296
+ for (const o2 of e5) {
297
+ if (E(o2)) {
298
+ const e7 = r3 + 1;
299
+ (e7 <= t2 || r3 >= n4) && s2.push(o2), r3 = e7;
299
300
  continue;
300
301
  }
301
- const e3 = r3 + o2.text.length;
302
- if (e3 <= t5 || r3 >= n4) s2.push(o2);
302
+ const e6 = r3 + o2.text.length;
303
+ if (e6 <= t2 || r3 >= n4) s2.push(o2);
303
304
  else {
304
- const e4 = Math.max(0, t5 - r3), i3 = Math.min(o2.text.length, n4 - r3), a4 = o2.text.slice(0, e4) + o2.text.slice(i3);
305
- a4.length > 0 && s2.push(g(a4, o2.marks));
305
+ const e7 = Math.max(0, t2 - r3), i5 = Math.min(o2.text.length, n4 - r3), a18 = o2.text.slice(0, e7) + o2.text.slice(i5);
306
+ a18.length > 0 && s2.push(N(a18, o2.marks));
306
307
  }
307
- r3 = e3;
308
+ r3 = e6;
308
309
  }
309
310
  return s2;
310
- })(e(t4), n3.from, n3.to);
311
- return { ...t4, children: Oe(t4.children, s(r2)) };
311
+ })(t(e4), n3.from, n3.to);
312
+ return { ...e4, children: Ze(e4.children, s(r2)) };
312
313
  });
313
- })(t2, n2);
314
+ })(e2, n2);
314
315
  case "splitBlock":
315
- return (function(t3, n3) {
316
- const i3 = t3.children.findIndex((e2) => e2.id === n3.blockId);
317
- if (-1 !== i3) {
318
- const a4 = t3.children[i3];
319
- if (!a4) return t3;
320
- const c3 = e(a4), l2 = r(a4), h3 = He(c3, 0, n3.offset), d2 = He(c3, n3.offset, l2), u2 = { ...a4, children: s(h3) }, p2 = o(a4.type, s(d2), n3.newBlockId, a4.attrs), f3 = [...t3.children];
321
- return f3.splice(i3, 1, u2, p2), { children: f3 };
316
+ return (function(e3, n3) {
317
+ const i5 = e3.children.findIndex((e4) => e4.id === n3.blockId);
318
+ if (-1 !== i5) {
319
+ const a18 = e3.children[i5];
320
+ if (!a18) return e3;
321
+ const c8 = t(a18), l2 = r(a18), h4 = et(c8, 0, n3.offset), d4 = et(c8, n3.offset, l2), u2 = { ...a18, children: s(h4) }, p2 = o(a18.type, s(d4), n3.newBlockId, a18.attrs), f4 = [...e3.children];
322
+ return f4.splice(i5, 1, u2, p2), { children: f4 };
322
323
  }
323
- return { children: t3.children.map((e2) => Pe(e2, n3) ?? e2) };
324
- })(t2, n2);
324
+ return { children: e3.children.map((e4) => Xe(e4, n3) ?? e4) };
325
+ })(e2, n2);
325
326
  case "mergeBlocks":
326
- return (function(t3, n3) {
327
- const r2 = t3.children.findIndex((e2) => e2.id === n3.targetBlockId), o2 = t3.children.findIndex((e2) => e2.id === n3.sourceBlockId);
327
+ return (function(e3, n3) {
328
+ const r2 = e3.children.findIndex((e4) => e4.id === n3.targetBlockId), o2 = e3.children.findIndex((e4) => e4.id === n3.sourceBlockId);
328
329
  if (-1 !== r2 && -1 !== o2) {
329
- const i3 = t3.children[r2], a4 = t3.children[o2];
330
- if (!i3 || !a4) return t3;
331
- const c3 = e(i3), l2 = e(a4), h3 = s([...c3, ...l2]), d2 = { ...i3, children: h3 };
332
- return { children: t3.children.filter((e2) => e2.id !== n3.sourceBlockId).map((e2) => e2.id === n3.targetBlockId ? d2 : e2) };
330
+ const i5 = e3.children[r2], a18 = e3.children[o2];
331
+ if (!i5 || !a18) return e3;
332
+ const c8 = t(i5), l2 = t(a18), h4 = s([...c8, ...l2]), d4 = { ...i5, children: h4 };
333
+ return { children: e3.children.filter((e4) => e4.id !== n3.sourceBlockId).map((e4) => e4.id === n3.targetBlockId ? d4 : e4) };
333
334
  }
334
- return { children: t3.children.map((e2) => De(e2, n3) ?? e2) };
335
- })(t2, n2);
335
+ return { children: e3.children.map((e4) => Je(e4, n3) ?? e4) };
336
+ })(e2, n2);
336
337
  case "addMark":
337
- return (function(t3, n3) {
338
- return Le(t3, n3.blockId, (t4) => {
339
- const r2 = ze(e(t4), n3.from, n3.to, n3.mark, true);
340
- return { ...t4, children: Oe(t4.children, s(r2)) };
338
+ return (function(e3, n3) {
339
+ return Qe(e3, n3.blockId, (e4) => {
340
+ const r2 = tt(t(e4), n3.from, n3.to, n3.mark, true);
341
+ return { ...e4, children: Ze(e4.children, s(r2)) };
341
342
  });
342
- })(t2, n2);
343
+ })(e2, n2);
343
344
  case "removeMark":
344
- return (function(t3, n3) {
345
- return Le(t3, n3.blockId, (t4) => {
346
- const r2 = ze(e(t4), n3.from, n3.to, n3.mark, false);
347
- return { ...t4, children: Oe(t4.children, s(r2)) };
345
+ return (function(e3, n3) {
346
+ return Qe(e3, n3.blockId, (e4) => {
347
+ const r2 = tt(t(e4), n3.from, n3.to, n3.mark, false);
348
+ return { ...e4, children: Ze(e4.children, s(r2)) };
348
349
  });
349
- })(t2, n2);
350
+ })(e2, n2);
350
351
  case "setStoredMarks":
351
- return t2;
352
+ return e2;
352
353
  case "setBlockType":
353
- return (function(e2, t3) {
354
- return Le(e2, t3.blockId, (e3) => ({ ...e3, type: t3.nodeType, ...t3.attrs ? { attrs: t3.attrs } : { attrs: void 0 } }));
355
- })(t2, n2);
354
+ return (function(e3, t2) {
355
+ return Qe(e3, t2.blockId, (e4) => ({ ...e4, type: t2.nodeType, ...t2.attrs ? { attrs: t2.attrs } : { attrs: void 0 } }));
356
+ })(e2, n2);
356
357
  case "insertNode":
357
- return (function(e2, t3) {
358
- if (0 === t3.parentPath.length) {
359
- const n3 = [...e2.children];
360
- return n3.splice(t3.index, 0, t3.node), { children: n3 };
361
- }
362
- return Fe(e2, t3.parentPath, (e3) => {
358
+ return (function(e3, t2) {
359
+ if (0 === t2.parentPath.length) {
363
360
  const n3 = [...e3.children];
364
- return n3.splice(t3.index, 0, t3.node), { ...e3, children: n3 };
361
+ return n3.splice(t2.index, 0, t2.node), { children: n3 };
362
+ }
363
+ return nt(e3, t2.parentPath, (e4) => {
364
+ const n3 = [...e4.children];
365
+ return n3.splice(t2.index, 0, t2.node), { ...e4, children: n3 };
365
366
  });
366
- })(t2, n2);
367
+ })(e2, n2);
367
368
  case "removeNode":
368
- return (function(e2, t3) {
369
- if (0 === t3.parentPath.length) {
370
- const n3 = [...e2.children];
371
- return n3.splice(t3.index, 1), { children: n3 };
372
- }
373
- return Fe(e2, t3.parentPath, (e3) => {
369
+ return (function(e3, t2) {
370
+ if (0 === t2.parentPath.length) {
374
371
  const n3 = [...e3.children];
375
- return n3.splice(t3.index, 1), { ...e3, children: n3 };
372
+ return n3.splice(t2.index, 1), { children: n3 };
373
+ }
374
+ return nt(e3, t2.parentPath, (e4) => {
375
+ const n3 = [...e4.children];
376
+ return n3.splice(t2.index, 1), { ...e4, children: n3 };
376
377
  });
377
- })(t2, n2);
378
+ })(e2, n2);
378
379
  case "setNodeAttr":
379
- return (function(e2, t3) {
380
- const n3 = t3.path[t3.path.length - 1];
381
- return n3 ? Le(e2, n3, (e3) => ({ ...e3, attrs: t3.attrs })) : e2;
382
- })(t2, n2);
380
+ return (function(e3, t2) {
381
+ const n3 = t2.path[t2.path.length - 1];
382
+ return n3 ? Qe(e3, n3, (e4) => ({ ...e4, attrs: t2.attrs })) : e3;
383
+ })(e2, n2);
383
384
  case "insertInlineNode":
384
- return (function(t3, n3) {
385
- return Le(t3, n3.blockId, (t4) => {
386
- const r2 = (function(e2, t5, n4) {
385
+ return (function(e3, n3) {
386
+ return Qe(e3, n3.blockId, (e4) => {
387
+ const r2 = (function(e5, t2, n4) {
387
388
  const s2 = [];
388
389
  let r3 = 0, o2 = false;
389
- for (const i3 of e2) {
390
- if (d(i3)) {
391
- o2 || t5 !== r3 || (s2.push(n4), o2 = true), s2.push(i3), r3 += 1;
390
+ for (const i5 of e5) {
391
+ if (E(i5)) {
392
+ o2 || t2 !== r3 || (s2.push(n4), o2 = true), s2.push(i5), r3 += 1;
392
393
  continue;
393
394
  }
394
- const e3 = r3 + i3.text.length;
395
- if (!o2 && t5 >= r3 && t5 <= e3) {
396
- const e4 = t5 - r3, a4 = i3.text.slice(0, e4), c3 = i3.text.slice(e4);
397
- a4 && s2.push(g(a4, i3.marks)), s2.push(n4), c3 && s2.push(g(c3, i3.marks)), o2 = true;
398
- } else s2.push(i3);
399
- r3 = e3;
395
+ const e6 = r3 + i5.text.length;
396
+ if (!o2 && t2 >= r3 && t2 <= e6) {
397
+ const e7 = t2 - r3, a18 = i5.text.slice(0, e7), c8 = i5.text.slice(e7);
398
+ a18 && s2.push(N(a18, i5.marks)), s2.push(n4), c8 && s2.push(N(c8, i5.marks)), o2 = true;
399
+ } else s2.push(i5);
400
+ r3 = e6;
400
401
  }
401
402
  return o2 || s2.push(n4), s2;
402
- })(e(t4), n3.offset, n3.node);
403
- return { ...t4, children: Oe(t4.children, s(r2)) };
403
+ })(t(e4), n3.offset, n3.node);
404
+ return { ...e4, children: Ze(e4.children, s(r2)) };
404
405
  });
405
- })(t2, n2);
406
+ })(e2, n2);
406
407
  case "removeInlineNode":
407
- return (function(t3, n3) {
408
- return Le(t3, n3.blockId, (t4) => {
409
- const r2 = (function(e2, t5) {
408
+ return (function(e3, n3) {
409
+ return Qe(e3, n3.blockId, (e4) => {
410
+ const r2 = (function(e5, t2) {
410
411
  const n4 = [];
411
412
  let s2 = 0;
412
- for (const r3 of e2) d(r3) ? (s2 !== t5 && n4.push(r3), s2 += 1) : (n4.push(r3), s2 += r3.text.length);
413
+ for (const r3 of e5) E(r3) ? (s2 !== t2 && n4.push(r3), s2 += 1) : (n4.push(r3), s2 += r3.text.length);
413
414
  return n4;
414
- })(e(t4), n3.offset);
415
- return { ...t4, children: Oe(t4.children, s(r2)) };
415
+ })(t(e4), n3.offset);
416
+ return { ...e4, children: Ze(e4.children, s(r2)) };
416
417
  });
417
- })(t2, n2);
418
+ })(e2, n2);
418
419
  case "setInlineNodeAttr":
419
- return (function(t3, n3) {
420
- return Le(t3, n3.blockId, (t4) => {
421
- const s2 = (function(e2, t5, n4) {
420
+ return (function(e3, n3) {
421
+ return Qe(e3, n3.blockId, (e4) => {
422
+ const s2 = (function(e5, t2, n4) {
422
423
  const s3 = [];
423
424
  let r2 = 0;
424
- for (const o2 of e2) d(o2) ? (r2 === t5 ? s3.push({ ...o2, attrs: n4 }) : s3.push(o2), r2 += 1) : (s3.push(o2), r2 += o2.text.length);
425
+ for (const o2 of e5) E(o2) ? (r2 === t2 ? s3.push({ ...o2, attrs: n4 }) : s3.push(o2), r2 += 1) : (s3.push(o2), r2 += o2.text.length);
425
426
  return s3;
426
- })(e(t4), n3.offset, n3.attrs);
427
- return { ...t4, children: Oe(t4.children, s2) };
427
+ })(t(e4), n3.offset, n3.attrs);
428
+ return { ...e4, children: Ze(e4.children, s2) };
428
429
  });
429
- })(t2, n2);
430
+ })(e2, n2);
430
431
  }
431
432
  }
432
- function Pe(t2, n2) {
433
- const i3 = t2.children.findIndex((e2) => l(e2) && e2.id === n2.blockId);
434
- if (-1 !== i3) {
435
- const a5 = t2.children[i3], c4 = e(a5), l2 = r(a5), h3 = He(c4, 0, n2.offset), d2 = He(c4, n2.offset, l2), u2 = { ...a5, children: s(h3) }, p2 = o(a5.type, s(d2), n2.newBlockId, a5.attrs), f3 = [...t2.children];
436
- return f3.splice(i3, 1, u2, p2), { ...t2, children: f3 };
433
+ function Xe(e2, n2) {
434
+ const i5 = e2.children.findIndex((e3) => m(e3) && e3.id === n2.blockId);
435
+ if (-1 !== i5) {
436
+ const a19 = e2.children[i5], c9 = t(a19), l2 = r(a19), h4 = et(c9, 0, n2.offset), d4 = et(c9, n2.offset, l2), u2 = { ...a19, children: s(h4) }, p2 = o(a19.type, s(d4), n2.newBlockId, a19.attrs), f4 = [...e2.children];
437
+ return f4.splice(i5, 1, u2, p2), { ...e2, children: f4 };
437
438
  }
438
- let a4 = false;
439
- const c3 = t2.children.map((e2) => {
440
- if (!l(e2)) return e2;
441
- const t3 = Pe(e2, n2);
442
- return t3 ? (a4 = true, t3) : e2;
439
+ let a18 = false;
440
+ const c8 = e2.children.map((e3) => {
441
+ if (!m(e3)) return e3;
442
+ const t2 = Xe(e3, n2);
443
+ return t2 ? (a18 = true, t2) : e3;
443
444
  });
444
- return a4 ? { ...t2, children: c3 } : null;
445
+ return a18 ? { ...e2, children: c8 } : null;
445
446
  }
446
- function De(t2, n2) {
447
- const r2 = t2.children.findIndex((e2) => l(e2) && e2.id === n2.targetBlockId), o2 = t2.children.findIndex((e2) => l(e2) && e2.id === n2.sourceBlockId);
447
+ function Je(e2, n2) {
448
+ const r2 = e2.children.findIndex((e3) => m(e3) && e3.id === n2.targetBlockId), o2 = e2.children.findIndex((e3) => m(e3) && e3.id === n2.sourceBlockId);
448
449
  if (-1 !== r2 && -1 !== o2) {
449
- const i4 = t2.children[r2], a5 = t2.children[o2], c3 = e(i4), h3 = e(a5), d2 = s([...c3, ...h3]), u2 = { ...i4, children: d2 }, p2 = t2.children.filter((e2) => !l(e2) || e2.id !== n2.sourceBlockId).map((e2) => l(e2) && e2.id === n2.targetBlockId ? u2 : e2);
450
- return { ...t2, children: p2 };
451
- }
452
- let i3 = false;
453
- const a4 = t2.children.map((e2) => {
454
- if (!l(e2)) return e2;
455
- const t3 = De(e2, n2);
456
- return t3 ? (i3 = true, t3) : e2;
450
+ const i6 = e2.children[r2], a19 = e2.children[o2], c8 = t(i6), l2 = t(a19), h4 = s([...c8, ...l2]), d4 = { ...i6, children: h4 }, u2 = e2.children.filter((e3) => !m(e3) || e3.id !== n2.sourceBlockId).map((e3) => m(e3) && e3.id === n2.targetBlockId ? d4 : e3);
451
+ return { ...e2, children: u2 };
452
+ }
453
+ let i5 = false;
454
+ const a18 = e2.children.map((e3) => {
455
+ if (!m(e3)) return e3;
456
+ const t2 = Je(e3, n2);
457
+ return t2 ? (i5 = true, t2) : e3;
457
458
  });
458
- return i3 ? { ...t2, children: a4 } : null;
459
+ return i5 ? { ...e2, children: a18 } : null;
459
460
  }
460
- function Le(e2, t2, n2) {
461
- return { children: _e(e2.children, t2, n2) };
461
+ function Qe(e2, t2, n2) {
462
+ return { children: Ye(e2.children, t2, n2) };
462
463
  }
463
- function _e(e2, t2, n2) {
464
+ function Ye(e2, t2, n2) {
464
465
  return e2.map((e3) => {
465
- if (!l(e3)) return e3;
466
+ if (!m(e3)) return e3;
466
467
  if (e3.id === t2) return n2(e3);
467
- const s2 = _e(e3.children, t2, n2);
468
+ const s2 = Ye(e3.children, t2, n2);
468
469
  return s2 === e3.children ? e3 : { ...e3, children: s2 };
469
470
  });
470
471
  }
471
- function Oe(e2, t2) {
472
- if (e2.every((e3) => m(e3) || d(e3))) return t2;
473
- const n2 = e2.filter((e3) => !m(e3) && !d(e3));
472
+ function Ze(e2, t2) {
473
+ if (e2.every((e3) => M(e3) || E(e3))) return t2;
474
+ const n2 = e2.filter((e3) => !M(e3) && !E(e3));
474
475
  return [...t2, ...n2];
475
476
  }
476
- function He(e2, t2, n2) {
477
+ function et(e2, t2, n2) {
477
478
  const s2 = [];
478
479
  let r2 = 0;
479
480
  for (const o2 of e2) {
480
- if (d(o2)) {
481
+ if (E(o2)) {
481
482
  const e4 = r2 + 1;
482
483
  e4 > t2 && r2 < n2 && s2.push(o2), r2 = e4;
483
484
  continue;
@@ -485,50 +486,50 @@ function He(e2, t2, n2) {
485
486
  const e3 = r2 + o2.text.length;
486
487
  if (e3 <= t2 || r2 >= n2) ;
487
488
  else {
488
- const e4 = Math.max(0, t2 - r2), i3 = Math.min(o2.text.length, n2 - r2), a4 = o2.text.slice(e4, i3);
489
- a4.length > 0 && s2.push(g(a4, o2.marks));
489
+ const e4 = Math.max(0, t2 - r2), i5 = Math.min(o2.text.length, n2 - r2), a18 = o2.text.slice(e4, i5);
490
+ a18.length > 0 && s2.push(N(a18, o2.marks));
490
491
  }
491
492
  r2 = e3;
492
493
  }
493
- return 0 === s2.length && s2.push(g("")), s2;
494
+ return 0 === s2.length && s2.push(N("")), s2;
494
495
  }
495
- function ze(e2, t2, n2, s2, r2) {
496
+ function tt(e2, t2, n2, s2, r2) {
496
497
  const o2 = [];
497
- let i3 = 0;
498
- for (const a4 of e2) {
499
- if (d(a4)) {
500
- o2.push(a4), i3 += 1;
498
+ let i5 = 0;
499
+ for (const a18 of e2) {
500
+ if (E(a18)) {
501
+ o2.push(a18), i5 += 1;
501
502
  continue;
502
503
  }
503
- const e3 = i3 + a4.text.length;
504
- if (e3 <= t2 || i3 >= n2) o2.push(a4);
505
- else if (i3 >= t2 && e3 <= n2) {
506
- const e4 = r2 ? k(a4.marks, s2) : T(a4.marks, s2.type);
507
- o2.push(g(a4.text, e4));
504
+ const e3 = i5 + a18.text.length;
505
+ if (e3 <= t2 || i5 >= n2) o2.push(a18);
506
+ else if (i5 >= t2 && e3 <= n2) {
507
+ const e4 = r2 ? P(a18.marks, s2) : R(a18.marks, s2.type);
508
+ o2.push(N(a18.text, e4));
508
509
  } else {
509
- const e4 = Math.max(0, t2 - i3), c3 = Math.min(a4.text.length, n2 - i3), l2 = a4.text.slice(0, e4), h3 = a4.text.slice(e4, c3), d2 = a4.text.slice(c3);
510
- if (l2 && o2.push(g(l2, a4.marks)), h3) {
511
- const e5 = r2 ? k(a4.marks, s2) : T(a4.marks, s2.type);
512
- o2.push(g(h3, e5));
510
+ const e4 = Math.max(0, t2 - i5), c8 = Math.min(a18.text.length, n2 - i5), l2 = a18.text.slice(0, e4), h4 = a18.text.slice(e4, c8), d4 = a18.text.slice(c8);
511
+ if (l2 && o2.push(N(l2, a18.marks)), h4) {
512
+ const e5 = r2 ? P(a18.marks, s2) : R(a18.marks, s2.type);
513
+ o2.push(N(h4, e5));
513
514
  }
514
- d2 && o2.push(g(d2, a4.marks));
515
+ d4 && o2.push(N(d4, a18.marks));
515
516
  }
516
- i3 = e3;
517
+ i5 = e3;
517
518
  }
518
519
  return o2;
519
520
  }
520
- function Fe(e2, t2, n2) {
521
+ function nt(e2, t2, n2) {
521
522
  if (0 === t2.length) return e2;
522
523
  const s2 = t2[0];
523
- return s2 ? { children: e2.children.map((e3) => l(e3) && e3.id === s2 ? 1 === t2.length ? n2(e3) : $e(e3, t2, 1, n2) : e3) } : e2;
524
+ return s2 ? { children: e2.children.map((e3) => m(e3) && e3.id === s2 ? 1 === t2.length ? n2(e3) : st(e3, t2, 1, n2) : e3) } : e2;
524
525
  }
525
- function $e(e2, t2, n2, s2) {
526
+ function st(e2, t2, n2, s2) {
526
527
  const r2 = t2[n2];
527
528
  if (!r2) return e2;
528
- const o2 = e2.children.map((e3) => l(e3) && e3.id === r2 ? n2 === t2.length - 1 ? s2(e3) : $e(e3, t2, n2 + 1, s2) : e3);
529
+ const o2 = e2.children.map((e3) => m(e3) && e3.id === r2 ? n2 === t2.length - 1 ? s2(e3) : st(e3, t2, n2 + 1, s2) : e3);
529
530
  return { ...e2, children: o2 };
530
531
  }
531
- function je(e2) {
532
+ function rt(e2) {
532
533
  switch (e2.type) {
533
534
  case "insertText":
534
535
  return { type: "deleteText", blockId: e2.blockId, from: e2.offset, to: e2.offset + e2.text.length, deletedText: e2.text, deletedMarks: e2.marks, deletedSegments: e2.segments ?? [{ text: e2.text, marks: [...e2.marks] }], ...e2.path ? { path: e2.path } : {} };
@@ -560,10 +561,10 @@ function je(e2) {
560
561
  return { type: "setInlineNodeAttr", blockId: e2.blockId, offset: e2.offset, attrs: e2.previousAttrs, previousAttrs: e2.attrs, ...e2.path ? { path: e2.path } : {} };
561
562
  }
562
563
  }
563
- function Ue(e2) {
564
- return { steps: e2.steps.map(je).reverse(), selectionBefore: e2.selectionAfter, selectionAfter: e2.selectionBefore, storedMarksAfter: null, metadata: { origin: "history", timestamp: Date.now() } };
564
+ function ot(e2) {
565
+ return { steps: e2.steps.map(rt).reverse(), selectionBefore: e2.selectionAfter, selectionAfter: e2.selectionBefore, storedMarksAfter: null, metadata: { origin: "history", timestamp: Date.now() } };
565
566
  }
566
- class Ke {
567
+ class it {
567
568
  steps = [];
568
569
  selection;
569
570
  storedMarks;
@@ -578,22 +579,22 @@ class Ke {
578
579
  return this.steps.push(o2), this.advanceDoc(o2), this;
579
580
  }
580
581
  deleteText(e2, t2, n2, s2, r2, o2) {
581
- let i3;
582
- if (o2) i3 = o2;
582
+ let i5;
583
+ if (o2) i5 = o2;
583
584
  else if (this.workingDoc) {
584
- const o3 = be(this.workingDoc, e2);
585
- i3 = o3 ? N(o3, t2, n2) : [{ text: s2, marks: [...r2] }];
586
- } else i3 = [{ text: s2, marks: [...r2] }];
587
- const a4 = { type: "deleteText", blockId: e2, from: t2, to: n2, deletedText: s2, deletedMarks: r2, deletedSegments: i3 };
588
- return this.steps.push(a4), this.advanceDoc(a4), this;
585
+ const o3 = Ae(this.workingDoc, e2);
586
+ i5 = o3 ? _(o3, t2, n2) : [{ text: s2, marks: [...r2] }];
587
+ } else i5 = [{ text: s2, marks: [...r2] }];
588
+ const a18 = { type: "deleteText", blockId: e2, from: t2, to: n2, deletedText: s2, deletedMarks: r2, deletedSegments: i5 };
589
+ return this.steps.push(a18), this.advanceDoc(a18), this;
589
590
  }
590
591
  deleteTextAt(e2, t2, n2) {
591
592
  const s2 = this.workingDoc;
592
593
  if (!s2) throw new Error("deleteTextAt requires a document. Use state.transaction() or provide doc to constructor.");
593
- const r2 = be(s2, e2);
594
+ const r2 = Ae(s2, e2);
594
595
  if (!r2) throw new Error(`Block "${e2}" not found in working document.`);
595
- const o2 = M(r2).slice(t2, n2), i3 = I(r2, t2), a4 = N(r2, t2, n2);
596
- return this.deleteText(e2, t2, n2, o2, i3, a4);
596
+ const o2 = O(r2).slice(t2, n2), i5 = $(r2, t2), a18 = _(r2, t2, n2);
597
+ return this.deleteText(e2, t2, n2, o2, i5, a18);
597
598
  }
598
599
  splitBlock(e2, t2, n2) {
599
600
  const s2 = { type: "splitBlock", blockId: e2, offset: t2, newBlockId: n2 };
@@ -606,7 +607,7 @@ class Ke {
606
607
  mergeBlocksAt(e2, t2) {
607
608
  const n2 = this.workingDoc;
608
609
  if (!n2) throw new Error("mergeBlocksAt requires a document. Use state.transaction() or provide doc to constructor.");
609
- const s2 = be(n2, e2);
610
+ const s2 = Ae(n2, e2);
610
611
  if (!s2) throw new Error(`Target block "${e2}" not found in working document.`);
611
612
  const o2 = r(s2);
612
613
  return this.mergeBlocks(e2, t2, o2);
@@ -622,7 +623,7 @@ class Ke {
622
623
  setBlockType(e2, t2, n2) {
623
624
  const s2 = this.workingDoc;
624
625
  if (!s2) throw new Error("setBlockType requires a document. Use state.transaction() or provide doc to constructor.");
625
- const r2 = be(s2, e2);
626
+ const r2 = Ae(s2, e2);
626
627
  if (!r2) throw new Error(`Block "${e2}" not found in working document.`);
627
628
  const o2 = { type: "setBlockType", blockId: e2, nodeType: t2, ...n2 ? { attrs: n2 } : {}, previousNodeType: r2.type, ...r2.attrs ? { previousAttrs: r2.attrs } : {} };
628
629
  return this.steps.push(o2), this.advanceDoc(o2), this;
@@ -637,12 +638,12 @@ class Ke {
637
638
  const s2 = (function(e3, t3, n3) {
638
639
  if (0 === t3.length) {
639
640
  const t4 = e3.children[n3];
640
- return t4 && l(t4) ? t4 : void 0;
641
+ return t4 && m(t4) ? t4 : void 0;
641
642
  }
642
- const s3 = Se(e3, t3);
643
+ const s3 = Ie(e3, t3);
643
644
  if (!s3) return;
644
645
  const r3 = s3.children[n3];
645
- return r3 && l(r3) ? r3 : void 0;
646
+ return r3 && m(r3) ? r3 : void 0;
646
647
  })(n2, e2, t2);
647
648
  if (!s2) throw new Error(`Node at index ${t2} not found under parent path [${e2.join(", ")}].`);
648
649
  const r2 = { type: "removeNode", parentPath: e2, index: t2, removedNode: s2 };
@@ -651,7 +652,7 @@ class Ke {
651
652
  setNodeAttr(e2, t2) {
652
653
  const n2 = this.workingDoc;
653
654
  if (!n2) throw new Error("setNodeAttr requires a document. Use state.transaction() or provide doc to constructor.");
654
- const s2 = Se(n2, e2);
655
+ const s2 = Ie(n2, e2);
655
656
  if (!s2) throw new Error(`Node not found at path [${e2.join(", ")}].`);
656
657
  const r2 = { type: "setNodeAttr", path: e2, attrs: t2, ...s2.attrs ? { previousAttrs: s2.attrs } : {} };
657
658
  return this.steps.push(r2), this.advanceDoc(r2), this;
@@ -663,34 +664,34 @@ class Ke {
663
664
  removeInlineNode(e2, t2) {
664
665
  const n2 = this.workingDoc;
665
666
  if (!n2) throw new Error("removeInlineNode requires a document. Use state.transaction() or provide doc.");
666
- const s2 = be(n2, e2);
667
+ const s2 = Ae(n2, e2);
667
668
  if (!s2) throw new Error(`Block "${e2}" not found in working document.`);
668
- const r2 = R(s2, t2);
669
+ const r2 = U(s2, t2);
669
670
  if (!r2 || "inline" !== r2.kind) throw new Error(`No InlineNode at offset ${t2} in block "${e2}".`);
670
671
  const o2 = { type: "removeInlineNode", blockId: e2, offset: t2, removedNode: r2.node };
671
672
  return this.steps.push(o2), this.advanceDoc(o2), this;
672
673
  }
673
- setInlineNodeAttr(t2, n2, s2) {
674
+ setInlineNodeAttr(e2, n2, s2) {
674
675
  const r2 = this.workingDoc;
675
676
  if (!r2) throw new Error("setInlineNodeAttr requires a document. Use state.transaction() or provide doc.");
676
- const o2 = be(r2, t2);
677
- if (!o2) throw new Error(`Block "${t2}" not found in working document.`);
678
- const i3 = e(o2);
679
- let a4 = 0;
680
- for (const e2 of i3) {
681
- if (d(e2) && a4 === n2) {
682
- const r3 = { type: "setInlineNodeAttr", blockId: t2, offset: n2, attrs: s2, previousAttrs: e2.attrs };
677
+ const o2 = Ae(r2, e2);
678
+ if (!o2) throw new Error(`Block "${e2}" not found in working document.`);
679
+ const i5 = t(o2);
680
+ let a18 = 0;
681
+ for (const t2 of i5) {
682
+ if (E(t2) && a18 === n2) {
683
+ const r3 = { type: "setInlineNodeAttr", blockId: e2, offset: n2, attrs: s2, previousAttrs: t2.attrs };
683
684
  return this.steps.push(r3), this.advanceDoc(r3), this;
684
685
  }
685
- a4 += d(e2) ? 1 : e2.text.length;
686
+ a18 += E(t2) ? 1 : t2.text.length;
686
687
  }
687
- throw new Error(`No InlineNode at offset ${n2} in block "${t2}".`);
688
+ throw new Error(`No InlineNode at offset ${n2} in block "${e2}".`);
688
689
  }
689
690
  setSelection(e2) {
690
691
  return this.selection = e2, this;
691
692
  }
692
693
  setNodeSelection(e2, t2) {
693
- return this.selection = H(e2, t2), this;
694
+ return this.selection = X(e2, t2), this;
694
695
  }
695
696
  setStoredMarks(e2, t2) {
696
697
  return this.steps.push({ type: "setStoredMarks", marks: e2, previousMarks: t2 }), this.storedMarks = e2, this;
@@ -699,10 +700,10 @@ class Ke {
699
700
  return { steps: [...this.steps], selectionBefore: this.selectionBefore, selectionAfter: this.selection, storedMarksAfter: this.storedMarks, metadata: { origin: this.origin, timestamp: Date.now() } };
700
701
  }
701
702
  advanceDoc(e2) {
702
- this.workingDoc && (this.workingDoc = Ae(this.workingDoc, e2));
703
+ this.workingDoc && (this.workingDoc = Ge(this.workingDoc, e2));
703
704
  }
704
705
  }
705
- class Ve {
706
+ class at {
706
707
  doc;
707
708
  selection;
708
709
  storedMarks;
@@ -713,31 +714,31 @@ class Ve {
713
714
  this.doc = e2, this.selection = t2, this.storedMarks = n2, this.schema = s2;
714
715
  }
715
716
  static create(e2) {
716
- const t2 = e2?.schema ?? X(), n2 = e2?.doc ?? P(), s2 = n2.children[0], r2 = e2?.selection ?? F(s2 ? s2.id : pe(""), 0);
717
- return new Ve(n2, r2, null, t2);
717
+ const t2 = e2?.schema ?? re(), n2 = e2?.doc ?? K(), s2 = n2.children[0], r2 = e2?.selection ?? J(s2 ? s2.id : Ee(""), 0);
718
+ return new at(n2, r2, null, t2);
718
719
  }
719
720
  transaction(e2 = "api") {
720
- return new Ke(this.selection, this.storedMarks, e2, this.doc);
721
+ return new it(this.selection, this.storedMarks, e2, this.doc);
721
722
  }
722
723
  apply(e2) {
723
724
  let t2 = this.doc;
724
- for (const n3 of e2.steps) t2 = Ae(t2, n3);
725
+ for (const n3 of e2.steps) t2 = Ge(t2, n3);
725
726
  const n2 = (function(e3, t3) {
726
- if ($(t3)) {
727
- if (be(e3, t3.nodeId)) return t3;
727
+ if (Q(t3)) {
728
+ if (Ae(e3, t3.nodeId)) return t3;
728
729
  const n4 = e3.children[0];
729
- return n4 ? F(n4.id, 0) : t3;
730
+ return n4 ? J(n4.id, 0) : t3;
730
731
  }
731
- const n3 = qe(e3, t3.anchor), s2 = qe(e3, t3.head);
732
- return n3 === t3.anchor && s2 === t3.head ? t3 : j(n3, s2);
732
+ const n3 = ct(e3, t3.anchor), s2 = ct(e3, t3.head);
733
+ return n3 === t3.anchor && s2 === t3.head ? t3 : Y(n3, s2);
733
734
  })(t2, e2.selectionAfter);
734
- return new Ve(t2, n2, e2.storedMarksAfter, this.schema);
735
+ return new at(t2, n2, e2.storedMarksAfter, this.schema);
735
736
  }
736
737
  getBlock(e2) {
737
738
  return this._blockMap ??= (function(e3) {
738
739
  const t2 = /* @__PURE__ */ new Map();
739
740
  return (function e4(n2) {
740
- for (const s2 of n2) l(s2) && (t2.set(s2.id, s2), e4(s2.children));
741
+ for (const s2 of n2) m(s2) && (t2.set(s2.id, s2), e4(s2.children));
741
742
  })(e3.children), t2;
742
743
  })(this.doc), this._blockMap.get(e2);
743
744
  }
@@ -745,36 +746,36 @@ class Ve {
745
746
  return this._blockOrder ??= (function(e2) {
746
747
  const t2 = [];
747
748
  return (function e3(n2) {
748
- for (const s2 of n2) l(s2) && (D(s2) ? t2.push(s2.id) : e3(s2.children));
749
+ for (const s2 of n2) m(s2) && (V(s2) ? t2.push(s2.id) : e3(s2.children));
749
750
  })(e2.children), t2;
750
751
  })(this.doc), this._blockOrder;
751
752
  }
752
753
  getNodePath(e2) {
753
- return ve(this.doc, e2);
754
+ return Me(this.doc, e2);
754
755
  }
755
756
  getParent(e2) {
756
- const t2 = ve(this.doc, e2);
757
+ const t2 = Me(this.doc, e2);
757
758
  if (!t2 || t2.length <= 1) return;
758
759
  const n2 = t2[t2.length - 2];
759
- return n2 ? be(this.doc, n2) : void 0;
760
+ return n2 ? Ae(this.doc, n2) : void 0;
760
761
  }
761
762
  toJSON() {
762
763
  return { doc: this.doc, selection: this.selection };
763
764
  }
764
765
  static fromJSON(e2, t2) {
765
- return new Ve(e2.doc, e2.selection, null, t2 ?? X());
766
+ return new at(e2.doc, e2.selection, null, t2 ?? re());
766
767
  }
767
768
  }
768
- function qe(e2, t2) {
769
- const n2 = be(e2, t2.blockId);
769
+ function ct(e2, t2) {
770
+ const n2 = Ae(e2, t2.blockId);
770
771
  if (n2) {
771
772
  const e3 = r(n2);
772
- return t2.offset > e3 ? U(t2.blockId, e3, t2.path) : t2;
773
+ return t2.offset > e3 ? Z(t2.blockId, e3, t2.path) : t2;
773
774
  }
774
775
  const s2 = e2.children[0];
775
- return s2 ? U(s2.id, 0) : t2;
776
+ return s2 ? Z(s2.id, 0) : t2;
776
777
  }
777
- class We {
778
+ class lt {
778
779
  undoStack = [];
779
780
  redoStack = [];
780
781
  groupTimeoutMs;
@@ -796,7 +797,7 @@ class We {
796
797
  for (let e3 = t2.transactions.length - 1; e3 >= 0; e3--) {
797
798
  const r2 = t2.transactions[e3];
798
799
  if (!r2) continue;
799
- const o2 = Ue(r2);
800
+ const o2 = ot(r2);
800
801
  n2 = n2.apply(o2), s2.push(...o2.steps);
801
802
  }
802
803
  return this.redoStack.push({ transactions: t2.transactions, timestamp: Date.now() }), this.lastOrigin = null, { state: n2, transaction: { steps: s2, selectionBefore: e2.selection, selectionAfter: n2.selection, storedMarksAfter: n2.storedMarks, metadata: { origin: "history", timestamp: Date.now(), historyDirection: "undo" } } };
@@ -825,7 +826,7 @@ class We {
825
826
  return s2 === r2;
826
827
  }
827
828
  }
828
- class Xe {
829
+ class ht {
829
830
  constructor(e2, t2) {
830
831
  this.element = e2, this.getState = t2.getState, this.dispatch = t2.dispatch, this.undo = t2.undo, this.redo = t2.redo, this.schemaRegistry = t2.schemaRegistry, this.handleKeydown = this.onKeydown.bind(this), e2.addEventListener("keydown", this.handleKeydown);
831
832
  }
@@ -838,8 +839,9 @@ class Xe {
838
839
  onKeydown(e2) {
839
840
  if (this.handleNodeSelectionKeys(e2)) return;
840
841
  if (this.handleArrowIntoVoid(e2)) return;
842
+ if ("false" === this.element.contentEditable) return void this.handleEscape(e2);
841
843
  if (this.schemaRegistry) {
842
- const t3 = Je(e2), n3 = this.schemaRegistry.getKeymaps();
844
+ const t3 = dt(e2), n3 = this.schemaRegistry.getKeymaps();
843
845
  for (let s3 = n3.length - 1; s3 >= 0; s3--) {
844
846
  const r2 = n3[s3]?.[t3];
845
847
  if (r2?.()) return void e2.preventDefault();
@@ -850,29 +852,31 @@ class Xe {
850
852
  if (!e2.metaKey && !e2.ctrlKey) return;
851
853
  const t2 = e2.key.toLowerCase(), n2 = this.getState();
852
854
  let s2 = null;
853
- return "z" !== t2 || e2.shiftKey ? "z" === t2 && e2.shiftKey || "y" === t2 && !e2.shiftKey ? (e2.preventDefault(), void this.redo()) : ("a" !== t2 || e2.shiftKey || (e2.preventDefault(), s2 = J(n2)), void (s2 && this.dispatch(s2))) : (e2.preventDefault(), void this.undo());
855
+ return "z" !== t2 || e2.shiftKey ? "z" === t2 && e2.shiftKey || "y" === t2 && !e2.shiftKey ? (e2.preventDefault(), void this.redo()) : ("a" !== t2 || e2.shiftKey || (e2.preventDefault(), s2 = oe(n2)), void (s2 && this.dispatch(s2))) : (e2.preventDefault(), void this.undo());
854
856
  }
855
857
  handleNodeSelectionKeys(e2) {
856
858
  const t2 = this.getState(), n2 = t2.selection;
857
- if (!$(n2)) return false;
859
+ if (!Q(n2)) return false;
858
860
  const s2 = e2.key;
859
861
  if (!("ArrowLeft" !== s2 && "ArrowUp" !== s2 && "ArrowRight" !== s2 && "ArrowDown" !== s2 || e2.shiftKey || e2.metaKey || e2.ctrlKey || e2.altKey)) {
860
- const n3 = Q(t2, "ArrowLeft" === s2 ? "left" : "ArrowRight" === s2 ? "right" : "ArrowUp" === s2 ? "up" : "down");
862
+ const n3 = ie(t2, "ArrowLeft" === s2 ? "left" : "ArrowRight" === s2 ? "right" : "ArrowUp" === s2 ? "up" : "down");
861
863
  return !!n3 && (e2.preventDefault(), this.dispatch(n3), true);
862
864
  }
863
865
  if ("Backspace" === s2 || "Delete" === s2) {
866
+ if ("false" === this.element.contentEditable) return true;
864
867
  e2.preventDefault();
865
- const s3 = G(t2, n2);
868
+ const s3 = ae(t2, n2);
866
869
  return s3 && this.dispatch(s3), true;
867
870
  }
868
871
  if ("Enter" === s2) {
872
+ if ("false" === this.element.contentEditable) return true;
869
873
  e2.preventDefault();
870
- const n3 = Y(t2);
874
+ const n3 = ce(t2);
871
875
  return n3 && this.dispatch(n3), true;
872
876
  }
873
877
  if ("Escape" === s2) {
874
878
  e2.preventDefault();
875
- const n3 = Q(t2, "right");
879
+ const n3 = ie(t2, "right");
876
880
  return n3 && this.dispatch(n3), true;
877
881
  }
878
882
  return false;
@@ -881,7 +885,7 @@ class Xe {
881
885
  if ("Tab" !== e2.key) return false;
882
886
  if (e2.metaKey || e2.ctrlKey || e2.altKey) return false;
883
887
  if (e2.preventDefault(), e2.shiftKey) return true;
884
- const t2 = this.getState(), n2 = Z(t2, " ");
888
+ const t2 = this.getState(), n2 = le(t2, " ");
885
889
  return this.dispatch(n2), true;
886
890
  }
887
891
  handleEscape(e2) {
@@ -891,21 +895,21 @@ class Xe {
891
895
  const t2 = e2.key;
892
896
  if ("ArrowLeft" !== t2 && "ArrowRight" !== t2 && "ArrowUp" !== t2 && "ArrowDown" !== t2) return false;
893
897
  if (e2.shiftKey || e2.metaKey || e2.ctrlKey || e2.altKey) return false;
894
- const n2 = this.getState(), s2 = Q(n2, "ArrowLeft" === t2 ? "left" : "ArrowRight" === t2 ? "right" : "ArrowUp" === t2 ? "up" : "down");
898
+ const n2 = this.getState(), s2 = ie(n2, "ArrowLeft" === t2 ? "left" : "ArrowRight" === t2 ? "right" : "ArrowUp" === t2 ? "up" : "down");
895
899
  return !!s2 && (e2.preventDefault(), this.dispatch(s2), true);
896
900
  }
897
901
  destroy() {
898
902
  this.element.removeEventListener("keydown", this.handleKeydown);
899
903
  }
900
904
  }
901
- function Je(e2) {
905
+ function dt(e2) {
902
906
  const t2 = [];
903
907
  (e2.metaKey || e2.ctrlKey) && t2.push("Mod"), e2.shiftKey && t2.push("Shift"), e2.altKey && t2.push("Alt");
904
908
  let n2 = e2.key;
905
909
  return " " === n2 ? n2 = "Space" : 1 === n2.length && (n2 = n2.toUpperCase()), t2.push(n2), t2.join("-");
906
910
  }
907
- let Qe;
908
- class Ge {
911
+ let ut;
912
+ class pt {
909
913
  constructor(e2, t2) {
910
914
  this.element = e2, this.getState = t2.getState, this.dispatch = t2.dispatch, this.schemaRegistry = t2.schemaRegistry, this.syncSelection = t2.syncSelection, this.handleCopy = this.onCopy.bind(this), this.handleCut = this.onCut.bind(this), e2.addEventListener("copy", this.handleCopy), e2.addEventListener("cut", this.handleCut);
911
915
  }
@@ -918,92 +922,93 @@ class Ge {
918
922
  onCopy(e2) {
919
923
  this.syncSelection?.();
920
924
  const t2 = this.getState(), n2 = t2.selection;
921
- if (K(n2) && V(n2)) return;
925
+ if (ee(n2) && te(n2)) return;
922
926
  e2.preventDefault();
923
927
  const s2 = e2.clipboardData;
924
- s2 && ($(n2) ? this.writeNodeSelectionToClipboard(s2, t2) : this.writeTextSelectionToClipboard(s2, t2));
928
+ s2 && (Q(n2) ? this.writeNodeSelectionToClipboard(s2, t2) : this.writeTextSelectionToClipboard(s2, t2));
925
929
  }
926
930
  onCut(e2) {
931
+ if ("false" === this.element.contentEditable) return;
927
932
  this.syncSelection?.();
928
933
  const t2 = this.getState(), n2 = t2.selection;
929
- if (K(n2) && V(n2)) return;
934
+ if (ee(n2) && te(n2)) return;
930
935
  e2.preventDefault();
931
936
  const s2 = e2.clipboardData;
932
- if (s2) if ($(n2)) {
937
+ if (s2) if (Q(n2)) {
933
938
  this.writeNodeSelectionToClipboard(s2, t2);
934
- const e3 = G(t2, n2);
939
+ const e3 = ae(t2, n2);
935
940
  e3 && this.dispatch(e3);
936
941
  } else {
937
942
  this.writeTextSelectionToClipboard(s2, t2);
938
- const e3 = ee(t2);
943
+ const e3 = he(t2);
939
944
  e3 && this.dispatch(e3);
940
945
  }
941
946
  }
942
947
  writeNodeSelectionToClipboard(e2, t2) {
943
948
  const n2 = t2.selection;
944
- if (!$(n2)) return;
949
+ if (!Q(n2)) return;
945
950
  const s2 = t2.getBlock(n2.nodeId);
946
951
  if (!s2) return;
947
952
  const r2 = { type: s2.type, ...s2.attrs ? { attrs: { ...s2.attrs } } : {} };
948
953
  e2.setData("application/x-notectl-block", JSON.stringify(r2));
949
954
  const o2 = this.schemaRegistry?.getNodeSpec(s2.type);
950
955
  o2?.toHTML && e2.setData("text/html", o2.toHTML(s2, ""));
951
- const i3 = s2.attrs, a4 = "string" == typeof i3?.alt ? i3.alt : "";
952
- e2.setData("text/plain", a4);
956
+ const i5 = s2.attrs, a18 = "string" == typeof i5?.alt ? i5.alt : "";
957
+ e2.setData("text/plain", a18);
953
958
  }
954
959
  writeTextSelectionToClipboard(e2, t2) {
955
960
  const n2 = t2.selection;
956
- if ($(n2)) return;
957
- if (V(n2)) return;
958
- const s2 = t2.getBlockOrder(), o2 = q(n2, s2), i3 = s2.indexOf(o2.from.blockId), a4 = s2.indexOf(o2.to.blockId), c3 = [], l2 = [];
959
- for (let e3 = i3; e3 <= a4; e3++) {
961
+ if (Q(n2)) return;
962
+ if (te(n2)) return;
963
+ const s2 = t2.getBlockOrder(), o2 = ne(n2, s2), i5 = s2.indexOf(o2.from.blockId), a18 = s2.indexOf(o2.to.blockId), c8 = [], l2 = [];
964
+ for (let e3 = i5; e3 <= a18; e3++) {
960
965
  const n3 = s2[e3];
961
966
  if (!n3) continue;
962
- const h4 = t2.getBlock(n3);
963
- if (!h4) continue;
964
- const d2 = M(h4), u2 = r(h4), p2 = e3 === i3 ? o2.from.offset : 0, f3 = e3 === a4 ? o2.to.offset : u2, g2 = d2.slice(p2, f3);
965
- c3.push(g2), l2.push({ type: h4.type, text: g2, ...h4.attrs ? { attrs: { ...h4.attrs } } : {} });
967
+ const h5 = t2.getBlock(n3);
968
+ if (!h5) continue;
969
+ const d4 = O(h5), u2 = r(h5), p2 = e3 === i5 ? o2.from.offset : 0, f4 = e3 === a18 ? o2.to.offset : u2, g2 = d4.slice(p2, f4);
970
+ c8.push(g2), l2.push({ type: h5.type, text: g2, ...h5.attrs ? { attrs: { ...h5.attrs } } : {} });
966
971
  }
967
- const h3 = c3.join("\n");
968
- if (e2.setData("text/plain", h3), this.schemaRegistry) {
972
+ const h4 = c8.join("\n");
973
+ if (e2.setData("text/plain", h4), this.schemaRegistry) {
969
974
  const n3 = [];
970
- for (let e3 = i3; e3 <= a4; e3++) {
971
- const c4 = s2[e3];
972
- if (!c4) continue;
973
- const l3 = t2.getBlock(c4);
975
+ for (let e3 = i5; e3 <= a18; e3++) {
976
+ const c9 = s2[e3];
977
+ if (!c9) continue;
978
+ const l3 = t2.getBlock(c9);
974
979
  if (!l3) continue;
975
- const h4 = e3 === i3 ? o2.from.offset : 0, d2 = e3 === a4 ? o2.to.offset : r(l3);
976
- n3.push(this.serializeBlockRangeToHTML(l3, h4, d2));
980
+ const h5 = e3 === i5 ? o2.from.offset : 0, d4 = e3 === a18 ? o2.to.offset : r(l3);
981
+ n3.push(this.serializeBlockRangeToHTML(l3, h5, d4));
977
982
  }
978
983
  e2.setData("text/html", n3.join(""));
979
984
  }
980
985
  !(function(e3, t3) {
981
- Qe = { plainText: e3, blocks: t3 };
982
- })(h3, l2);
983
- }
984
- serializeBlockRangeToHTML(t2, n2, s2) {
985
- const r2 = e(t2), o2 = [];
986
- let i3 = 0;
987
- for (const e2 of r2) {
988
- const t3 = i3 + (d(e2) ? 1 : e2.text.length);
989
- if (t3 <= n2 || i3 >= s2) i3 = t3;
986
+ ut = { plainText: e3, blocks: t3 };
987
+ })(h4, l2);
988
+ }
989
+ serializeBlockRangeToHTML(e2, n2, s2) {
990
+ const r2 = t(e2), o2 = [];
991
+ let i5 = 0;
992
+ for (const e3 of r2) {
993
+ const t2 = i5 + (E(e3) ? 1 : e3.text.length);
994
+ if (t2 <= n2 || i5 >= s2) i5 = t2;
990
995
  else {
991
- if (m(e2)) {
992
- const t4 = Math.max(0, n2 - i3), r3 = Math.min(e2.text.length, s2 - i3), a4 = e2.text.slice(t4, r3);
993
- a4.length > 0 && o2.push(this.serializeTextWithMarks(a4, e2.marks));
996
+ if (M(e3)) {
997
+ const t3 = Math.max(0, n2 - i5), r3 = Math.min(e3.text.length, s2 - i5), a18 = e3.text.slice(t3, r3);
998
+ a18.length > 0 && o2.push(this.serializeTextWithMarks(a18, e3.marks));
994
999
  }
995
- i3 = t3;
1000
+ i5 = t2;
996
1001
  }
997
1002
  }
998
1003
  return o2.join("");
999
1004
  }
1000
1005
  serializeTextWithMarks(e2, t2) {
1001
- if (0 === t2.length || !this.schemaRegistry) return ke(e2);
1006
+ if (0 === t2.length || !this.schemaRegistry) return Le(e2);
1002
1007
  const n2 = [...t2].sort((e3, t3) => {
1003
1008
  const n3 = this.schemaRegistry?.getMarkSpec(e3.type), s3 = this.schemaRegistry?.getMarkSpec(t3.type);
1004
1009
  return (n3?.rank ?? 100) - (s3?.rank ?? 100);
1005
1010
  });
1006
- let s2 = ke(e2);
1011
+ let s2 = Le(e2);
1007
1012
  for (const e3 of n2) {
1008
1013
  const t3 = this.schemaRegistry?.getMarkSpec(e3.type);
1009
1014
  t3?.toHTMLString && (s2 = t3.toHTMLString(e3, s2));
@@ -1014,7 +1019,7 @@ class Ge {
1014
1019
  this.element.removeEventListener("copy", this.handleCopy), this.element.removeEventListener("cut", this.handleCut);
1015
1020
  }
1016
1021
  }
1017
- class Ye {
1022
+ class ft {
1018
1023
  listeners = /* @__PURE__ */ new Map();
1019
1024
  emit(e2, t2) {
1020
1025
  const n2 = this.listeners.get(e2.id);
@@ -1040,19 +1045,23 @@ class Ye {
1040
1045
  this.listeners.clear();
1041
1046
  }
1042
1047
  }
1043
- class Ze {
1048
+ class gt {
1044
1049
  plugins = /* @__PURE__ */ new Map();
1045
1050
  commands = /* @__PURE__ */ new Map();
1046
1051
  services = /* @__PURE__ */ new Map();
1047
1052
  middlewares = [];
1048
1053
  registrations = /* @__PURE__ */ new Map();
1049
- eventBus = new Ye();
1054
+ eventBus = new ft();
1050
1055
  pluginStyleSheets = [];
1051
- schemaRegistry = new Me();
1056
+ schemaRegistry = new Ue();
1052
1057
  middlewareSorted = null;
1053
1058
  initOrder = [];
1054
1059
  initialized = false;
1055
1060
  initializing = false;
1061
+ registerService(e2, t2) {
1062
+ if (this.services.has(e2.id)) throw new Error(`Service "${e2.id}" is already registered.`);
1063
+ this.services.set(e2.id, t2);
1064
+ }
1056
1065
  register(e2) {
1057
1066
  if (this.initialized || this.initializing) throw new Error(`Cannot register plugin "${e2.id}" after initialization.`);
1058
1067
  if (this.plugins.has(e2.id)) throw new Error(`Plugin "${e2.id}" is already registered.`);
@@ -1094,7 +1103,7 @@ class Ze {
1094
1103
  }
1095
1104
  }
1096
1105
  collectDecorations(e2, t2) {
1097
- let n2 = we.empty;
1106
+ let n2 = De.empty;
1098
1107
  for (const s2 of this.initOrder) {
1099
1108
  const r2 = this.plugins.get(s2);
1100
1109
  if (r2?.decorations) try {
@@ -1110,22 +1119,22 @@ class Ze {
1110
1119
  if (0 === this.middlewares.length) return void n2(e2);
1111
1120
  const s2 = this.getSortedMiddleware();
1112
1121
  let r2 = 0, o2 = false;
1113
- const i3 = (e3) => {
1122
+ const i5 = (e3) => {
1114
1123
  if (r2 < s2.length) {
1115
1124
  const n3 = s2[r2++];
1116
1125
  if (!n3) return;
1117
1126
  let o3 = false;
1118
- const a4 = (e4) => {
1119
- o3 || (o3 = true, i3(e4));
1127
+ const a18 = (e4) => {
1128
+ o3 || (o3 = true, i5(e4));
1120
1129
  };
1121
1130
  try {
1122
- n3.middleware(e3, t2, a4);
1131
+ n3.middleware(e3, t2, a18);
1123
1132
  } catch (t3) {
1124
- console.error("[PluginManager] Middleware error:", t3), a4(e3);
1133
+ console.error("[PluginManager] Middleware error:", t3), a18(e3);
1125
1134
  }
1126
1135
  } else o2 || (o2 = true, n2(e3));
1127
1136
  };
1128
- i3(e2);
1137
+ i5(e2);
1129
1138
  }
1130
1139
  executeCommand(e2) {
1131
1140
  const t2 = this.commands.get(e2);
@@ -1154,6 +1163,9 @@ class Ze {
1154
1163
  getService(e2) {
1155
1164
  return this.services.get(e2.id);
1156
1165
  }
1166
+ onEvent(e2, t2) {
1167
+ return this.eventBus.on(e2, t2);
1168
+ }
1157
1169
  getPluginStyleSheets() {
1158
1170
  return this.pluginStyleSheets;
1159
1171
  }
@@ -1289,48 +1301,205 @@ class Ze {
1289
1301
  return r2;
1290
1302
  }
1291
1303
  }
1292
- const et = { Light: "light", Dark: "dark", System: "system" }, tt = { name: "light", primitives: { background: "#ffffff", foreground: "#1a1a1a", mutedForeground: "#666666", border: "#d0d0d0", borderFocus: "#4a90d9", primary: "#4a90d9", primaryForeground: "#1a5fa0", primaryMuted: "#d0e0f0", surfaceRaised: "#f8f8f8", surfaceOverlay: "#ffffff", hoverBackground: "#e8e8e8", activeBackground: "#d0e0f0", danger: "#dc2626", dangerMuted: "#fee2e2", success: "#1a8c1a", shadow: "rgba(0, 0, 0, 0.15)", focusRing: "rgba(74, 144, 217, 0.2)" }, codeBlock: { background: "#f8fafc", foreground: "#334155", headerBackground: "#f1f5f9", headerForeground: "#64748b", headerBorder: "#e2e8f0" }, tooltip: { background: "#1a1a1a", foreground: "#ffffff" } }, nt = { name: "dark", primitives: { background: "#1e1e2e", foreground: "#cdd6f4", mutedForeground: "#7f849c", border: "#45475a", borderFocus: "#89b4fa", primary: "#89b4fa", primaryForeground: "#89b4fa", primaryMuted: "rgba(137, 180, 250, 0.15)", surfaceRaised: "#313244", surfaceOverlay: "#313244", hoverBackground: "#45475a", activeBackground: "rgba(137, 180, 250, 0.15)", danger: "#f38ba8", dangerMuted: "rgba(243, 139, 168, 0.15)", success: "#a6e3a1", shadow: "rgba(0, 0, 0, 0.4)", focusRing: "rgba(137, 180, 250, 0.25)" }, codeBlock: { background: "#11111b", foreground: "#cdd6f4", headerBackground: "#181825", headerForeground: "#7f849c", headerBorder: "rgba(205, 214, 244, 0.08)" }, tooltip: { background: "#585b70", foreground: "#cdd6f4" } };
1293
- function st(e2, t2) {
1304
+ const mt = { label: "Print", tooltip: (e2) => `Print (${e2})`, printingAnnouncement: "Printing" }, yt = { en: mt, de: { label: "Drucken", tooltip: (e2) => `Drucken (${e2})`, printingAnnouncement: "Druckvorgang" }, es: { label: "Imprimir", tooltip: (e2) => `Imprimir (${e2})`, printingAnnouncement: "Imprimiendo" }, fr: { label: "Imprimer", tooltip: (e2) => `Imprimer (${e2})`, printingAnnouncement: "Impression" }, zh: { label: "打印", tooltip: (e2) => `打印 (${e2})`, printingAnnouncement: "正在打印" }, ru: { label: "Печать", tooltip: (e2) => `Печать (${e2})`, printingAnnouncement: "Печать" }, ar: { label: "طباعة", tooltip: (e2) => `طباعة (${e2})`, printingAnnouncement: "جارٍ الطباعة" }, hi: { label: "प्रिंट", tooltip: (e2) => `प्रिंट (${e2})`, printingAnnouncement: "प्रिंट हो रहा है" } };
1305
+ function kt(e2) {
1306
+ return "function" == typeof e2 ? e2() : e2;
1307
+ }
1308
+ const bt = 96 / 25.4, St = { DINA4: "din-a4", DINA5: "din-a5", USLetter: "us-letter", USLegal: "us-legal" };
1309
+ function vt(e2) {
1310
+ return Math.round(e2 * bt);
1311
+ }
1312
+ const wt = /* @__PURE__ */ new Map([[St.DINA4, { widthMm: 210, heightMm: 297, widthPx: vt(210), heightPx: vt(297) }], [St.DINA5, { widthMm: 148, heightMm: 210, widthPx: vt(148), heightPx: vt(210) }], [St.USLetter, { widthMm: 215.9, heightMm: 279.4, widthPx: vt(215.9), heightPx: vt(279.4) }], [St.USLegal, { widthMm: 215.9, heightMm: 355.6, widthPx: vt(215.9), heightPx: vt(355.6) }]]), Et = /* @__PURE__ */ new Map([[St.DINA4, "A4"], [St.DINA5, "A5"], [St.USLetter, "letter"], [St.USLegal, "legal"]]);
1313
+ function Tt(e2) {
1314
+ const t2 = wt.get(e2);
1315
+ if (!t2) throw new Error(`Unknown paper size: ${e2}`);
1316
+ return t2;
1317
+ }
1318
+ const xt = 48, Nt = 56, Ct = 24;
1319
+ function Lt(e2) {
1320
+ return Object.values(St).includes(e2);
1321
+ }
1322
+ function At(e2) {
1323
+ const t2 = Et.get(e2);
1324
+ if (!t2) throw new Error(`Unknown paper size: ${e2}`);
1325
+ return t2;
1326
+ }
1327
+ const It = new Pe("print"), Mt = new Be("print:before"), Bt = new Be("print:after"), Pt = { print() {
1328
+ }, toHTML: () => "" };
1329
+ class Rt {
1330
+ id = "print";
1331
+ name = "Print";
1332
+ config;
1333
+ service = null;
1334
+ locale;
1335
+ constructor(e2) {
1336
+ this.config = e2 ?? {};
1337
+ }
1338
+ init(e2) {
1339
+ this.locale = Re(yt, e2, this.config.locale);
1340
+ const t2 = e2.getContainer(), n2 = t2.getRootNode();
1341
+ if (n2 instanceof ShadowRoot) {
1342
+ const s3 = n2.host, r3 = e2.getEventBus();
1343
+ this.service = /* @__PURE__ */ (function(e3, t3, n3, s4) {
1344
+ function r4(e4) {
1345
+ return e4 ?? {};
1346
+ }
1347
+ function o3(r5) {
1348
+ const o4 = { options: r5, cancelled: false };
1349
+ if (s4.emit(Mt, o4), o4.cancelled) return null;
1350
+ const i6 = o4.options, a18 = (function(e4, t4, n4, s5 = "en") {
1351
+ return ["<!DOCTYPE html>", `<html lang="${s5}">`, "<head>", '<meta charset="utf-8">', `<title>${n4.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")}</title>`, `<style>${e4}</style>`, "</head>", `<body>${t4}</body>`, "</html>"].join("\n");
1352
+ })((function(e4, t4, n4) {
1353
+ const s5 = [], r6 = (function(e5) {
1354
+ const t5 = [];
1355
+ for (const n5 of e5.adoptedStyleSheets) for (const e6 of n5.cssRules) t5.push(e6.cssText);
1356
+ return t5.join("\n");
1357
+ })(e4);
1358
+ r6 && s5.push(r6);
1359
+ const o5 = (function(e5) {
1360
+ const t5 = getComputedStyle(e5), n5 = [];
1361
+ for (let e6 = 0; e6 < t5.length; e6++) {
1362
+ const s6 = t5[e6] ?? "";
1363
+ if (s6.startsWith("--notectl-")) {
1364
+ const e7 = t5.getPropertyValue(s6).trim();
1365
+ e7 && n5.push(` ${s6}: ${e7};`);
1366
+ }
1367
+ }
1368
+ return 0 === n5.length ? "" : `:root {
1369
+ ${n5.join("\n")}
1370
+ }`;
1371
+ })(t4);
1372
+ o5 && s5.push(o5), n4.paperSize && s5.push((function(e5) {
1373
+ const t5 = getComputedStyle(e5), n5 = ["font-family", "font-size", "font-weight", "line-height", "letter-spacing", "word-spacing", "color"], s6 = [" margin: 0;"];
1374
+ for (const e6 of n5) {
1375
+ const n6 = t5.getPropertyValue(e6).trim();
1376
+ n6 && s6.push(` ${e6}: ${n6};`);
1377
+ }
1378
+ return `body {
1379
+ ${s6.join("\n")}
1380
+ }`;
1381
+ })(t4));
1382
+ const i7 = (function(e5) {
1383
+ const t5 = [], n5 = [];
1384
+ if (e5.margin ? n5.push(` margin: ${e5.margin};`) : e5.paperSize && n5.push(" margin: 0;"), e5.paperSize || e5.orientation) {
1385
+ const t6 = [e5.paperSize ? At(e5.paperSize) : "A4"];
1386
+ e5.orientation && t6.push(e5.orientation), n5.push(` size: ${t6.join(" ")};`);
1387
+ }
1388
+ n5.length > 0 && t5.push(`@page {
1389
+ ${n5.join("\n")}
1390
+ }`), e5.paperSize && t5.push(".notectl-content { padding: 48px 56px !important; }");
1391
+ const s6 = [];
1392
+ return s6.push("[data-notectl-no-print] { display: none !important; }"), s6.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"), s6.push("img { page-break-inside: avoid; }"), s6.push(".notectl-table { break-inside: avoid; }"), e5.printBackground && s6.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"), t5.push(`@media print {
1393
+ ${s6.join("\n ")}
1394
+ }`), t5.join("\n\n");
1395
+ })(n4);
1396
+ return i7 && s5.push(i7), n4.customCSS && s5.push(n4.customCSS), s5.join("\n\n");
1397
+ })(e3, t3, i6), (function(e4, t4) {
1398
+ const n4 = (function(e5) {
1399
+ return (e5.querySelector(".notectl-content") ?? e5).cloneNode(true);
1400
+ })(e4);
1401
+ return (function(e5) {
1402
+ e5.removeAttribute("contenteditable");
1403
+ const t5 = ["notectl-node-selected", "notectl-content--empty"];
1404
+ for (const n5 of t5) {
1405
+ e5.classList.remove(n5);
1406
+ for (const t6 of e5.querySelectorAll(`.${n5}`)) t6.classList.remove(n5);
1407
+ }
1408
+ e5.removeAttribute("data-placeholder");
1409
+ })(n4), (function(e5, t5) {
1410
+ if (t5.excludeBlockTypes) for (const n5 of t5.excludeBlockTypes) {
1411
+ const t6 = e5.querySelectorAll(`[data-block-type="${n5}"]`);
1412
+ for (const e6 of t6) e6.remove();
1413
+ }
1414
+ if (t5.pageBreakBefore) for (const n5 of t5.pageBreakBefore) {
1415
+ const t6 = e5.querySelectorAll(`[data-block-type="${n5}"]`);
1416
+ for (const e6 of t6) e6.style.breakBefore = "page", e6.style.pageBreakBefore = "always";
1417
+ }
1418
+ })(n4, t4), (function(e5, t5) {
1419
+ if (t5.header) {
1420
+ const n5 = document.createElement("div");
1421
+ n5.className = "notectl-print-header", n5.innerHTML = kt(t5.header), e5.insertBefore(n5, e5.firstChild);
1422
+ }
1423
+ if (t5.footer) {
1424
+ const n5 = document.createElement("div");
1425
+ n5.className = "notectl-print-footer", n5.innerHTML = kt(t5.footer), e5.appendChild(n5);
1426
+ }
1427
+ })(n4, t4), n4;
1428
+ })(n3, i6).outerHTML, i6.title ?? "", t3.closest("[lang]")?.getAttribute("lang") ?? (document.documentElement.lang || "en")), c8 = { html: a18 };
1429
+ return s4.emit(Bt, c8), a18;
1430
+ }
1431
+ return { print(e4) {
1432
+ const t4 = o3(r4(e4));
1433
+ if (!t4) return;
1434
+ const n4 = document.createElement("iframe");
1435
+ n4.style.cssText = "position:fixed;left:-9999px;width:0;height:0;border:none;", document.body.appendChild(n4);
1436
+ const s5 = n4.contentDocument;
1437
+ if (!s5) return void document.body.removeChild(n4);
1438
+ s5.open(), s5.write(t4), s5.close();
1439
+ const i6 = () => {
1440
+ n4.remove();
1441
+ };
1442
+ n4.contentWindow ? (n4.contentWindow.addEventListener("afterprint", i6, { once: true }), n4.contentWindow.print()) : i6();
1443
+ }, toHTML: (e4) => o3(r4(e4)) ?? "" };
1444
+ })(n2, s3, t2, r3);
1445
+ } else this.service = Pt;
1446
+ e2.registerService(It, this.service);
1447
+ const s2 = this.config.defaults ?? {}, r2 = this.service, o2 = this.locale;
1448
+ e2.registerCommand("print", () => (e2.announce(o2.printingAnnouncement), r2.print(s2), true));
1449
+ const i5 = this.config.keyBinding ?? "Mod-P";
1450
+ if (e2.registerKeymap({ [i5]: () => (e2.executeCommand("print"), true) }), false !== this.config.showToolbarItem) {
1451
+ const t3 = $e(i5);
1452
+ e2.registerToolbarItem({ id: "print", group: "actions", label: this.locale.label, tooltip: this.locale.tooltip(t3), icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>', command: "print", priority: 900 });
1453
+ }
1454
+ }
1455
+ destroy() {
1456
+ this.service = null;
1457
+ }
1458
+ }
1459
+ const _t = { Light: "light", Dark: "dark", System: "system" }, Ot = { name: "light", primitives: { background: "#ffffff", foreground: "#1a1a1a", mutedForeground: "#666666", border: "#d0d0d0", borderFocus: "#4a90d9", primary: "#4a90d9", primaryForeground: "#1a5fa0", primaryMuted: "#d0e0f0", surfaceRaised: "#f8f8f8", surfaceOverlay: "#ffffff", hoverBackground: "#e8e8e8", activeBackground: "#d0e0f0", danger: "#dc2626", dangerMuted: "#fee2e2", success: "#1a8c1a", shadow: "rgba(0, 0, 0, 0.15)", focusRing: "rgba(74, 144, 217, 0.2)" }, codeBlock: { background: "#f8fafc", foreground: "#334155", headerBackground: "#f1f5f9", headerForeground: "#64748b", headerBorder: "#e2e8f0" }, tooltip: { background: "#1a1a1a", foreground: "#ffffff" } }, Dt = { name: "dark", primitives: { background: "#1e1e2e", foreground: "#cdd6f4", mutedForeground: "#7f849c", border: "#45475a", borderFocus: "#89b4fa", primary: "#89b4fa", primaryForeground: "#89b4fa", primaryMuted: "rgba(137, 180, 250, 0.15)", surfaceRaised: "#313244", surfaceOverlay: "#313244", hoverBackground: "#45475a", activeBackground: "rgba(137, 180, 250, 0.15)", danger: "#f38ba8", dangerMuted: "rgba(243, 139, 168, 0.15)", success: "#a6e3a1", shadow: "rgba(0, 0, 0, 0.4)", focusRing: "rgba(137, 180, 250, 0.25)" }, codeBlock: { background: "#11111b", foreground: "#cdd6f4", headerBackground: "#181825", headerForeground: "#7f849c", headerBorder: "rgba(205, 214, 244, 0.08)" }, tooltip: { background: "#585b70", foreground: "#cdd6f4" } };
1460
+ function Ht(e2, t2) {
1294
1461
  return { name: t2.name, primitives: { ...e2.primitives, ...t2.primitives }, toolbar: t2.toolbar ? { ...e2.toolbar, ...t2.toolbar } : e2.toolbar, codeBlock: t2.codeBlock ? { ...e2.codeBlock, ...t2.codeBlock } : e2.codeBlock, tooltip: t2.tooltip ? { ...e2.tooltip, ...t2.tooltip } : e2.tooltip };
1295
1462
  }
1296
- function rt(e2) {
1463
+ function zt(e2) {
1297
1464
  if ("object" == typeof e2) return e2;
1298
1465
  switch (e2) {
1299
- case et.Light:
1300
- return tt;
1301
- case et.Dark:
1302
- return nt;
1466
+ case _t.Light:
1467
+ return Ot;
1468
+ case _t.Dark:
1469
+ return Dt;
1303
1470
  default:
1304
- return tt;
1471
+ return Ot;
1305
1472
  }
1306
1473
  }
1307
- const ot = [["primitives.background", "--notectl-bg"], ["primitives.foreground", "--notectl-fg"], ["primitives.mutedForeground", "--notectl-fg-muted"], ["primitives.border", "--notectl-border"], ["primitives.borderFocus", "--notectl-border-focus"], ["primitives.primary", "--notectl-primary"], ["primitives.primaryForeground", "--notectl-primary-fg"], ["primitives.primaryMuted", "--notectl-primary-muted"], ["primitives.surfaceRaised", "--notectl-surface-raised"], ["primitives.surfaceOverlay", "--notectl-surface-overlay"], ["primitives.hoverBackground", "--notectl-hover-bg"], ["primitives.activeBackground", "--notectl-active-bg"], ["primitives.danger", "--notectl-danger"], ["primitives.dangerMuted", "--notectl-danger-muted"], ["primitives.success", "--notectl-success"], ["primitives.shadow", "--notectl-shadow"], ["primitives.focusRing", "--notectl-focus-ring"], ["toolbar.background", "--notectl-toolbar-bg"], ["toolbar.borderColor", "--notectl-toolbar-border"], ["codeBlock.background", "--notectl-code-block-bg"], ["codeBlock.foreground", "--notectl-code-block-color"], ["codeBlock.headerBackground", "--notectl-code-block-header-bg"], ["codeBlock.headerForeground", "--notectl-code-block-header-color"], ["codeBlock.headerBorder", "--notectl-code-block-header-border"], ["tooltip.background", "--notectl-tooltip-bg"], ["tooltip.foreground", "--notectl-tooltip-fg"]], it = /* @__PURE__ */ new Map([["--notectl-toolbar-bg", "var(--notectl-surface-raised)"], ["--notectl-toolbar-border", "var(--notectl-border)"], ["--notectl-code-block-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-color", "var(--notectl-fg)"], ["--notectl-code-block-header-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-header-color", "var(--notectl-fg-muted)"], ["--notectl-code-block-header-border", "var(--notectl-border)"], ["--notectl-tooltip-bg", "var(--notectl-fg)"], ["--notectl-tooltip-fg", "var(--notectl-bg)"]]);
1308
- function at(e2, t2) {
1474
+ const $t = [["primitives.background", "--notectl-bg"], ["primitives.foreground", "--notectl-fg"], ["primitives.mutedForeground", "--notectl-fg-muted"], ["primitives.border", "--notectl-border"], ["primitives.borderFocus", "--notectl-border-focus"], ["primitives.primary", "--notectl-primary"], ["primitives.primaryForeground", "--notectl-primary-fg"], ["primitives.primaryMuted", "--notectl-primary-muted"], ["primitives.surfaceRaised", "--notectl-surface-raised"], ["primitives.surfaceOverlay", "--notectl-surface-overlay"], ["primitives.hoverBackground", "--notectl-hover-bg"], ["primitives.activeBackground", "--notectl-active-bg"], ["primitives.danger", "--notectl-danger"], ["primitives.dangerMuted", "--notectl-danger-muted"], ["primitives.success", "--notectl-success"], ["primitives.shadow", "--notectl-shadow"], ["primitives.focusRing", "--notectl-focus-ring"], ["toolbar.background", "--notectl-toolbar-bg"], ["toolbar.borderColor", "--notectl-toolbar-border"], ["codeBlock.background", "--notectl-code-block-bg"], ["codeBlock.foreground", "--notectl-code-block-color"], ["codeBlock.headerBackground", "--notectl-code-block-header-bg"], ["codeBlock.headerForeground", "--notectl-code-block-header-color"], ["codeBlock.headerBorder", "--notectl-code-block-header-border"], ["tooltip.background", "--notectl-tooltip-bg"], ["tooltip.foreground", "--notectl-tooltip-fg"]], jt = /* @__PURE__ */ new Map([["--notectl-toolbar-bg", "var(--notectl-surface-raised)"], ["--notectl-toolbar-border", "var(--notectl-border)"], ["--notectl-code-block-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-color", "var(--notectl-fg)"], ["--notectl-code-block-header-bg", "var(--notectl-surface-raised)"], ["--notectl-code-block-header-color", "var(--notectl-fg-muted)"], ["--notectl-code-block-header-border", "var(--notectl-border)"], ["--notectl-tooltip-bg", "var(--notectl-fg)"], ["--notectl-tooltip-fg", "var(--notectl-bg)"]]);
1475
+ function Ft(e2, t2) {
1309
1476
  const n2 = t2.split(".");
1310
1477
  let s2 = e2;
1311
1478
  for (const e3 of n2) {
1312
1479
  if (null == s2) return;
1480
+ if ("object" != typeof s2) return;
1313
1481
  s2 = s2[e3];
1314
1482
  }
1315
1483
  return "string" == typeof s2 ? s2 : void 0;
1316
1484
  }
1317
- function ct(e2) {
1485
+ function Ut(e2) {
1318
1486
  const t2 = [":host {"];
1319
- for (const [n2, s2] of ot) {
1320
- const r2 = at(e2, n2);
1487
+ for (const [n2, s2] of $t) {
1488
+ const r2 = Ft(e2, n2);
1321
1489
  if (void 0 !== r2) t2.push(` ${s2}: ${r2};`);
1322
1490
  else {
1323
- const e3 = it.get(s2);
1491
+ const e3 = jt.get(s2);
1324
1492
  e3 && t2.push(` ${s2}: ${e3};`);
1325
1493
  }
1326
1494
  }
1327
1495
  return t2.push("}"), t2.join("\n");
1328
1496
  }
1329
- function lt(e2) {
1497
+ function Kt(e2) {
1330
1498
  const t2 = new CSSStyleSheet();
1331
- return t2.replaceSync(ct(e2)), t2;
1499
+ return t2.replaceSync(Ut(e2)), t2;
1332
1500
  }
1333
- class ht {
1501
+ const Vt = { EN: "en", DE: "de", ES: "es", FR: "fr", ZH: "zh", RU: "ru", AR: "ar", HI: "hi", BROWSER: "browser" };
1502
+ class qt {
1334
1503
  constructor(e2, t2) {
1335
1504
  this.element = e2, this.getState = t2.getState, this.dispatch = t2.dispatch, this.syncSelection = t2.syncSelection, this.schemaRegistry = t2.schemaRegistry, this.handleBeforeInput = this.onBeforeInput.bind(this), this.handleCompositionStart = this.onCompositionStart.bind(this), this.handleCompositionEnd = this.onCompositionEnd.bind(this), e2.addEventListener("beforeinput", this.handleBeforeInput), e2.addEventListener("compositionstart", this.handleCompositionStart), e2.addEventListener("compositionend", this.handleCompositionEnd);
1336
1505
  }
@@ -1343,38 +1512,39 @@ class ht {
1343
1512
  handleCompositionStart;
1344
1513
  handleCompositionEnd;
1345
1514
  onBeforeInput(e2) {
1515
+ if ("false" === this.element.contentEditable) return;
1346
1516
  if (this.composing && "insertCompositionText" === e2.inputType) return;
1347
1517
  e2.preventDefault(), "insertText" !== e2.inputType && "insertCompositionText" !== e2.inputType && this.syncSelection();
1348
1518
  const t2 = this.getState();
1349
1519
  let n2 = null;
1350
1520
  switch (e2.inputType) {
1351
1521
  case "insertText":
1352
- e2.data && (n2 = Z(t2, e2.data, "input"));
1522
+ e2.data && (n2 = le(t2, e2.data, "input"));
1353
1523
  break;
1354
1524
  case "insertParagraph":
1355
- n2 = Y(t2);
1525
+ n2 = ce(t2);
1356
1526
  break;
1357
1527
  case "insertLineBreak":
1358
- n2 = ae(t2);
1528
+ n2 = ye(t2);
1359
1529
  break;
1360
1530
  case "deleteContentBackward":
1361
1531
  case "deleteByCut":
1362
- n2 = te(t2);
1532
+ n2 = de(t2);
1363
1533
  break;
1364
1534
  case "deleteContentForward":
1365
- n2 = ie(t2);
1535
+ n2 = me(t2);
1366
1536
  break;
1367
1537
  case "deleteWordBackward":
1368
- n2 = oe(t2);
1538
+ n2 = ge(t2);
1369
1539
  break;
1370
1540
  case "deleteWordForward":
1371
- n2 = re(t2);
1541
+ n2 = fe(t2);
1372
1542
  break;
1373
1543
  case "deleteSoftLineBackward":
1374
- n2 = se(t2);
1544
+ n2 = pe(t2);
1375
1545
  break;
1376
1546
  case "deleteSoftLineForward":
1377
- n2 = ne(t2);
1547
+ n2 = ue(t2);
1378
1548
  }
1379
1549
  n2 && (this.dispatch(n2), "insertText" === e2.inputType && this.checkInputRules());
1380
1550
  }
@@ -1382,10 +1552,10 @@ class ht {
1382
1552
  this.composing = true;
1383
1553
  }
1384
1554
  onCompositionEnd(e2) {
1385
- this.composing = false;
1555
+ if (this.composing = false, "false" === this.element.contentEditable) return;
1386
1556
  const t2 = e2.data;
1387
1557
  if (!t2) return;
1388
- const n2 = this.getState(), s2 = Z(n2, t2, "input");
1558
+ const n2 = this.getState(), s2 = le(n2, t2, "input");
1389
1559
  this.dispatch(s2);
1390
1560
  }
1391
1561
  checkInputRules() {
@@ -1393,10 +1563,10 @@ class ht {
1393
1563
  const e2 = this.schemaRegistry.getInputRules();
1394
1564
  if (0 === e2.length) return;
1395
1565
  const t2 = this.getState();
1396
- if ($(t2.selection)) return;
1566
+ if (Q(t2.selection)) return;
1397
1567
  const { anchor: n2 } = t2.selection, s2 = t2.getBlock(n2.blockId);
1398
1568
  if (!s2) return;
1399
- const r2 = M(s2).slice(0, n2.offset);
1569
+ const r2 = O(s2).slice(0, n2.offset);
1400
1570
  for (const n3 of e2) {
1401
1571
  const e3 = n3.pattern.exec(r2);
1402
1572
  if (e3) {
@@ -1409,14 +1579,14 @@ class ht {
1409
1579
  this.element.removeEventListener("beforeinput", this.handleBeforeInput), this.element.removeEventListener("compositionstart", this.handleCompositionStart), this.element.removeEventListener("compositionend", this.handleCompositionEnd);
1410
1580
  }
1411
1581
  }
1412
- function dt(e2) {
1582
+ function Wt(e2) {
1413
1583
  return e2.reduce((e3, t2) => e3 + t2.text, "");
1414
1584
  }
1415
- function ut(e2) {
1585
+ function Gt(e2) {
1416
1586
  return e2.reduce((e3, t2) => e3 + t2.text.length, 0);
1417
1587
  }
1418
- const pt = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "BLOCKQUOTE", "UL", "OL", "LI", "HR", "PRE", "TABLE", "THEAD", "TBODY", "TR"]), ft = /* @__PURE__ */ new Set(["STRONG", "B", "EM", "I", "U", "S", "STRIKE", "DEL", "A", "SPAN", "BR", "SUB", "SUP", "CODE"]);
1419
- class gt {
1588
+ const Xt = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "BLOCKQUOTE", "UL", "OL", "LI", "HR", "PRE", "TABLE", "THEAD", "TBODY", "TR"]), Jt = /* @__PURE__ */ new Set(["STRONG", "B", "EM", "I", "U", "S", "STRIKE", "DEL", "A", "SPAN", "BR", "SUB", "SUP", "CODE"]);
1589
+ class Qt {
1420
1590
  schema;
1421
1591
  blockParseRules;
1422
1592
  markParseRules;
@@ -1425,7 +1595,7 @@ class gt {
1425
1595
  }
1426
1596
  parse(e2) {
1427
1597
  const t2 = this.parseContainer(e2);
1428
- return 0 === t2.length ? { blocks: [{ type: this.resolveBlockType(fe("paragraph")), segments: [{ text: "", marks: [] }] }] } : { blocks: t2 };
1598
+ return 0 === t2.length ? { blocks: [{ type: this.resolveBlockType(Te("paragraph")), segments: [{ text: "", marks: [] }] }] } : { blocks: t2 };
1429
1599
  }
1430
1600
  parseContainer(e2) {
1431
1601
  const t2 = [];
@@ -1442,13 +1612,13 @@ class gt {
1442
1612
  parseBlockElement(e2) {
1443
1613
  const t2 = e2.tagName, n2 = /^H([1-6])$/.exec(t2);
1444
1614
  if (n2) {
1445
- const t3 = Number(n2[1]), s2 = this.resolveBlockType(fe("heading"));
1446
- return [{ type: s2, ...s2 === fe("heading") ? { attrs: { level: t3 } } : {}, segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1615
+ const t3 = Number(n2[1]), s2 = this.resolveBlockType(Te("heading"));
1616
+ return [{ type: s2, ...s2 === Te("heading") ? { attrs: { level: t3 } } : {}, segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1447
1617
  }
1448
1618
  switch (t2) {
1449
1619
  case "P":
1450
1620
  case "DIV":
1451
- return [{ type: this.resolveBlockType(fe("paragraph")), segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1621
+ return [{ type: this.resolveBlockType(Te("paragraph")), segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1452
1622
  case "BLOCKQUOTE":
1453
1623
  return this.parseBlockquote(e2);
1454
1624
  case "UL":
@@ -1458,9 +1628,9 @@ class gt {
1458
1628
  case "LI":
1459
1629
  return this.parseListItem(e2, "bullet", 0);
1460
1630
  case "HR":
1461
- return [{ type: this.resolveBlockType(fe("horizontal_rule")), segments: [] }];
1631
+ return [{ type: this.resolveBlockType(Te("horizontal_rule")), segments: [] }];
1462
1632
  case "PRE":
1463
- return [{ type: this.resolveBlockType(fe("paragraph")), segments: this.ensureSegments(this.parsePreContent(e2)) }];
1633
+ return [{ type: this.resolveBlockType(Te("paragraph")), segments: this.ensureSegments(this.parsePreContent(e2)) }];
1464
1634
  case "TABLE":
1465
1635
  case "THEAD":
1466
1636
  case "TBODY":
@@ -1468,12 +1638,12 @@ class gt {
1468
1638
  return this.parseTableAsParagraphs(e2);
1469
1639
  default: {
1470
1640
  const t3 = this.matchBlockRule(e2);
1471
- return t3 ? [{ type: t3.type, ...t3.attrs ? { attrs: t3.attrs } : {}, segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }] : [{ type: this.resolveBlockType(fe("paragraph")), segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1641
+ return t3 ? [{ type: t3.type, ...t3.attrs ? { attrs: t3.attrs } : {}, segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }] : [{ type: this.resolveBlockType(Te("paragraph")), segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1472
1642
  }
1473
1643
  }
1474
1644
  }
1475
1645
  parseBlockquote(e2) {
1476
- const t2 = this.resolveBlockType(fe("blockquote"));
1646
+ const t2 = this.resolveBlockType(Te("blockquote"));
1477
1647
  return Array.from(e2.childNodes).some((e3) => e3.nodeType === Node.ELEMENT_NODE && this.isBlockElement(e3)) ? this.parseContainer(e2).map((e3) => ({ type: t2, segments: e3.segments })) : [{ type: t2, segments: this.ensureSegments(this.parseInlineChildren(e2, [])) }];
1478
1648
  }
1479
1649
  parseList(e2, t2, n2) {
@@ -1485,15 +1655,15 @@ class gt {
1485
1655
  return s2;
1486
1656
  }
1487
1657
  parseListItem(e2, t2, n2) {
1488
- const s2 = [], r2 = this.resolveBlockType(fe("list_item")), o2 = this.hasCheckbox(e2), i3 = o2 ? "checklist" : t2, a4 = !!o2 && this.isCheckboxChecked(e2), c3 = [], l2 = [];
1658
+ const s2 = [], r2 = this.resolveBlockType(Te("list_item")), o2 = this.hasCheckbox(e2), i5 = o2 ? "checklist" : t2, a18 = !!o2 && this.isCheckboxChecked(e2), c8 = [], l2 = [];
1489
1659
  for (const t3 of Array.from(e2.childNodes)) if (t3.nodeType === Node.ELEMENT_NODE) {
1490
1660
  const e3 = t3;
1491
- "UL" === e3.tagName || "OL" === e3.tagName ? l2.push(e3) : "INPUT" === e3.tagName && "checkbox" === e3.getAttribute("type") || (this.isBlockElement(e3) ? c3.push(...this.parseInlineChildren(e3, [])) : c3.push(...this.parseInlineNode(t3, [])));
1661
+ "UL" === e3.tagName || "OL" === e3.tagName ? l2.push(e3) : "INPUT" === e3.tagName && "checkbox" === e3.getAttribute("type") || (this.isBlockElement(e3) ? c8.push(...this.parseInlineChildren(e3, [])) : c8.push(...this.parseInlineNode(t3, [])));
1492
1662
  } else if (t3.nodeType === Node.TEXT_NODE) {
1493
1663
  const e3 = t3.textContent ?? "";
1494
- e3 && c3.push({ text: e3, marks: [] });
1664
+ e3 && c8.push({ text: e3, marks: [] });
1495
1665
  }
1496
- s2.push({ type: r2, attrs: { listType: i3, indent: n2, ..."checklist" === i3 ? { checked: a4 } : {} }, segments: this.ensureSegments(this.normalizeSegments(c3)) });
1666
+ s2.push({ type: r2, attrs: { listType: i5, indent: n2, ..."checklist" === i5 ? { checked: a18 } : {} }, segments: this.ensureSegments(this.normalizeSegments(c8)) });
1497
1667
  for (const e3 of l2) {
1498
1668
  const t3 = "OL" === e3.tagName ? "ordered" : "bullet";
1499
1669
  s2.push(...this.parseList(e3, t3, n2 + 1));
@@ -1513,7 +1683,7 @@ class gt {
1513
1683
  if (e2.nodeType !== Node.ELEMENT_NODE) return [];
1514
1684
  const n2 = e2, s2 = n2.tagName;
1515
1685
  if ("BR" === s2) return [{ text: "\n", marks: this.resolveMarks(t2) }];
1516
- if (this.isBlockElement(n2) && !ft.has(s2)) return this.parseInlineChildren(n2, t2);
1686
+ if (this.isBlockElement(n2) && !Jt.has(s2)) return this.parseInlineChildren(n2, t2);
1517
1687
  const r2 = this.mergeMarks(t2, this.marksFromElement(n2));
1518
1688
  return this.parseInlineChildren(n2, r2);
1519
1689
  }
@@ -1525,7 +1695,7 @@ class gt {
1525
1695
  const t2 = [], n2 = e2.querySelectorAll("td, th");
1526
1696
  for (const e3 of Array.from(n2)) {
1527
1697
  const n3 = this.parseInlineChildren(e3, []);
1528
- n3.length > 0 && n3.some((e4) => e4.text.length > 0) && t2.push({ type: this.resolveBlockType(fe("paragraph")), segments: this.ensureSegments(n3) });
1698
+ n3.length > 0 && n3.some((e4) => e4.text.length > 0) && t2.push({ type: this.resolveBlockType(Te("paragraph")), segments: this.ensureSegments(n3) });
1529
1699
  }
1530
1700
  return t2;
1531
1701
  }
@@ -1536,14 +1706,14 @@ class gt {
1536
1706
  for (const r2 of this.markParseRules) if (r2.rule.tag === n2 && !s3.has(r2.type)) if (r2.rule.getAttrs) {
1537
1707
  const n3 = r2.rule.getAttrs(e2);
1538
1708
  if (false === n3) continue;
1539
- t2.push({ type: ge(r2.type), ...Object.keys(n3).length > 0 ? { attrs: n3 } : {} }), s3.add(r2.type);
1540
- } else t2.push({ type: ge(r2.type) }), s3.add(r2.type);
1709
+ t2.push({ type: xe(r2.type), ...Object.keys(n3).length > 0 ? { attrs: n3 } : {} }), s3.add(r2.type);
1710
+ } else t2.push({ type: xe(r2.type) }), s3.add(r2.type);
1541
1711
  if (s3.size > 0) return t2;
1542
1712
  }
1543
1713
  const s2 = e2.tagName;
1544
- if ("STRONG" !== s2 && "B" !== s2 || t2.push({ type: ge("bold") }), "EM" !== s2 && "I" !== s2 || t2.push({ type: ge("italic") }), "U" === s2 && t2.push({ type: ge("underline") }), "S" !== s2 && "STRIKE" !== s2 && "DEL" !== s2 || t2.push({ type: ge("strikethrough") }), "A" === s2) {
1714
+ if ("STRONG" !== s2 && "B" !== s2 || t2.push({ type: xe("bold") }), "EM" !== s2 && "I" !== s2 || t2.push({ type: xe("italic") }), "U" === s2 && t2.push({ type: xe("underline") }), "S" !== s2 && "STRIKE" !== s2 && "DEL" !== s2 || t2.push({ type: xe("strikethrough") }), "A" === s2) {
1545
1715
  const n3 = e2.getAttribute("href") ?? "";
1546
- t2.push({ type: ge("link"), attrs: { href: n3 } });
1716
+ t2.push({ type: xe("link"), attrs: { href: n3 } });
1547
1717
  }
1548
1718
  return t2;
1549
1719
  }
@@ -1553,17 +1723,17 @@ class gt {
1553
1723
  return n2;
1554
1724
  }
1555
1725
  resolveMarks(e2) {
1556
- return e2.filter((e3) => le(this.schema, e3.type));
1726
+ return e2.filter((e3) => be(this.schema, e3.type));
1557
1727
  }
1558
1728
  resolveBlockType(e2) {
1559
- return he(this.schema, e2) ? e2 : fe("paragraph");
1729
+ return Se(this.schema, e2) ? e2 : Te("paragraph");
1560
1730
  }
1561
1731
  normalizeSegments(e2) {
1562
1732
  if (0 === e2.length) return [];
1563
1733
  const t2 = [];
1564
1734
  for (const n2 of e2) {
1565
1735
  const e3 = t2[t2.length - 1];
1566
- e3 && _(e3.marks, n2.marks) ? t2[t2.length - 1] = { text: e3.text + n2.text, marks: e3.marks } : n2.text.length > 0 && t2.push(n2);
1736
+ e3 && W(e3.marks, n2.marks) ? t2[t2.length - 1] = { text: e3.text + n2.text, marks: e3.marks } : n2.text.length > 0 && t2.push(n2);
1567
1737
  }
1568
1738
  return t2;
1569
1739
  }
@@ -1576,14 +1746,14 @@ class gt {
1576
1746
  if (n2.rule.getAttrs) {
1577
1747
  const t3 = n2.rule.getAttrs(e2);
1578
1748
  if (false === t3) continue;
1579
- return { type: fe(n2.type), attrs: t3 };
1749
+ return { type: Te(n2.type), attrs: t3 };
1580
1750
  }
1581
- return { type: fe(n2.type) };
1751
+ return { type: Te(n2.type) };
1582
1752
  }
1583
1753
  return null;
1584
1754
  }
1585
1755
  isBlockElement(e2) {
1586
- if (pt.has(e2.tagName)) return true;
1756
+ if (Xt.has(e2.tagName)) return true;
1587
1757
  const t2 = e2.tagName.toLowerCase();
1588
1758
  return this.blockParseRules.some((e3) => e3.rule.tag === t2);
1589
1759
  }
@@ -1596,10 +1766,10 @@ class gt {
1596
1766
  }
1597
1767
  flushPendingSegments(e2, t2) {
1598
1768
  const n2 = this.normalizeSegments(t2);
1599
- 0 !== n2.length && (n2.every((e3) => "" === e3.text.trim()) || e2.push({ type: this.resolveBlockType(fe("paragraph")), segments: n2 }));
1769
+ 0 !== n2.length && (n2.every((e3) => "" === e3.text.trim()) || e2.push({ type: this.resolveBlockType(Te("paragraph")), segments: n2 }));
1600
1770
  }
1601
1771
  }
1602
- class mt {
1772
+ class Yt {
1603
1773
  constructor(e2, t2) {
1604
1774
  this.element = e2, this.getState = t2.getState, this.dispatch = t2.dispatch, this.schemaRegistry = t2.schemaRegistry, this.handlePaste = this.onPaste.bind(this), e2.addEventListener("paste", this.handlePaste);
1605
1775
  }
@@ -1608,7 +1778,7 @@ class mt {
1608
1778
  schemaRegistry;
1609
1779
  handlePaste;
1610
1780
  onPaste(e2) {
1611
- e2.preventDefault();
1781
+ if (e2.preventDefault(), "false" === this.element.contentEditable) return;
1612
1782
  const t2 = e2.clipboardData;
1613
1783
  if (!t2) return;
1614
1784
  const n2 = t2.getData("application/x-notectl-block");
@@ -1617,67 +1787,67 @@ class mt {
1617
1787
  const s2 = t2.getData("text/plain");
1618
1788
  if (s2) {
1619
1789
  const e3 = (function(e4) {
1620
- if (Qe && Qe.plainText === e4) return Qe.blocks;
1790
+ if (ut && ut.plainText === e4) return ut.blocks;
1621
1791
  })(s2);
1622
1792
  if (e3 && this.handleRichPaste(e3)) return;
1623
1793
  }
1624
- const r2 = this.getState(), i3 = t2.getData("text/html");
1625
- if (i3) {
1626
- const e3 = this.extractRichData(i3);
1794
+ const r2 = this.getState(), i5 = t2.getData("text/html");
1795
+ if (i5) {
1796
+ const e3 = this.extractRichData(i5);
1627
1797
  if (e3 && this.handleRichPasteFromJson(e3)) return;
1628
- const t3 = this.schemaRegistry ? this.schemaRegistry.getAllowedTags() : ["strong", "em", "u", "b", "i", "p", "br", "div", "span"], n3 = this.schemaRegistry ? this.schemaRegistry.getAllowedAttrs() : [], s3 = Ne.sanitize(i3, { ALLOWED_TAGS: t3, ALLOWED_ATTR: n3 });
1798
+ const t3 = this.schemaRegistry ? this.schemaRegistry.getAllowedTags() : ["strong", "em", "u", "b", "i", "p", "br", "div", "span"], n3 = this.schemaRegistry ? this.schemaRegistry.getAllowedAttrs() : [], s3 = Fe.sanitize(i5, { ALLOWED_TAGS: t3, ALLOWED_ATTR: n3 });
1629
1799
  if (this.schemaRegistry) {
1630
- const e4 = de(this.schemaRegistry), t4 = new gt({ schema: e4, schemaRegistry: this.schemaRegistry }), n4 = document.createElement("template");
1800
+ const e4 = ve(this.schemaRegistry), t4 = new Qt({ schema: e4, schemaRegistry: this.schemaRegistry }), n4 = document.createElement("template");
1631
1801
  n4.innerHTML = s3;
1632
- const i4 = (function(e5, t5) {
1802
+ const i6 = (function(e5, t5) {
1633
1803
  if (0 === t5.blocks.length) return e5.transaction("paste").setSelection(e5.selection).build();
1634
1804
  const n5 = t5.blocks[0];
1635
- return n5 ? 1 === t5.blocks.length && n5.type === fe("paragraph") ? (function(e6, t6) {
1805
+ return n5 ? 1 === t5.blocks.length && n5.type === Te("paragraph") ? (function(e6, t6) {
1636
1806
  const n6 = e6.selection;
1637
- if ($(n6)) return e6.transaction("paste").setSelection(n6).build();
1638
- const s4 = e6.transaction("paste"), r3 = V(n6) ? null : q(n6, e6.getBlockOrder());
1639
- V(n6) || ce(e6, s4);
1640
- const o2 = r3 ? r3.from.blockId : n6.anchor.blockId, i5 = r3 ? r3.from.offset : n6.anchor.offset, a4 = ut(t6), c3 = dt(t6);
1641
- return s4.insertText(o2, i5, c3, [], t6), s4.setSelection(F(o2, i5 + a4)), s4.build();
1807
+ if (Q(n6)) return e6.transaction("paste").setSelection(n6).build();
1808
+ const s4 = e6.transaction("paste"), r3 = te(n6) ? null : ne(n6, e6.getBlockOrder());
1809
+ te(n6) || ke(e6, s4);
1810
+ const o2 = r3 ? r3.from.blockId : n6.anchor.blockId, i7 = r3 ? r3.from.offset : n6.anchor.offset, a18 = Gt(t6), c8 = Wt(t6);
1811
+ return s4.insertText(o2, i7, c8, [], t6), s4.setSelection(J(o2, i7 + a18)), s4.build();
1642
1812
  })(e5, n5.segments) : 1 === t5.blocks.length ? (function(e6, t6) {
1643
1813
  const n6 = e6.selection;
1644
- if ($(n6)) return e6.transaction("paste").setSelection(n6).build();
1645
- const s4 = e6.transaction("paste"), r3 = V(n6) ? null : q(n6, e6.getBlockOrder());
1646
- V(n6) || ce(e6, s4);
1647
- const o2 = r3 ? r3.from.blockId : n6.anchor.blockId, i5 = r3 ? r3.from.offset : n6.anchor.offset, a4 = ut(t6.segments), c3 = dt(t6.segments);
1648
- return s4.setBlockType(o2, t6.type, t6.attrs), s4.insertText(o2, i5, c3, [], t6.segments), s4.setSelection(F(o2, i5 + a4)), s4.build();
1814
+ if (Q(n6)) return e6.transaction("paste").setSelection(n6).build();
1815
+ const s4 = e6.transaction("paste"), r3 = te(n6) ? null : ne(n6, e6.getBlockOrder());
1816
+ te(n6) || ke(e6, s4);
1817
+ const o2 = r3 ? r3.from.blockId : n6.anchor.blockId, i7 = r3 ? r3.from.offset : n6.anchor.offset, a18 = Gt(t6.segments), c8 = Wt(t6.segments);
1818
+ return s4.setBlockType(o2, t6.type, t6.attrs), s4.insertText(o2, i7, c8, [], t6.segments), s4.setSelection(J(o2, i7 + a18)), s4.build();
1649
1819
  })(e5, n5) : (function(e6, t6) {
1650
1820
  const n6 = e6.selection;
1651
- if ($(n6)) return e6.transaction("paste").setSelection(n6).build();
1652
- const s4 = e6.transaction("paste"), r3 = V(n6) ? null : q(n6, e6.getBlockOrder());
1653
- V(n6) || ce(e6, s4);
1654
- const i5 = r3 ? r3.from.blockId : n6.anchor.blockId, a4 = r3 ? r3.from.offset : n6.anchor.offset, c3 = e6.getBlockOrder().indexOf(i5), l2 = t6.blocks[0], h3 = t6.blocks[t6.blocks.length - 1];
1655
- if (!l2 || !h3) return s4.build();
1656
- const d2 = t6.blocks.slice(1, -1), u2 = ut(l2.segments);
1657
- l2.segments.length > 0 && u2 > 0 && s4.insertText(i5, a4, dt(l2.segments), [], l2.segments), l2.type !== fe("paragraph") && s4.setBlockType(i5, l2.type, l2.attrs);
1658
- const p2 = a4 + u2, f3 = L();
1659
- s4.splitBlock(i5, p2, f3);
1660
- let m2 = c3 + 1;
1661
- for (const e7 of d2) {
1662
- const t7 = e7.segments.map((e8) => g(e8.text, [...e8.marks])), n7 = o(e7.type, t7.length > 0 ? t7 : void 0, L(), e7.attrs);
1663
- s4.insertNode([], m2, n7), m2++;
1821
+ if (Q(n6)) return e6.transaction("paste").setSelection(n6).build();
1822
+ const s4 = e6.transaction("paste"), r3 = te(n6) ? null : ne(n6, e6.getBlockOrder());
1823
+ te(n6) || ke(e6, s4);
1824
+ const i7 = r3 ? r3.from.blockId : n6.anchor.blockId, a18 = r3 ? r3.from.offset : n6.anchor.offset, c8 = e6.getBlockOrder().indexOf(i7), l2 = t6.blocks[0], h4 = t6.blocks[t6.blocks.length - 1];
1825
+ if (!l2 || !h4) return s4.build();
1826
+ const d4 = t6.blocks.slice(1, -1), u2 = Gt(l2.segments);
1827
+ l2.segments.length > 0 && u2 > 0 && s4.insertText(i7, a18, Wt(l2.segments), [], l2.segments), l2.type !== Te("paragraph") && s4.setBlockType(i7, l2.type, l2.attrs);
1828
+ const p2 = a18 + u2, f4 = q();
1829
+ s4.splitBlock(i7, p2, f4);
1830
+ let g2 = c8 + 1;
1831
+ for (const e7 of d4) {
1832
+ const t7 = e7.segments.map((e8) => N(e8.text, [...e8.marks])), n7 = o(e7.type, t7.length > 0 ? t7 : void 0, q(), e7.attrs);
1833
+ s4.insertNode([], g2, n7), g2++;
1664
1834
  }
1665
- const y2 = ut(h3.segments);
1666
- return h3.segments.length > 0 && y2 > 0 && s4.insertText(f3, 0, dt(h3.segments), [], h3.segments), h3.type !== fe("paragraph") && s4.setBlockType(f3, h3.type, h3.attrs), s4.setSelection(F(f3, y2)), s4.build();
1835
+ const m2 = Gt(h4.segments);
1836
+ return h4.segments.length > 0 && m2 > 0 && s4.insertText(f4, 0, Wt(h4.segments), [], h4.segments), h4.type !== Te("paragraph") && s4.setBlockType(f4, h4.type, h4.attrs), s4.setSelection(J(f4, m2)), s4.build();
1667
1837
  })(e5, t5) : e5.transaction("paste").setSelection(e5.selection).build();
1668
1838
  })(r2, t4.parse(n4.content));
1669
- this.dispatch(i4);
1839
+ this.dispatch(i6);
1670
1840
  } else {
1671
1841
  const e4 = this.extractTextFromHTML(s3);
1672
1842
  if (e4) {
1673
- const t4 = Z(r2, e4, "paste");
1843
+ const t4 = le(r2, e4, "paste");
1674
1844
  this.dispatch(t4);
1675
1845
  }
1676
1846
  }
1677
1847
  return;
1678
1848
  }
1679
1849
  if (s2) {
1680
- const e3 = Z(this.getState(), s2, "paste");
1850
+ const e3 = le(this.getState(), s2, "paste");
1681
1851
  this.dispatch(e3);
1682
1852
  }
1683
1853
  }
@@ -1691,22 +1861,22 @@ class mt {
1691
1861
  const n2 = t2.type;
1692
1862
  if (!n2) return;
1693
1863
  if (this.schemaRegistry && !this.schemaRegistry.getNodeSpec(n2)) return;
1694
- const s2 = this.getState(), r2 = s2.selection, i3 = $(r2) ? r2.nodeId : r2.anchor.blockId, a4 = L(), c3 = t2.attrs ? t2.attrs : void 0, h3 = o(fe(n2), [], a4, c3), d2 = this.findTableCellAncestor(s2, i3);
1695
- if (d2) {
1696
- const e3 = ve(s2.doc, d2);
1864
+ const s2 = this.getState(), r2 = s2.selection, i5 = Q(r2) ? r2.nodeId : r2.anchor.blockId, a18 = q(), c8 = t2.attrs ? t2.attrs : void 0, l2 = o(Te(n2), [], a18, c8), h4 = this.findTableCellAncestor(s2, i5);
1865
+ if (h4) {
1866
+ const e3 = Me(s2.doc, h4);
1697
1867
  if (!e3) return;
1698
- const t3 = s2.getBlock(d2);
1868
+ const t3 = s2.getBlock(h4);
1699
1869
  if (!t3) return;
1700
1870
  const n3 = s2.transaction("paste");
1701
- return n3.insertNode(e3, t3.children.length, h3), n3.setSelection(H(a4, [...e3, a4])), void this.dispatch(n3.build());
1871
+ return n3.insertNode(e3, t3.children.length, l2), n3.setSelection(X(a18, [...e3, a18])), void this.dispatch(n3.build());
1702
1872
  }
1703
- const u2 = ve(s2.doc, i3), p2 = u2 && u2.length > 1 ? u2.slice(0, -1) : [], f3 = (0 === p2.length ? s2.doc.children : (() => {
1704
- const e3 = s2.getBlock(p2[p2.length - 1]);
1873
+ const d4 = Me(s2.doc, i5), u2 = d4 && d4.length > 1 ? d4.slice(0, -1) : [], p2 = (0 === u2.length ? s2.doc.children : (() => {
1874
+ const e3 = s2.getBlock(u2[u2.length - 1]);
1705
1875
  return e3 ? e3.children : [];
1706
- })()).findIndex((e3) => l(e3) && e3.id === i3);
1707
- if (f3 < 0) return;
1708
- const g2 = s2.transaction("paste");
1709
- g2.insertNode(p2, f3 + 1, h3), g2.setSelection(H(a4, [...p2, a4])), this.dispatch(g2.build());
1876
+ })()).findIndex((e3) => m(e3) && e3.id === i5);
1877
+ if (p2 < 0) return;
1878
+ const f4 = s2.transaction("paste");
1879
+ f4.insertNode(u2, p2 + 1, l2), f4.setSelection(X(a18, [...u2, a18])), this.dispatch(f4.build());
1710
1880
  }
1711
1881
  handleRichPasteFromJson(e2) {
1712
1882
  let t2;
@@ -1720,46 +1890,46 @@ class mt {
1720
1890
  handleRichPaste(e2) {
1721
1891
  if (0 === e2.length) return false;
1722
1892
  if (!e2.some((e3) => void 0 !== e3.type && "paragraph" !== e3.type)) return false;
1723
- const t2 = this.getState(), n2 = t2.selection, s2 = $(n2) ? n2.nodeId : n2.anchor.blockId, r2 = this.findTableCellAncestor(t2, s2);
1893
+ const t2 = this.getState(), n2 = t2.selection, s2 = Q(n2) ? n2.nodeId : n2.anchor.blockId, r2 = this.findTableCellAncestor(t2, s2);
1724
1894
  return r2 ? this.insertRichBlocksIntoCell(e2, t2, s2, r2) : this.insertRichBlocksAtRoot(e2, t2, s2);
1725
1895
  }
1726
1896
  insertRichBlocksIntoCell(e2, t2, n2, s2) {
1727
- const r2 = ve(t2.doc, s2);
1897
+ const r2 = Me(t2.doc, s2);
1728
1898
  if (!r2) return false;
1729
- const i3 = t2.getBlock(s2);
1730
- if (!i3) return false;
1731
- const a4 = t2.getBlock(n2), c3 = i3.children.findIndex((e3) => l(e3) && e3.id === n2), h3 = void 0 !== a4 && "paragraph" === a4.type && "" === M(a4);
1732
- let d2 = c3 >= 0 ? c3 + 1 : i3.children.length;
1733
- const u2 = t2.transaction("paste");
1734
- let p2, f3 = 0;
1899
+ const i5 = t2.getBlock(s2);
1900
+ if (!i5) return false;
1901
+ const a18 = t2.getBlock(n2), c8 = i5.children.findIndex((e3) => m(e3) && e3.id === n2), l2 = void 0 !== a18 && "paragraph" === a18.type && "" === O(a18);
1902
+ let h4 = c8 >= 0 ? c8 + 1 : i5.children.length;
1903
+ const d4 = t2.transaction("paste");
1904
+ let u2, p2 = 0;
1735
1905
  for (const t3 of e2) {
1736
1906
  if (!t3.type) continue;
1737
- const e3 = L(), n3 = t3.text ?? "", s3 = n3 ? [g(n3)] : void 0, i4 = t3.attrs ? t3.attrs : void 0, a5 = o(fe(t3.type), s3, e3, i4);
1738
- u2.insertNode(r2, d2, a5), d2++, p2 = e3, f3 = n3.length;
1907
+ const e3 = q(), n3 = t3.text ?? "", s3 = n3 ? [N(n3)] : void 0, i6 = t3.attrs ? t3.attrs : void 0, a19 = o(Te(t3.type), s3, e3, i6);
1908
+ d4.insertNode(r2, h4, a19), h4++, u2 = e3, p2 = n3.length;
1739
1909
  }
1740
- return h3 && c3 >= 0 && u2.removeNode(r2, c3), p2 && u2.setSelection(F(p2, f3)), this.dispatch(u2.build()), true;
1910
+ return l2 && c8 >= 0 && d4.removeNode(r2, c8), u2 && d4.setSelection(J(u2, p2)), this.dispatch(d4.build()), true;
1741
1911
  }
1742
1912
  insertRichBlocksAtRoot(e2, t2, n2) {
1743
- const s2 = ve(t2.doc, n2), r2 = s2 && s2.length > 1 ? s2.slice(0, -1) : [], i3 = (0 === r2.length ? t2.doc.children : (() => {
1913
+ const s2 = Me(t2.doc, n2), r2 = s2 && s2.length > 1 ? s2.slice(0, -1) : [], i5 = (0 === r2.length ? t2.doc.children : (() => {
1744
1914
  const e3 = t2.getBlock(r2[r2.length - 1]);
1745
1915
  return e3 ? e3.children : [];
1746
- })()).findIndex((e3) => l(e3) && e3.id === n2);
1747
- if (i3 < 0) return false;
1748
- const a4 = t2.getBlock(n2), c3 = void 0 !== a4 && "paragraph" === a4.type && "" === M(a4);
1749
- let h3 = i3 + 1;
1750
- const d2 = t2.transaction("paste");
1751
- let u2, p2 = 0;
1916
+ })()).findIndex((e3) => m(e3) && e3.id === n2);
1917
+ if (i5 < 0) return false;
1918
+ const a18 = t2.getBlock(n2), c8 = void 0 !== a18 && "paragraph" === a18.type && "" === O(a18);
1919
+ let l2 = i5 + 1;
1920
+ const h4 = t2.transaction("paste");
1921
+ let d4, u2 = 0;
1752
1922
  for (const t3 of e2) {
1753
1923
  if (!t3.type) continue;
1754
- const e3 = L(), n3 = t3.text ?? "", s3 = n3 ? [g(n3)] : void 0, i4 = t3.attrs ? t3.attrs : void 0, a5 = o(fe(t3.type), s3, e3, i4);
1755
- d2.insertNode(r2, h3, a5), h3++, u2 = e3, p2 = n3.length;
1924
+ const e3 = q(), n3 = t3.text ?? "", s3 = n3 ? [N(n3)] : void 0, i6 = t3.attrs ? t3.attrs : void 0, a19 = o(Te(t3.type), s3, e3, i6);
1925
+ h4.insertNode(r2, l2, a19), l2++, d4 = e3, u2 = n3.length;
1756
1926
  }
1757
- return c3 && d2.removeNode(r2, i3), u2 && d2.setSelection(F(u2, p2)), this.dispatch(d2.build()), true;
1927
+ return c8 && h4.removeNode(r2, i5), d4 && h4.setSelection(J(d4, u2)), this.dispatch(h4.build()), true;
1758
1928
  }
1759
1929
  findTableCellAncestor(e2, t2) {
1760
1930
  const n2 = e2.getBlock(t2);
1761
1931
  if ("table_cell" === n2?.type) return t2;
1762
- const s2 = ve(e2.doc, t2);
1932
+ const s2 = Me(e2.doc, t2);
1763
1933
  if (s2) for (const t3 of s2) {
1764
1934
  const n3 = e2.getBlock(t3);
1765
1935
  if ("table_cell" === n3?.type) return t3;
@@ -1800,8 +1970,8 @@ class mt {
1800
1970
  this.element.removeEventListener("paste", this.handlePaste);
1801
1971
  }
1802
1972
  }
1803
- function yt(e2, t2, n2, s2) {
1804
- const r2 = t2?.doc.children ?? [], o2 = n2.doc.children, i3 = s2?.registry, a4 = s2?.nodeViews;
1973
+ function Zt(e2, t2, n2, s2) {
1974
+ const r2 = t2?.doc.children ?? [], o2 = n2.doc.children, i5 = s2?.registry, a18 = s2?.nodeViews;
1805
1975
  !(function(e3) {
1806
1976
  const t3 = Array.from(e3.querySelectorAll(":scope > [data-block-wrapper]"));
1807
1977
  for (const n3 of t3) {
@@ -1809,71 +1979,71 @@ function yt(e2, t2, n2, s2) {
1809
1979
  n3.remove();
1810
1980
  }
1811
1981
  })(e2);
1812
- const c3 = /* @__PURE__ */ new Map();
1982
+ const c8 = /* @__PURE__ */ new Map();
1813
1983
  for (const t3 of Array.from(e2.children)) {
1814
1984
  const e3 = t3, n3 = e3.getAttribute("data-block-id");
1815
- n3 && c3.set(pe(n3), e3);
1985
+ n3 && c8.set(Ee(n3), e3);
1816
1986
  }
1817
1987
  const l2 = new Set(o2.map((e3) => e3.id));
1818
- for (const [t3, n3] of c3) if (!l2.has(t3)) {
1819
- e2.removeChild(n3), c3.delete(t3);
1820
- const s3 = a4?.get(t3);
1821
- s3 && (s3.destroy?.(), a4?.delete(t3));
1822
- }
1823
- const h3 = /* @__PURE__ */ new Map();
1824
- for (const e3 of r2) h3.set(e3.id, e3);
1825
- let d2 = null;
1988
+ for (const [t3, n3] of c8) if (!l2.has(t3)) {
1989
+ e2.removeChild(n3), c8.delete(t3);
1990
+ const s3 = a18?.get(t3);
1991
+ s3 && (s3.destroy?.(), a18?.delete(t3));
1992
+ }
1993
+ const h4 = /* @__PURE__ */ new Map();
1994
+ for (const e3 of r2) h4.set(e3.id, e3);
1995
+ let d4 = null;
1826
1996
  const u2 = s2?.selectedNodeId, p2 = s2?.previousSelectedNodeId;
1827
1997
  for (const t3 of o2) {
1828
- const n3 = c3.get(t3.id), r3 = h3.get(t3.id), o3 = s2?.oldDecorations?.find(t3.id), l3 = s2?.decorations?.find(t3.id);
1829
- if (n3 && r3 && !kt(r3, t3, o3, l3)) d2 = n3;
1998
+ const n3 = c8.get(t3.id), r3 = h4.get(t3.id), o3 = s2?.oldDecorations?.find(t3.id), l3 = s2?.decorations?.find(t3.id);
1999
+ if (n3 && r3 && !en(r3, t3, o3, l3)) d4 = n3;
1830
2000
  else if (n3) {
1831
- const r4 = a4?.get(t3.id);
2001
+ const r4 = a18?.get(t3.id);
1832
2002
  if (r4) {
1833
2003
  if (r4.update?.(t3)) {
1834
- if (D(t3) && r4.contentDOM) {
2004
+ if (V(t3) && r4.contentDOM) {
1835
2005
  r4.contentDOM.textContent = "";
1836
2006
  const e3 = s2?.decorations?.findInline(t3.id);
1837
- St(r4.contentDOM, t3, i3, e3);
2007
+ nn(r4.contentDOM, t3, i5, e3);
1838
2008
  }
1839
- d2 = r4.dom;
2009
+ d4 = r4.dom;
1840
2010
  continue;
1841
2011
  }
1842
- r4.destroy?.(), a4?.delete(t3.id);
2012
+ r4.destroy?.(), a18?.delete(t3.id);
1843
2013
  }
1844
- const o4 = bt(t3, i3, a4, s2);
1845
- e2.replaceChild(o4, n3), d2 = o4;
2014
+ const o4 = tn(t3, i5, a18, s2);
2015
+ e2.replaceChild(o4, n3), d4 = o4;
1846
2016
  } else {
1847
- const n4 = bt(t3, i3, a4, s2);
1848
- d2?.nextSibling ? e2.insertBefore(n4, d2.nextSibling) : !d2 && e2.firstChild ? e2.insertBefore(n4, e2.firstChild) : e2.appendChild(n4), d2 = n4;
2017
+ const n4 = tn(t3, i5, a18, s2);
2018
+ d4?.nextSibling ? e2.insertBefore(n4, d4.nextSibling) : !d4 && e2.firstChild ? e2.insertBefore(n4, e2.firstChild) : e2.appendChild(n4), d4 = n4;
1849
2019
  }
1850
2020
  if (u2 === t3.id) {
1851
- const e3 = a4?.get(t3.id);
2021
+ const e3 = a18?.get(t3.id);
1852
2022
  if (e3) e3.selectNode?.();
1853
2023
  else {
1854
- const e4 = c3.get(t3.id) ?? d2;
2024
+ const e4 = c8.get(t3.id) ?? d4;
1855
2025
  e4 instanceof HTMLElement && e4.classList.add("notectl-node-selected");
1856
2026
  }
1857
2027
  } else if (p2 === t3.id) {
1858
- const e3 = a4?.get(t3.id);
2028
+ const e3 = a18?.get(t3.id);
1859
2029
  if (e3) e3.deselectNode?.();
1860
2030
  else {
1861
- const e4 = c3.get(t3.id) ?? d2;
2031
+ const e4 = c8.get(t3.id) ?? d4;
1862
2032
  e4 instanceof HTMLElement && e4.classList.remove("notectl-node-selected");
1863
2033
  }
1864
2034
  }
1865
2035
  }
1866
2036
  if (p2 && p2 !== u2) {
1867
- const e3 = a4?.get(p2);
2037
+ const e3 = a18?.get(p2);
1868
2038
  e3 && !l2.has(p2) && e3.deselectNode?.();
1869
2039
  }
1870
2040
  if (u2 && !l2.has(u2)) {
1871
- const e3 = a4?.get(u2);
2041
+ const e3 = a18?.get(u2);
1872
2042
  e3 && e3.selectNode?.();
1873
2043
  }
1874
- Ct(e2, o2, i3);
2044
+ un(e2, o2, i5);
1875
2045
  }
1876
- function kt(e2, t2, n2, s2) {
2046
+ function en(e2, t2, n2, s2) {
1877
2047
  if (e2.type !== t2.type) return true;
1878
2048
  if (e2.children.length !== t2.children.length) return true;
1879
2049
  const r2 = e2.attrs, o2 = t2.attrs;
@@ -1886,135 +2056,135 @@ function kt(e2, t2, n2, s2) {
1886
2056
  for (let n3 = 0; n3 < e2.children.length; n3++) {
1887
2057
  const s3 = e2.children[n3], r3 = t2.children[n3];
1888
2058
  if (!s3 || !r3) return true;
1889
- if (m(s3) && m(r3)) {
2059
+ if (M(s3) && M(r3)) {
1890
2060
  if (s3.text !== r3.text) return true;
1891
- if (!_(s3.marks, r3.marks)) return true;
1892
- } else if (d(s3) && d(r3)) {
2061
+ if (!W(s3.marks, r3.marks)) return true;
2062
+ } else if (E(s3) && E(r3)) {
1893
2063
  if (s3.inlineType !== r3.inlineType) return true;
1894
- if (!Et(s3.attrs, r3.attrs)) return true;
2064
+ if (!an(s3.attrs, r3.attrs)) return true;
1895
2065
  } else {
1896
- if (m(s3) || m(r3) || d(s3) || d(r3)) return true;
1897
- if (kt(s3, r3)) return true;
2066
+ if (M(s3) || M(r3) || E(s3) || E(r3)) return true;
2067
+ if (en(s3, r3)) return true;
1898
2068
  }
1899
2069
  }
1900
- const i3 = n2 ?? [], a4 = s2 ?? [];
1901
- return i3 !== a4 && !Te(i3, a4);
2070
+ const i5 = n2 ?? [], a18 = s2 ?? [];
2071
+ return i5 !== a18 && !He(i5, a18);
1902
2072
  }
1903
- function bt(e2, t2, n2, s2) {
2073
+ function tn(e2, t2, n2, s2) {
1904
2074
  const r2 = s2?.decorations?.findInline(e2.id);
1905
2075
  if (t2 && n2 && s2?.getState && s2?.dispatch) {
1906
2076
  const o2 = t2.getNodeViewFactory(e2.type);
1907
2077
  if (o2) {
1908
- const i3 = o2(e2, s2.getState, s2.dispatch);
1909
- n2.set(e2.id, i3);
1910
- const a4 = t2.getNodeSpec(e2.type);
1911
- if (a4?.isVoid && i3.dom.setAttribute("data-void", "true"), a4?.selectable && i3.dom.setAttribute("data-selectable", "true"), i3.contentDOM && i3.contentDOM !== i3.dom && i3.contentDOM.setAttribute("data-content-dom", "true"), D(e2) && i3.contentDOM) St(i3.contentDOM, e2, t2, r2);
2078
+ const i5 = o2(e2, s2.getState, s2.dispatch);
2079
+ n2.set(e2.id, i5);
2080
+ const a18 = t2.getNodeSpec(e2.type);
2081
+ if (a18?.isVoid && i5.dom.setAttribute("data-void", "true"), a18?.selectable && i5.dom.setAttribute("data-selectable", "true"), i5.contentDOM && i5.contentDOM !== i5.dom && i5.contentDOM.setAttribute("data-content-dom", "true"), V(e2) && i5.contentDOM) nn(i5.contentDOM, e2, t2, r2);
1912
2082
  else {
1913
- const r3 = O(e2), o3 = /* @__PURE__ */ new Map();
2083
+ const r3 = G(e2), o3 = /* @__PURE__ */ new Map();
1914
2084
  for (const e3 of r3) {
1915
- const r4 = i3.getContentDOM?.(e3.id) ?? i3.contentDOM;
2085
+ const r4 = i5.getContentDOM?.(e3.id) ?? i5.contentDOM;
1916
2086
  if (r4) {
1917
- const i4 = bt(e3, t2, n2, s2);
1918
- r4.appendChild(i4);
1919
- let a5 = o3.get(r4);
1920
- a5 || (a5 = [], o3.set(r4, a5)), a5.push(e3);
2087
+ const i6 = tn(e3, t2, n2, s2);
2088
+ r4.appendChild(i6);
2089
+ let a19 = o3.get(r4);
2090
+ a19 || (a19 = [], o3.set(r4, a19)), a19.push(e3);
1921
2091
  }
1922
2092
  }
1923
- for (const [e3, n3] of o3) Ct(e3, n3, t2);
2093
+ for (const [e3, n3] of o3) un(e3, n3, t2);
1924
2094
  }
1925
- return It(i3.dom, e2.id, s2), i3.dom;
2095
+ return i5.dom.setAttribute("data-block-type", e2.type), dn(i5.dom, e2.id, s2), i5.dom;
1926
2096
  }
1927
2097
  }
1928
2098
  if (t2) {
1929
2099
  const o2 = t2.getNodeSpec(e2.type);
1930
2100
  if (o2) {
1931
- const i3 = o2.toDOM(e2);
1932
- if (o2.isVoid && i3.setAttribute("data-void", "true"), o2.selectable && i3.setAttribute("data-selectable", "true"), !o2.isVoid) if (D(e2)) St(i3, e2, t2, r2);
2101
+ const i5 = o2.toDOM(e2);
2102
+ if (o2.isVoid && i5.setAttribute("data-void", "true"), o2.selectable && i5.setAttribute("data-selectable", "true"), !o2.isVoid) if (V(e2)) nn(i5, e2, t2, r2);
1933
2103
  else {
1934
- const r3 = O(e2);
2104
+ const r3 = G(e2);
1935
2105
  for (const e3 of r3) {
1936
- const r4 = bt(e3, t2, n2, s2);
1937
- i3.appendChild(r4);
2106
+ const r4 = tn(e3, t2, n2, s2);
2107
+ i5.appendChild(r4);
1938
2108
  }
1939
- Ct(i3, r3, t2);
2109
+ un(i5, r3, t2);
1940
2110
  }
1941
- return It(i3, e2.id, s2), i3;
2111
+ return i5.setAttribute("data-block-type", e2.type), dn(i5, e2.id, s2), i5;
1942
2112
  }
1943
2113
  }
1944
2114
  return (function(e3, t3, n3) {
1945
- const s3 = ye("p", e3.id);
1946
- return St(s3, e3, t3, n3), s3;
2115
+ const s3 = Ce("p", e3.id);
2116
+ return s3.setAttribute("data-block-type", e3.type), nn(s3, e3, t3, n3), s3;
1947
2117
  })(e2, t2, r2);
1948
2118
  }
1949
- function St(t2, n2, s2, r2) {
1950
- const o2 = e(n2);
1951
- if (1 === o2.length && m(o2[0]) && "" === o2[0].text) return void t2.appendChild(document.createElement("br"));
1952
- if (r2 && 0 !== r2.length) !(function(e2, t3, n3, s3) {
2119
+ function nn(e2, n2, s2, r2) {
2120
+ const o2 = t(n2);
2121
+ if (1 === o2.length && M(o2[0]) && "" === o2[0].text) return void e2.appendChild(document.createElement("br"));
2122
+ if (r2 && 0 !== r2.length) !(function(e3, t2, n3, s3) {
1953
2123
  let r3 = 0;
1954
- for (const o3 of t3) {
1955
- if (d(o3)) {
1956
- e2.appendChild(Tt(o3, s3)), r3 += 1;
2124
+ for (const o3 of t2) {
2125
+ if (E(o3)) {
2126
+ e3.appendChild(on(o3, s3)), r3 += 1;
1957
2127
  continue;
1958
2128
  }
1959
- const t4 = r3, i4 = r3 + o3.text.length;
2129
+ const t3 = r3, i6 = r3 + o3.text.length;
1960
2130
  if (0 === o3.text.length) {
1961
- r3 = i4;
2131
+ r3 = i6;
1962
2132
  continue;
1963
2133
  }
1964
- const a4 = /* @__PURE__ */ new Set();
1965
- a4.add(t4), a4.add(i4);
1966
- for (const e3 of n3) {
1967
- const n4 = Math.max(t4, e3.from), s4 = Math.min(i4, e3.to);
1968
- n4 > t4 && n4 < i4 && a4.add(n4), s4 > t4 && s4 < i4 && a4.add(s4);
2134
+ const a18 = /* @__PURE__ */ new Set();
2135
+ a18.add(t3), a18.add(i6);
2136
+ for (const e4 of n3) {
2137
+ const n4 = Math.max(t3, e4.from), s4 = Math.min(i6, e4.to);
2138
+ n4 > t3 && n4 < i6 && a18.add(n4), s4 > t3 && s4 < i6 && a18.add(s4);
1969
2139
  }
1970
- const c3 = [...a4].sort((e3, t5) => e3 - t5);
1971
- for (let r4 = 0; r4 < c3.length - 1; r4++) {
1972
- const i5 = c3[r4], a5 = c3[r4 + 1];
1973
- if (void 0 === i5 || void 0 === a5 || i5 >= a5) continue;
1974
- const l2 = i5 - t4, h3 = a5 - t4, d2 = o3.text.slice(l2, h3), u2 = [];
1975
- for (const e3 of n3) e3.from <= i5 && e3.to >= a5 && u2.push(e3);
1976
- let p2 = document.createTextNode(vt(d2));
2140
+ const c8 = [...a18].sort((e4, t4) => e4 - t4);
2141
+ for (let r4 = 0; r4 < c8.length - 1; r4++) {
2142
+ const i7 = c8[r4], a19 = c8[r4 + 1];
2143
+ if (void 0 === i7 || void 0 === a19 || i7 >= a19) continue;
2144
+ const l2 = i7 - t3, h4 = a19 - t3, d4 = o3.text.slice(l2, h4), u2 = [];
2145
+ for (const e4 of n3) e4.from <= i7 && e4.to >= a19 && u2.push(e4);
2146
+ let p2 = document.createTextNode(sn(d4));
1977
2147
  if (o3.marks.length > 0) {
1978
- const e3 = [...o3.marks].sort((e4, t5) => xt(e4, s3) - xt(t5, s3));
1979
- for (let t5 = e3.length - 1; t5 >= 0; t5--) {
1980
- const n4 = e3[t5];
2148
+ const e4 = [...o3.marks].sort((e5, t4) => cn(e5, s3) - cn(t4, s3));
2149
+ for (let t4 = e4.length - 1; t4 >= 0; t4--) {
2150
+ const n4 = e4[t4];
1981
2151
  if (!n4) continue;
1982
- const r5 = Nt(n4, s3);
2152
+ const r5 = ln(n4, s3);
1983
2153
  r5.appendChild(p2), p2 = r5;
1984
2154
  }
1985
2155
  }
1986
- for (const e3 of u2) {
1987
- const t5 = Mt(e3.attrs);
1988
- t5.appendChild(p2), p2 = t5;
2156
+ for (const e4 of u2) {
2157
+ const t4 = hn(e4.attrs);
2158
+ t4.appendChild(p2), p2 = t4;
1989
2159
  }
1990
- e2.appendChild(p2);
2160
+ e3.appendChild(p2);
1991
2161
  }
1992
- r3 = i4;
2162
+ r3 = i6;
1993
2163
  }
1994
- })(t2, o2, r2, s2);
1995
- else for (const e2 of o2) m(e2) ? t2.appendChild(wt(e2, s2)) : t2.appendChild(Tt(e2, s2));
1996
- const i3 = o2[o2.length - 1];
1997
- i3 && d(i3) && "hard_break" === i3.inlineType && t2.appendChild(document.createElement("br"));
2164
+ })(e2, o2, r2, s2);
2165
+ else for (const t2 of o2) M(t2) ? e2.appendChild(rn(t2, s2)) : e2.appendChild(on(t2, s2));
2166
+ const i5 = o2[o2.length - 1];
2167
+ i5 && E(i5) && "hard_break" === i5.inlineType && e2.appendChild(document.createElement("br"));
1998
2168
  }
1999
- function vt(e2) {
2169
+ function sn(e2) {
2000
2170
  let t2 = e2.replace(/ {2}/g, "  ");
2001
2171
  return t2.endsWith(" ") && (t2 = `${t2.slice(0, -1)} `), t2.startsWith(" ") && (t2 = ` ${t2.slice(1)}`), t2;
2002
2172
  }
2003
- function wt(e2, t2) {
2173
+ function rn(e2, t2) {
2004
2174
  if ("" === e2.text) return document.createTextNode("");
2005
- const n2 = document.createTextNode(vt(e2.text));
2175
+ const n2 = document.createTextNode(sn(e2.text));
2006
2176
  if (0 === e2.marks.length) return n2;
2007
- const s2 = [...e2.marks].sort((e3, n3) => xt(e3, t2) - xt(n3, t2));
2177
+ const s2 = [...e2.marks].sort((e3, n3) => cn(e3, t2) - cn(n3, t2));
2008
2178
  let r2 = n2;
2009
2179
  for (let e3 = s2.length - 1; e3 >= 0; e3--) {
2010
2180
  const n3 = s2[e3];
2011
2181
  if (!n3) continue;
2012
- const o2 = Nt(n3, t2);
2182
+ const o2 = ln(n3, t2);
2013
2183
  o2.appendChild(r2), r2 = o2;
2014
2184
  }
2015
2185
  return r2;
2016
2186
  }
2017
- function Tt(e2, t2) {
2187
+ function on(e2, t2) {
2018
2188
  if (t2) {
2019
2189
  const n3 = t2.getInlineNodeSpec(e2.inlineType);
2020
2190
  if (n3) {
@@ -2025,13 +2195,13 @@ function Tt(e2, t2) {
2025
2195
  const n2 = document.createElement("span");
2026
2196
  return n2.setAttribute("data-inline-type", e2.inlineType), n2.setAttribute("contenteditable", "false"), n2;
2027
2197
  }
2028
- function Et(e2, t2) {
2198
+ function an(e2, t2) {
2029
2199
  const n2 = Object.keys(e2), s2 = Object.keys(t2);
2030
2200
  if (n2.length !== s2.length) return false;
2031
2201
  for (const s3 of n2) if (e2[s3] !== t2[s3]) return false;
2032
2202
  return true;
2033
2203
  }
2034
- function xt(e2, t2) {
2204
+ function cn(e2, t2) {
2035
2205
  if (t2) {
2036
2206
  const n2 = t2.getMarkSpec(e2.type);
2037
2207
  if (n2) return n2.rank ?? 100;
@@ -2047,7 +2217,7 @@ function xt(e2, t2) {
2047
2217
  return 100;
2048
2218
  }
2049
2219
  }
2050
- function Nt(e2, t2) {
2220
+ function ln(e2, t2) {
2051
2221
  if (t2) {
2052
2222
  const n2 = t2.getMarkSpec(e2.type);
2053
2223
  if (n2) return n2.toDOM(e2);
@@ -2063,14 +2233,14 @@ function Nt(e2, t2) {
2063
2233
  return document.createElement("span");
2064
2234
  }
2065
2235
  }
2066
- function Mt(e2) {
2236
+ function hn(e2) {
2067
2237
  const t2 = e2.nodeName ?? "span", n2 = document.createElement(t2);
2068
2238
  if (n2.setAttribute("data-decoration", "true"), e2.class) for (const t3 of e2.class.split(" ")) t3 && n2.classList.add(t3);
2069
2239
  e2.style && (n2.style.cssText = e2.style);
2070
2240
  for (const [t3, s2] of Object.entries(e2)) "class" !== t3 && "style" !== t3 && "nodeName" !== t3 && void 0 !== s2 && n2.setAttribute(t3, s2);
2071
2241
  return n2;
2072
2242
  }
2073
- function It(e2, t2, n2) {
2243
+ function dn(e2, t2, n2) {
2074
2244
  const s2 = n2?.decorations?.findNode(t2);
2075
2245
  if (s2 && 0 !== s2.length) for (const t3 of s2) {
2076
2246
  if (t3.attrs.class) for (const n3 of t3.attrs.class.split(" ")) n3 && e2.classList.add(n3);
@@ -2080,13 +2250,13 @@ function It(e2, t2, n2) {
2080
2250
  }
2081
2251
  }
2082
2252
  }
2083
- function Ct(e2, t2, n2) {
2253
+ function un(e2, t2, n2) {
2084
2254
  if (!n2) return;
2085
2255
  const s2 = [];
2086
2256
  let r2 = null, o2 = [];
2087
2257
  for (const e3 of t2) {
2088
- const t3 = n2.getNodeSpec(e3.type), i3 = t3?.wrapper?.(e3);
2089
- i3 && r2 && i3.key === r2.key ? o2.push(e3.id) : i3 ? (r2 && o2.length > 0 && s2.push({ spec: r2, blockIds: o2 }), r2 = i3, o2 = [e3.id]) : (r2 && o2.length > 0 && s2.push({ spec: r2, blockIds: o2 }), r2 = null, o2 = []);
2258
+ const t3 = n2.getNodeSpec(e3.type), i5 = t3?.wrapper?.(e3);
2259
+ i5 && r2 && i5.key === r2.key ? o2.push(e3.id) : i5 ? (r2 && o2.length > 0 && s2.push({ spec: r2, blockIds: o2 }), r2 = i5, o2 = [e3.id]) : (r2 && o2.length > 0 && s2.push({ spec: r2, blockIds: o2 }), r2 = null, o2 = []);
2090
2260
  }
2091
2261
  r2 && o2.length > 0 && s2.push({ spec: r2, blockIds: o2 });
2092
2262
  for (const t3 of s2) {
@@ -2101,32 +2271,32 @@ function Ct(e2, t2, n2) {
2101
2271
  }
2102
2272
  }
2103
2273
  }
2104
- function Bt(e2) {
2274
+ function pn(e2) {
2105
2275
  const t2 = e2.getRootNode();
2106
2276
  return t2 instanceof ShadowRoot && "getSelection" in t2 ? t2.getSelection() : window.getSelection();
2107
2277
  }
2108
- function Rt(e2, t2) {
2109
- const n2 = Bt(e2);
2278
+ function fn(e2, t2) {
2279
+ const n2 = pn(e2);
2110
2280
  if (!n2) return;
2111
- if ($(t2)) {
2281
+ if (Q(t2)) {
2112
2282
  const s3 = e2.querySelector(`[data-block-id="${t2.nodeId}"]`);
2113
2283
  if (!s3) return;
2114
2284
  const r3 = s3.parentNode;
2115
2285
  if (!r3) return;
2116
- const o2 = Lt(r3, s3);
2286
+ const o2 = kn(r3, s3);
2117
2287
  try {
2118
2288
  n2.setBaseAndExtent(r3, o2, r3, o2 + 1);
2119
2289
  } catch {
2120
2290
  }
2121
2291
  return;
2122
2292
  }
2123
- const s2 = At(e2, t2.anchor), r2 = At(e2, t2.head);
2293
+ const s2 = gn(e2, t2.anchor), r2 = gn(e2, t2.head);
2124
2294
  if (s2 && r2) try {
2125
2295
  n2.setBaseAndExtent(s2.node, s2.offset, r2.node, r2.offset);
2126
2296
  } catch {
2127
2297
  }
2128
2298
  }
2129
- function At(e2, t2) {
2299
+ function gn(e2, t2) {
2130
2300
  let n2 = null;
2131
2301
  if (t2.path && t2.path.length > 0) {
2132
2302
  let s3 = e2;
@@ -2138,29 +2308,29 @@ function At(e2, t2) {
2138
2308
  s3 !== e2 && s3.getAttribute("data-block-id") === t2.blockId && (n2 = s3);
2139
2309
  }
2140
2310
  if (n2 ??= e2.querySelector(`[data-block-id="${t2.blockId}"]`), !n2) return null;
2141
- const s2 = _t(n2);
2311
+ const s2 = bn(n2);
2142
2312
  if (1 === s2.childNodes.length && "BR" === s2.firstChild?.nodeName) return { node: s2, offset: 0 };
2143
2313
  let r2 = t2.offset;
2144
- const o2 = Dt(s2);
2145
- let i3 = o2.nextNode();
2146
- for (; i3; ) {
2147
- if (i3.nodeType === Node.TEXT_NODE) {
2148
- const e3 = i3.textContent?.length ?? 0;
2149
- if (r2 <= e3) return { node: i3, offset: r2 };
2314
+ const o2 = yn(s2);
2315
+ let i5 = o2.nextNode();
2316
+ for (; i5; ) {
2317
+ if (i5.nodeType === Node.TEXT_NODE) {
2318
+ const e3 = i5.textContent?.length ?? 0;
2319
+ if (r2 <= e3) return { node: i5, offset: r2 };
2150
2320
  r2 -= e3;
2151
- } else if (i3 instanceof HTMLElement && "false" === i3.getAttribute("contenteditable")) {
2321
+ } else if (i5 instanceof HTMLElement && "false" === i5.getAttribute("contenteditable")) {
2152
2322
  if (0 === r2) {
2153
- const e3 = i3.parentNode;
2154
- if (e3) return { node: e3, offset: Lt(e3, i3) };
2323
+ const e3 = i5.parentNode;
2324
+ if (e3) return { node: e3, offset: kn(e3, i5) };
2155
2325
  }
2156
2326
  r2 -= 1;
2157
2327
  }
2158
- i3 = o2.nextNode();
2328
+ i5 = o2.nextNode();
2159
2329
  }
2160
- const a4 = s2.lastChild;
2161
- return a4 ? a4.nodeType === Node.TEXT_NODE ? { node: a4, offset: a4.textContent?.length ?? 0 } : { node: s2, offset: s2.childNodes.length } : { node: s2, offset: 0 };
2330
+ const a18 = s2.lastChild;
2331
+ return a18 ? a18.nodeType === Node.TEXT_NODE ? { node: a18, offset: a18.textContent?.length ?? 0 } : { node: s2, offset: s2.childNodes.length } : { node: s2, offset: 0 };
2162
2332
  }
2163
- function Pt(e2, t2, n2) {
2333
+ function mn(e2, t2, n2) {
2164
2334
  const s2 = (function(e3, t3) {
2165
2335
  let n3 = t3;
2166
2336
  for (; n3 && n3 !== e3; ) {
@@ -2172,40 +2342,40 @@ function Pt(e2, t2, n2) {
2172
2342
  if (!s2) return null;
2173
2343
  const r2 = s2.getAttribute("data-block-id");
2174
2344
  if (!r2) return null;
2175
- const o2 = pe(r2), i3 = (function(e3, t3) {
2345
+ const o2 = Ee(r2), i5 = (function(e3, t3) {
2176
2346
  const n3 = [];
2177
2347
  let s3 = t3;
2178
- for (; s3 && s3 !== e3; ) s3.hasAttribute("data-block-id") && n3.unshift(pe(s3.getAttribute("data-block-id") ?? "")), s3 = s3.parentElement;
2348
+ for (; s3 && s3 !== e3; ) s3.hasAttribute("data-block-id") && n3.unshift(Ee(s3.getAttribute("data-block-id") ?? "")), s3 = s3.parentElement;
2179
2349
  return n3;
2180
- })(e2, s2), a4 = _t(s2);
2181
- if (t2 === s2 || t2 === a4) {
2182
- const e3 = t2 === a4 ? a4 : s2;
2183
- let r3 = 0, c4 = 0;
2350
+ })(e2, s2), a18 = bn(s2);
2351
+ if (t2 === s2 || t2 === a18) {
2352
+ const e3 = t2 === a18 ? a18 : s2;
2353
+ let r3 = 0, c9 = 0;
2184
2354
  for (const t3 of Array.from(e3.childNodes)) {
2185
- if (c4 >= n2) break;
2186
- r3 += Ot(t3), c4++;
2355
+ if (c9 >= n2) break;
2356
+ r3 += Sn(t3), c9++;
2187
2357
  }
2188
- return U(o2, r3, i3.length > 1 ? i3 : void 0);
2358
+ return Z(o2, r3, i5.length > 1 ? i5 : void 0);
2189
2359
  }
2190
- if (a4 !== s2 && !a4.contains(t2)) return U(o2, 0, i3.length > 1 ? i3 : void 0);
2191
- let c3 = 0;
2192
- const l2 = Dt(a4);
2193
- let h3 = l2.nextNode();
2194
- for (; h3; ) {
2195
- if (h3 === t2) return h3.nodeType === Node.TEXT_NODE ? U(o2, c3 + n2, i3.length > 1 ? i3 : void 0) : U(o2, c3, i3.length > 1 ? i3 : void 0);
2196
- h3.nodeType === Node.TEXT_NODE ? c3 += h3.textContent?.length ?? 0 : h3 instanceof HTMLElement && "false" === h3.getAttribute("contenteditable") && (c3 += 1), h3 = l2.nextNode();
2360
+ if (a18 !== s2 && !a18.contains(t2)) return Z(o2, 0, i5.length > 1 ? i5 : void 0);
2361
+ let c8 = 0;
2362
+ const l2 = yn(a18);
2363
+ let h4 = l2.nextNode();
2364
+ for (; h4; ) {
2365
+ if (h4 === t2) return h4.nodeType === Node.TEXT_NODE ? Z(o2, c8 + n2, i5.length > 1 ? i5 : void 0) : Z(o2, c8, i5.length > 1 ? i5 : void 0);
2366
+ h4.nodeType === Node.TEXT_NODE ? c8 += h4.textContent?.length ?? 0 : h4 instanceof HTMLElement && "false" === h4.getAttribute("contenteditable") && (c8 += 1), h4 = l2.nextNode();
2197
2367
  }
2198
2368
  if (t2.nodeType === Node.ELEMENT_NODE) {
2199
2369
  let e3 = 0, s3 = 0;
2200
2370
  for (const r3 of Array.from(t2.childNodes)) {
2201
2371
  if (s3 >= n2) break;
2202
- e3 += Ot(r3), s3++;
2372
+ e3 += Sn(r3), s3++;
2203
2373
  }
2204
- return U(o2, e3, i3.length > 1 ? i3 : void 0);
2374
+ return Z(o2, e3, i5.length > 1 ? i5 : void 0);
2205
2375
  }
2206
- return U(o2, 0, i3.length > 1 ? i3 : void 0);
2376
+ return Z(o2, 0, i5.length > 1 ? i5 : void 0);
2207
2377
  }
2208
- function Dt(e2) {
2378
+ function yn(e2) {
2209
2379
  return document.createTreeWalker(e2, NodeFilter.SHOW_ALL, { acceptNode: (t2) => (function(e3, t3) {
2210
2380
  let n2 = e3.parentNode;
2211
2381
  for (; n2 && n2 !== t3; ) {
@@ -2215,7 +2385,7 @@ function Dt(e2) {
2215
2385
  return false;
2216
2386
  })(t2, e2) || t2 instanceof HTMLElement && t2.hasAttribute("data-block-id") && t2 !== e2 ? NodeFilter.FILTER_REJECT : t2.nodeType === Node.TEXT_NODE || t2 instanceof HTMLElement && "false" === t2.getAttribute("contenteditable") ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP });
2217
2387
  }
2218
- function Lt(e2, t2) {
2388
+ function kn(e2, t2) {
2219
2389
  let n2 = 0;
2220
2390
  for (const s2 of Array.from(e2.childNodes)) {
2221
2391
  if (s2 === t2) return n2;
@@ -2223,17 +2393,17 @@ function Lt(e2, t2) {
2223
2393
  }
2224
2394
  return n2;
2225
2395
  }
2226
- function _t(e2) {
2396
+ function bn(e2) {
2227
2397
  return e2.querySelector("[data-content-dom]") ?? e2;
2228
2398
  }
2229
- function Ot(e2) {
2399
+ function Sn(e2) {
2230
2400
  if (e2.nodeType === Node.TEXT_NODE) return e2.textContent?.length ?? 0;
2231
2401
  if (e2 instanceof HTMLElement && "false" === e2.getAttribute("contenteditable")) return 1;
2232
2402
  let t2 = 0;
2233
- for (const n2 of Array.from(e2.childNodes)) t2 += Ot(n2);
2403
+ for (const n2 of Array.from(e2.childNodes)) t2 += Sn(n2);
2234
2404
  return t2;
2235
2405
  }
2236
- class Ht {
2406
+ class vn {
2237
2407
  state;
2238
2408
  contentElement;
2239
2409
  inputHandler;
@@ -2250,10 +2420,10 @@ class Ht {
2250
2420
  pendingNodeSelectionClear = false;
2251
2421
  schemaRegistry;
2252
2422
  nodeViews = /* @__PURE__ */ new Map();
2253
- decorations = we.empty;
2423
+ decorations = De.empty;
2254
2424
  getDecorations;
2255
2425
  constructor(e2, t2) {
2256
- this.state = t2.state, this.contentElement = e2, this.schemaRegistry = t2.schemaRegistry, this.getDecorations = t2.getDecorations, this.history = new We({ maxDepth: t2.maxHistoryDepth ?? 100 }), t2.onStateChange && this.stateChangeCallbacks.push(t2.onStateChange), this.inputHandler = new ht(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), syncSelection: () => this.syncSelectionFromDOM(), schemaRegistry: this.schemaRegistry }), this.keyboardHandler = new Xe(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), undo: () => this.undo(), redo: () => this.redo(), schemaRegistry: this.schemaRegistry }), this.pasteHandler = new mt(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), schemaRegistry: this.schemaRegistry }), this.clipboardHandler = new Ge(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), schemaRegistry: this.schemaRegistry, syncSelection: () => this.syncSelectionFromDOM() }), this.handleSelectionChange = this.onSelectionChange.bind(this), document.addEventListener("selectionchange", this.handleSelectionChange), this.handleMousedown = this.onMousedown.bind(this), e2.addEventListener("mousedown", this.handleMousedown), this.handleDragover = this.onDragover.bind(this), e2.addEventListener("dragover", this.handleDragover), this.handleDrop = this.onDrop.bind(this), e2.addEventListener("drop", this.handleDrop), this.decorations = this.getDecorations?.(this.state) ?? we.empty, yt(e2, null, this.state, { ...this.reconcileOptions(), decorations: this.decorations }), Rt(e2, this.state.selection);
2426
+ this.state = t2.state, this.contentElement = e2, this.schemaRegistry = t2.schemaRegistry, this.getDecorations = t2.getDecorations, this.history = new lt({ maxDepth: t2.maxHistoryDepth ?? 100 }), t2.onStateChange && this.stateChangeCallbacks.push(t2.onStateChange), this.inputHandler = new qt(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), syncSelection: () => this.syncSelectionFromDOM(), schemaRegistry: this.schemaRegistry }), this.keyboardHandler = new ht(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), undo: () => this.undo(), redo: () => this.redo(), schemaRegistry: this.schemaRegistry }), this.pasteHandler = new Yt(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), schemaRegistry: this.schemaRegistry }), this.clipboardHandler = new pt(e2, { getState: () => this.state, dispatch: (e3) => this.dispatch(e3), schemaRegistry: this.schemaRegistry, syncSelection: () => this.syncSelectionFromDOM() }), this.handleSelectionChange = this.onSelectionChange.bind(this), document.addEventListener("selectionchange", this.handleSelectionChange), this.handleMousedown = this.onMousedown.bind(this), e2.addEventListener("mousedown", this.handleMousedown), this.handleDragover = this.onDragover.bind(this), e2.addEventListener("dragover", this.handleDragover), this.handleDrop = this.onDrop.bind(this), e2.addEventListener("drop", this.handleDrop), this.decorations = this.getDecorations?.(this.state) ?? De.empty, Zt(e2, null, this.state, { ...this.reconcileOptions(), decorations: this.decorations }), fn(e2, this.state.selection);
2257
2427
  }
2258
2428
  getState() {
2259
2429
  return this.state;
@@ -2264,8 +2434,8 @@ class Ht {
2264
2434
  try {
2265
2435
  const s2 = this.state;
2266
2436
  this.state = e2, n2?.pushHistory && "history" !== t2.metadata.origin && this.history.push(t2);
2267
- const r2 = this.decorations, o2 = this.getDecorations?.(e2, t2) ?? we.empty;
2268
- this.decorations = o2, yt(this.contentElement, s2, e2, { ...this.reconcileOptions(s2.selection), decorations: o2, oldDecorations: r2 }), Rt(this.contentElement, e2.selection);
2437
+ const r2 = this.decorations, o2 = this.getDecorations?.(e2, t2) ?? De.empty;
2438
+ this.decorations = o2, Zt(this.contentElement, s2, e2, { ...this.reconcileOptions(s2.selection), decorations: o2, oldDecorations: r2 }), fn(this.contentElement, e2.selection);
2269
2439
  for (const n3 of this.stateChangeCallbacks) n3(s2, e2, t2);
2270
2440
  } finally {
2271
2441
  this.isUpdating = false;
@@ -2298,27 +2468,27 @@ class Ht {
2298
2468
  try {
2299
2469
  const t2 = this.state;
2300
2470
  this.state = e2, this.history.clear();
2301
- const n2 = this.decorations, s2 = this.getDecorations?.(e2) ?? we.empty;
2302
- this.decorations = s2, yt(this.contentElement, t2, e2, { ...this.reconcileOptions(t2.selection), decorations: s2, oldDecorations: n2 }), Rt(this.contentElement, e2.selection);
2471
+ const n2 = this.decorations, s2 = this.getDecorations?.(e2) ?? De.empty;
2472
+ this.decorations = s2, Zt(this.contentElement, t2, e2, { ...this.reconcileOptions(t2.selection), decorations: s2, oldDecorations: n2 }), fn(this.contentElement, e2.selection);
2303
2473
  } finally {
2304
2474
  this.isUpdating = false;
2305
2475
  }
2306
2476
  }
2307
2477
  }
2308
2478
  syncSelectionFromDOM() {
2309
- if ($(this.state.selection) && !this.pendingNodeSelectionClear) return;
2479
+ if (Q(this.state.selection) && !this.pendingNodeSelectionClear) return;
2310
2480
  this.pendingNodeSelectionClear = false;
2311
2481
  const e2 = (function(e3) {
2312
- const t3 = Bt(e3);
2482
+ const t3 = pn(e3);
2313
2483
  if (!t3 || 0 === t3.rangeCount) return null;
2314
2484
  const n3 = t3.anchorNode, s2 = t3.focusNode;
2315
2485
  if (!n3 || !s2) return null;
2316
2486
  if (!e3.contains(n3) || !e3.contains(s2)) return null;
2317
- const r2 = Pt(e3, n3, t3.anchorOffset), o2 = Pt(e3, s2, t3.focusOffset);
2318
- return r2 && o2 ? j(r2, o2) : null;
2487
+ const r2 = mn(e3, n3, t3.anchorOffset), o2 = mn(e3, s2, t3.focusOffset);
2488
+ return r2 && o2 ? Y(r2, o2) : null;
2319
2489
  })(this.contentElement);
2320
2490
  if (!e2) return;
2321
- if (W(e2, this.state.selection)) return;
2491
+ if (se(e2, this.state.selection)) return;
2322
2492
  const t2 = this.state.transaction("input").setSelection(e2).setStoredMarks(null, this.state.storedMarks).build(), n2 = this.state.apply(t2);
2323
2493
  this.applyUpdate(n2, t2);
2324
2494
  }
@@ -2328,33 +2498,34 @@ class Ht {
2328
2498
  if (!(t2 instanceof HTMLElement)) return;
2329
2499
  const n2 = t2.closest("[data-block-id]");
2330
2500
  if (!(n2 instanceof HTMLElement && this.contentElement.contains(n2))) return void ((this.contentElement.contains(t2) || t2 === this.contentElement) && this.handleClickBelowContent(e2));
2331
- if (!n2.hasAttribute("data-void") && !n2.hasAttribute("data-selectable")) return void ($(this.state.selection) && (this.pendingNodeSelectionClear = true));
2501
+ if (!n2.hasAttribute("data-void") && !n2.hasAttribute("data-selectable")) return void (Q(this.state.selection) && (this.pendingNodeSelectionClear = true));
2332
2502
  const s2 = n2.querySelector("[data-content-dom]");
2333
- if (s2?.contains(t2)) return void ($(this.state.selection) && (this.pendingNodeSelectionClear = true));
2503
+ if (s2?.contains(t2)) return void (Q(this.state.selection) && (this.pendingNodeSelectionClear = true));
2334
2504
  e2.preventDefault(), this.contentElement.focus();
2335
- const r2 = pe(n2.getAttribute("data-block-id") ?? ""), o2 = this.buildBlockPath(n2), i3 = H(r2, o2), a4 = this.state.transaction("input").setSelection(i3).setStoredMarks(null, this.state.storedMarks).build(), c3 = this.state.apply(a4);
2336
- this.applyUpdate(c3, a4);
2505
+ const r2 = Ee(n2.getAttribute("data-block-id") ?? ""), o2 = this.buildBlockPath(n2), i5 = X(r2, o2), a18 = this.state.transaction("input").setSelection(i5).setStoredMarks(null, this.state.storedMarks).build(), c8 = this.state.apply(a18);
2506
+ this.applyUpdate(c8, a18);
2337
2507
  }
2338
2508
  handleClickBelowContent(e2) {
2509
+ if ("false" === this.contentElement.contentEditable) return;
2339
2510
  const t2 = this.state.getBlockOrder(), n2 = t2[t2.length - 1];
2340
2511
  if (!n2) return;
2341
2512
  const s2 = this.contentElement.querySelector(`[data-block-id="${n2}"]`);
2342
2513
  if (!s2) return;
2343
2514
  const o2 = s2.getBoundingClientRect();
2344
2515
  if (e2.clientY <= o2.bottom) return;
2345
- const i3 = this.state.getBlock(n2);
2346
- if ("paragraph" === i3?.type && 0 === r(i3)) {
2347
- const t3 = this.state.transaction("input").setSelection(F(n2, 0)).build();
2516
+ const i5 = this.state.getBlock(n2);
2517
+ if ("paragraph" === i5?.type && 0 === r(i5)) {
2518
+ const t3 = this.state.transaction("input").setSelection(J(n2, 0)).build();
2348
2519
  return this.dispatch(t3), void e2.preventDefault();
2349
2520
  }
2350
2521
  e2.preventDefault(), this.contentElement.focus();
2351
- const a4 = L(), c3 = i3 ? r(i3) : 0, l2 = this.state.transaction("input").splitBlock(n2, c3, a4).setBlockType(a4, fe("paragraph")).setSelection(F(a4, 0)).build();
2522
+ const a18 = q(), c8 = i5 ? r(i5) : 0, l2 = this.state.transaction("input").splitBlock(n2, c8, a18).setBlockType(a18, Te("paragraph")).setSelection(J(a18, 0)).build();
2352
2523
  this.dispatch(l2);
2353
2524
  }
2354
2525
  buildBlockPath(e2) {
2355
2526
  const t2 = [];
2356
2527
  let n2 = e2;
2357
- for (; n2 && n2 !== this.contentElement; ) n2.hasAttribute("data-block-id") && t2.unshift(pe(n2.getAttribute("data-block-id") ?? "")), n2 = n2.parentElement;
2528
+ for (; n2 && n2 !== this.contentElement; ) n2.hasAttribute("data-block-id") && t2.unshift(Ee(n2.getAttribute("data-block-id") ?? "")), n2 = n2.parentElement;
2358
2529
  return t2;
2359
2530
  }
2360
2531
  onDragover(e2) {
@@ -2386,7 +2557,7 @@ class Ht {
2386
2557
  const o2 = n2.caretRangeFromPoint(e2, t2);
2387
2558
  o2 && (s2 = o2.startContainer, r2 = o2.startOffset);
2388
2559
  }
2389
- return s2 && this.contentElement.contains(s2) ? Pt(this.contentElement, s2, r2) : null;
2560
+ return s2 && this.contentElement.contains(s2) ? mn(this.contentElement, s2, r2) : null;
2390
2561
  }
2391
2562
  onSelectionChange() {
2392
2563
  if (this.isUpdating) return;
@@ -2394,7 +2565,7 @@ class Ht {
2394
2565
  (this.contentElement.contains(t2) || t2 === this.contentElement) && this.syncSelectionFromDOM();
2395
2566
  }
2396
2567
  reconcileOptions(e2) {
2397
- const t2 = $(this.state.selection) ? this.state.selection.nodeId : void 0, n2 = e2 && $(e2) ? e2.nodeId : void 0;
2568
+ const t2 = Q(this.state.selection) ? this.state.selection.nodeId : void 0, n2 = e2 && Q(e2) ? e2.nodeId : void 0;
2398
2569
  return { registry: this.schemaRegistry, nodeViews: this.nodeViews, getState: () => this.state, dispatch: (e3) => this.dispatch(e3), selectedNodeId: t2, previousSelectedNodeId: n2 };
2399
2570
  }
2400
2571
  destroy() {
@@ -2403,29 +2574,29 @@ class Ht {
2403
2574
  this.nodeViews.clear();
2404
2575
  }
2405
2576
  }
2406
- const zt = { paragraph: "Paragraph", heading: "Heading", code_block: "Code Block", blockquote: "Block Quote", list_item: "List Item", horizontal_rule: "Horizontal Rule", image: "Image", table: "Table" };
2407
- function Ft(e2, t2) {
2408
- return "heading" === e2 && t2?.level ? `Heading ${t2.level}` : zt[e2] ?? e2;
2577
+ const wn = { paragraph: "Paragraph", heading: "Heading", code_block: "Code Block", blockquote: "Block Quote", list_item: "List Item", horizontal_rule: "Horizontal Rule", image: "Image", table: "Table" };
2578
+ function En(e2, t2) {
2579
+ return "heading" === e2 && t2?.level ? `Heading ${t2.level}` : wn[e2] ?? e2;
2409
2580
  }
2410
- function $t(e2, t2) {
2581
+ function Tn(e2, t2) {
2411
2582
  const n2 = [];
2412
- return jt(e2, [], n2, t2?.getMarkParseRules() ?? []), n2.length > 0 ? n2 : [g("")];
2583
+ return xn(e2, [], n2, t2?.getMarkParseRules() ?? []), n2.length > 0 ? n2 : [N("")];
2413
2584
  }
2414
- function jt(e2, t2, n2, s2) {
2585
+ function xn(e2, t2, n2, s2) {
2415
2586
  if (e2.nodeType === Node.TEXT_NODE) {
2416
2587
  const s3 = e2.textContent ?? "";
2417
- return void (s3 && n2.push(g(s3, [...t2])));
2588
+ return void (s3 && n2.push(N(s3, [...t2])));
2418
2589
  }
2419
2590
  if (e2.nodeType !== Node.ELEMENT_NODE) return;
2420
- const r2 = e2, o2 = r2.tagName.toLowerCase(), i3 = [...t2], a4 = /* @__PURE__ */ new Set();
2421
- for (const e3 of s2) if (e3.rule.tag === o2 && !a4.has(e3.type)) if (e3.rule.getAttrs) {
2591
+ const r2 = e2, o2 = r2.tagName.toLowerCase(), i5 = [...t2], a18 = /* @__PURE__ */ new Set();
2592
+ for (const e3 of s2) if (e3.rule.tag === o2 && !a18.has(e3.type)) if (e3.rule.getAttrs) {
2422
2593
  const t3 = e3.rule.getAttrs(r2);
2423
2594
  if (false === t3) continue;
2424
- i3.some((t4) => t4.type === e3.type) || (i3.push({ type: ge(e3.type), ...Object.keys(t3).length > 0 ? { attrs: t3 } : {} }), a4.add(e3.type));
2425
- } else i3.some((t3) => t3.type === e3.type) || (i3.push({ type: ge(e3.type) }), a4.add(e3.type));
2426
- for (const e3 of Array.from(r2.childNodes)) jt(e3, i3, n2, s2);
2595
+ i5.some((t4) => t4.type === e3.type) || (i5.push({ type: xe(e3.type), ...Object.keys(t3).length > 0 ? { attrs: t3 } : {} }), a18.add(e3.type));
2596
+ } else i5.some((t3) => t3.type === e3.type) || (i5.push({ type: xe(e3.type) }), a18.add(e3.type));
2597
+ for (const e3 of Array.from(r2.childNodes)) xn(e3, i5, n2, s2);
2427
2598
  }
2428
- function Ut(e2, t2) {
2599
+ function Nn(e2, t2) {
2429
2600
  const n2 = e2.tagName.toLowerCase();
2430
2601
  for (const s2 of t2) if (s2.rule.tag === n2) {
2431
2602
  if (s2.rule.getAttrs) {
@@ -2437,23 +2608,23 @@ function Ut(e2, t2) {
2437
2608
  }
2438
2609
  return null;
2439
2610
  }
2440
- function Kt(t2, n2) {
2441
- const s2 = (function(t3, n3) {
2442
- const s3 = e(t3), r3 = [];
2443
- for (const e2 of s3) if (d(e2)) {
2444
- const t4 = n3?.getInlineNodeSpec(e2.inlineType);
2445
- t4?.toHTMLString && r3.push(t4.toHTMLString(e2));
2446
- } else r3.push(Vt(e2, n3));
2611
+ function Cn(e2, n2) {
2612
+ const s2 = (function(e3, n3) {
2613
+ const s3 = t(e3), r3 = [];
2614
+ for (const e4 of s3) if (E(e4)) {
2615
+ const t2 = n3?.getInlineNodeSpec(e4.inlineType);
2616
+ t2?.toHTMLString && r3.push(t2.toHTMLString(e4));
2617
+ } else r3.push(Ln(e4, n3));
2447
2618
  return r3.join("");
2448
- })(t2, n2), r2 = n2?.getNodeSpec(t2.type);
2619
+ })(e2, n2), r2 = n2?.getNodeSpec(e2.type);
2449
2620
  let o2;
2450
- o2 = r2?.toHTML ? r2.toHTML(t2, s2) : `<p>${s2 || "<br>"}</p>`;
2451
- const i3 = t2.attrs?.align;
2452
- return i3 && "left" !== i3 && (o2 = o2.replace(/>/, ` style="text-align: ${i3}">`)), o2;
2621
+ o2 = r2?.toHTML ? r2.toHTML(e2, s2) : `<p>${s2 || "<br>"}</p>`;
2622
+ const i5 = e2.attrs?.align;
2623
+ return i5 && "left" !== i5 && (o2 = o2.replace(/>/, ` style="text-align: ${i5}">`)), o2;
2453
2624
  }
2454
- function Vt(e2, t2) {
2625
+ function Ln(e2, t2) {
2455
2626
  if ("" === e2.text) return "";
2456
- let n2 = ke(e2.text);
2627
+ let n2 = Le(e2.text);
2457
2628
  const s2 = (function(e3) {
2458
2629
  if (!e3) return /* @__PURE__ */ new Map();
2459
2630
  const t3 = e3.getMarkTypes(), n3 = /* @__PURE__ */ new Map();
@@ -2469,9 +2640,9 @@ function Vt(e2, t2) {
2469
2640
  }
2470
2641
  return n2;
2471
2642
  }
2472
- const qt = ["\n:host {\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n color: var(--notectl-fg);\n}\n\n.notectl-editor {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n overflow: hidden;\n background: var(--notectl-bg);\n}\n\n.notectl-editor:focus-within {\n border-color: var(--notectl-border-focus);\n box-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n/* Content Area */\n.notectl-content {\n flex: 1;\n padding: 12px 16px;\n outline: none;\n min-height: var(--notectl-content-min-height, 400px);\n cursor: text;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n -moz-tab-size: 4;\n tab-size: 4;\n}\n\n.notectl-content p {\n margin: 0;\n padding: 2px 0;\n min-height: 1.6em;\n}\n\n.notectl-content p + p {\n margin-top: 0;\n}\n\n/* Horizontal Rule */\n.notectl-content hr {\n border: none;\n border-top: 1px solid var(--notectl-border);\n margin: 8px 0;\n padding: 0;\n cursor: default;\n user-select: none;\n}\n\n/* Placeholder */\n.notectl-content.notectl-content--empty::before {\n content: attr(data-placeholder);\n color: var(--notectl-fg-muted);\n pointer-events: none;\n position: absolute;\n top: 12px;\n left: 16px;\n}\n\n/* Plugin container bottom */\n.notectl-plugin-container--bottom {\n border-top: 1px solid var(--notectl-border);\n}\n\n/* Screen reader announcements */\n.notectl-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n/* Node selection */\n.notectl-node-selected {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n}\n", "\n@media (prefers-reduced-motion: reduce) {\n .notectl-toolbar-btn,\n .notectl-image__resize-handle,\n .notectl-image__size-indicator,\n .notectl-color-picker__swatch,\n .notectl-font-picker__item,\n .notectl-heading-picker__item,\n .notectl-font-size-picker__item,\n .ntbl-handle,\n .ntbl-handle-delete,\n .ntbl-insert-line,\n .ntbl-insert-btn,\n .ntbl-add-zone,\n .ntbl-add-icon,\n .ntbl-col-bar,\n .ntbl-row-bar,\n .ntbl-delete-table-btn,\n .notectl-code-block__copy {\n transition: none !important;\n }\n}\n"].join("\n");
2473
- let Wt = null;
2474
- class Xt {
2643
+ const An = ["\n:host {\n display: block;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 16px;\n line-height: 1.6;\n color: var(--notectl-fg);\n}\n\n.notectl-editor {\n display: flex;\n flex-direction: column;\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n overflow: hidden;\n background: var(--notectl-bg);\n}\n\n.notectl-editor:focus-within {\n border-color: var(--notectl-border-focus);\n box-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n/* Content Area */\n.notectl-content {\n flex: 1;\n padding: 12px 16px;\n outline: none;\n min-height: var(--notectl-content-min-height, 400px);\n cursor: text;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n -moz-tab-size: 4;\n tab-size: 4;\n}\n\n.notectl-content p {\n margin: 0;\n padding: 2px 0;\n min-height: 1.6em;\n}\n\n.notectl-content p + p {\n margin-top: 0;\n}\n\n/* Horizontal Rule */\n.notectl-content hr {\n border: none;\n border-top: 1px solid var(--notectl-border);\n margin: 8px 0;\n padding: 0;\n cursor: default;\n user-select: none;\n}\n\n/* Placeholder */\n.notectl-content.notectl-content--empty::before {\n content: attr(data-placeholder);\n color: var(--notectl-fg-muted);\n pointer-events: none;\n position: absolute;\n top: 12px;\n left: 16px;\n}\n\n/* Plugin container bottom */\n.notectl-plugin-container--bottom {\n border-top: 1px solid var(--notectl-border);\n}\n\n/* Screen reader announcements */\n.notectl-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n\n/* Node selection */\n.notectl-node-selected {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n}\n", "\n@media (prefers-reduced-motion: reduce) {\n .notectl-toolbar-btn,\n .notectl-image__resize-handle,\n .notectl-image__size-indicator,\n .notectl-color-picker__swatch,\n .notectl-font-picker__item,\n .notectl-heading-picker__item,\n .notectl-font-size-picker__item,\n .ntbl-handle,\n .ntbl-handle-delete,\n .ntbl-insert-line,\n .ntbl-insert-btn,\n .ntbl-add-zone,\n .ntbl-add-icon,\n .ntbl-col-bar,\n .ntbl-row-bar,\n .ntbl-delete-table-btn,\n .notectl-code-block__copy {\n transition: none !important;\n }\n}\n", '\n/* Paper viewport: scroll container with centered gray background */\n.notectl-paper-viewport {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n background: var(--notectl-paper-viewport-bg, #e8e8e8);\n padding: 24px 0;\n}\n\n/* Paper surface: white page with shadow, centered */\n.notectl-paper-surface {\n margin: 0 auto;\n background: var(--notectl-bg);\n border-radius: 2px;\n box-shadow: 0 2px 8px var(--notectl-shadow, rgba(0, 0, 0, 0.15));\n transform-origin: top center;\n transition: transform 0.15s ease-out;\n}\n\n/* Content overrides in paper mode: wider document margins */\n.notectl-editor[data-paper-mode] .notectl-content {\n flex: none;\n padding: 48px 56px;\n min-height: auto;\n}\n\n/* Placeholder position override for paper mode */\n.notectl-editor[data-paper-mode] .notectl-content.notectl-content--empty::before {\n top: 48px;\n left: 56px;\n}\n\n/* Dark mode: darker viewport background */\n:host([theme="dark"]) .notectl-paper-viewport {\n --notectl-paper-viewport-bg: #181825;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .notectl-paper-surface {\n transition: none !important;\n }\n}\n'].join("\n");
2644
+ let In = null;
2645
+ class Mn {
2475
2646
  themeStyleSheet = new CSSStyleSheet();
2476
2647
  systemThemeQuery = null;
2477
2648
  systemThemeHandler = null;
@@ -2481,11 +2652,11 @@ class Xt {
2481
2652
  this.shadow = e2;
2482
2653
  }
2483
2654
  apply(e2) {
2484
- if (this.cleanupSystemThemeListener(), e2 === et.System) {
2655
+ if (this.cleanupSystemThemeListener(), e2 === _t.System) {
2485
2656
  this.setupSystemThemeListener();
2486
- const e3 = rt(this.getSystemTheme());
2657
+ const e3 = zt(this.getSystemTheme());
2487
2658
  this.setThemeStyleSheet(e3);
2488
- } else this.setThemeStyleSheet(rt(e2));
2659
+ } else this.setThemeStyleSheet(zt(e2));
2489
2660
  }
2490
2661
  setPluginStyleSheets(e2) {
2491
2662
  this.pluginSheets = e2, this.refreshAdoptedStyleSheets();
@@ -2494,14 +2665,14 @@ class Xt {
2494
2665
  this.cleanupSystemThemeListener();
2495
2666
  }
2496
2667
  setThemeStyleSheet(e2) {
2497
- this.themeStyleSheet.replaceSync(ct(e2)), this.refreshAdoptedStyleSheets();
2668
+ this.themeStyleSheet.replaceSync(Ut(e2)), this.refreshAdoptedStyleSheets();
2498
2669
  }
2499
2670
  refreshAdoptedStyleSheets() {
2500
- this.shadow.adoptedStyleSheets = [this.themeStyleSheet, (Wt || (Wt = new CSSStyleSheet(), Wt.replaceSync(qt)), Wt), ...this.pluginSheets];
2671
+ this.shadow.adoptedStyleSheets = [this.themeStyleSheet, (In || (In = new CSSStyleSheet(), In.replaceSync(An)), In), ...this.pluginSheets];
2501
2672
  }
2502
2673
  setupSystemThemeListener() {
2503
2674
  this.systemThemeQuery = window.matchMedia("(prefers-color-scheme: dark)"), this.systemThemeHandler = (e2) => {
2504
- const t2 = rt(this.getSystemTheme());
2675
+ const t2 = zt(this.getSystemTheme());
2505
2676
  this.setThemeStyleSheet(t2);
2506
2677
  }, this.systemThemeQuery.addEventListener("change", this.systemThemeHandler);
2507
2678
  }
@@ -2509,10 +2680,70 @@ class Xt {
2509
2680
  this.systemThemeQuery && this.systemThemeHandler && this.systemThemeQuery.removeEventListener("change", this.systemThemeHandler), this.systemThemeQuery = null, this.systemThemeHandler = null;
2510
2681
  }
2511
2682
  getSystemTheme() {
2512
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? et.Dark : et.Light;
2683
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? _t.Dark : _t.Light;
2684
+ }
2685
+ }
2686
+ class Bn {
2687
+ wrapper;
2688
+ content;
2689
+ viewport = null;
2690
+ surface = null;
2691
+ viewportObserver = null;
2692
+ surfaceObserver = null;
2693
+ currentSize = null;
2694
+ currentPaperWidthPx = 0;
2695
+ currentPaperHeightPx = 0;
2696
+ currentScale = 1;
2697
+ constructor(e2, t2) {
2698
+ this.wrapper = e2, this.content = t2;
2699
+ }
2700
+ apply(e2) {
2701
+ if (null === e2) return void this.disable();
2702
+ const t2 = Tt(e2);
2703
+ this.currentPaperWidthPx = t2.widthPx, this.currentPaperHeightPx = t2.heightPx, this.currentSize = e2, this.viewport || this.enable(), this.updateSurfaceDimensions(), this.wrapper.setAttribute("data-paper-mode", e2);
2704
+ }
2705
+ destroy() {
2706
+ this.disable();
2707
+ }
2708
+ getPaperSize() {
2709
+ return this.currentSize;
2710
+ }
2711
+ enable() {
2712
+ this.viewport = document.createElement("div"), this.viewport.className = "notectl-paper-viewport", this.surface = document.createElement("div"), this.surface.className = "notectl-paper-surface", this.wrapper.removeChild(this.content), this.surface.appendChild(this.content), this.viewport.appendChild(this.surface);
2713
+ const e2 = this.wrapper.querySelector(".notectl-plugin-container--bottom");
2714
+ e2 ? this.wrapper.insertBefore(this.viewport, e2) : this.wrapper.appendChild(this.viewport), this.viewportObserver = new ResizeObserver((e3) => {
2715
+ for (const t2 of e3) this.onViewportResize(t2.contentRect.width);
2716
+ }), this.viewportObserver.observe(this.viewport), this.surfaceObserver = new ResizeObserver((e3) => {
2717
+ for (const t2 of e3) this.onSurfaceResize(t2.contentRect.height);
2718
+ }), this.surfaceObserver.observe(this.surface);
2719
+ }
2720
+ disable() {
2721
+ if (this.viewportObserver?.disconnect(), this.viewportObserver = null, this.surfaceObserver?.disconnect(), this.surfaceObserver = null, this.viewport && this.surface) {
2722
+ this.surface.removeChild(this.content);
2723
+ const e2 = this.wrapper.querySelector(".notectl-plugin-container--bottom");
2724
+ e2 ? this.wrapper.insertBefore(this.content, e2) : this.wrapper.appendChild(this.content), this.wrapper.removeChild(this.viewport);
2725
+ }
2726
+ this.viewport = null, this.surface = null, this.currentSize = null, this.currentPaperWidthPx = 0, this.currentPaperHeightPx = 0, this.currentScale = 1, this.wrapper.removeAttribute("data-paper-mode");
2727
+ }
2728
+ updateSurfaceDimensions() {
2729
+ this.surface && (this.surface.style.width = `${this.currentPaperWidthPx}px`, this.surface.style.minHeight = `${this.currentPaperHeightPx}px`);
2730
+ }
2731
+ onViewportResize(e2) {
2732
+ if (!this.surface || 0 === this.currentPaperWidthPx) return;
2733
+ const t2 = e2 - 48, n2 = Math.min(1, t2 / this.currentPaperWidthPx);
2734
+ this.currentScale = n2, this.surface.style.transform = n2 < 1 ? `scale(${n2})` : "", this.updateHeightCompensation(n2);
2735
+ }
2736
+ onSurfaceResize(e2) {
2737
+ this.surface && this.viewport && this.updateHeightCompensation(this.currentScale);
2738
+ }
2739
+ updateHeightCompensation(e2) {
2740
+ if (!this.surface) return;
2741
+ if (e2 >= 1) return void (this.surface.style.marginBottom = "");
2742
+ const t2 = this.surface.scrollHeight, n2 = t2 * e2 - t2;
2743
+ this.surface.style.marginBottom = `${n2}px`;
2513
2744
  }
2514
2745
  }
2515
- class Jt extends HTMLElement {
2746
+ class Pn extends HTMLElement {
2516
2747
  view = null;
2517
2748
  pluginManager = null;
2518
2749
  contentElement = null;
@@ -2527,13 +2758,14 @@ class Jt extends HTMLElement {
2527
2758
  initialized = false;
2528
2759
  preInitPlugins = [];
2529
2760
  themeController = null;
2761
+ paperLayout = null;
2530
2762
  constructor() {
2531
2763
  super(), this.readyPromise = new Promise((e2) => {
2532
2764
  this.readyPromiseResolve = e2;
2533
2765
  }), this.attachShadow({ mode: "open" });
2534
2766
  }
2535
2767
  static get observedAttributes() {
2536
- return ["placeholder", "readonly", "theme"];
2768
+ return ["placeholder", "readonly", "theme", "paper-size"];
2537
2769
  }
2538
2770
  connectedCallback() {
2539
2771
  this.initialized || this.init();
@@ -2546,7 +2778,7 @@ class Jt extends HTMLElement {
2546
2778
  const e3 = null !== n2;
2547
2779
  this.contentElement.contentEditable = e3 ? "false" : "true", e3 ? this.contentElement.setAttribute("aria-readonly", "true") : this.contentElement.removeAttribute("aria-readonly");
2548
2780
  }
2549
- "theme" === e2 && this.themeController && this.themeController.apply(n2 ?? et.Light);
2781
+ "theme" === e2 && this.themeController && this.themeController.apply(n2 ?? _t.Light), "paper-size" === e2 && (null === n2 ? this.configure({ paperSize: void 0 }) : Lt(n2) && this.configure({ paperSize: n2 }));
2550
2782
  }
2551
2783
  registerPlugin(e2) {
2552
2784
  if (this.initialized) throw new Error("Cannot register plugins after initialization. Register before calling init() or adding to DOM.");
@@ -2557,46 +2789,50 @@ class Jt extends HTMLElement {
2557
2789
  this.initialized = true, e2 && (this.config = e2);
2558
2790
  const t2 = this.shadowRoot;
2559
2791
  if (!t2) return;
2560
- this.themeController = new Xt(t2), this.themeController.apply(this.config.theme ?? et.Light);
2792
+ this.themeController = new Mn(t2), this.themeController.apply(this.config.theme ?? _t.Light);
2561
2793
  const n2 = (function(e3) {
2562
2794
  const t3 = document.createElement("div");
2563
2795
  t3.className = "notectl-editor";
2564
2796
  const n3 = document.createElement("div");
2565
- n3.className = "notectl-plugin-container--top";
2797
+ n3.className = "notectl-plugin-container--top", n3.setAttribute("data-notectl-no-print", "");
2566
2798
  const s3 = document.createElement("div");
2567
2799
  s3.className = "notectl-content", s3.contentEditable = e3.readonly ? "false" : "true", s3.setAttribute("role", "textbox"), s3.setAttribute("aria-multiline", "true"), s3.setAttribute("aria-label", "Rich text editor"), e3.readonly && s3.setAttribute("aria-readonly", "true"), s3.setAttribute("aria-description", "Press Escape to exit the editor"), s3.setAttribute("data-placeholder", e3.placeholder ?? "Start typing...");
2568
2800
  const r3 = document.createElement("div");
2569
- r3.className = "notectl-plugin-container--bottom";
2801
+ r3.className = "notectl-plugin-container--bottom", r3.setAttribute("data-notectl-no-print", "");
2570
2802
  const o3 = document.createElement("div");
2571
- return o3.className = "notectl-sr-only", o3.setAttribute("aria-live", "polite"), o3.setAttribute("aria-atomic", "true"), t3.appendChild(n3), t3.appendChild(s3), t3.appendChild(r3), t3.appendChild(o3), { wrapper: t3, content: s3, topPluginContainer: n3, bottomPluginContainer: r3, announcer: o3 };
2803
+ return o3.className = "notectl-sr-only", o3.setAttribute("data-notectl-no-print", ""), o3.setAttribute("aria-live", "polite"), o3.setAttribute("aria-atomic", "true"), t3.appendChild(n3), t3.appendChild(s3), t3.appendChild(r3), t3.appendChild(o3), { wrapper: t3, content: s3, topPluginContainer: n3, bottomPluginContainer: r3, announcer: o3 };
2572
2804
  })({ readonly: this.config.readonly, placeholder: this.config.placeholder });
2573
- this.editorWrapper = n2.wrapper, this.contentElement = n2.content, this.topPluginContainer = n2.topPluginContainer, this.bottomPluginContainer = n2.bottomPluginContainer, this.announcer = n2.announcer, t2.appendChild(this.editorWrapper), this.pluginManager = new Ze(), Re(this.pluginManager.schemaRegistry), this.processToolbarConfig();
2805
+ this.editorWrapper = n2.wrapper, this.contentElement = n2.content, this.topPluginContainer = n2.topPluginContainer, this.bottomPluginContainer = n2.bottomPluginContainer, this.announcer = n2.announcer, t2.appendChild(this.editorWrapper), this.config.paperSize && (this.paperLayout = new Bn(this.editorWrapper, this.contentElement), this.paperLayout.apply(this.config.paperSize)), this.pluginManager = new gt();
2806
+ const s2 = new _e(this.config.locale ?? "browser");
2807
+ this.pluginManager.registerService(Oe, s2), We(this.pluginManager.schemaRegistry), this.processToolbarConfig();
2574
2808
  for (const e3 of this.config.plugins ?? []) this.pluginManager.register(e3);
2575
2809
  for (const e3 of this.preInitPlugins) this.pluginManager.register(e3);
2576
2810
  this.preInitPlugins = [], this.ensureTextFormattingPlugin(), this.contentElement.addEventListener("focus", () => this.emit("focus", void 0)), this.contentElement.addEventListener("blur", () => this.emit("blur", void 0));
2577
- const s2 = this.contentElement, r2 = this.pluginManager, o2 = this.topPluginContainer, i3 = this.bottomPluginContainer;
2578
- if (!(s2 && r2 && o2 && i3)) return;
2579
- const a4 = this.announcer;
2580
- await r2.init({ getState: () => {
2811
+ const r2 = this.contentElement, o2 = this.pluginManager, i5 = this.topPluginContainer, a18 = this.bottomPluginContainer;
2812
+ if (!(r2 && o2 && i5 && a18)) return;
2813
+ const c8 = this.announcer;
2814
+ await o2.init({ getState: () => {
2581
2815
  if (!this.view) throw new Error("View not initialized");
2582
2816
  return this.view.getState();
2583
- }, dispatch: (e3) => this.dispatch(e3), getContainer: () => s2, getPluginContainer: (e3) => "top" === e3 ? o2 : i3, announce: (e3) => {
2584
- a4 && (a4.textContent = e3);
2817
+ }, dispatch: (e3) => this.dispatch(e3), getContainer: () => r2, getPluginContainer: (e3) => "top" === e3 ? i5 : a18, announce: (e3) => {
2818
+ c8 && (c8.textContent = e3);
2585
2819
  }, onBeforeReady: () => {
2586
- const e3 = de(r2.schemaRegistry), t3 = Ve.create({ schema: e3 });
2587
- this.view = new Ht(s2, { state: t3, schemaRegistry: r2.schemaRegistry, maxHistoryDepth: this.config.maxHistoryDepth, getDecorations: (e4, t4) => this.pluginManager?.collectDecorations(e4, t4) ?? we.empty, onStateChange: (e4, t4, n4) => {
2820
+ const e3 = ve(o2.schemaRegistry), t3 = at.create({ schema: e3 });
2821
+ this.view = new vn(r2, { state: t3, schemaRegistry: o2.schemaRegistry, maxHistoryDepth: this.config.maxHistoryDepth, getDecorations: (e4, t4) => this.pluginManager?.collectDecorations(e4, t4) ?? De.empty, onStateChange: (e4, t4, n4) => {
2588
2822
  this.onStateChange(e4, t4, n4);
2589
2823
  } }), this.updateEmptyState();
2590
- const n3 = r2.getPluginStyleSheets();
2824
+ const n3 = o2.getPluginStyleSheets();
2591
2825
  n3.length > 0 && this.themeController?.setPluginStyleSheets(n3);
2592
- } }), this.config.autofocus && requestAnimationFrame(() => this.contentElement?.focus()), this.readyPromiseResolve?.(), this.emit("ready", void 0);
2826
+ } }), this.pluginManager && (this.pluginManager.onEvent(Mt, (e3) => {
2827
+ !e3.options.paperSize && this.config.paperSize && (e3.options = { ...e3.options, paperSize: this.config.paperSize });
2828
+ }), this.config.autofocus && requestAnimationFrame(() => this.contentElement?.focus()), this.readyPromiseResolve?.(), this.emit("ready", void 0));
2593
2829
  }
2594
2830
  getJSON() {
2595
2831
  if (!this.view) throw new Error("Editor not initialized");
2596
2832
  return this.view.getState().doc;
2597
2833
  }
2598
2834
  setJSON(e2) {
2599
- const t2 = this.pluginManager ? de(this.pluginManager.schemaRegistry) : void 0, n2 = Ve.create({ doc: e2, schema: t2, selection: F(e2.children[0]?.id ?? pe(""), 0) });
2835
+ const t2 = this.pluginManager ? ve(this.pluginManager.schemaRegistry) : void 0, n2 = at.create({ doc: e2, schema: t2, selection: J(e2.children[0]?.id ?? Ee(""), 0) });
2600
2836
  this.replaceState(n2);
2601
2837
  }
2602
2838
  getHTML() {
@@ -2604,46 +2840,46 @@ class Jt extends HTMLElement {
2604
2840
  return (function(e2, t2) {
2605
2841
  const n2 = [];
2606
2842
  let s2 = null;
2607
- for (const r3 of e2.children) if (me(r3, "list_item")) {
2843
+ for (const r3 of e2.children) if (Ne(r3, "list_item")) {
2608
2844
  const e3 = "ordered" === r3.attrs.listType ? "ol" : "ul";
2609
- s2 !== e3 && (s2 && n2.push(`</${s2}>`), n2.push(`<${e3}>`), s2 = e3), n2.push(Kt(r3, t2));
2610
- } else s2 && (n2.push(`</${s2}>`), s2 = null), n2.push(Kt(r3, t2));
2845
+ s2 !== e3 && (s2 && n2.push(`</${s2}>`), n2.push(`<${e3}>`), s2 = e3), n2.push(Cn(r3, t2));
2846
+ } else s2 && (n2.push(`</${s2}>`), s2 = null), n2.push(Cn(r3, t2));
2611
2847
  s2 && n2.push(`</${s2}>`);
2612
2848
  const r2 = t2 ? t2.getAllowedTags() : ["p", "br", "div", "span"], o2 = t2 ? t2.getAllowedAttrs() : ["style"];
2613
- return Ne.sanitize(n2.join(""), { ALLOWED_TAGS: r2, ALLOWED_ATTR: o2 });
2849
+ return Fe.sanitize(n2.join(""), { ALLOWED_TAGS: r2, ALLOWED_ATTR: o2 });
2614
2850
  })(this.view.getState().doc, this.pluginManager?.schemaRegistry);
2615
2851
  }
2616
2852
  setHTML(e2) {
2617
2853
  const t2 = (function(e3, t3) {
2618
2854
  const n2 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], s2 = t3 ? t3.getAllowedAttrs() : ["style"], r2 = document.createElement("template");
2619
- r2.innerHTML = Ne.sanitize(e3, { ALLOWED_TAGS: n2, ALLOWED_ATTR: s2 });
2620
- const i3 = r2.content, a4 = t3?.getBlockParseRules() ?? [], c3 = [];
2621
- for (const e4 of Array.from(i3.childNodes)) if (e4.nodeType === Node.ELEMENT_NODE) {
2855
+ r2.innerHTML = Fe.sanitize(e3, { ALLOWED_TAGS: n2, ALLOWED_ATTR: s2 });
2856
+ const i5 = r2.content, a18 = t3?.getBlockParseRules() ?? [], c8 = [];
2857
+ for (const e4 of Array.from(i5.childNodes)) if (e4.nodeType === Node.ELEMENT_NODE) {
2622
2858
  const n3 = e4, s3 = n3.tagName.toLowerCase();
2623
2859
  if ("ul" === s3 || "ol" === s3) {
2624
2860
  const e5 = "ol" === s3 ? "ordered" : "bullet";
2625
2861
  for (const s4 of Array.from(n3.querySelectorAll("li"))) {
2626
- const n4 = $t(s4, t3);
2627
- c3.push(o(fe("list_item"), n4, void 0, { listType: e5, indent: 0, checked: false }));
2862
+ const n4 = Tn(s4, t3);
2863
+ c8.push(o(Te("list_item"), n4, void 0, { listType: e5, indent: 0, checked: false }));
2628
2864
  }
2629
2865
  continue;
2630
2866
  }
2631
- const r3 = Ut(n3, a4);
2867
+ const r3 = Nn(n3, a18);
2632
2868
  if (r3) {
2633
- const e5 = $t(n3, t3);
2634
- c3.push(o(fe(r3.type), e5, void 0, r3.attrs));
2869
+ const e5 = Tn(n3, t3);
2870
+ c8.push(o(Te(r3.type), e5, void 0, r3.attrs));
2635
2871
  continue;
2636
2872
  }
2637
- const i4 = $t(n3, t3);
2638
- c3.push(o(fe("paragraph"), i4));
2639
- } else e4.nodeType === Node.TEXT_NODE && e4.textContent?.trim() && c3.push(o(fe("paragraph"), [g(e4.textContent.trim())]));
2640
- return 0 === c3.length ? P() : P(c3);
2873
+ const i6 = Tn(n3, t3);
2874
+ c8.push(o(Te("paragraph"), i6));
2875
+ } else e4.nodeType === Node.TEXT_NODE && e4.textContent?.trim() && c8.push(o(Te("paragraph"), [N(e4.textContent.trim())]));
2876
+ return 0 === c8.length ? K() : K(c8);
2641
2877
  })(e2, this.pluginManager?.schemaRegistry);
2642
2878
  this.setJSON(t2);
2643
2879
  }
2644
2880
  getText() {
2645
2881
  if (!this.view) throw new Error("Editor not initialized");
2646
- return this.view.getState().doc.children.map((e2) => M(e2)).join("\n");
2882
+ return this.view.getState().doc.children.map((e2) => O(e2)).join("\n");
2647
2883
  }
2648
2884
  isEmpty() {
2649
2885
  if (!this.view) return true;
@@ -2651,16 +2887,16 @@ class Jt extends HTMLElement {
2651
2887
  if (0 === e2.children.length) return true;
2652
2888
  if (e2.children.length > 1) return false;
2653
2889
  const t2 = e2.children[0];
2654
- return !t2 || "paragraph" === t2.type && "" === M(t2);
2890
+ return !t2 || "paragraph" === t2.type && "" === O(t2);
2655
2891
  }
2656
2892
  commands = { toggleBold: () => this.executeCommand("toggleBold"), toggleItalic: () => this.executeCommand("toggleItalic"), toggleUnderline: () => this.executeCommand("toggleUnderline"), undo: () => this.view?.undo(), redo: () => this.view?.redo(), selectAll: () => {
2657
2893
  if (!this.view) return;
2658
- const e2 = J(this.view.getState());
2894
+ const e2 = oe(this.view.getState());
2659
2895
  this.dispatch(e2);
2660
2896
  } };
2661
2897
  can() {
2662
2898
  const e2 = this.view?.getState().schema;
2663
- return { toggleBold: () => !!e2 && le(e2, "bold"), toggleItalic: () => !!e2 && le(e2, "italic"), toggleUnderline: () => !!e2 && le(e2, "underline"), undo: () => this.view?.history.canUndo() ?? false, redo: () => this.view?.history.canRedo() ?? false };
2899
+ return { toggleBold: () => !!e2 && be(e2, "bold"), toggleItalic: () => !!e2 && be(e2, "italic"), toggleUnderline: () => !!e2 && be(e2, "underline"), undo: () => this.view?.history.canUndo() ?? false, redo: () => this.view?.history.canRedo() ?? false };
2664
2900
  }
2665
2901
  executeCommand(e2) {
2666
2902
  return this.pluginManager?.executeCommand(e2) ?? false;
@@ -2668,6 +2904,13 @@ class Jt extends HTMLElement {
2668
2904
  configurePlugin(e2, t2) {
2669
2905
  this.pluginManager?.configurePlugin(e2, t2);
2670
2906
  }
2907
+ getService(e2) {
2908
+ return this.pluginManager?.getService(e2);
2909
+ }
2910
+ onPluginEvent(e2, t2) {
2911
+ return this.pluginManager?.onEvent(e2, t2) ?? (() => {
2912
+ });
2913
+ }
2671
2914
  getState() {
2672
2915
  if (!this.view) throw new Error("Editor not initialized");
2673
2916
  return this.view.getState();
@@ -2685,16 +2928,19 @@ class Jt extends HTMLElement {
2685
2928
  return this.readyPromise;
2686
2929
  }
2687
2930
  configure(e2) {
2688
- void 0 !== e2.placeholder && this.contentElement && this.contentElement.setAttribute("data-placeholder", e2.placeholder), void 0 !== e2.readonly && this.contentElement && (this.contentElement.contentEditable = e2.readonly ? "false" : "true", e2.readonly ? this.contentElement.setAttribute("aria-readonly", "true") : this.contentElement.removeAttribute("aria-readonly")), this.config = { ...this.config, ...e2 };
2931
+ void 0 !== e2.placeholder && this.contentElement && this.contentElement.setAttribute("data-placeholder", e2.placeholder), void 0 !== e2.readonly && this.contentElement && (this.contentElement.contentEditable = e2.readonly ? "false" : "true", e2.readonly ? this.contentElement.setAttribute("aria-readonly", "true") : this.contentElement.removeAttribute("aria-readonly")), "paperSize" in e2 && this.applyPaperSize(e2.paperSize), this.config = { ...this.config, ...e2 };
2689
2932
  }
2690
2933
  setTheme(e2) {
2691
2934
  this.config = { ...this.config, theme: e2 }, this.themeController?.apply(e2);
2692
2935
  }
2693
2936
  getTheme() {
2694
- return this.config.theme ?? et.Light;
2937
+ return this.config.theme ?? _t.Light;
2938
+ }
2939
+ getPaperSize() {
2940
+ return this.config.paperSize;
2695
2941
  }
2696
2942
  destroy() {
2697
- this.themeController?.destroy(), this.themeController = null, this.view?.destroy();
2943
+ this.paperLayout?.destroy(), this.paperLayout = null, this.themeController?.destroy(), this.themeController = null, this.view?.destroy();
2698
2944
  const e2 = this.pluginManager?.destroy() ?? Promise.resolve();
2699
2945
  return this.view = null, this.pluginManager = null, this.initialized = false, e2;
2700
2946
  }
@@ -2707,26 +2953,29 @@ class Jt extends HTMLElement {
2707
2953
  e2.push(n2);
2708
2954
  }
2709
2955
  const t2 = { groups: e2 };
2710
- this.pluginManager.register(new Ee(t2));
2956
+ this.pluginManager.register(new ze(t2));
2711
2957
  }
2712
2958
  ensureTextFormattingPlugin() {
2713
2959
  if (!this.pluginManager) return;
2714
2960
  if (void 0 !== this.pluginManager.get("text-formatting")) return;
2715
2961
  const e2 = { bold: this.config.features?.bold ?? true, italic: this.config.features?.italic ?? true, underline: this.config.features?.underline ?? true };
2716
- this.pluginManager.register(new xe(e2));
2962
+ this.pluginManager.register(new je(e2));
2963
+ }
2964
+ applyPaperSize(e2) {
2965
+ this.editorWrapper && this.contentElement && (e2 ? (this.paperLayout || (this.paperLayout = new Bn(this.editorWrapper, this.contentElement)), this.paperLayout.apply(e2)) : this.paperLayout?.apply(null));
2717
2966
  }
2718
2967
  emit(e2, t2) {
2719
2968
  const n2 = this.eventListeners.get(e2);
2720
2969
  if (n2) for (const e3 of n2) e3(t2);
2721
2970
  }
2722
2971
  onStateChange(e2, t2, n2) {
2723
- if (this.announcer && (this.announcer.textContent = ""), this.pluginManager?.notifyStateChange(e2, t2, n2), this.updateEmptyState(), this.emit("stateChange", { oldState: e2, newState: t2, transaction: n2 }), W(e2.selection, t2.selection) || this.emit("selectionChange", { selection: t2.selection }), !this.announcer?.textContent) {
2972
+ if (this.announcer && (this.announcer.textContent = ""), this.pluginManager?.notifyStateChange(e2, t2, n2), this.updateEmptyState(), this.emit("stateChange", { oldState: e2, newState: t2, transaction: n2 }), se(e2.selection, t2.selection) || this.emit("selectionChange", { selection: t2.selection }), !this.announcer?.textContent) {
2724
2973
  const s2 = (function(e3, t3, n3) {
2725
2974
  if ("undo" === n3.metadata.historyDirection) return "Undo";
2726
2975
  if ("redo" === n3.metadata.historyDirection) return "Redo";
2727
- for (const e4 of n3.steps) if ("setBlockType" === e4.type) return Ft(e4.nodeType, e4.attrs);
2976
+ for (const e4 of n3.steps) if ("setBlockType" === e4.type) return En(e4.nodeType, e4.attrs);
2728
2977
  for (const n4 of t3.schema.markTypes) {
2729
- const s3 = ge(n4), r2 = ue(e3, s3), o2 = ue(t3, s3);
2978
+ const s3 = xe(n4), r2 = we(e3, s3), o2 = we(t3, s3);
2730
2979
  if (r2 !== o2) return `${n4} ${o2 ? "on" : "off"}`;
2731
2980
  }
2732
2981
  return null;
@@ -2741,133 +2990,192 @@ class Jt extends HTMLElement {
2741
2990
  this.view && (this.view.replaceState(e2), this.updateEmptyState());
2742
2991
  }
2743
2992
  }
2744
- async function Qt(e2) {
2993
+ async function Rn(e2) {
2745
2994
  const t2 = document.createElement("notectl-editor");
2746
2995
  return await t2.init(e2), t2;
2747
2996
  }
2748
- "undefined" == typeof customElements || customElements.get("notectl-editor") || customElements.define("notectl-editor", Jt);
2997
+ "undefined" == typeof customElements || customElements.get("notectl-editor") || customElements.define("notectl-editor", Pn);
2749
2998
  export {
2750
- ALIGNMENT_ICONS,
2751
- AlignmentPlugin,
2752
- BlockquotePlugin,
2753
- C as CODE_BLOCK_SERVICE_KEY,
2754
- Ge as ClipboardHandler,
2755
- a2 as CodeBlockPlugin,
2756
- nt as DARK_THEME,
2757
- DEFAULT_IMAGE_KEYMAP,
2758
- we as DecorationSet,
2759
- Ve as EditorState,
2760
- Ye as EventBus,
2761
- E as EventKey,
2762
- FontPlugin,
2763
- FontSizePlugin,
2999
+ Bt as AFTER_PRINT,
3000
+ A2 as ALIGNMENT_ICONS,
3001
+ a11 as ALIGNMENT_LOCALES,
3002
+ b13 as ALIGNMENT_LOCALE_DE,
3003
+ c5 as ALIGNMENT_LOCALE_EN,
3004
+ d as AlignmentPlugin,
3005
+ Mt as BEFORE_PRINT,
3006
+ B2 as BLOCKQUOTE_LOCALES,
3007
+ a7 as BLOCKQUOTE_LOCALE_EN,
3008
+ b9 as BlockquotePlugin,
3009
+ C as CODE_BLOCK_LOCALES,
3010
+ a as CODE_BLOCK_LOCALE_EN,
3011
+ b3 as CODE_BLOCK_SERVICE_KEY,
3012
+ pt as ClipboardHandler,
3013
+ c3 as CodeBlockPlugin,
3014
+ Dt as DARK_THEME,
3015
+ D as DEFAULT_IMAGE_KEYMAP,
3016
+ De as DecorationSet,
3017
+ at as EditorState,
3018
+ ft as EventBus,
3019
+ Be as EventKey,
3020
+ F as FONT_LOCALES,
3021
+ a12 as FONT_LOCALE_EN,
3022
+ F2 as FONT_SIZE_LOCALES,
3023
+ a13 as FONT_SIZE_LOCALE_EN,
3024
+ b14 as FontPlugin,
3025
+ b15 as FontSizePlugin,
3026
+ H as HEADING_LOCALES,
3027
+ a4 as HEADING_LOCALE_EN,
3028
+ H3 as HIGHLIGHT_LOCALES,
3029
+ a15 as HIGHLIGHT_LOCALE_EN,
3030
+ H2 as HORIZONTAL_RULE_LOCALES,
3031
+ a10 as HORIZONTAL_RULE_LOCALE_EN,
2764
3032
  HardBreakPlugin,
2765
- HeadingPlugin,
2766
- HighlightPlugin,
2767
- We as HistoryManager,
2768
- HorizontalRulePlugin,
2769
- IMAGE_UPLOAD_SERVICE,
2770
- ImagePlugin,
2771
- tt as LIGHT_THEME,
2772
- LinkPlugin,
2773
- ListPlugin,
2774
- Jt as NotectlEditor,
2775
- Ze as PluginManager,
2776
- Me as SchemaRegistry,
2777
- S as ServiceKey,
2778
- StrikethroughPlugin,
2779
- SuperSubPlugin,
2780
- TablePlugin,
2781
- TableSelectionServiceKey,
2782
- AlignmentPlugin2 as TextAlignmentPlugin,
2783
- TextColorPlugin,
2784
- xe as TextFormattingPlugin,
2785
- et as ThemePreset,
2786
- Ee as ToolbarPlugin,
2787
- a3 as ToolbarServiceKey,
2788
- Ke as TransactionBuilder,
2789
- Ae as applyStep,
2790
- pe as blockId,
2791
- Ce as canContain,
3033
+ b6 as HeadingPlugin,
3034
+ b17 as HighlightPlugin,
3035
+ lt as HistoryManager,
3036
+ b12 as HorizontalRulePlugin,
3037
+ I as IMAGE_LOCALES,
3038
+ a17 as IMAGE_LOCALE_EN,
3039
+ b19 as IMAGE_UPLOAD_SERVICE,
3040
+ c7 as ImagePlugin,
3041
+ Ot as LIGHT_THEME,
3042
+ L as LINK_LOCALES,
3043
+ a5 as LINK_LOCALE_EN,
3044
+ L2 as LIST_LOCALES,
3045
+ a6 as LIST_LOCALE_EN,
3046
+ b7 as LinkPlugin,
3047
+ b8 as ListPlugin,
3048
+ Vt as Locale,
3049
+ _e as LocaleService,
3050
+ Oe as LocaleServiceKey,
3051
+ Pn as NotectlEditor,
3052
+ Nt as PAPER_MARGIN_HORIZONTAL_PX,
3053
+ xt as PAPER_MARGIN_TOP_PX,
3054
+ Ct as PAPER_VIEWPORT_PADDING_PX,
3055
+ yt as PRINT_LOCALES,
3056
+ mt as PRINT_LOCALE_EN,
3057
+ It as PRINT_SERVICE_KEY,
3058
+ St as PaperSize,
3059
+ gt as PluginManager,
3060
+ Rt as PrintPlugin,
3061
+ S as STRIKETHROUGH_LOCALES,
3062
+ a8 as STRIKETHROUGH_LOCALE_EN,
3063
+ S2 as SUPER_SUB_LOCALES,
3064
+ a16 as SUPER_SUB_LOCALE_EN,
3065
+ Ue as SchemaRegistry,
3066
+ Pe as ServiceKey,
3067
+ b10 as StrikethroughPlugin,
3068
+ b18 as SuperSubPlugin,
3069
+ T2 as TABLE_LOCALES,
3070
+ a14 as TABLE_LOCALE_AR,
3071
+ b16 as TABLE_LOCALE_DE,
3072
+ c6 as TABLE_LOCALE_EN,
3073
+ d3 as TABLE_LOCALE_ES,
3074
+ e as TABLE_LOCALE_FR,
3075
+ f3 as TABLE_LOCALE_HI,
3076
+ g as TABLE_LOCALE_RU,
3077
+ h3 as TABLE_LOCALE_ZH,
3078
+ T as TEXT_COLOR_LOCALES,
3079
+ a9 as TEXT_COLOR_LOCALE_EN,
3080
+ a3 as TEXT_FORMATTING_LOCALES,
3081
+ b5 as TEXT_FORMATTING_LOCALE_EN,
3082
+ b4 as TOOLBAR_LOCALES,
3083
+ c4 as TOOLBAR_LOCALE_EN,
3084
+ i4 as TablePlugin,
3085
+ j as TableSelectionServiceKey,
3086
+ d2 as TextAlignmentPlugin,
3087
+ b11 as TextColorPlugin,
3088
+ je as TextFormattingPlugin,
3089
+ _t as ThemePreset,
3090
+ ze as ToolbarPlugin,
3091
+ a2 as ToolbarServiceKey,
3092
+ it as TransactionBuilder,
3093
+ Ge as applyStep,
3094
+ Ee as blockId,
3095
+ Ve as canContain,
2792
3096
  c as commandName,
2793
- ye as createBlockElement,
3097
+ Ce as createBlockElement,
2794
3098
  o as createBlockNode,
2795
- F as createCollapsedSelection,
2796
- P as createDocument,
2797
- Qt as createEditor,
3099
+ J as createCollapsedSelection,
3100
+ K as createDocument,
3101
+ Rn as createEditor,
2798
3102
  f as createInlineNode,
2799
- H as createNodeSelection,
2800
- U as createPosition,
2801
- j as createSelection,
2802
- g as createTextNode,
2803
- st as createTheme,
2804
- lt as createThemeStyleSheet,
2805
- X as defaultSchema,
2806
- te as deleteBackward,
2807
- ie as deleteForward,
2808
- G as deleteNodeSelection,
2809
- ee as deleteSelectionCommand,
2810
- ke as escapeHTML,
2811
- be as findNode,
2812
- ve as findNodePath,
3103
+ X as createNodeSelection,
3104
+ Z as createPosition,
3105
+ Y as createSelection,
3106
+ N as createTextNode,
3107
+ Ht as createTheme,
3108
+ Kt as createThemeStyleSheet,
3109
+ re as defaultSchema,
3110
+ de as deleteBackward,
3111
+ me as deleteForward,
3112
+ ae as deleteNodeSelection,
3113
+ he as deleteSelectionCommand,
3114
+ Le as escapeHTML,
3115
+ Ae as findNode,
3116
+ Me as findNodePath,
2813
3117
  b2 as findNodeWithPath,
2814
- findTableContext,
2815
- t as forEachBlockInRange,
2816
- f2 as formatShortcut,
2817
- ct as generateThemeCSS,
2818
- O as getBlockChildren,
3118
+ k as findTableContext,
3119
+ f2 as forEachBlockInRange,
3120
+ $e as formatShortcut,
3121
+ Ut as generateThemeCSS,
3122
+ G as getBlockChildren,
2819
3123
  r as getBlockLength,
2820
- I as getBlockMarksAtOffset,
2821
- M as getBlockText,
2822
- R as getContentAtOffset,
2823
- e as getInlineChildren,
3124
+ $ as getBlockMarksAtOffset,
3125
+ O as getBlockText,
3126
+ U as getContentAtOffset,
3127
+ t as getInlineChildren,
3128
+ At as getPaperCSSSize,
3129
+ Tt as getPaperDimensions,
2824
3130
  v as getTextChildren,
2825
3131
  h as hasMark,
2826
- i2 as inlineDecoration,
3132
+ i3 as inlineDecoration,
2827
3133
  i as inlineType,
2828
- ae as insertHardBreakCommand,
2829
- Z as insertTextCommand,
2830
- je as invertStep,
2831
- Ue as invertTransaction,
2832
- l as isBlockNode,
2833
- V as isCollapsed,
3134
+ ye as insertHardBreakCommand,
3135
+ le as insertTextCommand,
3136
+ rt as invertStep,
3137
+ ot as invertTransaction,
3138
+ m as isBlockNode,
3139
+ te as isCollapsed,
2834
3140
  h2 as isForward,
2835
- d as isInlineNode,
2836
- a as isInlineNodeOfType,
3141
+ E as isInlineNode,
3142
+ b as isInlineNodeOfType,
2837
3143
  u as isInsideIsolating,
2838
- isInsideTable,
2839
- D as isLeafBlock,
2840
- ue as isMarkActive,
2841
- le as isMarkAllowed,
2842
- b as isMarkOfType,
2843
- me as isNodeOfType,
2844
- $ as isNodeSelection,
2845
- m as isTextNode,
2846
- K as isTextSelection,
3144
+ l as isInsideTable,
3145
+ V as isLeafBlock,
3146
+ we as isMarkActive,
3147
+ be as isMarkAllowed,
3148
+ i2 as isMarkOfType,
3149
+ Ne as isNodeOfType,
3150
+ Q as isNodeSelection,
3151
+ M as isTextNode,
3152
+ ee as isTextSelection,
3153
+ Lt as isValidPaperSize,
2847
3154
  v2 as isVoidBlock,
2848
- _ as markSetsEqual,
2849
- ge as markType,
3155
+ W as markSetsEqual,
3156
+ xe as markType,
2850
3157
  w as mergeBlockBackward,
2851
- Q as navigateArrowIntoVoid,
3158
+ ie as navigateArrowIntoVoid,
2852
3159
  n as nodeDecoration,
2853
- fe as nodeType,
2854
- Je as normalizeKeyDescriptor,
3160
+ Te as nodeType,
3161
+ dt as normalizeKeyDescriptor,
2855
3162
  p as pluginId,
2856
- Re as registerBuiltinSpecs,
2857
- Se as resolveNodeByPath,
3163
+ We as registerBuiltinSpecs,
3164
+ Ie as resolveNodeByPath,
2858
3165
  c2 as resolveParentByPath,
2859
- rt as resolveTheme,
2860
- de as schemaFromRegistry,
2861
- J as selectAll,
2862
- q as selectionRange,
2863
- W as selectionsEqual,
3166
+ Re as resolvePluginLocale,
3167
+ zt as resolveTheme,
3168
+ ve as schemaFromRegistry,
3169
+ oe as selectAll,
3170
+ ne as selectionRange,
3171
+ se as selectionsEqual,
2864
3172
  x as sharesParent,
2865
- Y as splitBlockCommand,
3173
+ ce as splitBlockCommand,
2866
3174
  y as toggleBold,
2867
3175
  z as toggleItalic,
2868
3176
  A as toggleMark,
2869
3177
  B as toggleUnderline,
2870
- Be as validateContent,
3178
+ qe as validateContent,
2871
3179
  w2 as walkNodes,
2872
3180
  w3 as widgetDecoration
2873
3181
  };