quoin-editor 1.0.0 → 1.0.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 (209) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/ai.cjs +135 -94
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.d.cts +1 -1
  5. package/dist/ai.d.ts +1 -1
  6. package/dist/ai.js +62 -21
  7. package/dist/ai.js.map +1 -1
  8. package/dist/catalogue.cjs +25 -25
  9. package/dist/catalogue.d.cts +6 -6
  10. package/dist/catalogue.d.ts +6 -6
  11. package/dist/catalogue.js +17 -17
  12. package/dist/{chunk-MQ2XQ4MX.js → chunk-26Q4LSIU.js} +6 -6
  13. package/dist/chunk-26Q4LSIU.js.map +1 -0
  14. package/dist/{chunk-AEJXZBVR.cjs → chunk-56C7GCKO.cjs} +110 -103
  15. package/dist/chunk-56C7GCKO.cjs.map +1 -0
  16. package/dist/{chunk-GTTPVJSD.cjs → chunk-5M4QG3ZC.cjs} +262 -245
  17. package/dist/chunk-5M4QG3ZC.cjs.map +1 -0
  18. package/dist/{chunk-2VDK27IF.cjs → chunk-5R3ISX4A.cjs} +312 -335
  19. package/dist/chunk-5R3ISX4A.cjs.map +1 -0
  20. package/dist/{chunk-LCQSG4M6.js → chunk-62WKUAQY.js} +18 -18
  21. package/dist/{chunk-LCQSG4M6.js.map → chunk-62WKUAQY.js.map} +1 -1
  22. package/dist/{chunk-NOKWNK2O.js → chunk-6LMS5J3Y.js} +3 -2
  23. package/dist/{chunk-HELJTLNC.cjs → chunk-6PKVJZQV.cjs} +12 -12
  24. package/dist/chunk-6PKVJZQV.cjs.map +1 -0
  25. package/dist/chunk-6YSGUAVW.js +376 -0
  26. package/dist/chunk-6YSGUAVW.js.map +1 -0
  27. package/dist/{chunk-CDELOHDY.cjs → chunk-75C6PX2L.cjs} +23 -23
  28. package/dist/{chunk-CDELOHDY.cjs.map → chunk-75C6PX2L.cjs.map} +1 -1
  29. package/dist/{chunk-T7SW6OWV.js → chunk-A4IJSJKL.js} +5 -5
  30. package/dist/{chunk-ND5XJVK2.cjs → chunk-BTBHHBVR.cjs} +19 -19
  31. package/dist/{chunk-ND5XJVK2.cjs.map → chunk-BTBHHBVR.cjs.map} +1 -1
  32. package/dist/{chunk-WXMYDXPN.cjs → chunk-CLTHD5GO.cjs} +4 -3
  33. package/dist/chunk-CLTHD5GO.cjs.map +1 -0
  34. package/dist/{chunk-OMOBMXD5.cjs → chunk-EH5KXQXY.cjs} +7 -2
  35. package/dist/chunk-EH5KXQXY.cjs.map +1 -0
  36. package/dist/{chunk-WQHV3MRE.cjs → chunk-ESMAW4NK.cjs} +12 -12
  37. package/dist/{chunk-WQHV3MRE.cjs.map → chunk-ESMAW4NK.cjs.map} +1 -1
  38. package/dist/{chunk-SLVDAHHK.cjs → chunk-EYFCOV3T.cjs} +5 -5
  39. package/dist/{chunk-SLVDAHHK.cjs.map → chunk-EYFCOV3T.cjs.map} +1 -1
  40. package/dist/{chunk-5DNCCN6X.cjs → chunk-F5V3IEEE.cjs} +27 -27
  41. package/dist/{chunk-5DNCCN6X.cjs.map → chunk-F5V3IEEE.cjs.map} +1 -1
  42. package/dist/{chunk-PMWCQSQX.js → chunk-GPIDU3GN.js} +5 -5
  43. package/dist/{chunk-PZ4GT5JO.cjs → chunk-HOIDJEVI.cjs} +316 -300
  44. package/dist/chunk-HOIDJEVI.cjs.map +1 -0
  45. package/dist/{chunk-RDG4VI6E.cjs → chunk-JJ3RASQS.cjs} +90 -90
  46. package/dist/{chunk-RDG4VI6E.cjs.map → chunk-JJ3RASQS.cjs.map} +1 -1
  47. package/dist/{chunk-ZGZEJCRV.js → chunk-LE3F7WIP.js} +23 -46
  48. package/dist/chunk-LE3F7WIP.js.map +1 -0
  49. package/dist/chunk-LE5XMIFJ.cjs +14 -0
  50. package/dist/chunk-LE5XMIFJ.cjs.map +1 -0
  51. package/dist/{chunk-POBM7MGR.js → chunk-LMAEPFTX.js} +2 -2
  52. package/dist/{chunk-ZHOSSWUM.js → chunk-LV6EYPJO.js} +4 -3
  53. package/dist/chunk-LV6EYPJO.js.map +1 -0
  54. package/dist/chunk-MLRAVUFG.cjs +376 -0
  55. package/dist/chunk-MLRAVUFG.cjs.map +1 -0
  56. package/dist/chunk-MQUCCSWG.js +14 -0
  57. package/dist/chunk-MQUCCSWG.js.map +1 -0
  58. package/dist/{chunk-XEBWC7ZL.js → chunk-O4Z2WMFF.js} +7 -2
  59. package/dist/chunk-O4Z2WMFF.js.map +1 -0
  60. package/dist/{chunk-K574XHMM.js → chunk-OCCKQHCY.js} +2 -2
  61. package/dist/{chunk-SG37UBDO.js → chunk-PGSS4IOS.js} +7 -7
  62. package/dist/{chunk-RUDWMKYX.js → chunk-PIWRSX7U.js} +8 -8
  63. package/dist/{chunk-PWUEPDA3.cjs → chunk-PX6LZMH4.cjs} +44 -44
  64. package/dist/{chunk-PWUEPDA3.cjs.map → chunk-PX6LZMH4.cjs.map} +1 -1
  65. package/dist/{chunk-JDPTZUBW.js → chunk-QXG3HWDS.js} +4 -4
  66. package/dist/{chunk-NNDYYEW5.js → chunk-RQW3P3GH.js} +5 -5
  67. package/dist/{chunk-ZS2WA357.js → chunk-SSIRYUCK.js} +144 -127
  68. package/dist/chunk-SSIRYUCK.js.map +1 -0
  69. package/dist/{chunk-47MLKSI2.js → chunk-UBNG5YCG.js} +6 -6
  70. package/dist/{chunk-KXOBZGQO.js → chunk-UCXLRRWY.js} +21 -14
  71. package/dist/chunk-UCXLRRWY.js.map +1 -0
  72. package/dist/{chunk-EL2OEJQC.cjs → chunk-UDAVVEFC.cjs} +56 -56
  73. package/dist/{chunk-EL2OEJQC.cjs.map → chunk-UDAVVEFC.cjs.map} +1 -1
  74. package/dist/{chunk-HJIQT3S5.js → chunk-UPSLDTLT.js} +100 -84
  75. package/dist/chunk-UPSLDTLT.js.map +1 -0
  76. package/dist/{chunk-GLLXHMH2.cjs → chunk-UWNZG2SD.cjs} +3 -3
  77. package/dist/{chunk-GLLXHMH2.cjs.map → chunk-UWNZG2SD.cjs.map} +1 -1
  78. package/dist/{chunk-HZSSEYJS.cjs → chunk-V3KLMSRO.cjs} +30 -30
  79. package/dist/{chunk-HZSSEYJS.cjs.map → chunk-V3KLMSRO.cjs.map} +1 -1
  80. package/dist/{chunk-ZC24WB7Y.cjs → chunk-VACTAZWS.cjs} +14 -14
  81. package/dist/{chunk-ZC24WB7Y.cjs.map → chunk-VACTAZWS.cjs.map} +1 -1
  82. package/dist/{chunk-KAVU6T6J.js → chunk-WMN6566P.js} +5 -5
  83. package/dist/{chunk-2QCRZ7OL.cjs → chunk-XX5FTPJR.cjs} +12 -11
  84. package/dist/{chunk-2QCRZ7OL.cjs.map → chunk-XX5FTPJR.cjs.map} +1 -1
  85. package/dist/comments.cjs +113 -98
  86. package/dist/comments.cjs.map +1 -1
  87. package/dist/comments.d.cts +6 -1
  88. package/dist/comments.d.ts +6 -1
  89. package/dist/comments.js +32 -17
  90. package/dist/comments.js.map +1 -1
  91. package/dist/diff.cjs +43 -40
  92. package/dist/diff.cjs.map +1 -1
  93. package/dist/diff.js +16 -13
  94. package/dist/diff.js.map +1 -1
  95. package/dist/docx.cjs +60 -40
  96. package/dist/docx.cjs.map +1 -1
  97. package/dist/docx.d.cts +6 -0
  98. package/dist/docx.d.ts +6 -0
  99. package/dist/docx.js +32 -12
  100. package/dist/docx.js.map +1 -1
  101. package/dist/embed.cjs +9 -9
  102. package/dist/embed.d.cts +1 -1
  103. package/dist/embed.d.ts +1 -1
  104. package/dist/embed.js +8 -8
  105. package/dist/{emoji-extension-DpQ43HjE.d.ts → emoji-extension-CmPlRssm.d.ts} +1 -1
  106. package/dist/{emoji-extension-C12gDPm6.d.cts → emoji-extension-zJ6F7hW8.d.cts} +1 -1
  107. package/dist/emoji.cjs +8 -8
  108. package/dist/emoji.d.cts +3 -3
  109. package/dist/emoji.d.ts +3 -3
  110. package/dist/emoji.js +7 -7
  111. package/dist/engine.cjs +4 -4
  112. package/dist/engine.d.cts +2 -2
  113. package/dist/engine.d.ts +2 -2
  114. package/dist/engine.js +3 -3
  115. package/dist/{find-extension-_sbZEt3R.d.cts → find-extension-BcRyE9K4.d.cts} +1 -1
  116. package/dist/{find-extension-DKqLLSuP.d.ts → find-extension-CmFehyul.d.ts} +1 -1
  117. package/dist/find.cjs +8 -8
  118. package/dist/find.d.cts +2 -2
  119. package/dist/find.d.ts +2 -2
  120. package/dist/find.js +7 -7
  121. package/dist/headless.cjs +5 -5
  122. package/dist/headless.d.cts +4 -4
  123. package/dist/headless.d.ts +4 -4
  124. package/dist/headless.js +4 -4
  125. package/dist/{index-CgD72kHB.d.cts → index-CFPmCee4.d.cts} +5 -2
  126. package/dist/{index-DNYbTK3w.d.ts → index-DiCGV60d.d.ts} +5 -2
  127. package/dist/index.cjs +7 -7
  128. package/dist/index.d.cts +4 -4
  129. package/dist/index.d.ts +4 -4
  130. package/dist/index.js +6 -6
  131. package/dist/math.cjs +10 -10
  132. package/dist/math.d.cts +1 -1
  133. package/dist/math.d.ts +1 -1
  134. package/dist/math.js +9 -9
  135. package/dist/mention.cjs +10 -10
  136. package/dist/mention.d.cts +1 -1
  137. package/dist/mention.d.ts +1 -1
  138. package/dist/mention.js +9 -9
  139. package/dist/presence.cjs +96 -99
  140. package/dist/presence.cjs.map +1 -1
  141. package/dist/presence.d.cts +2 -2
  142. package/dist/presence.d.ts +2 -2
  143. package/dist/presence.js +64 -67
  144. package/dist/presence.js.map +1 -1
  145. package/dist/{stats-extension-Bly88uio.d.ts → stats-extension-DisOEbbI.d.ts} +1 -1
  146. package/dist/{stats-extension-CJPijvUb.d.cts → stats-extension-Dt1lgP3m.d.cts} +1 -1
  147. package/dist/stats.cjs +9 -9
  148. package/dist/stats.d.cts +3 -3
  149. package/dist/stats.d.ts +3 -3
  150. package/dist/stats.js +8 -8
  151. package/dist/styles.css +1 -1
  152. package/dist/{table-extension-Dzf4k6hI.d.ts → table-extension-BTMJnT7J.d.ts} +1 -1
  153. package/dist/{table-extension-BTLxFy2S.d.cts → table-extension-DxZz3jqp.d.cts} +1 -1
  154. package/dist/table.cjs +8 -8
  155. package/dist/table.d.cts +2 -2
  156. package/dist/table.d.ts +2 -2
  157. package/dist/table.js +7 -7
  158. package/dist/{toc-extension-DWm5alVj.d.ts → toc-extension-CR9U-l6j.d.ts} +1 -1
  159. package/dist/{toc-extension-B3-s6h2x.d.cts → toc-extension-DGHywOBv.d.cts} +1 -1
  160. package/dist/toc.cjs +8 -8
  161. package/dist/toc.d.cts +2 -2
  162. package/dist/toc.d.ts +2 -2
  163. package/dist/toc.js +7 -7
  164. package/dist/{types-a1CRBlEh.d.ts → types-C6_QkXzy.d.ts} +1 -9
  165. package/dist/{types-Cz7XJLaK.d.cts → types-CJ7Gq3GX.d.cts} +1 -9
  166. package/dist/{view-controller-DSHw0ltQ.d.cts → view-controller-BD1KwYfE.d.cts} +6 -19
  167. package/dist/{view-controller-UbpzblGl.d.ts → view-controller-y4cb60ue.d.ts} +6 -19
  168. package/dist/view.cjs +6 -6
  169. package/dist/view.js +3 -3
  170. package/dist/yjs.cjs +234 -396
  171. package/dist/yjs.cjs.map +1 -1
  172. package/dist/yjs.d.cts +3 -3
  173. package/dist/yjs.d.ts +3 -3
  174. package/dist/yjs.js +126 -288
  175. package/dist/yjs.js.map +1 -1
  176. package/package.json +1 -1
  177. package/dist/chunk-2VDK27IF.cjs.map +0 -1
  178. package/dist/chunk-AEJXZBVR.cjs.map +0 -1
  179. package/dist/chunk-E75EHRPA.cjs +0 -175
  180. package/dist/chunk-E75EHRPA.cjs.map +0 -1
  181. package/dist/chunk-GTTPVJSD.cjs.map +0 -1
  182. package/dist/chunk-HELJTLNC.cjs.map +0 -1
  183. package/dist/chunk-HJIQT3S5.js.map +0 -1
  184. package/dist/chunk-JEIFJHEI.js +0 -14
  185. package/dist/chunk-JEIFJHEI.js.map +0 -1
  186. package/dist/chunk-KXOBZGQO.js.map +0 -1
  187. package/dist/chunk-MQ2XQ4MX.js.map +0 -1
  188. package/dist/chunk-OMOBMXD5.cjs.map +0 -1
  189. package/dist/chunk-PZ4GT5JO.cjs.map +0 -1
  190. package/dist/chunk-QAW5NH6S.cjs +0 -14
  191. package/dist/chunk-QAW5NH6S.cjs.map +0 -1
  192. package/dist/chunk-TC4DARU2.js +0 -175
  193. package/dist/chunk-TC4DARU2.js.map +0 -1
  194. package/dist/chunk-WXMYDXPN.cjs.map +0 -1
  195. package/dist/chunk-XEBWC7ZL.js.map +0 -1
  196. package/dist/chunk-ZGZEJCRV.js.map +0 -1
  197. package/dist/chunk-ZHOSSWUM.js.map +0 -1
  198. package/dist/chunk-ZS2WA357.js.map +0 -1
  199. /package/dist/{chunk-NOKWNK2O.js.map → chunk-6LMS5J3Y.js.map} +0 -0
  200. /package/dist/{chunk-T7SW6OWV.js.map → chunk-A4IJSJKL.js.map} +0 -0
  201. /package/dist/{chunk-PMWCQSQX.js.map → chunk-GPIDU3GN.js.map} +0 -0
  202. /package/dist/{chunk-POBM7MGR.js.map → chunk-LMAEPFTX.js.map} +0 -0
  203. /package/dist/{chunk-K574XHMM.js.map → chunk-OCCKQHCY.js.map} +0 -0
  204. /package/dist/{chunk-SG37UBDO.js.map → chunk-PGSS4IOS.js.map} +0 -0
  205. /package/dist/{chunk-RUDWMKYX.js.map → chunk-PIWRSX7U.js.map} +0 -0
  206. /package/dist/{chunk-JDPTZUBW.js.map → chunk-QXG3HWDS.js.map} +0 -0
  207. /package/dist/{chunk-NNDYYEW5.js.map → chunk-RQW3P3GH.js.map} +0 -0
  208. /package/dist/{chunk-47MLKSI2.js.map → chunk-UBNG5YCG.js.map} +0 -0
  209. /package/dist/{chunk-KAVU6T6J.js.map → chunk-WMN6566P.js.map} +0 -0
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunk2VDK27IFcjs = require('./chunk-2VDK27IF.cjs');
16
+ var _chunk5R3ISX4Acjs = require('./chunk-5R3ISX4A.cjs');
17
17
 
18
18
 
19
19
 
@@ -30,7 +30,7 @@ var _chunk2VDK27IFcjs = require('./chunk-2VDK27IF.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkGTTPVJSDcjs = require('./chunk-GTTPVJSD.cjs');
33
+ var _chunk5M4QG3ZCcjs = require('./chunk-5M4QG3ZC.cjs');
34
34
 
35
35
 
36
36
 
@@ -50,7 +50,7 @@ var _chunkGTTPVJSDcjs = require('./chunk-GTTPVJSD.cjs');
50
50
 
51
51
 
52
52
 
53
- var _chunkPZ4GT5JOcjs = require('./chunk-PZ4GT5JO.cjs');
53
+ var _chunkHOIDJEVIcjs = require('./chunk-HOIDJEVI.cjs');
54
54
 
55
55
 
56
56
 
@@ -59,13 +59,14 @@ var _chunkPZ4GT5JOcjs = require('./chunk-PZ4GT5JO.cjs');
59
59
 
60
60
 
61
61
 
62
- var _chunkND5XJVK2cjs = require('./chunk-ND5XJVK2.cjs');
62
+
63
+ var _chunkBTBHHBVRcjs = require('./chunk-BTBHHBVR.cjs');
63
64
 
64
65
  // src/engine/commands/table-shape.ts
65
66
  var CELL = /^cell:(\d+):(\d+)$/;
66
67
  var tableShape = (block) => ({
67
- rows: _chunkND5XJVK2cjs.countOf.call(void 0, block.attrs.rows),
68
- cols: _chunkND5XJVK2cjs.countOf.call(void 0, block.attrs.cols)
68
+ rows: _chunkBTBHHBVRcjs.countOf.call(void 0, block.attrs.rows),
69
+ cols: _chunkBTBHHBVRcjs.countOf.call(void 0, block.attrs.cols)
69
70
  });
70
71
  var ALIGNS = ["left", "center", "right"];
71
72
  var columnAligns = (block, cols) => Array.from({ length: cols }, (_, col) => {
@@ -79,7 +80,7 @@ function cellOf(region) {
79
80
  return match === null ? null : [Number(match[1]), Number(match[2])];
80
81
  }
81
82
  function tableBlock(doc, id) {
82
- const block = _chunkND5XJVK2cjs.blockById.call(void 0, doc, id);
83
+ const block = _chunkBTBHHBVRcjs.blockById.call(void 0, doc, id);
83
84
  return _optionalChain([block, 'optionalAccess', _2 => _2.type]) === "TABLE" ? block : null;
84
85
  }
85
86
  var isIndex = (index, length) => Number.isInteger(index) && index >= 0 && index < length;
@@ -93,7 +94,7 @@ function rebuiltTable(block, plan) {
93
94
  for (let row = 0; row < plan.rows; row++) {
94
95
  for (let col = 0; col < plan.cols; col++) {
95
96
  const from = plan.source(row, col);
96
- regions[_chunkND5XJVK2cjs.cellKey.call(void 0, row, col)] = from === null ? [] : _nullishCoalesce(block.regions[_chunkND5XJVK2cjs.cellKey.call(void 0, ...from)], () => ( []));
97
+ regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, row, col)] = from === null ? [] : _nullishCoalesce(block.regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, ...from)], () => ( []));
97
98
  }
98
99
  }
99
100
  return { ...block, attrs: { ...block.attrs, ...plan.attrs, rows: plan.rows, cols: plan.cols }, regions };
@@ -102,17 +103,17 @@ function followedPos(pos, blockId, plan) {
102
103
  const cell = pos.block === blockId ? cellOf(pos.region) : null;
103
104
  if (cell === null) return pos;
104
105
  const moved = plan.target(cell);
105
- return moved === null ? { block: blockId, region: _chunkND5XJVK2cjs.cellKey.call(void 0, ...plan.landing(cell)), offset: 0 } : { ...pos, region: _chunkND5XJVK2cjs.cellKey.call(void 0, ...moved) };
106
+ return moved === null ? { block: blockId, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, ...plan.landing(cell)), offset: 0 } : { ...pos, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, ...moved) };
106
107
  }
107
108
  function followedSelection(selection, blockId, plan) {
108
109
  if (_optionalChain([selection, 'optionalAccess', _3 => _3.kind]) !== "text") return selection;
109
110
  const anchor = followedPos(selection.anchor, blockId, plan);
110
111
  const head = followedPos(selection.head, blockId, plan);
111
- return anchor === selection.anchor && head === selection.head ? selection : _chunkPZ4GT5JOcjs.textSelection.call(void 0, anchor, head);
112
+ return anchor === selection.anchor && head === selection.head ? selection : _chunkHOIDJEVIcjs.textSelection.call(void 0, anchor, head);
112
113
  }
113
114
 
114
115
  // src/engine/state/cell-selection.ts
115
- var cellSelectionKey = _chunkPZ4GT5JOcjs.createPluginKey.call(void 0, "cellSelection");
116
+ var cellSelectionKey = _chunkHOIDJEVIcjs.createPluginKey.call(void 0, "cellSelection");
116
117
  function rangeOfSelection({ doc, selection }) {
117
118
  if (_optionalChain([selection, 'optionalAccess', _4 => _4.kind]) !== "text") return null;
118
119
  const { anchor, head } = selection;
@@ -150,39 +151,39 @@ function selectCells(blockId, anchor, head) {
150
151
  const { rows, cols } = block === null ? { rows: 0, cols: 0 } : tableShape(block);
151
152
  const inside = ([row, col]) => isIndex(row, rows) && isIndex(col, cols);
152
153
  if (block === null || !inside(anchor) || !inside(head)) return false;
153
- const end2 = _chunkND5XJVK2cjs.cellKey.call(void 0, ...head);
154
- const selection = _chunkPZ4GT5JOcjs.textSelection.call(void 0,
155
- { block: blockId, region: _chunkND5XJVK2cjs.cellKey.call(void 0, ...anchor), offset: 0 },
156
- { block: blockId, region: end2, offset: _chunkND5XJVK2cjs.inlineLength.call(void 0, _nullishCoalesce(block.regions[end2], () => ( []))) }
154
+ const end2 = _chunkBTBHHBVRcjs.cellKey.call(void 0, ...head);
155
+ const selection = _chunkHOIDJEVIcjs.textSelection.call(void 0,
156
+ { block: blockId, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, ...anchor), offset: 0 },
157
+ { block: blockId, region: end2, offset: _chunkBTBHHBVRcjs.inlineLength.call(void 0, _nullishCoalesce(block.regions[end2], () => ( []))) }
157
158
  );
158
- _optionalChain([dispatch, 'optionalCall', _5 => _5(new (0, _chunkPZ4GT5JOcjs.Transaction)(state).setSelection(selection))]);
159
+ _optionalChain([dispatch, 'optionalCall', _5 => _5(new (0, _chunkHOIDJEVIcjs.Transaction)(state).setSelection(selection))]);
159
160
  return true;
160
161
  };
161
162
  }
162
163
 
163
164
  // src/engine/commands/cell-commands.ts
164
165
  function filledCells(doc, range) {
165
- const regions = _nullishCoalesce(_optionalChain([_chunkND5XJVK2cjs.blockById.call(void 0, doc, range.block), 'optionalAccess', _6 => _6.regions]), () => ( {}));
166
+ const regions = _nullishCoalesce(_optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, doc, range.block), 'optionalAccess', _6 => _6.regions]), () => ( {}));
166
167
  return cellsInRange(range).flatMap((cell) => {
167
- const region = _chunkND5XJVK2cjs.cellKey.call(void 0, ...cell);
168
- const length = _chunkND5XJVK2cjs.inlineLength.call(void 0, _nullishCoalesce(regions[region], () => ( [])));
168
+ const region = _chunkBTBHHBVRcjs.cellKey.call(void 0, ...cell);
169
+ const length = _chunkBTBHHBVRcjs.inlineLength.call(void 0, _nullishCoalesce(regions[region], () => ( [])));
169
170
  return length > 0 ? [{ region, length }] : [];
170
171
  });
171
172
  }
172
173
  function firstCell({ block, anchor, head }) {
173
- return { block, region: _chunkND5XJVK2cjs.cellKey.call(void 0, Math.min(anchor[0], head[0]), Math.min(anchor[1], head[1])), offset: 0 };
174
+ return { block, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, Math.min(anchor[0], head[0]), Math.min(anchor[1], head[1])), offset: 0 };
174
175
  }
175
176
  function emptied(state, range) {
176
- const tr = new (0, _chunkPZ4GT5JOcjs.Transaction)(state);
177
+ const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state);
177
178
  for (const { region, length } of filledCells(state.doc, range)) {
178
- tr.step(_chunkPZ4GT5JOcjs.replaceInlineStep.call(void 0, range.block, region, 0, length, []));
179
+ tr.step(_chunkHOIDJEVIcjs.replaceInlineStep.call(void 0, range.block, region, 0, length, []));
179
180
  }
180
181
  return tr;
181
182
  }
182
183
  var deleteCellContents = (state, dispatch) => {
183
184
  const range = cellSelection(state);
184
185
  if (range === null) return false;
185
- _optionalChain([dispatch, 'optionalCall', _7 => _7(emptied(state, range).setSelection(_chunkPZ4GT5JOcjs.textSelection.call(void 0, firstCell(range))))]);
186
+ _optionalChain([dispatch, 'optionalCall', _7 => _7(emptied(state, range).setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, firstCell(range))))]);
186
187
  return true;
187
188
  };
188
189
  function typeOverCells(text) {
@@ -190,7 +191,7 @@ function typeOverCells(text) {
190
191
  const range = cellSelection(state);
191
192
  if (range === null || text === "") return false;
192
193
  const tr = emptied(state, range);
193
- _optionalChain([dispatch, 'optionalCall', _8 => _8(tr.setSelection(_chunkPZ4GT5JOcjs.textSelection.call(void 0, _chunkPZ4GT5JOcjs.insertTextAt.call(void 0, tr, state.schema, firstCell(range), text))))]);
194
+ _optionalChain([dispatch, 'optionalCall', _8 => _8(tr.setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, _chunkHOIDJEVIcjs.insertTextAt.call(void 0, tr, state.schema, firstCell(range), text))))]);
194
195
  return true;
195
196
  };
196
197
  }
@@ -198,14 +199,14 @@ function setCellsMark(type, attrs) {
198
199
  return (state, dispatch) => {
199
200
  const range = cellSelection(state);
200
201
  const cells = range === null ? [] : filledCells(state.doc, range);
201
- const regions = range === null ? void 0 : _optionalChain([_chunkND5XJVK2cjs.blockById.call(void 0, state.doc, range.block), 'optionalAccess', _9 => _9.regions]);
202
+ const regions = range === null ? void 0 : _optionalChain([_chunkBTBHHBVRcjs.blockById.call(void 0, state.doc, range.block), 'optionalAccess', _9 => _9.regions]);
202
203
  if (range === null || regions === void 0 || cells.length === 0) return false;
203
- const carried = cells.every(({ region }) => _chunkPZ4GT5JOcjs.markCoverage.call(void 0, regions[region], type, attrs).every);
204
- const mark = carried ? _chunkPZ4GT5JOcjs.toggleMark.call(void 0, type, attrs) : _chunkPZ4GT5JOcjs.setMark.call(void 0, type, attrs);
205
- const tr = new (0, _chunkPZ4GT5JOcjs.Transaction)(state);
204
+ const carried = cells.every(({ region }) => _chunkHOIDJEVIcjs.markCoverage.call(void 0, regions[region], type, attrs).every);
205
+ const mark = carried ? _chunkHOIDJEVIcjs.toggleMark.call(void 0, type, attrs) : _chunkHOIDJEVIcjs.setMark.call(void 0, type, attrs);
206
+ const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state);
206
207
  for (const { region, length } of cells) {
207
208
  const start = { block: range.block, region, offset: 0 };
208
- const whole = _chunkPZ4GT5JOcjs.textSelection.call(void 0, start, { ...start, offset: length });
209
+ const whole = _chunkHOIDJEVIcjs.textSelection.call(void 0, start, { ...start, offset: length });
209
210
  mark({ ...state, doc: tr.doc, selection: whole, storedMarks: null }, (cell) => {
210
211
  for (const step of cell.steps) tr.step(step);
211
212
  });
@@ -227,7 +228,7 @@ var controlsSlot = (controller, blockId) => _nullishCoalesce(_optionalChain([con
227
228
 
228
229
  var _jsxruntime = require('react/jsx-runtime');
229
230
  var TableCell = _react.memo.call(void 0, function TableCell2({ controller, blockId, row, col, header, align, label }) {
230
- const inRange = _chunkGTTPVJSDcjs.useEditorState.call(void 0,
231
+ const inRange = _chunk5M4QG3ZCcjs.useEditorState.call(void 0,
231
232
  controller,
232
233
  _react.useCallback.call(void 0,
233
234
  (state) => {
@@ -246,7 +247,7 @@ var TableCell = _react.memo.call(void 0, function TableCell2({ controller, block
246
247
  "data-col": col,
247
248
  "data-in-range": inRange ? "" : void 0,
248
249
  style: align === null ? void 0 : { textAlign: align },
249
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGTTPVJSDcjs.EditableRegion, { block: blockId, region: _chunkND5XJVK2cjs.cellKey.call(void 0, row, col), label, className: "quoin-table-text" })
250
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5M4QG3ZCcjs.EditableRegion, { block: blockId, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, row, col), label, className: "quoin-table-text" })
250
251
  }
251
252
  );
252
253
  });
@@ -295,7 +296,7 @@ function changeTable(blockId, change, plan) {
295
296
  const block = tableBlock(state.doc, blockId);
296
297
  const next = block && change(block);
297
298
  if (!next) return false;
298
- const tr = new (0, _chunkPZ4GT5JOcjs.Transaction)(state).step(_chunkPZ4GT5JOcjs.replaceBlockStep.call(void 0, next));
299
+ const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state).step(_chunkHOIDJEVIcjs.replaceBlockStep.call(void 0, next));
299
300
  _optionalChain([dispatch, 'optionalCall', _17 => _17(plan ? tr.setSelection(followedSelection(state.selection, blockId, plan)) : tr)]);
300
301
  return true;
301
302
  };
@@ -406,28 +407,28 @@ var setColumnWidth = (blockId, col, px, drawn) => changeTable(blockId, (block) =
406
407
  var isCount = (value) => Number.isInteger(value) && value > 0;
407
408
  function emptyCells({ rows, cols }) {
408
409
  const regions = {};
409
- for (let row = 0; row < rows; row++) for (let col = 0; col < cols; col++) regions[_chunkND5XJVK2cjs.cellKey.call(void 0, row, col)] = [];
410
+ for (let row = 0; row < rows; row++) for (let col = 0; col < cols; col++) regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, row, col)] = [];
410
411
  return regions;
411
412
  }
412
413
  function insertTable(rows, cols, options = {}) {
413
414
  return (state, dispatch) => {
414
415
  const { doc, schema } = state;
415
- const id = _chunkPZ4GT5JOcjs.headBlockId.call(void 0, state.selection);
416
+ const id = _chunkHOIDJEVIcjs.headBlockId.call(void 0, state.selection);
416
417
  if (id === null || !isCount(rows) || !isCount(cols)) return false;
417
- const index = _chunkND5XJVK2cjs.requireBlockIndex.call(void 0, doc, id);
418
+ const index = _chunkBTBHHBVRcjs.requireBlockIndex.call(void 0, doc, id);
418
419
  const current = doc.blocks[index];
419
- const fills = _chunkPZ4GT5JOcjs.isParagraph.call(void 0, current) && _chunkPZ4GT5JOcjs.regionLength.call(void 0, current, _nullishCoalesce(_chunkPZ4GT5JOcjs.primaryRegion.call(void 0, schema, current), () => ( ""))) === 0;
420
+ const fills = _chunkHOIDJEVIcjs.isParagraph.call(void 0, current) && _chunkHOIDJEVIcjs.regionLength.call(void 0, current, _nullishCoalesce(_chunkHOIDJEVIcjs.primaryRegion.call(void 0, schema, current), () => ( ""))) === 0;
420
421
  const table = {
421
- id: fills ? current.id : (_nullishCoalesce(options.newId, () => ( (0, _chunkND5XJVK2cjs.newId))))(),
422
+ id: fills ? current.id : (_nullishCoalesce(options.newId, () => ( (0, _chunkBTBHHBVRcjs.newId))))(),
422
423
  type: "TABLE",
423
424
  indent: current.indent,
424
425
  attrs: { header: true, align: Array.from({ length: cols }, () => null), rows, cols },
425
426
  regions: emptyCells({ rows, cols })
426
427
  };
427
- const tr = new (0, _chunkPZ4GT5JOcjs.Transaction)(state).step(
428
- fills ? _chunkPZ4GT5JOcjs.replaceBlockStep.call(void 0, table) : _chunkPZ4GT5JOcjs.insertBlocksStep.call(void 0, _chunkPZ4GT5JOcjs.descendantsEnd.call(void 0, doc, index), [table])
428
+ const tr = new (0, _chunkHOIDJEVIcjs.Transaction)(state).step(
429
+ fills ? _chunkHOIDJEVIcjs.replaceBlockStep.call(void 0, table) : _chunkHOIDJEVIcjs.insertBlocksStep.call(void 0, _chunkHOIDJEVIcjs.descendantsEnd.call(void 0, doc, index), [table])
429
430
  );
430
- _optionalChain([dispatch, 'optionalCall', _19 => _19(tr.setSelection(_chunkPZ4GT5JOcjs.textSelection.call(void 0, { block: table.id, region: _chunkND5XJVK2cjs.cellKey.call(void 0, 0, 0), offset: 0 })))]);
431
+ _optionalChain([dispatch, 'optionalCall', _19 => _19(tr.setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, { block: table.id, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, 0, 0), offset: 0 })))]);
431
432
  return true;
432
433
  };
433
434
  }
@@ -440,15 +441,15 @@ function headCell({ doc, selection }) {
440
441
  const cell = block && cellOf(head.region);
441
442
  return block && cell ? { block, cell, head, shape: tableShape(block) } : null;
442
443
  }
443
- var cellLength = (block, [row, col]) => _chunkND5XJVK2cjs.inlineLength.call(void 0, _nullishCoalesce(block.regions[_chunkND5XJVK2cjs.cellKey.call(void 0, row, col)], () => ( [])));
444
+ var cellLength = (block, [row, col]) => _chunkBTBHHBVRcjs.inlineLength.call(void 0, _nullishCoalesce(block.regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, row, col)], () => ( [])));
444
445
  var cellPos = (block, cell, atEnd = false) => ({
445
446
  block: block.id,
446
- region: _chunkND5XJVK2cjs.cellKey.call(void 0, ...cell),
447
+ region: _chunkBTBHHBVRcjs.cellKey.call(void 0, ...cell),
447
448
  offset: atEnd ? cellLength(block, cell) : 0
448
449
  });
449
- var moveTo = (state, pos) => new (0, _chunkPZ4GT5JOcjs.Transaction)(state).setSelection(_chunkPZ4GT5JOcjs.textSelection.call(void 0, pos));
450
+ var moveTo = (state, pos) => new (0, _chunkHOIDJEVIcjs.Transaction)(state).setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, pos));
450
451
  var thenCaretIn = (command, blockId, at) => (state, dispatch) => {
451
- const caret = _chunkPZ4GT5JOcjs.textSelection.call(void 0, { block: blockId, region: _chunkND5XJVK2cjs.cellKey.call(void 0, ...at), offset: 0 });
452
+ const caret = _chunkHOIDJEVIcjs.textSelection.call(void 0, { block: blockId, region: _chunkBTBHHBVRcjs.cellKey.call(void 0, ...at), offset: 0 });
452
453
  return command(state, dispatch && ((tr) => dispatch(tr.setSelection(caret))));
453
454
  };
454
455
  var cellAtIndex = (index, { cols }) => [Math.floor(index / cols), index % cols];
@@ -481,11 +482,11 @@ var enterInCell = (state, dispatch) => {
481
482
  if (row === shape.rows - 1 && cellLength(block, cell) === 0) {
482
483
  return thenCaretIn(addRow(block.id, shape.rows), block.id, [shape.rows, col])(state, dispatch);
483
484
  }
484
- return _chunkPZ4GT5JOcjs.insertHardBreak.call(void 0, state, dispatch);
485
+ return _chunkHOIDJEVIcjs.insertHardBreak.call(void 0, state, dispatch);
485
486
  };
486
487
  var stopAtCellEdge = (atEnd) => (state) => {
487
488
  const caret = headCell(state);
488
- if (caret === null || !_chunkPZ4GT5JOcjs.isCollapsed.call(void 0, state.selection)) return false;
489
+ if (caret === null || !_chunkHOIDJEVIcjs.isCollapsed.call(void 0, state.selection)) return false;
489
490
  return caret.head.offset === (atEnd ? cellLength(caret.block, caret.cell) : 0);
490
491
  };
491
492
  var firstThatApplies = (...commands) => (state, dispatch) => commands.some((command) => command(state, dispatch));
@@ -518,7 +519,7 @@ function useCellPress(controller, blockId, table, editable) {
518
519
  if (!editable || element === null) return;
519
520
  const onPointerDown = (event) => {
520
521
  const cell = event.button === 0 && event.pointerType !== "touch" ? cellOf2(event.target) : null;
521
- const block = cell && _chunkND5XJVK2cjs.blockById.call(void 0, controller.editor.state.doc, blockId);
522
+ const block = cell && _chunkBTBHHBVRcjs.blockById.call(void 0, controller.editor.state.doc, blockId);
522
523
  if (!cell || !block) return;
523
524
  event.preventDefault();
524
525
  event.stopPropagation();
@@ -532,7 +533,7 @@ function useCellPress(controller, blockId, table, editable) {
532
533
  // src/extensions/table/use-reveal-cell.ts
533
534
 
534
535
  function useRevealCell(controller, blockId) {
535
- const region = _chunkGTTPVJSDcjs.useEditorState.call(void 0,
536
+ const region = _chunk5M4QG3ZCcjs.useEditorState.call(void 0,
536
537
  controller,
537
538
  _react.useCallback.call(void 0,
538
539
  (state) => {
@@ -556,23 +557,23 @@ function useRevealCell(controller, blockId) {
556
557
  // src/extensions/table/vertical-cell-move.ts
557
558
  var VERTICAL = { ArrowUp: -1, ArrowDown: 1 };
558
559
  function caretAtGoal(controller, blockId, cell, direction) {
559
- const region = _chunkND5XJVK2cjs.cellKey.call(void 0, ...cell);
560
+ const region = _chunkBTBHHBVRcjs.cellKey.call(void 0, ...cell);
560
561
  const host = controller.registry.get(blockId, region);
561
562
  const { goalX } = controller;
562
- const line = host && _chunkGTTPVJSDcjs.lineEdgeRect.call(void 0, host, direction < 0);
563
+ const line = host && _chunk5M4QG3ZCcjs.lineEdgeRect.call(void 0, host, direction < 0);
563
564
  if (!host || !line || goalX === null) return null;
564
565
  const box = host.getBoundingClientRect();
565
566
  const x = Math.min(Math.max(goalX, box.left), box.right - 1);
566
- const point = _chunkGTTPVJSDcjs.caretFromPoint.call(void 0, host.ownerDocument, x, line.top + line.height / 2);
567
- const pos = point && _chunkGTTPVJSDcjs.domToPos.call(void 0, controller.registry, point.node, point.offset);
567
+ const point = _chunk5M4QG3ZCcjs.caretFromPoint.call(void 0, host.ownerDocument, x, line.top + line.height / 2);
568
+ const pos = point && _chunk5M4QG3ZCcjs.domToPos.call(void 0, controller.registry, point.node, point.offset);
568
569
  return pos && pos.block === blockId && pos.region === region ? pos : null;
569
570
  }
570
571
  var plainArrow = (event) => event.altKey || event.ctrlKey || event.metaKey ? void 0 : VERTICAL[event.key];
571
572
  function caretOnEdgeLine(controller, head, direction) {
572
573
  const host = controller.registry.get(head.block, head.region);
573
- const point = _chunkGTTPVJSDcjs.posToDom.call(void 0, controller.registry, head);
574
- if (!host || !point || !(direction < 0 ? _chunkGTTPVJSDcjs.isOnFirstLine.call(void 0, host, point) : _chunkGTTPVJSDcjs.isOnLastLine.call(void 0, host, point))) return null;
575
- return { left: _nullishCoalesce(_optionalChain([_chunkGTTPVJSDcjs.caretClientRect.call(void 0, point), 'optionalAccess', _31 => _31.left]), () => ( null)) };
574
+ const point = _chunk5M4QG3ZCcjs.posToDom.call(void 0, controller.registry, head);
575
+ if (!host || !point || !(direction < 0 ? _chunk5M4QG3ZCcjs.isOnFirstLine.call(void 0, host, point) : _chunk5M4QG3ZCcjs.isOnLastLine.call(void 0, host, point))) return null;
576
+ return { left: _nullishCoalesce(_optionalChain([_chunk5M4QG3ZCcjs.caretClientRect.call(void 0, point), 'optionalAccess', _31 => _31.left]), () => ( null)) };
576
577
  }
577
578
  function columnAt(controller, blockId, row, x) {
578
579
  const cells = Array.from(_nullishCoalesce(_optionalChain([controller, 'access', _32 => _32.blockElement, 'call', _33 => _33(blockId), 'optionalAccess', _34 => _34.querySelector, 'call', _35 => _35("table"), 'optionalAccess', _36 => _36.rows, 'access', _37 => _37[row], 'optionalAccess', _38 => _38.cells]), () => ( [])));
@@ -585,7 +586,7 @@ function enterTable(controller, blockId, event) {
585
586
  const { selection } = state;
586
587
  const block = tableBlock(state.doc, blockId);
587
588
  if (direction === void 0 || event.shiftKey || block === null || _optionalChain([selection, 'optionalAccess', _39 => _39.kind]) !== "text") return false;
588
- if (!_chunkPZ4GT5JOcjs.isCollapsed.call(void 0, selection) || _optionalChain([_chunkGTTPVJSDcjs.neighbourBlock.call(void 0, state.doc, selection.head.block, direction), 'optionalAccess', _40 => _40.id]) !== blockId) return false;
589
+ if (!_chunkHOIDJEVIcjs.isCollapsed.call(void 0, selection) || _optionalChain([_chunk5M4QG3ZCcjs.neighbourBlock.call(void 0, state.doc, selection.head.block, direction), 'optionalAccess', _40 => _40.id]) !== blockId) return false;
589
590
  const caret = caretOnEdgeLine(controller, selection.head, direction);
590
591
  if (caret === null) return false;
591
592
  controller.goalX ??= caret.left;
@@ -594,7 +595,7 @@ function enterTable(controller, blockId, event) {
594
595
  const { goalX } = controller;
595
596
  const cell = [row, goalX === null ? direction > 0 ? 0 : cols - 1 : columnAt(controller, blockId, row, goalX)];
596
597
  const pos = _nullishCoalesce(caretAtGoal(controller, blockId, cell, direction), () => ( cellPos(block, cell, direction < 0)));
597
- controller.dispatch(controller.editor.createTransaction().setSelection(_chunkPZ4GT5JOcjs.textSelection.call(void 0, pos)));
598
+ controller.dispatch(controller.editor.createTransaction().setSelection(_chunkHOIDJEVIcjs.textSelection.call(void 0, pos)));
598
599
  return true;
599
600
  }
600
601
  function moveBetweenRows(controller, blockId, event) {
@@ -610,7 +611,7 @@ function moveBetweenRows(controller, blockId, event) {
610
611
  if (edge === null) return false;
611
612
  controller.goalX ??= edge.left;
612
613
  const pos = _nullishCoalesce(caretAtGoal(controller, blockId, target, direction), () => ( cellPos(caret.block, target, direction < 0)));
613
- const selection = event.shiftKey ? _chunkPZ4GT5JOcjs.textSelection.call(void 0, state.selection.anchor, pos) : _chunkPZ4GT5JOcjs.textSelection.call(void 0, pos);
614
+ const selection = event.shiftKey ? _chunkHOIDJEVIcjs.textSelection.call(void 0, state.selection.anchor, pos) : _chunkHOIDJEVIcjs.textSelection.call(void 0, pos);
614
615
  controller.dispatch(controller.editor.createTransaction().setSelection(selection));
615
616
  return true;
616
617
  }
@@ -625,12 +626,12 @@ function useTableKeys(controller, blockId, editable) {
625
626
  _react.useEffect.call(void 0, () => {
626
627
  if (!editable) return;
627
628
  const intercept = (event) => {
628
- if (_chunkGTTPVJSDcjs.isComposingKey.call(void 0, controller, event)) return false;
629
+ if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event)) return false;
629
630
  const handled = typeOver(controller, blockId, event) || moveBetweenRows(controller, blockId, event) || enterTable(controller, blockId, event);
630
631
  if (handled) event.preventDefault();
631
632
  return handled;
632
633
  };
633
- return _chunk2VDK27IFcjs.interceptKeys.call(void 0, controller, intercept);
634
+ return _chunk5R3ISX4Acjs.interceptKeys.call(void 0, controller, intercept);
634
635
  }, [controller, blockId, editable]);
635
636
  }
636
637
 
@@ -638,7 +639,7 @@ function useTableKeys(controller, blockId, editable) {
638
639
 
639
640
  var indexes = (from, to) => Array.from({ length: Math.max(to - from, 0) }, (_, i) => from + i);
640
641
  function TableBlock({ block, controller, labels }) {
641
- const readOnly = _chunkGTTPVJSDcjs.useReadOnly.call(void 0, controller);
642
+ const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
642
643
  const table = _react.useRef.call(void 0, null);
643
644
  const { rows, cols } = tableShape(block);
644
645
  const header = block.attrs.header !== false && rows > 0;
@@ -662,7 +663,7 @@ function TableBlock({ block, controller, labels }) {
662
663
  col
663
664
  )) }, index);
664
665
  const scroller = readOnly ? { role: "region", "aria-label": labels.table, tabIndex: 0 } : void 0;
665
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { contentEditable: false, className: "quoin-table", "data-readonly": readOnly ? "" : void 0, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `quoin-table-scroll ${readOnly ? _chunk2VDK27IFcjs.FOCUS_RING : ""}`, ...scroller, children: [
666
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { contentEditable: false, className: "quoin-table", "data-readonly": readOnly ? "" : void 0, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `quoin-table-scroll ${readOnly ? _chunk5R3ISX4Acjs.FOCUS_RING : ""}`, ...scroller, children: [
666
667
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
667
668
  "table",
668
669
  {
@@ -686,19 +687,23 @@ var _reactdom = require('react-dom');
686
687
 
687
688
  // src/extensions/table/menu-cells.ts
688
689
  var EMPTY = [];
689
- function menuCells(block, target, axis) {
690
+ function lineCells(block, index, axis) {
690
691
  const { rows, cols } = tableShape(block);
691
- const row = Math.min(target.row, rows - 1);
692
- const col = Math.min(target.col, cols - 1);
693
692
  return Array.from(
694
693
  { length: axis === "row" ? cols : rows },
695
- (_, index) => axis === "row" ? _nullishCoalesce(block.regions[_chunkND5XJVK2cjs.cellKey.call(void 0, row, index)], () => ( EMPTY)) : _nullishCoalesce(block.regions[_chunkND5XJVK2cjs.cellKey.call(void 0, index, col)], () => ( EMPTY))
694
+ (_, other) => axis === "row" ? _nullishCoalesce(block.regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, index, other)], () => ( EMPTY)) : _nullishCoalesce(block.regions[_chunkBTBHHBVRcjs.cellKey.call(void 0, other, index)], () => ( EMPTY))
696
695
  );
697
696
  }
697
+ var sameLine = (before, after, index, axis) => _chunkBTBHHBVRcjs.sameItems.call(void 0, lineCells(before, index, axis), lineCells(after, index, axis), _chunkBTBHHBVRcjs.equalInline);
698
698
  function sameMenuCells(opened, current, target, axis) {
699
- const before = menuCells(opened, target, axis);
700
- const after = menuCells(current, target, axis);
701
- return before.length === after.length && before.every((cell, index) => _chunkND5XJVK2cjs.equalInline.call(void 0, cell, after[index]));
699
+ const shape = tableShape(opened);
700
+ const lines = axis === "row" ? shape.rows : shape.cols;
701
+ const index = Math.min(axis === "row" ? target.row : target.col, lines - 1);
702
+ if (sameLine(opened, current, index, axis)) return true;
703
+ const reshaped = tableShape(current);
704
+ if (reshaped.rows !== shape.rows || reshaped.cols !== shape.cols) return false;
705
+ const others = Array.from({ length: lines }, (_, other) => other);
706
+ return others.every((other) => other === index || sameLine(opened, current, other, axis));
702
707
  }
703
708
 
704
709
  // src/extensions/table/TableHandles.tsx
@@ -722,7 +727,7 @@ function ColumnResizer(props) {
722
727
  if (!controller.readOnly) controller.run(setColumnWidth(blockId, col, px, widths));
723
728
  };
724
729
  const onKeyDown = (event) => {
725
- if (_chunkGTTPVJSDcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
730
+ if (_chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
726
731
  const step = event.shiftKey ? LARGE_STEP : STEP;
727
732
  const tab = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
728
733
  if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
@@ -777,7 +782,7 @@ function ColumnResizer(props) {
777
782
  "aria-valuetext": labels.columnWidth(width),
778
783
  className: "quoin-table-resizer",
779
784
  style,
780
- ...{ [_chunkGTTPVJSDcjs.NATIVE_INTERACTION]: "" },
785
+ ...{ [_chunk5M4QG3ZCcjs.NATIVE_INTERACTION]: "" },
781
786
  onKeyDown,
782
787
  onPointerDown,
783
788
  onPointerMove,
@@ -797,20 +802,20 @@ function HandleMenu({ controller, axis, label, style, items, open, onOpenChange,
797
802
  if (controller.run(item3.command)) controller.announce(item3.done);
798
803
  };
799
804
  const item2 = (entry) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
800
- _chunk2VDK27IFcjs.DropdownMenuItem,
805
+ _chunk5R3ISX4Acjs.DropdownMenuItem,
801
806
  {
802
807
  disabled: entry.disabled,
803
808
  className: entry.destructive ? DESTRUCTIVE : void 0,
804
809
  onSelect: () => run(entry),
805
810
  children: [
806
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.MenuIcon, { icon: entry.icon }),
811
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.MenuIcon, { icon: entry.icon }),
807
812
  entry.label
808
813
  ]
809
814
  },
810
815
  entry.id
811
816
  );
812
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2VDK27IFcjs.DropdownMenu, { open, onOpenChange, children: [
813
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
817
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5R3ISX4Acjs.DropdownMenu, { open, onOpenChange, children: [
818
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
814
819
  "button",
815
820
  {
816
821
  ref: buttonRef,
@@ -824,18 +829,18 @@ function HandleMenu({ controller, axis, label, style, items, open, onOpenChange,
824
829
  }
825
830
  ) }),
826
831
  open && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
827
- _chunk2VDK27IFcjs.DropdownMenuContent,
832
+ _chunk5R3ISX4Acjs.DropdownMenuContent,
828
833
  {
829
834
  align: "start",
830
835
  "aria-label": label,
831
836
  "aria-labelledby": void 0,
832
- onCloseAutoFocus: _chunk2VDK27IFcjs.returnFocusToText.call(void 0, controller),
833
- ..._chunk2VDK27IFcjs.bubblePart.call(void 0, controller),
837
+ onCloseAutoFocus: _chunk5R3ISX4Acjs.returnFocusToText.call(void 0, controller),
838
+ ..._chunk5R3ISX4Acjs.bubblePart.call(void 0, controller),
834
839
  children: [
835
840
  items.filter((entry) => !entry.destructive).map(item2),
836
841
  children,
837
842
  items.filter((entry) => entry.destructive).map((entry) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
838
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.DropdownMenuSeparator, {}),
843
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.DropdownMenuSeparator, {}),
839
844
  item2(entry)
840
845
  ] }, entry.id))
841
846
  ]
@@ -913,7 +918,7 @@ function TableHandles(props) {
913
918
  const { rowEdge, colEdge } = target;
914
919
  const rowInsertAt = edgeOf(geometry.rows, rowEdge);
915
920
  const columnInsertAt = edgeOf(geometry.cols, colEdge);
916
- _chunkGTTPVJSDcjs.useIsomorphicLayoutEffect.call(void 0, () => {
921
+ _chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
917
922
  if (!focusRequested) return;
918
923
  _optionalChain([(_nullishCoalesce(columnHandle.current, () => ( rowHandle.current))), 'optionalAccess', _50 => _50.focus, 'call', _51 => _51()]);
919
924
  onFocused();
@@ -924,7 +929,7 @@ function TableHandles(props) {
924
929
  const onKeyDown = (event) => {
925
930
  const handles = [rowHandle.current, columnHandle.current].filter((handle) => handle !== null);
926
931
  const index = handles.indexOf(event.target);
927
- if (index === -1 || _chunkGTTPVJSDcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
932
+ if (index === -1 || _chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event.nativeEvent)) return;
928
933
  if (event.key === "ArrowLeft" || event.key === "ArrowRight") handles[(index + 1) % handles.length].focus();
929
934
  else if (isTab(event) && !event.shiftKey && resizer.current !== null) resizer.current.focus();
930
935
  else if (isTab(event) || event.key === "Escape") controller.focus();
@@ -962,7 +967,7 @@ function TableHandles(props) {
962
967
  onOpenChange: opener("row"),
963
968
  buttonRef: rowHandle,
964
969
  children: row === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
965
- _chunk2VDK27IFcjs.DropdownMenuCheckboxItem,
970
+ _chunk5R3ISX4Acjs.DropdownMenuCheckboxItem,
966
971
  {
967
972
  checked: block.attrs.header !== false,
968
973
  onCheckedChange: (on) => run(toggleHeaderRow(block.id), on ? labels.headerRowOn : labels.headerRowOff),
@@ -983,14 +988,14 @@ function TableHandles(props) {
983
988
  onOpenChange: opener("column"),
984
989
  buttonRef: columnHandle,
985
990
  children: [
986
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.DropdownMenuSeparator, {}),
987
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.DropdownMenuRadioGroup, { value: _nullishCoalesce(align, () => ( "")), children: alignItems(labels).map(({ value, label, icon, done }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
988
- _chunk2VDK27IFcjs.DropdownMenuRadioItem,
991
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.DropdownMenuSeparator, {}),
992
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.DropdownMenuRadioGroup, { value: _nullishCoalesce(align, () => ( "")), children: alignItems(labels).map(({ value, label, icon, done }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
993
+ _chunk5R3ISX4Acjs.DropdownMenuRadioItem,
989
994
  {
990
995
  value,
991
996
  onSelect: () => align === value ? run(setColumnAlign(block.id, col, null), labels.alignmentCleared) : run(setColumnAlign(block.id, col, value), done),
992
997
  children: [
993
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2VDK27IFcjs.MenuIcon, { icon }),
998
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5R3ISX4Acjs.MenuIcon, { icon }),
994
999
  label
995
1000
  ]
996
1001
  },
@@ -1009,8 +1014,8 @@ function TableHandles(props) {
1009
1014
  "data-axis": "row",
1010
1015
  className: "quoin-table-insert",
1011
1016
  style: place(geometry.left - BESIDE, rowInsertAt),
1012
- onPointerDown: _chunk2VDK27IFcjs.keepFocus,
1013
- onMouseDown: _chunk2VDK27IFcjs.keepFocus,
1017
+ onPointerDown: _chunk5R3ISX4Acjs.keepFocus,
1018
+ onMouseDown: _chunk5R3ISX4Acjs.keepFocus,
1014
1019
  onClick: () => run(addRow(block.id, rowEdge), labels.rowInserted),
1015
1020
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Plus, { "aria-hidden": "true" })
1016
1021
  }
@@ -1024,8 +1029,8 @@ function TableHandles(props) {
1024
1029
  "data-axis": "column",
1025
1030
  className: "quoin-table-insert",
1026
1031
  style: place(columnInsertAt, geometry.top),
1027
- onPointerDown: _chunk2VDK27IFcjs.keepFocus,
1028
- onMouseDown: _chunk2VDK27IFcjs.keepFocus,
1032
+ onPointerDown: _chunk5R3ISX4Acjs.keepFocus,
1033
+ onMouseDown: _chunk5R3ISX4Acjs.keepFocus,
1029
1034
  onClick: () => run(addColumn(block.id, colEdge), labels.columnInserted),
1030
1035
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Plus, { "aria-hidden": "true" })
1031
1036
  }
@@ -1071,7 +1076,7 @@ function edgeNear(spans, at, reach) {
1071
1076
  // src/extensions/table/use-table-geometry.ts
1072
1077
  function useTableGeometry(controller, blockId, slot) {
1073
1078
  const [geometry, setGeometry] = _react.useState.call(void 0, null);
1074
- _chunkGTTPVJSDcjs.useIsomorphicLayoutEffect.call(void 0, () => {
1079
+ _chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
1075
1080
  const table = _optionalChain([controller, 'access', _55 => _55.blockElement, 'call', _56 => _56(blockId), 'optionalAccess', _57 => _57.querySelector, 'call', _58 => _58("table")]);
1076
1081
  const view = slot.ownerDocument.defaultView;
1077
1082
  if (!table || !view) return;
@@ -1108,7 +1113,7 @@ function useCutCells(controller) {
1108
1113
  const onCut = (event) => {
1109
1114
  if (controller.readOnly || cellSelection(controller.editor.state) === null) return;
1110
1115
  event.stopPropagation();
1111
- _chunkGTTPVJSDcjs.handleCopy.call(void 0, controller, event, false);
1116
+ _chunk5M4QG3ZCcjs.handleCopy.call(void 0, controller, event, false);
1112
1117
  controller.run(deleteCellContents);
1113
1118
  };
1114
1119
  root.addEventListener("cut", onCut, true);
@@ -1155,9 +1160,9 @@ function focusOf(root) {
1155
1160
  function useTableTarget(controller, held) {
1156
1161
  const [hovered, setHovered] = _react.useState.call(void 0, null);
1157
1162
  const [focus, setFocus] = _react.useState.call(void 0, "none");
1158
- const caret = _chunkGTTPVJSDcjs.useEditorState.call(void 0, controller, caretTarget, sameTarget);
1163
+ const caret = _chunk5M4QG3ZCcjs.useEditorState.call(void 0, controller, caretTarget, sameTarget);
1159
1164
  const hoveredBlock = _nullishCoalesce(_optionalChain([hovered, 'optionalAccess', _63 => _63.target, 'access', _64 => _64.block]), () => ( null));
1160
- const shape = _chunkGTTPVJSDcjs.useEditorState.call(void 0,
1165
+ const shape = _chunk5M4QG3ZCcjs.useEditorState.call(void 0,
1161
1166
  controller,
1162
1167
  _react.useCallback.call(void 0, (state) => hoveredBlock === null ? null : shapeOf(state, hoveredBlock), [hoveredBlock])
1163
1168
  );
@@ -1199,20 +1204,22 @@ function useTableTarget(controller, held) {
1199
1204
  // src/extensions/table/TableControls.tsx
1200
1205
 
1201
1206
  var isFocusKey = (event) => event.key === "F10" && event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
1202
- var takesFocusKey = (state) => _chunkPZ4GT5JOcjs.isCollapsed.call(void 0, state.selection) || cellSelection(state) !== null;
1207
+ var takesFocusKey = (state) => _chunkHOIDJEVIcjs.isCollapsed.call(void 0, state.selection) || cellSelection(state) !== null;
1203
1208
  function TableControls({ controller, labels }) {
1204
- const readOnly = _chunkGTTPVJSDcjs.useReadOnly.call(void 0, controller);
1209
+ const readOnly = _chunk5M4QG3ZCcjs.useReadOnly.call(void 0, controller);
1205
1210
  const [held, setHeld] = _react.useState.call(void 0, null);
1206
1211
  const [focusFor, setFocusFor] = _react.useState.call(void 0, null);
1207
1212
  const [slot, setSlot] = _react.useState.call(void 0, null);
1208
1213
  const target = useTableTarget(controller, _nullishCoalesce(_optionalChain([held, 'optionalAccess', _65 => _65.target]), () => ( null)));
1209
1214
  useCutCells(controller);
1210
1215
  const blockId = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _66 => _66.block]), () => ( null));
1211
- const block = _chunkGTTPVJSDcjs.useEditorState.call(void 0,
1216
+ const block = _chunk5M4QG3ZCcjs.useEditorState.call(void 0,
1212
1217
  controller,
1213
1218
  _react.useCallback.call(void 0, (state) => blockId === null ? null : tableBlock(state.doc, blockId), [blockId])
1214
1219
  );
1215
- if (_optionalChain([held, 'optionalAccess', _67 => _67.menu]) && held.opened && block && !sameMenuCells(held.opened, block, held.target, held.menu)) setHeld(null);
1220
+ if (_optionalChain([held, 'optionalAccess', _67 => _67.menu]) && held.opened && block && held.opened !== block) {
1221
+ setHeld(sameMenuCells(held.opened, block, held.target, held.menu) ? { ...held, opened: block } : null);
1222
+ }
1216
1223
  _react.useEffect.call(void 0, () => {
1217
1224
  if (!readOnly && block !== null) return;
1218
1225
  setHeld(null);
@@ -1223,13 +1230,13 @@ function TableControls({ controller, labels }) {
1223
1230
  const intercept = (event) => {
1224
1231
  const { state } = controller.editor;
1225
1232
  const caret = caretTarget(state);
1226
- if (!isFocusKey(event) || _chunkGTTPVJSDcjs.isComposingKey.call(void 0, controller, event) || caret === null || !takesFocusKey(state)) return false;
1233
+ if (!isFocusKey(event) || _chunk5M4QG3ZCcjs.isComposingKey.call(void 0, controller, event) || caret === null || !takesFocusKey(state)) return false;
1227
1234
  event.preventDefault();
1228
1235
  setHeld({ target: caret, menu: null });
1229
1236
  setFocusFor(caret.block);
1230
1237
  return true;
1231
1238
  };
1232
- return _chunk2VDK27IFcjs.interceptKeys.call(void 0, controller, intercept);
1239
+ return _chunk5R3ISX4Acjs.interceptKeys.call(void 0, controller, intercept);
1233
1240
  }, [controller, readOnly]);
1234
1241
  const onMenu = _react.useCallback.call(void 0,
1235
1242
  (menu) => setHeld(menu === null || target === null || block === null ? null : { target, menu, opened: block }),
@@ -1240,7 +1247,7 @@ function TableControls({ controller, labels }) {
1240
1247
  setFocusFor(null);
1241
1248
  setHeld((current) => _optionalChain([current, 'optionalAccess', _68 => _68.menu]) === null ? null : current);
1242
1249
  }, []);
1243
- _chunkGTTPVJSDcjs.useIsomorphicLayoutEffect.call(void 0, () => {
1250
+ _chunk5M4QG3ZCcjs.useIsomorphicLayoutEffect.call(void 0, () => {
1244
1251
  const drawn = block === null || readOnly ? null : controlsSlot(controller, block.id);
1245
1252
  setSlot((current) => current === drawn ? current : drawn);
1246
1253
  });
@@ -1344,7 +1351,7 @@ function tableExtension(options = {}) {
1344
1351
  blockNames: { TABLE: labels.table },
1345
1352
  overlays: [TableOverlay]
1346
1353
  };
1347
- return _chunkPZ4GT5JOcjs.defineExtension.call(void 0, {
1354
+ return _chunkHOIDJEVIcjs.defineExtension.call(void 0, {
1348
1355
  name: "table",
1349
1356
  priority: ABOVE_CORE_KEYS,
1350
1357
  plugins: [cellSelectionPlugin],
@@ -1375,4 +1382,4 @@ function tableExtension(options = {}) {
1375
1382
 
1376
1383
 
1377
1384
  exports.cellSelectionKey = cellSelectionKey; exports.cellSelectionPlugin = cellSelectionPlugin; exports.cellSelection = cellSelection; exports.cellsInRange = cellsInRange; exports.selectCells = selectCells; exports.deleteCellContents = deleteCellContents; exports.setCellsMark = setCellsMark; exports.addRow = addRow; exports.removeRow = removeRow; exports.moveRow = moveRow; exports.addColumn = addColumn; exports.removeColumn = removeColumn; exports.moveColumn = moveColumn; exports.toggleHeaderRow = toggleHeaderRow; exports.setColumnAlign = setColumnAlign; exports.setColumnWidth = setColumnWidth; exports.insertTable = insertTable; exports.englishTableLabels = englishTableLabels; exports.tableExtension = tableExtension;
1378
- //# sourceMappingURL=chunk-AEJXZBVR.cjs.map
1385
+ //# sourceMappingURL=chunk-56C7GCKO.cjs.map