@superdoc-dev/mcp 0.11.0-next.1 → 0.11.0-next.2

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 (2) hide show
  1. package/dist/index.js +775 -313
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -52208,7 +52208,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
52208
52208
  emptyOptions2 = {};
52209
52209
  });
52210
52210
 
52211
- // ../../packages/superdoc/dist/chunks/SuperConverter-CQg2Zq8Z.es.js
52211
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DHtZjY65.es.js
52212
52212
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
52213
52213
  const fieldValue = extension$1.config[field];
52214
52214
  if (typeof fieldValue === "function")
@@ -82365,7 +82365,33 @@ function importCommentData({ docx, editor, converter }) {
82365
82365
  function isReplacementPair(previous$1, current) {
82366
82366
  return previous$1.type !== current.type && previous$1.author === current.author && previous$1.date === current.date;
82367
82367
  }
82368
- function assignInternalId(element, idMap, context, insideTrackedChange) {
82368
+ function trackedChangeEntryFromElement(element) {
82369
+ return {
82370
+ type: element.name,
82371
+ author: element.attributes?.["w:author"] ?? "",
82372
+ date: element.attributes?.["w:date"] ?? ""
82373
+ };
82374
+ }
82375
+ function findNextSiblingTrackedChange(elements, startIndex) {
82376
+ if (!Array.isArray(elements))
82377
+ return null;
82378
+ for (let i$1 = startIndex;i$1 < elements.length; i$1 += 1) {
82379
+ const element = elements[i$1];
82380
+ if (TRACKED_CHANGE_NAMES.has(element?.name))
82381
+ return trackedChangeEntryFromElement(element);
82382
+ if (!PAIRING_TRANSPARENT_NAMES.has(element?.name))
82383
+ return null;
82384
+ }
82385
+ return null;
82386
+ }
82387
+ function isChildReplacementInsideDeletion(beforePrevious, previous$1, current, next) {
82388
+ if (!isReplacementPair(previous$1, current))
82389
+ return false;
82390
+ const touchesDifferentAuthorDeletionBefore = beforePrevious?.type === "w:del" && beforePrevious.author !== previous$1.author;
82391
+ const touchesDifferentAuthorDeletionAfter = next?.type === "w:del" && next.author !== previous$1.author;
82392
+ return touchesDifferentAuthorDeletionBefore || touchesDifferentAuthorDeletionAfter;
82393
+ }
82394
+ function assignInternalId(element, idMap, context, insideTrackedChange, nextTrackedChange = null) {
82369
82395
  const wordId = String(element.attributes?.["w:id"] ?? "");
82370
82396
  if (!wordId)
82371
82397
  return;
@@ -82374,18 +82400,18 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
82374
82400
  idMap.set(wordId, v4_default());
82375
82401
  return;
82376
82402
  }
82377
- const current = {
82378
- type: element.name,
82379
- author: element.attributes?.["w:author"] ?? "",
82380
- date: element.attributes?.["w:date"] ?? ""
82381
- };
82382
- if (context.replacements === "paired" && context.lastTrackedChange && isReplacementPair(context.lastTrackedChange, current)) {
82403
+ const current = trackedChangeEntryFromElement(element);
82404
+ const shouldPair = context.replacements === "paired";
82405
+ const shouldKeepChildSides = context.lastTrackedChange && isChildReplacementInsideDeletion(context.beforeLastTrackedChange, context.lastTrackedChange, current, nextTrackedChange);
82406
+ if (shouldPair && context.lastTrackedChange && !shouldKeepChildSides && isReplacementPair(context.lastTrackedChange, current)) {
82383
82407
  if (!idMap.has(wordId))
82384
82408
  idMap.set(wordId, context.lastTrackedChange.internalId);
82385
82409
  context.lastTrackedChange = null;
82410
+ context.beforeLastTrackedChange = null;
82386
82411
  } else {
82387
82412
  const internalId = idMap.get(wordId) ?? v4_default();
82388
82413
  idMap.set(wordId, internalId);
82414
+ context.beforeLastTrackedChange = context.lastTrackedChange;
82389
82415
  context.lastTrackedChange = {
82390
82416
  ...current,
82391
82417
  internalId
@@ -82395,20 +82421,25 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
82395
82421
  function walkElements(elements, idMap, context, insideTrackedChange = false) {
82396
82422
  if (!Array.isArray(elements))
82397
82423
  return;
82398
- for (const element of elements)
82424
+ for (let index2 = 0;index2 < elements.length; index2 += 1) {
82425
+ const element = elements[index2];
82399
82426
  if (TRACKED_CHANGE_NAMES.has(element.name)) {
82400
- assignInternalId(element, idMap, context, insideTrackedChange);
82427
+ assignInternalId(element, idMap, context, insideTrackedChange, findNextSiblingTrackedChange(elements, index2 + 1));
82401
82428
  if (element.elements)
82402
82429
  walkElements(element.elements, idMap, {
82430
+ beforeLastTrackedChange: null,
82403
82431
  lastTrackedChange: null,
82404
82432
  replacements: context.replacements
82405
82433
  }, true);
82406
82434
  } else {
82407
- if (!PAIRING_TRANSPARENT_NAMES.has(element.name))
82435
+ if (!PAIRING_TRANSPARENT_NAMES.has(element.name)) {
82408
82436
  context.lastTrackedChange = null;
82437
+ context.beforeLastTrackedChange = null;
82438
+ }
82409
82439
  if (element.elements)
82410
82440
  walkElements(element.elements, idMap, context, insideTrackedChange);
82411
82441
  }
82442
+ }
82412
82443
  }
82413
82444
  function buildTrackedChangeIdMapForPart(part, options = {}) {
82414
82445
  const root2 = part?.elements?.[0];
@@ -82417,6 +82448,7 @@ function buildTrackedChangeIdMapForPart(part, options = {}) {
82417
82448
  const replacements = options.replacements === "independent" ? "independent" : "paired";
82418
82449
  const idMap = /* @__PURE__ */ new Map;
82419
82450
  walkElements(root2.elements, idMap, {
82451
+ beforeLastTrackedChange: null,
82420
82452
  lastTrackedChange: null,
82421
82453
  replacements
82422
82454
  });
@@ -85949,12 +85981,21 @@ function getInlineIndex(editor) {
85949
85981
  function clearIndexCache(editor) {
85950
85982
  cacheByEditor.delete(editor);
85951
85983
  }
85984
+ function isVisibleTextModel(options) {
85985
+ return options?.textModel === "visible";
85986
+ }
85987
+ function hasTrackDeleteMark(node2) {
85988
+ return node2.marks?.some((mark) => mark.type.name === "trackDelete") ?? false;
85989
+ }
85990
+ function shouldSkipTextNode(node2, options) {
85991
+ return isVisibleTextModel(options) && hasTrackDeleteMark(node2);
85992
+ }
85952
85993
  function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
85953
85994
  if (segmentLength <= 1)
85954
85995
  return targetOffset <= segmentStart ? docFrom : docTo;
85955
85996
  return docFrom + (targetOffset - segmentStart);
85956
85997
  }
85957
- function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
85998
+ function pmPositionToTextOffset(blockNode, blockPos, pmPos, options) {
85958
85999
  const contentStart = blockPos + 1;
85959
86000
  if (pmPos <= contentStart)
85960
86001
  return 0;
@@ -85965,7 +86006,13 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
85965
86006
  return;
85966
86007
  if (node2.isText) {
85967
86008
  const text$2 = node2.text ?? "";
85968
- if (pmPos >= docPos + text$2.length)
86009
+ const endPos = docPos + text$2.length;
86010
+ if (shouldSkipTextNode(node2, options)) {
86011
+ if (pmPos < endPos)
86012
+ done = true;
86013
+ return;
86014
+ }
86015
+ if (pmPos >= endPos)
85969
86016
  offset += text$2.length;
85970
86017
  else {
85971
86018
  offset += Math.max(0, pmPos - docPos);
@@ -86005,10 +86052,12 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
86005
86052
  visitContent(blockNode, contentStart);
86006
86053
  return offset;
86007
86054
  }
86008
- function computeTextContentLength(blockNode) {
86055
+ function computeTextContentLength(blockNode, options) {
86009
86056
  let length = 0;
86010
86057
  const walk = (node2) => {
86011
86058
  if (node2.isText) {
86059
+ if (shouldSkipTextNode(node2, options))
86060
+ return;
86012
86061
  length += (node2.text ?? "").length;
86013
86062
  return;
86014
86063
  }
@@ -86035,7 +86084,7 @@ function computeTextContentLength(blockNode) {
86035
86084
  }
86036
86085
  return length;
86037
86086
  }
86038
- function resolveTextRangeInBlock(blockNode, blockPos, range) {
86087
+ function resolveTextRangeInBlock(blockNode, blockPos, range, options) {
86039
86088
  if (range.start < 0 || range.end < range.start)
86040
86089
  return null;
86041
86090
  let offset = 0;
@@ -86067,7 +86116,7 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
86067
86116
  const walkNode$1 = (node2, docPos) => {
86068
86117
  if (node2.isText) {
86069
86118
  const text$2 = node2.text ?? "";
86070
- if (text$2.length > 0)
86119
+ if (text$2.length > 0 && !shouldSkipTextNode(node2, options))
86071
86120
  advanceSegment(text$2.length, docPos, docPos + text$2.length);
86072
86121
  return;
86073
86122
  }
@@ -86094,6 +86143,39 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
86094
86143
  to: toPos
86095
86144
  };
86096
86145
  }
86146
+ function textContentInBlock(blockNode, options) {
86147
+ let text$2 = "";
86148
+ const walkNode$1 = (node2) => {
86149
+ if (node2.isText) {
86150
+ if (!shouldSkipTextNode(node2, options))
86151
+ text$2 += node2.text ?? "";
86152
+ return;
86153
+ }
86154
+ if (node2.isLeaf) {
86155
+ text$2 += "";
86156
+ return;
86157
+ }
86158
+ let isFirstChild$1 = true;
86159
+ for (let i$1 = 0;i$1 < node2.childCount; i$1++) {
86160
+ const child = node2.child(i$1);
86161
+ if (child.isBlock && !isFirstChild$1)
86162
+ text$2 += `
86163
+ `;
86164
+ walkNode$1(child);
86165
+ isFirstChild$1 = false;
86166
+ }
86167
+ };
86168
+ let isFirstChild = true;
86169
+ for (let i$1 = 0;i$1 < blockNode.childCount; i$1++) {
86170
+ const child = blockNode.child(i$1);
86171
+ if (child.isBlock && !isFirstChild)
86172
+ text$2 += `
86173
+ `;
86174
+ walkNode$1(child);
86175
+ isFirstChild = false;
86176
+ }
86177
+ return text$2;
86178
+ }
86097
86179
  function buildTextWithTabs(schema, text$2, marks, opts = {}) {
86098
86180
  if (!text$2.includes("\t"))
86099
86181
  return schema.text(text$2, marks);
@@ -86117,7 +86199,7 @@ function parentAllowsNodeAt(tr, absPos, nodeType) {
86117
86199
  return true;
86118
86200
  return contentMatch.matchType(nodeType) != null;
86119
86201
  }
86120
- function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback) {
86202
+ function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback, options = {}) {
86121
86203
  const anyDoc = doc$2;
86122
86204
  if (typeof anyDoc.nodesBetween !== "function") {
86123
86205
  if (typeof anyDoc.textBetween === "function")
@@ -86138,6 +86220,8 @@ function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback) {
86138
86220
  return false;
86139
86221
  }
86140
86222
  if (node2.isText) {
86223
+ if (options.textModel === "visible" && node2.marks?.some((mark) => mark.type.name === "trackDelete"))
86224
+ return false;
86141
86225
  const start = Math.max(from2, pos) - pos;
86142
86226
  const end = Math.min(to, pos + node2.nodeSize) - pos;
86143
86227
  const text$2 = typeof node2.text === "string" ? node2.text : "".repeat(node2.nodeSize);
@@ -86206,7 +86290,7 @@ function resolveTextTarget(editor, target) {
86206
86290
  const block = matches$1[0];
86207
86291
  if (!block)
86208
86292
  return null;
86209
- return resolveTextRangeInBlock(block.node, block.pos, target.range);
86293
+ return resolveTextRangeInBlock(block.node, block.pos, target.range, { textModel: "visible" });
86210
86294
  }
86211
86295
  function resolveInlineInsertPosition(editor, at, operationName) {
86212
86296
  const firstSegment = at.segments[0];
@@ -86245,11 +86329,11 @@ function resolveDefaultInsertTarget(editor) {
86245
86329
  for (let i$1 = index2.candidates.length - 1;i$1 >= 0; i$1--) {
86246
86330
  const candidate = index2.candidates[i$1];
86247
86331
  if (topLevelPositions.has(candidate.pos) && isTextBlockCandidate(candidate)) {
86248
- const textLength = computeTextContentLength(candidate.node);
86332
+ const textLength = computeTextContentLength(candidate.node, { textModel: "visible" });
86249
86333
  const range = resolveTextRangeInBlock(candidate.node, candidate.pos, {
86250
86334
  start: textLength,
86251
86335
  end: textLength
86252
- });
86336
+ }, { textModel: "visible" });
86253
86337
  if (!range)
86254
86338
  continue;
86255
86339
  return {
@@ -89210,7 +89294,7 @@ function getTextAdapter(editor, input) {
89210
89294
  const doc$2 = resolveStoryRuntime(editor, input.in).editor.state.doc;
89211
89295
  return textBetweenWithTabs(doc$2, 0, doc$2.content.size, `
89212
89296
  `, `
89213
- `);
89297
+ `, { textModel: "visible" });
89214
89298
  }
89215
89299
  function getRawTrackedMarks(editor) {
89216
89300
  try {
@@ -107963,7 +108047,7 @@ var isRegExp = (value) => {
107963
108047
  state.kern = kernNode.attributes["w:val"];
107964
108048
  }
107965
108049
  }, SuperConverter;
107966
- var init_SuperConverter_CQg2Zq8Z_es = __esm(() => {
108050
+ var init_SuperConverter_DHtZjY65_es = __esm(() => {
107967
108051
  init_rolldown_runtime_Bg48TavK_es();
107968
108052
  init_jszip_C49i9kUs_es();
107969
108053
  init_xml_js_CqGKpaft_es();
@@ -146279,7 +146363,7 @@ var init_SuperConverter_CQg2Zq8Z_es = __esm(() => {
146279
146363
  };
146280
146364
  });
146281
146365
 
146282
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BjHgBUHt.es.js
146366
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-lxRAue2X.es.js
146283
146367
  function parseSizeUnit(val = "0") {
146284
146368
  const length = val.toString() || "0";
146285
146369
  const value = Number.parseFloat(length);
@@ -147414,7 +147498,7 @@ function applyDirectiveToMarks(marks, markKey2, directive, markType) {
147414
147498
  return otherMarks;
147415
147499
  }
147416
147500
  }
147417
- function captureRunsInRange(editor, blockPos, from2, to) {
147501
+ function captureRunsInRange(editor, blockPos, from2, to, options) {
147418
147502
  const blockNode = editor.state.doc.nodeAt(blockPos);
147419
147503
  if (!blockNode || from2 < 0 || to < from2 || from2 === to)
147420
147504
  return {
@@ -147439,9 +147523,12 @@ function captureRunsInRange(editor, blockPos, from2, to) {
147439
147523
  if (node2.isText) {
147440
147524
  const text4 = node2.text ?? "";
147441
147525
  if (text4.length > 0) {
147526
+ const marks = Array.isArray(node2.marks) ? node2.marks : [];
147527
+ if (options?.textModel === "visible" && marks.some((mark) => mark.type.name === "trackDelete"))
147528
+ return;
147442
147529
  const start = offset;
147443
147530
  const end = offset + text4.length;
147444
- maybePushRun(start, end, Array.isArray(node2.marks) ? node2.marks : []);
147531
+ maybePushRun(start, end, marks);
147445
147532
  offset = end;
147446
147533
  }
147447
147534
  return;
@@ -147722,6 +147809,12 @@ function applySetMarksToResolved(editor, existingMarks, setMarks) {
147722
147809
  }
147723
147810
  return marks;
147724
147811
  }
147812
+ function getCandidateText(editor, candidate, options) {
147813
+ if (candidate.node.childCount > 0)
147814
+ return textContentInBlock(candidate.node, options);
147815
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
147816
+ `, "");
147817
+ }
147725
147818
  function resolveUnknownBlockId(attrs) {
147726
147819
  if (!attrs)
147727
147820
  return;
@@ -147735,7 +147828,38 @@ function getAddressStartPos(editor, index2, address) {
147735
147828
  return findBlockById(index2, address)?.pos ?? Number.MAX_SAFE_INTEGER;
147736
147829
  return findInlineByAnchor(getInlineIndex(editor), address)?.pos ?? Number.MAX_SAFE_INTEGER;
147737
147830
  }
147738
- function buildTextContext(editor, address, matchFrom, matchTo, textRanges) {
147831
+ function buildTextContext(editor, address, matchFrom, matchTo, textRanges, options) {
147832
+ if (textRanges?.length) {
147833
+ const index2 = getBlockIndex(editor);
147834
+ const firstRange = textRanges[0];
147835
+ const lastRange = textRanges[textRanges.length - 1];
147836
+ const firstBlock = index2.candidates.find((candidate) => candidate.nodeId === firstRange.blockId);
147837
+ const lastBlock = index2.candidates.find((candidate) => candidate.nodeId === lastRange.blockId);
147838
+ if (firstBlock && lastBlock) {
147839
+ const matchText = textRanges.map((range) => {
147840
+ const block = index2.candidates.find((candidate) => candidate.nodeId === range.blockId);
147841
+ if (!block)
147842
+ return "";
147843
+ return getCandidateText(editor, block, options).slice(range.range.start, range.range.end);
147844
+ }).join(`
147845
+ `);
147846
+ const firstText = getCandidateText(editor, firstBlock, options);
147847
+ const lastText = getCandidateText(editor, lastBlock, options);
147848
+ const leftContext = firstText.slice(Math.max(0, firstRange.range.start - SNIPPET_PADDING), firstRange.range.start);
147849
+ const snippet$1 = `${leftContext}${matchText}${lastText.slice(lastRange.range.end, lastRange.range.end + SNIPPET_PADDING)}`.replace(/ {2,}/g, " ");
147850
+ const prefix$1 = leftContext.replace(/ {2,}/g, " ");
147851
+ const normalizedMatch = matchText.replace(/ {2,}/g, " ");
147852
+ return {
147853
+ address,
147854
+ snippet: snippet$1,
147855
+ highlightRange: {
147856
+ start: prefix$1.length,
147857
+ end: prefix$1.length + normalizedMatch.length
147858
+ },
147859
+ textRanges
147860
+ };
147861
+ }
147862
+ }
147739
147863
  const docSize = editor.state.doc.content.size;
147740
147864
  const snippetFrom = Math.max(0, matchFrom - SNIPPET_PADDING);
147741
147865
  const snippetTo = Math.min(docSize, matchTo + SNIPPET_PADDING);
@@ -147754,14 +147878,14 @@ function buildTextContext(editor, address, matchFrom, matchTo, textRanges) {
147754
147878
  textRanges: textRanges?.length ? textRanges : undefined
147755
147879
  };
147756
147880
  }
147757
- function toTextAddress$1(editor, block, range) {
147881
+ function toTextAddress$1(editor, block, range, options) {
147758
147882
  const blockStart = block.pos + 1;
147759
147883
  const blockEnd = block.end - 1;
147760
147884
  if (range.from < blockStart || range.to > blockEnd)
147761
147885
  return;
147762
- const start = editor.state.doc.textBetween(blockStart, range.from, `
147886
+ const start = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.from, options) : editor.state.doc.textBetween(blockStart, range.from, `
147763
147887
  `, "").length;
147764
- const end = editor.state.doc.textBetween(blockStart, range.to, `
147888
+ const end = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.to, options) : editor.state.doc.textBetween(blockStart, range.to, `
147765
147889
  `, "").length;
147766
147890
  return {
147767
147891
  kind: "text",
@@ -147840,7 +147964,7 @@ function buildSearchPattern(selector, diagnostics) {
147840
147964
  const flags = selector.caseSensitive ? "g" : "gi";
147841
147965
  return new RegExp(flexible, flags);
147842
147966
  }
147843
- function executeTextSelector(editor, index2, query, diagnostics) {
147967
+ function executeTextSelector(editor, index2, query, diagnostics, options = {}) {
147844
147968
  if (query.select.type !== "text") {
147845
147969
  addDiagnostic(diagnostics, `Text strategy received a non-text selector (type="${query.select.type}").`);
147846
147970
  return {
@@ -147868,16 +147992,20 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147868
147992
  matches: [],
147869
147993
  total: 0
147870
147994
  };
147871
- const rawResult = requireEditorCommand(editor.commands?.search, "find (search)")(pattern, {
147995
+ const search2 = requireEditorCommand(editor.commands?.search, "find (search)");
147996
+ const searchModel = options.searchModel ?? "visible";
147997
+ const textOffsetOptions = { textModel: searchModel };
147998
+ pattern.lastIndex = 0;
147999
+ const rawResult = search2(pattern, {
147872
148000
  highlight: false,
147873
148001
  caseSensitive: selector.caseSensitive ?? false,
147874
148002
  maxMatches: Infinity,
147875
- searchModel: "visible"
148003
+ searchModel
147876
148004
  });
147877
148005
  if (!Array.isArray(rawResult))
147878
148006
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
147879
- const allMatches = rawResult;
147880
148007
  const scopeRange = scope.range;
148008
+ const allMatches = rawResult;
147881
148009
  const matches2 = scopeRange ? allMatches.filter((m) => m.from >= scopeRange.start && m.to <= scopeRange.end) : allMatches;
147882
148010
  const textBlocks = index2.candidates.filter(isTextBlockCandidate);
147883
148011
  const contexts = [];
@@ -147894,7 +148022,7 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147894
148022
  return;
147895
148023
  if (!source)
147896
148024
  source = block;
147897
- return toTextAddress$1(editor, block, range);
148025
+ return toTextAddress$1(editor, block, range, textOffsetOptions);
147898
148026
  }).filter((range) => Boolean(range));
147899
148027
  if (!source)
147900
148028
  source = findCandidateByPos(textBlocks, match.from) ?? findBlockByPos(index2, match.from);
@@ -147902,7 +148030,7 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147902
148030
  continue;
147903
148031
  const address = toBlockAddress(source);
147904
148032
  addresses.push(address);
147905
- contexts.push(buildTextContext(editor, address, match.from, match.to, textRanges));
148033
+ contexts.push(buildTextContext(editor, address, match.from, match.to, textRanges, textOffsetOptions));
147906
148034
  }
147907
148035
  const paged = paginate(addresses, query.offset, query.limit);
147908
148036
  const pagedContexts = paginate(contexts, query.offset, query.limit).items;
@@ -147953,7 +148081,7 @@ function resolveTextPoint(editor, index2, point3) {
147953
148081
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
147954
148082
  start: point3.offset,
147955
148083
  end: point3.offset
147956
- });
148084
+ }, { textModel: "visible" });
147957
148085
  if (!resolved)
147958
148086
  throw new DocumentApiAdapterError("INVALID_TARGET", `Offset ${point3.offset} is out of range in block "${point3.blockId}".`, {
147959
148087
  field: "offset",
@@ -148160,11 +148288,11 @@ function validateInsertionContext(editor, index2, step2, stepIndex, anchorBlockI
148160
148288
  });
148161
148289
  }
148162
148290
  }
148163
- function resolveAbsoluteRange(editor, candidate, from2, to, stepId) {
148291
+ function resolveAbsoluteRange(editor, candidate, from2, to, stepId, options) {
148164
148292
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
148165
148293
  start: from2,
148166
148294
  end: to
148167
- });
148295
+ }, options);
148168
148296
  if (!resolved)
148169
148297
  throw planError("INVALID_INPUT", `text offset [${from2}, ${to}) out of range in block`, stepId);
148170
148298
  return {
@@ -148248,8 +148376,9 @@ function coalesceBlockRanges(stepId, blockId, ranges) {
148248
148376
  };
148249
148377
  }
148250
148378
  function buildRangeTarget(editor, step2, addr, candidate) {
148251
- const abs = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step2.id);
148252
- const capturedStyle = step2.op === "text.rewrite" || step2.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to) : undefined;
148379
+ const textOffsetOptions = { textModel: addr.textModel };
148380
+ const abs = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step2.id, textOffsetOptions);
148381
+ const capturedStyle = step2.op === "text.rewrite" || step2.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to, textOffsetOptions) : undefined;
148253
148382
  return {
148254
148383
  kind: "range",
148255
148384
  stepId: step2.id,
@@ -148264,7 +148393,7 @@ function buildRangeTarget(editor, step2, addr, candidate) {
148264
148393
  capturedStyle
148265
148394
  };
148266
148395
  }
148267
- function buildSpanTarget(editor, index2, step2, segments, matchId) {
148396
+ function buildSpanTarget(editor, index2, step2, segments, matchId, textModel = "visible") {
148268
148397
  validateSegmentOrder(editor, index2, segments, step2.id);
148269
148398
  const compiledSegments = [];
148270
148399
  const capturedStyles = [];
@@ -148273,7 +148402,8 @@ function buildSpanTarget(editor, index2, step2, segments, matchId) {
148273
148402
  const candidate = index2.candidates.find((c) => c.nodeId === seg.blockId);
148274
148403
  if (!candidate)
148275
148404
  throw planError("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step2.id);
148276
- const abs = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step2.id);
148405
+ const textOffsetOptions = { textModel };
148406
+ const abs = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step2.id, textOffsetOptions);
148277
148407
  compiledSegments.push({
148278
148408
  blockId: seg.blockId,
148279
148409
  from: seg.from,
@@ -148281,10 +148411,10 @@ function buildSpanTarget(editor, index2, step2, segments, matchId) {
148281
148411
  absFrom: abs.absFrom,
148282
148412
  absTo: abs.absTo
148283
148413
  });
148284
- const blockText = getBlockText(editor, candidate);
148414
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
148285
148415
  textParts.push(blockText.slice(seg.from, seg.to));
148286
148416
  if (step2.op === "text.rewrite" || step2.op === "format.apply")
148287
- capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to));
148417
+ capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to, textOffsetOptions));
148288
148418
  }
148289
148419
  return {
148290
148420
  kind: "span",
@@ -148322,12 +148452,14 @@ function validateSegmentOrder(_editor, index2, segments, stepId) {
148322
148452
  }
148323
148453
  }
148324
148454
  function resolveTextSelector(editor, index2, selector, within, stepId, options) {
148455
+ const textModel = options?.textModel ?? "visible";
148456
+ const textOffsetOptions = { textModel };
148325
148457
  if (selector.type === "text") {
148326
148458
  const result$1 = executeTextSelector(editor, index2, {
148327
148459
  select: selector,
148328
148460
  within,
148329
148461
  includeNodes: false
148330
- }, []);
148462
+ }, [], { searchModel: textModel });
148331
148463
  const addresses$1 = [];
148332
148464
  if (result$1.context)
148333
148465
  for (const ctx of result$1.context) {
@@ -148337,15 +148469,16 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148337
148469
  const candidate = index2.candidates.find((c) => c.nodeId === coalesced.blockId);
148338
148470
  if (!candidate)
148339
148471
  continue;
148340
- const matchText = getBlockText(editor, candidate).slice(coalesced.from, coalesced.to);
148341
- const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to);
148472
+ const matchText = getBlockText(editor, candidate, textOffsetOptions).slice(coalesced.from, coalesced.to);
148473
+ const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to, textOffsetOptions);
148342
148474
  addresses$1.push({
148343
148475
  blockId: coalesced.blockId,
148344
148476
  from: coalesced.from,
148345
148477
  to: coalesced.to,
148346
148478
  text: matchText,
148347
148479
  marks: captured.runs.length > 0 ? captured.runs[0].marks : [],
148348
- blockPos: candidate.pos
148480
+ blockPos: candidate.pos,
148481
+ textModel
148349
148482
  });
148350
148483
  }
148351
148484
  return { addresses: addresses$1 };
@@ -148364,14 +148497,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148364
148497
  if (!candidate)
148365
148498
  continue;
148366
148499
  if (isTextBlockCandidate(candidate)) {
148367
- const blockText = getBlockText(editor, candidate);
148500
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
148368
148501
  addresses.push({
148369
148502
  blockId: match.nodeId,
148370
148503
  from: 0,
148371
148504
  to: blockText.length,
148372
148505
  text: blockText,
148373
148506
  marks: [],
148374
- blockPos: candidate.pos
148507
+ blockPos: candidate.pos,
148508
+ textModel
148375
148509
  });
148376
148510
  } else
148377
148511
  addresses.push({
@@ -148380,12 +148514,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148380
148514
  to: 0,
148381
148515
  text: "",
148382
148516
  marks: [],
148383
- blockPos: candidate.pos
148517
+ blockPos: candidate.pos,
148518
+ textModel
148384
148519
  });
148385
148520
  }
148386
148521
  return { addresses };
148387
148522
  }
148388
- function getBlockText(editor, candidate) {
148523
+ function getBlockText(editor, candidate, options = { textModel: "visible" }) {
148524
+ if (candidate.node && candidate.node.childCount > 0)
148525
+ return textContentInBlock(candidate.node, options);
148389
148526
  const blockStart = candidate.pos + 1;
148390
148527
  const blockEnd = candidate.end - 1;
148391
148528
  return editor.state.doc.textBetween(blockStart, blockEnd, `
@@ -148421,12 +148558,13 @@ function resolveV3TextRef(editor, index2, step2, refData) {
148421
148558
  to: seg.to,
148422
148559
  text: matchText,
148423
148560
  marks: [],
148424
- blockPos: candidate.pos
148561
+ blockPos: candidate.pos,
148562
+ textModel: "visible"
148425
148563
  }, candidate);
148426
148564
  target.matchId = refData.matchId;
148427
148565
  return [target];
148428
148566
  }
148429
- return [buildSpanTarget(editor, index2, step2, segments, refData.matchId)];
148567
+ return [buildSpanTarget(editor, index2, step2, segments, refData.matchId, "visible")];
148430
148568
  }
148431
148569
  function resolveV4TextRef(editor, index2, step2, refData) {
148432
148570
  if (refData.scope === "node" && refData.node?.nodeId)
@@ -148459,13 +148597,14 @@ function resolveV4TextRef(editor, index2, step2, refData) {
148459
148597
  to: seg.to,
148460
148598
  text: matchText,
148461
148599
  marks: [],
148462
- blockPos: candidate.pos
148600
+ blockPos: candidate.pos,
148601
+ textModel: "visible"
148463
148602
  }, candidate);
148464
148603
  if (refData.matchId)
148465
148604
  target.matchId = refData.matchId;
148466
148605
  return [target];
148467
148606
  }
148468
- return [buildSpanTarget(editor, index2, step2, segments, refData.matchId ?? `v4:${step2.id}`)];
148607
+ return [buildSpanTarget(editor, index2, step2, segments, refData.matchId ?? `v4:${step2.id}`, "visible")];
148469
148608
  }
148470
148609
  function resolveTextRef(editor, index2, step2, ref2) {
148471
148610
  const decoded = decodeRef(ref2);
@@ -148492,7 +148631,8 @@ function resolveBlockRef(editor, index2, step2, ref2) {
148492
148631
  to: blockText.length,
148493
148632
  text: blockText,
148494
148633
  marks: [],
148495
- blockPos: candidate.pos
148634
+ blockPos: candidate.pos,
148635
+ textModel: "visible"
148496
148636
  }, candidate)];
148497
148637
  }
148498
148638
  function dispatchRefHandler(editor, index2, step2, ref2) {
@@ -148539,7 +148679,8 @@ function buildWholeBlockRangeTarget(editor, step2, candidate) {
148539
148679
  to: blockText.length,
148540
148680
  text: blockText,
148541
148681
  marks: [],
148542
- blockPos: candidate.pos
148682
+ blockPos: candidate.pos,
148683
+ textModel: "visible"
148543
148684
  }, candidate);
148544
148685
  }
148545
148686
  return {
@@ -148622,7 +148763,7 @@ function captureStyleAtAbsoluteRange(editor, absFrom, absTo) {
148622
148763
  isUniform: checkUniformity(allRuns)
148623
148764
  };
148624
148765
  }
148625
- function resolveStepTargets(editor, index2, step2) {
148766
+ function resolveStepTargets(editor, index2, step2, options = {}) {
148626
148767
  const where = step2.where;
148627
148768
  const refWhere = isRefWhere(where) ? where : undefined;
148628
148769
  const selectWhere = isSelectWhere(where) ? where : undefined;
@@ -148637,7 +148778,10 @@ function resolveStepTargets(editor, index2, step2) {
148637
148778
  targets = resolveRefTargets(editor, index2, step2, refWhere);
148638
148779
  else if (selectWhere) {
148639
148780
  const isStructuralOp = step2.op === "structural.insert" || step2.op === "structural.replace";
148640
- targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step2.id, { allBlockTypes: isStructuralOp }).addresses.map((addr) => {
148781
+ targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step2.id, {
148782
+ allBlockTypes: isStructuralOp,
148783
+ textModel: options.selectTextModel ?? "visible"
148784
+ }).addresses.map((addr) => {
148641
148785
  const candidate = index2.candidates.find((c) => c.nodeId === addr.blockId);
148642
148786
  if (!candidate)
148643
148787
  throw planError("TARGET_NOT_FOUND", `block "${addr.blockId}" not in index`, step2.id);
@@ -148902,7 +149046,7 @@ function assertSingleStoryKey(steps) {
148902
149046
  });
148903
149047
  }
148904
149048
  }
148905
- function compilePlan(editor, steps) {
149049
+ function compilePlan(editor, steps, options = {}) {
148906
149050
  if (steps.length > 200)
148907
149051
  throw planError("INVALID_INPUT", `plan contains ${steps.length} steps, maximum is 200`);
148908
149052
  const compiledRevision = getRevision(editor);
@@ -148933,7 +149077,7 @@ function compilePlan(editor, steps) {
148933
149077
  throw planError("INVALID_INPUT", `unknown step op "${step2.op}"`, step2.id);
148934
149078
  if (isCreateOp(step2.op))
148935
149079
  validateCreateStepPosition(step2);
148936
- const targets = resolveStepTargets(editor, index2, step2);
149080
+ const targets = resolveStepTargets(editor, index2, step2, options);
148937
149081
  if (isCreateOp(step2.op) && targets.length > 0) {
148938
149082
  const position2 = step2.args.position ?? "after";
148939
149083
  const anchorBlockId = resolveCreateAnchorFromTargets(targets, position2, step2.id);
@@ -151066,7 +151210,7 @@ function executeCompiledPlan(editor, compiled, options = {}) {
151066
151210
  function executePlan(editor, input) {
151067
151211
  if (!input.steps?.length)
151068
151212
  throw planError("INVALID_INPUT", "plan must contain at least one step");
151069
- return executeCompiledPlan(editor, compilePlan(editor, input.steps), {
151213
+ return executeCompiledPlan(editor, compilePlan(editor, input.steps, { selectTextModel: input.changeMode === "tracked" ? "raw" : "visible" }), {
151070
151214
  changeMode: input.changeMode ?? "direct",
151071
151215
  expectedRevision: input.expectedRevision
151072
151216
  });
@@ -156628,8 +156772,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
156628
156772
  }
156629
156773
  };
156630
156774
  };
156631
- var init_create_headless_toolbar_BjHgBUHt_es = __esm(() => {
156632
- init_SuperConverter_CQg2Zq8Z_es();
156775
+ var init_create_headless_toolbar_lxRAue2X_es = __esm(() => {
156776
+ init_SuperConverter_DHtZjY65_es();
156633
156777
  init_uuid_qzgm05fK_es();
156634
156778
  init_constants_D_X7xF4s_es();
156635
156779
  init_dist_B8HfvhaK_es();
@@ -211378,7 +211522,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
211378
211522
  init_remark_gfm_BhnWr3yf_es();
211379
211523
  });
211380
211524
 
211381
- // ../../packages/superdoc/dist/chunks/src-GT3sTaEO.es.js
211525
+ // ../../packages/superdoc/dist/chunks/src-BlbgbalI.es.js
211382
211526
  function deleteProps(obj, propOrProps) {
211383
211527
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
211384
211528
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -224396,11 +224540,20 @@ function buildSelectionClipboardHtml(view, editor) {
224396
224540
  annotateCopiedSectionMetadata(container, view);
224397
224541
  return serializeSelectionAsWordHtml(container) || container.innerHTML || null;
224398
224542
  }
224399
- function projectContentNode(pmNode) {
224400
- return projectBlock(pmNode);
224543
+ function isVisibleProjection(options) {
224544
+ return options?.textModel === "visible";
224545
+ }
224546
+ function hasTrackDeleteMark$1(pmNode) {
224547
+ return pmNode.marks?.some((mark2) => mark2.type.name === "trackDelete") ?? false;
224548
+ }
224549
+ function projectContentNode(pmNode, options) {
224550
+ return projectBlock(pmNode, options);
224401
224551
  }
224402
- function projectInlineNode(pmNode) {
224403
- return projectInline(pmNode);
224552
+ function projectInlineNode(pmNode, options) {
224553
+ return projectInline(pmNode, options) ?? {
224554
+ kind: "run",
224555
+ run: { text: "" }
224556
+ };
224404
224557
  }
224405
224558
  function projectMarkBasedInline(editor, candidate) {
224406
224559
  const { nodeType, anchor, attrs } = candidate;
@@ -224450,8 +224603,9 @@ function resolveTextByBlockId(editor, anchor) {
224450
224603
  function projectDocument(editor, options) {
224451
224604
  const doc$12 = editor.state.doc;
224452
224605
  const body = [];
224606
+ const projectionOptions = { textModel: "visible" };
224453
224607
  doc$12.forEach((child) => {
224454
- body.push(projectBlock(child));
224608
+ body.push(projectBlock(child, projectionOptions));
224455
224609
  });
224456
224610
  const sections = projectSections(editor);
224457
224611
  const numbering = projectNumberingCatalog(editor);
@@ -224537,27 +224691,27 @@ function projectNumberingCatalog(editor) {
224537
224691
  }
224538
224692
  return Object.keys(catalog.definitions).length > 0 ? catalog : undefined;
224539
224693
  }
224540
- function projectBlock(pmNode) {
224694
+ function projectBlock(pmNode, options) {
224541
224695
  const typeName = pmNode.type.name;
224542
224696
  switch (typeName) {
224543
224697
  case "paragraph":
224544
- return projectParagraphOrHeading(pmNode);
224698
+ return projectParagraphOrHeading(pmNode, options);
224545
224699
  case "heading":
224546
- return projectHeadingNode(pmNode);
224700
+ return projectHeadingNode(pmNode, options);
224547
224701
  case "table":
224548
- return projectTable(pmNode);
224702
+ return projectTable(pmNode, options);
224549
224703
  case "bulletList":
224550
224704
  case "orderedList":
224551
- return projectList(pmNode, typeName === "orderedList");
224705
+ return projectList(pmNode, typeName === "orderedList", options);
224552
224706
  case "listItem":
224553
- return projectListItemAsContent(pmNode);
224707
+ return projectListItemAsContent(pmNode, options);
224554
224708
  case "image":
224555
224709
  return projectBlockImage(pmNode);
224556
224710
  case "tableOfContents":
224557
224711
  return projectToc(pmNode);
224558
224712
  case "sdt":
224559
224713
  case "structuredContentBlock":
224560
- return projectBlockSdt(pmNode);
224714
+ return projectBlockSdt(pmNode, options);
224561
224715
  case "sectionBreak":
224562
224716
  return projectSectionBreak(pmNode);
224563
224717
  case "pageBreak":
@@ -224566,22 +224720,22 @@ function projectBlock(pmNode) {
224566
224720
  case "drawing":
224567
224721
  return projectBlockDrawing(pmNode);
224568
224722
  default:
224569
- return projectFallbackBlock(pmNode);
224723
+ return projectFallbackBlock(pmNode, options);
224570
224724
  }
224571
224725
  }
224572
- function projectParagraphOrHeading(pmNode) {
224726
+ function projectParagraphOrHeading(pmNode, options) {
224573
224727
  const attrs = pmNode.attrs;
224574
224728
  const headingLevel = getHeadingLevel(attrs?.paragraphProperties?.styleId);
224575
224729
  if (headingLevel && headingLevel >= 1 && headingLevel <= 6)
224576
- return buildHeading(pmNode, attrs, headingLevel);
224577
- return buildParagraph(pmNode, attrs);
224730
+ return buildHeading(pmNode, attrs, headingLevel, options);
224731
+ return buildParagraph(pmNode, attrs, options);
224578
224732
  }
224579
- function projectHeadingNode(pmNode) {
224733
+ function projectHeadingNode(pmNode, options) {
224580
224734
  const attrs = pmNode.attrs;
224581
- return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1);
224735
+ return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1, options);
224582
224736
  }
224583
- function buildParagraph(pmNode, attrs) {
224584
- const inlines = projectInlineChildren(pmNode);
224737
+ function buildParagraph(pmNode, attrs, options) {
224738
+ const inlines = projectInlineChildren(pmNode, options);
224585
224739
  const result = {
224586
224740
  kind: "paragraph",
224587
224741
  id: resolveNodeId(pmNode),
@@ -224595,8 +224749,8 @@ function buildParagraph(pmNode, attrs) {
224595
224749
  result.paragraph.props = props;
224596
224750
  return result;
224597
224751
  }
224598
- function buildHeading(pmNode, attrs, level) {
224599
- const inlines = projectInlineChildren(pmNode);
224752
+ function buildHeading(pmNode, attrs, level, options) {
224753
+ const inlines = projectInlineChildren(pmNode, options);
224600
224754
  const result = {
224601
224755
  kind: "heading",
224602
224756
  id: resolveNodeId(pmNode),
@@ -224613,13 +224767,13 @@ function buildHeading(pmNode, attrs, level) {
224613
224767
  result.heading.props = props;
224614
224768
  return result;
224615
224769
  }
224616
- function projectTable(pmNode) {
224770
+ function projectTable(pmNode, options) {
224617
224771
  const attrs = pmNode.attrs;
224618
224772
  const pmAttrs = pmNode.attrs;
224619
224773
  const rows = [];
224620
224774
  pmNode.forEach((child) => {
224621
224775
  if (child.type.name === "tableRow")
224622
- rows.push(projectTableRow(child));
224776
+ rows.push(projectTableRow(child, options));
224623
224777
  });
224624
224778
  const result = {
224625
224779
  kind: "table",
@@ -224649,11 +224803,11 @@ function projectTable(pmNode) {
224649
224803
  }
224650
224804
  return result;
224651
224805
  }
224652
- function projectTableRow(pmNode) {
224806
+ function projectTableRow(pmNode, options) {
224653
224807
  const cells = [];
224654
224808
  pmNode.forEach((child) => {
224655
224809
  if (child.type.name === "tableCell" || child.type.name === "tableHeader")
224656
- cells.push(projectTableCell(child));
224810
+ cells.push(projectTableCell(child, options));
224657
224811
  });
224658
224812
  const row2 = { cells };
224659
224813
  const attrs = pmNode.attrs;
@@ -224666,11 +224820,11 @@ function projectTableRow(pmNode) {
224666
224820
  }
224667
224821
  return row2;
224668
224822
  }
224669
- function projectTableCell(pmNode) {
224823
+ function projectTableCell(pmNode, options) {
224670
224824
  const attrs = pmNode.attrs;
224671
224825
  const content3 = [];
224672
224826
  pmNode.forEach((child) => {
224673
- content3.push(projectBlock(child));
224827
+ content3.push(projectBlock(child, options));
224674
224828
  });
224675
224829
  const cell2 = { content: content3 };
224676
224830
  if (attrs?.colspan && attrs.colspan > 1)
@@ -224682,11 +224836,11 @@ function projectTableCell(pmNode) {
224682
224836
  cell2.props = { verticalAlign: vAlign };
224683
224837
  return cell2;
224684
224838
  }
224685
- function projectList(pmNode, ordered) {
224839
+ function projectList(pmNode, ordered, options) {
224686
224840
  const items = [];
224687
224841
  pmNode.forEach((child) => {
224688
224842
  if (child.type.name === "listItem")
224689
- items.push(projectListItem(child));
224843
+ items.push(projectListItem(child, options));
224690
224844
  });
224691
224845
  const result = {
224692
224846
  kind: "list",
@@ -224704,18 +224858,18 @@ function projectList(pmNode, ordered) {
224704
224858
  result.list.styleRef = attrs.listStyleId;
224705
224859
  return result;
224706
224860
  }
224707
- function projectListItem(pmNode) {
224861
+ function projectListItem(pmNode, options) {
224708
224862
  const content3 = [];
224709
224863
  pmNode.forEach((child) => {
224710
- content3.push(projectBlock(child));
224864
+ content3.push(projectBlock(child, options));
224711
224865
  });
224712
224866
  return {
224713
224867
  level: pmNode.attrs?.level ?? 0,
224714
224868
  content: content3
224715
224869
  };
224716
224870
  }
224717
- function projectListItemAsContent(pmNode) {
224718
- const inlines = projectInlineChildren(pmNode);
224871
+ function projectListItemAsContent(pmNode, options) {
224872
+ const inlines = projectInlineChildren(pmNode, options);
224719
224873
  return {
224720
224874
  kind: "paragraph",
224721
224875
  id: resolveNodeId(pmNode),
@@ -224764,10 +224918,10 @@ function extractSdtMetadata(attrs) {
224764
224918
  ...lock && lock !== "none" ? { lock } : {}
224765
224919
  };
224766
224920
  }
224767
- function projectBlockSdt(pmNode) {
224921
+ function projectBlockSdt(pmNode, options) {
224768
224922
  const children = [];
224769
224923
  pmNode.forEach((child) => {
224770
- children.push(projectBlock(child));
224924
+ children.push(projectBlock(child, options));
224771
224925
  });
224772
224926
  return {
224773
224927
  kind: "sdt",
@@ -224779,8 +224933,8 @@ function projectBlockSdt(pmNode) {
224779
224933
  }
224780
224934
  };
224781
224935
  }
224782
- function projectInlineSdt(pmNode) {
224783
- const inlines = projectInlineChildren(pmNode);
224936
+ function projectInlineSdt(pmNode, options) {
224937
+ const inlines = projectInlineChildren(pmNode, options);
224784
224938
  return {
224785
224939
  kind: "sdt",
224786
224940
  id: resolveSdtNodeId(pmNode),
@@ -224817,28 +224971,29 @@ function projectBlockDrawing(pmNode) {
224817
224971
  }
224818
224972
  };
224819
224973
  }
224820
- function projectFallbackBlock(pmNode) {
224821
- const inlines = projectInlineChildren(pmNode);
224974
+ function projectFallbackBlock(pmNode, options) {
224975
+ const inlines = projectInlineChildren(pmNode, options);
224822
224976
  return {
224823
224977
  kind: "paragraph",
224824
224978
  id: resolveNodeId(pmNode),
224825
224979
  paragraph: { inlines }
224826
224980
  };
224827
224981
  }
224828
- function projectInlineChildren(pmNode) {
224982
+ function projectInlineChildren(pmNode, options) {
224829
224983
  const inlines = [];
224830
224984
  pmNode.forEach((child) => {
224831
- const projected = projectInline(child);
224832
- inlines.push(projected);
224985
+ const projected = projectInline(child, options);
224986
+ if (projected)
224987
+ inlines.push(projected);
224833
224988
  });
224834
224989
  return inlines;
224835
224990
  }
224836
- function projectInline(pmNode) {
224991
+ function projectInline(pmNode, options) {
224837
224992
  if (pmNode.isText)
224838
- return projectTextRun(pmNode);
224993
+ return projectTextRun(pmNode, options);
224839
224994
  switch (pmNode.type.name) {
224840
224995
  case "run":
224841
- return projectRunNode(pmNode);
224996
+ return projectRunNode(pmNode, options);
224842
224997
  case "image":
224843
224998
  return projectInlineImage(pmNode);
224844
224999
  case "tab":
@@ -224855,21 +225010,23 @@ function projectInline(pmNode) {
224855
225010
  case "field":
224856
225011
  return projectInlineField(pmNode);
224857
225012
  case "structuredContent":
224858
- return projectInlineSdt(pmNode);
225013
+ return projectInlineSdt(pmNode, options);
224859
225014
  default:
224860
- return projectInlineFallback(pmNode);
225015
+ return projectInlineFallback(pmNode, options);
224861
225016
  }
224862
225017
  }
224863
- function projectRunNode(pmNode) {
225018
+ function projectRunNode(pmNode, options) {
224864
225019
  const runProperties = (pmNode.attrs ?? {}).runProperties;
224865
- const text5 = pmNode.textContent;
225020
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
225021
+ if (isVisibleProjection(options) && text5.length === 0)
225022
+ return null;
224866
225023
  let linkMark;
224867
225024
  pmNode.forEach((child) => {
224868
225025
  if (!linkMark)
224869
225026
  linkMark = child.marks?.find((m$1) => m$1.type.name === "link");
224870
225027
  });
224871
225028
  if (linkMark)
224872
- return buildHyperlinkFromRunNode(pmNode, linkMark);
225029
+ return buildHyperlinkFromRunNode(pmNode, linkMark, options);
224873
225030
  const run2 = {
224874
225031
  kind: "run",
224875
225032
  run: { text: text5 }
@@ -224882,11 +225039,14 @@ function projectRunNode(pmNode) {
224882
225039
  run2.run.props = props;
224883
225040
  return run2;
224884
225041
  }
224885
- function buildHyperlinkFromRunNode(pmNode, linkMark) {
225042
+ function buildHyperlinkFromRunNode(pmNode, linkMark, options) {
224886
225043
  const attrs = linkMark.attrs;
225044
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
225045
+ if (isVisibleProjection(options) && text5.length === 0)
225046
+ return null;
224887
225047
  const childRun = {
224888
225048
  kind: "run",
224889
- run: { text: pmNode.textContent }
225049
+ run: { text: text5 }
224890
225050
  };
224891
225051
  const runProperties = pmNode.attrs?.runProperties;
224892
225052
  const props = extractRunPropsFromRunProperties(runProperties);
@@ -225000,7 +225160,9 @@ function extractRunPropsFromRunProperties(runProperties) {
225000
225160
  }
225001
225161
  return hasProps ? props : undefined;
225002
225162
  }
225003
- function projectTextRun(pmNode) {
225163
+ function projectTextRun(pmNode, options) {
225164
+ if (isVisibleProjection(options) && hasTrackDeleteMark$1(pmNode))
225165
+ return null;
225004
225166
  const marks = pmNode.marks;
225005
225167
  const linkMark = marks.find((m$1) => m$1.type.name === "link");
225006
225168
  if (linkMark)
@@ -225095,10 +225257,13 @@ function projectInlineField(pmNode) {
225095
225257
  }
225096
225258
  };
225097
225259
  }
225098
- function projectInlineFallback(pmNode) {
225260
+ function projectInlineFallback(pmNode, options) {
225261
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent ?? "";
225262
+ if (isVisibleProjection(options) && text5.length === 0)
225263
+ return null;
225099
225264
  return {
225100
225265
  kind: "run",
225101
- run: { text: pmNode.textContent ?? "" }
225266
+ run: { text: text5 }
225102
225267
  };
225103
225268
  }
225104
225269
  function resolveNodeId(pmNode) {
@@ -226151,6 +226316,13 @@ function buildSelectionTargetFromTextRanges(textRanges, story) {
226151
226316
  target.story = story;
226152
226317
  return target;
226153
226318
  }
226319
+ function readCandidateVisibleText(editor, candidate) {
226320
+ const maybeNode = candidate.node;
226321
+ if (maybeNode && typeof maybeNode.childCount === "number" && maybeNode.childCount > 0)
226322
+ return textContentInBlock(maybeNode, { textModel: "visible" });
226323
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
226324
+ `, "");
226325
+ }
226154
226326
  function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyKey, resolverParams) {
226155
226327
  const index2 = getBlockIndex(editor);
226156
226328
  const doc$12 = editor.state.doc;
@@ -226203,10 +226375,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
226203
226375
  }
226204
226376
  });
226205
226377
  }
226206
- const blockStart = candidate.pos + 1;
226207
- const blockEnd = candidate.end - 1;
226208
- const blockText = doc$12.textBetween(blockStart, blockEnd, `
226209
- `, "");
226378
+ const blockText = readCandidateVisibleText(editor, candidate);
226210
226379
  const matchedText = blockText.slice(from$1, to);
226211
226380
  const node2 = doc$12.nodeAt(candidate.pos);
226212
226381
  const nodeType = node2?.type.name ?? "paragraph";
@@ -226215,7 +226384,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
226215
226384
  resolverParams,
226216
226385
  paragraphProperties: node2?.attrs?.paragraphProperties ?? null
226217
226386
  } : undefined;
226218
- const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to).runs);
226387
+ const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to, { textModel: "visible" }).runs);
226219
226388
  const blockRange = {
226220
226389
  start: from$1,
226221
226390
  end: to
@@ -226279,7 +226448,6 @@ function buildBlocksSnippet(editor, blocks2) {
226279
226448
  if (!editor.state?.doc || blocks2.length === 0)
226280
226449
  return;
226281
226450
  const index2 = getBlockIndex(editor);
226282
- const doc$12 = editor.state.doc;
226283
226451
  const matchText = blocks2.map((b$1) => b$1.text).join(`
226284
226452
  `);
226285
226453
  if (matchText.length >= 500)
@@ -226296,10 +226464,7 @@ function buildBlocksSnippet(editor, blocks2) {
226296
226464
  const firstBlock = blocks2[0];
226297
226465
  const firstCandidate = index2.candidates.find((c) => c.nodeId === firstBlock.blockId);
226298
226466
  if (firstCandidate) {
226299
- const blockStart = firstCandidate.pos + 1;
226300
- const blockEnd = firstCandidate.end - 1;
226301
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
226302
- `, "");
226467
+ const fullBlockText = readCandidateVisibleText(editor, firstCandidate);
226303
226468
  const contextStart = Math.max(0, firstBlock.range.start - contextEachSide);
226304
226469
  leftContext = fullBlockText.slice(contextStart, firstBlock.range.start);
226305
226470
  }
@@ -226307,10 +226472,7 @@ function buildBlocksSnippet(editor, blocks2) {
226307
226472
  const lastBlock = blocks2[blocks2.length - 1];
226308
226473
  const lastCandidate = index2.candidates.find((c) => c.nodeId === lastBlock.blockId);
226309
226474
  if (lastCandidate) {
226310
- const blockStart = lastCandidate.pos + 1;
226311
- const blockEnd = lastCandidate.end - 1;
226312
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
226313
- `, "");
226475
+ const fullBlockText = readCandidateVisibleText(editor, lastCandidate);
226314
226476
  const contextEnd = Math.min(fullBlockText.length, lastBlock.range.end + contextEachSide);
226315
226477
  rightContext = fullBlockText.slice(lastBlock.range.end, contextEnd);
226316
226478
  }
@@ -226636,12 +226798,12 @@ function projectMatchToSDNodeResult(editor, address, blockIndex) {
226636
226798
  if (!found2)
226637
226799
  return null;
226638
226800
  return {
226639
- node: projectContentNode(found2.node),
226801
+ node: projectContentNode(found2.node, { textModel: "visible" }),
226640
226802
  address
226641
226803
  };
226642
226804
  }
226643
226805
  return {
226644
- node: projectContentNode(candidate.node),
226806
+ node: projectContentNode(candidate.node, { textModel: "visible" }),
226645
226807
  address
226646
226808
  };
226647
226809
  }
@@ -248382,7 +248544,7 @@ function extractParagraphText(paraNode, paraPos) {
248382
248544
  return;
248383
248545
  }
248384
248546
  if (node2.isText && node2.text) {
248385
- if (hasTrackDeleteMark(node2))
248547
+ if (hasTrackDeleteMark2(node2))
248386
248548
  return;
248387
248549
  const text5 = node2.text;
248388
248550
  const pmFrom = pos;
@@ -248415,7 +248577,7 @@ function extractParagraphText(paraNode, paraPos) {
248415
248577
  }
248416
248578
  }
248417
248579
  }
248418
- function hasTrackDeleteMark(node2) {
248580
+ function hasTrackDeleteMark2(node2) {
248419
248581
  return node2.marks?.some((m$1) => m$1.type.name === "trackDelete") ?? false;
248420
248582
  }
248421
248583
  function isNonTextInlineNode(typeName) {
@@ -279959,7 +280121,8 @@ var Node$13 = class Node$14 {
279959
280121
  replacementGroupId: "",
279960
280122
  replacementSideId: "",
279961
280123
  sharedDeletionId: intent.replacementGroupHint || null,
279962
- recordSharedDeletionId: Boolean(intent.replacementGroupHint)
280124
+ recordSharedDeletionId: Boolean(intent.replacementGroupHint),
280125
+ reassignExistingDeletions: intent.source !== "native" && !intent.preserveExistingReviewState ? "different-user" : false
279963
280126
  });
279964
280127
  if (result.ok === false)
279965
280128
  return result;
@@ -280030,12 +280193,17 @@ var Node$13 = class Node$14 {
280030
280193
  }
280031
280194
  if (existingDelete) {
280032
280195
  const allExistingDeletes = node2.marks.filter((m$1) => m$1.type.name === TrackDeleteMarkName);
280033
- if (reassignExistingDeletions) {
280196
+ const isDifferentUserDeletion = !isSameUserHighConfidence(classifyOwnership({
280197
+ currentUser: ctx$1.currentIdentity,
280198
+ change: getChangeAuthorIdentity(existingDelete.attrs)
280199
+ }));
280200
+ if (reassignExistingDeletions === "all" || reassignExistingDeletions === "different-user" && isDifferentUserDeletion) {
280034
280201
  ops.push({
280035
280202
  kind: "reassign",
280036
280203
  from: segFrom,
280037
280204
  to: segTo,
280038
280205
  node: node2,
280206
+ parentId: existingDelete.attrs.id || existingDelete.attrs.overlapParentId || "",
280039
280207
  existingDeleteMarks: allExistingDeletes
280040
280208
  });
280041
280209
  return;
@@ -280076,7 +280244,7 @@ var Node$13 = class Node$14 {
280076
280244
  if (op.kind === "reassign") {
280077
280245
  const mark2 = makeDeleteMark(ctx$1, {
280078
280246
  id: deletionId,
280079
- overlapParentId: "",
280247
+ overlapParentId: op.parentId || "",
280080
280248
  replacementGroupId,
280081
280249
  replacementSideId
280082
280250
  });
@@ -280190,11 +280358,11 @@ var Node$13 = class Node$14 {
280190
280358
  }, compileOrdinaryTextReplace = (ctx$1, intent, sanitizedSlice, replacementParentId) => {
280191
280359
  const sharedId = intent.replacements === "paired" && !replacementParentId ? intent.replacementGroupHint || v4_default() : null;
280192
280360
  const replacementGroupId = sharedId ?? "";
280193
- let positionTo = intent.to;
280361
+ let positionTo = replacementParentId ? intent.from : intent.to;
280194
280362
  if (intent.from !== intent.to && intent.probeForDeletionSpan) {
280195
280363
  const probePos = Math.max(intent.from, intent.to - 1);
280196
280364
  const deletionSpan = findMarkPosition(ctx$1.tr.doc, probePos, TrackDeleteMarkName);
280197
- if (deletionSpan && deletionSpan.to > positionTo)
280365
+ if (!replacementParentId && deletionSpan && deletionSpan.to > positionTo)
280198
280366
  positionTo = deletionSpan.to;
280199
280367
  }
280200
280368
  const baseParentIsTextblock = ctx$1.tr.doc.resolve(positionTo).parent?.isTextblock;
@@ -280287,11 +280455,11 @@ var Node$13 = class Node$14 {
280287
280455
  let deletionMark = null;
280288
280456
  if (intent.from !== intent.to) {
280289
280457
  const stepsBefore = ctx$1.tr.steps.length;
280290
- const delResult = applyTrackedDelete(ctx$1, intent.from, intent.to, {
280458
+ const delResult = applyTrackedDelete(ctx$1, insertedLength > 0 && positionTo <= intent.from ? intent.from + insertedLength : intent.from, insertedLength > 0 && positionTo <= intent.from ? intent.to + insertedLength : intent.to, {
280291
280459
  replacementGroupId,
280292
280460
  replacementSideId: sharedId ? `${sharedId}#deleted` : "",
280293
280461
  sharedDeletionId: sharedId,
280294
- reassignExistingDeletions: Boolean(sharedId)
280462
+ reassignExistingDeletions: sharedId || replacementParentId ? "all" : false
280295
280463
  });
280296
280464
  if (delResult.ok === false)
280297
280465
  return delResult;
@@ -280784,13 +280952,14 @@ var Node$13 = class Node$14 {
280784
280952
  let intent;
280785
280953
  try {
280786
280954
  const preserveExistingReviewState = tr.getMeta("protectTrackedReviewState") === true;
280955
+ const source = tr.getMeta("inputType") === "programmatic" ? "document-api" : "native";
280787
280956
  if (step2.from === step2.to && step2.slice.content.size > 0)
280788
280957
  intent = makeTextInsertIntent({
280789
280958
  at: step2.from,
280790
280959
  content: step2.slice,
280791
280960
  user,
280792
280961
  date: date6,
280793
- source: "native",
280962
+ source,
280794
280963
  preserveExistingReviewState
280795
280964
  });
280796
280965
  else if (step2.from !== step2.to && step2.slice.content.size === 0)
@@ -280799,7 +280968,7 @@ var Node$13 = class Node$14 {
280799
280968
  to: step2.to,
280800
280969
  user,
280801
280970
  date: date6,
280802
- source: "native",
280971
+ source,
280803
280972
  preserveExistingReviewState
280804
280973
  });
280805
280974
  else if (step2.from !== step2.to && step2.slice.content.size > 0) {
@@ -280810,7 +280979,7 @@ var Node$13 = class Node$14 {
280810
280979
  replacements,
280811
280980
  user,
280812
280981
  date: date6,
280813
- source: "native",
280982
+ source,
280814
280983
  preserveExistingReviewState
280815
280984
  });
280816
280985
  if (tr.steps.length === 1)
@@ -281922,6 +282091,7 @@ var Node$13 = class Node$14 {
281922
282091
  else if (change.type === CanonicalChangeType.Replacement) {
281923
282092
  const repResult = planReplacementDecision({
281924
282093
  ops,
282094
+ graph,
281925
282095
  change,
281926
282096
  decision,
281927
282097
  removedRanges,
@@ -282066,7 +282236,7 @@ var Node$13 = class Node$14 {
282066
282236
  });
282067
282237
  if (isFull)
282068
282238
  retired.add(change.id);
282069
- }, planReplacementDecision = ({ ops, change, decision, removedRanges, retired }) => {
282239
+ }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
282070
282240
  const inserted = change.insertedSegments;
282071
282241
  const deleted = change.deletedSegments;
282072
282242
  if (!inserted.length || !deleted.length)
@@ -282111,16 +282281,114 @@ var Node$13 = class Node$14 {
282111
282281
  cause: `reject-replacement-inserted:${change.id}`
282112
282282
  });
282113
282283
  }
282114
- for (const seg of deleted)
282284
+ const parentRestore = getParentRestoreContext({
282285
+ graph,
282286
+ change
282287
+ });
282288
+ for (const seg of deleted) {
282115
282289
  pushRemoveMarkOpsForSegment({
282116
282290
  ops,
282117
282291
  segment: seg,
282118
282292
  changeId: change.id,
282119
282293
  side: SegmentSide.Deleted
282120
282294
  });
282295
+ if (parentRestore?.mark)
282296
+ pushAddMarkOpsForSegment({
282297
+ ops,
282298
+ segment: seg,
282299
+ changeId: parentRestore.mark.attrs?.id || change.parent || change.id,
282300
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
282301
+ mark: parentRestore.mark
282302
+ });
282303
+ }
282304
+ for (const sibling of parentRestore?.siblingSegments ?? []) {
282305
+ pushRemoveMarkOpsForSegment({
282306
+ ops,
282307
+ segment: sibling,
282308
+ changeId: sibling.changeId,
282309
+ side: sibling.side
282310
+ });
282311
+ pushAddMarkOpsForSegment({
282312
+ ops,
282313
+ segment: sibling,
282314
+ changeId: parentRestore.mark.attrs?.id || sibling.changeId,
282315
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
282316
+ mark: parentRestore.mark
282317
+ });
282318
+ retired.add(sibling.changeId);
282319
+ }
282121
282320
  }
282122
282321
  retired.add(change.id);
282123
282322
  return { ok: true };
282323
+ }, getParentRestoreContext = ({ graph, change }) => {
282324
+ const explicit = getExplicitParentRestoreContext({
282325
+ graph,
282326
+ change
282327
+ });
282328
+ if (explicit)
282329
+ return explicit;
282330
+ return inferAdjacentParentRestoreContext({
282331
+ graph,
282332
+ change
282333
+ });
282334
+ }, getExplicitParentRestoreContext = ({ graph, change }) => {
282335
+ if (!change.parent)
282336
+ return null;
282337
+ const parent = graph.changes.get(change.parent);
282338
+ if (!parent)
282339
+ return null;
282340
+ if (parent.type === CanonicalChangeType.Insertion) {
282341
+ const mark2 = parent.insertedSegments[0]?.mark ?? null;
282342
+ return mark2 ? {
282343
+ mark: mark2,
282344
+ siblingSegments: []
282345
+ } : null;
282346
+ }
282347
+ if (parent.type === CanonicalChangeType.Deletion) {
282348
+ const mark2 = parent.deletedSegments[0]?.mark ?? null;
282349
+ return mark2 ? {
282350
+ mark: mark2,
282351
+ siblingSegments: []
282352
+ } : null;
282353
+ }
282354
+ return null;
282355
+ }, inferAdjacentParentRestoreContext = ({ graph, change }) => {
282356
+ if (!change.deletedSegments.length || !change.segments.length)
282357
+ return null;
282358
+ const from$1 = Math.min(...change.segments.map((segment) => segment.from));
282359
+ const to = Math.max(...change.segments.map((segment) => segment.to));
282360
+ const before = nearestSegmentBefore({
282361
+ graph,
282362
+ change,
282363
+ from: from$1
282364
+ });
282365
+ const after = nearestSegmentAfter({
282366
+ graph,
282367
+ change,
282368
+ to
282369
+ });
282370
+ if (!before || !after)
282371
+ return null;
282372
+ if (!areParentRestorePeers(before, after))
282373
+ return null;
282374
+ return {
282375
+ mark: before.mark,
282376
+ siblingSegments: after.changeId === before.changeId ? [] : [after]
282377
+ };
282378
+ }, nearestSegmentBefore = ({ graph, change, from: from$1 }) => {
282379
+ return graph.segments.filter((segment) => segment.changeId !== change.id && segment.to <= from$1).sort((a2, b$1) => b$1.to - a2.to || b$1.from - a2.from)[0];
282380
+ }, nearestSegmentAfter = ({ graph, change, to }) => {
282381
+ return graph.segments.filter((segment) => segment.changeId !== change.id && segment.from >= to).sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to)[0];
282382
+ }, areParentRestorePeers = (left$1, right$1) => {
282383
+ if (!left$1 || !right$1)
282384
+ return false;
282385
+ if (left$1.side !== right$1.side)
282386
+ return false;
282387
+ if (left$1.side !== SegmentSide.Inserted && left$1.side !== SegmentSide.Deleted)
282388
+ return false;
282389
+ if (left$1.markType !== right$1.markType)
282390
+ return false;
282391
+ return left$1.attrs.author === right$1.attrs.author && left$1.attrs.authorEmail === right$1.attrs.authorEmail && left$1.attrs.date === right$1.attrs.date;
282124
282392
  }, planFormattingDecision = ({ ops, change, decision, retired }) => {
282125
282393
  for (const seg of change.formattingSegments)
282126
282394
  if (decision === "accept")
@@ -282262,6 +282530,21 @@ var Node$13 = class Node$14 {
282262
282530
  mark: run2.mark
282263
282531
  });
282264
282532
  }
282533
+ }, pushAddMarkOpsForSegment = ({ ops, segment, changeId, side, mark: mark2, from: from$1 = segment.from, to = segment.to }) => {
282534
+ for (const run2 of getSegmentMarkRuns(segment)) {
282535
+ const clippedFrom = Math.max(from$1, run2.from);
282536
+ const clippedTo = Math.min(to, run2.to);
282537
+ if (clippedFrom >= clippedTo)
282538
+ continue;
282539
+ ops.push({
282540
+ kind: "addMark",
282541
+ from: clippedFrom,
282542
+ to: clippedTo,
282543
+ changeId,
282544
+ side,
282545
+ mark: mark2
282546
+ });
282547
+ }
282265
282548
  }, getSegmentMarkRuns = (segment) => {
282266
282549
  return segment.markRuns?.length ? segment.markRuns : [{
282267
282550
  from: segment.from,
@@ -283269,7 +283552,7 @@ var Node$13 = class Node$14 {
283269
283552
  this.deco = deco;
283270
283553
  }
283271
283554
  }, searchKey, BLOCK_SEPARATOR = `
283272
- `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$1 = (node2) => node2?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
283555
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node2) => node2?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
283273
283556
  const matches2 = [];
283274
283557
  for (const indexMatch of indexMatches) {
283275
283558
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
@@ -308415,13 +308698,13 @@ menclose::after {
308415
308698
  return;
308416
308699
  console.log(...args$1);
308417
308700
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
308418
- var init_src_GT3sTaEO_es = __esm(() => {
308701
+ var init_src_BlbgbalI_es = __esm(() => {
308419
308702
  init_rolldown_runtime_Bg48TavK_es();
308420
- init_SuperConverter_CQg2Zq8Z_es();
308703
+ init_SuperConverter_DHtZjY65_es();
308421
308704
  init_jszip_C49i9kUs_es();
308422
308705
  init_xml_js_CqGKpaft_es();
308423
308706
  init_uuid_qzgm05fK_es();
308424
- init_create_headless_toolbar_BjHgBUHt_es();
308707
+ init_create_headless_toolbar_lxRAue2X_es();
308425
308708
  init_constants_D_X7xF4s_es();
308426
308709
  init_dist_B8HfvhaK_es();
308427
308710
  init_unified_Dsuw2be5_es();
@@ -326274,7 +326557,7 @@ function print() { __p += __j.call(arguments, '') }
326274
326557
  const text5 = node2.text || "";
326275
326558
  if (!text5.length)
326276
326559
  return;
326277
- if (hasTrackDeleteMark$1(node2)) {
326560
+ if (hasTrackDeleteMark$2(node2)) {
326278
326561
  appendDeletionBarrier();
326279
326562
  return;
326280
326563
  }
@@ -326316,7 +326599,7 @@ function print() { __p += __j.call(arguments, '') }
326316
326599
  }
326317
326600
  #walkNode(node2, docPos, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
326318
326601
  if (node2.isText) {
326319
- if (searchModel === "visible" && hasTrackDeleteMark$1(node2)) {
326602
+ if (searchModel === "visible" && hasTrackDeleteMark$2(node2)) {
326320
326603
  if (context?.deletionBarrierActive)
326321
326604
  return offset$1;
326322
326605
  addSegment({
@@ -342856,11 +343139,11 @@ function print() { __p += __j.call(arguments, '') }
342856
343139
  ]);
342857
343140
  });
342858
343141
 
342859
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BghVjsf3.es.js
343142
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BKVodoDg.es.js
342860
343143
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
342861
- var init_create_super_doc_ui_BghVjsf3_es = __esm(() => {
342862
- init_SuperConverter_CQg2Zq8Z_es();
342863
- init_create_headless_toolbar_BjHgBUHt_es();
343144
+ var init_create_super_doc_ui_BKVodoDg_es = __esm(() => {
343145
+ init_SuperConverter_DHtZjY65_es();
343146
+ init_create_headless_toolbar_lxRAue2X_es();
342864
343147
  MOD_ALIASES = new Set([
342865
343148
  "Mod",
342866
343149
  "Meta",
@@ -342902,16 +343185,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
342902
343185
 
342903
343186
  // ../../packages/superdoc/dist/super-editor.es.js
342904
343187
  var init_super_editor_es = __esm(() => {
342905
- init_src_GT3sTaEO_es();
342906
- init_SuperConverter_CQg2Zq8Z_es();
343188
+ init_src_BlbgbalI_es();
343189
+ init_SuperConverter_DHtZjY65_es();
342907
343190
  init_jszip_C49i9kUs_es();
342908
343191
  init_xml_js_CqGKpaft_es();
342909
- init_create_headless_toolbar_BjHgBUHt_es();
343192
+ init_create_headless_toolbar_lxRAue2X_es();
342910
343193
  init_constants_D_X7xF4s_es();
342911
343194
  init_dist_B8HfvhaK_es();
342912
343195
  init_unified_Dsuw2be5_es();
342913
343196
  init_DocxZipper_nv_KfOqb_es();
342914
- init_create_super_doc_ui_BghVjsf3_es();
343197
+ init_create_super_doc_ui_BKVodoDg_es();
342915
343198
  init_ui_C5PAS9hY_es();
342916
343199
  init_eventemitter3_BnGqBE_Q_es();
342917
343200
  init_errors_CNaD6vcg_es();
@@ -364779,14 +365062,27 @@ var init_index_cache = __esm(() => {
364779
365062
  cacheByEditor2 = new WeakMap;
364780
365063
  });
364781
365064
 
365065
+ // ../../packages/super-editor/src/editors/v1/extensions/track-changes/constants.js
365066
+ var TrackInsertMarkName2 = "trackInsert", TrackDeleteMarkName2 = "trackDelete", TrackFormatMarkName2 = "trackFormat";
365067
+ var init_constants = () => {};
365068
+
364782
365069
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/text-offset-resolver.ts
365070
+ function isVisibleTextModel2(options) {
365071
+ return options?.textModel === "visible";
365072
+ }
365073
+ function hasTrackDeleteMark3(node3) {
365074
+ return node3.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2) ?? false;
365075
+ }
365076
+ function shouldSkipTextNode2(node3, options) {
365077
+ return isVisibleTextModel2(options) && hasTrackDeleteMark3(node3);
365078
+ }
364783
365079
  function resolveSegmentPosition3(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
364784
365080
  if (segmentLength <= 1) {
364785
365081
  return targetOffset <= segmentStart ? docFrom : docTo;
364786
365082
  }
364787
365083
  return docFrom + (targetOffset - segmentStart);
364788
365084
  }
364789
- function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
365085
+ function pmPositionToTextOffset2(blockNode, blockPos, pmPos, options) {
364790
365086
  const contentStart = blockPos + 1;
364791
365087
  if (pmPos <= contentStart)
364792
365088
  return 0;
@@ -364798,6 +365094,11 @@ function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
364798
365094
  if (node3.isText) {
364799
365095
  const text5 = node3.text ?? "";
364800
365096
  const endPos = docPos + text5.length;
365097
+ if (shouldSkipTextNode2(node3, options)) {
365098
+ if (pmPos < endPos)
365099
+ done = true;
365100
+ return;
365101
+ }
364801
365102
  if (pmPos >= endPos) {
364802
365103
  offset2 += text5.length;
364803
365104
  } else {
@@ -364841,10 +365142,12 @@ function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
364841
365142
  visitContent(blockNode, contentStart);
364842
365143
  return offset2;
364843
365144
  }
364844
- function computeTextContentLength2(blockNode) {
365145
+ function computeTextContentLength2(blockNode, options) {
364845
365146
  let length3 = 0;
364846
365147
  const walk = (node3) => {
364847
365148
  if (node3.isText) {
365149
+ if (shouldSkipTextNode2(node3, options))
365150
+ return;
364848
365151
  length3 += (node3.text ?? "").length;
364849
365152
  return;
364850
365153
  }
@@ -364871,7 +365174,7 @@ function computeTextContentLength2(blockNode) {
364871
365174
  }
364872
365175
  return length3;
364873
365176
  }
364874
- function resolveTextRangeInBlock2(blockNode, blockPos, range) {
365177
+ function resolveTextRangeInBlock2(blockNode, blockPos, range, options) {
364875
365178
  if (range.start < 0 || range.end < range.start)
364876
365179
  return null;
364877
365180
  let offset2 = 0;
@@ -364906,7 +365209,7 @@ function resolveTextRangeInBlock2(blockNode, blockPos, range) {
364906
365209
  const walkNode3 = (node3, docPos) => {
364907
365210
  if (node3.isText) {
364908
365211
  const text5 = node3.text ?? "";
364909
- if (text5.length > 0) {
365212
+ if (text5.length > 0 && !shouldSkipTextNode2(node3, options)) {
364910
365213
  advanceSegment(text5.length, docPos, docPos + text5.length);
364911
365214
  }
364912
365215
  return;
@@ -364928,6 +365231,43 @@ function resolveTextRangeInBlock2(blockNode, blockPos, range) {
364928
365231
  return null;
364929
365232
  return { from: fromPos, to: toPos };
364930
365233
  }
365234
+ function textContentInBlock2(blockNode, options) {
365235
+ let text5 = "";
365236
+ const walkNode3 = (node3) => {
365237
+ if (node3.isText) {
365238
+ if (!shouldSkipTextNode2(node3, options)) {
365239
+ text5 += node3.text ?? "";
365240
+ }
365241
+ return;
365242
+ }
365243
+ if (node3.isLeaf) {
365244
+ text5 += "";
365245
+ return;
365246
+ }
365247
+ let isFirstChild2 = true;
365248
+ for (let i4 = 0;i4 < node3.childCount; i4++) {
365249
+ const child = node3.child(i4);
365250
+ if (child.isBlock && !isFirstChild2)
365251
+ text5 += `
365252
+ `;
365253
+ walkNode3(child);
365254
+ isFirstChild2 = false;
365255
+ }
365256
+ };
365257
+ let isFirstChild = true;
365258
+ for (let i4 = 0;i4 < blockNode.childCount; i4++) {
365259
+ const child = blockNode.child(i4);
365260
+ if (child.isBlock && !isFirstChild)
365261
+ text5 += `
365262
+ `;
365263
+ walkNode3(child);
365264
+ isFirstChild = false;
365265
+ }
365266
+ return text5;
365267
+ }
365268
+ var init_text_offset_resolver = __esm(() => {
365269
+ init_constants();
365270
+ });
364931
365271
 
364932
365272
  // ../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js
364933
365273
  function findDiffStart2(a2, b2, pos) {
@@ -367169,7 +367509,7 @@ function parentAllowsNodeAt2(tr, absPos, nodeType) {
367169
367509
  return true;
367170
367510
  return contentMatch.matchType(nodeType) != null;
367171
367511
  }
367172
- function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367512
+ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback, options = {}) {
367173
367513
  const anyDoc = doc5;
367174
367514
  if (typeof anyDoc.nodesBetween !== "function") {
367175
367515
  if (typeof anyDoc.textBetween === "function") {
@@ -367191,6 +367531,9 @@ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367191
367531
  return false;
367192
367532
  }
367193
367533
  if (node3.isText) {
367534
+ if (options.textModel === "visible" && node3.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2)) {
367535
+ return false;
367536
+ }
367194
367537
  const start2 = Math.max(from3, pos) - pos;
367195
367538
  const end = Math.min(to, pos + node3.nodeSize) - pos;
367196
367539
  const text5 = typeof node3.text === "string" ? node3.text : "".repeat(node3.nodeSize);
@@ -367220,6 +367563,7 @@ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367220
367563
  }
367221
367564
  var init_text_with_tabs = __esm(() => {
367222
367565
  init_dist2();
367566
+ init_constants();
367223
367567
  });
367224
367568
 
367225
367569
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/text-mutation-resolution.ts
@@ -367270,7 +367614,7 @@ function resolveTextTarget2(editor, target) {
367270
367614
  const block = matches3[0];
367271
367615
  if (!block)
367272
367616
  return null;
367273
- return resolveTextRangeInBlock2(block.node, block.pos, target.range);
367617
+ return resolveTextRangeInBlock2(block.node, block.pos, target.range, { textModel: "visible" });
367274
367618
  }
367275
367619
  function resolveInlineInsertPosition2(editor, at, operationName) {
367276
367620
  const firstSegment = at.segments[0];
@@ -367317,8 +367661,8 @@ function resolveDefaultInsertTarget2(editor) {
367317
367661
  for (let i4 = index2.candidates.length - 1;i4 >= 0; i4--) {
367318
367662
  const candidate = index2.candidates[i4];
367319
367663
  if (topLevelPositions.has(candidate.pos) && isTextBlockCandidate2(candidate)) {
367320
- const textLength = computeTextContentLength2(candidate.node);
367321
- const range = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: textLength, end: textLength });
367664
+ const textLength = computeTextContentLength2(candidate.node, { textModel: "visible" });
367665
+ const range = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: textLength, end: textLength }, { textModel: "visible" });
367322
367666
  if (!range)
367323
367667
  continue;
367324
367668
  return {
@@ -367452,6 +367796,7 @@ var init_adapter_utils = __esm(() => {
367452
367796
  init_src();
367453
367797
  init_index_cache();
367454
367798
  init_node_address_resolver();
367799
+ init_text_offset_resolver();
367455
367800
  init_text_mutation_resolution();
367456
367801
  init_errors4();
367457
367802
  init_text_with_tabs();
@@ -371205,11 +371550,17 @@ var init_sections_resolver = __esm(() => {
371205
371550
  });
371206
371551
 
371207
371552
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/sd-projection.ts
371208
- function projectContentNode2(pmNode) {
371209
- return projectBlock2(pmNode);
371553
+ function isVisibleProjection2(options) {
371554
+ return options?.textModel === "visible";
371555
+ }
371556
+ function hasTrackDeleteMark4(pmNode) {
371557
+ return pmNode.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2) ?? false;
371210
371558
  }
371211
- function projectInlineNode2(pmNode) {
371212
- return projectInline2(pmNode);
371559
+ function projectContentNode2(pmNode, options) {
371560
+ return projectBlock2(pmNode, options);
371561
+ }
371562
+ function projectInlineNode2(pmNode, options) {
371563
+ return projectInline2(pmNode, options) ?? { kind: "run", run: { text: "" } };
371213
371564
  }
371214
371565
  function projectMarkBasedInline2(editor, candidate) {
371215
371566
  const { nodeType, anchor, attrs } = candidate;
@@ -371254,8 +371605,9 @@ function resolveTextByBlockId2(editor, anchor) {
371254
371605
  function projectDocument2(editor, options) {
371255
371606
  const doc5 = editor.state.doc;
371256
371607
  const body = [];
371608
+ const projectionOptions = { textModel: "visible" };
371257
371609
  doc5.forEach((child) => {
371258
- body.push(projectBlock2(child));
371610
+ body.push(projectBlock2(child, projectionOptions));
371259
371611
  });
371260
371612
  const sections = projectSections2(editor);
371261
371613
  const numbering = projectNumberingCatalog2(editor);
@@ -371344,27 +371696,27 @@ function projectNumberingCatalog2(editor) {
371344
371696
  }
371345
371697
  return Object.keys(catalog.definitions).length > 0 ? catalog : undefined;
371346
371698
  }
371347
- function projectBlock2(pmNode) {
371699
+ function projectBlock2(pmNode, options) {
371348
371700
  const typeName = pmNode.type.name;
371349
371701
  switch (typeName) {
371350
371702
  case "paragraph":
371351
- return projectParagraphOrHeading2(pmNode);
371703
+ return projectParagraphOrHeading2(pmNode, options);
371352
371704
  case "heading":
371353
- return projectHeadingNode2(pmNode);
371705
+ return projectHeadingNode2(pmNode, options);
371354
371706
  case "table":
371355
- return projectTable2(pmNode);
371707
+ return projectTable2(pmNode, options);
371356
371708
  case "bulletList":
371357
371709
  case "orderedList":
371358
- return projectList2(pmNode, typeName === "orderedList");
371710
+ return projectList2(pmNode, typeName === "orderedList", options);
371359
371711
  case "listItem":
371360
- return projectListItemAsContent2(pmNode);
371712
+ return projectListItemAsContent2(pmNode, options);
371361
371713
  case "image":
371362
371714
  return projectBlockImage2(pmNode);
371363
371715
  case "tableOfContents":
371364
371716
  return projectToc2(pmNode);
371365
371717
  case "sdt":
371366
371718
  case "structuredContentBlock":
371367
- return projectBlockSdt2(pmNode);
371719
+ return projectBlockSdt2(pmNode, options);
371368
371720
  case "sectionBreak":
371369
371721
  return projectSectionBreak2(pmNode);
371370
371722
  case "pageBreak":
@@ -371373,25 +371725,25 @@ function projectBlock2(pmNode) {
371373
371725
  case "drawing":
371374
371726
  return projectBlockDrawing2(pmNode);
371375
371727
  default:
371376
- return projectFallbackBlock2(pmNode);
371728
+ return projectFallbackBlock2(pmNode, options);
371377
371729
  }
371378
371730
  }
371379
- function projectParagraphOrHeading2(pmNode) {
371731
+ function projectParagraphOrHeading2(pmNode, options) {
371380
371732
  const attrs = pmNode.attrs;
371381
371733
  const headingLevel = getHeadingLevel2(attrs?.paragraphProperties?.styleId);
371382
371734
  if (headingLevel && headingLevel >= 1 && headingLevel <= 6) {
371383
- return buildHeading2(pmNode, attrs, headingLevel);
371735
+ return buildHeading2(pmNode, attrs, headingLevel, options);
371384
371736
  }
371385
- return buildParagraph2(pmNode, attrs);
371737
+ return buildParagraph2(pmNode, attrs, options);
371386
371738
  }
371387
- function projectHeadingNode2(pmNode) {
371739
+ function projectHeadingNode2(pmNode, options) {
371388
371740
  const attrs = pmNode.attrs;
371389
371741
  const rawLevel = pmNode.attrs?.level;
371390
371742
  const level = rawLevel ?? getHeadingLevel2(attrs?.paragraphProperties?.styleId) ?? 1;
371391
- return buildHeading2(pmNode, attrs, level);
371743
+ return buildHeading2(pmNode, attrs, level, options);
371392
371744
  }
371393
- function buildParagraph2(pmNode, attrs) {
371394
- const inlines = projectInlineChildren2(pmNode);
371745
+ function buildParagraph2(pmNode, attrs, options) {
371746
+ const inlines = projectInlineChildren2(pmNode, options);
371395
371747
  const result = {
371396
371748
  kind: "paragraph",
371397
371749
  id: resolveNodeId2(pmNode),
@@ -371405,8 +371757,8 @@ function buildParagraph2(pmNode, attrs) {
371405
371757
  result.paragraph.props = props;
371406
371758
  return result;
371407
371759
  }
371408
- function buildHeading2(pmNode, attrs, level) {
371409
- const inlines = projectInlineChildren2(pmNode);
371760
+ function buildHeading2(pmNode, attrs, level, options) {
371761
+ const inlines = projectInlineChildren2(pmNode, options);
371410
371762
  const result = {
371411
371763
  kind: "heading",
371412
371764
  id: resolveNodeId2(pmNode),
@@ -371420,13 +371772,13 @@ function buildHeading2(pmNode, attrs, level) {
371420
371772
  result.heading.props = props;
371421
371773
  return result;
371422
371774
  }
371423
- function projectTable2(pmNode) {
371775
+ function projectTable2(pmNode, options) {
371424
371776
  const attrs = pmNode.attrs;
371425
371777
  const pmAttrs = pmNode.attrs;
371426
371778
  const rows = [];
371427
371779
  pmNode.forEach((child) => {
371428
371780
  if (child.type.name === "tableRow") {
371429
- rows.push(projectTableRow2(child));
371781
+ rows.push(projectTableRow2(child, options));
371430
371782
  }
371431
371783
  });
371432
371784
  const result = {
@@ -371458,11 +371810,11 @@ function projectTable2(pmNode) {
371458
371810
  }
371459
371811
  return result;
371460
371812
  }
371461
- function projectTableRow2(pmNode) {
371813
+ function projectTableRow2(pmNode, options) {
371462
371814
  const cells = [];
371463
371815
  pmNode.forEach((child) => {
371464
371816
  if (child.type.name === "tableCell" || child.type.name === "tableHeader") {
371465
- cells.push(projectTableCell2(child));
371817
+ cells.push(projectTableCell2(child, options));
371466
371818
  }
371467
371819
  });
371468
371820
  const row2 = { cells };
@@ -371476,11 +371828,11 @@ function projectTableRow2(pmNode) {
371476
371828
  }
371477
371829
  return row2;
371478
371830
  }
371479
- function projectTableCell2(pmNode) {
371831
+ function projectTableCell2(pmNode, options) {
371480
371832
  const attrs = pmNode.attrs;
371481
371833
  const content3 = [];
371482
371834
  pmNode.forEach((child) => {
371483
- content3.push(projectBlock2(child));
371835
+ content3.push(projectBlock2(child, options));
371484
371836
  });
371485
371837
  const cell2 = { content: content3 };
371486
371838
  if (attrs?.colspan && attrs.colspan > 1)
@@ -371494,11 +371846,11 @@ function projectTableCell2(pmNode) {
371494
371846
  }
371495
371847
  return cell2;
371496
371848
  }
371497
- function projectList2(pmNode, ordered) {
371849
+ function projectList2(pmNode, ordered, options) {
371498
371850
  const items = [];
371499
371851
  pmNode.forEach((child) => {
371500
371852
  if (child.type.name === "listItem") {
371501
- items.push(projectListItem2(child));
371853
+ items.push(projectListItem2(child, options));
371502
371854
  }
371503
371855
  });
371504
371856
  const result = {
@@ -371514,10 +371866,10 @@ function projectList2(pmNode, ordered) {
371514
371866
  result.list.styleRef = attrs.listStyleId;
371515
371867
  return result;
371516
371868
  }
371517
- function projectListItem2(pmNode) {
371869
+ function projectListItem2(pmNode, options) {
371518
371870
  const content3 = [];
371519
371871
  pmNode.forEach((child) => {
371520
- content3.push(projectBlock2(child));
371872
+ content3.push(projectBlock2(child, options));
371521
371873
  });
371522
371874
  const item = {
371523
371875
  level: pmNode.attrs?.level ?? 0,
@@ -371525,8 +371877,8 @@ function projectListItem2(pmNode) {
371525
371877
  };
371526
371878
  return item;
371527
371879
  }
371528
- function projectListItemAsContent2(pmNode) {
371529
- const inlines = projectInlineChildren2(pmNode);
371880
+ function projectListItemAsContent2(pmNode, options) {
371881
+ const inlines = projectInlineChildren2(pmNode, options);
371530
371882
  return {
371531
371883
  kind: "paragraph",
371532
371884
  id: resolveNodeId2(pmNode),
@@ -371572,10 +371924,10 @@ function extractSdtMetadata2(attrs) {
371572
371924
  ...lock && lock !== "none" ? { lock } : {}
371573
371925
  };
371574
371926
  }
371575
- function projectBlockSdt2(pmNode) {
371927
+ function projectBlockSdt2(pmNode, options) {
371576
371928
  const children = [];
371577
371929
  pmNode.forEach((child) => {
371578
- children.push(projectBlock2(child));
371930
+ children.push(projectBlock2(child, options));
371579
371931
  });
371580
371932
  return {
371581
371933
  kind: "sdt",
@@ -371587,8 +371939,8 @@ function projectBlockSdt2(pmNode) {
371587
371939
  }
371588
371940
  };
371589
371941
  }
371590
- function projectInlineSdt2(pmNode) {
371591
- const inlines = projectInlineChildren2(pmNode);
371942
+ function projectInlineSdt2(pmNode, options) {
371943
+ const inlines = projectInlineChildren2(pmNode, options);
371592
371944
  return {
371593
371945
  kind: "sdt",
371594
371946
  id: resolveSdtNodeId2(pmNode),
@@ -371627,29 +371979,30 @@ function projectBlockDrawing2(pmNode) {
371627
371979
  }
371628
371980
  };
371629
371981
  }
371630
- function projectFallbackBlock2(pmNode) {
371631
- const inlines = projectInlineChildren2(pmNode);
371982
+ function projectFallbackBlock2(pmNode, options) {
371983
+ const inlines = projectInlineChildren2(pmNode, options);
371632
371984
  return {
371633
371985
  kind: "paragraph",
371634
371986
  id: resolveNodeId2(pmNode),
371635
371987
  paragraph: { inlines }
371636
371988
  };
371637
371989
  }
371638
- function projectInlineChildren2(pmNode) {
371990
+ function projectInlineChildren2(pmNode, options) {
371639
371991
  const inlines = [];
371640
371992
  pmNode.forEach((child) => {
371641
- const projected = projectInline2(child);
371642
- inlines.push(projected);
371993
+ const projected = projectInline2(child, options);
371994
+ if (projected)
371995
+ inlines.push(projected);
371643
371996
  });
371644
371997
  return inlines;
371645
371998
  }
371646
- function projectInline2(pmNode) {
371999
+ function projectInline2(pmNode, options) {
371647
372000
  if (pmNode.isText) {
371648
- return projectTextRun2(pmNode);
372001
+ return projectTextRun2(pmNode, options);
371649
372002
  }
371650
372003
  switch (pmNode.type.name) {
371651
372004
  case "run":
371652
- return projectRunNode2(pmNode);
372005
+ return projectRunNode2(pmNode, options);
371653
372006
  case "image":
371654
372007
  return projectInlineImage2(pmNode);
371655
372008
  case "tab":
@@ -371666,15 +372019,17 @@ function projectInline2(pmNode) {
371666
372019
  case "field":
371667
372020
  return projectInlineField2(pmNode);
371668
372021
  case "structuredContent":
371669
- return projectInlineSdt2(pmNode);
372022
+ return projectInlineSdt2(pmNode, options);
371670
372023
  default:
371671
- return projectInlineFallback2(pmNode);
372024
+ return projectInlineFallback2(pmNode, options);
371672
372025
  }
371673
372026
  }
371674
- function projectRunNode2(pmNode) {
372027
+ function projectRunNode2(pmNode, options) {
371675
372028
  const attrs = pmNode.attrs ?? {};
371676
372029
  const runProperties = attrs.runProperties;
371677
- const text5 = pmNode.textContent;
372030
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent;
372031
+ if (isVisibleProjection2(options) && text5.length === 0)
372032
+ return null;
371678
372033
  let linkMark;
371679
372034
  pmNode.forEach((child) => {
371680
372035
  if (!linkMark) {
@@ -371682,7 +372037,7 @@ function projectRunNode2(pmNode) {
371682
372037
  }
371683
372038
  });
371684
372039
  if (linkMark) {
371685
- return buildHyperlinkFromRunNode2(pmNode, linkMark);
372040
+ return buildHyperlinkFromRunNode2(pmNode, linkMark, options);
371686
372041
  }
371687
372042
  const run2 = { kind: "run", run: { text: text5 } };
371688
372043
  const styleRef = typeof runProperties?.rStyle === "string" ? runProperties.rStyle : typeof runProperties?.styleId === "string" ? runProperties.styleId : undefined;
@@ -371693,11 +372048,14 @@ function projectRunNode2(pmNode) {
371693
372048
  run2.run.props = props;
371694
372049
  return run2;
371695
372050
  }
371696
- function buildHyperlinkFromRunNode2(pmNode, linkMark) {
372051
+ function buildHyperlinkFromRunNode2(pmNode, linkMark, options) {
371697
372052
  const attrs = linkMark.attrs;
372053
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent;
372054
+ if (isVisibleProjection2(options) && text5.length === 0)
372055
+ return null;
371698
372056
  const childRun = {
371699
372057
  kind: "run",
371700
- run: { text: pmNode.textContent }
372058
+ run: { text: text5 }
371701
372059
  };
371702
372060
  const runProperties = pmNode.attrs?.runProperties;
371703
372061
  const props = extractRunPropsFromRunProperties2(runProperties);
@@ -371812,7 +372170,9 @@ function extractRunPropsFromRunProperties2(runProperties) {
371812
372170
  }
371813
372171
  return hasProps ? props : undefined;
371814
372172
  }
371815
- function projectTextRun2(pmNode) {
372173
+ function projectTextRun2(pmNode, options) {
372174
+ if (isVisibleProjection2(options) && hasTrackDeleteMark4(pmNode))
372175
+ return null;
371816
372176
  const marks = pmNode.marks;
371817
372177
  const linkMark = marks.find((m2) => m2.type.name === "link");
371818
372178
  if (linkMark) {
@@ -371899,10 +372259,13 @@ function projectInlineField2(pmNode) {
371899
372259
  }
371900
372260
  };
371901
372261
  }
371902
- function projectInlineFallback2(pmNode) {
372262
+ function projectInlineFallback2(pmNode, options) {
372263
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent ?? "";
372264
+ if (isVisibleProjection2(options) && text5.length === 0)
372265
+ return null;
371903
372266
  return {
371904
372267
  kind: "run",
371905
- run: { text: pmNode.textContent ?? "" }
372268
+ run: { text: text5 }
371906
372269
  };
371907
372270
  }
371908
372271
  function resolveNodeId2(pmNode) {
@@ -372140,6 +372503,8 @@ var init_sd_projection = __esm(() => {
372140
372503
  init_node_address_resolver();
372141
372504
  init_toc_switches();
372142
372505
  init_sections_resolver();
372506
+ init_text_offset_resolver();
372507
+ init_constants();
372143
372508
  BULLET_FORMATS2 = new Set(["bullet"]);
372144
372509
  LOCK_MODE_TO_SDT_LOCK2 = {
372145
372510
  unlocked: "none",
@@ -383771,6 +384136,13 @@ var init_node_info_resolver = __esm(() => {
383771
384136
  });
383772
384137
 
383773
384138
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/find/common.ts
384139
+ function getCandidateText2(editor, candidate, options) {
384140
+ if (candidate.node.childCount > 0) {
384141
+ return textContentInBlock2(candidate.node, options);
384142
+ }
384143
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
384144
+ `, "");
384145
+ }
383774
384146
  function resolveUnknownBlockId2(attrs) {
383775
384147
  if (!attrs)
383776
384148
  return;
@@ -383788,7 +384160,39 @@ function getAddressStartPos2(editor, index2, address2) {
383788
384160
  const inline = findInlineByAnchor2(inlineIndex, address2);
383789
384161
  return inline?.pos ?? Number.MAX_SAFE_INTEGER;
383790
384162
  }
383791
- function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges) {
384163
+ function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges, options) {
384164
+ if (textRanges?.length) {
384165
+ const index2 = getBlockIndex2(editor);
384166
+ const firstRange = textRanges[0];
384167
+ const lastRange = textRanges[textRanges.length - 1];
384168
+ const firstBlock = index2.candidates.find((candidate) => candidate.nodeId === firstRange.blockId);
384169
+ const lastBlock = index2.candidates.find((candidate) => candidate.nodeId === lastRange.blockId);
384170
+ if (firstBlock && lastBlock) {
384171
+ const matchText = textRanges.map((range) => {
384172
+ const block = index2.candidates.find((candidate) => candidate.nodeId === range.blockId);
384173
+ if (!block)
384174
+ return "";
384175
+ return getCandidateText2(editor, block, options).slice(range.range.start, range.range.end);
384176
+ }).join(`
384177
+ `);
384178
+ const firstText = getCandidateText2(editor, firstBlock, options);
384179
+ const lastText = getCandidateText2(editor, lastBlock, options);
384180
+ const leftContext = firstText.slice(Math.max(0, firstRange.range.start - SNIPPET_PADDING2), firstRange.range.start);
384181
+ const rightContext = lastText.slice(lastRange.range.end, lastRange.range.end + SNIPPET_PADDING2);
384182
+ const snippet2 = `${leftContext}${matchText}${rightContext}`.replace(/ {2,}/g, " ");
384183
+ const prefix3 = leftContext.replace(/ {2,}/g, " ");
384184
+ const normalizedMatch = matchText.replace(/ {2,}/g, " ");
384185
+ return {
384186
+ address: address2,
384187
+ snippet: snippet2,
384188
+ highlightRange: {
384189
+ start: prefix3.length,
384190
+ end: prefix3.length + normalizedMatch.length
384191
+ },
384192
+ textRanges
384193
+ };
384194
+ }
384195
+ }
383792
384196
  const docSize = editor.state.doc.content.size;
383793
384197
  const snippetFrom = Math.max(0, matchFrom - SNIPPET_PADDING2);
383794
384198
  const snippetTo = Math.min(docSize, matchTo + SNIPPET_PADDING2);
@@ -383808,14 +384212,14 @@ function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges) {
383808
384212
  textRanges: textRanges?.length ? textRanges : undefined
383809
384213
  };
383810
384214
  }
383811
- function toTextAddress3(editor, block, range) {
384215
+ function toTextAddress3(editor, block, range, options) {
383812
384216
  const blockStart = block.pos + 1;
383813
384217
  const blockEnd = block.end - 1;
383814
384218
  if (range.from < blockStart || range.to > blockEnd)
383815
384219
  return;
383816
- const start2 = editor.state.doc.textBetween(blockStart, range.from, `
384220
+ const start2 = block.node.childCount > 0 ? pmPositionToTextOffset2(block.node, block.pos, range.from, options) : editor.state.doc.textBetween(blockStart, range.from, `
383817
384221
  `, "").length;
383818
- const end = editor.state.doc.textBetween(blockStart, range.to, `
384222
+ const end = block.node.childCount > 0 ? pmPositionToTextOffset2(block.node, block.pos, range.to, options) : editor.state.doc.textBetween(blockStart, range.to, `
383819
384223
  `, "").length;
383820
384224
  return {
383821
384225
  kind: "text",
@@ -383874,6 +384278,7 @@ var init_common = __esm(() => {
383874
384278
  init_node_address_resolver();
383875
384279
  init_inline_address_resolver();
383876
384280
  init_adapter_utils();
384281
+ init_text_offset_resolver();
383877
384282
  DUAL_KIND_TYPES2 = new Set(["sdt", "image"]);
383878
384283
  KNOWN_BLOCK_PM_NODE_TYPES2 = new Set([
383879
384284
  "paragraph",
@@ -384038,7 +384443,7 @@ function buildSearchPattern2(selector, diagnostics) {
384038
384443
  const flags = selector.caseSensitive ? "g" : "gi";
384039
384444
  return new RegExp(flexible, flags);
384040
384445
  }
384041
- function executeTextSelector2(editor, index2, query2, diagnostics) {
384446
+ function executeTextSelector2(editor, index2, query2, diagnostics, options = {}) {
384042
384447
  if (query2.select.type !== "text") {
384043
384448
  addDiagnostic2(diagnostics, `Text strategy received a non-text selector (type="${query2.select.type}").`);
384044
384449
  return { matches: [], total: 0 };
@@ -384055,17 +384460,20 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384055
384460
  if (!pattern)
384056
384461
  return { matches: [], total: 0 };
384057
384462
  const search4 = requireEditorCommand2(editor.commands?.search, "find (search)");
384463
+ const searchModel = options.searchModel ?? "visible";
384464
+ const textOffsetOptions = { textModel: searchModel };
384465
+ pattern.lastIndex = 0;
384058
384466
  const rawResult = search4(pattern, {
384059
384467
  highlight: false,
384060
384468
  caseSensitive: selector.caseSensitive ?? false,
384061
384469
  maxMatches: Infinity,
384062
- searchModel: "visible"
384470
+ searchModel
384063
384471
  });
384064
384472
  if (!Array.isArray(rawResult)) {
384065
384473
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
384066
384474
  }
384067
- const allMatches = rawResult;
384068
384475
  const scopeRange = scope.range;
384476
+ const allMatches = rawResult;
384069
384477
  const matches3 = scopeRange ? allMatches.filter((m2) => m2.from >= scopeRange.start && m2.to <= scopeRange.end) : allMatches;
384070
384478
  const textBlocks = index2.candidates.filter(isTextBlockCandidate2);
384071
384479
  const contexts = [];
@@ -384079,7 +384487,7 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384079
384487
  return;
384080
384488
  if (!source)
384081
384489
  source = block;
384082
- return toTextAddress3(editor, block, range);
384490
+ return toTextAddress3(editor, block, range, textOffsetOptions);
384083
384491
  }).filter((range) => Boolean(range));
384084
384492
  if (!source) {
384085
384493
  source = findCandidateByPos2(textBlocks, match2.from) ?? findBlockByPos2(index2, match2.from);
@@ -384088,7 +384496,7 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384088
384496
  continue;
384089
384497
  const address2 = toBlockAddress2(source);
384090
384498
  addresses.push(address2);
384091
- contexts.push(buildTextContext2(editor, address2, match2.from, match2.to, textRanges));
384499
+ contexts.push(buildTextContext2(editor, address2, match2.from, match2.to, textRanges, textOffsetOptions));
384092
384500
  }
384093
384501
  const paged = paginate2(addresses, query2.offset, query2.limit);
384094
384502
  const pagedContexts = paginate2(contexts, query2.offset, query2.limit).items;
@@ -384194,7 +384602,7 @@ var init_mark_directives = __esm(() => {
384194
384602
  });
384195
384603
 
384196
384604
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/style-resolver.ts
384197
- function captureRunsInRange2(editor, blockPos, from4, to) {
384605
+ function captureRunsInRange2(editor, blockPos, from4, to, options) {
384198
384606
  const doc6 = editor.state.doc;
384199
384607
  const blockNode = doc6.nodeAt(blockPos);
384200
384608
  if (!blockNode || from4 < 0 || to < from4 || from4 === to) {
@@ -384218,9 +384626,12 @@ function captureRunsInRange2(editor, blockPos, from4, to) {
384218
384626
  if (node3.isText) {
384219
384627
  const text5 = node3.text ?? "";
384220
384628
  if (text5.length > 0) {
384629
+ const marks = Array.isArray(node3.marks) ? node3.marks : [];
384630
+ if (options?.textModel === "visible" && marks.some((mark2) => mark2.type.name === TrackDeleteMarkName2)) {
384631
+ return;
384632
+ }
384221
384633
  const start2 = offset2;
384222
384634
  const end = offset2 + text5.length;
384223
- const marks = Array.isArray(node3.marks) ? node3.marks : [];
384224
384635
  maybePushRun(start2, end, marks);
384225
384636
  offset2 = end;
384226
384637
  }
@@ -384515,6 +384926,7 @@ var init_style_resolver = __esm(() => {
384515
384926
  init_src();
384516
384927
  init_errors6();
384517
384928
  init_mark_directives();
384929
+ init_constants();
384518
384930
  CORE_MARK_KEYS = ["bold", "italic", "underline", "strike"];
384519
384931
  CORE_MARK_NAMES2 = new Set(CORE_MARK_KEYS);
384520
384932
  METADATA_MARK_NAMES2 = new Set([
@@ -385496,6 +385908,14 @@ function buildSelectionTargetFromTextRanges2(textRanges, story) {
385496
385908
  target.story = story;
385497
385909
  return target;
385498
385910
  }
385911
+ function readCandidateVisibleText2(editor, candidate) {
385912
+ const maybeNode = candidate.node;
385913
+ if (maybeNode && typeof maybeNode.childCount === "number" && maybeNode.childCount > 0) {
385914
+ return textContentInBlock2(maybeNode, { textModel: "visible" });
385915
+ }
385916
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
385917
+ `, "");
385918
+ }
385499
385919
  function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, storyKey, resolverParams) {
385500
385920
  const index2 = getBlockIndex2(editor);
385501
385921
  const doc6 = editor.state.doc;
@@ -385540,10 +385960,7 @@ function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, story
385540
385960
  });
385541
385961
  }
385542
385962
  }
385543
- const blockStart = candidate.pos + 1;
385544
- const blockEnd = candidate.end - 1;
385545
- const blockText = doc6.textBetween(blockStart, blockEnd, `
385546
- `, "");
385963
+ const blockText = readCandidateVisibleText2(editor, candidate);
385547
385964
  const matchedText = blockText.slice(from4, to);
385548
385965
  const node3 = doc6.nodeAt(candidate.pos);
385549
385966
  const nodeType = node3?.type.name ?? "paragraph";
@@ -385552,7 +385969,7 @@ function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, story
385552
385969
  resolverParams,
385553
385970
  paragraphProperties: node3?.attrs?.paragraphProperties ?? null
385554
385971
  } : undefined;
385555
- const captured = captureRunsInRange2(editor, candidate.pos, from4, to);
385972
+ const captured = captureRunsInRange2(editor, candidate.pos, from4, to, { textModel: "visible" });
385556
385973
  const coalesced = coalesceRuns2(captured.runs);
385557
385974
  const blockRange = { start: from4, end: to };
385558
385975
  const runs2 = coalesced.map((run2, runIdx) => ({
@@ -385605,7 +386022,6 @@ function buildBlocksSnippet2(editor, blocks2) {
385605
386022
  if (!editor.state?.doc || blocks2.length === 0)
385606
386023
  return;
385607
386024
  const index2 = getBlockIndex2(editor);
385608
- const doc6 = editor.state.doc;
385609
386025
  const matchText = blocks2.map((b2) => b2.text).join(`
385610
386026
  `);
385611
386027
  if (matchText.length >= SNIPPET_MAX_LENGTH2) {
@@ -385620,10 +386036,7 @@ function buildBlocksSnippet2(editor, blocks2) {
385620
386036
  const firstBlock = blocks2[0];
385621
386037
  const firstCandidate = index2.candidates.find((c) => c.nodeId === firstBlock.blockId);
385622
386038
  if (firstCandidate) {
385623
- const blockStart = firstCandidate.pos + 1;
385624
- const blockEnd = firstCandidate.end - 1;
385625
- const fullBlockText = doc6.textBetween(blockStart, blockEnd, `
385626
- `, "");
386039
+ const fullBlockText = readCandidateVisibleText2(editor, firstCandidate);
385627
386040
  const contextStart = Math.max(0, firstBlock.range.start - contextEachSide);
385628
386041
  leftContext = fullBlockText.slice(contextStart, firstBlock.range.start);
385629
386042
  }
@@ -385631,10 +386044,7 @@ function buildBlocksSnippet2(editor, blocks2) {
385631
386044
  const lastBlock = blocks2[blocks2.length - 1];
385632
386045
  const lastCandidate = index2.candidates.find((c) => c.nodeId === lastBlock.blockId);
385633
386046
  if (lastCandidate) {
385634
- const blockStart = lastCandidate.pos + 1;
385635
- const blockEnd = lastCandidate.end - 1;
385636
- const fullBlockText = doc6.textBetween(blockStart, blockEnd, `
385637
- `, "");
386047
+ const fullBlockText = readCandidateVisibleText2(editor, lastCandidate);
385638
386048
  const contextEnd = Math.min(fullBlockText.length, lastBlock.range.end + contextEachSide);
385639
386049
  rightContext = fullBlockText.slice(lastBlock.range.end, contextEnd);
385640
386050
  }
@@ -385819,6 +386229,7 @@ var init_query_match_adapter = __esm(() => {
385819
386229
  init_errors6();
385820
386230
  init_match_style_helpers();
385821
386231
  init_resolve_story_runtime();
386232
+ init_text_offset_resolver();
385822
386233
  });
385823
386234
 
385824
386235
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/find-adapter.ts
@@ -385938,12 +386349,12 @@ function projectMatchToSDNodeResult2(editor, address2, blockIndex) {
385938
386349
  if (!found3)
385939
386350
  return null;
385940
386351
  return {
385941
- node: projectContentNode2(found3.node),
386352
+ node: projectContentNode2(found3.node, { textModel: "visible" }),
385942
386353
  address: address2
385943
386354
  };
385944
386355
  }
385945
386356
  return {
385946
- node: projectContentNode2(candidate.node),
386357
+ node: projectContentNode2(candidate.node, { textModel: "visible" }),
385947
386358
  address: address2
385948
386359
  };
385949
386360
  }
@@ -386118,7 +386529,7 @@ function getTextAdapter2(editor, input2) {
386118
386529
  const doc6 = runtime.editor.state.doc;
386119
386530
  return textBetweenWithTabs2(doc6, 0, doc6.content.size, `
386120
386531
  `, `
386121
- `);
386532
+ `, { textModel: "visible" });
386122
386533
  }
386123
386534
  var init_get_text_adapter = __esm(() => {
386124
386535
  init_resolve_story_runtime();
@@ -387097,7 +387508,7 @@ var init_codes = __esm(() => {
387097
387508
 
387098
387509
  // ../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/constants.js
387099
387510
  var constants;
387100
- var init_constants = __esm(() => {
387511
+ var init_constants2 = __esm(() => {
387101
387512
  constants = {
387102
387513
  attentionSideAfter: 2,
387103
387514
  attentionSideBefore: 1,
@@ -387356,7 +387767,7 @@ var init_values = __esm(() => {
387356
387767
  // ../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/default.js
387357
387768
  var init_default2 = __esm(() => {
387358
387769
  init_codes();
387359
- init_constants();
387770
+ init_constants2();
387360
387771
  init_types6();
387361
387772
  init_values();
387362
387773
  });
@@ -405853,10 +406264,6 @@ var init_mergeTextNodes = __esm(() => {
405853
406264
  init_objectIncludes();
405854
406265
  });
405855
406266
 
405856
- // ../../packages/super-editor/src/editors/v1/extensions/track-changes/constants.js
405857
- var TrackInsertMarkName2 = "trackInsert", TrackDeleteMarkName2 = "trackDelete", TrackFormatMarkName2 = "trackFormat";
405858
- var init_constants2 = () => {};
405859
-
405860
406267
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v2/importer/markImporter.js
405861
406268
  function parseMarks2(property, unknownMarks = [], docx = null) {
405862
406269
  const marks = [];
@@ -406069,7 +406476,7 @@ function getStrikeValue2(attributes) {
406069
406476
  }
406070
406477
  var init_markImporter = __esm(() => {
406071
406478
  init_SuperConverter();
406072
- init_constants2();
406479
+ init_constants();
406073
406480
  init_helpers();
406074
406481
  init_rpr();
406075
406482
  init_styles3();
@@ -406877,7 +407284,7 @@ var cloneMark3 = (mark2) => {
406877
407284
  return runs2;
406878
407285
  };
406879
407286
  var init_track_change_helpers = __esm(() => {
406880
- init_constants2();
407287
+ init_constants();
406881
407288
  });
406882
407289
 
406883
407290
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/helpers.js
@@ -406926,7 +407333,7 @@ var getMarkType3 = (mark2) => mark2?.type?.name ?? mark2?.type ?? null, toRunPro
406926
407333
  };
406927
407334
  var init_helpers4 = __esm(() => {
406928
407335
  init_exporter();
406929
- init_constants2();
407336
+ init_constants();
406930
407337
  });
406931
407338
 
406932
407339
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.js
@@ -433868,7 +434275,35 @@ var init_documentCommentsImporter = __esm(() => {
433868
434275
  function isReplacementPair2(previous5, current) {
433869
434276
  return previous5.type !== current.type && previous5.author === current.author && previous5.date === current.date;
433870
434277
  }
433871
- function assignInternalId2(element3, idMap, context, insideTrackedChange) {
434278
+ function trackedChangeEntryFromElement2(element3) {
434279
+ return {
434280
+ type: element3.name,
434281
+ author: element3.attributes?.["w:author"] ?? "",
434282
+ date: element3.attributes?.["w:date"] ?? ""
434283
+ };
434284
+ }
434285
+ function findNextSiblingTrackedChange2(elements, startIndex) {
434286
+ if (!Array.isArray(elements))
434287
+ return null;
434288
+ for (let i5 = startIndex;i5 < elements.length; i5 += 1) {
434289
+ const element3 = elements[i5];
434290
+ if (TRACKED_CHANGE_NAMES2.has(element3?.name)) {
434291
+ return trackedChangeEntryFromElement2(element3);
434292
+ }
434293
+ if (!PAIRING_TRANSPARENT_NAMES2.has(element3?.name)) {
434294
+ return null;
434295
+ }
434296
+ }
434297
+ return null;
434298
+ }
434299
+ function isChildReplacementInsideDeletion2(beforePrevious, previous5, current, next2) {
434300
+ if (!isReplacementPair2(previous5, current))
434301
+ return false;
434302
+ const touchesDifferentAuthorDeletionBefore = beforePrevious?.type === "w:del" && beforePrevious.author !== previous5.author;
434303
+ const touchesDifferentAuthorDeletionAfter = next2?.type === "w:del" && next2.author !== previous5.author;
434304
+ return touchesDifferentAuthorDeletionBefore || touchesDifferentAuthorDeletionAfter;
434305
+ }
434306
+ function assignInternalId2(element3, idMap, context, insideTrackedChange, nextTrackedChange = null) {
433872
434307
  const wordId = String(element3.attributes?.["w:id"] ?? "");
433873
434308
  if (!wordId)
433874
434309
  return;
@@ -433878,35 +434313,37 @@ function assignInternalId2(element3, idMap, context, insideTrackedChange) {
433878
434313
  }
433879
434314
  return;
433880
434315
  }
433881
- const current = {
433882
- type: element3.name,
433883
- author: element3.attributes?.["w:author"] ?? "",
433884
- date: element3.attributes?.["w:date"] ?? ""
433885
- };
434316
+ const current = trackedChangeEntryFromElement2(element3);
433886
434317
  const shouldPair = context.replacements === "paired";
433887
- if (shouldPair && context.lastTrackedChange && isReplacementPair2(context.lastTrackedChange, current)) {
434318
+ const shouldKeepChildSides = context.lastTrackedChange && isChildReplacementInsideDeletion2(context.beforeLastTrackedChange, context.lastTrackedChange, current, nextTrackedChange);
434319
+ if (shouldPair && context.lastTrackedChange && !shouldKeepChildSides && isReplacementPair2(context.lastTrackedChange, current)) {
433888
434320
  if (!idMap.has(wordId)) {
433889
434321
  idMap.set(wordId, context.lastTrackedChange.internalId);
433890
434322
  }
433891
434323
  context.lastTrackedChange = null;
434324
+ context.beforeLastTrackedChange = null;
433892
434325
  } else {
433893
434326
  const internalId = idMap.get(wordId) ?? v42();
433894
434327
  idMap.set(wordId, internalId);
434328
+ context.beforeLastTrackedChange = context.lastTrackedChange;
433895
434329
  context.lastTrackedChange = { ...current, internalId };
433896
434330
  }
433897
434331
  }
433898
434332
  function walkElements2(elements, idMap, context, insideTrackedChange = false) {
433899
434333
  if (!Array.isArray(elements))
433900
434334
  return;
433901
- for (const element3 of elements) {
434335
+ for (let index3 = 0;index3 < elements.length; index3 += 1) {
434336
+ const element3 = elements[index3];
433902
434337
  if (TRACKED_CHANGE_NAMES2.has(element3.name)) {
433903
- assignInternalId2(element3, idMap, context, insideTrackedChange);
434338
+ const nextTrackedChange = findNextSiblingTrackedChange2(elements, index3 + 1);
434339
+ assignInternalId2(element3, idMap, context, insideTrackedChange, nextTrackedChange);
433904
434340
  if (element3.elements) {
433905
- walkElements2(element3.elements, idMap, { lastTrackedChange: null, replacements: context.replacements }, true);
434341
+ walkElements2(element3.elements, idMap, { beforeLastTrackedChange: null, lastTrackedChange: null, replacements: context.replacements }, true);
433906
434342
  }
433907
434343
  } else {
433908
434344
  if (!PAIRING_TRANSPARENT_NAMES2.has(element3.name)) {
433909
434345
  context.lastTrackedChange = null;
434346
+ context.beforeLastTrackedChange = null;
433910
434347
  }
433911
434348
  if (element3.elements) {
433912
434349
  walkElements2(element3.elements, idMap, context, insideTrackedChange);
@@ -433920,7 +434357,7 @@ function buildTrackedChangeIdMapForPart2(part, options = {}) {
433920
434357
  return new Map;
433921
434358
  const replacements = options.replacements === "independent" ? "independent" : "paired";
433922
434359
  const idMap = new Map;
433923
- walkElements2(root4.elements, idMap, { lastTrackedChange: null, replacements });
434360
+ walkElements2(root4.elements, idMap, { beforeLastTrackedChange: null, lastTrackedChange: null, replacements });
433924
434361
  return idMap;
433925
434362
  }
433926
434363
  function buildTrackedChangeIdMap2(docx, options = {}) {
@@ -438327,7 +438764,7 @@ var getTrackChanges2 = (state, id2 = null) => {
438327
438764
  return trackedChanges;
438328
438765
  };
438329
438766
  var init_getTrackChanges = __esm(() => {
438330
- init_constants2();
438767
+ init_constants();
438331
438768
  });
438332
438769
 
438333
438770
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-resolver.ts
@@ -438665,7 +439102,7 @@ function findMatchingChange2(editor, id2) {
438665
439102
  }
438666
439103
  var groupedCache2;
438667
439104
  var init_tracked_change_resolver = __esm(() => {
438668
- init_constants2();
439105
+ init_constants();
438669
439106
  init_getTrackChanges();
438670
439107
  init_resolve_story_runtime();
438671
439108
  init_story_key();
@@ -446383,7 +446820,7 @@ function resolveTextPoint3(editor, index3, point7) {
446383
446820
  const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, {
446384
446821
  start: point7.offset,
446385
446822
  end: point7.offset
446386
- });
446823
+ }, { textModel: "visible" });
446387
446824
  if (!resolved) {
446388
446825
  throw new DocumentApiAdapterError3("INVALID_TARGET", `Offset ${point7.offset} is out of range in block "${point7.blockId}".`, { field: "offset", value: point7.offset, blockId: point7.blockId });
446389
446826
  }
@@ -446456,6 +446893,7 @@ function findBlockByTypeAndId2(index3, nodeType, nodeId) {
446456
446893
  var init_selection_target_resolver = __esm(() => {
446457
446894
  init_index_cache();
446458
446895
  init_node_address_resolver();
446896
+ init_text_offset_resolver();
446459
446897
  init_errors4();
446460
446898
  });
446461
446899
 
@@ -446598,8 +447036,8 @@ function validateInsertionContext2(editor, index3, step3, stepIndex, anchorBlock
446598
447036
  });
446599
447037
  }
446600
447038
  }
446601
- function resolveAbsoluteRange3(editor, candidate, from4, to, stepId) {
446602
- const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: from4, end: to });
447039
+ function resolveAbsoluteRange3(editor, candidate, from4, to, stepId, options) {
447040
+ const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: from4, end: to }, options);
446603
447041
  if (!resolved) {
446604
447042
  throw planError2("INVALID_INPUT", `text offset [${from4}, ${to}) out of range in block`, stepId);
446605
447043
  }
@@ -446667,8 +447105,9 @@ function coalesceBlockRanges2(stepId, blockId, ranges) {
446667
447105
  return { from: from4, to };
446668
447106
  }
446669
447107
  function buildRangeTarget2(editor, step3, addr, candidate) {
446670
- const abs3 = resolveAbsoluteRange3(editor, candidate, addr.from, addr.to, step3.id);
446671
- const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange2(editor, candidate.pos, addr.from, addr.to) : undefined;
447108
+ const textOffsetOptions = { textModel: addr.textModel };
447109
+ const abs3 = resolveAbsoluteRange3(editor, candidate, addr.from, addr.to, step3.id, textOffsetOptions);
447110
+ const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange2(editor, candidate.pos, addr.from, addr.to, textOffsetOptions) : undefined;
446672
447111
  return {
446673
447112
  kind: "range",
446674
447113
  stepId: step3.id,
@@ -446683,7 +447122,7 @@ function buildRangeTarget2(editor, step3, addr, candidate) {
446683
447122
  capturedStyle
446684
447123
  };
446685
447124
  }
446686
- function buildSpanTarget2(editor, index3, step3, segments, matchId) {
447125
+ function buildSpanTarget2(editor, index3, step3, segments, matchId, textModel = "visible") {
446687
447126
  validateSegmentOrder2(editor, index3, segments, step3.id);
446688
447127
  const compiledSegments = [];
446689
447128
  const capturedStyles = [];
@@ -446693,7 +447132,8 @@ function buildSpanTarget2(editor, index3, step3, segments, matchId) {
446693
447132
  if (!candidate) {
446694
447133
  throw planError2("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step3.id);
446695
447134
  }
446696
- const abs3 = resolveAbsoluteRange3(editor, candidate, seg.from, seg.to, step3.id);
447135
+ const textOffsetOptions = { textModel };
447136
+ const abs3 = resolveAbsoluteRange3(editor, candidate, seg.from, seg.to, step3.id, textOffsetOptions);
446697
447137
  compiledSegments.push({
446698
447138
  blockId: seg.blockId,
446699
447139
  from: seg.from,
@@ -446701,10 +447141,10 @@ function buildSpanTarget2(editor, index3, step3, segments, matchId) {
446701
447141
  absFrom: abs3.absFrom,
446702
447142
  absTo: abs3.absTo
446703
447143
  });
446704
- const blockText = getBlockText2(editor, candidate);
447144
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446705
447145
  textParts.push(blockText.slice(seg.from, seg.to));
446706
447146
  if (step3.op === "text.rewrite" || step3.op === "format.apply") {
446707
- capturedStyles.push(captureRunsInRange2(editor, candidate.pos, seg.from, seg.to));
447147
+ capturedStyles.push(captureRunsInRange2(editor, candidate.pos, seg.from, seg.to, textOffsetOptions));
446708
447148
  }
446709
447149
  }
446710
447150
  return {
@@ -446749,13 +447189,15 @@ function validateSegmentOrder2(_editor, index3, segments, stepId) {
446749
447189
  }
446750
447190
  }
446751
447191
  function resolveTextSelector2(editor, index3, selector, within2, stepId, options) {
447192
+ const textModel = options?.textModel ?? "visible";
447193
+ const textOffsetOptions = { textModel };
446752
447194
  if (selector.type === "text") {
446753
447195
  const query3 = {
446754
447196
  select: selector,
446755
447197
  within: within2,
446756
447198
  includeNodes: false
446757
447199
  };
446758
- const result2 = executeTextSelector2(editor, index3, query3, []);
447200
+ const result2 = executeTextSelector2(editor, index3, query3, [], { searchModel: textModel });
446759
447201
  const addresses2 = [];
446760
447202
  if (result2.context) {
446761
447203
  for (const ctx2 of result2.context) {
@@ -446765,16 +447207,17 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446765
447207
  const candidate = index3.candidates.find((c) => c.nodeId === coalesced.blockId);
446766
447208
  if (!candidate)
446767
447209
  continue;
446768
- const blockText = getBlockText2(editor, candidate);
447210
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446769
447211
  const matchText = blockText.slice(coalesced.from, coalesced.to);
446770
- const captured = captureRunsInRange2(editor, candidate.pos, coalesced.from, coalesced.to);
447212
+ const captured = captureRunsInRange2(editor, candidate.pos, coalesced.from, coalesced.to, textOffsetOptions);
446771
447213
  addresses2.push({
446772
447214
  blockId: coalesced.blockId,
446773
447215
  from: coalesced.from,
446774
447216
  to: coalesced.to,
446775
447217
  text: matchText,
446776
447218
  marks: captured.runs.length > 0 ? captured.runs[0].marks : [],
446777
- blockPos: candidate.pos
447219
+ blockPos: candidate.pos,
447220
+ textModel
446778
447221
  });
446779
447222
  }
446780
447223
  }
@@ -446795,14 +447238,15 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446795
447238
  if (!candidate)
446796
447239
  continue;
446797
447240
  if (isTextBlockCandidate2(candidate)) {
446798
- const blockText = getBlockText2(editor, candidate);
447241
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446799
447242
  addresses.push({
446800
447243
  blockId: match2.nodeId,
446801
447244
  from: 0,
446802
447245
  to: blockText.length,
446803
447246
  text: blockText,
446804
447247
  marks: [],
446805
- blockPos: candidate.pos
447248
+ blockPos: candidate.pos,
447249
+ textModel
446806
447250
  });
446807
447251
  } else {
446808
447252
  addresses.push({
@@ -446811,13 +447255,17 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446811
447255
  to: 0,
446812
447256
  text: "",
446813
447257
  marks: [],
446814
- blockPos: candidate.pos
447258
+ blockPos: candidate.pos,
447259
+ textModel
446815
447260
  });
446816
447261
  }
446817
447262
  }
446818
447263
  return { addresses };
446819
447264
  }
446820
- function getBlockText2(editor, candidate) {
447265
+ function getBlockText2(editor, candidate, options = { textModel: "visible" }) {
447266
+ if (candidate.node && candidate.node.childCount > 0) {
447267
+ return textContentInBlock2(candidate.node, options);
447268
+ }
446821
447269
  const blockStart = candidate.pos + 1;
446822
447270
  const blockEnd = candidate.end - 1;
446823
447271
  return editor.state.doc.textBetween(blockStart, blockEnd, `
@@ -446851,13 +447299,14 @@ function resolveV3TextRef2(editor, index3, step3, refData) {
446851
447299
  to: seg.to,
446852
447300
  text: matchText,
446853
447301
  marks: [],
446854
- blockPos: candidate.pos
447302
+ blockPos: candidate.pos,
447303
+ textModel: "visible"
446855
447304
  };
446856
447305
  const target = buildRangeTarget2(editor, step3, addr, candidate);
446857
447306
  target.matchId = refData.matchId;
446858
447307
  return [target];
446859
447308
  }
446860
- return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId)];
447309
+ return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId, "visible")];
446861
447310
  }
446862
447311
  function resolveV4TextRef2(editor, index3, step3, refData) {
446863
447312
  if (refData.scope === "node" && refData.node?.nodeId) {
@@ -446889,14 +447338,15 @@ function resolveV4TextRef2(editor, index3, step3, refData) {
446889
447338
  to: seg.to,
446890
447339
  text: matchText,
446891
447340
  marks: [],
446892
- blockPos: candidate.pos
447341
+ blockPos: candidate.pos,
447342
+ textModel: "visible"
446893
447343
  };
446894
447344
  const target = buildRangeTarget2(editor, step3, addr, candidate);
446895
447345
  if (refData.matchId)
446896
447346
  target.matchId = refData.matchId;
446897
447347
  return [target];
446898
447348
  }
446899
- return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId ?? `v4:${step3.id}`)];
447349
+ return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId ?? `v4:${step3.id}`, "visible")];
446900
447350
  }
446901
447351
  function resolveTextRef2(editor, index3, step3, ref4) {
446902
447352
  const decoded = decodeRef2(ref4);
@@ -446926,7 +447376,8 @@ function resolveBlockRef2(editor, index3, step3, ref4) {
446926
447376
  to: blockText.length,
446927
447377
  text: blockText,
446928
447378
  marks: [],
446929
- blockPos: candidate.pos
447379
+ blockPos: candidate.pos,
447380
+ textModel: "visible"
446930
447381
  };
446931
447382
  return [buildRangeTarget2(editor, step3, addr, candidate)];
446932
447383
  }
@@ -446976,7 +447427,8 @@ function buildWholeBlockRangeTarget2(editor, step3, candidate) {
446976
447427
  to: blockText.length,
446977
447428
  text: blockText,
446978
447429
  marks: [],
446979
- blockPos: candidate.pos
447430
+ blockPos: candidate.pos,
447431
+ textModel: "visible"
446980
447432
  };
446981
447433
  return buildRangeTarget2(editor, step3, addr, candidate);
446982
447434
  }
@@ -447052,7 +447504,7 @@ function captureStyleAtAbsoluteRange2(editor, absFrom, absTo) {
447052
447504
  return;
447053
447505
  return { runs: allRuns, isUniform: checkUniformity2(allRuns) };
447054
447506
  }
447055
- function resolveStepTargets2(editor, index3, step3) {
447507
+ function resolveStepTargets2(editor, index3, step3, options = {}) {
447056
447508
  const where = step3.where;
447057
447509
  const refWhere = isRefWhere2(where) ? where : undefined;
447058
447510
  const selectWhere = isSelectWhere2(where) ? where : undefined;
@@ -447069,7 +447521,8 @@ function resolveStepTargets2(editor, index3, step3) {
447069
447521
  } else if (selectWhere) {
447070
447522
  const isStructuralOp = step3.op === "structural.insert" || step3.op === "structural.replace";
447071
447523
  const resolved = resolveTextSelector2(editor, index3, selectWhere.select, selectWhere.within, step3.id, {
447072
- allBlockTypes: isStructuralOp
447524
+ allBlockTypes: isStructuralOp,
447525
+ textModel: options.selectTextModel ?? "visible"
447073
447526
  });
447074
447527
  targets = resolved.addresses.map((addr) => {
447075
447528
  const candidate = index3.candidates.find((c) => c.nodeId === addr.blockId);
@@ -447352,7 +447805,7 @@ function assertSingleStoryKey2(steps) {
447352
447805
  }
447353
447806
  }
447354
447807
  }
447355
- function compilePlan2(editor, steps) {
447808
+ function compilePlan2(editor, steps, options = {}) {
447356
447809
  if (steps.length > MAX_PLAN_STEPS2) {
447357
447810
  throw planError2("INVALID_INPUT", `plan contains ${steps.length} steps, maximum is ${MAX_PLAN_STEPS2}`);
447358
447811
  }
@@ -447389,7 +447842,7 @@ function compilePlan2(editor, steps) {
447389
447842
  if (isCreateOp2(step3.op)) {
447390
447843
  validateCreateStepPosition2(step3);
447391
447844
  }
447392
- const targets = resolveStepTargets2(editor, index3, step3);
447845
+ const targets = resolveStepTargets2(editor, index3, step3, options);
447393
447846
  if (isCreateOp2(step3.op) && targets.length > 0) {
447394
447847
  const position5 = step3.args.position ?? "after";
447395
447848
  const anchorBlockId = resolveCreateAnchorFromTargets2(targets, position5, step3.id);
@@ -447416,6 +447869,7 @@ var init_compiler = __esm(() => {
447416
447869
  init_text_strategy();
447417
447870
  init_block_strategy();
447418
447871
  init_node_address_resolver();
447872
+ init_text_offset_resolver();
447419
447873
  init_selection_target_resolver();
447420
447874
  init_expand_delete_selection();
447421
447875
  VALID_CREATE_POSITIONS2 = ["before", "after"];
@@ -449601,7 +450055,9 @@ function executePlan2(editor, input2) {
449601
450055
  if (!input2.steps?.length) {
449602
450056
  throw planError2("INVALID_INPUT", "plan must contain at least one step");
449603
450057
  }
449604
- const compiled = compilePlan2(editor, input2.steps);
450058
+ const compiled = compilePlan2(editor, input2.steps, {
450059
+ selectTextModel: input2.changeMode === "tracked" ? "raw" : "visible"
450060
+ });
449605
450061
  return executeCompiledPlan2(editor, compiled, {
449606
450062
  changeMode: input2.changeMode ?? "direct",
449607
450063
  expectedRevision: input2.expectedRevision
@@ -449629,7 +450085,7 @@ var init_executor = __esm(() => {
449629
450085
  init_dist2();
449630
450086
  init_text_with_tabs();
449631
450087
  init_getMarksFromSelection();
449632
- init_constants2();
450088
+ init_constants();
449633
450089
  DEFAULT_INLINE_POLICY2 = {
449634
450090
  mode: "preserve",
449635
450091
  onNonUniform: "majority"
@@ -451874,7 +452330,7 @@ var init_plan_wrappers = __esm(() => {
451874
452330
  init_adapter_utils();
451875
452331
  init_text_mutation_resolution();
451876
452332
  init_mutation_helpers();
451877
- init_constants2();
452333
+ init_constants();
451878
452334
  init_markdownToPmContent();
451879
452335
  init_structural_write_engine();
451880
452336
  init_selection_target_resolver();
@@ -453265,6 +453721,7 @@ var init_track_changes_wrappers = __esm(() => {
453265
453721
  init_comment_target_resolver();
453266
453722
  init_plan_wrappers();
453267
453723
  init_adapter_utils();
453724
+ init_text_offset_resolver();
453268
453725
  init_revision_tracker();
453269
453726
  init_tracked_change_resolver();
453270
453727
  init_tracked_change_index();
@@ -454801,7 +455258,7 @@ var init_extract_adapter = __esm(() => {
454801
455258
  init_comments_wrappers();
454802
455259
  init_track_changes_wrappers();
454803
455260
  init_tracked_change_resolver();
454804
- init_constants2();
455261
+ init_constants();
454805
455262
  TRACK_MARK_TYPE_BY_NAME2 = {
454806
455263
  [TrackInsertMarkName2]: "insert",
454807
455264
  [TrackDeleteMarkName2]: "delete",
@@ -455056,7 +455513,7 @@ function getDocumentApiCapabilities2(editor) {
455056
455513
  var REQUIRED_COMMANDS2, VALID_CAPABILITY_REASON_CODES2, REQUIRED_HELPERS2, SCHEMA_NODE_GATES2, schemaGatedIds2, SUPPORTED_NON_UNIFORM_STRATEGIES2, SUPPORTED_SET_MARKS2, REGEX_MAX_PATTERN_LENGTH2 = 1024;
455057
455514
  var init_capabilities_adapter = __esm(() => {
455058
455515
  init_src();
455059
- init_constants2();
455516
+ init_constants();
455060
455517
  REQUIRED_COMMANDS2 = {
455061
455518
  "create.paragraph": ["insertParagraphAt"],
455062
455519
  "create.heading": ["insertHeadingAt"],
@@ -455600,7 +456057,7 @@ function collectTrackInsertRefsInRange2(editor, from4, to) {
455600
456057
  return Array.from(ids).map((id2) => ({ kind: "entity", entityType: "trackedChange", entityId: id2 }));
455601
456058
  }
455602
456059
  var init_tracked_change_refs = __esm(() => {
455603
- init_constants2();
456060
+ init_constants();
455604
456061
  init_tracked_change_resolver();
455605
456062
  });
455606
456063
 
@@ -456181,6 +456638,7 @@ var init_blocks_wrappers = __esm(() => {
456181
456638
  init_src();
456182
456639
  init_index_cache();
456183
456640
  init_node_address_resolver();
456641
+ init_text_offset_resolver();
456184
456642
  init_errors4();
456185
456643
  init_mutation_helpers();
456186
456644
  init_plan_wrappers();
@@ -459190,6 +459648,7 @@ function markTypesPresentEverywhere2(doc6, from4, to) {
459190
459648
  var COMMENT_MARK_NAME4 = "commentMark", TRACK_CHANGE_MARK_NAMES2;
459191
459649
  var init_selection_info_resolver = __esm(() => {
459192
459650
  init_dist5();
459651
+ init_text_offset_resolver();
459193
459652
  init_tracked_change_resolver();
459194
459653
  TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
459195
459654
  });
@@ -474578,6 +475037,7 @@ var init_bookmark_resolver = __esm(() => {
474578
475037
  init_story_key();
474579
475038
  init_live_story_session_runtime_registry();
474580
475039
  init_note_entry_lookup();
475040
+ init_text_offset_resolver();
474581
475041
  });
474582
475042
 
474583
475043
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/bookmark-wrappers.ts
@@ -475894,6 +476354,7 @@ var init_anchored_metadata_wrappers = __esm(() => {
475894
476354
  init_index_cache();
475895
476355
  init_node_address_resolver();
475896
476356
  init_selection_target_resolver();
476357
+ init_text_offset_resolver();
475897
476358
  init_mutation_helpers();
475898
476359
  init_adapter_utils();
475899
476360
  init_content_controls2();
@@ -476588,6 +477049,7 @@ var init_permission_ranges_adapter = __esm(() => {
476588
477049
  init_revision_tracker();
476589
477050
  init_adapter_utils();
476590
477051
  init_selection_target_resolver();
477052
+ init_text_offset_resolver();
476591
477053
  init_permission_ranges2();
476592
477054
  });
476593
477055