@notectl/core 1.7.2 → 1.7.3

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 (125) hide show
  1. package/dist/chunks/{ColorGrid-Dneqb8if.mjs → ColorGrid--lBQ7jCK.mjs} +2 -2
  2. package/dist/chunks/{ColorGrid-Dneqb8if.mjs.map → ColorGrid--lBQ7jCK.mjs.map} +1 -1
  3. package/dist/chunks/{ColorPickerPopup-CiCLBbe9.mjs → ColorPickerPopup-TpIRlXc8.mjs} +8 -8
  4. package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +1 -0
  5. package/dist/chunks/Document-Brtw2jL1.mjs.map +1 -1
  6. package/dist/chunks/MarkCommands-6RUJ4L3r.mjs.map +1 -1
  7. package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -1
  8. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +34 -0
  9. package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +1 -0
  10. package/dist/chunks/{StyleRuntime-ChRjVQwL.mjs → StyleRuntime-CP4NCwKT.mjs} +49 -53
  11. package/dist/chunks/StyleRuntime-CP4NCwKT.mjs.map +1 -0
  12. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
  13. package/dist/chunks/{index-D515iymW.mjs → index--7pBhSF4.mjs} +5 -5
  14. package/dist/chunks/index--7pBhSF4.mjs.map +1 -0
  15. package/dist/chunks/index-BXCkjDax.mjs +161 -0
  16. package/dist/chunks/index-BXCkjDax.mjs.map +1 -0
  17. package/dist/chunks/{ToolbarPlugin-DpLVJ71w.mjs → index-BcDRT4K2.mjs} +81 -93
  18. package/dist/chunks/index-BcDRT4K2.mjs.map +1 -0
  19. package/dist/chunks/{index--n1RGpq-.mjs → index-BjFBWBOC.mjs} +46 -49
  20. package/dist/chunks/index-BjFBWBOC.mjs.map +1 -0
  21. package/dist/chunks/{index-BqNUfq-y.mjs → index-CCyqQ0Dz.mjs} +2 -2
  22. package/dist/chunks/{index-BqNUfq-y.mjs.map → index-CCyqQ0Dz.mjs.map} +1 -1
  23. package/dist/chunks/{index-DyzigvbZ.mjs → index-DSAuGP4n.mjs} +50 -50
  24. package/dist/chunks/index-DSAuGP4n.mjs.map +1 -0
  25. package/dist/chunks/{index-BhDXjueu.mjs → index-DtRfqsq5.mjs} +14 -14
  26. package/dist/chunks/{index-BhDXjueu.mjs.map → index-DtRfqsq5.mjs.map} +1 -1
  27. package/dist/chunks/{index-Dk49P9N4.mjs → index-Dum8yE_t.mjs} +11 -11
  28. package/dist/chunks/{index-Dk49P9N4.mjs.map → index-Dum8yE_t.mjs.map} +1 -1
  29. package/dist/chunks/{index-CluzpB2b.mjs → index-DxbQirny.mjs} +7 -7
  30. package/dist/chunks/{index-CluzpB2b.mjs.map → index-DxbQirny.mjs.map} +1 -1
  31. package/dist/chunks/{index-CWltg1wK.mjs → index-WpbK_s_H.mjs} +20 -25
  32. package/dist/chunks/index-WpbK_s_H.mjs.map +1 -0
  33. package/dist/chunks/{index-D3NlpmT1.mjs → index-WrqH1wG8.mjs} +3 -3
  34. package/dist/chunks/{index-D3NlpmT1.mjs.map → index-WrqH1wG8.mjs.map} +1 -1
  35. package/dist/chunks/{index-BvqkuEY1.mjs → index-fx3KIap3.mjs} +3 -3
  36. package/dist/chunks/{index-BvqkuEY1.mjs.map → index-fx3KIap3.mjs.map} +1 -1
  37. package/dist/chunks/{index-BAke7kNL.mjs → index-oOJo-ywB.mjs} +41 -41
  38. package/dist/chunks/{index-BAke7kNL.mjs.map → index-oOJo-ywB.mjs.map} +1 -1
  39. package/dist/chunks/{index-ABlTDvEX.mjs → index-toj88jtL.mjs} +2 -2
  40. package/dist/chunks/{index-ABlTDvEX.mjs.map → index-toj88jtL.mjs.map} +1 -1
  41. package/dist/commands/MarkCommands.d.ts +3 -3
  42. package/dist/commands/MarkCommands.d.ts.map +1 -1
  43. package/dist/editor/CSSClassCollector.d.ts +36 -0
  44. package/dist/editor/CSSClassCollector.d.ts.map +1 -0
  45. package/dist/editor/ContentHTMLTypes.d.ts +29 -0
  46. package/dist/editor/ContentHTMLTypes.d.ts.map +1 -0
  47. package/dist/editor/ContentStyleInjector.d.ts +69 -0
  48. package/dist/editor/ContentStyleInjector.d.ts.map +1 -0
  49. package/dist/editor/DocumentParser.d.ts +9 -1
  50. package/dist/editor/DocumentParser.d.ts.map +1 -1
  51. package/dist/editor/DocumentSerializer.d.ts +6 -0
  52. package/dist/editor/DocumentSerializer.d.ts.map +1 -1
  53. package/dist/editor/MarkSerializer.d.ts +7 -0
  54. package/dist/editor/MarkSerializer.d.ts.map +1 -1
  55. package/dist/editor/NotectlEditor.d.ts +8 -11
  56. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  57. package/dist/editor/styles/font-select.d.ts +1 -1
  58. package/dist/editor/styles/font-select.d.ts.map +1 -1
  59. package/dist/editor/styles/font-size-select.d.ts +1 -1
  60. package/dist/editor/styles/font-size-select.d.ts.map +1 -1
  61. package/dist/editor/styles/heading-select.d.ts +1 -1
  62. package/dist/editor/styles/heading-select.d.ts.map +1 -1
  63. package/dist/editor/styles/toolbar.d.ts +1 -1
  64. package/dist/editor/styles/toolbar.d.ts.map +1 -1
  65. package/dist/index.d.ts +10 -13
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/model/Document.d.ts +0 -4
  68. package/dist/model/Document.d.ts.map +1 -1
  69. package/dist/model/NodeSpec.d.ts +19 -2
  70. package/dist/model/NodeSpec.d.ts.map +1 -1
  71. package/dist/notectl-core.mjs +460 -336
  72. package/dist/notectl-core.mjs.map +1 -1
  73. package/dist/notectl-core.umd.js +676 -587
  74. package/dist/notectl-core.umd.js.map +1 -1
  75. package/dist/plugins/alignment.mjs +1 -1
  76. package/dist/plugins/blockquote.mjs +1 -1
  77. package/dist/plugins/caret-navigation.mjs +1 -1
  78. package/dist/plugins/code-block/CodeBlockPlugin.d.ts +0 -1
  79. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  80. package/dist/plugins/code-block/index.d.ts +2 -1
  81. package/dist/plugins/code-block/index.d.ts.map +1 -1
  82. package/dist/plugins/code-block.mjs +1 -1
  83. package/dist/plugins/font/FontPlugin.d.ts +0 -1
  84. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  85. package/dist/plugins/font-size/FontSizePlugin.d.ts +0 -2
  86. package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
  87. package/dist/plugins/font-size/FontSizePopup.d.ts +3 -1
  88. package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
  89. package/dist/plugins/font-size.mjs +1 -1
  90. package/dist/plugins/font.mjs +1 -1
  91. package/dist/plugins/heading.mjs +1 -1
  92. package/dist/plugins/highlight.mjs +1 -1
  93. package/dist/plugins/horizontal-rule.mjs +1 -1
  94. package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
  95. package/dist/plugins/image.mjs +1 -1
  96. package/dist/plugins/list.mjs +1 -1
  97. package/dist/plugins/shared/ColorPickerPopup.d.ts +2 -1
  98. package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
  99. package/dist/plugins/shared/PopupManager.d.ts +12 -2
  100. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  101. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  102. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  103. package/dist/plugins/table.mjs +1 -1
  104. package/dist/plugins/text-color.mjs +1 -1
  105. package/dist/plugins/toolbar/ToolbarItem.d.ts +3 -2
  106. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  107. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +0 -3
  108. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  109. package/dist/plugins/toolbar.mjs +2 -2
  110. package/dist/presets/PresetTypes.d.ts +1 -1
  111. package/dist/presets/PresetTypes.d.ts.map +1 -1
  112. package/dist/style/StyleRuntime.d.ts +3 -7
  113. package/dist/style/StyleRuntime.d.ts.map +1 -1
  114. package/package.json +1 -1
  115. package/dist/chunks/ColorPickerPopup-CiCLBbe9.mjs.map +0 -1
  116. package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs +0 -32
  117. package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs.map +0 -1
  118. package/dist/chunks/StyleRuntime-ChRjVQwL.mjs.map +0 -1
  119. package/dist/chunks/ToolbarPlugin-DpLVJ71w.mjs.map +0 -1
  120. package/dist/chunks/index--n1RGpq-.mjs.map +0 -1
  121. package/dist/chunks/index-4or5UzNO.mjs +0 -168
  122. package/dist/chunks/index-4or5UzNO.mjs.map +0 -1
  123. package/dist/chunks/index-CWltg1wK.mjs.map +0 -1
  124. package/dist/chunks/index-D515iymW.mjs.map +0 -1
  125. package/dist/chunks/index-DyzigvbZ.mjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { d as S, b as C, f as T, i as R, j as L, r as M, a as I, n as N, c as O, k as _, l as H, m as $, g as K, e as U, o as W, p as V, q as J, s as Q, t as X, u as Y } from "./chunks/Document-Brtw2jL1.mjs";
2
2
  import { v, w, h } from "./chunks/Document-Brtw2jL1.mjs";
3
- import { f as Z, a as ee, C as te, b as ne } from "./chunks/index-BAke7kNL.mjs";
4
- import { e, c, d, g, h as h2, i, j, k, l, m, n, o, p, q, r, s, t, u, v as v2, w as w2, x, y, z, A, B, D, E, F, G } from "./chunks/index-BAke7kNL.mjs";
3
+ import { f as Z, a as ee, C as te, b as ne } from "./chunks/index-oOJo-ywB.mjs";
4
+ import { e, c, d, g, h as h2, i, j, k, l, m, n, o, p, q, r, s, t, u, v as v2, w as w2, x, y, z, A, B, D, E, F, G } from "./chunks/index-oOJo-ywB.mjs";
5
5
  import { e as se, d as re, i as ie, a as oe, c as ae, f as ce, b as le, g as he, h as de, s as ue } from "./chunks/Selection-BRTab5hO.mjs";
6
6
  import { j as j2, k as k2 } from "./chunks/Selection-BRTab5hO.mjs";
7
7
  import { d as pe, i as fe, a as ge, s as me } from "./chunks/MarkCommands-6RUJ4L3r.mjs";
8
8
  import { b, t as t2, c as c2, e as e2, f } from "./chunks/MarkCommands-6RUJ4L3r.mjs";
9
- import { b as ye, n as ke, i as ve, m as be } from "./chunks/TypeBrands-C09nE2qO.mjs";
9
+ import { b as ye, n as ke, i as be, m as ve } from "./chunks/TypeBrands-C09nE2qO.mjs";
10
10
  import { c as c3, p as p2 } from "./chunks/TypeBrands-C09nE2qO.mjs";
11
11
  import { a as Se } from "./chunks/AttrRegistry-D9Jx_RVb.mjs";
12
12
  import { b as b2, i as i2 } from "./chunks/AttrRegistry-D9Jx_RVb.mjs";
@@ -14,58 +14,58 @@ import { c as we } from "./chunks/NodeSpec-NZVvcCuH.mjs";
14
14
  import { e as Ee, f as xe } from "./chunks/HTMLUtils-DTqQzcKR.mjs";
15
15
  import { a as Ce, r as Te, f as Ae } from "./chunks/NodeResolver-C2XYkeOi.mjs";
16
16
  import { b as b3, c as c4, w as w3 } from "./chunks/NodeResolver-C2XYkeOi.mjs";
17
- import { n as Re, g as Le, s as Me, r as Ie, d as Ne, a as Be, b as Oe, e as Pe, c as _e, f as De, h as He } from "./chunks/CaretNavigation-7JYpIKbs.mjs";
17
+ import { n as Re, g as Le, s as Me, r as Ie, d as Ne, a as Be, b as Oe, e as _e, c as De, f as Pe, h as He } from "./chunks/CaretNavigation-7JYpIKbs.mjs";
18
18
  import { i as i3, m as m2, j as j3 } from "./chunks/CaretNavigation-7JYpIKbs.mjs";
19
19
  import { d as ze, a as je, m as $e, b as Ke, s as Fe, n as Ue, c as We, e as Ve, f as Ge, i as qe, g as Je, h as Qe, r as Xe, H as Ye } from "./chunks/index-ErZ5_a1o.mjs";
20
20
  import { g as Ze } from "./chunks/Platform-S_xqIqcM.mjs";
21
21
  import { a, i as i4, b as b4 } from "./chunks/Platform-S_xqIqcM.mjs";
22
22
  import { E as et, S as tt, r as nt, L as st, a as rt } from "./chunks/resolvePluginLocale-B4w1OkPy.mjs";
23
- import { T as it } from "./chunks/ToolbarPlugin-DpLVJ71w.mjs";
24
- import { P, b as b5, c as c5, d as d2, e as e3, a as a2 } from "./chunks/ToolbarPlugin-DpLVJ71w.mjs";
23
+ import { T as it } from "./chunks/index-BcDRT4K2.mjs";
24
+ import { P, a as a2, b as b5, c as c5, d as d2, e as e3 } from "./chunks/index-BcDRT4K2.mjs";
25
25
  import { n as ot, a as at, f as ct } from "./chunks/ToolbarKeyboardNav-DhpL8zNV.mjs";
26
- import { a as a3, p as p3 } from "./chunks/PopupPositioning-BTT-_pQ3.mjs";
27
- import { r as r2 } from "./chunks/ColorGrid-Dneqb8if.mjs";
28
- import { D as lt, d as ht, C as dt } from "./chunks/index-D515iymW.mjs";
29
- import { a as a4, b as b6, c as c6, i as i5, n as n2, w as w4 } from "./chunks/index-D515iymW.mjs";
26
+ import { a as a3, p as p3 } from "./chunks/PopupPositioning-CgjgAKjp.mjs";
27
+ import { r as r2 } from "./chunks/ColorGrid--lBQ7jCK.mjs";
28
+ import { D as lt, d as ht, C as dt } from "./chunks/index--7pBhSF4.mjs";
29
+ import { a as a4, b as b6, c as c6, i as i5, n as n2, w as w4 } from "./chunks/index--7pBhSF4.mjs";
30
30
  import { f as ut } from "./chunks/ToolbarItem-BpZggUGo.mjs";
31
31
  import { T as pt } from "./chunks/index-Cd3uJLP3.mjs";
32
32
  import { a as a5, b as b7 } from "./chunks/index-Cd3uJLP3.mjs";
33
- import { H as ft } from "./chunks/index--n1RGpq-.mjs";
34
- import { a as a6, b as b8 } from "./chunks/index--n1RGpq-.mjs";
33
+ import { H as ft } from "./chunks/index-BjFBWBOC.mjs";
34
+ import { a as a6, b as b8 } from "./chunks/index-BjFBWBOC.mjs";
35
35
  import { L as gt } from "./chunks/index-fsVJLutn.mjs";
36
36
  import { a as a7, b as b9 } from "./chunks/index-fsVJLutn.mjs";
37
- import { L as mt } from "./chunks/index-BqNUfq-y.mjs";
38
- import { a as a8, b as b10 } from "./chunks/index-BqNUfq-y.mjs";
39
- import { B as yt } from "./chunks/index-Dk49P9N4.mjs";
40
- import { a as a9, b as b11 } from "./chunks/index-Dk49P9N4.mjs";
37
+ import { L as mt } from "./chunks/index-CCyqQ0Dz.mjs";
38
+ import { a as a8, b as b10 } from "./chunks/index-CCyqQ0Dz.mjs";
39
+ import { B as yt } from "./chunks/index-Dum8yE_t.mjs";
40
+ import { a as a9, b as b11 } from "./chunks/index-Dum8yE_t.mjs";
41
41
  import { S as kt } from "./chunks/index-BXtw5PNN.mjs";
42
42
  import { a as a10, b as b12 } from "./chunks/index-BXtw5PNN.mjs";
43
- import { T as vt } from "./chunks/index-BvqkuEY1.mjs";
44
- import { a as a11, b as b13 } from "./chunks/index-BvqkuEY1.mjs";
45
- import { H as bt } from "./chunks/index-CluzpB2b.mjs";
46
- import { a as a12, b as b14 } from "./chunks/index-CluzpB2b.mjs";
47
- import { A as St } from "./chunks/index-ABlTDvEX.mjs";
48
- import { a as a13, b as b15, c as c7, d as d3 } from "./chunks/index-ABlTDvEX.mjs";
49
- import { F as wt } from "./chunks/index-CWltg1wK.mjs";
50
- import { a as a14, b as b16 } from "./chunks/index-CWltg1wK.mjs";
51
- import { F as Et } from "./chunks/index-4or5UzNO.mjs";
52
- import { a as a15, b as b17 } from "./chunks/index-4or5UzNO.mjs";
53
- import { T as xt } from "./chunks/index-BhDXjueu.mjs";
54
- import { a as a16, b as b18, c as c8, d as d4, e as e4, f as f2, g as g2, h as h3, i as i6, j as j4, k as k3, l as l2 } from "./chunks/index-BhDXjueu.mjs";
55
- import { H as Ct } from "./chunks/index-D3NlpmT1.mjs";
56
- import { a as a17, b as b19 } from "./chunks/index-D3NlpmT1.mjs";
43
+ import { T as bt } from "./chunks/index-fx3KIap3.mjs";
44
+ import { a as a11, b as b13 } from "./chunks/index-fx3KIap3.mjs";
45
+ import { H as vt } from "./chunks/index-DxbQirny.mjs";
46
+ import { a as a12, b as b14 } from "./chunks/index-DxbQirny.mjs";
47
+ import { A as St } from "./chunks/index-toj88jtL.mjs";
48
+ import { a as a13, b as b15, c as c7, d as d3 } from "./chunks/index-toj88jtL.mjs";
49
+ import { F as wt } from "./chunks/index-WpbK_s_H.mjs";
50
+ import { a as a14, b as b16 } from "./chunks/index-WpbK_s_H.mjs";
51
+ import { F as Et } from "./chunks/index-BXCkjDax.mjs";
52
+ import { a as a15, b as b17 } from "./chunks/index-BXCkjDax.mjs";
53
+ import { T as xt } from "./chunks/index-DtRfqsq5.mjs";
54
+ import { a as a16, b as b18, c as c8, d as d4, e as e4, f as f2, g as g2, h as h3, i as i6, j as j4, k as k3, l as l2 } from "./chunks/index-DtRfqsq5.mjs";
55
+ import { H as Ct } from "./chunks/index-WrqH1wG8.mjs";
56
+ import { a as a17, b as b19 } from "./chunks/index-WrqH1wG8.mjs";
57
57
  import { S as Tt } from "./chunks/index-C1opJocO.mjs";
58
58
  import { a as a18, b as b20 } from "./chunks/index-C1opJocO.mjs";
59
- import { I as At } from "./chunks/index-DyzigvbZ.mjs";
60
- import { D as D2, a as a19, b as b21, c as c9 } from "./chunks/index-DyzigvbZ.mjs";
59
+ import { I as At } from "./chunks/index-DSAuGP4n.mjs";
60
+ import { D as D2, a as a19, b as b21, c as c9 } from "./chunks/index-DSAuGP4n.mjs";
61
61
  import { GapCursorPlugin as Rt } from "./plugins/gap-cursor.mjs";
62
- import { s as Lt, b as Mt, c as It, d as Nt, a as Bt, u as Ot, e as Pt, r as _t } from "./chunks/StyleRuntime-ChRjVQwL.mjs";
62
+ import { s as Lt, b as Mt, c as It, a as Nt, u as Bt, d as Ot, r as _t } from "./chunks/StyleRuntime-CP4NCwKT.mjs";
63
63
  import Dt from "dompurify";
64
- import { STARTER_FONTS as Ht } from "./fonts.mjs";
64
+ import { STARTER_FONTS as Pt } from "./fonts.mjs";
65
65
  import { a as a20, g as g3, i as i7, r as r3 } from "./chunks/AttributedMarkCommands-BtLea72z.mjs";
66
66
  import { c as c10, a as a21, b as b22, i as i8, s as s2 } from "./chunks/NavigationUtils-Cspt2ZrK.mjs";
67
67
  import { f as f3 } from "./chunks/RangeIterator-Bh4Vl_6D.mjs";
68
- class zt {
68
+ class Ht {
69
69
  _nodeSpecs = /* @__PURE__ */ new Map();
70
70
  _markSpecs = /* @__PURE__ */ new Map();
71
71
  _inlineNodeSpecs = /* @__PURE__ */ new Map();
@@ -141,7 +141,7 @@ class zt {
141
141
  this._nodeSpecs.clear(), this._markSpecs.clear(), this._inlineNodeSpecs.clear();
142
142
  }
143
143
  }
144
- function jt(e5, t3, n3) {
144
+ function zt(e5, t3, n3) {
145
145
  const s3 = e5.getNodeSpec(t3);
146
146
  if (!s3?.content) return true;
147
147
  const r4 = e5.getNodeSpec(n3), i9 = r4?.group;
@@ -151,50 +151,50 @@ function jt(e5, t3, n3) {
151
151
  }
152
152
  return false;
153
153
  }
154
- function $t(e5, t3, n3) {
154
+ function jt(e5, t3, n3) {
155
155
  const s3 = e5.getNodeSpec(t3);
156
156
  if (!s3?.content) return true;
157
157
  const { min: r4 = 0, max: i9 = Number.POSITIVE_INFINITY } = s3.content, o2 = n3.filter((e6) => "text" !== e6);
158
158
  if (o2.length < r4 || o2.length > i9) return false;
159
- for (const n4 of o2) if (!jt(e5, t3, n4)) return false;
159
+ for (const n4 of o2) if (!zt(e5, t3, n4)) return false;
160
160
  return true;
161
161
  }
162
- function Kt(e5) {
162
+ function $t(e5) {
163
163
  e5.registerNodeSpec({ type: "paragraph", group: "block", content: { allow: ["text"] }, toDOM: (e6) => we("p", e6.id), toHTML: (e6, t3) => `<p>${t3 || "<br>"}</p>`, parseHTML: [{ tag: "p" }, { tag: "div", priority: 10 }], sanitize: { tags: ["p"] } });
164
164
  }
165
- function Ft(e5, t3, n3) {
166
- return { children: Ut(e5.children, t3, n3) };
165
+ function Kt(e5, t3, n3) {
166
+ return { children: Ft(e5.children, t3, n3) };
167
167
  }
168
- function Ut(e5, t3, n3) {
168
+ function Ft(e5, t3, n3) {
169
169
  return e5.map((e6) => {
170
170
  if (!S(e6)) return e6;
171
171
  if (e6.id === t3) return n3(e6);
172
- const s3 = Ut(e6.children, t3, n3);
172
+ const s3 = Ft(e6.children, t3, n3);
173
173
  return s3 === e6.children ? e6 : { ...e6, children: s3 };
174
174
  });
175
175
  }
176
- function Wt(e5, t3, n3) {
176
+ function Ut(e5, t3, n3) {
177
177
  if (0 === t3.length) return e5;
178
178
  const s3 = t3[0];
179
- return s3 ? { children: e5.children.map((e6) => S(e6) && e6.id === s3 ? 1 === t3.length ? n3(e6) : Vt(e6, t3, 1, n3) : e6) } : e5;
179
+ return s3 ? { children: e5.children.map((e6) => S(e6) && e6.id === s3 ? 1 === t3.length ? n3(e6) : Wt(e6, t3, 1, n3) : e6) } : e5;
180
180
  }
181
- function Vt(e5, t3, n3, s3) {
181
+ function Wt(e5, t3, n3, s3) {
182
182
  const r4 = t3[n3];
183
183
  if (!r4) return e5;
184
- const i9 = e5.children.map((e6) => S(e6) && e6.id === r4 ? n3 === t3.length - 1 ? s3(e6) : Vt(e6, t3, n3 + 1, s3) : e6);
184
+ const i9 = e5.children.map((e6) => S(e6) && e6.id === r4 ? n3 === t3.length - 1 ? s3(e6) : Wt(e6, t3, n3 + 1, s3) : e6);
185
185
  return { ...e5, children: i9 };
186
186
  }
187
- function Gt(e5, t3, n3) {
187
+ function Vt(e5, t3, n3) {
188
188
  if (t3(e5)) return n3(e5);
189
189
  let s3 = false;
190
190
  const r4 = e5.map((e6) => {
191
191
  if (!S(e6)) return e6;
192
- const r5 = Gt(e6.children, t3, n3);
192
+ const r5 = Vt(e6.children, t3, n3);
193
193
  return r5 ? (s3 = true, { ...e6, children: r5 }) : e6;
194
194
  });
195
195
  return s3 ? r4 : null;
196
196
  }
197
- function qt(e5, t3, n3) {
197
+ function Gt(e5, t3, n3) {
198
198
  const s3 = [];
199
199
  let r4 = 0;
200
200
  for (const i9 of e5) {
@@ -213,7 +213,7 @@ function qt(e5, t3, n3) {
213
213
  }
214
214
  return 0 === s3.length && s3.push(T("")), s3;
215
215
  }
216
- function Jt(e5, t3, n3, s3, r4) {
216
+ function qt(e5, t3, n3, s3, r4) {
217
217
  const i9 = [];
218
218
  let o2 = 0;
219
219
  for (const a22 of e5) {
@@ -238,16 +238,16 @@ function Jt(e5, t3, n3, s3, r4) {
238
238
  }
239
239
  return i9;
240
240
  }
241
- function Qt(e5, t3) {
241
+ function Jt(e5, t3) {
242
242
  if (e5.every((e6) => R(e6) || C(e6))) return t3;
243
243
  const n3 = e5.filter((e6) => !R(e6) && !C(e6));
244
244
  return [...t3, ...n3];
245
245
  }
246
- function Xt(e5, t3) {
246
+ function Qt(e5, t3) {
247
247
  switch (t3.type) {
248
248
  case "insertText":
249
249
  return (function(e6, t4) {
250
- return Ft(e6, t4.blockId, (e7) => {
250
+ return Kt(e6, t4.blockId, (e7) => {
251
251
  const n3 = I(e7), s3 = t4.segments ? (function(e8, t5, n4) {
252
252
  const s4 = [];
253
253
  let r4 = 0, i9 = false;
@@ -288,12 +288,12 @@ function Xt(e5, t3) {
288
288
  }
289
289
  return o2 || r4.push(T(n4, s4)), r4;
290
290
  })(n3, t4.offset, t4.text, t4.marks);
291
- return { ...e7, children: Qt(e7.children, N(s3)) };
291
+ return { ...e7, children: Jt(e7.children, N(s3)) };
292
292
  });
293
293
  })(e5, t3);
294
294
  case "deleteText":
295
295
  return (function(e6, t4) {
296
- return Ft(e6, t4.blockId, (e7) => {
296
+ return Kt(e6, t4.blockId, (e7) => {
297
297
  const n3 = (function(e8, t5, n4) {
298
298
  const s3 = [];
299
299
  let r4 = 0;
@@ -313,22 +313,22 @@ function Xt(e5, t3) {
313
313
  }
314
314
  return s3;
315
315
  })(I(e7), t4.from, t4.to);
316
- return { ...e7, children: Qt(e7.children, N(n3)) };
316
+ return { ...e7, children: Jt(e7.children, N(n3)) };
317
317
  });
318
318
  })(e5, t3);
319
319
  case "splitBlock":
320
320
  return (function(e6, t4) {
321
- const n3 = Gt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.blockId), (e7) => {
321
+ const n3 = Vt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.blockId), (e7) => {
322
322
  const n4 = e7.findIndex((e8) => S(e8) && e8.id === t4.blockId);
323
323
  if (-1 === n4) return e7;
324
- const s3 = e7[n4], r4 = I(s3), i9 = O(s3), o2 = qt(r4, 0, t4.offset), a22 = qt(r4, t4.offset, i9), c11 = { ...s3, children: N(o2) }, l3 = _(s3.type, N(a22), t4.newBlockId, s3.attrs), h4 = [...e7];
324
+ const s3 = e7[n4], r4 = I(s3), i9 = O(s3), o2 = Gt(r4, 0, t4.offset), a22 = Gt(r4, t4.offset, i9), c11 = { ...s3, children: N(o2) }, l3 = _(s3.type, N(a22), t4.newBlockId, s3.attrs), h4 = [...e7];
325
325
  return h4.splice(n4, 1, c11, l3), h4;
326
326
  });
327
327
  return n3 ? { children: n3 } : e6;
328
328
  })(e5, t3);
329
329
  case "mergeBlocks":
330
330
  return (function(e6, t4) {
331
- const n3 = Gt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.targetBlockId) && e7.some((e8) => S(e8) && e8.id === t4.sourceBlockId), (e7) => {
331
+ const n3 = Vt(e6.children, (e7) => e7.some((e8) => S(e8) && e8.id === t4.targetBlockId) && e7.some((e8) => S(e8) && e8.id === t4.sourceBlockId), (e7) => {
332
332
  const n4 = e7.findIndex((e8) => S(e8) && e8.id === t4.targetBlockId), s3 = e7.findIndex((e8) => S(e8) && e8.id === t4.sourceBlockId);
333
333
  if (-1 === n4 || -1 === s3) return e7;
334
334
  const r4 = e7[n4], i9 = e7[s3], o2 = I(r4), a22 = I(i9), c11 = N([...o2, ...a22]), l3 = { ...r4, children: c11 };
@@ -338,23 +338,23 @@ function Xt(e5, t3) {
338
338
  })(e5, t3);
339
339
  case "addMark":
340
340
  return (function(e6, t4) {
341
- return Ft(e6, t4.blockId, (e7) => {
342
- const n3 = Jt(I(e7), t4.from, t4.to, t4.mark, true);
343
- return { ...e7, children: Qt(e7.children, N(n3)) };
341
+ return Kt(e6, t4.blockId, (e7) => {
342
+ const n3 = qt(I(e7), t4.from, t4.to, t4.mark, true);
343
+ return { ...e7, children: Jt(e7.children, N(n3)) };
344
344
  });
345
345
  })(e5, t3);
346
346
  case "removeMark":
347
347
  return (function(e6, t4) {
348
- return Ft(e6, t4.blockId, (e7) => {
349
- const n3 = Jt(I(e7), t4.from, t4.to, t4.mark, false);
350
- return { ...e7, children: Qt(e7.children, N(n3)) };
348
+ return Kt(e6, t4.blockId, (e7) => {
349
+ const n3 = qt(I(e7), t4.from, t4.to, t4.mark, false);
350
+ return { ...e7, children: Jt(e7.children, N(n3)) };
351
351
  });
352
352
  })(e5, t3);
353
353
  case "setStoredMarks":
354
354
  return e5;
355
355
  case "setBlockType":
356
356
  return (function(e6, t4) {
357
- return Ft(e6, t4.blockId, (e7) => ({ ...e7, type: t4.nodeType, ...t4.attrs ? { attrs: t4.attrs } : { attrs: void 0 } }));
357
+ return Kt(e6, t4.blockId, (e7) => ({ ...e7, type: t4.nodeType, ...t4.attrs ? { attrs: t4.attrs } : { attrs: void 0 } }));
358
358
  })(e5, t3);
359
359
  case "insertNode":
360
360
  return (function(e6, t4) {
@@ -362,7 +362,7 @@ function Xt(e5, t3) {
362
362
  const n3 = [...e6.children];
363
363
  return n3.splice(t4.index, 0, t4.node), { children: n3 };
364
364
  }
365
- return Wt(e6, t4.parentPath, (e7) => {
365
+ return Ut(e6, t4.parentPath, (e7) => {
366
366
  const n3 = [...e7.children];
367
367
  return n3.splice(t4.index, 0, t4.node), { ...e7, children: n3 };
368
368
  });
@@ -373,7 +373,7 @@ function Xt(e5, t3) {
373
373
  const n3 = [...e6.children];
374
374
  return n3.splice(t4.index, 1), { children: n3 };
375
375
  }
376
- return Wt(e6, t4.parentPath, (e7) => {
376
+ return Ut(e6, t4.parentPath, (e7) => {
377
377
  const n3 = [...e7.children];
378
378
  return n3.splice(t4.index, 1), { ...e7, children: n3 };
379
379
  });
@@ -381,11 +381,11 @@ function Xt(e5, t3) {
381
381
  case "setNodeAttr":
382
382
  return (function(e6, t4) {
383
383
  const n3 = t4.path[t4.path.length - 1];
384
- return n3 ? Ft(e6, n3, (e7) => ({ ...e7, attrs: t4.attrs })) : e6;
384
+ return n3 ? Kt(e6, n3, (e7) => ({ ...e7, attrs: t4.attrs })) : e6;
385
385
  })(e5, t3);
386
386
  case "insertInlineNode":
387
387
  return (function(e6, t4) {
388
- return Ft(e6, t4.blockId, (e7) => {
388
+ return Kt(e6, t4.blockId, (e7) => {
389
389
  const n3 = (function(e8, t5, n4) {
390
390
  const s3 = [];
391
391
  let r4 = 0, i9 = false;
@@ -403,36 +403,36 @@ function Xt(e5, t3) {
403
403
  }
404
404
  return i9 || s3.push(n4), s3;
405
405
  })(I(e7), t4.offset, t4.node);
406
- return { ...e7, children: Qt(e7.children, N(n3)) };
406
+ return { ...e7, children: Jt(e7.children, N(n3)) };
407
407
  });
408
408
  })(e5, t3);
409
409
  case "removeInlineNode":
410
410
  return (function(e6, t4) {
411
- return Ft(e6, t4.blockId, (e7) => {
411
+ return Kt(e6, t4.blockId, (e7) => {
412
412
  const n3 = (function(e8, t5) {
413
413
  const n4 = [];
414
414
  let s3 = 0;
415
415
  for (const r4 of e8) C(r4) ? (s3 !== t5 && n4.push(r4), s3 += 1) : (n4.push(r4), s3 += r4.text.length);
416
416
  return n4;
417
417
  })(I(e7), t4.offset);
418
- return { ...e7, children: Qt(e7.children, N(n3)) };
418
+ return { ...e7, children: Jt(e7.children, N(n3)) };
419
419
  });
420
420
  })(e5, t3);
421
421
  case "setInlineNodeAttr":
422
422
  return (function(e6, t4) {
423
- return Ft(e6, t4.blockId, (e7) => {
423
+ return Kt(e6, t4.blockId, (e7) => {
424
424
  const n3 = (function(e8, t5, n4) {
425
425
  const s3 = [];
426
426
  let r4 = 0;
427
427
  for (const i9 of e8) C(i9) ? (r4 === t5 ? s3.push({ ...i9, attrs: n4 }) : s3.push(i9), r4 += 1) : (s3.push(i9), r4 += i9.text.length);
428
428
  return s3;
429
429
  })(I(e7), t4.offset, t4.attrs);
430
- return { ...e7, children: Qt(e7.children, n3) };
430
+ return { ...e7, children: Jt(e7.children, n3) };
431
431
  });
432
432
  })(e5, t3);
433
433
  }
434
434
  }
435
- function Yt(e5) {
435
+ function Xt(e5) {
436
436
  switch (e5.type) {
437
437
  case "insertText":
438
438
  return { type: "deleteText", blockId: e5.blockId, from: e5.offset, to: e5.offset + e5.text.length, deletedText: e5.text, deletedMarks: e5.marks, deletedSegments: e5.segments ?? [{ text: e5.text, marks: [...e5.marks] }], ...e5.path ? { path: e5.path } : {} };
@@ -464,10 +464,10 @@ function Yt(e5) {
464
464
  return { type: "setInlineNodeAttr", blockId: e5.blockId, offset: e5.offset, attrs: e5.previousAttrs, previousAttrs: e5.attrs, ...e5.path ? { path: e5.path } : {} };
465
465
  }
466
466
  }
467
- function Zt(e5) {
468
- return { steps: e5.steps.map(Yt).reverse(), selectionBefore: e5.selectionAfter, selectionAfter: e5.selectionBefore, storedMarksAfter: null, metadata: { origin: "history", timestamp: Date.now() } };
467
+ function Yt(e5) {
468
+ return { steps: e5.steps.map(Xt).reverse(), selectionBefore: e5.selectionAfter, selectionAfter: e5.selectionBefore, storedMarksAfter: null, metadata: { origin: "history", timestamp: Date.now() } };
469
469
  }
470
- class en {
470
+ class Zt {
471
471
  steps = [];
472
472
  selection;
473
473
  storedMarks;
@@ -607,10 +607,10 @@ class en {
607
607
  return { steps: [...this.steps], selectionBefore: this.selectionBefore, selectionAfter: this.selection, storedMarksAfter: this.storedMarks, metadata: { origin: this.origin, timestamp: Date.now(), ...this._readonlyAllowed ? { readonlyAllowed: true } : {} } };
608
608
  }
609
609
  advanceDoc(e5) {
610
- this.workingDoc && (this.workingDoc = Xt(this.workingDoc, e5));
610
+ this.workingDoc && (this.workingDoc = Qt(this.workingDoc, e5));
611
611
  }
612
612
  }
613
- class tn {
613
+ class en {
614
614
  doc;
615
615
  selection;
616
616
  storedMarks;
@@ -622,21 +622,21 @@ class tn {
622
622
  }
623
623
  static create(e5) {
624
624
  const t3 = e5?.schema ?? pe(), n3 = e5?.doc ?? W(), s3 = n3.children[0], r4 = e5?.selection ?? re(s3 ? s3.id : ye(""), 0);
625
- return new tn(n3, r4, null, t3);
625
+ return new en(n3, r4, null, t3);
626
626
  }
627
627
  transaction(e5 = "api") {
628
- return new en(this.selection, this.storedMarks, e5, this.doc);
628
+ return new Zt(this.selection, this.storedMarks, e5, this.doc);
629
629
  }
630
630
  apply(e5) {
631
631
  let t3 = this.doc;
632
- for (const n4 of e5.steps) t3 = Xt(t3, n4);
632
+ for (const n4 of e5.steps) t3 = Qt(t3, n4);
633
633
  const n3 = (function(e6, t4) {
634
- if (ie(t4)) return Ce(e6, t4.nodeId) ? t4 : sn(e6, t4);
635
- if (oe(t4)) return Ce(e6, t4.blockId) ? t4 : sn(e6, t4);
636
- const n4 = nn(e6, t4.anchor), s3 = nn(e6, t4.head);
634
+ if (ie(t4)) return Ce(e6, t4.nodeId) ? t4 : nn(e6, t4);
635
+ if (oe(t4)) return Ce(e6, t4.blockId) ? t4 : nn(e6, t4);
636
+ const n4 = tn(e6, t4.anchor), s3 = tn(e6, t4.head);
637
637
  return n4 === t4.anchor && s3 === t4.head ? t4 : ae(n4, s3);
638
638
  })(t3, e5.selectionAfter);
639
- return new tn(t3, n3, e5.storedMarksAfter, this.schema);
639
+ return new en(t3, n3, e5.storedMarksAfter, this.schema);
640
640
  }
641
641
  getBlock(e5) {
642
642
  return this._blockMap ??= (function(e6) {
@@ -667,10 +667,10 @@ class tn {
667
667
  return { doc: this.doc, selection: this.selection };
668
668
  }
669
669
  static fromJSON(e5, t3) {
670
- return new tn(e5.doc, e5.selection, null, t3 ?? pe());
670
+ return new en(e5.doc, e5.selection, null, t3 ?? pe());
671
671
  }
672
672
  }
673
- function nn(e5, t3) {
673
+ function tn(e5, t3) {
674
674
  const n3 = Ce(e5, t3.blockId);
675
675
  if (n3) {
676
676
  const e6 = O(n3);
@@ -679,27 +679,27 @@ function nn(e5, t3) {
679
679
  const s3 = e5.children[0];
680
680
  return s3 ? ce(s3.id, 0) : t3;
681
681
  }
682
- function sn(e5, t3) {
683
- const n3 = rn(e5.children);
682
+ function nn(e5, t3) {
683
+ const n3 = sn(e5.children);
684
684
  return n3 ? re(n3.id, 0) : t3;
685
685
  }
686
- function rn(e5) {
686
+ function sn(e5) {
687
687
  for (const t3 of e5) {
688
688
  if (!S(t3)) continue;
689
689
  if (V(t3)) return t3;
690
- const e6 = rn(t3.children);
690
+ const e6 = sn(t3.children);
691
691
  if (e6) return e6;
692
692
  }
693
693
  return null;
694
694
  }
695
- function on(e5) {
695
+ function rn(e5) {
696
696
  for (const t3 of e5.steps) if ("setStoredMarks" !== t3.type) return false;
697
697
  return true;
698
698
  }
699
- function an(e5) {
700
- return !!e5.metadata.readonlyAllowed || on(e5);
699
+ function on(e5) {
700
+ return !!e5.metadata.readonlyAllowed || rn(e5);
701
701
  }
702
- class cn {
702
+ class an {
703
703
  undoStack = [];
704
704
  redoStack = [];
705
705
  groupTimeoutMs;
@@ -722,7 +722,7 @@ class cn {
722
722
  for (let e6 = t3.transactions.length - 1; e6 >= 0; e6--) {
723
723
  const r4 = t3.transactions[e6];
724
724
  if (!r4) continue;
725
- const i9 = Zt(r4);
725
+ const i9 = Yt(r4);
726
726
  n3 = n3.apply(i9), s3.push(...i9.steps);
727
727
  }
728
728
  return this.redoStack.push({ transactions: t3.transactions, timestamp: Date.now() }), this.lastOrigin = null, { state: n3, transaction: { steps: s3, selectionBefore: e5.selection, selectionAfter: n3.selection, storedMarksAfter: n3.storedMarks, metadata: { origin: "history", timestamp: Date.now(), historyDirection: "undo" } } };
@@ -751,7 +751,7 @@ class cn {
751
751
  return s3 === r4;
752
752
  }
753
753
  }
754
- function ln(e5, t3) {
754
+ function cn(e5, t3) {
755
755
  const n3 = e5.selection;
756
756
  if (ie(n3)) return ze(e5, n3);
757
757
  if (oe(n3)) return null;
@@ -763,13 +763,13 @@ function ln(e5, t3) {
763
763
  const [i9, o2] = r4;
764
764
  return e5.transaction("input").deleteTextAt(s3.id, i9, o2).setSelection(re(s3.id, i9)).build();
765
765
  }
766
- function hn(e5) {
767
- return ln(e5, { merge: Ke, range: (e6, t3) => t3 > 0 ? [t3 - 1, t3] : null });
766
+ function ln(e5) {
767
+ return cn(e5, { merge: Ke, range: (e6, t3) => t3 > 0 ? [t3 - 1, t3] : null });
768
768
  }
769
- function dn(e5) {
770
- return ln(e5, { merge: $e, range: (e6, t3) => t3 < O(e6) ? [t3, t3 + 1] : null });
769
+ function hn(e5) {
770
+ return cn(e5, { merge: $e, range: (e6, t3) => t3 < O(e6) ? [t3, t3 + 1] : null });
771
771
  }
772
- class un {
772
+ class dn {
773
773
  constructor(e5, t3) {
774
774
  this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.undo = t3.undo, this.redo = t3.redo, this.keymapRegistry = t3.keymapRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.compositionTracker = t3.compositionTracker, this.handleKeydown = this.onKeydown.bind(this), e5.addEventListener("keydown", this.handleKeydown);
775
775
  }
@@ -787,7 +787,7 @@ class un {
787
787
  if (this.handleGapCursorKeys(e5)) return;
788
788
  if (this.isReadOnly()) {
789
789
  if (this.keymapRegistry) {
790
- const t4 = pn(e5), n4 = this.keymapRegistry.getKeymapsByPriority().navigation;
790
+ const t4 = un(e5), n4 = this.keymapRegistry.getKeymapsByPriority().navigation;
791
791
  for (let s4 = n4.length - 1; s4 >= 0; s4--) {
792
792
  const r4 = n4[s4]?.[t4];
793
793
  if (r4?.()) return void e5.preventDefault();
@@ -796,7 +796,7 @@ class un {
796
796
  return void this.handleEscape(e5);
797
797
  }
798
798
  if (this.keymapRegistry) {
799
- const t4 = pn(e5), n4 = this.keymapRegistry.getKeymapsByPriority();
799
+ const t4 = un(e5), n4 = this.keymapRegistry.getKeymapsByPriority();
800
800
  for (const s4 of [n4.context, n4.navigation, n4.default]) for (let n5 = s4.length - 1; n5 >= 0; n5--) {
801
801
  const r4 = s4[n5]?.[t4];
802
802
  if (r4?.()) return void e5.preventDefault();
@@ -892,13 +892,13 @@ class un {
892
892
  this.element.removeEventListener("keydown", this.handleKeydown);
893
893
  }
894
894
  }
895
- function pn(e5) {
895
+ function un(e5) {
896
896
  const t3 = [];
897
897
  (e5.metaKey || e5.ctrlKey) && t3.push("Mod"), e5.shiftKey && t3.push("Shift"), e5.altKey && t3.push("Alt");
898
898
  let n3 = e5.key;
899
899
  return " " === n3 ? n3 = "Space" : 1 === n3.length && (n3 = n3.toUpperCase()), t3.push(n3), t3.join("-");
900
900
  }
901
- function fn(e5) {
901
+ function pn(e5) {
902
902
  const t3 = e5.getMarkTypes(), n3 = /* @__PURE__ */ new Map();
903
903
  for (const s3 of t3) {
904
904
  const t4 = e5.getMarkSpec(s3);
@@ -906,11 +906,11 @@ function fn(e5) {
906
906
  }
907
907
  return n3;
908
908
  }
909
- function gn(e5, t3, n3, s3) {
909
+ function fn(e5, t3, n3, s3) {
910
910
  if ("" === e5) return "";
911
911
  let r4 = Ee(e5);
912
912
  if (0 === t3.length) return r4;
913
- const i9 = s3 ?? fn(n3), o2 = [...t3].sort((e6, t4) => (i9.get(e6.type) ?? 99) - (i9.get(t4.type) ?? 99)), a22 = [], c11 = [];
913
+ const i9 = s3 ?? pn(n3), o2 = [...t3].sort((e6, t4) => (i9.get(e6.type) ?? 99) - (i9.get(t4.type) ?? 99)), a22 = [], c11 = [];
914
914
  for (const e6 of o2) {
915
915
  const t4 = n3.getMarkSpec(e6.type);
916
916
  if (t4?.toHTMLStyle) {
@@ -925,6 +925,28 @@ function gn(e5, t3, n3, s3) {
925
925
  }
926
926
  return r4;
927
927
  }
928
+ function gn(e5, t3, n3, s3, r4) {
929
+ if ("" === e5) return "";
930
+ let i9 = Ee(e5);
931
+ if (0 === t3.length) return i9;
932
+ const o2 = r4 ?? pn(n3), a22 = [...t3].sort((e6, t4) => (o2.get(e6.type) ?? 99) - (o2.get(t4.type) ?? 99)), c11 = [], l3 = [];
933
+ for (const e6 of a22) {
934
+ const t4 = n3.getMarkSpec(e6.type);
935
+ if (t4?.toHTMLStyle) {
936
+ const n4 = t4.toHTMLStyle(e6);
937
+ n4 && c11.push(n4);
938
+ } else l3.push(e6);
939
+ }
940
+ if (c11.length > 0) {
941
+ const e6 = c11.join("; ");
942
+ i9 = `<span class="${s3.getClassName(e6)}">${i9}</span>`;
943
+ }
944
+ for (const e6 of l3) {
945
+ const t4 = n3.getMarkSpec(e6.type);
946
+ t4?.toHTMLString && (i9 = t4.toHTMLString(e6, i9));
947
+ }
948
+ return i9;
949
+ }
928
950
  let mn;
929
951
  class yn {
930
952
  constructor(e5, t3) {
@@ -992,7 +1014,7 @@ class yn {
992
1014
  }
993
1015
  const l3 = a22.join("\n");
994
1016
  if (e5.setData("text/plain", l3), this.schemaRegistry) {
995
- const n4 = fn(this.schemaRegistry), a23 = [];
1017
+ const n4 = pn(this.schemaRegistry), a23 = [];
996
1018
  for (let e6 = i9; e6 <= o2; e6++) {
997
1019
  const c12 = s3[e6];
998
1020
  if (!c12) continue;
@@ -1016,7 +1038,7 @@ class yn {
1016
1038
  else {
1017
1039
  if (R(e6)) {
1018
1040
  const r6 = Math.max(0, t3 - o2), a22 = Math.min(e6.text.length, n3 - o2), c11 = e6.text.slice(r6, a22);
1019
- c11.length > 0 && this.schemaRegistry && i9.push(gn(c11, e6.marks, this.schemaRegistry, s3));
1041
+ c11.length > 0 && this.schemaRegistry && i9.push(fn(c11, e6.marks, this.schemaRegistry, s3));
1020
1042
  } else if (C(e6)) {
1021
1043
  const t4 = this.schemaRegistry?.getInlineNodeSpec(e6.inlineType);
1022
1044
  t4?.toHTMLString && i9.push(t4.toHTMLString(e6));
@@ -1046,7 +1068,7 @@ class kn {
1046
1068
  this._composing = false, this._activeBlockId = null;
1047
1069
  }
1048
1070
  }
1049
- class vn {
1071
+ class bn {
1050
1072
  _contextKeymaps = [];
1051
1073
  _navigationKeymaps = [];
1052
1074
  _defaultKeymaps = [];
@@ -1084,7 +1106,7 @@ class vn {
1084
1106
  }
1085
1107
  }
1086
1108
  }
1087
- class bn {
1109
+ class vn {
1088
1110
  _inputRules = [];
1089
1111
  registerInputRule(e5) {
1090
1112
  this._inputRules.push(e5);
@@ -1383,9 +1405,9 @@ class On {
1383
1405
  registrations = /* @__PURE__ */ new Map();
1384
1406
  eventBus = new Bn();
1385
1407
  pluginStyleSheets = [];
1386
- schemaRegistry = new zt();
1387
- keymapRegistry = new vn();
1388
- inputRuleRegistry = new bn();
1408
+ schemaRegistry = new Ht();
1409
+ keymapRegistry = new bn();
1410
+ inputRuleRegistry = new vn();
1389
1411
  fileHandlerRegistry = new Sn();
1390
1412
  nodeViewRegistry = new En();
1391
1413
  toolbarRegistry = new xn();
@@ -1671,8 +1693,8 @@ class On {
1671
1693
  return r4;
1672
1694
  }
1673
1695
  }
1674
- const Pn = { label: "Print", tooltip: (e5) => `Print (${e5})`, printingAnnouncement: "Printing" }, _n = { en: Pn, de: { label: "Drucken", tooltip: (e5) => `Drucken (${e5})`, printingAnnouncement: "Druckvorgang" }, es: { label: "Imprimir", tooltip: (e5) => `Imprimir (${e5})`, printingAnnouncement: "Imprimiendo" }, fr: { label: "Imprimer", tooltip: (e5) => `Imprimer (${e5})`, printingAnnouncement: "Impression" }, zh: { label: "打印", tooltip: (e5) => `打印 (${e5})`, printingAnnouncement: "正在打印" }, ru: { label: "Печать", tooltip: (e5) => `Печать (${e5})`, printingAnnouncement: "Печать" }, ar: { label: "طباعة", tooltip: (e5) => `طباعة (${e5})`, printingAnnouncement: "جارٍ الطباعة" }, hi: { label: "प्रिंट", tooltip: (e5) => `प्रिंट (${e5})`, printingAnnouncement: "प्रिंट हो रहा है" } };
1675
- function Dn(e5) {
1696
+ const _n = { label: "Print", tooltip: (e5) => `Print (${e5})`, printingAnnouncement: "Printing" }, Dn = { en: _n, de: { label: "Drucken", tooltip: (e5) => `Drucken (${e5})`, printingAnnouncement: "Druckvorgang" }, es: { label: "Imprimir", tooltip: (e5) => `Imprimir (${e5})`, printingAnnouncement: "Imprimiendo" }, fr: { label: "Imprimer", tooltip: (e5) => `Imprimer (${e5})`, printingAnnouncement: "Impression" }, zh: { label: "打印", tooltip: (e5) => `打印 (${e5})`, printingAnnouncement: "正在打印" }, ru: { label: "Печать", tooltip: (e5) => `Печать (${e5})`, printingAnnouncement: "Печать" }, ar: { label: "طباعة", tooltip: (e5) => `طباعة (${e5})`, printingAnnouncement: "جارٍ الطباعة" }, hi: { label: "प्रिंट", tooltip: (e5) => `प्रिंट (${e5})`, printingAnnouncement: "प्रिंट हो रहा है" } };
1697
+ function Pn(e5) {
1676
1698
  return "function" == typeof e5 ? e5() : e5;
1677
1699
  }
1678
1700
  const Hn = 96 / 25.4, zn = { DINA4: "din-a4", DINA5: "din-a5", USLetter: "us-letter", USLegal: "us-legal" };
@@ -1706,7 +1728,7 @@ class Zn {
1706
1728
  this.config = e5 ?? {};
1707
1729
  }
1708
1730
  init(e5) {
1709
- this.locale = nt(_n, e5, this.config.locale);
1731
+ this.locale = nt(Dn, e5, this.config.locale);
1710
1732
  const t3 = e5.getContainer(), n3 = t3.getRootNode();
1711
1733
  if (n3 instanceof ShadowRoot) {
1712
1734
  const s4 = n3.host, r5 = e5.getEventBus();
@@ -1788,11 +1810,11 @@ ${n6.join("\n")}
1788
1810
  })(n5, t5), (function(e8, t6) {
1789
1811
  if (t6.header) {
1790
1812
  const n6 = document.createElement("div");
1791
- n6.className = "notectl-print-header", n6.innerHTML = Dn(t6.header), e8.insertBefore(n6, e8.firstChild);
1813
+ n6.className = "notectl-print-header", n6.innerHTML = Pn(t6.header), e8.insertBefore(n6, e8.firstChild);
1792
1814
  }
1793
1815
  if (t6.footer) {
1794
1816
  const n6 = document.createElement("div");
1795
- n6.className = "notectl-print-footer", n6.innerHTML = Dn(t6.footer), e8.appendChild(n6);
1817
+ n6.className = "notectl-print-footer", n6.innerHTML = Pn(t6.footer), e8.appendChild(n6);
1796
1818
  }
1797
1819
  })(n5, t5), n5;
1798
1820
  })(n4, o3).outerHTML, o3.title ?? "", t4.closest("[lang]")?.getAttribute("lang") ?? (document.documentElement.lang || "en")), c11 = { html: a22 };
@@ -1868,12 +1890,57 @@ function ls(e5) {
1868
1890
  const t3 = new CSSStyleSheet();
1869
1891
  return t3.replaceSync(cs(e5)), t3;
1870
1892
  }
1871
- const hs = { EN: "en", DE: "de", ES: "es", FR: "fr", ZH: "zh", RU: "ru", AR: "ar", HI: "hi", BROWSER: "browser" }, ds = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]);
1872
- function us(e5, t3) {
1873
- const n3 = ps(e5.children, t3), s3 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], r4 = t3 ? t3.getAllowedAttrs() : ["style"];
1874
- return Dt.sanitize(n3, { ALLOWED_TAGS: s3, ALLOWED_ATTR: r4 });
1893
+ const hs = { EN: "en", DE: "de", ES: "es", FR: "fr", ZH: "zh", RU: "ru", AR: "ar", HI: "hi", BROWSER: "browser" };
1894
+ function ds(e5) {
1895
+ let t3 = 2166136261;
1896
+ for (let n3 = 0; n3 < e5.length; n3++) t3 ^= e5.charCodeAt(n3), t3 = Math.imul(t3, 16777619);
1897
+ return (t3 >>> 0).toString(36).padStart(6, "0");
1898
+ }
1899
+ class us {
1900
+ classMap = /* @__PURE__ */ new Map();
1901
+ usedHashes = /* @__PURE__ */ new Set();
1902
+ getClassName(e5) {
1903
+ const t3 = (function(e6) {
1904
+ return e6.split(";").map((e7) => e7.trim()).filter((e7) => e7.length > 0).sort().join("; ");
1905
+ })(e5), n3 = this.classMap.get(t3);
1906
+ if (n3) return n3;
1907
+ let s3 = ds(t3), r4 = 0;
1908
+ for (; this.usedHashes.has(s3); ) r4++, s3 = ds(t3 + String(r4));
1909
+ const i9 = `notectl-s-${s3}`;
1910
+ return this.usedHashes.add(s3), this.classMap.set(t3, i9), i9;
1911
+ }
1912
+ getAlignmentClassName(e5) {
1913
+ const t3 = `text-align: ${e5}`, n3 = this.classMap.get(t3);
1914
+ if (n3) return n3;
1915
+ const s3 = `notectl-align-${e5}`;
1916
+ return this.classMap.set(t3, s3), s3;
1917
+ }
1918
+ toCSS() {
1919
+ if (0 === this.classMap.size) return "";
1920
+ const e5 = [];
1921
+ for (const [t3, n3] of this.classMap) e5.push(`.${n3} { ${t3}; }`);
1922
+ return e5.join("\n");
1923
+ }
1924
+ toStyleMap() {
1925
+ const e5 = /* @__PURE__ */ new Map();
1926
+ for (const [t3, n3] of this.classMap) e5.set(n3, t3);
1927
+ return e5;
1928
+ }
1875
1929
  }
1876
- function ps(e5, t3) {
1930
+ const ps = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]);
1931
+ function fs(e5, t3) {
1932
+ const n3 = { registry: t3, exportCtx: { styleAttr: (e6) => e6 ? ` style="${e6}"` : "" } }, s3 = ms(e5.children, n3), r4 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], i9 = t3 ? t3.getAllowedAttrs() : ["style"];
1933
+ return Dt.sanitize(s3, { ALLOWED_TAGS: r4, ALLOWED_ATTR: i9 });
1934
+ }
1935
+ function gs(e5, t3) {
1936
+ const n3 = new us(), s3 = /* @__PURE__ */ (function(e6) {
1937
+ return { styleAttr: (t4) => t4 ? ` class="${e6.getClassName(t4)}"` : "" };
1938
+ })(n3), r4 = { registry: t3, collector: n3, exportCtx: s3 }, i9 = ms(e5.children, r4), o2 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], a22 = t3 ? t3.getAllowedAttrs() : ["style", "class"];
1939
+ a22.includes("class") || a22.push("class");
1940
+ const c11 = a22.filter((e6) => "style" !== e6);
1941
+ return { html: Dt.sanitize(i9, { ALLOWED_TAGS: o2, ALLOWED_ATTR: c11 }), css: n3.toCSS(), styleMap: n3.toStyleMap() };
1942
+ }
1943
+ function ms(e5, t3) {
1877
1944
  const n3 = [];
1878
1945
  let s3 = 0;
1879
1946
  for (; s3 < e5.length; ) {
@@ -1885,13 +1952,13 @@ function ps(e5, t3) {
1885
1952
  if (!t4 || !Se(t4, "list_item")) break;
1886
1953
  r5.push(t4), s3++;
1887
1954
  }
1888
- n3.push(fs(r5, t3));
1889
- } else n3.push(ms(r4, t3)), s3++;
1955
+ n3.push(ys(r5, t3));
1956
+ } else n3.push(bs(r4, t3)), s3++;
1890
1957
  else s3++;
1891
1958
  }
1892
1959
  return n3.join("");
1893
1960
  }
1894
- function fs(e5, t3) {
1961
+ function ys(e5, t3) {
1895
1962
  const n3 = [], s3 = [];
1896
1963
  for (let r4 = 0; r4 < e5.length; r4++) {
1897
1964
  const i9 = e5[r4];
@@ -1911,8 +1978,8 @@ function fs(e5, t3) {
1911
1978
  const e6 = s3[s3.length - 1];
1912
1979
  e6 && a22 > e6.indent && (n3.push(`<${c11}>`), s3.push({ tag: c11, indent: a22 }));
1913
1980
  }
1914
- const l3 = ms(i9, t3), h4 = e5[r4 + 1], d5 = h4 ? h4.attrs?.indent ?? 0 : void 0;
1915
- void 0 !== d5 && d5 > a22 ? n3.push(gs(l3)) : n3.push(l3);
1981
+ const l3 = bs(i9, t3), h4 = e5[r4 + 1], d5 = h4 ? h4.attrs?.indent ?? 0 : void 0;
1982
+ void 0 !== d5 && d5 > a22 ? n3.push(ks(l3)) : n3.push(l3);
1916
1983
  }
1917
1984
  for (; s3.length > 0; ) {
1918
1985
  const e6 = s3.pop();
@@ -1921,10 +1988,10 @@ function fs(e5, t3) {
1921
1988
  }
1922
1989
  return n3.join("");
1923
1990
  }
1924
- function gs(e5) {
1991
+ function ks(e5) {
1925
1992
  return e5.endsWith("</li>") ? e5.slice(0, -5) : e5;
1926
1993
  }
1927
- function ms(e5, t3) {
1994
+ function bs(e5, t3) {
1928
1995
  const n3 = V(e5) ? (function(e6, t4) {
1929
1996
  const n4 = (function(e7) {
1930
1997
  if (e7.length <= 1) return e7;
@@ -1938,57 +2005,81 @@ function ms(e5, t3) {
1938
2005
  e8 && R(e8) && Q(e8.marks, n5.marks) ? t5[t5.length - 1] = { type: "text", text: e8.text + n5.text, marks: e8.marks } : t5.push(n5);
1939
2006
  }
1940
2007
  return t5;
1941
- })(I(e6)), s4 = [], r5 = t4 ? fn(t4) : void 0;
2008
+ })(I(e6)), s4 = [], r5 = t4.registry ? pn(t4.registry) : void 0;
1942
2009
  for (const e7 of n4) if (C(e7)) {
1943
- const n5 = t4?.getInlineNodeSpec(e7.inlineType);
2010
+ const n5 = t4.registry?.getInlineNodeSpec(e7.inlineType);
1944
2011
  n5?.toHTMLString && s4.push(n5.toHTMLString(e7));
1945
- } else t4 ? s4.push(gn(e7.text, e7.marks, t4, r5)) : "" !== e7.text && s4.push(Ee(e7.text));
2012
+ } else t4.registry && t4.collector ? s4.push(gn(e7.text, e7.marks, t4.registry, t4.collector, r5)) : t4.registry ? s4.push(fn(e7.text, e7.marks, t4.registry, r5)) : "" !== e7.text && s4.push(Ee(e7.text));
1946
2013
  return s4.join("");
1947
- })(e5, t3) : ps(J(e5), t3), s3 = t3?.getNodeSpec(e5.type);
2014
+ })(e5, t3) : ms(J(e5), t3), s3 = t3.registry?.getNodeSpec(e5.type);
1948
2015
  let r4;
1949
- r4 = s3?.toHTML ? s3.toHTML(e5, n3) : `<p>${n3 || "<br>"}</p>`;
1950
- const i9 = e5.attrs?.align, o2 = /style="[^"]*text-align:/.test(r4);
1951
- return i9 && "left" !== i9 && ds.has(i9) && !o2 && (r4 = r4.replace(/>/, ` style="text-align: ${i9}">`)), r4;
2016
+ r4 = s3?.toHTML ? s3.toHTML(e5, n3, t3.exportCtx) : `<p>${n3 || "<br>"}</p>`;
2017
+ const i9 = e5.attrs?.align;
2018
+ if (i9 && "left" !== i9 && ps.has(i9)) if (t3.collector) {
2019
+ const e6 = t3.collector.getAlignmentClassName(i9), n4 = r4.indexOf(">"), s4 = r4.slice(0, n4 + 1).match(/class="([^"]*)"/);
2020
+ r4 = s4 ? r4.replace(`class="${s4[1]}"`, `class="${s4[1]} ${e6}"`) : r4.replace(/>/, ` class="${e6}">`);
2021
+ } else {
2022
+ const e6 = r4.indexOf(">"), t4 = r4.slice(0, e6 + 1).match(/style="([^"]*)"/), n4 = t4?.[1];
2023
+ void 0 !== n4 ? /text-align:/.test(n4) || (r4 = r4.replace(`style="${n4}"`, `style="${n4}; text-align: ${i9}"`)) : r4 = r4.replace(/>/, ` style="text-align: ${i9}">`);
2024
+ }
2025
+ return r4;
1952
2026
  }
1953
- function ys(e5, t3) {
1954
- const n3 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], s3 = t3 ? t3.getAllowedAttrs() : ["style"], r4 = document.createElement("template");
1955
- r4.innerHTML = Dt.sanitize(e5, { ALLOWED_TAGS: n3, ALLOWED_ATTR: s3 });
1956
- const i9 = r4.content, o2 = t3?.getBlockParseRules() ?? [], a22 = [];
1957
- for (const e6 of Array.from(i9.childNodes)) if (e6.nodeType === Node.ELEMENT_NODE) {
2027
+ function vs(e5, t3, n3) {
2028
+ const s3 = t3 ? t3.getAllowedTags() : ["p", "br", "div", "span"], r4 = t3 ? t3.getAllowedAttrs() : ["style"];
2029
+ n3?.styleMap && !r4.includes("class") && r4.push("class");
2030
+ const i9 = document.createElement("template");
2031
+ i9.innerHTML = Dt.sanitize(e5, { ALLOWED_TAGS: s3, ALLOWED_ATTR: r4 });
2032
+ const o2 = i9.content;
2033
+ n3?.styleMap && (function(e6, t4) {
2034
+ const n4 = e6.querySelectorAll("[class]");
2035
+ for (const e7 of Array.from(n4)) {
2036
+ const n5 = e7, s4 = Array.from(n5.classList), r5 = [];
2037
+ for (const e8 of s4) {
2038
+ const s5 = t4.get(e8);
2039
+ if (s5) {
2040
+ const t5 = n5.getAttribute("style") ?? "", i10 = t5 && !t5.endsWith(";") ? "; " : "";
2041
+ n5.setAttribute("style", t5 + i10 + s5), r5.push(e8);
2042
+ }
2043
+ }
2044
+ for (const e8 of r5) n5.classList.remove(e8);
2045
+ }
2046
+ })(o2, n3.styleMap);
2047
+ const a22 = t3?.getBlockParseRules() ?? [], c11 = [];
2048
+ for (const e6 of Array.from(o2.childNodes)) if (e6.nodeType === Node.ELEMENT_NODE) {
1958
2049
  const n4 = e6, s4 = n4.tagName.toLowerCase();
1959
2050
  if ("ul" === s4 || "ol" === s4) {
1960
- ks(n4, "ol" === s4 ? "ordered" : "bullet", 0, a22, t3);
2051
+ Ss(n4, "ol" === s4 ? "ordered" : "bullet", 0, c11, t3);
1961
2052
  continue;
1962
2053
  }
1963
- const r5 = ws(n4, o2);
2054
+ const r5 = Cs(n4, a22);
1964
2055
  if (r5) {
1965
- const e7 = vs(n4, t3), s5 = { ...r5.attrs };
1966
- Ss(n4, s5), a22.push(_(ke(r5.type), e7, void 0, Object.keys(s5).length > 0 ? s5 : void 0));
2056
+ const e7 = ws(n4, t3), s5 = { ...r5.attrs };
2057
+ xs(n4, s5), c11.push(_(ke(r5.type), e7, void 0, Object.keys(s5).length > 0 ? s5 : void 0));
1967
2058
  continue;
1968
2059
  }
1969
- const i10 = vs(n4, t3), c11 = {};
1970
- Ss(n4, c11), a22.push(_(ke("paragraph"), i10, void 0, Object.keys(c11).length > 0 ? c11 : void 0));
1971
- } else e6.nodeType === Node.TEXT_NODE && e6.textContent?.trim() && a22.push(_(ke("paragraph"), [T(e6.textContent.trim())]));
1972
- return 0 === a22.length ? W() : W(a22);
2060
+ const i10 = ws(n4, t3), o3 = {};
2061
+ xs(n4, o3), c11.push(_(ke("paragraph"), i10, void 0, Object.keys(o3).length > 0 ? o3 : void 0));
2062
+ } else e6.nodeType === Node.TEXT_NODE && e6.textContent?.trim() && c11.push(_(ke("paragraph"), [T(e6.textContent.trim())]));
2063
+ return 0 === c11.length ? W() : W(c11);
1973
2064
  }
1974
- function ks(e5, t3, n3, s3, r4) {
2065
+ function Ss(e5, t3, n3, s3, r4) {
1975
2066
  for (const i9 of Array.from(e5.children)) {
1976
2067
  const e6 = i9.tagName.toLowerCase();
1977
2068
  if ("li" === e6) {
1978
- const e7 = i9, o2 = e7.querySelector(':scope > input[type="checkbox"]'), a22 = null !== o2, c11 = o2?.hasAttribute("checked") ?? false, l3 = a22 ? "checklist" : t3, h4 = vs(e7, r4, true), d5 = { listType: l3, indent: n3, checked: c11 };
2069
+ const e7 = i9, o2 = e7.querySelector(':scope > input[type="checkbox"]'), a22 = null !== o2, c11 = o2?.hasAttribute("checked") ?? false, l3 = a22 ? "checklist" : t3, h4 = ws(e7, r4, true), d5 = { listType: l3, indent: n3, checked: c11 };
1979
2070
  s3.push(_(ke("list_item"), h4, void 0, d5));
1980
2071
  for (const t4 of Array.from(e7.children)) {
1981
2072
  const e8 = t4.tagName.toLowerCase();
1982
- "ul" !== e8 && "ol" !== e8 || ks(t4, "ol" === e8 ? "ordered" : "bullet", n3 + 1, s3, r4);
2073
+ "ul" !== e8 && "ol" !== e8 || Ss(t4, "ol" === e8 ? "ordered" : "bullet", n3 + 1, s3, r4);
1983
2074
  }
1984
- } else "ul" !== e6 && "ol" !== e6 || ks(i9, "ol" === e6 ? "ordered" : "bullet", n3 + 1, s3, r4);
2075
+ } else "ul" !== e6 && "ol" !== e6 || Ss(i9, "ol" === e6 ? "ordered" : "bullet", n3 + 1, s3, r4);
1985
2076
  }
1986
2077
  }
1987
- function vs(e5, t3, n3) {
2078
+ function ws(e5, t3, n3) {
1988
2079
  const s3 = [];
1989
- return bs(e5, [], s3, t3?.getMarkParseRules() ?? [], t3?.getInlineParseRules() ?? [], n3), s3.length > 0 ? s3 : [T("")];
2080
+ return Es(e5, [], s3, t3?.getMarkParseRules() ?? [], t3?.getInlineParseRules() ?? [], n3), s3.length > 0 ? s3 : [T("")];
1990
2081
  }
1991
- function bs(e5, t3, n3, s3, r4, i9) {
2082
+ function Es(e5, t3, n3, s3, r4, i9) {
1992
2083
  if (e5.nodeType === Node.TEXT_NODE) {
1993
2084
  const s4 = e5.textContent ?? "";
1994
2085
  return void (s4 && n3.push(T(s4, [...t3])));
@@ -2001,23 +2092,27 @@ function bs(e5, t3, n3, s3, r4, i9) {
2001
2092
  if (e6.rule.getAttrs) {
2002
2093
  const t4 = e6.rule.getAttrs(o2);
2003
2094
  if (false === t4) continue;
2004
- return void n3.push(X(ve(e6.type), t4));
2095
+ return void n3.push(X(be(e6.type), t4));
2005
2096
  }
2006
- return void n3.push(X(ve(e6.type)));
2097
+ return void n3.push(X(be(e6.type)));
2007
2098
  }
2008
2099
  const c11 = [...t3], l3 = /* @__PURE__ */ new Set();
2009
2100
  for (const e6 of s3) if (e6.rule.tag === a22 && !l3.has(e6.type)) if (e6.rule.getAttrs) {
2010
2101
  const t4 = e6.rule.getAttrs(o2);
2011
2102
  if (false === t4) continue;
2012
- c11.some((t5) => t5.type === e6.type) || (c11.push({ type: be(e6.type), ...Object.keys(t4).length > 0 ? { attrs: t4 } : {} }), l3.add(e6.type));
2013
- } else c11.some((t4) => t4.type === e6.type) || (c11.push({ type: be(e6.type) }), l3.add(e6.type));
2014
- for (const e6 of Array.from(o2.childNodes)) bs(e6, c11, n3, s3, r4, i9);
2103
+ c11.some((t5) => t5.type === e6.type) || (c11.push({ type: ve(e6.type), ...Object.keys(t4).length > 0 ? { attrs: t4 } : {} }), l3.add(e6.type));
2104
+ } else c11.some((t4) => t4.type === e6.type) || (c11.push({ type: ve(e6.type) }), l3.add(e6.type));
2105
+ for (const e6 of Array.from(o2.childNodes)) Es(e6, c11, n3, s3, r4, i9);
2015
2106
  }
2016
- function Ss(e5, t3) {
2107
+ function xs(e5, t3) {
2017
2108
  const n3 = e5.style?.textAlign ?? "";
2018
- n3 && ds.has(n3) && (t3.align = n3);
2109
+ if (n3 && ps.has(n3)) t3.align = n3;
2110
+ else for (const n4 of Array.from(e5.classList)) {
2111
+ const e6 = n4.match(/^notectl-align-(\w+)$/), s3 = e6?.[1];
2112
+ if (s3 && ps.has(s3)) return void (t3.align = s3);
2113
+ }
2019
2114
  }
2020
- function ws(e5, t3) {
2115
+ function Cs(e5, t3) {
2021
2116
  const n3 = e5.tagName.toLowerCase();
2022
2117
  for (const s3 of t3) if (s3.rule.tag === n3) {
2023
2118
  if (s3.rule.getAttrs) {
@@ -2029,7 +2124,29 @@ function ws(e5, t3) {
2029
2124
  }
2030
2125
  return null;
2031
2126
  }
2032
- class Es {
2127
+ function Ts(e5, t3) {
2128
+ const n3 = t3?.document ?? globalThis.document, s3 = t3?.container ?? n3.head;
2129
+ if (t3?.id) {
2130
+ const s4 = n3.getElementById(t3.id);
2131
+ if (s4 instanceof HTMLStyleElement) return s4.textContent = e5, t3.nonce && s4.setAttribute("nonce", t3.nonce), s4;
2132
+ }
2133
+ const r4 = n3.createElement("style");
2134
+ return r4.textContent = e5, t3?.id && (r4.id = t3.id), t3?.nonce && r4.setAttribute("nonce", t3.nonce), s3.appendChild(r4), r4;
2135
+ }
2136
+ function As(e5, t3) {
2137
+ const n3 = (t3 ?? globalThis.document).getElementById(e5);
2138
+ n3 && n3.remove();
2139
+ }
2140
+ const Rs = /* @__PURE__ */ new WeakSet();
2141
+ function Ls(e5, t3) {
2142
+ const n3 = t3?.target ?? globalThis.document, s3 = new CSSStyleSheet();
2143
+ return s3.replaceSync(e5), Rs.add(s3), t3?.replace && (n3.adoptedStyleSheets = n3.adoptedStyleSheets.filter((e6) => !Rs.has(e6))), n3.adoptedStyleSheets = [...n3.adoptedStyleSheets, s3], s3;
2144
+ }
2145
+ function Ms(e5, t3) {
2146
+ const n3 = t3 ?? globalThis.document;
2147
+ n3.adoptedStyleSheets = n3.adoptedStyleSheets.filter((t4) => t4 !== e5);
2148
+ }
2149
+ class Is {
2033
2150
  constructor(e5, t3) {
2034
2151
  this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.syncSelection = t3.syncSelection, this.inputRuleRegistry = t3.inputRuleRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.compositionTracker = t3.compositionTracker ?? new kn(), this.handleBeforeInput = this.onBeforeInput.bind(this), this.handleCompositionStart = this.onCompositionStart.bind(this), this.handleCompositionEnd = this.onCompositionEnd.bind(this), e5.addEventListener("beforeinput", this.handleBeforeInput), e5.addEventListener("compositionstart", this.handleCompositionStart), e5.addEventListener("compositionend", this.handleCompositionEnd);
2035
2152
  }
@@ -2060,29 +2177,29 @@ class Es {
2060
2177
  break;
2061
2178
  case "deleteContentBackward":
2062
2179
  case "deleteByCut":
2063
- n3 = hn(t3);
2180
+ n3 = ln(t3);
2064
2181
  break;
2065
2182
  case "deleteContentForward":
2066
- n3 = dn(t3);
2183
+ n3 = hn(t3);
2067
2184
  break;
2068
2185
  case "deleteWordBackward":
2069
2186
  n3 = (function(e6) {
2070
- return ln(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [ee(e7, t4), t4] : null });
2187
+ return cn(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [ee(e7, t4), t4] : null });
2071
2188
  })(t3);
2072
2189
  break;
2073
2190
  case "deleteWordForward":
2074
2191
  n3 = (function(e6) {
2075
- return ln(e6, { merge: $e, range: (e7, t4) => t4 < O(e7) ? [t4, Z(e7, t4)] : null });
2192
+ return cn(e6, { merge: $e, range: (e7, t4) => t4 < O(e7) ? [t4, Z(e7, t4)] : null });
2076
2193
  })(t3);
2077
2194
  break;
2078
2195
  case "deleteSoftLineBackward":
2079
2196
  n3 = (function(e6) {
2080
- return ln(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [0, t4] : null });
2197
+ return cn(e6, { merge: Ke, range: (e7, t4) => t4 > 0 ? [0, t4] : null });
2081
2198
  })(t3);
2082
2199
  break;
2083
2200
  case "deleteSoftLineForward":
2084
2201
  n3 = (function(e6) {
2085
- return ln(e6, { merge: $e, range: (e7, t4) => {
2202
+ return cn(e6, { merge: $e, range: (e7, t4) => {
2086
2203
  const n4 = O(e7);
2087
2204
  return t4 < n4 ? [t4, n4] : null;
2088
2205
  } });
@@ -2122,13 +2239,13 @@ class Es {
2122
2239
  this.element.removeEventListener("beforeinput", this.handleBeforeInput), this.element.removeEventListener("compositionstart", this.handleCompositionStart), this.element.removeEventListener("compositionend", this.handleCompositionEnd);
2123
2240
  }
2124
2241
  }
2125
- function xs(e5) {
2242
+ function Ns(e5) {
2126
2243
  return e5.reduce((e6, t3) => e6 + t3.text, "");
2127
2244
  }
2128
- function Cs(e5) {
2245
+ function Bs(e5) {
2129
2246
  return e5.reduce((e6, t3) => e6 + t3.text.length, 0);
2130
2247
  }
2131
- function Ts(e5, t3) {
2248
+ function Os(e5, t3) {
2132
2249
  const n3 = Ae(e5.doc, t3.blockId);
2133
2250
  if (!n3) return null;
2134
2251
  const s3 = n3.length > 1 ? n3.slice(0, -1) : [], r4 = (0 === s3.length ? e5.doc.children : (() => {
@@ -2139,19 +2256,19 @@ function Ts(e5, t3) {
2139
2256
  const i9 = "before" === t3.side ? r4 : r4 + 1;
2140
2257
  return { parentPath: s3, insertIndex: i9 };
2141
2258
  }
2142
- function As(e5, t3, n3) {
2143
- const s3 = Ts(e5, t3);
2259
+ function _s(e5, t3, n3) {
2260
+ const s3 = Os(e5, t3);
2144
2261
  if (!s3) return e5.transaction("paste").setSelection(t3).build();
2145
2262
  const r4 = e5.transaction("paste");
2146
2263
  let i9, o2 = s3.insertIndex, a22 = 0;
2147
2264
  for (const e6 of n3) {
2148
- const t4 = Y(), n4 = xs(e6.segments), c11 = e6.segments.map((e7) => T(e7.text, [...e7.marks])), l3 = _(e6.type, c11.length > 0 ? c11 : [T("")], t4, e6.attrs);
2265
+ const t4 = Y(), n4 = Ns(e6.segments), c11 = e6.segments.map((e7) => T(e7.text, [...e7.marks])), l3 = _(e6.type, c11.length > 0 ? c11 : [T("")], t4, e6.attrs);
2149
2266
  r4.insertNode(s3.parentPath, o2, l3), o2++, i9 = t4, a22 = n4.length;
2150
2267
  }
2151
2268
  return i9 && r4.setSelection(re(i9, a22)), r4.build();
2152
2269
  }
2153
- const Rs = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "BLOCKQUOTE", "UL", "OL", "LI", "HR", "PRE", "TABLE", "THEAD", "TBODY", "TR"]), Ls = /* @__PURE__ */ new Set(["STRONG", "B", "EM", "I", "U", "S", "STRIKE", "DEL", "A", "SPAN", "BR", "SUB", "SUP", "CODE"]);
2154
- class Ms {
2270
+ const Ds = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "BLOCKQUOTE", "UL", "OL", "LI", "HR", "PRE", "TABLE", "THEAD", "TBODY", "TR"]), Ps = /* @__PURE__ */ new Set(["STRONG", "B", "EM", "I", "U", "S", "STRIKE", "DEL", "A", "SPAN", "BR", "SUB", "SUP", "CODE"]);
2271
+ class Hs {
2155
2272
  schema;
2156
2273
  blockParseRules;
2157
2274
  markParseRules;
@@ -2248,7 +2365,7 @@ class Ms {
2248
2365
  if (e5.nodeType !== Node.ELEMENT_NODE) return [];
2249
2366
  const n3 = e5, s3 = n3.tagName;
2250
2367
  if ("BR" === s3) return [{ text: "\n", marks: this.resolveMarks(t3) }];
2251
- if (this.isBlockElement(n3) && !Ls.has(s3)) return this.parseInlineChildren(n3, t3);
2368
+ if (this.isBlockElement(n3) && !Ps.has(s3)) return this.parseInlineChildren(n3, t3);
2252
2369
  const r4 = this.mergeMarks(t3, this.marksFromElement(n3));
2253
2370
  return this.parseInlineChildren(n3, r4);
2254
2371
  }
@@ -2271,18 +2388,18 @@ class Ms {
2271
2388
  for (const r4 of this.markParseRules) if (r4.rule.tag === n3 && !s4.has(r4.type)) if (r4.rule.getAttrs) {
2272
2389
  const n4 = r4.rule.getAttrs(e5);
2273
2390
  if (false === n4) continue;
2274
- t3.push({ type: be(r4.type), ...Object.keys(n4).length > 0 ? { attrs: n4 } : {} }), s4.add(r4.type);
2275
- } else t3.push({ type: be(r4.type) }), s4.add(r4.type);
2391
+ t3.push({ type: ve(r4.type), ...Object.keys(n4).length > 0 ? { attrs: n4 } : {} }), s4.add(r4.type);
2392
+ } else t3.push({ type: ve(r4.type) }), s4.add(r4.type);
2276
2393
  if (s4.size > 0) return t3;
2277
2394
  }
2278
2395
  const s3 = e5.tagName;
2279
2396
  if ("STRONG" === s3 || "B" === s3) {
2280
2397
  const n4 = e5.style.fontWeight, s4 = Number.parseInt(n4, 10);
2281
- "normal" === n4 || !Number.isNaN(s4) && s4 < 700 || t3.push({ type: be("bold") });
2398
+ "normal" === n4 || !Number.isNaN(s4) && s4 < 700 || t3.push({ type: ve("bold") });
2282
2399
  }
2283
- if ("EM" !== s3 && "I" !== s3 || t3.push({ type: be("italic") }), "U" === s3 && t3.push({ type: be("underline") }), "S" !== s3 && "STRIKE" !== s3 && "DEL" !== s3 || t3.push({ type: be("strikethrough") }), "A" === s3) {
2400
+ if ("EM" !== s3 && "I" !== s3 || t3.push({ type: ve("italic") }), "U" === s3 && t3.push({ type: ve("underline") }), "S" !== s3 && "STRIKE" !== s3 && "DEL" !== s3 || t3.push({ type: ve("strikethrough") }), "A" === s3) {
2284
2401
  const n4 = e5.getAttribute("href") ?? "";
2285
- t3.push({ type: be("link"), attrs: { href: n4 } });
2402
+ t3.push({ type: ve("link"), attrs: { href: n4 } });
2286
2403
  }
2287
2404
  return t3;
2288
2405
  }
@@ -2322,7 +2439,7 @@ class Ms {
2322
2439
  return null;
2323
2440
  }
2324
2441
  isBlockElement(e5) {
2325
- if (Rs.has(e5.tagName)) return true;
2442
+ if (Ds.has(e5.tagName)) return true;
2326
2443
  const t3 = e5.tagName.toLowerCase();
2327
2444
  return this.blockParseRules.some((e6) => e6.rule.tag === t3);
2328
2445
  }
@@ -2367,21 +2484,21 @@ class Ms {
2367
2484
  0 !== n3.length && (n3.every((e6) => "" === e6.text.trim()) || e5.push({ type: this.resolveBlockType(ke("paragraph")), segments: n3 }));
2368
2485
  }
2369
2486
  }
2370
- const Is = { 1: "x-small", 2: "small", 3: "medium", 4: "large", 5: "x-large", 6: "xx-large", 7: "xxx-large" };
2371
- function Ns(e5) {
2487
+ const zs = { 1: "x-small", 2: "small", 3: "medium", 4: "large", 5: "x-large", 6: "xx-large", 7: "xxx-large" };
2488
+ function js(e5) {
2372
2489
  return e5.toLowerCase().includes("font-size");
2373
2490
  }
2374
- function Bs(e5, t3) {
2491
+ function $s(e5, t3) {
2375
2492
  for (; e5.firstChild; ) t3.appendChild(e5.firstChild);
2376
2493
  }
2377
- function Os(e5) {
2494
+ function Ks(e5) {
2378
2495
  const t3 = e5.parentNode;
2379
2496
  if (t3) {
2380
2497
  for (; e5.firstChild; ) t3.insertBefore(e5.firstChild, e5);
2381
2498
  t3.removeChild(e5);
2382
2499
  }
2383
2500
  }
2384
- function Ps(e5, t3) {
2501
+ function Fs(e5, t3) {
2385
2502
  if (!t3) return;
2386
2503
  const n3 = {};
2387
2504
  let s3 = false;
@@ -2391,7 +2508,7 @@ function Ps(e5, t3) {
2391
2508
  }
2392
2509
  return s3 ? n3 : void 0;
2393
2510
  }
2394
- class _s {
2511
+ class Us {
2395
2512
  constructor(e5, t3) {
2396
2513
  this.element = e5, this.getState = t3.getState, this.dispatch = t3.dispatch, this.schemaRegistry = t3.schemaRegistry, this.fileHandlerRegistry = t3.fileHandlerRegistry, this.isReadOnly = t3.isReadOnly ?? (() => false), this.handlePaste = this.onPaste.bind(this), e5.addEventListener("paste", this.handlePaste);
2397
2514
  }
@@ -2425,20 +2542,20 @@ class _s {
2425
2542
  for (const e8 of t5) {
2426
2543
  const t6 = e8.getAttribute("color"), n5 = e8.getAttribute("face"), s5 = e8.getAttribute("size"), r5 = e8.getAttribute("style") ?? "";
2427
2544
  if (!(null !== t6 || null !== n5 || null !== s5 || r5.length > 0)) {
2428
- Os(e8);
2545
+ Ks(e8);
2429
2546
  continue;
2430
2547
  }
2431
2548
  const i10 = document.createElement("span"), o3 = [];
2432
- if (r5 && o3.push(r5.endsWith(";") ? r5 : `${r5};`), t6 && o3.push(`color: ${t6};`), n5 && o3.push(`font-family: ${n5};`), s5 && !Ns(r5)) {
2433
- const e9 = Is[s5];
2549
+ if (r5 && o3.push(r5.endsWith(";") ? r5 : `${r5};`), t6 && o3.push(`color: ${t6};`), n5 && o3.push(`font-family: ${n5};`), s5 && !js(r5)) {
2550
+ const e9 = zs[s5];
2434
2551
  e9 && o3.push(`font-size: ${e9};`);
2435
2552
  }
2436
- Mt(i10, o3.join(" ")), Bs(e8, i10), e8.parentNode?.replaceChild(i10, e8);
2553
+ Mt(i10, o3.join(" ")), $s(e8, i10), e8.parentNode?.replaceChild(i10, e8);
2437
2554
  }
2438
2555
  })(t4.content);
2439
2556
  const n4 = t4.innerHTML, s4 = this.schemaRegistry ? this.schemaRegistry.getAllowedTags() : ["strong", "em", "u", "b", "i", "p", "br", "div", "span"], o2 = this.schemaRegistry ? this.schemaRegistry.getAllowedAttrs() : [], a22 = Dt.sanitize(n4, { ALLOWED_TAGS: s4, ALLOWED_ATTR: o2 });
2440
2557
  if (this.schemaRegistry) {
2441
- const e7 = me(this.schemaRegistry), t5 = new Ms({ schema: e7, schemaRegistry: this.schemaRegistry }), n5 = document.createElement("template");
2558
+ const e7 = me(this.schemaRegistry), t5 = new Hs({ schema: e7, schemaRegistry: this.schemaRegistry }), n5 = document.createElement("template");
2442
2559
  n5.innerHTML = a22;
2443
2560
  const s5 = (function(e8, t6) {
2444
2561
  if (0 === t6.blocks.length) return e8.transaction("paste").setSelection(e8.selection).build();
@@ -2447,33 +2564,33 @@ class _s {
2447
2564
  const n7 = e9.selection;
2448
2565
  if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2449
2566
  if (oe(n7)) return (function(e10, t8, n8) {
2450
- const s7 = Ts(e10, t8);
2567
+ const s7 = Os(e10, t8);
2451
2568
  if (!s7) return e10.transaction("paste").setSelection(t8).build();
2452
- const r6 = Y(), i11 = xs(n8), o4 = Cs(n8), a24 = e10.transaction("paste");
2569
+ const r6 = Y(), i11 = Ns(n8), o4 = Bs(n8), a24 = e10.transaction("paste");
2453
2570
  return a24.insertNode(s7.parentPath, s7.insertIndex, _(ke("paragraph"), [T("")], r6)), i11.length > 0 && a24.insertText(r6, 0, i11, [], n8), a24.setSelection(re(r6, o4)), a24.build();
2454
2571
  })(e9, n7, t7);
2455
2572
  const s6 = e9.transaction("paste");
2456
2573
  le(n7) || Qe(e9, s6);
2457
- const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Cs(t7), a23 = xs(t7);
2574
+ const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Bs(t7), a23 = Ns(t7);
2458
2575
  return s6.insertText(r5, i10, a23, [], t7), s6.setSelection(re(r5, i10 + o3)), s6.build();
2459
2576
  })(e8, n6.segments) : 1 === t6.blocks.length ? (function(e9, t7) {
2460
2577
  const n7 = e9.selection;
2461
2578
  if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2462
- if (oe(n7)) return As(e9, n7, [t7]);
2579
+ if (oe(n7)) return _s(e9, n7, [t7]);
2463
2580
  const s6 = e9.transaction("paste");
2464
2581
  le(n7) || Qe(e9, s6);
2465
- const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Cs(t7.segments), a23 = xs(t7.segments);
2582
+ const { blockId: r5, offset: i10 } = Xe(n7, e9.getBlockOrder()), o3 = Bs(t7.segments), a23 = Ns(t7.segments);
2466
2583
  return s6.setBlockType(r5, t7.type, t7.attrs), s6.insertText(r5, i10, a23, [], t7.segments), s6.setSelection(re(r5, i10 + o3)), s6.build();
2467
2584
  })(e8, n6) : (function(e9, t7) {
2468
2585
  const n7 = e9.selection;
2469
2586
  if (ie(n7)) return e9.transaction("paste").setSelection(n7).build();
2470
- if (oe(n7)) return As(e9, n7, t7.blocks);
2587
+ if (oe(n7)) return _s(e9, n7, t7.blocks);
2471
2588
  const s6 = e9.transaction("paste");
2472
2589
  le(n7) || Qe(e9, s6);
2473
2590
  const r5 = e9.getBlockOrder(), { blockId: i10, offset: o3 } = Xe(n7, r5), a23 = r5.indexOf(i10), c11 = t7.blocks[0], l3 = t7.blocks[t7.blocks.length - 1];
2474
2591
  if (!c11 || !l3) return s6.build();
2475
- const h4 = t7.blocks.slice(1, -1), d5 = Cs(c11.segments);
2476
- c11.segments.length > 0 && d5 > 0 && s6.insertText(i10, o3, xs(c11.segments), [], c11.segments), c11.type !== ke("paragraph") && s6.setBlockType(i10, c11.type, c11.attrs);
2592
+ const h4 = t7.blocks.slice(1, -1), d5 = Bs(c11.segments);
2593
+ c11.segments.length > 0 && d5 > 0 && s6.insertText(i10, o3, Ns(c11.segments), [], c11.segments), c11.type !== ke("paragraph") && s6.setBlockType(i10, c11.type, c11.attrs);
2477
2594
  const u2 = o3 + d5, p4 = Y();
2478
2595
  s6.splitBlock(i10, u2, p4);
2479
2596
  let f4 = a23 + 1;
@@ -2481,8 +2598,8 @@ class _s {
2481
2598
  const t8 = e10.segments.map((e11) => T(e11.text, [...e11.marks])), n8 = _(e10.type, t8.length > 0 ? t8 : void 0, Y(), e10.attrs);
2482
2599
  s6.insertNode([], f4, n8), f4++;
2483
2600
  }
2484
- const g4 = Cs(l3.segments);
2485
- return l3.segments.length > 0 && g4 > 0 && s6.insertText(p4, 0, xs(l3.segments), [], l3.segments), l3.type !== ke("paragraph") && s6.setBlockType(p4, l3.type, l3.attrs), s6.setSelection(re(p4, g4)), s6.build();
2601
+ const g4 = Bs(l3.segments);
2602
+ return l3.segments.length > 0 && g4 > 0 && s6.insertText(p4, 0, Ns(l3.segments), [], l3.segments), l3.type !== ke("paragraph") && s6.setBlockType(p4, l3.type, l3.attrs), s6.setSelection(re(p4, g4)), s6.build();
2486
2603
  })(e8, t6) : e8.transaction("paste").setSelection(e8.selection).build();
2487
2604
  })(r4, t5.parse(n5.content));
2488
2605
  this.dispatch(s5);
@@ -2511,7 +2628,7 @@ class _s {
2511
2628
  if (!n3) return;
2512
2629
  const s3 = this.schemaRegistry?.getNodeSpec(n3);
2513
2630
  if (this.schemaRegistry && !s3) return;
2514
- const r4 = this.getState(), i9 = r4.selection, o2 = ie(i9) ? i9.nodeId : oe(i9) ? i9.blockId : i9.anchor.blockId, a22 = Y(), c11 = Ps(t3.attrs, s3?.attrs), l3 = _(ke(n3), [], a22, c11), h4 = this.findTableCellAncestor(r4, o2);
2631
+ const r4 = this.getState(), i9 = r4.selection, o2 = ie(i9) ? i9.nodeId : oe(i9) ? i9.blockId : i9.anchor.blockId, a22 = Y(), c11 = Fs(t3.attrs, s3?.attrs), l3 = _(ke(n3), [], a22, c11), h4 = this.findTableCellAncestor(r4, o2);
2515
2632
  if (h4) {
2516
2633
  const e6 = Ae(r4.doc, h4);
2517
2634
  if (!e6) return;
@@ -2583,7 +2700,7 @@ class _s {
2583
2700
  if (!this.schemaRegistry) return e5;
2584
2701
  const t3 = this.schemaRegistry.getNodeSpec(e5.type);
2585
2702
  if (!t3) return;
2586
- const n3 = Ps(e5.attrs, t3.attrs);
2703
+ const n3 = Fs(e5.attrs, t3.attrs);
2587
2704
  return { ...e5, attrs: n3 };
2588
2705
  }
2589
2706
  findTableCellAncestor(e5, t3) {
@@ -2633,7 +2750,7 @@ class _s {
2633
2750
  this.element.removeEventListener("paste", this.handlePaste);
2634
2751
  }
2635
2752
  }
2636
- function Ds(e5, t3, n3, s3) {
2753
+ function Ws(e5, t3, n3, s3) {
2637
2754
  const r4 = t3?.doc.children ?? [], i9 = n3.doc.children, o2 = s3?.registry, a22 = s3?.nodeViews, c11 = null != s3?.compositionBlockId;
2638
2755
  c11 || (function(e6) {
2639
2756
  const t4 = Array.from(e6.querySelectorAll(":scope > [data-block-wrapper]"));
@@ -2656,7 +2773,7 @@ function Ds(e5, t3, n3, s3) {
2656
2773
  }
2657
2774
  const h4 = new Set(i9.map((e6) => e6.id));
2658
2775
  for (const [e6, t4] of l3) if (!h4.has(e6)) {
2659
- qs(t4), l3.delete(e6);
2776
+ nr(t4), l3.delete(e6);
2660
2777
  const n4 = a22?.get(e6);
2661
2778
  n4 && (n4.destroy?.(), a22?.delete(e6));
2662
2779
  }
@@ -2671,7 +2788,7 @@ function Ds(e5, t3, n3, s3) {
2671
2788
  continue;
2672
2789
  }
2673
2790
  const i10 = s3?.oldDecorations?.find(t4.id), c12 = s3?.decorations?.find(t4.id);
2674
- if (n4 && r5 && !Hs(r5, t4, i10, c12)) u2 = n4;
2791
+ if (n4 && r5 && !Vs(r5, t4, i10, c12)) u2 = n4;
2675
2792
  else if (n4) {
2676
2793
  const r6 = a22?.get(t4.id);
2677
2794
  if (r6) {
@@ -2679,18 +2796,18 @@ function Ds(e5, t3, n3, s3) {
2679
2796
  if (V(t4) && r6.contentDOM) {
2680
2797
  r6.contentDOM.textContent = "";
2681
2798
  const e6 = s3?.decorations?.findInline(t4.id);
2682
- js(r6.contentDOM, t4, o2, e6);
2799
+ qs(r6.contentDOM, t4, o2, e6);
2683
2800
  }
2684
2801
  u2 = r6.dom;
2685
2802
  continue;
2686
2803
  }
2687
2804
  r6.destroy?.(), a22?.delete(t4.id);
2688
2805
  }
2689
- const i11 = zs(t4, o2, a22, s3);
2690
- Js(n4, i11, e5), u2 = i11;
2806
+ const i11 = Gs(t4, o2, a22, s3);
2807
+ sr(n4, i11, e5), u2 = i11;
2691
2808
  } else {
2692
- const n5 = zs(t4, o2, a22, s3);
2693
- Qs(e5, u2, n5), u2 = n5;
2809
+ const n5 = Gs(t4, o2, a22, s3);
2810
+ rr(e5, u2, n5), u2 = n5;
2694
2811
  }
2695
2812
  if (p4 === t4.id) {
2696
2813
  const e6 = a22?.get(t4.id);
@@ -2716,9 +2833,9 @@ function Ds(e5, t3, n3, s3) {
2716
2833
  const e6 = a22?.get(p4);
2717
2834
  e6 && e6.selectNode?.();
2718
2835
  }
2719
- c11 || Gs(e5, i9, o2);
2836
+ c11 || tr(e5, i9, o2);
2720
2837
  }
2721
- function Hs(e5, t3, n3, s3) {
2838
+ function Vs(e5, t3, n3, s3) {
2722
2839
  if (e5.type !== t3.type) return true;
2723
2840
  if (e5.children.length !== t3.children.length) return true;
2724
2841
  const r4 = e5.attrs, i9 = t3.attrs;
@@ -2736,16 +2853,16 @@ function Hs(e5, t3, n3, s3) {
2736
2853
  if (!Q(s4.marks, r5.marks)) return true;
2737
2854
  } else if (C(s4) && C(r5)) {
2738
2855
  if (s4.inlineType !== r5.inlineType) return true;
2739
- if (!Us(s4.attrs, r5.attrs)) return true;
2856
+ if (!Ys(s4.attrs, r5.attrs)) return true;
2740
2857
  } else {
2741
2858
  if (R(s4) || R(r5) || C(s4) || C(r5)) return true;
2742
- if (Hs(s4, r5)) return true;
2859
+ if (Vs(s4, r5)) return true;
2743
2860
  }
2744
2861
  }
2745
2862
  const o2 = n3 ?? [], a22 = s3 ?? [];
2746
2863
  return o2 !== a22 && !ht(o2, a22);
2747
2864
  }
2748
- function zs(e5, t3, n3, s3) {
2865
+ function Gs(e5, t3, n3, s3) {
2749
2866
  const r4 = s3?.decorations?.findInline(e5.id), i9 = s3?.nodeViewRegistry;
2750
2867
  if (i9 && t3 && n3 && s3?.getState && s3?.dispatch) {
2751
2868
  const o2 = i9.getNodeViewFactory(e5.type);
@@ -2753,45 +2870,45 @@ function zs(e5, t3, n3, s3) {
2753
2870
  const i10 = o2(e5, s3.getState, s3.dispatch);
2754
2871
  n3.set(e5.id, i10);
2755
2872
  const a22 = t3.getNodeSpec(e5.type);
2756
- if (a22?.isVoid && i10.dom.setAttribute("data-void", "true"), a22?.selectable && i10.dom.setAttribute("data-selectable", "true"), i10.contentDOM && i10.contentDOM !== i10.dom && i10.contentDOM.setAttribute("data-content-dom", "true"), V(e5) && i10.contentDOM) js(i10.contentDOM, e5, t3, r4);
2873
+ if (a22?.isVoid && i10.dom.setAttribute("data-void", "true"), a22?.selectable && i10.dom.setAttribute("data-selectable", "true"), i10.contentDOM && i10.contentDOM !== i10.dom && i10.contentDOM.setAttribute("data-content-dom", "true"), V(e5) && i10.contentDOM) qs(i10.contentDOM, e5, t3, r4);
2757
2874
  else {
2758
2875
  const r5 = J(e5), o3 = /* @__PURE__ */ new Map();
2759
2876
  for (const e6 of r5) {
2760
2877
  const r6 = i10.getContentDOM?.(e6.id) ?? i10.contentDOM;
2761
2878
  if (r6) {
2762
- const i11 = zs(e6, t3, n3, s3);
2879
+ const i11 = Gs(e6, t3, n3, s3);
2763
2880
  r6.appendChild(i11);
2764
2881
  let a23 = o3.get(r6);
2765
2882
  a23 || (a23 = [], o3.set(r6, a23)), a23.push(e6);
2766
2883
  }
2767
2884
  }
2768
- for (const [e6, n4] of o3) Gs(e6, n4, t3);
2885
+ for (const [e6, n4] of o3) tr(e6, n4, t3);
2769
2886
  }
2770
- return i10.dom.setAttribute("data-block-type", e5.type), Vs(i10.dom, e5.id, s3), i10.dom;
2887
+ return i10.dom.setAttribute("data-block-type", e5.type), er(i10.dom, e5.id, s3), i10.dom;
2771
2888
  }
2772
2889
  }
2773
2890
  if (t3) {
2774
2891
  const i10 = t3.getNodeSpec(e5.type);
2775
2892
  if (i10) {
2776
2893
  const o2 = i10.toDOM(e5);
2777
- if (i10.isVoid && o2.setAttribute("data-void", "true"), i10.selectable && o2.setAttribute("data-selectable", "true"), !i10.isVoid) if (V(e5)) js(o2, e5, t3, r4);
2894
+ if (i10.isVoid && o2.setAttribute("data-void", "true"), i10.selectable && o2.setAttribute("data-selectable", "true"), !i10.isVoid) if (V(e5)) qs(o2, e5, t3, r4);
2778
2895
  else {
2779
2896
  const r5 = J(e5);
2780
2897
  for (const e6 of r5) {
2781
- const r6 = zs(e6, t3, n3, s3);
2898
+ const r6 = Gs(e6, t3, n3, s3);
2782
2899
  o2.appendChild(r6);
2783
2900
  }
2784
- Gs(o2, r5, t3);
2901
+ tr(o2, r5, t3);
2785
2902
  }
2786
- return o2.setAttribute("data-block-type", e5.type), Vs(o2, e5.id, s3), o2;
2903
+ return o2.setAttribute("data-block-type", e5.type), er(o2, e5.id, s3), o2;
2787
2904
  }
2788
2905
  }
2789
2906
  return (function(e6, t4, n4) {
2790
2907
  const s4 = we("p", e6.id);
2791
- return s4.setAttribute("data-block-type", e6.type), js(s4, e6, t4, n4), s4;
2908
+ return s4.setAttribute("data-block-type", e6.type), qs(s4, e6, t4, n4), s4;
2792
2909
  })(e5, t3, r4);
2793
2910
  }
2794
- function js(e5, t3, n3, s3) {
2911
+ function qs(e5, t3, n3, s3) {
2795
2912
  for (const t4 of e5.querySelectorAll("[data-cursor-wrapper]")) t4.remove();
2796
2913
  const r4 = I(t3);
2797
2914
  if (1 === r4.length && R(r4[0]) && "" === r4[0].text) return void e5.appendChild(document.createElement("br"));
@@ -2799,7 +2916,7 @@ function js(e5, t3, n3, s3) {
2799
2916
  let r5 = 0;
2800
2917
  for (const i10 of t4) {
2801
2918
  if (C(i10)) {
2802
- e6.appendChild(Fs(i10, s4)), r5 += 1;
2919
+ e6.appendChild(Xs(i10, s4)), r5 += 1;
2803
2920
  continue;
2804
2921
  }
2805
2922
  const t5 = r5, o2 = r5 + i10.text.length;
@@ -2819,7 +2936,7 @@ function js(e5, t3, n3, s3) {
2819
2936
  if (void 0 === o3 || void 0 === a23 || o3 >= a23) continue;
2820
2937
  const l3 = o3 - t5, h4 = a23 - t5, d5 = i10.text.slice(l3, h4), u2 = [];
2821
2938
  for (const e7 of n4) e7.from <= o3 && e7.to >= a23 && u2.push(e7);
2822
- let p4 = document.createTextNode($s(d5));
2939
+ let p4 = document.createTextNode(Js(d5));
2823
2940
  if (i10.marks.length > 0) {
2824
2941
  const e7 = [...i10.marks].sort((e8, t6) => Tn(e8, s4) - Tn(t6, s4));
2825
2942
  for (let t6 = e7.length - 1; t6 >= 0; t6--) {
@@ -2830,7 +2947,7 @@ function js(e5, t3, n3, s3) {
2830
2947
  }
2831
2948
  }
2832
2949
  for (const e7 of u2) {
2833
- const t6 = Ws(e7.attrs);
2950
+ const t6 = Zs(e7.attrs);
2834
2951
  t6.appendChild(p4), p4 = t6;
2835
2952
  }
2836
2953
  e6.appendChild(p4);
@@ -2838,17 +2955,17 @@ function js(e5, t3, n3, s3) {
2838
2955
  r5 = o2;
2839
2956
  }
2840
2957
  })(e5, r4, s3, n3);
2841
- else for (const t4 of r4) R(t4) ? e5.appendChild(Ks(t4, n3)) : e5.appendChild(Fs(t4, n3));
2958
+ else for (const t4 of r4) R(t4) ? e5.appendChild(Qs(t4, n3)) : e5.appendChild(Xs(t4, n3));
2842
2959
  const i9 = r4[r4.length - 1];
2843
2960
  i9 && C(i9) && "hard_break" === i9.inlineType && e5.appendChild(document.createElement("br"));
2844
2961
  }
2845
- function $s(e5) {
2962
+ function Js(e5) {
2846
2963
  let t3 = e5.replace(/ {2}/g, "  ");
2847
2964
  return t3.endsWith(" ") && (t3 = `${t3.slice(0, -1)} `), t3.startsWith(" ") && (t3 = ` ${t3.slice(1)}`), t3;
2848
2965
  }
2849
- function Ks(e5, t3) {
2966
+ function Qs(e5, t3) {
2850
2967
  if ("" === e5.text) return document.createTextNode("");
2851
- const n3 = document.createTextNode($s(e5.text));
2968
+ const n3 = document.createTextNode(Js(e5.text));
2852
2969
  if (0 === e5.marks.length) return n3;
2853
2970
  const s3 = [...e5.marks].sort((e6, n4) => Tn(e6, t3) - Tn(n4, t3));
2854
2971
  let r4 = n3;
@@ -2860,7 +2977,7 @@ function Ks(e5, t3) {
2860
2977
  }
2861
2978
  return r4;
2862
2979
  }
2863
- function Fs(e5, t3) {
2980
+ function Xs(e5, t3) {
2864
2981
  if (t3) {
2865
2982
  const n4 = t3.getInlineNodeSpec(e5.inlineType);
2866
2983
  if (n4) {
@@ -2871,27 +2988,27 @@ function Fs(e5, t3) {
2871
2988
  const n3 = document.createElement("span");
2872
2989
  return n3.setAttribute("data-inline-type", e5.inlineType), n3.setAttribute("contenteditable", "false"), n3;
2873
2990
  }
2874
- function Us(e5, t3) {
2991
+ function Ys(e5, t3) {
2875
2992
  const n3 = Object.keys(e5), s3 = Object.keys(t3);
2876
2993
  if (n3.length !== s3.length) return false;
2877
2994
  for (const s4 of n3) if (e5[s4] !== t3[s4]) return false;
2878
2995
  return true;
2879
2996
  }
2880
- function Ws(e5) {
2997
+ function Zs(e5) {
2881
2998
  const t3 = e5.nodeName ?? "span", n3 = document.createElement(t3);
2882
2999
  if (n3.setAttribute("data-decoration", "true"), e5.class) for (const t4 of e5.class.split(" ")) t4 && n3.classList.add(t4);
2883
- e5.style && Nt(n3, e5.style);
3000
+ e5.style && Mt(n3, e5.style);
2884
3001
  for (const [t4, s3] of Object.entries(e5)) "class" !== t4 && "style" !== t4 && "nodeName" !== t4 && void 0 !== s3 && n3.setAttribute(t4, s3);
2885
3002
  return n3;
2886
3003
  }
2887
- function Vs(e5, t3, n3) {
3004
+ function er(e5, t3, n3) {
2888
3005
  const s3 = n3?.decorations?.findNode(t3);
2889
3006
  if (s3 && 0 !== s3.length) for (const t4 of s3) {
2890
3007
  if (t4.attrs.class) for (const n4 of t4.attrs.class.split(" ")) n4 && e5.classList.add(n4);
2891
3008
  t4.attrs.style && It(e5, t4.attrs.style);
2892
3009
  }
2893
3010
  }
2894
- function Gs(e5, t3, n3) {
3011
+ function tr(e5, t3, n3) {
2895
3012
  if (!n3) return;
2896
3013
  const s3 = [];
2897
3014
  let r4 = null, i9 = [];
@@ -2912,21 +3029,21 @@ function Gs(e5, t3, n3) {
2912
3029
  }
2913
3030
  }
2914
3031
  }
2915
- function qs(e5) {
3032
+ function nr(e5) {
2916
3033
  e5.parentElement?.removeChild(e5);
2917
3034
  }
2918
- function Js(e5, t3, n3) {
3035
+ function sr(e5, t3, n3) {
2919
3036
  const s3 = e5.parentElement;
2920
3037
  s3 ? s3.replaceChild(t3, e5) : n3.replaceChild(t3, e5);
2921
3038
  }
2922
- function Qs(e5, t3, n3) {
3039
+ function rr(e5, t3, n3) {
2923
3040
  if (t3?.parentElement) {
2924
3041
  const e6 = t3.parentElement;
2925
3042
  return void (t3.nextSibling ? e6.insertBefore(n3, t3.nextSibling) : e6.appendChild(n3));
2926
3043
  }
2927
3044
  e5.firstChild ? e5.insertBefore(n3, e5.firstChild) : e5.appendChild(n3);
2928
3045
  }
2929
- class Xs {
3046
+ class ir {
2930
3047
  state;
2931
3048
  contentElement;
2932
3049
  inputHandler;
@@ -2958,11 +3075,11 @@ class Xs {
2958
3075
  goalColumn = null;
2959
3076
  preserveGoalColumn = false;
2960
3077
  constructor(e5, t3) {
2961
- this.state = t3.state, this.contentElement = e5, this.schemaRegistry = t3.schemaRegistry, this.keymapRegistry = t3.keymapRegistry, this.fileHandlerRegistry = t3.fileHandlerRegistry, this.nodeViewRegistry = t3.nodeViewRegistry, this.getDecorations = t3.getDecorations, this.isReadOnly = t3.isReadOnly ?? (() => false), this.history = new cn({ maxDepth: t3.maxHistoryDepth ?? 100 }), t3.onStateChange && this.stateChangeCallbacks.push(t3.onStateChange), this.inputHandler = new Es(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), syncSelection: () => this.syncSelectionFromDOM(), inputRuleRegistry: t3.inputRuleRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.keyboardHandler = new un(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), undo: () => this.undo(), redo: () => this.redo(), keymapRegistry: this.keymapRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.pasteHandler = new _s(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, fileHandlerRegistry: this.fileHandlerRegistry, isReadOnly: this.isReadOnly }), this.clipboardHandler = new yn(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, syncSelection: () => this.syncSelectionFromDOM(), isReadOnly: this.isReadOnly }), this.cursorWrapper = new Rn(e5, this.schemaRegistry), this.handleCompositionStartForWrapper = () => {
3078
+ this.state = t3.state, this.contentElement = e5, this.schemaRegistry = t3.schemaRegistry, this.keymapRegistry = t3.keymapRegistry, this.fileHandlerRegistry = t3.fileHandlerRegistry, this.nodeViewRegistry = t3.nodeViewRegistry, this.getDecorations = t3.getDecorations, this.isReadOnly = t3.isReadOnly ?? (() => false), this.history = new an({ maxDepth: t3.maxHistoryDepth ?? 100 }), t3.onStateChange && this.stateChangeCallbacks.push(t3.onStateChange), this.inputHandler = new Is(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), syncSelection: () => this.syncSelectionFromDOM(), inputRuleRegistry: t3.inputRuleRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.keyboardHandler = new dn(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), undo: () => this.undo(), redo: () => this.redo(), keymapRegistry: this.keymapRegistry, isReadOnly: this.isReadOnly, compositionTracker: this.compositionTracker }), this.pasteHandler = new Us(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, fileHandlerRegistry: this.fileHandlerRegistry, isReadOnly: this.isReadOnly }), this.clipboardHandler = new yn(e5, { getState: () => this.state, dispatch: (e6) => this.dispatch(e6), schemaRegistry: this.schemaRegistry, syncSelection: () => this.syncSelectionFromDOM(), isReadOnly: this.isReadOnly }), this.cursorWrapper = new Rn(e5, this.schemaRegistry), this.handleCompositionStartForWrapper = () => {
2962
3079
  this.cursorWrapper.onCompositionStart(this.state);
2963
3080
  }, this.handleCompositionEndForWrapper = () => {
2964
3081
  this.cursorWrapper.cleanup();
2965
- }, e5.addEventListener("compositionstart", this.handleCompositionStartForWrapper), e5.addEventListener("compositionend", this.handleCompositionEndForWrapper), this.handleSelectionChange = this.onSelectionChange.bind(this), document.addEventListener("selectionchange", this.handleSelectionChange), this.handleMousedown = this.onMousedown.bind(this), e5.addEventListener("mousedown", this.handleMousedown), this.handleDragover = this.onDragover.bind(this), e5.addEventListener("dragover", this.handleDragover), this.handleDrop = this.onDrop.bind(this), e5.addEventListener("drop", this.handleDrop), this.decorations = this.getDecorations?.(this.state) ?? lt.empty, Ds(e5, null, this.state, { ...this.reconcileOptions(), decorations: this.decorations }), Me(e5, this.state.selection), this.registerNavigationKeymaps();
3082
+ }, e5.addEventListener("compositionstart", this.handleCompositionStartForWrapper), e5.addEventListener("compositionend", this.handleCompositionEndForWrapper), this.handleSelectionChange = this.onSelectionChange.bind(this), document.addEventListener("selectionchange", this.handleSelectionChange), this.handleMousedown = this.onMousedown.bind(this), e5.addEventListener("mousedown", this.handleMousedown), this.handleDragover = this.onDragover.bind(this), e5.addEventListener("dragover", this.handleDragover), this.handleDrop = this.onDrop.bind(this), e5.addEventListener("drop", this.handleDrop), this.decorations = this.getDecorations?.(this.state) ?? lt.empty, Ws(e5, null, this.state, { ...this.reconcileOptions(), decorations: this.decorations }), Me(e5, this.state.selection), this.registerNavigationKeymaps();
2966
3083
  }
2967
3084
  getState() {
2968
3085
  return this.state;
@@ -2974,7 +3091,7 @@ class Xs {
2974
3091
  const s3 = this.state;
2975
3092
  this.state = e5, this.cursorWrapper.isActive && !e5.storedMarks?.length && this.cursorWrapper.cleanup(), n3?.pushHistory && "history" !== t3.metadata.origin && this.history.push(t3);
2976
3093
  const r4 = this.decorations, i9 = this.getDecorations?.(e5, t3) ?? lt.empty;
2977
- this.decorations = i9, Ds(this.contentElement, s3, e5, { ...this.reconcileOptions(s3.selection), decorations: i9, oldDecorations: r4, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
3094
+ this.decorations = i9, Ws(this.contentElement, s3, e5, { ...this.reconcileOptions(s3.selection), decorations: i9, oldDecorations: r4, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
2978
3095
  for (const n4 of this.stateChangeCallbacks) n4(s3, e5, t3);
2979
3096
  this.preserveGoalColumn || (this.goalColumn = null);
2980
3097
  } finally {
@@ -3009,7 +3126,7 @@ class Xs {
3009
3126
  const t3 = this.state;
3010
3127
  this.state = e5, this.history.clear();
3011
3128
  const n3 = this.decorations, s3 = this.getDecorations?.(e5) ?? lt.empty;
3012
- this.decorations = s3, Ds(this.contentElement, t3, e5, { ...this.reconcileOptions(t3.selection), decorations: s3, oldDecorations: n3, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
3129
+ this.decorations = s3, Ws(this.contentElement, t3, e5, { ...this.reconcileOptions(t3.selection), decorations: s3, oldDecorations: n3, compositionBlockId: this.compositionTracker.isComposing ? this.compositionTracker.activeBlockId ?? void 0 : void 0 }), this.compositionTracker.isComposing || Me(this.contentElement, e5.selection);
3013
3130
  } finally {
3014
3131
  this.isUpdating = false;
3015
3132
  }
@@ -3112,8 +3229,8 @@ class Xs {
3112
3229
  this.goalColumn = null;
3113
3230
  const t3 = this.resolveLogicalHorizontalDirection(e5), n3 = Oe(this.state, t3);
3114
3231
  if (n3) return this.dispatch(n3), this.validateSelectionAfterInlineSkip(), true;
3115
- if (!Pe(this.contentElement, this.state, e5)) return false;
3116
- const s3 = _e(this.state, t3);
3232
+ if (!_e(this.contentElement, this.state, e5)) return false;
3233
+ const s3 = De(this.state, t3);
3117
3234
  return !!s3 && (this.dispatch(s3), true);
3118
3235
  }
3119
3236
  resolveLogicalHorizontalDirection(e5) {
@@ -3123,8 +3240,8 @@ class Xs {
3123
3240
  return n3 instanceof HTMLElement && "rtl" === Ze(n3) ? "left" === e5 ? "right" : "left" : e5;
3124
3241
  }
3125
3242
  handleVerticalArrow(e5) {
3126
- const t3 = this.contentElement.ownerDocument.getSelection?.() ?? null, n3 = t3 ? De(t3) : null;
3127
- if (!Pe(this.contentElement, this.state, e5, n3)) return false;
3243
+ const t3 = this.contentElement.ownerDocument.getSelection?.() ?? null, n3 = t3 ? Pe(t3) : null;
3244
+ if (!_e(this.contentElement, this.state, e5, n3)) return false;
3128
3245
  null === this.goalColumn && n3 && (this.goalColumn = n3.left), this.preserveGoalColumn = true;
3129
3246
  const s3 = He(this.contentElement, this.state, e5, this.goalColumn);
3130
3247
  return s3 ? (this.dispatch(s3), this.preserveGoalColumn = false, true) : (this.preserveGoalColumn = false, false);
@@ -3139,9 +3256,9 @@ class Xs {
3139
3256
  this.nodeViews.clear();
3140
3257
  }
3141
3258
  }
3142
- const Ys = ["\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");
3143
- let Zs = null;
3144
- class er {
3259
+ const or = ["\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");
3260
+ let ar = null;
3261
+ class cr {
3145
3262
  themeStyleSheet = new CSSStyleSheet();
3146
3263
  systemThemeQuery = null;
3147
3264
  systemThemeHandler = null;
@@ -3171,7 +3288,7 @@ class er {
3171
3288
  this.themeStyleSheet.replaceSync(cs(e5)), this.refreshAdoptedStyleSheets();
3172
3289
  }
3173
3290
  refreshAdoptedStyleSheets() {
3174
- this.shadow.adoptedStyleSheets = [this.themeStyleSheet, (Zs || (Zs = new CSSStyleSheet(), Zs.replaceSync(Ys)), Zs), ...this.pluginSheets, ...this.runtimeSheets];
3291
+ this.shadow.adoptedStyleSheets = [this.themeStyleSheet, (ar || (ar = new CSSStyleSheet(), ar.replaceSync(or)), ar), ...this.pluginSheets, ...this.runtimeSheets];
3175
3292
  }
3176
3293
  setupSystemThemeListener() {
3177
3294
  this.systemThemeQuery = window.matchMedia("(prefers-color-scheme: dark)"), this.systemThemeHandler = (e5) => {
@@ -3186,7 +3303,7 @@ class er {
3186
3303
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? es.Dark : es.Light;
3187
3304
  }
3188
3305
  }
3189
- class tr {
3306
+ class lr {
3190
3307
  wrapper;
3191
3308
  content;
3192
3309
  viewport = null;
@@ -3230,12 +3347,12 @@ class tr {
3230
3347
  this.viewport = null, this.surface = null, this.currentSize = null, this.currentPaperWidthPx = 0, this.currentPaperHeightPx = 0, this.currentScale = 1, this.wrapper.removeAttribute("data-paper-mode");
3231
3348
  }
3232
3349
  updateSurfaceDimensions() {
3233
- this.surface && (Bt(this.surface, "width", `${this.currentPaperWidthPx}px`), Bt(this.surface, "minHeight", `${this.currentPaperHeightPx}px`));
3350
+ this.surface && (Nt(this.surface, "width", `${this.currentPaperWidthPx}px`), Nt(this.surface, "minHeight", `${this.currentPaperHeightPx}px`));
3234
3351
  }
3235
3352
  onViewportResize(e5) {
3236
3353
  if (!this.surface || 0 === this.currentPaperWidthPx) return;
3237
3354
  const t3 = e5 - 48, n3 = Math.min(1, t3 / this.currentPaperWidthPx);
3238
- this.currentScale = n3, Bt(this.surface, "transform", n3 < 1 ? `scale(${n3})` : ""), this.scheduleHeightCompensation(n3);
3355
+ this.currentScale = n3, Nt(this.surface, "transform", n3 < 1 ? `scale(${n3})` : ""), this.scheduleHeightCompensation(n3);
3239
3356
  }
3240
3357
  onSurfaceResize(e5) {
3241
3358
  this.surface && this.viewport && this.scheduleHeightCompensation(this.currentScale);
@@ -3247,12 +3364,12 @@ class tr {
3247
3364
  }
3248
3365
  updateHeightCompensation(e5) {
3249
3366
  if (!this.surface) return;
3250
- if (e5 >= 1) return void Bt(this.surface, "marginBottom", "");
3367
+ if (e5 >= 1) return void Nt(this.surface, "marginBottom", "");
3251
3368
  const t3 = this.surface.scrollHeight, n3 = t3 * e5 - t3;
3252
- Bt(this.surface, "marginBottom", `${n3}px`);
3369
+ Nt(this.surface, "marginBottom", `${n3}px`);
3253
3370
  }
3254
3371
  }
3255
- class nr extends HTMLElement {
3372
+ class hr extends HTMLElement {
3256
3373
  view = null;
3257
3374
  pluginManager = null;
3258
3375
  contentElement = null;
@@ -3301,7 +3418,7 @@ class nr extends HTMLElement {
3301
3418
  this.initialized = true, e5 && (this.config = e5);
3302
3419
  const t3 = this.shadowRoot;
3303
3420
  if (!t3) return;
3304
- this.themeController = new er(t3), this.setupStyleRuntime(t3), this.themeController.apply(this.config.theme ?? es.Light);
3421
+ this.themeController = new cr(t3), this.setupStyleRuntime(t3), this.themeController.apply(this.config.theme ?? es.Light);
3305
3422
  const n3 = (function(e6) {
3306
3423
  const t4 = document.createElement("div");
3307
3424
  t4.className = "notectl-editor";
@@ -3314,9 +3431,9 @@ class nr extends HTMLElement {
3314
3431
  const i10 = document.createElement("div");
3315
3432
  return i10.className = "notectl-sr-only", i10.setAttribute("data-notectl-no-print", ""), i10.setAttribute("aria-live", "polite"), i10.setAttribute("aria-atomic", "true"), t4.appendChild(n4), t4.appendChild(s4), t4.appendChild(r5), t4.appendChild(i10), { wrapper: t4, content: s4, topPluginContainer: n4, bottomPluginContainer: r5, announcer: i10 };
3316
3433
  })({ readonly: this.config.readonly, placeholder: this.config.placeholder });
3317
- this.editorWrapper = n3.wrapper, this.contentElement = n3.content, this.topPluginContainer = n3.topPluginContainer, this.bottomPluginContainer = n3.bottomPluginContainer, this.announcer = n3.announcer, t3.appendChild(this.editorWrapper), this.config.paperSize && (this.paperLayout = new tr(this.editorWrapper, this.contentElement), this.paperLayout.apply(this.config.paperSize)), this.pluginManager = new On();
3434
+ this.editorWrapper = n3.wrapper, this.contentElement = n3.content, this.topPluginContainer = n3.topPluginContainer, this.bottomPluginContainer = n3.bottomPluginContainer, this.announcer = n3.announcer, t3.appendChild(this.editorWrapper), this.config.paperSize && (this.paperLayout = new lr(this.editorWrapper, this.contentElement), this.paperLayout.apply(this.config.paperSize)), this.pluginManager = new On();
3318
3435
  const s3 = new st(this.config.locale ?? "browser");
3319
- this.pluginManager.registerService(rt, s3), Kt(this.pluginManager.schemaRegistry), this.processToolbarConfig();
3436
+ this.pluginManager.registerService(rt, s3), $t(this.pluginManager.schemaRegistry), this.processToolbarConfig();
3320
3437
  for (const e6 of this.config.plugins ?? []) this.pluginManager.register(e6);
3321
3438
  for (const e6 of this.preInitPlugins) this.pluginManager.register(e6);
3322
3439
  this.preInitPlugins = [], this.ensureTextFormattingPlugin(), this.ensureCaretNavigationPlugin(), this.ensureGapCursorPlugin(), this.contentElement.addEventListener("focus", () => this.emit("focus", void 0)), this.contentElement.addEventListener("blur", () => this.emit("blur", void 0));
@@ -3329,8 +3446,8 @@ class nr extends HTMLElement {
3329
3446
  }, dispatch: (e6) => this.dispatch(e6), getContainer: () => r4, getPluginContainer: (e6) => "top" === e6 ? o2 : a22, announce: (e6) => {
3330
3447
  c11 && (c11.textContent = e6);
3331
3448
  }, hasAnnouncement: () => !!c11?.textContent, onBeforeReady: () => {
3332
- const e6 = me(i9.schemaRegistry), t4 = tn.create({ schema: e6 });
3333
- this.view = new Xs(r4, { state: t4, schemaRegistry: i9.schemaRegistry, keymapRegistry: i9.keymapRegistry, inputRuleRegistry: i9.inputRuleRegistry, fileHandlerRegistry: i9.fileHandlerRegistry, nodeViewRegistry: i9.nodeViewRegistry, maxHistoryDepth: this.config.maxHistoryDepth, getDecorations: (e7, t5) => this.pluginManager?.collectDecorations(e7, t5) ?? lt.empty, onStateChange: (e7, t5, n5) => {
3449
+ const e6 = me(i9.schemaRegistry), t4 = en.create({ schema: e6 });
3450
+ this.view = new ir(r4, { state: t4, schemaRegistry: i9.schemaRegistry, keymapRegistry: i9.keymapRegistry, inputRuleRegistry: i9.inputRuleRegistry, fileHandlerRegistry: i9.fileHandlerRegistry, nodeViewRegistry: i9.nodeViewRegistry, maxHistoryDepth: this.config.maxHistoryDepth, getDecorations: (e7, t5) => this.pluginManager?.collectDecorations(e7, t5) ?? lt.empty, onStateChange: (e7, t5, n5) => {
3334
3451
  this.onStateChange(e7, t5, n5);
3335
3452
  }, isReadOnly: () => this.config.readonly ?? false }), this.updateEmptyState();
3336
3453
  const n4 = i9.getPluginStyleSheets();
@@ -3347,17 +3464,22 @@ class nr extends HTMLElement {
3347
3464
  return this.view.getState().doc;
3348
3465
  }
3349
3466
  setJSON(e5) {
3350
- const t3 = this.pluginManager ? me(this.pluginManager.schemaRegistry) : void 0, n3 = tn.create({ doc: e5, schema: t3, selection: re(e5.children[0]?.id ?? ye(""), 0) });
3467
+ const t3 = this.pluginManager ? me(this.pluginManager.schemaRegistry) : void 0, n3 = en.create({ doc: e5, schema: t3, selection: re(e5.children[0]?.id ?? ye(""), 0) });
3351
3468
  this.replaceState(n3);
3352
3469
  }
3353
3470
  getContentHTML(e5) {
3354
3471
  if (!this.view) throw new Error("Editor not initialized");
3355
- const t3 = us(this.view.getState().doc, this.pluginManager?.schemaRegistry);
3356
- return e5?.pretty ? xe(t3) : t3;
3472
+ const t3 = this.view.getState().doc, n3 = this.pluginManager?.schemaRegistry;
3473
+ if ("classes" === e5?.cssMode) {
3474
+ const s4 = gs(t3, n3);
3475
+ return e5.pretty ? { html: xe(s4.html), css: s4.css, styleMap: s4.styleMap } : s4;
3476
+ }
3477
+ const s3 = fs(t3, n3);
3478
+ return e5?.pretty ? xe(s3) : s3;
3357
3479
  }
3358
- setContentHTML(e5) {
3359
- const t3 = ys(e5, this.pluginManager?.schemaRegistry);
3360
- this.setJSON(t3);
3480
+ setContentHTML(e5, t3) {
3481
+ const n3 = vs(e5, this.pluginManager?.schemaRegistry, t3);
3482
+ this.setJSON(n3);
3361
3483
  }
3362
3484
  getText() {
3363
3485
  if (!this.view) throw new Error("Editor not initialized");
@@ -3405,7 +3527,7 @@ class nr extends HTMLElement {
3405
3527
  return this.view.getState();
3406
3528
  }
3407
3529
  dispatch(e5) {
3408
- this.view && this.pluginManager && (!this.config.readonly || an(e5) || this.pluginManager.isReadonlyBypassed()) && this.pluginManager.dispatchWithMiddleware(e5, this.view.getState(), (e6) => this.view?.dispatch(e6));
3530
+ this.view && this.pluginManager && (!this.config.readonly || on(e5) || this.pluginManager.isReadonlyBypassed()) && this.pluginManager.dispatchWithMiddleware(e5, this.view.getState(), (e6) => this.view?.dispatch(e6));
3409
3531
  }
3410
3532
  on(e5, t3) {
3411
3533
  this.eventListeners.has(e5) || this.eventListeners.set(e5, /* @__PURE__ */ new Set()), this.eventListeners.get(e5)?.add(t3);
@@ -3457,16 +3579,14 @@ class nr extends HTMLElement {
3457
3579
  this.pluginManager && void 0 === this.pluginManager.get("gap-cursor") && this.pluginManager.register(new Rt());
3458
3580
  }
3459
3581
  applyPaperSize(e5) {
3460
- this.editorWrapper && this.contentElement && (e5 ? (this.paperLayout || (this.paperLayout = new tr(this.editorWrapper, this.contentElement)), this.paperLayout.apply(e5)) : this.paperLayout?.apply(null));
3582
+ this.editorWrapper && this.contentElement && (e5 ? (this.paperLayout || (this.paperLayout = new lr(this.editorWrapper, this.contentElement)), this.paperLayout.apply(e5)) : this.paperLayout?.apply(null));
3461
3583
  }
3462
3584
  setupStyleRuntime(e5) {
3463
- Ot(e5), this.runtimeStyleSheet = null;
3464
- const t3 = this.config.styleMode ?? "strict";
3465
- "strict" === t3 && (this.runtimeStyleSheet = Pt()), this.themeController?.setRuntimeStyleSheets(this.runtimeStyleSheet ? [this.runtimeStyleSheet] : []), _t(e5, { mode: t3, nonce: this.config.styleNonce, sheet: this.runtimeStyleSheet });
3585
+ Bt(e5), this.runtimeStyleSheet = Ot(), this.themeController?.setRuntimeStyleSheets(this.runtimeStyleSheet ? [this.runtimeStyleSheet] : []), _t(e5, { nonce: this.config.styleNonce, sheet: this.runtimeStyleSheet });
3466
3586
  }
3467
3587
  teardownStyleRuntime() {
3468
3588
  const e5 = this.shadowRoot;
3469
- e5 && Ot(e5), this.runtimeStyleSheet = null, this.themeController?.setRuntimeStyleSheets([]);
3589
+ e5 && Bt(e5), this.runtimeStyleSheet = null, this.themeController?.setRuntimeStyleSheets([]);
3470
3590
  }
3471
3591
  emit(e5, t3) {
3472
3592
  const n3 = this.eventListeners.get(e5);
@@ -3485,17 +3605,17 @@ class nr extends HTMLElement {
3485
3605
  this.view && (this.view.replaceState(e5), this.updateEmptyState());
3486
3606
  }
3487
3607
  }
3488
- async function sr(e5) {
3608
+ async function dr(e5) {
3489
3609
  const t3 = document.createElement("notectl-editor");
3490
3610
  return await t3.init(e5), t3;
3491
3611
  }
3492
- function rr(e5) {
3493
- return { toolbar: [[new wt({ fonts: Ht, ...e5?.font })]], plugins: [] };
3612
+ function ur(e5) {
3613
+ return { toolbar: [[new wt({ fonts: Pt, ...e5?.font })]], plugins: [] };
3494
3614
  }
3495
- function ir(e5) {
3496
- return { toolbar: [[new wt({ fonts: Ht, ...e5?.font }), new Et(e5?.fontSize)], [new pt(e5?.textFormatting), new kt(e5?.strikethrough), new Tt(e5?.superSub)], [new vt(e5?.textColor), new Ct(e5?.highlight)], [new ft(e5?.heading), new yt(e5?.blockquote), new dt(e5?.codeBlock)], [new St(e5?.alignment)], [new mt(e5?.list)], [new gt(e5?.link), new xt(e5?.table), new bt(e5?.horizontalRule), new At(e5?.image)], [new Zn(e5?.print)]], plugins: [new Ye()] };
3615
+ function pr(e5) {
3616
+ return { toolbar: [[new wt({ fonts: Pt, ...e5?.font }), new Et(e5?.fontSize)], [new pt(e5?.textFormatting), new kt(e5?.strikethrough), new Tt(e5?.superSub)], [new bt(e5?.textColor), new Ct(e5?.highlight)], [new ft(e5?.heading), new yt(e5?.blockquote), new dt(e5?.codeBlock)], [new St(e5?.alignment)], [new mt(e5?.list)], [new gt(e5?.link), new xt(e5?.table), new vt(e5?.horizontalRule), new At(e5?.image)], [new Zn(e5?.print)]], plugins: [new Ye()] };
3497
3617
  }
3498
- "undefined" == typeof customElements || customElements.get("notectl-editor") || customElements.define("notectl-editor", nr);
3618
+ "undefined" == typeof customElements || customElements.get("notectl-editor") || customElements.define("notectl-editor", hr);
3499
3619
  export {
3500
3620
  Xn as AFTER_PRINT,
3501
3621
  a13 as ALIGNMENT_ICONS,
@@ -3519,7 +3639,7 @@ export {
3519
3639
  ns as DARK_THEME,
3520
3640
  D2 as DEFAULT_IMAGE_KEYMAP,
3521
3641
  lt as DecorationSet,
3522
- tn as EditorState,
3642
+ en as EditorState,
3523
3643
  Bn as EventBus,
3524
3644
  et as EventKey,
3525
3645
  a14 as FONT_LOCALES,
@@ -3539,14 +3659,14 @@ export {
3539
3659
  Ye as HardBreakPlugin,
3540
3660
  ft as HeadingPlugin,
3541
3661
  Ct as HighlightPlugin,
3542
- cn as HistoryManager,
3543
- bt as HorizontalRulePlugin,
3662
+ an as HistoryManager,
3663
+ vt as HorizontalRulePlugin,
3544
3664
  a19 as IMAGE_LOCALES,
3545
3665
  b21 as IMAGE_LOCALE_EN,
3546
3666
  c9 as IMAGE_UPLOAD_SERVICE,
3547
3667
  At as ImagePlugin,
3548
- bn as InputRuleRegistry,
3549
- vn as KeymapRegistry,
3668
+ vn as InputRuleRegistry,
3669
+ bn as KeymapRegistry,
3550
3670
  ts as LIGHT_THEME,
3551
3671
  a7 as LINK_LOCALES,
3552
3672
  b9 as LINK_LOCALE_EN,
@@ -3558,23 +3678,23 @@ export {
3558
3678
  st as LocaleService,
3559
3679
  rt as LocaleServiceKey,
3560
3680
  En as NodeViewRegistry,
3561
- nr as NotectlEditor,
3681
+ hr as NotectlEditor,
3562
3682
  Wn as PAPER_MARGIN_HORIZONTAL_PX,
3563
3683
  Un as PAPER_MARGIN_TOP_PX,
3564
3684
  Vn as PAPER_VIEWPORT_PADDING_PX,
3565
- _n as PRINT_LOCALES,
3566
- Pn as PRINT_LOCALE_EN,
3685
+ Dn as PRINT_LOCALES,
3686
+ _n as PRINT_LOCALE_EN,
3567
3687
  Jn as PRINT_SERVICE_KEY,
3568
3688
  zn as PaperSize,
3569
3689
  On as PluginManager,
3570
3690
  P as PopupManager,
3571
- b5 as PopupServiceKey,
3691
+ a2 as PopupServiceKey,
3572
3692
  Zn as PrintPlugin,
3573
3693
  a10 as STRIKETHROUGH_LOCALES,
3574
3694
  b12 as STRIKETHROUGH_LOCALE_EN,
3575
3695
  a18 as SUPER_SUB_LOCALES,
3576
3696
  b20 as SUPER_SUB_LOCALE_EN,
3577
- zt as SchemaRegistry,
3697
+ Ht as SchemaRegistry,
3578
3698
  tt as ServiceKey,
3579
3699
  kt as StrikethroughPlugin,
3580
3700
  Tt as SuperSubPlugin,
@@ -3591,40 +3711,40 @@ export {
3591
3711
  b13 as TEXT_COLOR_LOCALE_EN,
3592
3712
  a5 as TEXT_FORMATTING_LOCALES,
3593
3713
  b7 as TEXT_FORMATTING_LOCALE_EN,
3594
- c5 as TOOLBAR_LOCALES,
3595
- d2 as TOOLBAR_LOCALE_EN,
3714
+ b5 as TOOLBAR_LOCALES,
3715
+ c5 as TOOLBAR_LOCALE_EN,
3596
3716
  xt as TablePlugin,
3597
3717
  j4 as TableSelectionServiceKey,
3598
- St as TextAlignmentPlugin,
3599
- vt as TextColorPlugin,
3718
+ bt as TextColorPlugin,
3600
3719
  pt as TextFormattingPlugin,
3601
3720
  es as ThemePreset,
3602
- e3 as ToolbarOverflowBehavior,
3721
+ d2 as ToolbarOverflowBehavior,
3603
3722
  it as ToolbarPlugin,
3604
3723
  xn as ToolbarRegistry,
3605
- a2 as ToolbarServiceKey,
3606
- en as TransactionBuilder,
3607
- ds as VALID_ALIGNMENTS,
3724
+ e3 as ToolbarServiceKey,
3725
+ Zt as TransactionBuilder,
3726
+ ps as VALID_ALIGNMENTS,
3727
+ Ls as adoptContentStyles,
3608
3728
  a3 as appendToRoot,
3609
3729
  a20 as applyAttributedMark,
3610
- Xt as applyStep,
3730
+ Qt as applyStep,
3611
3731
  Nn as attachGridKeyboard,
3612
3732
  In as attachListboxKeyboard,
3613
3733
  Mn as attachMenuKeyboard,
3614
3734
  ye as blockId,
3615
3735
  v as blockOffsetToTextOffset,
3616
- jt as canContain,
3736
+ zt as canContain,
3617
3737
  c10 as canCrossBlockBoundary,
3618
3738
  c3 as commandName,
3619
3739
  we as createBlockElement,
3620
3740
  _ as createBlockNode,
3621
3741
  re as createCollapsedSelection,
3622
3742
  W as createDocument,
3623
- sr as createEditor,
3624
- ir as createFullPreset,
3743
+ dr as createEditor,
3744
+ pr as createFullPreset,
3625
3745
  j2 as createGapCursor,
3626
3746
  X as createInlineNode,
3627
- rr as createMinimalPreset,
3747
+ ur as createMinimalPreset,
3628
3748
  se as createNodeSelection,
3629
3749
  ce as createPosition,
3630
3750
  ae as createSelection,
@@ -3632,13 +3752,13 @@ export {
3632
3752
  ss as createTheme,
3633
3753
  ls as createThemeStyleSheet,
3634
3754
  pe as defaultSchema,
3635
- hn as deleteBackward,
3755
+ ln as deleteBackward,
3636
3756
  Ve as deleteBackwardAtGap,
3637
- dn as deleteForward,
3757
+ hn as deleteForward,
3638
3758
  Ge as deleteForwardAtGap,
3639
3759
  ze as deleteNodeSelection,
3640
3760
  je as deleteSelectionCommand,
3641
- Pe as endOfTextblock,
3761
+ _e as endOfTextblock,
3642
3762
  Ee as escapeHTML,
3643
3763
  e as extendCharacterBackward,
3644
3764
  c as extendCharacterForward,
@@ -3668,7 +3788,7 @@ export {
3668
3788
  K as getBlockMarksAtOffset,
3669
3789
  $ as getBlockText,
3670
3790
  p as getBlockTypeLabel,
3671
- De as getCaretRectFromSelection,
3791
+ Pe as getCaretRectFromSelection,
3672
3792
  U as getContentAtOffset,
3673
3793
  I as getInlineChildren,
3674
3794
  g3 as getMarkAttrAtSelection,
@@ -3677,13 +3797,14 @@ export {
3677
3797
  w as getTextChildren,
3678
3798
  Ze as getTextDirection,
3679
3799
  h as hasMark,
3800
+ Ts as injectContentStyles,
3680
3801
  i5 as inlineDecoration,
3681
- ve as inlineType,
3802
+ be as inlineType,
3682
3803
  Je as insertHardBreakCommand,
3683
3804
  qe as insertTextCommand,
3684
- Yt as invertStep,
3685
- Zt as invertTransaction,
3686
- an as isAllowedInReadonly,
3805
+ Xt as invertStep,
3806
+ Yt as invertTransaction,
3807
+ on as isAllowedInReadonly,
3687
3808
  i7 as isAttributedMarkActive,
3688
3809
  S as isBlockNode,
3689
3810
  le as isCollapsed,
@@ -3702,14 +3823,14 @@ export {
3702
3823
  i2 as isMarkOfType,
3703
3824
  Se as isNodeOfType,
3704
3825
  ie as isNodeSelection,
3705
- on as isSelectionOnlyTransaction,
3826
+ rn as isSelectionOnlyTransaction,
3706
3827
  R as isTextNode,
3707
3828
  de as isTextSelection,
3708
3829
  Gn as isValidPaperSize,
3709
3830
  i8 as isVoidBlock,
3710
3831
  b4 as isWebKit,
3711
3832
  Q as markSetsEqual,
3712
- be as markType,
3833
+ ve as markType,
3713
3834
  Ke as mergeBlockBackward,
3714
3835
  q as moveCharacterBackward,
3715
3836
  r as moveCharacterForward,
@@ -3724,7 +3845,7 @@ export {
3724
3845
  m2 as moveTx,
3725
3846
  A as moveWordBackward,
3726
3847
  B as moveWordForward,
3727
- _e as navigateAcrossBlocks,
3848
+ De as navigateAcrossBlocks,
3728
3849
  Ue as navigateArrowIntoVoid,
3729
3850
  Re as navigateFromGapCursor,
3730
3851
  He as navigateVerticalWithGoalColumn,
@@ -3732,13 +3853,15 @@ export {
3732
3853
  n2 as nodeDecoration,
3733
3854
  j3 as nodeSelTx,
3734
3855
  ke as nodeType,
3735
- pn as normalizeKeyDescriptor,
3736
- ys as parseHTMLToDocument,
3856
+ un as normalizeKeyDescriptor,
3857
+ vs as parseHTMLToDocument,
3737
3858
  p2 as pluginId,
3738
3859
  p3 as positionPopup,
3739
3860
  E as prevGraphemeSize,
3740
- Kt as registerBuiltinSpecs,
3861
+ $t as registerBuiltinSpecs,
3862
+ Ms as removeAdoptedStyles,
3741
3863
  r3 as removeAttributedMark,
3864
+ As as removeContentStyles,
3742
3865
  r2 as renderColorGrid,
3743
3866
  Te as resolveNodeByPath,
3744
3867
  c4 as resolveParentByPath,
@@ -3748,7 +3871,8 @@ export {
3748
3871
  Fe as selectAll,
3749
3872
  ue as selectionRange,
3750
3873
  he as selectionsEqual,
3751
- us as serializeDocumentToHTML,
3874
+ gs as serializeDocumentToCSS,
3875
+ fs as serializeDocumentToHTML,
3752
3876
  s2 as sharesParent,
3753
3877
  Oe as skipInlineNode,
3754
3878
  We as splitBlockCommand,
@@ -3756,7 +3880,7 @@ export {
3756
3880
  c2 as toggleItalic,
3757
3881
  e2 as toggleMark,
3758
3882
  f as toggleUnderline,
3759
- $t as validateContent,
3883
+ jt as validateContent,
3760
3884
  F as viewExtend,
3761
3885
  G as viewMove,
3762
3886
  w3 as walkNodes,