@pixerate/editor 0.47.0 → 0.49.0

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 (91) hide show
  1. package/dist/agent/index.cjs +248 -29
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +18 -6
  4. package/dist/agent/index.d.ts +18 -6
  5. package/dist/agent/index.js +228 -9
  6. package/dist/agent/index.js.map +1 -1
  7. package/dist/{builtins-xs7rK6ys.d.cts → builtins-1kqwLUnb.d.cts} +1 -1
  8. package/dist/{builtins-D2nMtw2W.d.ts → builtins-BKYlHH1s.d.ts} +1 -1
  9. package/dist/chart/index.cjs +216 -3541
  10. package/dist/chart/index.cjs.map +1 -1
  11. package/dist/chart/index.d.cts +4 -494
  12. package/dist/chart/index.d.ts +4 -494
  13. package/dist/chart/index.js +155 -3480
  14. package/dist/chart/index.js.map +1 -1
  15. package/dist/{chunk-5VXI5GED.js → chunk-2CJ3LPYQ.js} +3 -3
  16. package/dist/{chunk-TXXNBDQX.cjs → chunk-2Q46FKZK.cjs} +113 -34
  17. package/dist/chunk-2Q46FKZK.cjs.map +1 -0
  18. package/dist/chunk-3JNRQVTS.cjs +521 -0
  19. package/dist/chunk-3JNRQVTS.cjs.map +1 -0
  20. package/dist/chunk-5TWIN7ZJ.js +113 -0
  21. package/dist/chunk-5TWIN7ZJ.js.map +1 -0
  22. package/dist/{chunk-PQFAHT5O.js → chunk-DQPBQXKG.js} +27 -94
  23. package/dist/chunk-DQPBQXKG.js.map +1 -0
  24. package/dist/{chunk-ZFBBVGCI.js → chunk-EKYHKQPG.js} +243 -243
  25. package/dist/{chunk-ZFBBVGCI.js.map → chunk-EKYHKQPG.js.map} +1 -1
  26. package/dist/{chunk-J3R2OWOE.cjs → chunk-FEMIVHN3.cjs} +610 -15
  27. package/dist/chunk-FEMIVHN3.cjs.map +1 -0
  28. package/dist/{chunk-C3NWJE3K.js → chunk-GJBIVWB2.js} +11 -672
  29. package/dist/chunk-GJBIVWB2.js.map +1 -0
  30. package/dist/chunk-GTZXF4BI.cjs +3424 -0
  31. package/dist/chunk-GTZXF4BI.cjs.map +1 -0
  32. package/dist/chunk-JOX6MJW4.cjs +674 -0
  33. package/dist/chunk-JOX6MJW4.cjs.map +1 -0
  34. package/dist/{chunk-REAGGLXS.js → chunk-JQ3BB3E6.js} +2 -2
  35. package/dist/{chunk-H4PICYNL.cjs → chunk-LNKZPIQD.cjs} +113 -180
  36. package/dist/chunk-LNKZPIQD.cjs.map +1 -0
  37. package/dist/chunk-OV7UAKIY.js +674 -0
  38. package/dist/chunk-OV7UAKIY.js.map +1 -0
  39. package/dist/{chunk-TK2XZK6Z.js → chunk-QFTVLEVN.js} +596 -1
  40. package/dist/chunk-QFTVLEVN.js.map +1 -0
  41. package/dist/{chunk-KRGXUQ2Y.js → chunk-T6XU4B54.js} +82 -3
  42. package/dist/chunk-T6XU4B54.js.map +1 -0
  43. package/dist/chunk-TGBCBQFV.cjs +113 -0
  44. package/dist/chunk-TGBCBQFV.cjs.map +1 -0
  45. package/dist/{chunk-SQC26VQV.cjs → chunk-UN33YOXW.cjs} +191 -191
  46. package/dist/{chunk-SQC26VQV.cjs.map → chunk-UN33YOXW.cjs.map} +1 -1
  47. package/dist/chunk-WBOAXDKD.js +3424 -0
  48. package/dist/chunk-WBOAXDKD.js.map +1 -0
  49. package/dist/{chunk-LYGEEDNR.cjs → chunk-XP5IUZUO.cjs} +242 -242
  50. package/dist/chunk-XP5IUZUO.cjs.map +1 -0
  51. package/dist/{chunk-BBRK6MOI.cjs → chunk-YU4WQE5M.cjs} +100 -100
  52. package/dist/{chunk-BBRK6MOI.cjs.map → chunk-YU4WQE5M.cjs.map} +1 -1
  53. package/dist/commands/index.d.cts +1 -1
  54. package/dist/commands/index.d.ts +1 -1
  55. package/dist/controller-ChjCCMLl.d.cts +822 -0
  56. package/dist/controller-DtbEo3om.d.ts +822 -0
  57. package/dist/export/index.cjs +4 -2
  58. package/dist/export/index.cjs.map +1 -1
  59. package/dist/export/index.d.cts +5 -1
  60. package/dist/export/index.d.ts +5 -1
  61. package/dist/export/index.js +3 -1
  62. package/dist/extensions/index.cjs +33 -4
  63. package/dist/extensions/index.cjs.map +1 -1
  64. package/dist/extensions/index.d.cts +4 -2
  65. package/dist/extensions/index.d.ts +4 -2
  66. package/dist/extensions/index.js +32 -3
  67. package/dist/{index-QrqMmZ75.d.cts → index-DoHqT1mq.d.cts} +203 -7
  68. package/dist/{index-CSUCQYAH.d.ts → index-YLZ0fKqE.d.ts} +203 -7
  69. package/dist/index.cjs +39 -13
  70. package/dist/index.cjs.map +1 -1
  71. package/dist/index.d.cts +9 -7
  72. package/dist/index.d.ts +9 -7
  73. package/dist/index.js +33 -7
  74. package/dist/index.js.map +1 -1
  75. package/dist/spreadsheet/index.cjs +4 -4
  76. package/dist/spreadsheet/index.js +3 -3
  77. package/package.json +1 -1
  78. package/dist/chunk-C3NWJE3K.js.map +0 -1
  79. package/dist/chunk-H4PICYNL.cjs.map +0 -1
  80. package/dist/chunk-J3R2OWOE.cjs.map +0 -1
  81. package/dist/chunk-KRGXUQ2Y.js.map +0 -1
  82. package/dist/chunk-LYGEEDNR.cjs.map +0 -1
  83. package/dist/chunk-NEOO6QJD.cjs +0 -1182
  84. package/dist/chunk-NEOO6QJD.cjs.map +0 -1
  85. package/dist/chunk-PQFAHT5O.js.map +0 -1
  86. package/dist/chunk-TK2XZK6Z.js.map +0 -1
  87. package/dist/chunk-TXXNBDQX.cjs.map +0 -1
  88. package/dist/types-BVqWm3d1.d.cts +0 -320
  89. package/dist/types-BVqWm3d1.d.ts +0 -320
  90. /package/dist/{chunk-5VXI5GED.js.map → chunk-2CJ3LPYQ.js.map} +0 -0
  91. /package/dist/{chunk-REAGGLXS.js.map → chunk-JQ3BB3E6.js.map} +0 -0
@@ -8,8 +8,8 @@ var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
8
8
 
9
9
 
10
10
 
11
+ var _chunk3JNRQVTScjs = require('./chunk-3JNRQVTS.cjs');
11
12
 
12
- var _chunkNEOO6QJDcjs = require('./chunk-NEOO6QJD.cjs');
13
13
 
14
14
 
15
15
 
@@ -25,7 +25,17 @@ var _chunkNEOO6QJDcjs = require('./chunk-NEOO6QJD.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkJ3R2OWOEcjs = require('./chunk-J3R2OWOE.cjs');
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ var _chunkFEMIVHN3cjs = require('./chunk-FEMIVHN3.cjs');
36
+
37
+
38
+ var _chunkJOX6MJW4cjs = require('./chunk-JOX6MJW4.cjs');
29
39
 
30
40
 
31
41
  var _chunkCS6NZWWAcjs = require('./chunk-CS6NZWWA.cjs');
@@ -2451,13 +2461,13 @@ async function loadCharts(zip, Parser, root, rels, options) {
2451
2461
  const charts = /* @__PURE__ */ new Map();
2452
2462
  if (options.charts === false) return charts;
2453
2463
  for (const el of descendants(root, "chart")) {
2454
- if (el.namespaceURI !== _chunkNEOO6QJDcjs.CHART_OOXML_NS) continue;
2464
+ if (el.namespaceURI !== _chunk3JNRQVTScjs.CHART_OOXML_NS) continue;
2455
2465
  const id = attr(el, "id");
2456
2466
  const rel = id ? rels.get(id) : void 0;
2457
2467
  if (!id || !rel || rel.external || charts.has(id)) continue;
2458
2468
  const entry = zip.get(rel.target);
2459
2469
  if (!entry) continue;
2460
- const read = _chunkNEOO6QJDcjs.chartFromOoxml.call(void 0, await zip.readText(entry), { DOMParser: Parser });
2470
+ const read = _chunk3JNRQVTScjs.chartFromOoxml.call(void 0, await zip.readText(entry), { DOMParser: Parser });
2461
2471
  charts.set(id, {
2462
2472
  id: `chart-${charts.size + 1}`,
2463
2473
  path: rel.target,
@@ -2470,10 +2480,12 @@ async function loadCharts(zip, Parser, root, rels, options) {
2470
2480
  }
2471
2481
  return charts;
2472
2482
  }
2473
- function chartTableHtml(chart) {
2474
- const [head, ...rows] = _chunkNEOO6QJDcjs.chartDataToTable.call(void 0, chart.spec);
2483
+ function chartBlockHtml(chart) {
2484
+ const [head, ...rows] = _chunkJOX6MJW4cjs.chartDataToTable.call(void 0, chart.spec);
2475
2485
  const cell = (v, tag) => `<${tag}><p>${_chunk66IMF6ODcjs.escapeHtml.call(void 0, v === null || v === void 0 ? "" : String(v))}</p></${tag}>`;
2476
- return `<table><tbody><tr>${head.map((h) => cell(h, "th")).join("")}</tr>${rows.map((r) => `<tr>${r.map((v, i) => cell(v, i ? "td" : "th")).join("")}</tr>`).join("")}</tbody></table>`;
2486
+ const table = `<table><tbody><tr>${head.map((h) => cell(h, "th")).join("")}</tr>${rows.map((r) => `<tr>${r.map((v, i) => cell(v, i ? "td" : "th")).join("")}</tr>`).join("")}</tbody></table>`;
2487
+ const caption = `<p>${_chunk66IMF6ODcjs.escapeHtml.call(void 0, `[Chart: ${chart.title || "untitled"}]`)}</p>`;
2488
+ return `<div data-type="chart" data-chart-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, chart.id)}" data-chart="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(chart.spec))}">${caption}${table}</div>`;
2477
2489
  }
2478
2490
  async function loadImages(zip, root, rels, options) {
2479
2491
  const images = /* @__PURE__ */ new Map();
@@ -2943,7 +2955,7 @@ function renderSegments(segments, code = false) {
2943
2955
  if (seg.kind === "text") inner += _chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.text);
2944
2956
  else if (seg.kind === "br") inner += code ? "\n" : "<br>";
2945
2957
  else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.alt)}">`;
2946
- else if (seg.kind === "chart") inner += _chunk66IMF6ODcjs.escapeHtml.call(void 0, `[Chart: ${seg.chart.title || "untitled"}]`);
2958
+ else if (seg.kind === "chart") inner += code ? _chunk66IMF6ODcjs.escapeHtml.call(void 0, `[Chart: ${seg.chart.title || "untitled"}]`) : "";
2947
2959
  else inner += `<sup>${seg.n}</sup>`;
2948
2960
  }
2949
2961
  const format = segments[i].format;
@@ -3122,7 +3134,7 @@ var ParagraphRenderer = (_class2 = class {
3122
3134
  };
3123
3135
  if (child.localName === "AlternateContent") {
3124
3136
  const branch = childElements(child).find(
3125
- (b) => descendants(b, "blip").length || descendants(b, "imagedata").length || descendants(b, "chart").some((el) => el.namespaceURI === _chunkNEOO6QJDcjs.CHART_OOXML_NS)
3137
+ (b) => descendants(b, "blip").length || descendants(b, "imagedata").length || descendants(b, "chart").some((el) => el.namespaceURI === _chunk3JNRQVTScjs.CHART_OOXML_NS)
3126
3138
  );
3127
3139
  if (branch) this.image(branch, format, push);
3128
3140
  return;
@@ -3189,7 +3201,7 @@ var ParagraphRenderer = (_class2 = class {
3189
3201
  /** Charts this paragraph contains, in order. */
3190
3202
  __init4() {this.charts = []}
3191
3203
  image(container, format, push) {
3192
- const chartRef = descendants(container, "chart").find((el) => el.namespaceURI === _chunkNEOO6QJDcjs.CHART_OOXML_NS);
3204
+ const chartRef = descendants(container, "chart").find((el) => el.namespaceURI === _chunk3JNRQVTScjs.CHART_OOXML_NS);
3193
3205
  const chart = chartRef ? this.part.charts.get(_nullishCoalesce(attr(chartRef, "id"), () => ( ""))) : void 0;
3194
3206
  if (chart) {
3195
3207
  if (!this.ctx.charts.includes(chart)) this.ctx.charts.push(chart);
@@ -3334,8 +3346,8 @@ function renderBlocks(container, ctx, part, topLevel = false) {
3334
3346
  const mappedStyle = styleId ? ctx.styleIds.get(styleId) : void 0;
3335
3347
  const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
3336
3348
  const changeAttr = topLevel && !list && ctx.tracked === "marks" ? blockChangeAttr(pPr, ctx) : "";
3337
- const tables = renderer.charts.map(chartTableHtml).join("");
3338
- const blockHtml = (heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`) + tables;
3349
+ const charts = renderer.charts.map(chartBlockHtml).join("");
3350
+ const blockHtml = (charts && !inner && !heading ? "" : heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`) + charts;
3339
3351
  if (!list) {
3340
3352
  closeAll();
3341
3353
  html += blockHtml;
@@ -3628,9 +3640,9 @@ function insertImportedDocument(target, content, options = {}) {
3628
3640
  if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
3629
3641
  from = to = _state.Selection.near(state.doc.resolve(from)).from;
3630
3642
  }
3631
- if (htmlSlice && _chunkJ3R2OWOEcjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkJ3R2OWOEcjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
3643
+ if (htmlSlice && _chunkFEMIVHN3cjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkFEMIVHN3cjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
3632
3644
  const tr2 = state.tr;
3633
- const end2 = _chunkJ3R2OWOEcjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
3645
+ const end2 = _chunkFEMIVHN3cjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
3634
3646
  if (end2 !== null) {
3635
3647
  if (options.at === void 0) tr2.setSelection(_state.Selection.near(tr2.doc.resolve(end2), -1));
3636
3648
  view.dispatch(tr2.scrollIntoView().setMeta("uiEvent", "drop"));
@@ -3807,7 +3819,7 @@ var RichClipboard = _core.Extension.create({
3807
3819
  const slice = _chunkHNDSPZ5Tcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
3808
3820
  if (!slice) return false;
3809
3821
  event.preventDefault();
3810
- if (_chunkJ3R2OWOEcjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
3822
+ if (_chunkFEMIVHN3cjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
3811
3823
  view.dispatch(
3812
3824
  view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")
3813
3825
  );
@@ -4133,90 +4145,6 @@ var Autocorrect = _core.Extension.create({
4133
4145
 
4134
4146
 
4135
4147
 
4136
-
4137
- // src/extensions/document-structure/utils.ts
4138
-
4139
-
4140
- var _transform = require('@tiptap/pm/transform');
4141
- var idCounter = 0;
4142
- function generateStructureId(prefix) {
4143
- idCounter = (idCounter + 1) % 1296;
4144
- const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
4145
- return `${prefix}-${random}${idCounter.toString(36).padStart(2, "0")}`;
4146
- }
4147
- function transactionsInsert(transactions, typeNames) {
4148
- for (const tr of transactions) {
4149
- for (const step of tr.steps) {
4150
- if (!(step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep)) {
4151
- const mark = step.mark;
4152
- if (mark && typeNames.includes(mark.type.name)) return true;
4153
- continue;
4154
- }
4155
- let found = false;
4156
- step.slice.content.descendants((node) => {
4157
- if (found) return false;
4158
- if (typeNames.includes(node.type.name) || node.marks.some((m) => typeNames.includes(m.type.name))) {
4159
- found = true;
4160
- }
4161
- return !found;
4162
- });
4163
- if (found) return true;
4164
- }
4165
- }
4166
- return false;
4167
- }
4168
- function docContains(doc, typeNames) {
4169
- let found = false;
4170
- doc.descendants((node) => {
4171
- if (found) return false;
4172
- if (typeNames.includes(node.type.name) || node.marks.some((m) => typeNames.includes(m.type.name))) {
4173
- found = true;
4174
- }
4175
- return !found;
4176
- });
4177
- return found;
4178
- }
4179
- function presenceStateSpec(typeNames) {
4180
- return {
4181
- init: (_config, state) => docContains(state.doc, typeNames),
4182
- apply: (tr, present, _oldState, newState) => {
4183
- if (!tr.docChanged) return present;
4184
- if (!present && !transactionsInsert([tr], typeNames)) return false;
4185
- return docContains(newState.doc, typeNames);
4186
- }
4187
- };
4188
- }
4189
- function arraysEqual(a, b, eq) {
4190
- if (a.length !== b.length) return false;
4191
- for (let i = 0; i < a.length; i++) {
4192
- if (!eq(a[i], b[i])) return false;
4193
- }
4194
- return true;
4195
- }
4196
- function scrollDomAtPos(view, pos, behavior = "smooth") {
4197
- try {
4198
- const dom = _optionalChain([view, 'optionalAccess', _161 => _161.nodeDOM, 'optionalCall', _162 => _162(pos)]);
4199
- if (dom && typeof dom.scrollIntoView === "function") {
4200
- dom.scrollIntoView({ block: "start", behavior });
4201
- }
4202
- } catch (e3) {
4203
- }
4204
- }
4205
- function syncInitialContent(editor, sync) {
4206
- const { content } = editor.options;
4207
- if (content == null || content === "") return;
4208
- try {
4209
- const doc = _core.createDocument.call(void 0, content, editor.schema, editor.options.parseOptions, {
4210
- errorOnInvalidContent: false
4211
- });
4212
- const tr = sync(_state.EditorState.create({ doc }));
4213
- if (_optionalChain([tr, 'optionalAccess', _163 => _163.docChanged])) editor.options.content = tr.doc;
4214
- } catch (e4) {
4215
- }
4216
- }
4217
- var STRUCTURE_PRIORITY = 45;
4218
-
4219
- // src/extensions/document-structure/outline.ts
4220
4148
  var outlinePluginKey = new (0, _state.PluginKey)("outline");
4221
4149
  var outlineIdPluginKey = new (0, _state.PluginKey)("outlineIds");
4222
4150
  var sameHeading = (a, b) => a.id === b.id && a.level === b.level && a.text === b.text && a.pos === b.pos && a.depth === b.depth;
@@ -4291,8 +4219,8 @@ function createOutlineStore(editor) {
4291
4219
  const compute = () => {
4292
4220
  if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
4293
4221
  const headings = getOutline(editor);
4294
- const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _164 => _164(editor, headings), 'optionalAccess', _165 => _165.id]), () => ( null));
4295
- const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
4222
+ const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _161 => _161(editor, headings), 'optionalAccess', _162 => _162.id]), () => ( null));
4223
+ const sameStructure = _chunkFEMIVHN3cjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
4296
4224
  if (sameStructure && snapshot.activeId === activeId) return snapshot;
4297
4225
  return {
4298
4226
  headings: sameStructure ? snapshot.headings : headings,
@@ -4316,16 +4244,16 @@ function createOutlineStore(editor) {
4316
4244
  subscribe(listener) {
4317
4245
  if (!listeners.size) {
4318
4246
  snapshot = compute();
4319
- _optionalChain([editor, 'optionalAccess', _166 => _166.on, 'call', _167 => _167("transaction", onTransaction)]);
4247
+ _optionalChain([editor, 'optionalAccess', _163 => _163.on, 'call', _164 => _164("transaction", onTransaction)]);
4320
4248
  }
4321
4249
  listeners.add(listener);
4322
4250
  return () => {
4323
4251
  listeners.delete(listener);
4324
- if (!listeners.size) _optionalChain([editor, 'optionalAccess', _168 => _168.off, 'call', _169 => _169("transaction", onTransaction)]);
4252
+ if (!listeners.size) _optionalChain([editor, 'optionalAccess', _165 => _165.off, 'call', _166 => _166("transaction", onTransaction)]);
4325
4253
  };
4326
4254
  },
4327
4255
  destroy() {
4328
- _optionalChain([editor, 'optionalAccess', _170 => _170.off, 'call', _171 => _171("transaction", onTransaction)]);
4256
+ _optionalChain([editor, 'optionalAccess', _167 => _167.off, 'call', _168 => _168("transaction", onTransaction)]);
4329
4257
  listeners.clear();
4330
4258
  }
4331
4259
  };
@@ -4340,7 +4268,7 @@ function navigateToHeading(editor, heading, options = {}) {
4340
4268
  editor.view.dispatch(tr);
4341
4269
  editor.view.focus();
4342
4270
  }
4343
- scrollDomAtPos(editor.view, current.pos, behavior);
4271
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
4344
4272
  return true;
4345
4273
  }
4346
4274
  function assignHeadingIds(state, types, generateId) {
@@ -4365,11 +4293,11 @@ function assignHeadingIds(state, types, generateId) {
4365
4293
  }
4366
4294
  var Outline = _core.Extension.create({
4367
4295
  name: "outline",
4368
- priority: STRUCTURE_PRIORITY,
4296
+ priority: _chunkFEMIVHN3cjs.STRUCTURE_PRIORITY,
4369
4297
  addOptions() {
4370
4298
  return {
4371
4299
  types: ["heading"],
4372
- generateId: () => generateStructureId("h"),
4300
+ generateId: () => _chunkFEMIVHN3cjs.generateStructureId.call(void 0, "h"),
4373
4301
  onUpdate: void 0
4374
4302
  };
4375
4303
  },
@@ -4400,16 +4328,16 @@ var Outline = _core.Extension.create({
4400
4328
  if (options.focus !== false) {
4401
4329
  tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
4402
4330
  tr.scrollIntoView();
4403
- _optionalChain([view, 'optionalAccess', _172 => _172.focus, 'optionalCall', _173 => _173()]);
4331
+ _optionalChain([view, 'optionalAccess', _169 => _169.focus, 'optionalCall', _170 => _170()]);
4404
4332
  }
4405
- scrollDomAtPos(view, heading.pos, options.behavior);
4333
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4406
4334
  }
4407
4335
  return true;
4408
4336
  },
4409
4337
  scrollToHeading: (id, options = {}) => ({ state, dispatch, view }) => {
4410
4338
  const heading = findHeading(state, id);
4411
4339
  if (!heading) return false;
4412
- if (dispatch) scrollDomAtPos(view, heading.pos, options.behavior);
4340
+ if (dispatch) _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
4413
4341
  return true;
4414
4342
  }
4415
4343
  };
@@ -4430,9 +4358,9 @@ var Outline = _core.Extension.create({
4430
4358
  apply: (tr, prev, _oldState, newState) => {
4431
4359
  if (!tr.docChanged) return prev;
4432
4360
  const next = computeOutline(newState.doc, types);
4433
- if (arraysEqual(prev, next, sameHeading)) return prev;
4361
+ if (_chunkFEMIVHN3cjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
4434
4362
  storage.headings = next;
4435
- _optionalChain([onUpdate, 'call', _174 => _174(), 'optionalCall', _175 => _175(next)]);
4363
+ _optionalChain([onUpdate, 'call', _171 => _171(), 'optionalCall', _172 => _172(next)]);
4436
4364
  return next;
4437
4365
  }
4438
4366
  }
@@ -4448,7 +4376,7 @@ var Outline = _core.Extension.create({
4448
4376
  },
4449
4377
  onBeforeCreate() {
4450
4378
  const { types, generateId } = this.options;
4451
- syncInitialContent(this.editor, (state) => assignHeadingIds(state, types, generateId));
4379
+ _chunkFEMIVHN3cjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
4452
4380
  }
4453
4381
  });
4454
4382
 
@@ -4618,7 +4546,7 @@ function syncTableOfContents(state, headingTypes) {
4618
4546
  node.attrs.minLevel,
4619
4547
  node.attrs.maxLevel
4620
4548
  );
4621
- if (!arraysEqual(_nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
4549
+ if (!_chunkFEMIVHN3cjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
4622
4550
  tr = _nullishCoalesce(tr, () => ( state.tr));
4623
4551
  tr.setNodeMarkup(pos, void 0, { ...node.attrs, entries });
4624
4552
  }
@@ -4630,7 +4558,7 @@ function syncTableOfContents(state, headingTypes) {
4630
4558
  }
4631
4559
  var TableOfContents = _core.Node.create({
4632
4560
  name: "tableOfContents",
4633
- priority: STRUCTURE_PRIORITY - 5,
4561
+ priority: _chunkFEMIVHN3cjs.STRUCTURE_PRIORITY - 5,
4634
4562
  group: "block",
4635
4563
  atom: true,
4636
4564
  selectable: true,
@@ -4741,7 +4669,7 @@ var TableOfContents = _core.Node.create({
4741
4669
  return [
4742
4670
  new (0, _state.Plugin)({
4743
4671
  key: tableOfContentsPluginKey,
4744
- state: presenceStateSpec([this.name]),
4672
+ state: _chunkFEMIVHN3cjs.presenceStateSpec.call(void 0, [this.name]),
4745
4673
  appendTransaction: (transactions, _oldState, newState) => {
4746
4674
  if (!transactions.some((tr) => tr.docChanged)) return null;
4747
4675
  if (!tableOfContentsPluginKey.getState(newState)) return null;
@@ -4751,7 +4679,7 @@ var TableOfContents = _core.Node.create({
4751
4679
  handleDOMEvents: {
4752
4680
  click: (view, event) => {
4753
4681
  const target = event.target;
4754
- const link = _optionalChain([target, 'optionalAccess', _176 => _176.closest, 'optionalCall', _177 => _177(
4682
+ const link = _optionalChain([target, 'optionalAccess', _173 => _173.closest, 'optionalCall', _174 => _174(
4755
4683
  'nav[data-type="table-of-contents"] a[data-heading-id]'
4756
4684
  )]);
4757
4685
  if (!link) return false;
@@ -4765,7 +4693,7 @@ var TableOfContents = _core.Node.create({
4765
4693
  );
4766
4694
  view.focus();
4767
4695
  }
4768
- scrollDomAtPos(view, heading.pos);
4696
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, heading.pos);
4769
4697
  return true;
4770
4698
  }
4771
4699
  }
@@ -4775,7 +4703,7 @@ var TableOfContents = _core.Node.create({
4775
4703
  },
4776
4704
  onBeforeCreate() {
4777
4705
  const { headingTypes } = this.options;
4778
- syncInitialContent(this.editor, (state) => syncTableOfContents(state, headingTypes));
4706
+ _chunkFEMIVHN3cjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
4779
4707
  }
4780
4708
  });
4781
4709
 
@@ -4824,7 +4752,7 @@ function getFootnotes(doc) {
4824
4752
  number: index + 1,
4825
4753
  text: footnote ? footnoteText(footnote.node) : "",
4826
4754
  referencePos: ref.pos,
4827
- footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _178 => _178.pos]), () => ( null))
4755
+ footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _175 => _175.pos]), () => ( null))
4828
4756
  };
4829
4757
  });
4830
4758
  }
@@ -4833,7 +4761,7 @@ function syncFootnotes(tr, options = {}) {
4833
4761
  const listType = schema.nodes[LIST];
4834
4762
  const itemType = schema.nodes[ITEM];
4835
4763
  if (!listType || !itemType) return false;
4836
- const generateId = _nullishCoalesce(options.generateId, () => ( (() => generateStructureId("fn"))));
4764
+ const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunkFEMIVHN3cjs.generateStructureId.call(void 0, "fn"))));
4837
4765
  const refs = [];
4838
4766
  const lists = [];
4839
4767
  const existing = /* @__PURE__ */ new Map();
@@ -4866,7 +4794,7 @@ function syncFootnotes(tr, options = {}) {
4866
4794
  });
4867
4795
  const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
4868
4796
  const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
4869
- const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _179 => _179.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _180 => _180.contents, 'optionalAccess', _181 => _181[id]]), () => ( "")))));
4797
+ const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _177 => _177.contents, 'optionalAccess', _178 => _178[id]]), () => ( "")))));
4870
4798
  if (source && source.attrs.id === id && source.attrs.number === number) {
4871
4799
  return source;
4872
4800
  }
@@ -4917,7 +4845,7 @@ function findReferences(doc, id) {
4917
4845
  }
4918
4846
  var FootnoteReference = _core.Node.create({
4919
4847
  name: REFERENCE,
4920
- priority: STRUCTURE_PRIORITY - 5,
4848
+ priority: _chunkFEMIVHN3cjs.STRUCTURE_PRIORITY - 5,
4921
4849
  group: "inline",
4922
4850
  inline: true,
4923
4851
  atom: true,
@@ -4925,7 +4853,7 @@ var FootnoteReference = _core.Node.create({
4925
4853
  addOptions() {
4926
4854
  return {
4927
4855
  HTMLAttributes: {},
4928
- generateId: () => generateStructureId("fn")
4856
+ generateId: () => _chunkFEMIVHN3cjs.generateStructureId.call(void 0, "fn")
4929
4857
  };
4930
4858
  },
4931
4859
  addAttributes() {
@@ -5036,7 +4964,7 @@ var FootnoteReference = _core.Node.create({
5036
4964
  _state.TextSelection.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
5037
4965
  );
5038
4966
  tr.scrollIntoView();
5039
- scrollDomAtPos(view, footnote.pos);
4967
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, footnote.pos);
5040
4968
  }
5041
4969
  return true;
5042
4970
  },
@@ -5046,7 +4974,7 @@ var FootnoteReference = _core.Node.create({
5046
4974
  if (dispatch) {
5047
4975
  tr.setSelection(_state.NodeSelection.create(tr.doc, ref.pos));
5048
4976
  tr.scrollIntoView();
5049
- scrollDomAtPos(view, ref.pos);
4977
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, ref.pos);
5050
4978
  }
5051
4979
  return true;
5052
4980
  }
@@ -5058,7 +4986,7 @@ var FootnoteReference = _core.Node.create({
5058
4986
  return [
5059
4987
  new (0, _state.Plugin)({
5060
4988
  key: footnotesPluginKey,
5061
- state: presenceStateSpec([REFERENCE, LIST]),
4989
+ state: _chunkFEMIVHN3cjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
5062
4990
  appendTransaction: (transactions, _oldState, newState) => {
5063
4991
  if (!transactions.some((tr2) => tr2.docChanged)) return null;
5064
4992
  if (!footnotesPluginKey.getState(newState)) return null;
@@ -5069,7 +4997,7 @@ var FootnoteReference = _core.Node.create({
5069
4997
  handleClickOn: (_view, _pos, node, _nodePos, event) => {
5070
4998
  if (node.type.name !== REFERENCE || !node.attrs.id) return false;
5071
4999
  const target = event.target;
5072
- if (!_optionalChain([target, 'optionalAccess', _182 => _182.closest, 'optionalCall', _183 => _183("a")])) return false;
5000
+ if (!_optionalChain([target, 'optionalAccess', _179 => _179.closest, 'optionalCall', _180 => _180("a")])) return false;
5073
5001
  event.preventDefault();
5074
5002
  return editor.commands.goToFootnote(node.attrs.id);
5075
5003
  }
@@ -5079,7 +5007,7 @@ var FootnoteReference = _core.Node.create({
5079
5007
  },
5080
5008
  onBeforeCreate() {
5081
5009
  const { generateId } = this.options;
5082
- syncInitialContent(this.editor, (state) => {
5010
+ _chunkFEMIVHN3cjs.syncInitialContent.call(void 0, this.editor, (state) => {
5083
5011
  const tr = state.tr;
5084
5012
  return syncFootnotes(tr, { generateId }) ? tr : null;
5085
5013
  });
@@ -5219,7 +5147,7 @@ var Bookmark = _core.Mark.create({
5219
5147
  addOptions() {
5220
5148
  return {
5221
5149
  HTMLAttributes: {},
5222
- generateId: () => generateStructureId("bm")
5150
+ generateId: () => _chunkFEMIVHN3cjs.generateStructureId.call(void 0, "bm")
5223
5151
  };
5224
5152
  },
5225
5153
  addAttributes() {
@@ -5267,7 +5195,7 @@ var Bookmark = _core.Mark.create({
5267
5195
  }
5268
5196
  if (!dispatch) return true;
5269
5197
  const sameName = getBookmarks(state.doc).find((b) => b.name === name);
5270
- const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _184 => _184.id]))), () => ( this.options.generateId()));
5198
+ const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _181 => _181.id]))), () => ( this.options.generateId()));
5271
5199
  if (sameName) {
5272
5200
  forEachBookmarkRange(
5273
5201
  tr.doc,
@@ -5304,7 +5232,7 @@ var Bookmark = _core.Mark.create({
5304
5232
  tr.setSelection(_state.TextSelection.create(tr.doc, bookmark.from, bookmark.to));
5305
5233
  tr.scrollIntoView();
5306
5234
  const domPos = state.doc.resolve(bookmark.from);
5307
- scrollDomAtPos(view, domPos.before(domPos.depth));
5235
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
5308
5236
  }
5309
5237
  return true;
5310
5238
  }
@@ -5369,7 +5297,7 @@ function syncCrossReferences(state, headingTypes) {
5369
5297
  }
5370
5298
  var CrossReference = _core.Node.create({
5371
5299
  name: NAME,
5372
- priority: STRUCTURE_PRIORITY - 5,
5300
+ priority: _chunkFEMIVHN3cjs.STRUCTURE_PRIORITY - 5,
5373
5301
  group: "inline",
5374
5302
  inline: true,
5375
5303
  atom: true,
@@ -5471,7 +5399,7 @@ var CrossReference = _core.Node.create({
5471
5399
  if (dispatch) {
5472
5400
  tr.setSelection(_state.TextSelection.create(tr.doc, range.from, range.to));
5473
5401
  tr.scrollIntoView();
5474
- scrollDomAtPos(view, range.blockPos);
5402
+ _chunkFEMIVHN3cjs.scrollDomAtPos.call(void 0, view, range.blockPos);
5475
5403
  }
5476
5404
  return true;
5477
5405
  }
@@ -5483,7 +5411,7 @@ var CrossReference = _core.Node.create({
5483
5411
  return [
5484
5412
  new (0, _state.Plugin)({
5485
5413
  key: crossReferencePluginKey,
5486
- state: presenceStateSpec([NAME]),
5414
+ state: _chunkFEMIVHN3cjs.presenceStateSpec.call(void 0, [NAME]),
5487
5415
  appendTransaction: (transactions, _oldState, newState) => {
5488
5416
  if (!transactions.some((tr) => tr.docChanged)) return null;
5489
5417
  if (!crossReferencePluginKey.getState(newState)) return null;
@@ -5502,14 +5430,14 @@ var CrossReference = _core.Node.create({
5502
5430
  },
5503
5431
  onBeforeCreate() {
5504
5432
  const { headingTypes } = this.options;
5505
- syncInitialContent(this.editor, (state) => syncCrossReferences(state, headingTypes));
5433
+ _chunkFEMIVHN3cjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
5506
5434
  }
5507
5435
  });
5508
5436
 
5509
5437
  // src/extensions/document-structure/command-items.ts
5510
5438
  var start = (editor, args) => {
5511
5439
  const chain = editor.chain().focus();
5512
- return _optionalChain([args, 'optionalAccess', _185 => _185.range]) ? chain.deleteRange(args.range) : chain;
5440
+ return _optionalChain([args, 'optionalAccess', _182 => _182.range]) ? chain.deleteRange(args.range) : chain;
5513
5441
  };
5514
5442
  var documentStructureCommandItems = [
5515
5443
  {
@@ -5526,7 +5454,7 @@ var documentStructureCommandItems = [
5526
5454
  description: "Insert a numbered footnote",
5527
5455
  keywords: ["footnote", "note", "fn", "citation"],
5528
5456
  extension: "footnoteReference",
5529
- run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _186 => _186.content]) }).run()
5457
+ run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _183 => _183.content]) }).run()
5530
5458
  },
5531
5459
  {
5532
5460
  id: "bookmark",
@@ -5535,7 +5463,7 @@ var documentStructureCommandItems = [
5535
5463
  keywords: ["bookmark", "anchor", "name"],
5536
5464
  extension: "bookmark",
5537
5465
  requires: "name",
5538
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _187 => _187.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5466
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _184 => _184.name]) && start(editor, args).setBookmark({ name: args.name }).run()
5539
5467
  },
5540
5468
  {
5541
5469
  id: "cross-reference",
@@ -5544,7 +5472,7 @@ var documentStructureCommandItems = [
5544
5472
  keywords: ["cross", "reference", "xref", "link", "ref"],
5545
5473
  extension: "crossReference",
5546
5474
  requires: "target",
5547
- run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _188 => _188.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5475
+ run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _185 => _185.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
5548
5476
  }
5549
5477
  ];
5550
5478
  function getDocumentStructureCommandItems(editor, query = "") {
@@ -5603,13 +5531,13 @@ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__ini
5603
5531
  }, _class3);
5604
5532
  var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
5605
5533
  function getFindReplaceState(source) {
5606
- const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _189 => _189.state]), () => ( source));
5534
+ const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _186 => _186.state]), () => ( source));
5607
5535
  if (!state || typeof state.plugins === "undefined") return null;
5608
5536
  const plugin = findReplacePluginKey.getState(state);
5609
5537
  return plugin ? toSnapshot(plugin) : null;
5610
5538
  }
5611
5539
  function getFindReplaceStore(editor) {
5612
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _190 => _190.storage, 'optionalAccess', _191 => _191.findReplace, 'optionalAccess', _192 => _192.store]), () => ( null));
5540
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _187 => _187.storage, 'optionalAccess', _188 => _188.findReplace, 'optionalAccess', _189 => _189.store]), () => ( null));
5613
5541
  }
5614
5542
  var snapshotCache = /* @__PURE__ */ new WeakMap();
5615
5543
  function toSnapshot(s) {
@@ -5757,7 +5685,7 @@ var FindReplace = _core.Extension.create({
5757
5685
  if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
5758
5686
  if (dispatch) {
5759
5687
  _history.closeHistory.call(void 0, tr);
5760
- const [end] = _chunkJ3R2OWOEcjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
5688
+ const [end] = _chunkFEMIVHN3cjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
5761
5689
  tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
5762
5690
  meta(tr, { type: "replaced", anchor: end, count: 1 });
5763
5691
  }
@@ -5768,7 +5696,7 @@ var FindReplace = _core.Extension.create({
5768
5696
  if (!s || !s.active || !s.matches.length) return false;
5769
5697
  if (dispatch) {
5770
5698
  _history.closeHistory.call(void 0, tr);
5771
- const ends = _chunkJ3R2OWOEcjs.applyReplacements.call(void 0, tr, s.matches);
5699
+ const ends = _chunkFEMIVHN3cjs.applyReplacements.call(void 0, tr, s.matches);
5772
5700
  meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
5773
5701
  }
5774
5702
  return true;
@@ -5780,7 +5708,7 @@ var FindReplace = _core.Extension.create({
5780
5708
  const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
5781
5709
  const step = (forward) => () => {
5782
5710
  const s = findReplacePluginKey.getState(this.editor.state);
5783
- if (!_optionalChain([s, 'optionalAccess', _193 => _193.active]) || !s.matches.length) return false;
5711
+ if (!_optionalChain([s, 'optionalAccess', _190 => _190.active]) || !s.matches.length) return false;
5784
5712
  return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
5785
5713
  };
5786
5714
  return {
@@ -5800,7 +5728,7 @@ var FindReplace = _core.Extension.create({
5800
5728
  if (!s.active || !s.query) {
5801
5729
  return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
5802
5730
  }
5803
- const result = _chunkJ3R2OWOEcjs.searchDocument.call(void 0, doc, s.query, s.options, {
5731
+ const result = _chunkFEMIVHN3cjs.searchDocument.call(void 0, doc, s.query, s.options, {
5804
5732
  replacement: s.replacement,
5805
5733
  clipboardText: safeClipboard(options.getClipboardText),
5806
5734
  timeLimitMs: options.timeLimitMs,
@@ -5893,7 +5821,7 @@ var FindReplace = _core.Extension.create({
5893
5821
  s = {
5894
5822
  ...s,
5895
5823
  currentIndex: m.index,
5896
- anchor: _nullishCoalesce(_optionalChain([s, 'access', _194 => _194.matches, 'access', _195 => _195[m.index], 'optionalAccess', _196 => _196.from]), () => ( s.anchor))
5824
+ anchor: _nullishCoalesce(_optionalChain([s, 'access', _191 => _191.matches, 'access', _192 => _192[m.index], 'optionalAccess', _193 => _193.from]), () => ( s.anchor))
5897
5825
  };
5898
5826
  redecorate = true;
5899
5827
  break;
@@ -5909,7 +5837,7 @@ var FindReplace = _core.Extension.create({
5909
5837
  }
5910
5838
  },
5911
5839
  props: {
5912
- decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _197 => _197.getState, 'call', _198 => _198(state), 'optionalAccess', _199 => _199.decorations]), () => ( _view2.DecorationSet.empty))
5840
+ decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _194 => _194.getState, 'call', _195 => _195(state), 'optionalAccess', _196 => _196.decorations]), () => ( _view2.DecorationSet.empty))
5913
5841
  },
5914
5842
  view: (view) => {
5915
5843
  const sync = () => {
@@ -5926,7 +5854,7 @@ var FindReplace = _core.Extension.create({
5926
5854
  function safeClipboard(get) {
5927
5855
  try {
5928
5856
  return String(_nullishCoalesce(get(), () => ( "")));
5929
- } catch (e5) {
5857
+ } catch (e3) {
5930
5858
  return "";
5931
5859
  }
5932
5860
  }
@@ -5938,11 +5866,11 @@ var STYLE_ID_ATTRIBUTE = "styleId";
5938
5866
  var CHARACTER_STYLE_MARK_NAME = "characterStyle";
5939
5867
  var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
5940
5868
  function getStyleRegistry(editor) {
5941
- return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _200 => _200.storage, 'optionalAccess', _201 => _201.paragraphStyles, 'optionalAccess', _202 => _202.registry]), () => ( null));
5869
+ return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _197 => _197.storage, 'optionalAccess', _198 => _198.paragraphStyles, 'optionalAccess', _199 => _199.registry]), () => ( null));
5942
5870
  }
5943
5871
  function headingLevels(editor) {
5944
- const heading = _optionalChain([editor, 'optionalAccess', _203 => _203.extensionManager, 'optionalAccess', _204 => _204.extensions, 'access', _205 => _205.find, 'call', _206 => _206((e) => e.name === "heading")]);
5945
- const levels = _optionalChain([heading, 'optionalAccess', _207 => _207.options, 'optionalAccess', _208 => _208.levels]);
5872
+ const heading = _optionalChain([editor, 'optionalAccess', _200 => _200.extensionManager, 'optionalAccess', _201 => _201.extensions, 'access', _202 => _202.find, 'call', _203 => _203((e) => e.name === "heading")]);
5873
+ const levels = _optionalChain([heading, 'optionalAccess', _204 => _204.options, 'optionalAccess', _205 => _205.levels]);
5946
5874
  return Array.isArray(levels) ? levels : null;
5947
5875
  }
5948
5876
  function isParagraphStyleAvailable(editor, registry, id) {
@@ -5952,7 +5880,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
5952
5880
  if (!editor.schema.nodes[block.type]) return false;
5953
5881
  if (block.type === "heading") {
5954
5882
  const levels = headingLevels(editor);
5955
- if (levels && !levels.includes(Number(_optionalChain([block, 'access', _209 => _209.attrs, 'optionalAccess', _210 => _210.level])))) return false;
5883
+ if (levels && !levels.includes(Number(_optionalChain([block, 'access', _206 => _206.attrs, 'optionalAccess', _207 => _207.level])))) return false;
5956
5884
  }
5957
5885
  return true;
5958
5886
  }
@@ -5992,7 +5920,7 @@ function captureSelectionFormat(state) {
5992
5920
  if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
5993
5921
  });
5994
5922
  const paragraph = {};
5995
- const align = _optionalChain([state, 'access', _211 => _211.selection, 'access', _212 => _212.$from, 'access', _213 => _213.parent, 'access', _214 => _214.attrs, 'optionalAccess', _215 => _215.textAlign]);
5923
+ const align = _optionalChain([state, 'access', _208 => _208.selection, 'access', _209 => _209.$from, 'access', _210 => _210.parent, 'access', _211 => _211.attrs, 'optionalAccess', _212 => _212.textAlign]);
5996
5924
  if (align && align !== "left") paragraph.textAlign = align;
5997
5925
  return { paragraph, character };
5998
5926
  }
@@ -6017,10 +5945,10 @@ function applyStyleToBlock(tr, pos, id, registry) {
6017
5945
  if (node.type === type && Object.entries(attrs).every(([k, v]) => node.attrs[k] === v)) return false;
6018
5946
  try {
6019
5947
  tr.setNodeMarkup(pos, type, attrs);
6020
- } catch (e6) {
5948
+ } catch (e4) {
6021
5949
  try {
6022
5950
  tr.setBlockType(pos + 1, pos + 1, type, attrs);
6023
- } catch (e7) {
5951
+ } catch (e5) {
6024
5952
  return false;
6025
5953
  }
6026
5954
  }
@@ -6158,7 +6086,7 @@ var ParagraphStyles = _core.Extension.create({
6158
6086
  },
6159
6087
  clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunk3CC7OPUQcjs.NORMAL_STYLE_ID),
6160
6088
  setCharacterStyle: (id) => ({ commands }) => {
6161
- if (_optionalChain([registry, 'call', _216 => _216(), 'access', _217 => _217.get, 'call', _218 => _218(id), 'optionalAccess', _219 => _219.kind]) !== "character") return false;
6089
+ if (_optionalChain([registry, 'call', _213 => _213(), 'access', _214 => _214.get, 'call', _215 => _215(id), 'optionalAccess', _216 => _216.kind]) !== "character") return false;
6162
6090
  return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
6163
6091
  },
6164
6092
  unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
@@ -6224,7 +6152,7 @@ var ParagraphStyles = _core.Extension.create({
6224
6152
  };
6225
6153
  },
6226
6154
  onDestroy() {
6227
- _optionalChain([this, 'access', _220 => _220.storage, 'access', _221 => _221.cleanup, 'optionalCall', _222 => _222()]);
6155
+ _optionalChain([this, 'access', _217 => _217.storage, 'access', _218 => _218.cleanup, 'optionalCall', _219 => _219()]);
6228
6156
  }
6229
6157
  });
6230
6158
  var EMPTY_STYLES = Object.freeze({
@@ -6262,8 +6190,8 @@ function createParagraphStylesStore(editor) {
6262
6190
  }
6263
6191
  };
6264
6192
  const detach = () => {
6265
- _optionalChain([editor, 'optionalAccess', _223 => _223.off, 'call', _224 => _224("transaction", update)]);
6266
- _optionalChain([unsubscribeRegistry, 'optionalCall', _225 => _225()]);
6193
+ _optionalChain([editor, 'optionalAccess', _220 => _220.off, 'call', _221 => _221("transaction", update)]);
6194
+ _optionalChain([unsubscribeRegistry, 'optionalCall', _222 => _222()]);
6267
6195
  unsubscribeRegistry = null;
6268
6196
  };
6269
6197
  return {
@@ -6274,7 +6202,7 @@ function createParagraphStylesStore(editor) {
6274
6202
  subscribe(listener) {
6275
6203
  if (!listeners.size) {
6276
6204
  snapshot = compute();
6277
- _optionalChain([editor, 'optionalAccess', _226 => _226.on, 'call', _227 => _227("transaction", update)]);
6205
+ _optionalChain([editor, 'optionalAccess', _223 => _223.on, 'call', _224 => _224("transaction", update)]);
6278
6206
  unsubscribeRegistry = registry ? registry.subscribe(update) : null;
6279
6207
  }
6280
6208
  listeners.add(listener);
@@ -6291,7 +6219,7 @@ function createParagraphStylesStore(editor) {
6291
6219
  }
6292
6220
 
6293
6221
  // src/extensions/rich-text-preset.ts
6294
- var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _228 => _228[name]]) || _optionalChain([mod, 'optionalAccess', _229 => _229.default, 'optionalAccess', _230 => _230[name]]) || _optionalChain([mod, 'optionalAccess', _231 => _231.default, 'optionalAccess', _232 => _232.default]) || _optionalChain([mod, 'optionalAccess', _233 => _233.default]) || mod;
6222
+ var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _225 => _225[name]]) || _optionalChain([mod, 'optionalAccess', _226 => _226.default, 'optionalAccess', _227 => _227[name]]) || _optionalChain([mod, 'optionalAccess', _228 => _228.default, 'optionalAccess', _229 => _229.default]) || _optionalChain([mod, 'optionalAccess', _230 => _230.default]) || mod;
6295
6223
  var StarterKit = resolveExt3(_StarterKit, "StarterKit");
6296
6224
  var Color = resolveExt3(_Color, "Color");
6297
6225
  var Highlight = resolveExt3(_Highlight, "Highlight");
@@ -6372,7 +6300,7 @@ function createRichTextPreset(options = {}) {
6372
6300
  find: /^\s*(\[([ |x])?\])\s$/i,
6373
6301
  type: this.type,
6374
6302
  getAttributes: (match) => ({
6375
- checked: _optionalChain([match, 'access', _234 => _234[2], 'optionalAccess', _235 => _235.toLowerCase, 'call', _236 => _236()]) === "x"
6303
+ checked: _optionalChain([match, 'access', _231 => _231[2], 'optionalAccess', _232 => _232.toLowerCase, 'call', _233 => _233()]) === "x"
6376
6304
  })
6377
6305
  })
6378
6306
  ];
@@ -6387,7 +6315,7 @@ function createRichTextPreset(options = {}) {
6387
6315
  })
6388
6316
  ];
6389
6317
  if (options.table !== false) {
6390
- extensions2.push(..._chunkJ3R2OWOEcjs.createTableExtensions.call(void 0, optionObject(options.table)));
6318
+ extensions2.push(..._chunkFEMIVHN3cjs.createTableExtensions.call(void 0, optionObject(options.table)));
6391
6319
  }
6392
6320
  if (characterLimit) {
6393
6321
  extensions2.push(
@@ -6492,6 +6420,11 @@ function createRichTextPreset(options = {}) {
6492
6420
  if (options.findReplace) {
6493
6421
  extensions2.push(FindReplace.configure(optionObject(options.findReplace)));
6494
6422
  }
6423
+ if (options.chart) {
6424
+ const { sparkline = true, ...chartOptions } = optionObject(options.chart);
6425
+ extensions2.push(_chunkFEMIVHN3cjs.Chart.configure(chartOptions));
6426
+ if (sparkline) extensions2.push(_chunkFEMIVHN3cjs.Sparkline.configure(optionObject(sparkline)));
6427
+ }
6495
6428
  if (options.paragraphStyles) {
6496
6429
  extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
6497
6430
  }
@@ -6543,7 +6476,7 @@ function createFindReplaceCommands(editor, options = {}) {
6543
6476
  const hasMatches = () => {
6544
6477
  const ok = usable(editor);
6545
6478
  if (ok !== true) return ok;
6546
- return _optionalChain([state, 'call', _237 => _237(), 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]) ? true : "No matches.";
6479
+ return _optionalChain([state, 'call', _234 => _234(), 'optionalAccess', _235 => _235.matches, 'access', _236 => _236.length]) ? true : "No matches.";
6547
6480
  };
6548
6481
  const apply = (params) => {
6549
6482
  const split = splitParams(params);
@@ -6551,7 +6484,7 @@ function createFindReplaceCommands(editor, options = {}) {
6551
6484
  };
6552
6485
  const failIfInvalid = () => {
6553
6486
  const s = state();
6554
- if (_optionalChain([s, 'optionalAccess', _240 => _240.error])) throw new Error(s.error.message);
6487
+ if (_optionalChain([s, 'optionalAccess', _237 => _237.error])) throw new Error(s.error.message);
6555
6488
  };
6556
6489
  return [
6557
6490
  {
@@ -6590,9 +6523,9 @@ function createFindReplaceCommands(editor, options = {}) {
6590
6523
  failIfInvalid();
6591
6524
  const s = state();
6592
6525
  return {
6593
- count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches, 'access', _242 => _242.length]), () => ( 0)),
6594
- truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _243 => _243.truncated]), () => ( false)),
6595
- matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _244 => _244.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6526
+ count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]), () => ( 0)),
6527
+ truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _240 => _240.truncated]), () => ( false)),
6528
+ matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
6596
6529
  };
6597
6530
  }
6598
6531
  },
@@ -6619,11 +6552,11 @@ function createFindReplaceCommands(editor, options = {}) {
6619
6552
  description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
6620
6553
  params: searchParams(true),
6621
6554
  ...scope,
6622
- enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _245 => _245.query]) !== void 0 ? usable(editor) : hasMatches(),
6555
+ enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _242 => _242.query]) !== void 0 ? usable(editor) : hasMatches(),
6623
6556
  run: (_ctx, params) => {
6624
6557
  apply(params);
6625
6558
  failIfInvalid();
6626
- const count = _nullishCoalesce(_optionalChain([state, 'call', _246 => _246(), 'optionalAccess', _247 => _247.matches, 'access', _248 => _248.length]), () => ( 0));
6559
+ const count = _nullishCoalesce(_optionalChain([state, 'call', _243 => _243(), 'optionalAccess', _244 => _244.matches, 'access', _245 => _245.length]), () => ( 0));
6627
6560
  if (count) editor.commands.replaceAll();
6628
6561
  return { replaced: count };
6629
6562
  }
@@ -6631,7 +6564,7 @@ function createFindReplaceCommands(editor, options = {}) {
6631
6564
  ];
6632
6565
  }
6633
6566
  function validateFindPattern(query, options = {}) {
6634
- const result = _chunkJ3R2OWOEcjs.compileFindPattern.call(void 0, query, options);
6567
+ const result = _chunkFEMIVHN3cjs.compileFindPattern.call(void 0, query, options);
6635
6568
  return result.ok ? null : result.error;
6636
6569
  }
6637
6570
 
@@ -6640,8 +6573,8 @@ var PARAMS = {
6640
6573
  insertTable: {
6641
6574
  type: "object",
6642
6575
  properties: {
6643
- rows: { type: "integer", minimum: 1, maximum: _chunkJ3R2OWOEcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
6644
- cols: { type: "integer", minimum: 1, maximum: _chunkJ3R2OWOEcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
6576
+ rows: { type: "integer", minimum: 1, maximum: _chunkFEMIVHN3cjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
6577
+ cols: { type: "integer", minimum: 1, maximum: _chunkFEMIVHN3cjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
6645
6578
  withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
6646
6579
  },
6647
6580
  additionalProperties: false
@@ -6672,7 +6605,7 @@ function createTableCommands(editor, options = {}) {
6672
6605
  const group = _nullishCoalesce(options.group, () => ( "Table"));
6673
6606
  const scope = options.scope ? { scope: options.scope } : {};
6674
6607
  const focus = _nullishCoalesce(options.focus, () => ( true));
6675
- return _chunkJ3R2OWOEcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
6608
+ return _chunkFEMIVHN3cjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
6676
6609
  const params = PARAMS[action];
6677
6610
  return {
6678
6611
  id: `${prefix}${action}`,
@@ -6682,13 +6615,13 @@ function createTableCommands(editor, options = {}) {
6682
6615
  description,
6683
6616
  ...params ? { params } : {},
6684
6617
  ...scope,
6685
- enabled: (_ctx, p) => _chunkJ3R2OWOEcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
6618
+ enabled: (_ctx, p) => _chunkFEMIVHN3cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
6686
6619
  run: (_ctx, p) => {
6687
- if (!_chunkJ3R2OWOEcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
6688
- const reason = _chunkJ3R2OWOEcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
6620
+ if (!_chunkFEMIVHN3cjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
6621
+ const reason = _chunkFEMIVHN3cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
6689
6622
  throw new Error(reason === true ? `${label} did not change the document.` : reason);
6690
6623
  }
6691
- const state = _chunkJ3R2OWOEcjs.getTableState.call(void 0, editor);
6624
+ const state = _chunkFEMIVHN3cjs.getTableState.call(void 0, editor);
6692
6625
  return {
6693
6626
  done: true,
6694
6627
  table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
@@ -6820,4 +6753,4 @@ function createTableCommands(editor, options = {}) {
6820
6753
 
6821
6754
 
6822
6755
  exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
6823
- //# sourceMappingURL=chunk-H4PICYNL.cjs.map
6756
+ //# sourceMappingURL=chunk-LNKZPIQD.cjs.map