@notectl/core 1.0.9 → 1.6.1

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 (227) hide show
  1. package/dist/chunks/{AttrRegistry-D-przlzb.mjs → AttrRegistry-I-VdmRnN.mjs} +2 -2
  2. package/dist/chunks/{AttrRegistry-D-przlzb.mjs.map → AttrRegistry-I-VdmRnN.mjs.map} +1 -1
  3. package/dist/chunks/CaretNavigation-CAJXoaae.mjs +311 -0
  4. package/dist/chunks/CaretNavigation-CAJXoaae.mjs.map +1 -0
  5. package/dist/chunks/ColorNames-BdsHwA2f.mjs +59 -0
  6. package/dist/chunks/ColorNames-BdsHwA2f.mjs.map +1 -0
  7. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs +125 -0
  8. package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs.map +1 -0
  9. package/dist/chunks/Commands-CicwYoTQ.mjs +286 -0
  10. package/dist/chunks/Commands-CicwYoTQ.mjs.map +1 -0
  11. package/dist/chunks/{Document-CI3iCwEP.mjs → Document-CuwE73FF.mjs} +35 -22
  12. package/dist/chunks/{Document-CI3iCwEP.mjs.map → Document-CuwE73FF.mjs.map} +1 -1
  13. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs +35 -0
  14. package/dist/chunks/HTMLUtils-DTqQzcKR.mjs.map +1 -0
  15. package/dist/chunks/MarkCommands-CC37WA7Z.mjs +94 -0
  16. package/dist/chunks/MarkCommands-CC37WA7Z.mjs.map +1 -0
  17. package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs +47 -0
  18. package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs.map +1 -0
  19. package/dist/chunks/{NodeResolver-D68ZLXti.mjs → NodeResolver-B-wzthAQ.mjs} +2 -2
  20. package/dist/chunks/{NodeResolver-D68ZLXti.mjs.map → NodeResolver-B-wzthAQ.mjs.map} +1 -1
  21. package/dist/chunks/Platform-S_xqIqcM.mjs +26 -0
  22. package/dist/chunks/Platform-S_xqIqcM.mjs.map +1 -0
  23. package/dist/chunks/Selection-DmFDwiPJ.mjs +52 -0
  24. package/dist/chunks/Selection-DmFDwiPJ.mjs.map +1 -0
  25. package/dist/chunks/ToolbarItem-BpZggUGo.mjs +8 -0
  26. package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -0
  27. package/dist/chunks/{ToolbarPlugin-DFkl1uYO.mjs → ToolbarPlugin-B6JETWaw.mjs} +3 -3
  28. package/dist/chunks/{ToolbarPlugin-DFkl1uYO.mjs.map → ToolbarPlugin-B6JETWaw.mjs.map} +1 -1
  29. package/dist/chunks/index--z_Txzej.mjs +467 -0
  30. package/dist/chunks/index--z_Txzej.mjs.map +1 -0
  31. package/dist/chunks/{index-o6hDR07y.mjs → index-83QoUENW.mjs} +25 -20
  32. package/dist/chunks/index-83QoUENW.mjs.map +1 -0
  33. package/dist/chunks/{index-DfO_fKw6.mjs → index-B0UFAfyb.mjs} +15 -15
  34. package/dist/chunks/{index-DfO_fKw6.mjs.map → index-B0UFAfyb.mjs.map} +1 -1
  35. package/dist/chunks/{index-BFsYGsBR.mjs → index-BDMP86F4.mjs} +39 -39
  36. package/dist/chunks/{index-BFsYGsBR.mjs.map → index-BDMP86F4.mjs.map} +1 -1
  37. package/dist/chunks/{index-Bsp4LC5t.mjs → index-BWXkaC2Z.mjs} +36 -36
  38. package/dist/chunks/index-BWXkaC2Z.mjs.map +1 -0
  39. package/dist/chunks/{index-DAFCISBN.mjs → index-BigJ0z6n.mjs} +3 -3
  40. package/dist/chunks/{index-DAFCISBN.mjs.map → index-BigJ0z6n.mjs.map} +1 -1
  41. package/dist/chunks/{index-uTnc9y7M.mjs → index-CPjf45-o.mjs} +28 -28
  42. package/dist/chunks/index-CPjf45-o.mjs.map +1 -0
  43. package/dist/chunks/{index-DGrRWMlW.mjs → index-CPyHuEzh.mjs} +105 -105
  44. package/dist/chunks/index-CPyHuEzh.mjs.map +1 -0
  45. package/dist/chunks/{index-BL56fbXt.mjs → index-D4GKlc-A.mjs} +89 -87
  46. package/dist/chunks/index-D4GKlc-A.mjs.map +1 -0
  47. package/dist/chunks/{index-BRYzYOYC.mjs → index-D67mP19g.mjs} +29 -29
  48. package/dist/chunks/index-D67mP19g.mjs.map +1 -0
  49. package/dist/chunks/{index-BIL37LSL.mjs → index-D8tbbW97.mjs} +18 -18
  50. package/dist/chunks/{index-BIL37LSL.mjs.map → index-D8tbbW97.mjs.map} +1 -1
  51. package/dist/chunks/{index-DC1EK22F.mjs → index-DIAXWwgJ.mjs} +24 -19
  52. package/dist/chunks/index-DIAXWwgJ.mjs.map +1 -0
  53. package/dist/chunks/{index-BSFLNveF.mjs → index-DQryjfJs.mjs} +352 -341
  54. package/dist/chunks/index-DQryjfJs.mjs.map +1 -0
  55. package/dist/chunks/{index-BTJfyJlJ.mjs → index-DRZwd-1W.mjs} +104 -104
  56. package/dist/chunks/index-DRZwd-1W.mjs.map +1 -0
  57. package/dist/chunks/{index-BQ8iIYLn.mjs → index-DUC1X43Z.mjs} +54 -54
  58. package/dist/chunks/index-DUC1X43Z.mjs.map +1 -0
  59. package/dist/chunks/{index-BCvuDpVr.mjs → index-DipAT_Q9.mjs} +31 -31
  60. package/dist/chunks/index-DipAT_Q9.mjs.map +1 -0
  61. package/dist/chunks/{index-DA8TG2S8.mjs → index-tBDVaSjG.mjs} +56 -56
  62. package/dist/chunks/index-tBDVaSjG.mjs.map +1 -0
  63. package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -1
  64. package/dist/commands/Commands.d.ts +13 -45
  65. package/dist/commands/Commands.d.ts.map +1 -1
  66. package/dist/commands/DeleteCommands.d.ts +15 -0
  67. package/dist/commands/DeleteCommands.d.ts.map +1 -0
  68. package/dist/commands/GapCursorCommands.d.ts +24 -0
  69. package/dist/commands/GapCursorCommands.d.ts.map +1 -0
  70. package/dist/commands/MarkCommands.d.ts +19 -0
  71. package/dist/commands/MarkCommands.d.ts.map +1 -0
  72. package/dist/commands/MovementCommands.d.ts +27 -0
  73. package/dist/commands/MovementCommands.d.ts.map +1 -0
  74. package/dist/commands/NodeSelectionCommands.d.ts +24 -0
  75. package/dist/commands/NodeSelectionCommands.d.ts.map +1 -0
  76. package/dist/commands/PasteCommand.d.ts.map +1 -1
  77. package/dist/commands/WordBoundary.d.ts +12 -0
  78. package/dist/commands/WordBoundary.d.ts.map +1 -0
  79. package/dist/editor/DocumentSerializer.d.ts.map +1 -1
  80. package/dist/editor/NotectlEditor.d.ts +7 -1
  81. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  82. package/dist/index.d.ts +25 -7
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/input/ClipboardHandler.d.ts.map +1 -1
  85. package/dist/input/CompositionTracker.d.ts +14 -0
  86. package/dist/input/CompositionTracker.d.ts.map +1 -0
  87. package/dist/input/FileHandlerRegistry.d.ts +16 -0
  88. package/dist/input/FileHandlerRegistry.d.ts.map +1 -0
  89. package/dist/input/InputHandler.d.ts +6 -4
  90. package/dist/input/InputHandler.d.ts.map +1 -1
  91. package/dist/input/InputRuleRegistry.d.ts +9 -0
  92. package/dist/input/InputRuleRegistry.d.ts.map +1 -0
  93. package/dist/input/KeyboardHandler.d.ts +20 -5
  94. package/dist/input/KeyboardHandler.d.ts.map +1 -1
  95. package/dist/input/Keymap.d.ts +11 -0
  96. package/dist/input/Keymap.d.ts.map +1 -1
  97. package/dist/input/KeymapRegistry.d.ts +19 -0
  98. package/dist/input/KeymapRegistry.d.ts.map +1 -0
  99. package/dist/input/PasteHandler.d.ts +3 -0
  100. package/dist/input/PasteHandler.d.ts.map +1 -1
  101. package/dist/model/Document.d.ts +8 -0
  102. package/dist/model/Document.d.ts.map +1 -1
  103. package/dist/model/GraphemeUtils.d.ts +20 -0
  104. package/dist/model/GraphemeUtils.d.ts.map +1 -0
  105. package/dist/model/HTMLUtils.d.ts +6 -1
  106. package/dist/model/HTMLUtils.d.ts.map +1 -1
  107. package/dist/model/NavigationUtils.d.ts +16 -0
  108. package/dist/model/NavigationUtils.d.ts.map +1 -0
  109. package/dist/model/SchemaRegistry.d.ts +0 -39
  110. package/dist/model/SchemaRegistry.d.ts.map +1 -1
  111. package/dist/model/Selection.d.ts +14 -3
  112. package/dist/model/Selection.d.ts.map +1 -1
  113. package/dist/notectl-core.mjs +2755 -2496
  114. package/dist/notectl-core.mjs.map +1 -1
  115. package/dist/notectl-core.umd.js +2672 -1680
  116. package/dist/notectl-core.umd.js.map +1 -1
  117. package/dist/plugins/Plugin.d.ts +17 -3
  118. package/dist/plugins/Plugin.d.ts.map +1 -1
  119. package/dist/plugins/PluginManager.d.ts +14 -0
  120. package/dist/plugins/PluginManager.d.ts.map +1 -1
  121. package/dist/plugins/alignment.mjs +1 -1
  122. package/dist/plugins/blockquote.mjs +1 -1
  123. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +35 -0
  124. package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -0
  125. package/dist/plugins/caret-navigation/index.d.ts +2 -0
  126. package/dist/plugins/caret-navigation/index.d.ts.map +1 -0
  127. package/dist/plugins/caret-navigation.mjs +5 -0
  128. package/dist/plugins/caret-navigation.mjs.map +1 -0
  129. package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -1
  130. package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
  131. package/dist/plugins/code-block.mjs +1 -1
  132. package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
  133. package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
  134. package/dist/plugins/font-size.mjs +1 -1
  135. package/dist/plugins/font.mjs +1 -1
  136. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +15 -0
  137. package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -0
  138. package/dist/plugins/gap-cursor/index.d.ts +2 -0
  139. package/dist/plugins/gap-cursor/index.d.ts.map +1 -0
  140. package/dist/plugins/gap-cursor.mjs +65 -0
  141. package/dist/plugins/gap-cursor.mjs.map +1 -0
  142. package/dist/plugins/hard-break.mjs +1 -1
  143. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts +9 -0
  144. package/dist/plugins/heading/BlockTypePickerRegistry.d.ts.map +1 -0
  145. package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -1
  146. package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -1
  147. package/dist/plugins/heading.mjs +1 -1
  148. package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
  149. package/dist/plugins/highlight.mjs +1 -1
  150. package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
  151. package/dist/plugins/horizontal-rule.mjs +1 -1
  152. package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
  153. package/dist/plugins/image.mjs +1 -1
  154. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  155. package/dist/plugins/link.mjs +1 -1
  156. package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
  157. package/dist/plugins/list.mjs +1 -1
  158. package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
  159. package/dist/plugins/print/PrintTypes.d.ts +5 -1
  160. package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
  161. package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
  162. package/dist/plugins/shared/ColorValidation.d.ts +7 -0
  163. package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
  164. package/dist/plugins/strikethrough.mjs +1 -1
  165. package/dist/plugins/super-sub.mjs +1 -1
  166. package/dist/plugins/table/TableCommands.d.ts.map +1 -1
  167. package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
  168. package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
  169. package/dist/plugins/table.mjs +1 -1
  170. package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
  171. package/dist/plugins/text-color.mjs +1 -1
  172. package/dist/plugins/text-formatting.mjs +1 -1
  173. package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
  174. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +12 -0
  175. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -0
  176. package/dist/plugins/toolbar.mjs +2 -2
  177. package/dist/state/EditorState.d.ts.map +1 -1
  178. package/dist/state/History.d.ts.map +1 -1
  179. package/dist/state/SelectionTransactions.d.ts +10 -0
  180. package/dist/state/SelectionTransactions.d.ts.map +1 -0
  181. package/dist/test/TestUtils.d.ts +23 -0
  182. package/dist/test/TestUtils.d.ts.map +1 -1
  183. package/dist/view/CaretNavigation.d.ts +48 -0
  184. package/dist/view/CaretNavigation.d.ts.map +1 -0
  185. package/dist/view/CursorWrapper.d.ts +19 -0
  186. package/dist/view/CursorWrapper.d.ts.map +1 -0
  187. package/dist/view/DomPointUtils.d.ts +20 -0
  188. package/dist/view/DomPointUtils.d.ts.map +1 -0
  189. package/dist/view/EditorView.d.ts +43 -0
  190. package/dist/view/EditorView.d.ts.map +1 -1
  191. package/dist/view/MarkRendering.d.ts +7 -0
  192. package/dist/view/MarkRendering.d.ts.map +1 -0
  193. package/dist/view/NodeViewRegistry.d.ts +9 -0
  194. package/dist/view/NodeViewRegistry.d.ts.map +1 -0
  195. package/dist/view/Platform.d.ts +29 -0
  196. package/dist/view/Platform.d.ts.map +1 -0
  197. package/dist/view/Reconciler.d.ts +4 -0
  198. package/dist/view/Reconciler.d.ts.map +1 -1
  199. package/dist/view/SelectionSync.d.ts +2 -0
  200. package/dist/view/SelectionSync.d.ts.map +1 -1
  201. package/dist/view/ViewMovementCommands.d.ts +40 -0
  202. package/dist/view/ViewMovementCommands.d.ts.map +1 -0
  203. package/package.json +10 -2
  204. package/dist/chunks/ColorNames-iaWsSZx1.mjs +0 -35
  205. package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +0 -1
  206. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +0 -140
  207. package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +0 -1
  208. package/dist/chunks/Commands-CSpSwGXv.mjs +0 -461
  209. package/dist/chunks/Commands-CSpSwGXv.mjs.map +0 -1
  210. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +0 -7
  211. package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +0 -1
  212. package/dist/chunks/Selection-D5ZjXoB7.mjs +0 -44
  213. package/dist/chunks/Selection-D5ZjXoB7.mjs.map +0 -1
  214. package/dist/chunks/ToolbarItem-ugDymuXi.mjs +0 -7
  215. package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +0 -1
  216. package/dist/chunks/index-BCvuDpVr.mjs.map +0 -1
  217. package/dist/chunks/index-BL56fbXt.mjs.map +0 -1
  218. package/dist/chunks/index-BQ8iIYLn.mjs.map +0 -1
  219. package/dist/chunks/index-BRYzYOYC.mjs.map +0 -1
  220. package/dist/chunks/index-BSFLNveF.mjs.map +0 -1
  221. package/dist/chunks/index-BTJfyJlJ.mjs.map +0 -1
  222. package/dist/chunks/index-Bsp4LC5t.mjs.map +0 -1
  223. package/dist/chunks/index-DA8TG2S8.mjs.map +0 -1
  224. package/dist/chunks/index-DC1EK22F.mjs.map +0 -1
  225. package/dist/chunks/index-DGrRWMlW.mjs.map +0 -1
  226. package/dist/chunks/index-o6hDR07y.mjs.map +0 -1
  227. package/dist/chunks/index-uTnc9y7M.mjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
2
- import { g as o, p as n, b as c, j as r, k as l } from "./Document-CI3iCwEP.mjs";
3
- import { e as s } from "./HTMLUtils-0wvCRvJc.mjs";
2
+ import { b as o, p as n, e as c, c as r, d as l } from "./Document-CuwE73FF.mjs";
3
+ import { e as s } from "./HTMLUtils-DTqQzcKR.mjs";
4
4
  import { c as i } from "./NodeSpec-NZVvcCuH.mjs";
5
- import { i as a, a as d, c as u } from "./Selection-D5ZjXoB7.mjs";
6
- import { n as f } from "./TypeBrands-C09nE2qO.mjs";
7
- import { f as k } from "./ToolbarItem-ugDymuXi.mjs";
8
- import { f as g } from "./NodeResolver-D68ZLXti.mjs";
9
- function p(t2, e2) {
5
+ import { i as a, a as d, b as u, c as f } from "./Selection-DmFDwiPJ.mjs";
6
+ import { n as k } from "./TypeBrands-C09nE2qO.mjs";
7
+ import { f as p } from "./ToolbarItem-BpZggUGo.mjs";
8
+ import { f as g } from "./NodeResolver-B-wzthAQ.mjs";
9
+ function b(t2, e2) {
10
10
  switch (t2.type) {
11
11
  case "inline":
12
12
  return (function(t3, e3) {
@@ -20,7 +20,7 @@ function p(t2, e2) {
20
20
  case "deleteText":
21
21
  return (function(t4, e4) {
22
22
  if (t4.blockId !== e4.blockId) return t4;
23
- const o2 = e4.to - e4.from, n2 = h(t4.from, e4.from, e4.to, o2), c2 = h(t4.to, e4.from, e4.to, o2);
23
+ const o2 = e4.to - e4.from, n2 = m(t4.from, e4.from, e4.to, o2), c2 = m(t4.to, e4.from, e4.to, o2);
24
24
  return n2 >= c2 ? null : n2 === t4.from && c2 === t4.to ? t4 : { ...t4, from: n2, to: c2 };
25
25
  })(t3, e3);
26
26
  case "splitBlock":
@@ -35,7 +35,7 @@ function p(t2, e2) {
35
35
  return t4.blockId !== e4.sourceBlockId ? t4 : { ...t4, blockId: e4.targetBlockId, from: t4.from + e4.targetLengthBefore, to: t4.to + e4.targetLengthBefore };
36
36
  })(t3, e3);
37
37
  case "removeNode":
38
- return b(t3, e3);
38
+ return h(t3, e3);
39
39
  default:
40
40
  return t3;
41
41
  }
@@ -65,7 +65,7 @@ function p(t2, e2) {
65
65
  return t4.blockId !== e4.sourceBlockId ? t4 : { ...t4, blockId: e4.targetBlockId, offset: t4.offset + e4.targetLengthBefore };
66
66
  })(t3, e3);
67
67
  case "removeNode":
68
- return b(t3, e3);
68
+ return h(t3, e3);
69
69
  default:
70
70
  return t3;
71
71
  }
@@ -78,41 +78,41 @@ function p(t2, e2) {
78
78
  return t4.blockId === e4.sourceBlockId ? null : t4;
79
79
  })(t3, e3);
80
80
  case "removeNode":
81
- return b(t3, e3);
81
+ return h(t3, e3);
82
82
  default:
83
83
  return t3;
84
84
  }
85
85
  })(t2, e2);
86
86
  }
87
87
  }
88
- function b(t2, e2) {
88
+ function h(t2, e2) {
89
89
  return t2.blockId === e2.removedNode.id ? null : t2;
90
90
  }
91
- function h(t2, e2, o2, n2) {
91
+ function m(t2, e2, o2, n2) {
92
92
  return t2 <= e2 ? t2 : t2 >= o2 ? t2 - n2 : e2;
93
93
  }
94
- function m(t2, e2, o2, n2) {
94
+ function y(t2, e2, o2, n2) {
95
95
  return { type: "inline", blockId: t2, from: e2, to: o2, attrs: n2 };
96
96
  }
97
- function y(t2, e2) {
97
+ function B(t2, e2) {
98
98
  return { type: "node", blockId: t2, attrs: e2 };
99
99
  }
100
- function B(t2, e2, o2, n2) {
100
+ function C(t2, e2, o2, n2) {
101
101
  return { type: "widget", blockId: t2, offset: e2, toDOM: o2, side: n2?.side ?? -1, key: n2?.key };
102
102
  }
103
- class C {
103
+ class I {
104
104
  constructor(t2) {
105
105
  this.byBlock = t2;
106
106
  }
107
- static empty = new C(/* @__PURE__ */ new Map());
107
+ static empty = new I(/* @__PURE__ */ new Map());
108
108
  static create(t2) {
109
- if (0 === t2.length) return C.empty;
109
+ if (0 === t2.length) return I.empty;
110
110
  const e2 = /* @__PURE__ */ new Map();
111
111
  for (const o2 of t2) {
112
112
  const t3 = e2.get(o2.blockId);
113
113
  t3 ? t3.push(o2) : e2.set(o2.blockId, [o2]);
114
114
  }
115
- return new C(e2);
115
+ return new I(e2);
116
116
  }
117
117
  find(t2) {
118
118
  return this.byBlock.get(t2) ?? [];
@@ -131,14 +131,14 @@ class C {
131
131
  }
132
132
  add(t2) {
133
133
  if (0 === t2.length) return this;
134
- if (this.isEmpty) return C.create(t2);
134
+ if (this.isEmpty) return I.create(t2);
135
135
  const e2 = /* @__PURE__ */ new Map();
136
136
  for (const [t3, o2] of this.byBlock) e2.set(t3, [...o2]);
137
137
  for (const o2 of t2) {
138
138
  const t3 = e2.get(o2.blockId);
139
139
  t3 ? t3.push(o2) : e2.set(o2.blockId, [o2]);
140
140
  }
141
- return new C(e2);
141
+ return new I(e2);
142
142
  }
143
143
  remove(t2) {
144
144
  const e2 = /* @__PURE__ */ new Map();
@@ -147,7 +147,7 @@ class C {
147
147
  const r2 = c2.filter((e3) => !t2(e3));
148
148
  r2.length !== c2.length && (o2 = true), r2.length > 0 && e2.set(n2, r2);
149
149
  }
150
- return o2 ? 0 === e2.size ? C.empty : new C(e2) : this;
150
+ return o2 ? 0 === e2.size ? I.empty : new I(e2) : this;
151
151
  }
152
152
  merge(t2) {
153
153
  if (t2.isEmpty) return this;
@@ -158,7 +158,7 @@ class C {
158
158
  const t3 = e2.get(o2);
159
159
  t3 ? t3.push(...n2) : e2.set(o2, [...n2]);
160
160
  }
161
- return new C(e2);
161
+ return new I(e2);
162
162
  }
163
163
  equals(t2) {
164
164
  if (this === t2) return true;
@@ -166,7 +166,7 @@ class C {
166
166
  for (const [e2, o2] of this.byBlock) {
167
167
  const n2 = t2.byBlock.get(e2);
168
168
  if (!n2) return false;
169
- if (!I(o2, n2)) return false;
169
+ if (!x(o2, n2)) return false;
170
170
  }
171
171
  return true;
172
172
  }
@@ -180,35 +180,35 @@ class C {
180
180
  for (const o2 of t2.steps) {
181
181
  const t3 = [];
182
182
  for (const n2 of e2) {
183
- const e3 = p(n2, o2);
183
+ const e3 = b(n2, o2);
184
184
  if (null !== e3) if (Array.isArray(e3)) for (const o3 of e3) t3.push(o3);
185
185
  else t3.push(e3);
186
186
  }
187
187
  e2 = t3;
188
188
  }
189
- return 0 === e2.length ? C.empty : C.create(e2);
189
+ return 0 === e2.length ? I.empty : I.create(e2);
190
190
  }
191
191
  }
192
- function I(t2, e2) {
192
+ function x(t2, e2) {
193
193
  if (t2 === e2) return true;
194
194
  if (t2.length !== e2.length) return false;
195
195
  for (let o2 = 0; o2 < t2.length; o2++) {
196
196
  const n2 = t2[o2], c2 = e2[o2];
197
- if (!n2 || !c2 || !x(n2, c2)) return false;
197
+ if (!n2 || !c2 || !w(n2, c2)) return false;
198
198
  }
199
199
  return true;
200
200
  }
201
- function x(t2, e2) {
201
+ function w(t2, e2) {
202
202
  if (t2.type !== e2.type) return false;
203
203
  if (t2.blockId !== e2.blockId) return false;
204
204
  switch (t2.type) {
205
205
  case "inline": {
206
206
  const o2 = e2;
207
- return t2.from === o2.from && t2.to === o2.to && w(t2.attrs, o2.attrs);
207
+ return t2.from === o2.from && t2.to === o2.to && v(t2.attrs, o2.attrs);
208
208
  }
209
209
  case "node": {
210
210
  const o2 = e2;
211
- return w(t2.attrs, o2.attrs);
211
+ return v(t2.attrs, o2.attrs);
212
212
  }
213
213
  case "widget": {
214
214
  const o2 = e2;
@@ -216,41 +216,41 @@ function x(t2, e2) {
216
216
  }
217
217
  }
218
218
  }
219
- function w(t2, e2) {
219
+ function v(t2, e2) {
220
220
  if (t2 === e2) return true;
221
221
  const o2 = Object.keys(t2), n2 = Object.keys(e2);
222
222
  if (o2.length !== n2.length) return false;
223
223
  for (const n3 of o2) if (t2[n3] !== e2[n3]) return false;
224
224
  return true;
225
225
  }
226
- function v(t2, e2) {
226
+ function _(t2, e2) {
227
227
  const o2 = t2.getState();
228
- if (a(o2.selection)) return false;
228
+ if (a(o2.selection) || d(o2.selection)) return false;
229
229
  const n2 = o2.selection, c2 = o2.getBlock(n2.anchor.blockId);
230
230
  return !(!c2 || "code_block" !== c2.type) && e2({ state: o2, block: c2, blockId: n2.anchor.blockId, offset: n2.anchor.offset });
231
231
  }
232
- function _(t2) {
233
- return v(t2, ({ state: e2, blockId: o2 }) => {
232
+ function S(t2) {
233
+ return _(t2, ({ state: e2, blockId: o2 }) => {
234
234
  const n2 = e2.getBlockOrder(), c2 = n2.indexOf(o2);
235
235
  if (c2 < n2.length - 1) {
236
- const o3 = n2[c2 + 1], r2 = e2.transaction("command").setSelection(u(o3, 0)).build();
236
+ const o3 = n2[c2 + 1], r2 = e2.transaction("command").setSelection(f(o3, 0)).build();
237
237
  t2.dispatch(r2);
238
- } else S(t2, o2);
238
+ } else A(t2, o2);
239
239
  return true;
240
240
  });
241
241
  }
242
- function S(t2, e2) {
242
+ function A(t2, e2) {
243
243
  const n2 = t2.getState(), r2 = n2.getBlock(e2);
244
244
  if (!r2) return;
245
- const l2 = o(r2), s2 = c(), i2 = n2.transaction("command").splitBlock(e2, l2, s2).setBlockType(s2, f("paragraph")).setSelection(u(s2, 0)).build();
245
+ const l2 = o(r2), s2 = c(), i2 = n2.transaction("command").splitBlock(e2, l2, s2).setBlockType(s2, k("paragraph")).setSelection(f(s2, 0)).build();
246
246
  t2.dispatch(i2);
247
247
  }
248
- function A(t2, e2) {
248
+ function T(t2, e2) {
249
249
  const n2 = t2.getState(), c2 = n2.selection;
250
- if (a(c2)) return false;
250
+ if (a(c2) || d(c2)) return false;
251
251
  const s2 = n2.getBlock(c2.anchor.blockId);
252
252
  if (!s2 || "code_block" === s2.type) return false;
253
- const i2 = { language: e2.defaultLanguage ?? "", backgroundColor: "" }, d2 = n2.transaction("command");
253
+ const i2 = { language: e2.defaultLanguage ?? "", backgroundColor: "" }, u2 = n2.transaction("command");
254
254
  return (function(t3, e3) {
255
255
  if (0 === o(e3)) return;
256
256
  const n3 = r(e3);
@@ -259,10 +259,10 @@ function A(t2, e2) {
259
259
  if (o2.text.length > 0) for (const n4 of o2.marks) t3.removeMark(e3.id, c3, c3 + o2.text.length, n4);
260
260
  c3 += o2.text.length;
261
261
  } else c3 += 1;
262
- })(d2, s2), d2.setBlockType(c2.anchor.blockId, f("code_block"), i2).setSelection(u(c2.anchor.blockId, 0)), t2.dispatch(d2.build()), true;
262
+ })(u2, s2), u2.setBlockType(c2.anchor.blockId, k("code_block"), i2).setSelection(f(c2.anchor.blockId, 0)), t2.dispatch(u2.build()), true;
263
263
  }
264
- const T = { label: "Code Block", tooltip: (t2) => t2 ? `Code Block (${t2})` : "Code Block", enteredCodeBlock: "Entered code block. Press Escape to exit.", leftCodeBlock: "Left code block." }, M = { en: T, de: { label: "Codeblock", tooltip: (t2) => t2 ? `Codeblock (${t2})` : "Codeblock", enteredCodeBlock: "Codeblock betreten. Escape zum Verlassen drücken.", leftCodeBlock: "Codeblock verlassen." }, es: { label: "Bloque de código", tooltip: (t2) => t2 ? `Bloque de código (${t2})` : "Bloque de código", enteredCodeBlock: "Bloque de código activado. Pulse Escape para salir.", leftCodeBlock: "Bloque de código desactivado." }, fr: { label: "Bloc de code", tooltip: (t2) => t2 ? `Bloc de code (${t2})` : "Bloc de code", enteredCodeBlock: "Bloc de code activé. Appuyez sur Échap pour quitter.", leftCodeBlock: "Bloc de code quitté." }, zh: { label: "代码块", tooltip: (t2) => t2 ? `代码块 (${t2})` : "代码块", enteredCodeBlock: "已进入代码块。按 Escape 退出。", leftCodeBlock: "已离开代码块。" }, ru: { label: "Блок кода", tooltip: (t2) => t2 ? `Блок кода (${t2})` : "Блок кода", enteredCodeBlock: "Вход в блок кода. Нажмите Escape для выхода.", leftCodeBlock: "Выход из блока кода." }, ar: { label: "كتلة كود", tooltip: (t2) => t2 ? `كتلة كود (${t2})` : "كتلة كود", enteredCodeBlock: "تم الدخول إلى كتلة الكود. اضغط Escape للخروج.", leftCodeBlock: "تم الخروج من كتلة الكود." }, hi: { label: "कोड ब्लॉक", tooltip: (t2) => t2 ? `कोड ब्लॉक (${t2})` : "कोड ब्लॉक", enteredCodeBlock: "कोड ब्लॉक में प्रवेश किया। बाहर निकलने के लिए Escape दबाएँ।", leftCodeBlock: "कोड ब्लॉक से बाहर।" } }, N = { insertAfter: "Mod-Enter", toggle: "Mod-Shift-M" }, E = { defaultLanguage: "", useSpaces: false, spaceCount: 2, showCopyButton: true }, L = new t("codeBlock");
265
- function O(t2, e2, o2, n2) {
264
+ const M = { label: "Code Block", tooltip: (t2) => t2 ? `Code Block (${t2})` : "Code Block", enteredCodeBlock: "Entered code block. Press Escape to exit.", leftCodeBlock: "Left code block." }, N = { en: M, de: { label: "Codeblock", tooltip: (t2) => t2 ? `Codeblock (${t2})` : "Codeblock", enteredCodeBlock: "Codeblock betreten. Escape zum Verlassen drücken.", leftCodeBlock: "Codeblock verlassen." }, es: { label: "Bloque de código", tooltip: (t2) => t2 ? `Bloque de código (${t2})` : "Bloque de código", enteredCodeBlock: "Bloque de código activado. Pulse Escape para salir.", leftCodeBlock: "Bloque de código desactivado." }, fr: { label: "Bloc de code", tooltip: (t2) => t2 ? `Bloc de code (${t2})` : "Bloc de code", enteredCodeBlock: "Bloc de code activé. Appuyez sur Échap pour quitter.", leftCodeBlock: "Bloc de code quitté." }, zh: { label: "代码块", tooltip: (t2) => t2 ? `代码块 (${t2})` : "代码块", enteredCodeBlock: "已进入代码块。按 Escape 退出。", leftCodeBlock: "已离开代码块。" }, ru: { label: "Блок кода", tooltip: (t2) => t2 ? `Блок кода (${t2})` : "Блок кода", enteredCodeBlock: "Вход в блок кода. Нажмите Escape для выхода.", leftCodeBlock: "Выход из блока кода." }, ar: { label: "كتلة كود", tooltip: (t2) => t2 ? `كتلة كود (${t2})` : "كتلة كود", enteredCodeBlock: "تم الدخول إلى كتلة الكود. اضغط Escape للخروج.", leftCodeBlock: "تم الخروج من كتلة الكود." }, hi: { label: "कोड ब्लॉक", tooltip: (t2) => t2 ? `कोड ब्लॉक (${t2})` : "कोड ब्लॉक", enteredCodeBlock: "कोड ब्लॉक में प्रवेश किया। बाहर निकलने के लिए Escape दबाएँ।", leftCodeBlock: "कोड ब्लॉक से बाहर।" } }, E = { insertAfter: "Mod-Enter", toggle: "Mod-Shift-M" }, L = { defaultLanguage: "", useSpaces: false, spaceCount: 2, showCopyButton: true }, O = new t("codeBlock");
265
+ function z(t2, e2, o2, n2) {
266
266
  const c2 = t2.getState(), r2 = c2.getBlock(e2);
267
267
  if (!r2 || "code_block" !== r2.type) return;
268
268
  const l2 = g(c2.doc, e2);
@@ -270,7 +270,7 @@ function O(t2, e2, o2, n2) {
270
270
  const s2 = { ...r2.attrs, [o2]: n2 }, i2 = c2.transaction("command").setNodeAttr(l2, s2).build();
271
271
  t2.dispatch(i2);
272
272
  }
273
- class z {
273
+ class $ {
274
274
  id = "code-block";
275
275
  name = "Code Block";
276
276
  priority = 36;
@@ -279,119 +279,119 @@ class z {
279
279
  context = null;
280
280
  locale;
281
281
  constructor(t2) {
282
- this.config = { ...E, ...t2 }, this.resolvedKeymap = { ...N, ...t2?.keymap };
282
+ this.config = { ...L, ...t2 }, this.resolvedKeymap = { ...E, ...t2?.keymap };
283
283
  }
284
284
  init(t2) {
285
- this.locale = e(M, t2, this.config.locale), t2.registerStyleSheet("\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n position: relative;\n margin: 8px 0;\n border-radius: 6px;\n background: var(--notectl-code-block-bg);\n color: var(--notectl-code-block-color);\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n font-size: 14px;\n line-height: 1.5;\n overflow: hidden;\n}\n\n.notectl-code-block__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 6px 12px;\n background: var(--notectl-code-block-header-bg);\n border-bottom: 1px solid var(--notectl-code-block-header-border);\n font-size: 12px;\n color: var(--notectl-code-block-header-color);\n user-select: none;\n}\n\n.notectl-code-block__language {\n font-weight: 500;\n letter-spacing: 0.02em;\n}\n\n.notectl-code-block__copy {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n border: none;\n border-radius: 4px;\n background: transparent;\n color: var(--notectl-code-block-header-color);\n cursor: pointer;\n padding: 0;\n transition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover {\n background: rgba(128, 128, 128, 0.15);\n color: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg {\n fill: currentColor;\n}\n\n.notectl-code-block__content {\n display: block;\n padding: 12px 16px;\n white-space: pre-wrap;\n word-wrap: break-word;\n tab-size: 4;\n -moz-tab-size: 4;\n outline: none;\n min-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n display: none;\n position: absolute;\n bottom: 4px;\n right: 8px;\n font-size: 11px;\n color: var(--notectl-code-block-header-color);\n opacity: 0.5;\n pointer-events: none;\n user-select: none;\n font-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n display: block;\n}\n"), this.context = t2, this.registerNodeSpec(t2), this.registerNodeView(t2), (function(t3, e2) {
285
+ this.locale = e(N, t2, this.config.locale), t2.registerStyleSheet("\n/* Code Block — uses theme custom properties */\n.notectl-code-block {\n position: relative;\n margin: 8px 0;\n border-radius: 6px;\n background: var(--notectl-code-block-bg);\n color: var(--notectl-code-block-color);\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;\n font-size: 14px;\n line-height: 1.5;\n overflow: hidden;\n}\n\n.notectl-code-block__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 6px 12px;\n background: var(--notectl-code-block-header-bg);\n border-bottom: 1px solid var(--notectl-code-block-header-border);\n font-size: 12px;\n color: var(--notectl-code-block-header-color);\n user-select: none;\n}\n\n.notectl-code-block__language {\n font-weight: 500;\n letter-spacing: 0.02em;\n}\n\n.notectl-code-block__copy {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n border: none;\n border-radius: 4px;\n background: transparent;\n color: var(--notectl-code-block-header-color);\n cursor: pointer;\n padding: 0;\n transition: background 0.15s, color 0.15s;\n}\n\n.notectl-code-block__copy:hover {\n background: rgba(128, 128, 128, 0.15);\n color: var(--notectl-code-block-color);\n}\n\n.notectl-code-block__copy svg {\n fill: currentColor;\n}\n\n.notectl-code-block__content {\n display: block;\n padding: 12px 16px;\n white-space: pre-wrap;\n word-wrap: break-word;\n tab-size: 4;\n -moz-tab-size: 4;\n outline: none;\n min-height: 1.5em;\n}\n\n.notectl-code-block--selected {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n}\n\n.notectl-code-block__esc-hint {\n display: none;\n position: absolute;\n bottom: 4px;\n right: 8px;\n font-size: 11px;\n color: var(--notectl-code-block-header-color);\n opacity: 0.5;\n pointer-events: none;\n user-select: none;\n font-family: system-ui, sans-serif;\n}\n\n.notectl-code-block--focused .notectl-code-block__esc-hint {\n display: block;\n}\n"), this.context = t2, this.registerNodeSpec(t2), this.registerNodeView(t2), (function(t3, e2) {
286
286
  t3.registerCommand("toggleCodeBlock", () => (function(t4, e3) {
287
287
  const o2 = t4.getState();
288
- if (a(o2.selection)) return false;
288
+ if (a(o2.selection) || d(o2.selection)) return false;
289
289
  const n2 = o2.getBlock(o2.selection.anchor.blockId);
290
290
  if (!n2) return false;
291
291
  if ("code_block" === n2.type) {
292
- const e4 = o2.transaction("command").setBlockType(o2.selection.anchor.blockId, f("paragraph")).setSelection(o2.selection).build();
292
+ const e4 = o2.transaction("command").setBlockType(o2.selection.anchor.blockId, k("paragraph")).setSelection(o2.selection).build();
293
293
  return t4.dispatch(e4), true;
294
294
  }
295
- return A(t4, e3);
296
- })(t3, e2)), t3.registerCommand("insertCodeBlock", () => A(t3, e2)), t3.registerCommand("setCodeBlockLanguage", () => false), t3.registerCommand("setCodeBlockBackground", () => false), t3.registerCommand("exitCodeBlock", () => _(t3));
295
+ return T(t4, e3);
296
+ })(t3, e2)), t3.registerCommand("insertCodeBlock", () => T(t3, e2)), t3.registerCommand("setCodeBlockLanguage", () => false), t3.registerCommand("setCodeBlockBackground", () => false), t3.registerCommand("exitCodeBlock", () => S(t3));
297
297
  })(t2, this.config), (function(t3, e2, r2) {
298
298
  const l2 = { Enter: () => (function(t4) {
299
- return v(t4, ({ state: e3, block: o2, blockId: r3, offset: l3 }) => {
300
- if (!d(e3.selection)) return false;
299
+ return _(t4, ({ state: e3, block: o2, blockId: r3, offset: l3 }) => {
300
+ if (!u(e3.selection)) return false;
301
301
  const s3 = n(o2);
302
302
  if (s3.endsWith("\n") && l3 === s3.length) return (function(t5, e4, o3) {
303
- const n2 = t5.getState(), r4 = o3.length - 1, l4 = c(), s4 = n2.transaction("input").deleteTextAt(e4, r4, o3.length).splitBlock(e4, r4, l4).setBlockType(l4, f("paragraph")).setSelection(u(l4, 0)).build();
303
+ const n2 = t5.getState(), r4 = o3.length - 1, l4 = c(), s4 = n2.transaction("input").deleteTextAt(e4, r4, o3.length).splitBlock(e4, r4, l4).setBlockType(l4, k("paragraph")).setSelection(f(l4, 0)).build();
304
304
  return t5.dispatch(s4), true;
305
305
  })(t4, r3, s3);
306
- const i3 = e3.transaction("input").insertText(r3, l3, "\n", []).setSelection(u(r3, l3 + 1)).build();
306
+ const i3 = e3.transaction("input").insertText(r3, l3, "\n", []).setSelection(f(r3, l3 + 1)).build();
307
307
  return t4.dispatch(i3), true;
308
308
  });
309
309
  })(t3), Backspace: () => (function(t4) {
310
- return v(t4, ({ state: e3, blockId: o2, offset: n2 }) => {
311
- if (!d(e3.selection)) return false;
310
+ return _(t4, ({ state: e3, blockId: o2, offset: n2 }) => {
311
+ if (!u(e3.selection)) return false;
312
312
  if (0 !== n2) return false;
313
- const c2 = e3.transaction("input").setBlockType(o2, f("paragraph")).setSelection(e3.selection).build();
313
+ const c2 = e3.transaction("input").setBlockType(o2, k("paragraph")).setSelection(e3.selection).build();
314
314
  return t4.dispatch(c2), true;
315
315
  });
316
316
  })(t3), Tab: () => (function(t4, e3) {
317
- return v(t4, ({ state: o2, blockId: n2, offset: c2 }) => {
318
- const r3 = e3.useSpaces ? " ".repeat(e3.spaceCount ?? 2) : " ", l3 = o2.transaction("input").insertText(n2, c2, r3, []).setSelection(u(n2, c2 + r3.length)).build();
317
+ return _(t4, ({ state: o2, blockId: n2, offset: c2 }) => {
318
+ const r3 = e3.useSpaces ? " ".repeat(e3.spaceCount ?? 2) : " ", l3 = o2.transaction("input").insertText(n2, c2, r3, []).setSelection(f(n2, c2 + r3.length)).build();
319
319
  return t4.dispatch(l3), true;
320
320
  });
321
321
  })(t3, e2), "Shift-Tab": () => (function(t4, e3) {
322
- return v(t4, ({ state: o2, block: c2, blockId: r3, offset: l3 }) => {
322
+ return _(t4, ({ state: o2, block: c2, blockId: r3, offset: l3 }) => {
323
323
  const s3 = n(c2), i3 = s3.lastIndexOf("\n", l3 - 1) + 1;
324
324
  if (e3.useSpaces) {
325
325
  const n2 = e3.spaceCount ?? 2;
326
326
  if (s3.slice(i3, i3 + n2) === " ".repeat(n2)) {
327
- const e4 = o2.transaction("input").deleteTextAt(r3, i3, i3 + n2).setSelection(u(r3, Math.max(i3, l3 - n2))).build();
327
+ const e4 = o2.transaction("input").deleteTextAt(r3, i3, i3 + n2).setSelection(f(r3, Math.max(i3, l3 - n2))).build();
328
328
  return t4.dispatch(e4), true;
329
329
  }
330
330
  } else if (" " === s3[i3]) {
331
- const e4 = o2.transaction("input").deleteTextAt(r3, i3, i3 + 1).setSelection(u(r3, Math.max(i3, l3 - 1))).build();
331
+ const e4 = o2.transaction("input").deleteTextAt(r3, i3, i3 + 1).setSelection(f(r3, Math.max(i3, l3 - 1))).build();
332
332
  return t4.dispatch(e4), true;
333
333
  }
334
334
  return true;
335
335
  });
336
- })(t3, e2), Escape: () => _(t3), ArrowDown: () => (function(t4) {
337
- return v(t4, ({ state: e3, block: o2, blockId: c2, offset: r3 }) => {
338
- if (!d(e3.selection)) return false;
336
+ })(t3, e2), Escape: () => S(t3), ArrowDown: () => (function(t4) {
337
+ return _(t4, ({ state: e3, block: o2, blockId: c2, offset: r3 }) => {
338
+ if (!u(e3.selection)) return false;
339
339
  if (-1 !== n(o2).indexOf("\n", r3)) return false;
340
340
  const l3 = e3.getBlockOrder(), s3 = l3.indexOf(c2);
341
341
  if (s3 < l3.length - 1) {
342
- const o3 = l3[s3 + 1], n2 = e3.transaction("command").setSelection(u(o3, 0)).build();
342
+ const o3 = l3[s3 + 1], n2 = e3.transaction("command").setSelection(f(o3, 0)).build();
343
343
  t4.dispatch(n2);
344
- } else S(t4, c2);
344
+ } else A(t4, c2);
345
345
  return true;
346
346
  });
347
347
  })(t3), ArrowUp: () => (function(t4) {
348
- return v(t4, ({ state: e3, block: c2, blockId: r3, offset: l3 }) => {
349
- if (!d(e3.selection)) return false;
348
+ return _(t4, ({ state: e3, block: c2, blockId: r3, offset: l3 }) => {
349
+ if (!u(e3.selection)) return false;
350
350
  const s3 = n(c2).indexOf("\n");
351
351
  if (-1 !== s3 && l3 > s3) return false;
352
352
  const i3 = e3.getBlockOrder(), a2 = i3.indexOf(r3);
353
353
  if (a2 > 0) {
354
- const n2 = i3[a2 - 1], c3 = e3.getBlock(n2), r4 = c3 ? o(c3) : 0, l4 = e3.transaction("command").setSelection(u(n2, r4)).build();
354
+ const n2 = i3[a2 - 1], c3 = e3.getBlock(n2), r4 = c3 ? o(c3) : 0, l4 = e3.transaction("command").setSelection(f(n2, r4)).build();
355
355
  return t4.dispatch(l4), true;
356
356
  }
357
357
  return false;
358
358
  });
359
359
  })(t3), ArrowRight: () => (function(t4) {
360
- return v(t4, ({ state: e3, block: o2, blockId: c2, offset: r3 }) => {
361
- if (!d(e3.selection)) return false;
360
+ return _(t4, ({ state: e3, block: o2, blockId: c2, offset: r3 }) => {
361
+ if (!u(e3.selection)) return false;
362
362
  if (r3 !== n(o2).length) return false;
363
363
  const l3 = e3.getBlockOrder(), s3 = l3.indexOf(c2);
364
364
  if (s3 < l3.length - 1) {
365
- const o3 = l3[s3 + 1], n2 = e3.transaction("command").setSelection(u(o3, 0)).build();
365
+ const o3 = l3[s3 + 1], n2 = e3.transaction("command").setSelection(f(o3, 0)).build();
366
366
  t4.dispatch(n2);
367
- } else S(t4, c2);
367
+ } else A(t4, c2);
368
368
  return true;
369
369
  });
370
370
  })(t3), ArrowLeft: () => (function(t4) {
371
- return v(t4, ({ state: e3, blockId: n2, offset: c2 }) => {
372
- if (!d(e3.selection)) return false;
371
+ return _(t4, ({ state: e3, blockId: n2, offset: c2 }) => {
372
+ if (!u(e3.selection)) return false;
373
373
  if (0 !== c2) return false;
374
374
  const r3 = e3.getBlockOrder(), l3 = r3.indexOf(n2);
375
375
  if (l3 > 0) {
376
- const n3 = r3[l3 - 1], c3 = e3.getBlock(n3), s3 = c3 ? o(c3) : 0, i3 = e3.transaction("command").setSelection(u(n3, s3)).build();
376
+ const n3 = r3[l3 - 1], c3 = e3.getBlock(n3), s3 = c3 ? o(c3) : 0, i3 = e3.transaction("command").setSelection(f(n3, s3)).build();
377
377
  return t4.dispatch(i3), true;
378
378
  }
379
379
  return false;
380
380
  });
381
381
  })(t3) }, { insertAfter: s2, toggle: i2 } = r2;
382
382
  s2 && (l2[s2] = () => (function(t4) {
383
- return v(t4, ({ blockId: e3 }) => (S(t4, e3), true));
384
- })(t3)), i2 && (l2[i2] = () => t3.executeCommand("toggleCodeBlock")), t3.registerKeymap(l2);
383
+ return _(t4, ({ blockId: e3 }) => (A(t4, e3), true));
384
+ })(t3)), i2 && (l2[i2] = () => t3.executeCommand("toggleCodeBlock")), t3.registerKeymap(l2, { priority: "context" });
385
385
  })(t2, this.config, this.resolvedKeymap), this.registerInputRule(t2), this.registerToolbarItem(t2), this.registerMiddleware(t2), (function(t3, e2, o2) {
386
- t3.registerService(L, { setLanguage(e3, o3) {
387
- O(t3, e3, "language", o3);
386
+ t3.registerService(O, { setLanguage(e3, o3) {
387
+ z(t3, e3, "language", o3);
388
388
  }, getLanguage(t4) {
389
389
  const e3 = o2();
390
390
  if (!e3) return "";
391
391
  const n2 = e3.getState().getBlock(t4);
392
392
  return n2 && "code_block" === n2.type ? n2.attrs?.language ?? "" : "";
393
393
  }, setBackground(e3, o3) {
394
- O(t3, e3, "backgroundColor", o3);
394
+ z(t3, e3, "backgroundColor", o3);
395
395
  }, getBackground(t4) {
396
396
  const e3 = o2();
397
397
  if (!e3) return "";
@@ -410,11 +410,11 @@ class z {
410
410
  }
411
411
  onStateChange(t2, e2, o2) {
412
412
  if (!this.context) return;
413
- const n2 = a(t2.selection) ? null : t2.selection.anchor.blockId, c2 = a(e2.selection) ? null : e2.selection.anchor.blockId, r2 = n2 ? t2.getBlock(n2) : void 0, l2 = c2 ? e2.getBlock(c2) : void 0, s2 = "code_block" === r2?.type, i2 = "code_block" === l2?.type;
413
+ const n2 = a(t2.selection) || d(t2.selection) ? null : t2.selection.anchor.blockId, c2 = a(e2.selection) || d(e2.selection) ? null : e2.selection.anchor.blockId, r2 = n2 ? t2.getBlock(n2) : void 0, l2 = c2 ? e2.getBlock(c2) : void 0, s2 = "code_block" === r2?.type, i2 = "code_block" === l2?.type;
414
414
  s2 && n2 && this.setBlockFocused(n2, false), i2 && c2 && this.setBlockFocused(c2, true), !s2 && i2 ? this.context.announce(this.locale.enteredCodeBlock) : s2 && !i2 && this.context.announce(this.locale.leftCodeBlock);
415
415
  }
416
416
  decorations(t2) {
417
- if (!this.config.highlighter) return C.empty;
417
+ if (!this.config.highlighter) return I.empty;
418
418
  const e2 = [], o2 = this.config.highlighter;
419
419
  for (const c2 of t2.getBlockOrder()) {
420
420
  const r2 = t2.getBlock(c2);
@@ -424,9 +424,9 @@ class z {
424
424
  const s2 = n(r2);
425
425
  if (!s2) continue;
426
426
  const i2 = o2.tokenize(s2, l2);
427
- for (const t3 of i2) e2.push(m(c2, t3.from, t3.to, { class: `notectl-token--${t3.type}` }));
427
+ for (const t3 of i2) e2.push(y(c2, t3.from, t3.to, { class: `notectl-token--${t3.type}` }));
428
428
  }
429
- return C.create(e2);
429
+ return I.create(e2);
430
430
  }
431
431
  registerNodeSpec(t2) {
432
432
  t2.registerNodeSpec({ type: "code_block", group: "block", content: { allow: ["text"] }, selectable: true, attrs: { language: { default: "" }, backgroundColor: { default: "" } }, toDOM(t3) {
@@ -485,17 +485,17 @@ class z {
485
485
  registerInputRule(t2) {
486
486
  t2.registerInputRule({ pattern: /^```(\w*) $/, handler: (t3, e2, o2, n2) => {
487
487
  const c2 = t3.selection;
488
- if (a(c2)) return null;
489
- if (!d(c2)) return null;
488
+ if (a(c2) || d(c2)) return null;
489
+ if (!u(c2)) return null;
490
490
  const r2 = t3.getBlock(c2.anchor.blockId);
491
491
  if (!r2 || "paragraph" !== r2.type) return null;
492
492
  const l2 = { language: e2[1] ?? "", backgroundColor: "" };
493
- return t3.transaction("input").deleteTextAt(c2.anchor.blockId, o2, o2 + e2[0].length).setBlockType(c2.anchor.blockId, f("code_block"), l2).setSelection(u(c2.anchor.blockId, 0)).build();
493
+ return t3.transaction("input").deleteTextAt(c2.anchor.blockId, o2, o2 + e2[0].length).setBlockType(c2.anchor.blockId, k("code_block"), l2).setSelection(f(c2.anchor.blockId, 0)).build();
494
494
  } });
495
495
  }
496
496
  registerToolbarItem(t2) {
497
- t2.registerToolbarItem({ id: "code_block", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(this.resolvedKeymap.toggle ? k(this.resolvedKeymap.toggle) : void 0), command: "toggleCodeBlock", priority: 56, separatorAfter: this.config.separatorAfter, isActive: (t3) => {
498
- if (a(t3.selection)) return false;
497
+ t2.registerToolbarItem({ id: "code_block", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(this.resolvedKeymap.toggle ? p(this.resolvedKeymap.toggle) : void 0), command: "toggleCodeBlock", priority: 56, separatorAfter: this.config.separatorAfter, isActive: (t3) => {
498
+ if (a(t3.selection) || d(t3.selection)) return false;
499
499
  const e2 = t3.getBlock(t3.selection.anchor.blockId);
500
500
  return "code_block" === e2?.type;
501
501
  } });
@@ -528,14 +528,14 @@ class z {
528
528
  }
529
529
  }
530
530
  export {
531
- M as C,
532
- C as D,
533
- T as a,
534
- L as b,
535
- z as c,
536
- I as d,
537
- m as i,
538
- y as n,
539
- B as w
531
+ N as C,
532
+ I as D,
533
+ M as a,
534
+ O as b,
535
+ $ as c,
536
+ x as d,
537
+ y as i,
538
+ B as n,
539
+ C as w
540
540
  };
541
- //# sourceMappingURL=index-DGrRWMlW.mjs.map
541
+ //# sourceMappingURL=index-CPyHuEzh.mjs.map