@superdoc-dev/mcp 0.9.0-next.3 → 0.9.0-next.5

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 +357 -93
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51891
51891
  emptyOptions2 = {};
51892
51892
  });
51893
51893
 
51894
- // ../../packages/superdoc/dist/chunks/SuperConverter-BzpaXL4Z.es.js
51894
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DZZ9HhoA.es.js
51895
51895
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
51896
51896
  const fieldValue = extension$1.config[field];
51897
51897
  if (typeof fieldValue === "function")
@@ -105968,12 +105968,12 @@ var isRegExp = (value) => {
105968
105968
  return text$2;
105969
105969
  return String(text$2).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
105970
105970
  }
105971
- #generateXml(node2) {
105971
+ #generateXml(node2, insideDeletion = false) {
105972
105972
  if (!node2)
105973
105973
  return null;
105974
105974
  let { name } = node2;
105975
105975
  const { elements, attributes } = node2;
105976
- if (name === "w:delInstrText")
105976
+ if (name === "w:delInstrText" && !insideDeletion)
105977
105977
  name = "w:instrText";
105978
105978
  let tag = `<${name}`;
105979
105979
  for (let attr in attributes) {
@@ -105988,8 +105988,9 @@ var isRegExp = (value) => {
105988
105988
  let tags = [tag];
105989
105989
  if (!name && node2.type === "text")
105990
105990
  return this.#replaceSpecialCharacters(node2.text ?? "");
105991
+ const nextInsideDeletion = insideDeletion || name === "w:del";
105991
105992
  if (elements) {
105992
- if (name === "w:instrText") {
105993
+ if (name === "w:instrText" || name === "w:delInstrText") {
105993
105994
  const textContent = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
105994
105995
  tags.push(this.#replaceSpecialCharacters(textContent));
105995
105996
  } else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset")
@@ -106005,7 +106006,7 @@ var isRegExp = (value) => {
106005
106006
  }
106006
106007
  else if (elements)
106007
106008
  for (let child of elements) {
106008
- const newElements = this.#generateXml(child);
106009
+ const newElements = this.#generateXml(child, nextInsideDeletion);
106009
106010
  if (!newElements)
106010
106011
  continue;
106011
106012
  if (typeof newElements === "string") {
@@ -106756,7 +106757,7 @@ var isRegExp = (value) => {
106756
106757
  state.kern = kernNode.attributes["w:val"];
106757
106758
  }
106758
106759
  }, SuperConverter;
106759
- var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
106760
+ var init_SuperConverter_DZZ9HhoA_es = __esm(() => {
106760
106761
  init_rolldown_runtime_Bg48TavK_es();
106761
106762
  init_jszip_C49i9kUs_es();
106762
106763
  init_xml_js_CqGKpaft_es();
@@ -110037,7 +110038,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
110037
110038
  idempotency: "conditional",
110038
110039
  supportsDryRun: true,
110039
110040
  supportsTrackedMode: true,
110040
- possibleFailureCodes: ["INVALID_TARGET"],
110041
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
110041
110042
  throws: [
110042
110043
  ...T_NOT_FOUND_CAPABLE,
110043
110044
  "INVALID_TARGET",
@@ -110113,7 +110114,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
110113
110114
  idempotency: "conditional",
110114
110115
  supportsDryRun: true,
110115
110116
  supportsTrackedMode: true,
110116
- possibleFailureCodes: ["INVALID_TARGET"],
110117
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
110117
110118
  throws: [
110118
110119
  ...T_NOT_FOUND_CAPABLE,
110119
110120
  "INVALID_TARGET",
@@ -145070,7 +145071,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
145070
145071
  };
145071
145072
  });
145072
145073
 
145073
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-6lLMNI-b.es.js
145074
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DMKUCLlb.es.js
145074
145075
  function parseSizeUnit(val = "0") {
145075
145076
  const length = val.toString() || "0";
145076
145077
  const value = Number.parseFloat(length);
@@ -155302,8 +155303,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
155302
155303
  }
155303
155304
  };
155304
155305
  };
155305
- var init_create_headless_toolbar_6lLMNI_b_es = __esm(() => {
155306
- init_SuperConverter_BzpaXL4Z_es();
155306
+ var init_create_headless_toolbar_DMKUCLlb_es = __esm(() => {
155307
+ init_SuperConverter_DZZ9HhoA_es();
155307
155308
  init_uuid_qzgm05fK_es();
155308
155309
  init_constants_DrU4EASo_es();
155309
155310
  init_dist_B8HfvhaK_es();
@@ -210034,7 +210035,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
210034
210035
  init_remark_gfm_BhnWr3yf_es();
210035
210036
  });
210036
210037
 
210037
- // ../../packages/superdoc/dist/chunks/src-BVHa1VXC.es.js
210038
+ // ../../packages/superdoc/dist/chunks/src-DC1U6aZu.es.js
210038
210039
  function deleteProps(obj, propOrProps) {
210039
210040
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
210040
210041
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -219767,6 +219768,64 @@ function recordDeletedValue(value, path2, diff, ignoreKeys) {
219767
219768
  function joinPath(base4, key2) {
219768
219769
  return base4 ? `${base4}.${key2}` : key2;
219769
219770
  }
219771
+ function applyAttrsDiff(baseAttrs, attrsDiff) {
219772
+ const result = cloneAttrs(baseAttrs ?? {});
219773
+ if (!attrsDiff)
219774
+ return result;
219775
+ for (const [path2, value] of Object.entries(attrsDiff.added ?? {}))
219776
+ setAtPath(result, path2, value);
219777
+ for (const [path2, change] of Object.entries(attrsDiff.modified ?? {}))
219778
+ setAtPath(result, path2, change.to);
219779
+ for (const path2 of Object.keys(attrsDiff.deleted ?? {}))
219780
+ deleteAtPath(result, path2);
219781
+ return result;
219782
+ }
219783
+ function cloneAttrs(value) {
219784
+ if (!isPlainObject$4(value))
219785
+ return {};
219786
+ const clone2 = {};
219787
+ for (const [key2, child] of Object.entries(value))
219788
+ clone2[key2] = cloneDeep(child);
219789
+ return clone2;
219790
+ }
219791
+ function cloneDeep(value) {
219792
+ if (Array.isArray(value))
219793
+ return value.map(cloneDeep);
219794
+ if (isPlainObject$4(value)) {
219795
+ const clone2 = {};
219796
+ for (const [key2, child] of Object.entries(value))
219797
+ clone2[key2] = cloneDeep(child);
219798
+ return clone2;
219799
+ }
219800
+ return value;
219801
+ }
219802
+ function splitPath(path2) {
219803
+ return path2.split(".");
219804
+ }
219805
+ function setAtPath(target, path2, value) {
219806
+ const segments = splitPath(path2);
219807
+ let cursor = target;
219808
+ for (let i4 = 0;i4 < segments.length - 1; i4++) {
219809
+ const key2 = segments[i4];
219810
+ const next2 = cursor[key2];
219811
+ if (!isPlainObject$4(next2))
219812
+ cursor[key2] = {};
219813
+ cursor = cursor[key2];
219814
+ }
219815
+ cursor[segments[segments.length - 1]] = cloneDeep(value);
219816
+ }
219817
+ function deleteAtPath(target, path2) {
219818
+ const segments = splitPath(path2);
219819
+ let cursor = target;
219820
+ for (let i4 = 0;i4 < segments.length - 1; i4++) {
219821
+ const key2 = segments[i4];
219822
+ const next2 = cursor[key2];
219823
+ if (!isPlainObject$4(next2))
219824
+ return;
219825
+ cursor = next2;
219826
+ }
219827
+ delete cursor[segments[segments.length - 1]];
219828
+ }
219770
219829
  function isPlainObject$4(value) {
219771
219830
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
219772
219831
  }
@@ -219801,7 +219860,10 @@ function omitKeys(attrs, keysToOmit) {
219801
219860
  return result;
219802
219861
  }
219803
219862
  function normalizeParagraphAttrs(attrs) {
219804
- return omitKeys(attrs, VOLATILE_PARAGRAPH_ATTRS);
219863
+ return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
219864
+ }
219865
+ function normalizeBlockAttrs(attrs) {
219866
+ return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
219805
219867
  }
219806
219868
  function normalizeImageNodeJSON(nodeJSON) {
219807
219869
  const attrs = nodeJSON.attrs;
@@ -219866,14 +219928,54 @@ function normalizeDocJSON(docJSON) {
219866
219928
  function normalizeDocNodeJSON(nodeJSON) {
219867
219929
  if (nodeJSON.type === "paragraph")
219868
219930
  return normalizeParagraphNodeJSON(nodeJSON);
219931
+ const attrs = nodeJSON.attrs;
219869
219932
  const content3 = nodeJSON.content;
219933
+ const normalizedAttrs = attrs ? normalizeBlockAttrs(attrs) : undefined;
219870
219934
  if (content3)
219871
219935
  return {
219872
219936
  ...nodeJSON,
219937
+ ...normalizedAttrs ? { attrs: normalizedAttrs } : {},
219873
219938
  content: content3.map(normalizeDocNodeJSON)
219874
219939
  };
219940
+ if (normalizedAttrs)
219941
+ return {
219942
+ ...nodeJSON,
219943
+ attrs: normalizedAttrs
219944
+ };
219875
219945
  return nodeJSON;
219876
219946
  }
219947
+ function normalizeParagraphAttrsLegacy(attrs) {
219948
+ return omitKeys(attrs, LEGACY_VOLATILE_PARAGRAPH_ATTRS);
219949
+ }
219950
+ function normalizeParagraphNodeJSONLegacy(nodeJSON) {
219951
+ const attrs = nodeJSON.attrs ?? {};
219952
+ const content3 = nodeJSON.content;
219953
+ return {
219954
+ ...nodeJSON,
219955
+ attrs: normalizeParagraphAttrsLegacy(attrs),
219956
+ ...content3 ? { content: content3.map(normalizeContentNodeJSON) } : {}
219957
+ };
219958
+ }
219959
+ function normalizeDocNodeJSONLegacy(nodeJSON) {
219960
+ if (nodeJSON.type === "paragraph")
219961
+ return normalizeParagraphNodeJSONLegacy(nodeJSON);
219962
+ const content3 = nodeJSON.content;
219963
+ if (content3)
219964
+ return {
219965
+ ...nodeJSON,
219966
+ content: content3.map(normalizeDocNodeJSONLegacy)
219967
+ };
219968
+ return nodeJSON;
219969
+ }
219970
+ function normalizeDocJSONLegacy(docJSON) {
219971
+ const content3 = docJSON.content;
219972
+ if (!content3)
219973
+ return docJSON;
219974
+ return {
219975
+ ...docJSON,
219976
+ content: content3.map(normalizeDocNodeJSONLegacy)
219977
+ };
219978
+ }
219877
219979
  function diffSequences(oldSeq, newSeq, options) {
219878
219980
  if (!options)
219879
219981
  throw new Error("diffSequences requires an options object.");
@@ -220433,7 +220535,7 @@ function buildDeletedDiff(nodeInfo, deletedNodesSet) {
220433
220535
  function buildModifiedDiff(oldNodeInfo, newNodeInfo) {
220434
220536
  if (isParagraphNodeInfo(oldNodeInfo) && isParagraphNodeInfo(newNodeInfo))
220435
220537
  return buildModifiedParagraphDiff(oldNodeInfo, newNodeInfo);
220436
- const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs);
220538
+ const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS);
220437
220539
  if (!attrsDiff)
220438
220540
  return null;
220439
220541
  return {
@@ -221007,12 +221109,9 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
221007
221109
  skipWithWarning(`Node type mismatch at pos ${pos} for modification.`);
221008
221110
  return result;
221009
221111
  }
221010
- if (!diff.newNodeJSON?.attrs) {
221011
- skipWithWarning(`Missing newNodeJSON.attrs at pos ${pos} for modification.`);
221012
- return result;
221013
- }
221014
221112
  try {
221015
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node2.marks);
221113
+ const mergedAttrs = applyAttrsDiff(node2.attrs, diff.attrsDiff);
221114
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node2.marks);
221016
221115
  result.applied += 1;
221017
221116
  return result;
221018
221117
  } catch (error48) {
@@ -221023,7 +221122,7 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
221023
221122
  skipWithWarning(`Unsupported diff action for non-paragraph node at pos ${pos}.`);
221024
221123
  return result;
221025
221124
  }
221026
- function applyAttrsDiff({ attrs, diff }) {
221125
+ function applyAttrsDiff$1({ attrs, diff }) {
221027
221126
  const updated = JSON.parse(JSON.stringify(attrs ?? {}));
221028
221127
  Object.entries(diff.added || {}).forEach(([path2, value]) => {
221029
221128
  setNestedValue(updated, path2, value);
@@ -221301,19 +221400,15 @@ function replayParagraphDiff({ tr, diff, schema }) {
221301
221400
  skipWithWarning(`Node type mismatch at pos ${pos} for paragraph modification.`);
221302
221401
  return result;
221303
221402
  }
221304
- if (diff.attrsDiff) {
221305
- if (!diff.newNodeJSON?.attrs) {
221306
- skipWithWarning(`Missing newNodeJSON attrs at pos ${pos} for paragraph modification.`);
221307
- return result;
221308
- }
221403
+ if (diff.attrsDiff)
221309
221404
  try {
221310
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node2.marks);
221405
+ const mergedAttrs = applyAttrsDiff(node2.attrs, diff.attrsDiff);
221406
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node2.marks);
221311
221407
  result.applied += 1;
221312
221408
  } catch (error48) {
221313
221409
  skipWithWarning(`Failed to update paragraph attrs at pos ${pos}.`);
221314
221410
  return result;
221315
221411
  }
221316
- }
221317
221412
  const paragraphEndPos = pos + 1 + node2.content.size;
221318
221413
  const contentDiffs = [...diff.contentDiff ?? []].sort((a2, b$1) => {
221319
221414
  const aPos = a2.startPos ?? paragraphEndPos;
@@ -237518,6 +237613,16 @@ function buildCanonicalDiffableState(doc$12, comments, styles, numbering, header
237518
237613
  partsState: partsState ? structuredClone(partsState) : null
237519
237614
  };
237520
237615
  }
237616
+ function buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, headerFooters, partsState) {
237617
+ return {
237618
+ body: normalizeDocJSONLegacy(doc$12.toJSON()),
237619
+ comments: comments.map(canonicalizeComment),
237620
+ styles: styles ? styles : null,
237621
+ numbering: numbering ? numbering : null,
237622
+ headerFooters: headerFooters ? structuredClone(headerFooters) : null,
237623
+ partsState: partsState ? structuredClone(partsState) : null
237624
+ };
237625
+ }
237521
237626
  function sortKeysDeep(value) {
237522
237627
  if (value === null || value === undefined)
237523
237628
  return value;
@@ -237638,6 +237743,9 @@ function getEditorPartsState(editor, headerFooters) {
237638
237743
  function buildCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
237639
237744
  return buildCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
237640
237745
  }
237746
+ function buildLegacyCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
237747
+ return buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
237748
+ }
237641
237749
  function captureSnapshot(editor) {
237642
237750
  const doc$12 = editor.state.doc;
237643
237751
  const comments = getEditorComments(editor);
@@ -237682,8 +237790,10 @@ function compareToSnapshot(editor, targetSnapshot) {
237682
237790
  throw err;
237683
237791
  throw new DiffServiceError("INVALID_INPUT", `Snapshot payload contains malformed data that failed during canonicalization: ${err instanceof Error ? err.message : String(err)}`);
237684
237792
  }
237685
- if (reDerivedFingerprint !== targetSnapshot.fingerprint)
237686
- throw new DiffServiceError("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
237793
+ if (reDerivedFingerprint !== targetSnapshot.fingerprint) {
237794
+ if (computeFingerprint(buildLegacyCanonicalStateForCoverage(targetDoc, targetComments, targetStyles, targetNumbering, targetHeaderFooters, targetSnapshot.version === SNAPSHOT_VERSION_V2 ? targetPartsState : null, targetCoverage)) !== targetSnapshot.fingerprint)
237795
+ throw new DiffServiceError("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
237796
+ }
237687
237797
  const baseDoc = editor.state.doc;
237688
237798
  const baseComments = getEditorComments(editor);
237689
237799
  const baseStyles = getEditorStyles(editor);
@@ -237730,8 +237840,10 @@ function applyDiffPayload(editor, diffPayload, options) {
237730
237840
  const baseHeaderFooters = getEditorHeaderFooters(editor);
237731
237841
  const basePartsState = getEditorPartsState(editor, baseHeaderFooters);
237732
237842
  const currentFingerprint = computeFingerprint(buildCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage));
237733
- if (currentFingerprint !== diffPayload.baseFingerprint)
237734
- throw new DiffServiceError("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
237843
+ if (currentFingerprint !== diffPayload.baseFingerprint) {
237844
+ if (computeFingerprint(buildLegacyCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage)) !== diffPayload.baseFingerprint)
237845
+ throw new DiffServiceError("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
237846
+ }
237735
237847
  const rawDiff = parseDiffPayloadContents(diffPayload.payload);
237736
237848
  const comments = editor.converter ? Array.isArray(editor.converter.comments) ? editor.converter.comments : [] : [];
237737
237849
  const trackedRequested = options?.changeMode === "tracked";
@@ -282830,7 +282942,7 @@ var Node$13 = class Node$14 {
282830
282942
  id: { default: null },
282831
282943
  edGrp: { default: null },
282832
282944
  displacedByCustomXml: { default: null }
282833
- }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path2, value) => {
282945
+ }), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, NON_SEMANTIC_BLOCK_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, LEGACY_VOLATILE_PARAGRAPH_ATTRS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS, COMMENT_ATTRS_DIFF_IGNORED_KEYS, SLOT_VARIANTS, PART_KINDS, DOCUMENT_RELS_PATH$2 = "word/_rels/document.xml.rels", DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", BODY_RELATIONSHIP_EXCLUSIONS, setNestedValue = (target, path2, value) => {
282834
282946
  if (!path2.includes(".")) {
282835
282947
  target[path2] = value;
282836
282948
  return;
@@ -282921,7 +283033,7 @@ var Node$13 = class Node$14 {
282921
283033
  return { warning: `No run nodes found in ${from$1}-${to} for run-attr update.` };
282922
283034
  const failures = [];
282923
283035
  runEntries.forEach(({ pos, node: node2 }) => {
282924
- const updatedAttrs = applyAttrsDiff({
283036
+ const updatedAttrs = applyAttrsDiff$1({
282925
283037
  attrs: node2.attrs,
282926
283038
  diff
282927
283039
  });
@@ -306745,13 +306857,13 @@ menclose::after {
306745
306857
  return;
306746
306858
  console.log(...args$1);
306747
306859
  }, 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;
306748
- var init_src_BVHa1VXC_es = __esm(() => {
306860
+ var init_src_DC1U6aZu_es = __esm(() => {
306749
306861
  init_rolldown_runtime_Bg48TavK_es();
306750
- init_SuperConverter_BzpaXL4Z_es();
306862
+ init_SuperConverter_DZZ9HhoA_es();
306751
306863
  init_jszip_C49i9kUs_es();
306752
306864
  init_xml_js_CqGKpaft_es();
306753
306865
  init_uuid_qzgm05fK_es();
306754
- init_create_headless_toolbar_6lLMNI_b_es();
306866
+ init_create_headless_toolbar_DMKUCLlb_es();
306755
306867
  init_constants_DrU4EASo_es();
306756
306868
  init_dist_B8HfvhaK_es();
306757
306869
  init_unified_Dsuw2be5_es();
@@ -322212,7 +322324,7 @@ ${err.toString()}`);
322212
322324
  customizer = typeof customizer == "function" ? customizer : undefined$1;
322213
322325
  return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
322214
322326
  }
322215
- function cloneDeep(value) {
322327
+ function cloneDeep$1(value) {
322216
322328
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
322217
322329
  }
322218
322330
  function cloneDeepWith(value, customizer) {
@@ -323289,7 +323401,7 @@ function print() { __p += __j.call(arguments, '') }
323289
323401
  lodash.ceil = ceil;
323290
323402
  lodash.clamp = clamp$2;
323291
323403
  lodash.clone = clone2;
323292
- lodash.cloneDeep = cloneDeep;
323404
+ lodash.cloneDeep = cloneDeep$1;
323293
323405
  lodash.cloneDeepWith = cloneDeepWith;
323294
323406
  lodash.cloneWith = cloneWith;
323295
323407
  lodash.conformsTo = conformsTo;
@@ -325472,7 +325584,9 @@ function print() { __p += __j.call(arguments, '') }
325472
325584
  "trackFormat"
325473
325585
  ]);
325474
325586
  TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS = new Set(["id", "sourceId"]);
325475
- VOLATILE_PARAGRAPH_ATTRS = new Set([
325587
+ NON_SEMANTIC_BLOCK_ATTRS = new Set([
325588
+ "sdBlockId",
325589
+ "sdBlockRev",
325476
325590
  "paraId",
325477
325591
  "textId",
325478
325592
  "rsidR",
@@ -325482,6 +325596,16 @@ function print() { __p += __j.call(arguments, '') }
325482
325596
  "rsidDel"
325483
325597
  ]);
325484
325598
  VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS = new Set(["wp14:anchorId", "wp14:editId"]);
325599
+ LEGACY_VOLATILE_PARAGRAPH_ATTRS = new Set([
325600
+ "paraId",
325601
+ "textId",
325602
+ "rsidR",
325603
+ "rsidRDefault",
325604
+ "rsidP",
325605
+ "rsidRPr",
325606
+ "rsidDel"
325607
+ ]);
325608
+ NON_PARAGRAPH_BLOCK_IGNORED_ATTRS = Array.from(NON_SEMANTIC_BLOCK_ATTRS);
325485
325609
  COMMENT_ATTRS_DIFF_IGNORED_KEYS = [
325486
325610
  "textJson",
325487
325611
  "elements",
@@ -330268,17 +330392,7 @@ function print() { __p += __j.call(arguments, '') }
330268
330392
  headerRowFill: null
330269
330393
  }
330270
330394
  };
330271
- IDENTITY_BLOCK_ATTRS = new Set([
330272
- "sdBlockId",
330273
- "sdBlockRev",
330274
- "paraId",
330275
- "textId",
330276
- "rsidR",
330277
- "rsidRDefault",
330278
- "rsidP",
330279
- "rsidRPr",
330280
- "rsidDel"
330281
- ]);
330395
+ IDENTITY_BLOCK_ATTRS = NON_SEMANTIC_BLOCK_ATTRS;
330282
330396
  WORD_DEFAULT_TBL_LOOK = {
330283
330397
  firstRow: true,
330284
330398
  lastRow: false,
@@ -340839,11 +340953,11 @@ function print() { __p += __j.call(arguments, '') }
340839
340953
  ]);
340840
340954
  });
340841
340955
 
340842
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DLpJoHdY.es.js
340956
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DmQpJGyP.es.js
340843
340957
  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;
340844
- var init_create_super_doc_ui_DLpJoHdY_es = __esm(() => {
340845
- init_SuperConverter_BzpaXL4Z_es();
340846
- init_create_headless_toolbar_6lLMNI_b_es();
340958
+ var init_create_super_doc_ui_DmQpJGyP_es = __esm(() => {
340959
+ init_SuperConverter_DZZ9HhoA_es();
340960
+ init_create_headless_toolbar_DMKUCLlb_es();
340847
340961
  MOD_ALIASES = new Set([
340848
340962
  "Mod",
340849
340963
  "Meta",
@@ -340885,16 +340999,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
340885
340999
 
340886
341000
  // ../../packages/superdoc/dist/super-editor.es.js
340887
341001
  var init_super_editor_es = __esm(() => {
340888
- init_src_BVHa1VXC_es();
340889
- init_SuperConverter_BzpaXL4Z_es();
341002
+ init_src_DC1U6aZu_es();
341003
+ init_SuperConverter_DZZ9HhoA_es();
340890
341004
  init_jszip_C49i9kUs_es();
340891
341005
  init_xml_js_CqGKpaft_es();
340892
- init_create_headless_toolbar_6lLMNI_b_es();
341006
+ init_create_headless_toolbar_DMKUCLlb_es();
340893
341007
  init_constants_DrU4EASo_es();
340894
341008
  init_dist_B8HfvhaK_es();
340895
341009
  init_unified_Dsuw2be5_es();
340896
341010
  init_DocxZipper_CZMPWpOp_es();
340897
- init_create_super_doc_ui_DLpJoHdY_es();
341011
+ init_create_super_doc_ui_DmQpJGyP_es();
340898
341012
  init_ui_C5PAS9hY_es();
340899
341013
  init_eventemitter3_BnGqBE_Q_es();
340900
341014
  init_errors_CNaD6vcg_es();
@@ -343040,7 +343154,7 @@ More content with **bold** and *italic*.`
343040
343154
  idempotency: "conditional",
343041
343155
  supportsDryRun: true,
343042
343156
  supportsTrackedMode: true,
343043
- possibleFailureCodes: ["INVALID_TARGET"],
343157
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
343044
343158
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY2]
343045
343159
  }),
343046
343160
  referenceDocPath: "format/apply.mdx",
@@ -343113,7 +343227,7 @@ More content with **bold** and *italic*.`
343113
343227
  idempotency: "conditional",
343114
343228
  supportsDryRun: true,
343115
343229
  supportsTrackedMode: true,
343116
- possibleFailureCodes: ["INVALID_TARGET"],
343230
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
343117
343231
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY2]
343118
343232
  }),
343119
343233
  referenceDocPath: "format/apply.mdx",
@@ -435058,12 +435172,12 @@ class DocxExporter2 {
435058
435172
  return text7;
435059
435173
  return String(text7).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
435060
435174
  }
435061
- #generateXml(node4) {
435175
+ #generateXml(node4, insideDeletion = false) {
435062
435176
  if (!node4)
435063
435177
  return null;
435064
435178
  let { name } = node4;
435065
435179
  const { elements, attributes } = node4;
435066
- if (name === "w:delInstrText") {
435180
+ if (name === "w:delInstrText" && !insideDeletion) {
435067
435181
  name = "w:instrText";
435068
435182
  }
435069
435183
  let tag = `<${name}`;
@@ -435080,8 +435194,9 @@ class DocxExporter2 {
435080
435194
  if (!name && node4.type === "text") {
435081
435195
  return this.#replaceSpecialCharacters(node4.text ?? "");
435082
435196
  }
435197
+ const nextInsideDeletion = insideDeletion || name === "w:del";
435083
435198
  if (elements) {
435084
- if (name === "w:instrText") {
435199
+ if (name === "w:instrText" || name === "w:delInstrText") {
435085
435200
  const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
435086
435201
  tags.push(this.#replaceSpecialCharacters(textContent2));
435087
435202
  } else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
@@ -435098,7 +435213,7 @@ class DocxExporter2 {
435098
435213
  } else {
435099
435214
  if (elements) {
435100
435215
  for (let child of elements) {
435101
- const newElements = this.#generateXml(child);
435216
+ const newElements = this.#generateXml(child, nextInsideDeletion);
435102
435217
  if (!newElements) {
435103
435218
  continue;
435104
435219
  }
@@ -456807,6 +456922,22 @@ var init_selection_info_resolver = __esm(() => {
456807
456922
  TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
456808
456923
  });
456809
456924
 
456925
+ // ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/identity-attrs.ts
456926
+ var NON_SEMANTIC_BLOCK_ATTRS2;
456927
+ var init_identity_attrs = __esm(() => {
456928
+ NON_SEMANTIC_BLOCK_ATTRS2 = new Set([
456929
+ "sdBlockId",
456930
+ "sdBlockRev",
456931
+ "paraId",
456932
+ "textId",
456933
+ "rsidR",
456934
+ "rsidRDefault",
456935
+ "rsidP",
456936
+ "rsidRPr",
456937
+ "rsidDel"
456938
+ ]);
456939
+ });
456940
+
456810
456941
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/table-target-resolver.ts
456811
456942
  function resolveLocatorToCandidate2(editor, locator, operationName) {
456812
456943
  const hasTarget = locator.target != null;
@@ -460549,6 +460680,7 @@ function tablesClearDefaultStyleAdapter2(editor, _input, options) {
460549
460680
  var POINTS_TO_PIXELS2, POINTS_TO_TWIPS2 = 20, PIXELS_TO_TWIPS2, DEFAULT_TABLE_GRID_WIDTH_TWIPS2 = 1500, SETTINGS_PART2 = "word/settings.xml", PRESET_GREY2 = "999999", PRESET_BLACK2 = "000000", STATIC_PRESETS2, IDENTITY_BLOCK_ATTRS2, WORD_DEFAULT_TBL_LOOK2, FLAG_TO_OOXML_KEY2, INVERTED_FLAGS2, XML_KEY_TO_STYLE_OPTION2, CLEARED_BORDER_OOXML2, TABLE_MARGIN_KEY_GROUPS2;
460550
460681
  var init_tables_adapter = __esm(() => {
460551
460682
  init_wrapper();
460683
+ init_identity_attrs();
460552
460684
  init_dist10();
460553
460685
  init_index_cache();
460554
460686
  init_table_target_resolver();
@@ -460601,17 +460733,7 @@ var init_tables_adapter = __esm(() => {
460601
460733
  headerRowFill: null
460602
460734
  }
460603
460735
  };
460604
- IDENTITY_BLOCK_ATTRS2 = new Set([
460605
- "sdBlockId",
460606
- "sdBlockRev",
460607
- "paraId",
460608
- "textId",
460609
- "rsidR",
460610
- "rsidRDefault",
460611
- "rsidP",
460612
- "rsidRPr",
460613
- "rsidDel"
460614
- ]);
460736
+ IDENTITY_BLOCK_ATTRS2 = NON_SEMANTIC_BLOCK_ATTRS2;
460615
460737
  WORD_DEFAULT_TBL_LOOK2 = {
460616
460738
  firstRow: true,
460617
460739
  lastRow: false,
@@ -463614,6 +463736,74 @@ function recordDeletedValue2(value, path3, diff, ignoreKeys) {
463614
463736
  function joinPath2(base6, key2) {
463615
463737
  return base6 ? `${base6}.${key2}` : key2;
463616
463738
  }
463739
+ function applyAttrsDiff2(baseAttrs, attrsDiff) {
463740
+ const result = cloneAttrs2(baseAttrs ?? {});
463741
+ if (!attrsDiff) {
463742
+ return result;
463743
+ }
463744
+ for (const [path3, value] of Object.entries(attrsDiff.added ?? {})) {
463745
+ setAtPath2(result, path3, value);
463746
+ }
463747
+ for (const [path3, change] of Object.entries(attrsDiff.modified ?? {})) {
463748
+ setAtPath2(result, path3, change.to);
463749
+ }
463750
+ for (const path3 of Object.keys(attrsDiff.deleted ?? {})) {
463751
+ deleteAtPath2(result, path3);
463752
+ }
463753
+ return result;
463754
+ }
463755
+ function cloneAttrs2(value) {
463756
+ if (!isPlainObject9(value)) {
463757
+ return {};
463758
+ }
463759
+ const clone2 = {};
463760
+ for (const [key2, child] of Object.entries(value)) {
463761
+ clone2[key2] = cloneDeep2(child);
463762
+ }
463763
+ return clone2;
463764
+ }
463765
+ function cloneDeep2(value) {
463766
+ if (Array.isArray(value)) {
463767
+ return value.map(cloneDeep2);
463768
+ }
463769
+ if (isPlainObject9(value)) {
463770
+ const clone2 = {};
463771
+ for (const [key2, child] of Object.entries(value)) {
463772
+ clone2[key2] = cloneDeep2(child);
463773
+ }
463774
+ return clone2;
463775
+ }
463776
+ return value;
463777
+ }
463778
+ function splitPath2(path3) {
463779
+ return path3.split(".");
463780
+ }
463781
+ function setAtPath2(target, path3, value) {
463782
+ const segments = splitPath2(path3);
463783
+ let cursor = target;
463784
+ for (let i5 = 0;i5 < segments.length - 1; i5++) {
463785
+ const key2 = segments[i5];
463786
+ const next2 = cursor[key2];
463787
+ if (!isPlainObject9(next2)) {
463788
+ cursor[key2] = {};
463789
+ }
463790
+ cursor = cursor[key2];
463791
+ }
463792
+ cursor[segments[segments.length - 1]] = cloneDeep2(value);
463793
+ }
463794
+ function deleteAtPath2(target, path3) {
463795
+ const segments = splitPath2(path3);
463796
+ let cursor = target;
463797
+ for (let i5 = 0;i5 < segments.length - 1; i5++) {
463798
+ const key2 = segments[i5];
463799
+ const next2 = cursor[key2];
463800
+ if (!isPlainObject9(next2)) {
463801
+ return;
463802
+ }
463803
+ cursor = next2;
463804
+ }
463805
+ delete cursor[segments[segments.length - 1]];
463806
+ }
463617
463807
  function isPlainObject9(value) {
463618
463808
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
463619
463809
  }
@@ -463665,7 +463855,10 @@ function omitKeys2(attrs, keysToOmit) {
463665
463855
  return result;
463666
463856
  }
463667
463857
  function normalizeParagraphAttrs2(attrs) {
463668
- return omitKeys2(attrs, VOLATILE_PARAGRAPH_ATTRS2);
463858
+ return omitKeys2(attrs, NON_SEMANTIC_BLOCK_ATTRS2);
463859
+ }
463860
+ function normalizeBlockAttrs2(attrs) {
463861
+ return omitKeys2(attrs, NON_SEMANTIC_BLOCK_ATTRS2);
463669
463862
  }
463670
463863
  function normalizeImageNodeJSON2(nodeJSON) {
463671
463864
  const attrs = nodeJSON.attrs;
@@ -463738,19 +463931,70 @@ function normalizeDocNodeJSON2(nodeJSON) {
463738
463931
  if (type === "paragraph") {
463739
463932
  return normalizeParagraphNodeJSON2(nodeJSON);
463740
463933
  }
463934
+ const attrs = nodeJSON.attrs;
463741
463935
  const content5 = nodeJSON.content;
463936
+ const normalizedAttrs = attrs ? normalizeBlockAttrs2(attrs) : undefined;
463742
463937
  if (content5) {
463743
463938
  return {
463744
463939
  ...nodeJSON,
463940
+ ...normalizedAttrs ? { attrs: normalizedAttrs } : {},
463745
463941
  content: content5.map(normalizeDocNodeJSON2)
463746
463942
  };
463747
463943
  }
463944
+ if (normalizedAttrs) {
463945
+ return { ...nodeJSON, attrs: normalizedAttrs };
463946
+ }
463947
+ return nodeJSON;
463948
+ }
463949
+ function normalizeParagraphAttrsLegacy2(attrs) {
463950
+ return omitKeys2(attrs, LEGACY_VOLATILE_PARAGRAPH_ATTRS2);
463951
+ }
463952
+ function normalizeParagraphNodeJSONLegacy2(nodeJSON) {
463953
+ const attrs = nodeJSON.attrs ?? {};
463954
+ const content5 = nodeJSON.content;
463955
+ return {
463956
+ ...nodeJSON,
463957
+ attrs: normalizeParagraphAttrsLegacy2(attrs),
463958
+ ...content5 ? { content: content5.map(normalizeContentNodeJSON2) } : {}
463959
+ };
463960
+ }
463961
+ function normalizeDocNodeJSONLegacy2(nodeJSON) {
463962
+ const type = nodeJSON.type;
463963
+ if (type === "paragraph") {
463964
+ return normalizeParagraphNodeJSONLegacy2(nodeJSON);
463965
+ }
463966
+ const content5 = nodeJSON.content;
463967
+ if (content5) {
463968
+ return {
463969
+ ...nodeJSON,
463970
+ content: content5.map(normalizeDocNodeJSONLegacy2)
463971
+ };
463972
+ }
463748
463973
  return nodeJSON;
463749
463974
  }
463750
- var VOLATILE_PARAGRAPH_ATTRS2, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS2;
463975
+ function normalizeDocJSONLegacy2(docJSON) {
463976
+ const content5 = docJSON.content;
463977
+ if (!content5) {
463978
+ return docJSON;
463979
+ }
463980
+ return {
463981
+ ...docJSON,
463982
+ content: content5.map(normalizeDocNodeJSONLegacy2)
463983
+ };
463984
+ }
463985
+ var VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS2, LEGACY_VOLATILE_PARAGRAPH_ATTRS2;
463751
463986
  var init_semantic_normalization = __esm(() => {
463752
- VOLATILE_PARAGRAPH_ATTRS2 = new Set(["paraId", "textId", "rsidR", "rsidRDefault", "rsidP", "rsidRPr", "rsidDel"]);
463987
+ init_identity_attrs();
463753
463988
  VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS2 = new Set(["wp14:anchorId", "wp14:editId"]);
463989
+ LEGACY_VOLATILE_PARAGRAPH_ATTRS2 = new Set([
463990
+ "paraId",
463991
+ "textId",
463992
+ "rsidR",
463993
+ "rsidRDefault",
463994
+ "rsidP",
463995
+ "rsidRPr",
463996
+ "rsidDel"
463997
+ ]);
463754
463998
  });
463755
463999
 
463756
464000
  // ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/sequence-diffing.ts
@@ -464397,7 +464641,7 @@ function buildModifiedDiff2(oldNodeInfo, newNodeInfo) {
464397
464641
  if (isParagraphNodeInfo2(oldNodeInfo) && isParagraphNodeInfo2(newNodeInfo)) {
464398
464642
  return buildModifiedParagraphDiff2(oldNodeInfo, newNodeInfo);
464399
464643
  }
464400
- const attrsDiff = getAttributesDiff2(oldNodeInfo.node.attrs, newNodeInfo.node.attrs);
464644
+ const attrsDiff = getAttributesDiff2(oldNodeInfo.node.attrs, newNodeInfo.node.attrs, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2);
464401
464645
  if (!attrsDiff) {
464402
464646
  return null;
464403
464647
  }
@@ -464413,10 +464657,13 @@ function buildModifiedDiff2(oldNodeInfo, newNodeInfo) {
464413
464657
  function isParagraphNodeInfo2(nodeInfo) {
464414
464658
  return nodeInfo.node.type.name === "paragraph";
464415
464659
  }
464660
+ var NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2;
464416
464661
  var init_generic_diffing = __esm(() => {
464417
464662
  init_paragraph_diffing();
464418
464663
  init_sequence_diffing();
464419
464664
  init_attributes_diffing();
464665
+ init_identity_attrs();
464666
+ NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2 = Array.from(NON_SEMANTIC_BLOCK_ATTRS2);
464420
464667
  });
464421
464668
 
464422
464669
  // ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/header-footer-diffing.ts
@@ -464912,12 +465159,9 @@ function replayNonParagraphDiff2({
464912
465159
  skipWithWarning(`Node type mismatch at pos ${pos} for modification.`);
464913
465160
  return result;
464914
465161
  }
464915
- if (!diff.newNodeJSON?.attrs) {
464916
- skipWithWarning(`Missing newNodeJSON.attrs at pos ${pos} for modification.`);
464917
- return result;
464918
- }
464919
465162
  try {
464920
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node4.marks);
465163
+ const mergedAttrs = applyAttrsDiff2(node4.attrs, diff.attrsDiff);
465164
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node4.marks);
464921
465165
  result.applied += 1;
464922
465166
  return result;
464923
465167
  } catch (error48) {
@@ -464931,10 +465175,11 @@ function replayNonParagraphDiff2({
464931
465175
  var init_replay_non_paragraph = __esm(() => {
464932
465176
  init_dist2();
464933
465177
  init_dist4();
465178
+ init_attributes_diffing();
464934
465179
  });
464935
465180
 
464936
465181
  // ../../packages/super-editor/src/editors/v1/extensions/diffing/replay/replay-attrs.ts
464937
- function applyAttrsDiff2({
465182
+ function applyAttrsDiff3({
464938
465183
  attrs,
464939
465184
  diff
464940
465185
  }) {
@@ -465281,7 +465526,7 @@ var applyRunAttrsDiffInRange2 = (tr, from4, to, diff) => {
465281
465526
  }
465282
465527
  const failures = [];
465283
465528
  runEntries.forEach(({ pos, node: node4 }) => {
465284
- const updatedAttrs = applyAttrsDiff2({ attrs: node4.attrs, diff });
465529
+ const updatedAttrs = applyAttrsDiff3({ attrs: node4.attrs, diff });
465285
465530
  if (deepEquals2(updatedAttrs, node4.attrs)) {
465286
465531
  return;
465287
465532
  }
@@ -465407,12 +465652,9 @@ function replayParagraphDiff2({
465407
465652
  return result;
465408
465653
  }
465409
465654
  if (diff.attrsDiff) {
465410
- if (!diff.newNodeJSON?.attrs) {
465411
- skipWithWarning(`Missing newNodeJSON attrs at pos ${pos} for paragraph modification.`);
465412
- return result;
465413
- }
465414
465655
  try {
465415
- tr.setNodeMarkup(pos, undefined, diff.newNodeJSON.attrs, node4.marks);
465656
+ const mergedAttrs = applyAttrsDiff2(node4.attrs, diff.attrsDiff);
465657
+ tr.setNodeMarkup(pos, undefined, mergedAttrs, node4.marks);
465416
465658
  result.applied += 1;
465417
465659
  } catch (error48) {
465418
465660
  skipWithWarning(`Failed to update paragraph attrs at pos ${pos}.`);
@@ -465447,6 +465689,7 @@ function replayParagraphDiff2({
465447
465689
  var init_replay_paragraph = __esm(() => {
465448
465690
  init_dist2();
465449
465691
  init_dist4();
465692
+ init_attributes_diffing();
465450
465693
  init_replay_inline();
465451
465694
  });
465452
465695
 
@@ -466582,6 +466825,16 @@ function buildCanonicalDiffableState2(doc6, comments, styles, numbering, headerF
466582
466825
  partsState: partsState ? structuredClone(partsState) : null
466583
466826
  };
466584
466827
  }
466828
+ function buildLegacyCanonicalDiffableState2(doc6, comments, styles, numbering, headerFooters, partsState) {
466829
+ return {
466830
+ body: normalizeDocJSONLegacy2(doc6.toJSON()),
466831
+ comments: comments.map(canonicalizeComment2),
466832
+ styles: styles ? styles : null,
466833
+ numbering: numbering ? numbering : null,
466834
+ headerFooters: headerFooters ? structuredClone(headerFooters) : null,
466835
+ partsState: partsState ? structuredClone(partsState) : null
466836
+ };
466837
+ }
466585
466838
  function sortKeysDeep2(value) {
466586
466839
  if (value === null || value === undefined)
466587
466840
  return value;
@@ -466808,6 +467061,9 @@ function getEditorPartsState2(editor, headerFooters) {
466808
467061
  function buildCanonicalStateForCoverage2(doc6, comments, styles, numbering, headerFooters, partsState, coverage) {
466809
467062
  return buildCanonicalDiffableState2(doc6, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
466810
467063
  }
467064
+ function buildLegacyCanonicalStateForCoverage2(doc6, comments, styles, numbering, headerFooters, partsState, coverage) {
467065
+ return buildLegacyCanonicalDiffableState2(doc6, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
467066
+ }
466811
467067
  function captureSnapshot2(editor) {
466812
467068
  const doc6 = editor.state.doc;
466813
467069
  const comments = getEditorComments2(editor);
@@ -466856,7 +467112,11 @@ function compareToSnapshot2(editor, targetSnapshot) {
466856
467112
  throw new DiffServiceError2("INVALID_INPUT", `Snapshot payload contains malformed data that failed during canonicalization: ${err instanceof Error ? err.message : String(err)}`);
466857
467113
  }
466858
467114
  if (reDerivedFingerprint !== targetSnapshot.fingerprint) {
466859
- throw new DiffServiceError2("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
467115
+ const legacyCanonical = buildLegacyCanonicalStateForCoverage2(targetDoc, targetComments, targetStyles, targetNumbering, targetHeaderFooters, targetSnapshot.version === SNAPSHOT_VERSION_V22 ? targetPartsState : null, targetCoverage);
467116
+ const legacyFingerprint = computeFingerprint2(legacyCanonical);
467117
+ if (legacyFingerprint !== targetSnapshot.fingerprint) {
467118
+ throw new DiffServiceError2("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
467119
+ }
466860
467120
  }
466861
467121
  const baseDoc = editor.state.doc;
466862
467122
  const baseComments = getEditorComments2(editor);
@@ -466907,7 +467167,11 @@ function applyDiffPayload2(editor, diffPayload, options) {
466907
467167
  const baseCanonical = buildCanonicalStateForCoverage2(baseDoc, baseComments, baseStyles, baseNumbering3, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V22 ? basePartsState : null, diffPayload.coverage);
466908
467168
  const currentFingerprint = computeFingerprint2(baseCanonical);
466909
467169
  if (currentFingerprint !== diffPayload.baseFingerprint) {
466910
- throw new DiffServiceError2("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". ` + `The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
467170
+ const legacyBaseCanonical = buildLegacyCanonicalStateForCoverage2(baseDoc, baseComments, baseStyles, baseNumbering3, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V22 ? basePartsState : null, diffPayload.coverage);
467171
+ const legacyFingerprint = computeFingerprint2(legacyBaseCanonical);
467172
+ if (legacyFingerprint !== diffPayload.baseFingerprint) {
467173
+ throw new DiffServiceError2("PRECONDITION_FAILED", `Document fingerprint mismatch. Expected "${diffPayload.baseFingerprint}", got "${currentFingerprint}". ` + `The document may have changed since the diff was computed. Re-run diff.compare against the current state.`);
467174
+ }
466911
467175
  }
466912
467176
  const rawDiff = parseDiffPayloadContents2(diffPayload.payload);
466913
467177
  const comments = editor.converter ? Array.isArray(editor.converter.comments) ? editor.converter.comments : [] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.9.0-next.3",
3
+ "version": "0.9.0-next.5",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"