@superdoc-dev/mcp 0.9.0-next.4 → 0.9.0-next.6
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.
- package/dist/index.js +484 -100
- 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-
|
|
51894
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DA0uKCdy.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")
|
|
@@ -92898,7 +92898,42 @@ var isRegExp = (value) => {
|
|
|
92898
92898
|
if (trackedRuns.length === 1)
|
|
92899
92899
|
return trackedRuns[0];
|
|
92900
92900
|
return trackedRuns;
|
|
92901
|
-
}, config$30, translator$5, translator$184, translator$71, translator$179, translator$65, translator$204, translator$83, translator$84, translator$141, translator$207, translator$100, translator$186, translator$188, propertyTranslators$11, translator$189, translator$109, propertyTranslators$10, CT_TC_MAR_CHILD_ORDER, baseConfig$1, orderedConfig$1, translator$190, translator$183, translator$180, translator$75, translator$72, translator$73, propertyTranslators$9, translator$191,
|
|
92901
|
+
}, config$30, translator$5, translator$184, translator$71, translator$179, translator$65, translator$204, translator$83, translator$84, translator$141, translator$207, translator$100, translator$186, translator$188, propertyTranslators$11, translator$189, translator$109, propertyTranslators$10, CT_TC_MAR_CHILD_ORDER, baseConfig$1, orderedConfig$1, translator$190, translator$183, translator$180, translator$75, translator$72, translator$73, propertyTranslators$9, translator$191, normalizeRowCellChildren = (row) => {
|
|
92902
|
+
const out = [];
|
|
92903
|
+
const children = Array.isArray(row?.elements) ? row.elements : [];
|
|
92904
|
+
for (const child of children) {
|
|
92905
|
+
if (!child || typeof child.name !== "string")
|
|
92906
|
+
continue;
|
|
92907
|
+
if (child.name === "w:tc") {
|
|
92908
|
+
out.push({
|
|
92909
|
+
node: child,
|
|
92910
|
+
cellSdt: null
|
|
92911
|
+
});
|
|
92912
|
+
continue;
|
|
92913
|
+
}
|
|
92914
|
+
if (child.name === "w:sdt") {
|
|
92915
|
+
const sdtPr = child.elements?.find((el) => el?.name === "w:sdtPr") ?? null;
|
|
92916
|
+
const sdtEndPr = child.elements?.find((el) => el?.name === "w:sdtEndPr") ?? null;
|
|
92917
|
+
const innerCells = child.elements?.find((el) => el?.name === "w:sdtContent")?.elements?.filter((el) => el?.name === "w:tc") ?? [];
|
|
92918
|
+
if (innerCells.length === 1 && sdtPr)
|
|
92919
|
+
out.push({
|
|
92920
|
+
node: innerCells[0],
|
|
92921
|
+
cellSdt: {
|
|
92922
|
+
scope: "cell",
|
|
92923
|
+
sdtPr,
|
|
92924
|
+
sdtEndPr
|
|
92925
|
+
}
|
|
92926
|
+
});
|
|
92927
|
+
else
|
|
92928
|
+
for (const innerTc of innerCells)
|
|
92929
|
+
out.push({
|
|
92930
|
+
node: innerTc,
|
|
92931
|
+
cellSdt: null
|
|
92932
|
+
});
|
|
92933
|
+
}
|
|
92934
|
+
}
|
|
92935
|
+
return out;
|
|
92936
|
+
}, getTableCellVMerge = (node2) => {
|
|
92902
92937
|
const vMerge = node2.elements.find((el) => el.name === "w:tcPr")?.elements?.find((el) => el.name === "w:vMerge");
|
|
92903
92938
|
if (!vMerge)
|
|
92904
92939
|
return null;
|
|
@@ -92914,7 +92949,7 @@ var isRegExp = (value) => {
|
|
|
92914
92949
|
const value = typeof raw === "string" ? parseInt(raw, 10) : raw;
|
|
92915
92950
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
92916
92951
|
}, findTableCellAtColumn = (row, targetColumn) => {
|
|
92917
|
-
const cells = row.
|
|
92952
|
+
const cells = normalizeRowCellChildren(row).map((entry) => entry.node);
|
|
92918
92953
|
let currentColumn = getGridBefore(row);
|
|
92919
92954
|
for (const cell of cells) {
|
|
92920
92955
|
const colSpan = getTableCellGridSpan(cell);
|
|
@@ -93075,7 +93110,7 @@ var isRegExp = (value) => {
|
|
|
93075
93110
|
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
93076
93111
|
while (pendingRowSpans.length < totalColumns)
|
|
93077
93112
|
pendingRowSpans.push(0);
|
|
93078
|
-
const
|
|
93113
|
+
const cellEntries = normalizeRowCellChildren(row);
|
|
93079
93114
|
const content$2 = [];
|
|
93080
93115
|
let currentColumnIndex = 0;
|
|
93081
93116
|
const fillUntil = (target, reason) => {
|
|
@@ -93094,7 +93129,7 @@ var isRegExp = (value) => {
|
|
|
93094
93129
|
};
|
|
93095
93130
|
fillUntil(safeGridBefore, "gridBefore");
|
|
93096
93131
|
skipOccupiedColumns();
|
|
93097
|
-
|
|
93132
|
+
cellEntries.forEach(({ node: node2, cellSdt }) => {
|
|
93098
93133
|
skipOccupiedColumns();
|
|
93099
93134
|
const startColumn = currentColumnIndex;
|
|
93100
93135
|
if (node2._vMergeConsumed)
|
|
@@ -93111,6 +93146,11 @@ var isRegExp = (value) => {
|
|
|
93111
93146
|
columnWidth
|
|
93112
93147
|
}
|
|
93113
93148
|
});
|
|
93149
|
+
if (result && cellSdt)
|
|
93150
|
+
result.attrs = {
|
|
93151
|
+
...result.attrs || {},
|
|
93152
|
+
cellSdt
|
|
93153
|
+
};
|
|
93114
93154
|
if (result) {
|
|
93115
93155
|
content$2.push(result);
|
|
93116
93156
|
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
@@ -93176,6 +93216,28 @@ var isRegExp = (value) => {
|
|
|
93176
93216
|
content: trimmedContent
|
|
93177
93217
|
}
|
|
93178
93218
|
});
|
|
93219
|
+
let cellCursor = 0;
|
|
93220
|
+
for (let i$1 = 0;i$1 < elements.length; i$1 += 1) {
|
|
93221
|
+
const exportedEl = elements[i$1];
|
|
93222
|
+
if (!exportedEl || exportedEl.name !== "w:tc")
|
|
93223
|
+
continue;
|
|
93224
|
+
const sourceCell = trimmedContent[cellCursor];
|
|
93225
|
+
cellCursor += 1;
|
|
93226
|
+
const cellSdt = sourceCell?.attrs?.cellSdt;
|
|
93227
|
+
if (!cellSdt || cellSdt.scope !== "cell" || !cellSdt.sdtPr)
|
|
93228
|
+
continue;
|
|
93229
|
+
const sdtChildren = [cellSdt.sdtPr];
|
|
93230
|
+
if (cellSdt.sdtEndPr)
|
|
93231
|
+
sdtChildren.push(cellSdt.sdtEndPr);
|
|
93232
|
+
sdtChildren.push({
|
|
93233
|
+
name: "w:sdtContent",
|
|
93234
|
+
elements: [exportedEl]
|
|
93235
|
+
});
|
|
93236
|
+
elements[i$1] = {
|
|
93237
|
+
name: "w:sdt",
|
|
93238
|
+
elements: sdtChildren
|
|
93239
|
+
};
|
|
93240
|
+
}
|
|
93179
93241
|
if (node2.attrs?.tableRowProperties) {
|
|
93180
93242
|
const tableRowProperties = { ...node2.attrs.tableRowProperties };
|
|
93181
93243
|
if (leadingPlaceholders > 0)
|
|
@@ -105968,12 +106030,12 @@ var isRegExp = (value) => {
|
|
|
105968
106030
|
return text$2;
|
|
105969
106031
|
return String(text$2).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
105970
106032
|
}
|
|
105971
|
-
#generateXml(node2) {
|
|
106033
|
+
#generateXml(node2, insideDeletion = false) {
|
|
105972
106034
|
if (!node2)
|
|
105973
106035
|
return null;
|
|
105974
106036
|
let { name } = node2;
|
|
105975
106037
|
const { elements, attributes } = node2;
|
|
105976
|
-
if (name === "w:delInstrText")
|
|
106038
|
+
if (name === "w:delInstrText" && !insideDeletion)
|
|
105977
106039
|
name = "w:instrText";
|
|
105978
106040
|
let tag = `<${name}`;
|
|
105979
106041
|
for (let attr in attributes) {
|
|
@@ -105988,8 +106050,9 @@ var isRegExp = (value) => {
|
|
|
105988
106050
|
let tags = [tag];
|
|
105989
106051
|
if (!name && node2.type === "text")
|
|
105990
106052
|
return this.#replaceSpecialCharacters(node2.text ?? "");
|
|
106053
|
+
const nextInsideDeletion = insideDeletion || name === "w:del";
|
|
105991
106054
|
if (elements) {
|
|
105992
|
-
if (name === "w:instrText") {
|
|
106055
|
+
if (name === "w:instrText" || name === "w:delInstrText") {
|
|
105993
106056
|
const textContent = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
105994
106057
|
tags.push(this.#replaceSpecialCharacters(textContent));
|
|
105995
106058
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset")
|
|
@@ -106005,7 +106068,7 @@ var isRegExp = (value) => {
|
|
|
106005
106068
|
}
|
|
106006
106069
|
else if (elements)
|
|
106007
106070
|
for (let child of elements) {
|
|
106008
|
-
const newElements = this.#generateXml(child);
|
|
106071
|
+
const newElements = this.#generateXml(child, nextInsideDeletion);
|
|
106009
106072
|
if (!newElements)
|
|
106010
106073
|
continue;
|
|
106011
106074
|
if (typeof newElements === "string") {
|
|
@@ -106756,7 +106819,7 @@ var isRegExp = (value) => {
|
|
|
106756
106819
|
state.kern = kernNode.attributes["w:val"];
|
|
106757
106820
|
}
|
|
106758
106821
|
}, SuperConverter;
|
|
106759
|
-
var
|
|
106822
|
+
var init_SuperConverter_DA0uKCdy_es = __esm(() => {
|
|
106760
106823
|
init_rolldown_runtime_Bg48TavK_es();
|
|
106761
106824
|
init_jszip_C49i9kUs_es();
|
|
106762
106825
|
init_xml_js_CqGKpaft_es();
|
|
@@ -110037,7 +110100,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
|
|
|
110037
110100
|
idempotency: "conditional",
|
|
110038
110101
|
supportsDryRun: true,
|
|
110039
110102
|
supportsTrackedMode: true,
|
|
110040
|
-
possibleFailureCodes: ["INVALID_TARGET"],
|
|
110103
|
+
possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
|
|
110041
110104
|
throws: [
|
|
110042
110105
|
...T_NOT_FOUND_CAPABLE,
|
|
110043
110106
|
"INVALID_TARGET",
|
|
@@ -110113,7 +110176,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
|
|
|
110113
110176
|
idempotency: "conditional",
|
|
110114
110177
|
supportsDryRun: true,
|
|
110115
110178
|
supportsTrackedMode: true,
|
|
110116
|
-
possibleFailureCodes: ["INVALID_TARGET"],
|
|
110179
|
+
possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
|
|
110117
110180
|
throws: [
|
|
110118
110181
|
...T_NOT_FOUND_CAPABLE,
|
|
110119
110182
|
"INVALID_TARGET",
|
|
@@ -145070,7 +145133,7 @@ var init_SuperConverter_BzpaXL4Z_es = __esm(() => {
|
|
|
145070
145133
|
};
|
|
145071
145134
|
});
|
|
145072
145135
|
|
|
145073
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
145136
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-CHdUF-l4.es.js
|
|
145074
145137
|
function parseSizeUnit(val = "0") {
|
|
145075
145138
|
const length = val.toString() || "0";
|
|
145076
145139
|
const value = Number.parseFloat(length);
|
|
@@ -155302,8 +155365,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
155302
155365
|
}
|
|
155303
155366
|
};
|
|
155304
155367
|
};
|
|
155305
|
-
var
|
|
155306
|
-
|
|
155368
|
+
var init_create_headless_toolbar_CHdUF_l4_es = __esm(() => {
|
|
155369
|
+
init_SuperConverter_DA0uKCdy_es();
|
|
155307
155370
|
init_uuid_qzgm05fK_es();
|
|
155308
155371
|
init_constants_DrU4EASo_es();
|
|
155309
155372
|
init_dist_B8HfvhaK_es();
|
|
@@ -210034,7 +210097,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
210034
210097
|
init_remark_gfm_BhnWr3yf_es();
|
|
210035
210098
|
});
|
|
210036
210099
|
|
|
210037
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
210100
|
+
// ../../packages/superdoc/dist/chunks/src-CWBwwVmR.es.js
|
|
210038
210101
|
function deleteProps(obj, propOrProps) {
|
|
210039
210102
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
210040
210103
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -219767,6 +219830,64 @@ function recordDeletedValue(value, path2, diff, ignoreKeys) {
|
|
|
219767
219830
|
function joinPath(base4, key2) {
|
|
219768
219831
|
return base4 ? `${base4}.${key2}` : key2;
|
|
219769
219832
|
}
|
|
219833
|
+
function applyAttrsDiff(baseAttrs, attrsDiff) {
|
|
219834
|
+
const result = cloneAttrs(baseAttrs ?? {});
|
|
219835
|
+
if (!attrsDiff)
|
|
219836
|
+
return result;
|
|
219837
|
+
for (const [path2, value] of Object.entries(attrsDiff.added ?? {}))
|
|
219838
|
+
setAtPath(result, path2, value);
|
|
219839
|
+
for (const [path2, change] of Object.entries(attrsDiff.modified ?? {}))
|
|
219840
|
+
setAtPath(result, path2, change.to);
|
|
219841
|
+
for (const path2 of Object.keys(attrsDiff.deleted ?? {}))
|
|
219842
|
+
deleteAtPath(result, path2);
|
|
219843
|
+
return result;
|
|
219844
|
+
}
|
|
219845
|
+
function cloneAttrs(value) {
|
|
219846
|
+
if (!isPlainObject$4(value))
|
|
219847
|
+
return {};
|
|
219848
|
+
const clone2 = {};
|
|
219849
|
+
for (const [key2, child] of Object.entries(value))
|
|
219850
|
+
clone2[key2] = cloneDeep(child);
|
|
219851
|
+
return clone2;
|
|
219852
|
+
}
|
|
219853
|
+
function cloneDeep(value) {
|
|
219854
|
+
if (Array.isArray(value))
|
|
219855
|
+
return value.map(cloneDeep);
|
|
219856
|
+
if (isPlainObject$4(value)) {
|
|
219857
|
+
const clone2 = {};
|
|
219858
|
+
for (const [key2, child] of Object.entries(value))
|
|
219859
|
+
clone2[key2] = cloneDeep(child);
|
|
219860
|
+
return clone2;
|
|
219861
|
+
}
|
|
219862
|
+
return value;
|
|
219863
|
+
}
|
|
219864
|
+
function splitPath(path2) {
|
|
219865
|
+
return path2.split(".");
|
|
219866
|
+
}
|
|
219867
|
+
function setAtPath(target, path2, value) {
|
|
219868
|
+
const segments = splitPath(path2);
|
|
219869
|
+
let cursor = target;
|
|
219870
|
+
for (let i4 = 0;i4 < segments.length - 1; i4++) {
|
|
219871
|
+
const key2 = segments[i4];
|
|
219872
|
+
const next2 = cursor[key2];
|
|
219873
|
+
if (!isPlainObject$4(next2))
|
|
219874
|
+
cursor[key2] = {};
|
|
219875
|
+
cursor = cursor[key2];
|
|
219876
|
+
}
|
|
219877
|
+
cursor[segments[segments.length - 1]] = cloneDeep(value);
|
|
219878
|
+
}
|
|
219879
|
+
function deleteAtPath(target, path2) {
|
|
219880
|
+
const segments = splitPath(path2);
|
|
219881
|
+
let cursor = target;
|
|
219882
|
+
for (let i4 = 0;i4 < segments.length - 1; i4++) {
|
|
219883
|
+
const key2 = segments[i4];
|
|
219884
|
+
const next2 = cursor[key2];
|
|
219885
|
+
if (!isPlainObject$4(next2))
|
|
219886
|
+
return;
|
|
219887
|
+
cursor = next2;
|
|
219888
|
+
}
|
|
219889
|
+
delete cursor[segments[segments.length - 1]];
|
|
219890
|
+
}
|
|
219770
219891
|
function isPlainObject$4(value) {
|
|
219771
219892
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
219772
219893
|
}
|
|
@@ -219801,7 +219922,10 @@ function omitKeys(attrs, keysToOmit) {
|
|
|
219801
219922
|
return result;
|
|
219802
219923
|
}
|
|
219803
219924
|
function normalizeParagraphAttrs(attrs) {
|
|
219804
|
-
return omitKeys(attrs,
|
|
219925
|
+
return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
|
|
219926
|
+
}
|
|
219927
|
+
function normalizeBlockAttrs(attrs) {
|
|
219928
|
+
return omitKeys(attrs, NON_SEMANTIC_BLOCK_ATTRS);
|
|
219805
219929
|
}
|
|
219806
219930
|
function normalizeImageNodeJSON(nodeJSON) {
|
|
219807
219931
|
const attrs = nodeJSON.attrs;
|
|
@@ -219866,14 +219990,54 @@ function normalizeDocJSON(docJSON) {
|
|
|
219866
219990
|
function normalizeDocNodeJSON(nodeJSON) {
|
|
219867
219991
|
if (nodeJSON.type === "paragraph")
|
|
219868
219992
|
return normalizeParagraphNodeJSON(nodeJSON);
|
|
219993
|
+
const attrs = nodeJSON.attrs;
|
|
219869
219994
|
const content3 = nodeJSON.content;
|
|
219995
|
+
const normalizedAttrs = attrs ? normalizeBlockAttrs(attrs) : undefined;
|
|
219870
219996
|
if (content3)
|
|
219871
219997
|
return {
|
|
219872
219998
|
...nodeJSON,
|
|
219999
|
+
...normalizedAttrs ? { attrs: normalizedAttrs } : {},
|
|
219873
220000
|
content: content3.map(normalizeDocNodeJSON)
|
|
219874
220001
|
};
|
|
220002
|
+
if (normalizedAttrs)
|
|
220003
|
+
return {
|
|
220004
|
+
...nodeJSON,
|
|
220005
|
+
attrs: normalizedAttrs
|
|
220006
|
+
};
|
|
219875
220007
|
return nodeJSON;
|
|
219876
220008
|
}
|
|
220009
|
+
function normalizeParagraphAttrsLegacy(attrs) {
|
|
220010
|
+
return omitKeys(attrs, LEGACY_VOLATILE_PARAGRAPH_ATTRS);
|
|
220011
|
+
}
|
|
220012
|
+
function normalizeParagraphNodeJSONLegacy(nodeJSON) {
|
|
220013
|
+
const attrs = nodeJSON.attrs ?? {};
|
|
220014
|
+
const content3 = nodeJSON.content;
|
|
220015
|
+
return {
|
|
220016
|
+
...nodeJSON,
|
|
220017
|
+
attrs: normalizeParagraphAttrsLegacy(attrs),
|
|
220018
|
+
...content3 ? { content: content3.map(normalizeContentNodeJSON) } : {}
|
|
220019
|
+
};
|
|
220020
|
+
}
|
|
220021
|
+
function normalizeDocNodeJSONLegacy(nodeJSON) {
|
|
220022
|
+
if (nodeJSON.type === "paragraph")
|
|
220023
|
+
return normalizeParagraphNodeJSONLegacy(nodeJSON);
|
|
220024
|
+
const content3 = nodeJSON.content;
|
|
220025
|
+
if (content3)
|
|
220026
|
+
return {
|
|
220027
|
+
...nodeJSON,
|
|
220028
|
+
content: content3.map(normalizeDocNodeJSONLegacy)
|
|
220029
|
+
};
|
|
220030
|
+
return nodeJSON;
|
|
220031
|
+
}
|
|
220032
|
+
function normalizeDocJSONLegacy(docJSON) {
|
|
220033
|
+
const content3 = docJSON.content;
|
|
220034
|
+
if (!content3)
|
|
220035
|
+
return docJSON;
|
|
220036
|
+
return {
|
|
220037
|
+
...docJSON,
|
|
220038
|
+
content: content3.map(normalizeDocNodeJSONLegacy)
|
|
220039
|
+
};
|
|
220040
|
+
}
|
|
219877
220041
|
function diffSequences(oldSeq, newSeq, options) {
|
|
219878
220042
|
if (!options)
|
|
219879
220043
|
throw new Error("diffSequences requires an options object.");
|
|
@@ -220433,7 +220597,7 @@ function buildDeletedDiff(nodeInfo, deletedNodesSet) {
|
|
|
220433
220597
|
function buildModifiedDiff(oldNodeInfo, newNodeInfo) {
|
|
220434
220598
|
if (isParagraphNodeInfo(oldNodeInfo) && isParagraphNodeInfo(newNodeInfo))
|
|
220435
220599
|
return buildModifiedParagraphDiff(oldNodeInfo, newNodeInfo);
|
|
220436
|
-
const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs);
|
|
220600
|
+
const attrsDiff = getAttributesDiff(oldNodeInfo.node.attrs, newNodeInfo.node.attrs, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS);
|
|
220437
220601
|
if (!attrsDiff)
|
|
220438
220602
|
return null;
|
|
220439
220603
|
return {
|
|
@@ -221007,12 +221171,9 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
|
|
|
221007
221171
|
skipWithWarning(`Node type mismatch at pos ${pos} for modification.`);
|
|
221008
221172
|
return result;
|
|
221009
221173
|
}
|
|
221010
|
-
if (!diff.newNodeJSON?.attrs) {
|
|
221011
|
-
skipWithWarning(`Missing newNodeJSON.attrs at pos ${pos} for modification.`);
|
|
221012
|
-
return result;
|
|
221013
|
-
}
|
|
221014
221174
|
try {
|
|
221015
|
-
|
|
221175
|
+
const mergedAttrs = applyAttrsDiff(node2.attrs, diff.attrsDiff);
|
|
221176
|
+
tr.setNodeMarkup(pos, undefined, mergedAttrs, node2.marks);
|
|
221016
221177
|
result.applied += 1;
|
|
221017
221178
|
return result;
|
|
221018
221179
|
} catch (error48) {
|
|
@@ -221023,7 +221184,7 @@ function replayNonParagraphDiff({ tr, diff, schema }) {
|
|
|
221023
221184
|
skipWithWarning(`Unsupported diff action for non-paragraph node at pos ${pos}.`);
|
|
221024
221185
|
return result;
|
|
221025
221186
|
}
|
|
221026
|
-
function applyAttrsDiff({ attrs, diff }) {
|
|
221187
|
+
function applyAttrsDiff$1({ attrs, diff }) {
|
|
221027
221188
|
const updated = JSON.parse(JSON.stringify(attrs ?? {}));
|
|
221028
221189
|
Object.entries(diff.added || {}).forEach(([path2, value]) => {
|
|
221029
221190
|
setNestedValue(updated, path2, value);
|
|
@@ -221301,19 +221462,15 @@ function replayParagraphDiff({ tr, diff, schema }) {
|
|
|
221301
221462
|
skipWithWarning(`Node type mismatch at pos ${pos} for paragraph modification.`);
|
|
221302
221463
|
return result;
|
|
221303
221464
|
}
|
|
221304
|
-
if (diff.attrsDiff)
|
|
221305
|
-
if (!diff.newNodeJSON?.attrs) {
|
|
221306
|
-
skipWithWarning(`Missing newNodeJSON attrs at pos ${pos} for paragraph modification.`);
|
|
221307
|
-
return result;
|
|
221308
|
-
}
|
|
221465
|
+
if (diff.attrsDiff)
|
|
221309
221466
|
try {
|
|
221310
|
-
|
|
221467
|
+
const mergedAttrs = applyAttrsDiff(node2.attrs, diff.attrsDiff);
|
|
221468
|
+
tr.setNodeMarkup(pos, undefined, mergedAttrs, node2.marks);
|
|
221311
221469
|
result.applied += 1;
|
|
221312
221470
|
} catch (error48) {
|
|
221313
221471
|
skipWithWarning(`Failed to update paragraph attrs at pos ${pos}.`);
|
|
221314
221472
|
return result;
|
|
221315
221473
|
}
|
|
221316
|
-
}
|
|
221317
221474
|
const paragraphEndPos = pos + 1 + node2.content.size;
|
|
221318
221475
|
const contentDiffs = [...diff.contentDiff ?? []].sort((a2, b$1) => {
|
|
221319
221476
|
const aPos = a2.startPos ?? paragraphEndPos;
|
|
@@ -237518,6 +237675,16 @@ function buildCanonicalDiffableState(doc$12, comments, styles, numbering, header
|
|
|
237518
237675
|
partsState: partsState ? structuredClone(partsState) : null
|
|
237519
237676
|
};
|
|
237520
237677
|
}
|
|
237678
|
+
function buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, headerFooters, partsState) {
|
|
237679
|
+
return {
|
|
237680
|
+
body: normalizeDocJSONLegacy(doc$12.toJSON()),
|
|
237681
|
+
comments: comments.map(canonicalizeComment),
|
|
237682
|
+
styles: styles ? styles : null,
|
|
237683
|
+
numbering: numbering ? numbering : null,
|
|
237684
|
+
headerFooters: headerFooters ? structuredClone(headerFooters) : null,
|
|
237685
|
+
partsState: partsState ? structuredClone(partsState) : null
|
|
237686
|
+
};
|
|
237687
|
+
}
|
|
237521
237688
|
function sortKeysDeep(value) {
|
|
237522
237689
|
if (value === null || value === undefined)
|
|
237523
237690
|
return value;
|
|
@@ -237638,6 +237805,9 @@ function getEditorPartsState(editor, headerFooters) {
|
|
|
237638
237805
|
function buildCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
|
|
237639
237806
|
return buildCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
|
|
237640
237807
|
}
|
|
237808
|
+
function buildLegacyCanonicalStateForCoverage(doc$12, comments, styles, numbering, headerFooters, partsState, coverage) {
|
|
237809
|
+
return buildLegacyCanonicalDiffableState(doc$12, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
|
|
237810
|
+
}
|
|
237641
237811
|
function captureSnapshot(editor) {
|
|
237642
237812
|
const doc$12 = editor.state.doc;
|
|
237643
237813
|
const comments = getEditorComments(editor);
|
|
@@ -237682,8 +237852,10 @@ function compareToSnapshot(editor, targetSnapshot) {
|
|
|
237682
237852
|
throw err;
|
|
237683
237853
|
throw new DiffServiceError("INVALID_INPUT", `Snapshot payload contains malformed data that failed during canonicalization: ${err instanceof Error ? err.message : String(err)}`);
|
|
237684
237854
|
}
|
|
237685
|
-
if (reDerivedFingerprint !== targetSnapshot.fingerprint)
|
|
237686
|
-
|
|
237855
|
+
if (reDerivedFingerprint !== targetSnapshot.fingerprint) {
|
|
237856
|
+
if (computeFingerprint(buildLegacyCanonicalStateForCoverage(targetDoc, targetComments, targetStyles, targetNumbering, targetHeaderFooters, targetSnapshot.version === SNAPSHOT_VERSION_V2 ? targetPartsState : null, targetCoverage)) !== targetSnapshot.fingerprint)
|
|
237857
|
+
throw new DiffServiceError("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
|
|
237858
|
+
}
|
|
237687
237859
|
const baseDoc = editor.state.doc;
|
|
237688
237860
|
const baseComments = getEditorComments(editor);
|
|
237689
237861
|
const baseStyles = getEditorStyles(editor);
|
|
@@ -237730,8 +237902,10 @@ function applyDiffPayload(editor, diffPayload, options) {
|
|
|
237730
237902
|
const baseHeaderFooters = getEditorHeaderFooters(editor);
|
|
237731
237903
|
const basePartsState = getEditorPartsState(editor, baseHeaderFooters);
|
|
237732
237904
|
const currentFingerprint = computeFingerprint(buildCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage));
|
|
237733
|
-
if (currentFingerprint !== diffPayload.baseFingerprint)
|
|
237734
|
-
|
|
237905
|
+
if (currentFingerprint !== diffPayload.baseFingerprint) {
|
|
237906
|
+
if (computeFingerprint(buildLegacyCanonicalStateForCoverage(baseDoc, baseComments, baseStyles, baseNumbering2, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V2 ? basePartsState : null, diffPayload.coverage)) !== diffPayload.baseFingerprint)
|
|
237907
|
+
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.`);
|
|
237908
|
+
}
|
|
237735
237909
|
const rawDiff = parseDiffPayloadContents(diffPayload.payload);
|
|
237736
237910
|
const comments = editor.converter ? Array.isArray(editor.converter.comments) ? editor.converter.comments : [] : [];
|
|
237737
237911
|
const trackedRequested = options?.changeMode === "tracked";
|
|
@@ -282830,7 +283004,7 @@ var Node$13 = class Node$14 {
|
|
|
282830
283004
|
id: { default: null },
|
|
282831
283005
|
edGrp: { default: null },
|
|
282832
283006
|
displacedByCustomXml: { default: null }
|
|
282833
|
-
}), PermEnd, PermEndBlock, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES$1, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS,
|
|
283007
|
+
}), 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
283008
|
if (!path2.includes(".")) {
|
|
282835
283009
|
target[path2] = value;
|
|
282836
283010
|
return;
|
|
@@ -282921,7 +283095,7 @@ var Node$13 = class Node$14 {
|
|
|
282921
283095
|
return { warning: `No run nodes found in ${from$1}-${to} for run-attr update.` };
|
|
282922
283096
|
const failures = [];
|
|
282923
283097
|
runEntries.forEach(({ pos, node: node2 }) => {
|
|
282924
|
-
const updatedAttrs = applyAttrsDiff({
|
|
283098
|
+
const updatedAttrs = applyAttrsDiff$1({
|
|
282925
283099
|
attrs: node2.attrs,
|
|
282926
283100
|
diff
|
|
282927
283101
|
});
|
|
@@ -306745,13 +306919,13 @@ menclose::after {
|
|
|
306745
306919
|
return;
|
|
306746
306920
|
console.log(...args$1);
|
|
306747
306921
|
}, 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
|
|
306922
|
+
var init_src_CWBwwVmR_es = __esm(() => {
|
|
306749
306923
|
init_rolldown_runtime_Bg48TavK_es();
|
|
306750
|
-
|
|
306924
|
+
init_SuperConverter_DA0uKCdy_es();
|
|
306751
306925
|
init_jszip_C49i9kUs_es();
|
|
306752
306926
|
init_xml_js_CqGKpaft_es();
|
|
306753
306927
|
init_uuid_qzgm05fK_es();
|
|
306754
|
-
|
|
306928
|
+
init_create_headless_toolbar_CHdUF_l4_es();
|
|
306755
306929
|
init_constants_DrU4EASo_es();
|
|
306756
306930
|
init_dist_B8HfvhaK_es();
|
|
306757
306931
|
init_unified_Dsuw2be5_es();
|
|
@@ -311603,6 +311777,10 @@ ${err.toString()}`);
|
|
|
311603
311777
|
default: null,
|
|
311604
311778
|
rendered: false
|
|
311605
311779
|
},
|
|
311780
|
+
cellSdt: {
|
|
311781
|
+
default: null,
|
|
311782
|
+
rendered: false
|
|
311783
|
+
},
|
|
311606
311784
|
__placeholder: {
|
|
311607
311785
|
default: null,
|
|
311608
311786
|
parseDOM: (element3) => {
|
|
@@ -311812,6 +311990,10 @@ ${err.toString()}`);
|
|
|
311812
311990
|
tableCellPropertiesInlineKeys: {
|
|
311813
311991
|
default: null,
|
|
311814
311992
|
rendered: false
|
|
311993
|
+
},
|
|
311994
|
+
cellSdt: {
|
|
311995
|
+
default: null,
|
|
311996
|
+
rendered: false
|
|
311815
311997
|
}
|
|
311816
311998
|
};
|
|
311817
311999
|
},
|
|
@@ -322212,7 +322394,7 @@ ${err.toString()}`);
|
|
|
322212
322394
|
customizer = typeof customizer == "function" ? customizer : undefined$1;
|
|
322213
322395
|
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
|
|
322214
322396
|
}
|
|
322215
|
-
function cloneDeep(value) {
|
|
322397
|
+
function cloneDeep$1(value) {
|
|
322216
322398
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
322217
322399
|
}
|
|
322218
322400
|
function cloneDeepWith(value, customizer) {
|
|
@@ -323289,7 +323471,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
323289
323471
|
lodash.ceil = ceil;
|
|
323290
323472
|
lodash.clamp = clamp$2;
|
|
323291
323473
|
lodash.clone = clone2;
|
|
323292
|
-
lodash.cloneDeep = cloneDeep;
|
|
323474
|
+
lodash.cloneDeep = cloneDeep$1;
|
|
323293
323475
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
323294
323476
|
lodash.cloneWith = cloneWith;
|
|
323295
323477
|
lodash.conformsTo = conformsTo;
|
|
@@ -325472,7 +325654,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325472
325654
|
"trackFormat"
|
|
325473
325655
|
]);
|
|
325474
325656
|
TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS = new Set(["id", "sourceId"]);
|
|
325475
|
-
|
|
325657
|
+
NON_SEMANTIC_BLOCK_ATTRS = new Set([
|
|
325658
|
+
"sdBlockId",
|
|
325659
|
+
"sdBlockRev",
|
|
325476
325660
|
"paraId",
|
|
325477
325661
|
"textId",
|
|
325478
325662
|
"rsidR",
|
|
@@ -325482,6 +325666,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325482
325666
|
"rsidDel"
|
|
325483
325667
|
]);
|
|
325484
325668
|
VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS = new Set(["wp14:anchorId", "wp14:editId"]);
|
|
325669
|
+
LEGACY_VOLATILE_PARAGRAPH_ATTRS = new Set([
|
|
325670
|
+
"paraId",
|
|
325671
|
+
"textId",
|
|
325672
|
+
"rsidR",
|
|
325673
|
+
"rsidRDefault",
|
|
325674
|
+
"rsidP",
|
|
325675
|
+
"rsidRPr",
|
|
325676
|
+
"rsidDel"
|
|
325677
|
+
]);
|
|
325678
|
+
NON_PARAGRAPH_BLOCK_IGNORED_ATTRS = Array.from(NON_SEMANTIC_BLOCK_ATTRS);
|
|
325485
325679
|
COMMENT_ATTRS_DIFF_IGNORED_KEYS = [
|
|
325486
325680
|
"textJson",
|
|
325487
325681
|
"elements",
|
|
@@ -330268,17 +330462,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
330268
330462
|
headerRowFill: null
|
|
330269
330463
|
}
|
|
330270
330464
|
};
|
|
330271
|
-
IDENTITY_BLOCK_ATTRS =
|
|
330272
|
-
"sdBlockId",
|
|
330273
|
-
"sdBlockRev",
|
|
330274
|
-
"paraId",
|
|
330275
|
-
"textId",
|
|
330276
|
-
"rsidR",
|
|
330277
|
-
"rsidRDefault",
|
|
330278
|
-
"rsidP",
|
|
330279
|
-
"rsidRPr",
|
|
330280
|
-
"rsidDel"
|
|
330281
|
-
]);
|
|
330465
|
+
IDENTITY_BLOCK_ATTRS = NON_SEMANTIC_BLOCK_ATTRS;
|
|
330282
330466
|
WORD_DEFAULT_TBL_LOOK = {
|
|
330283
330467
|
firstRow: true,
|
|
330284
330468
|
lastRow: false,
|
|
@@ -340839,11 +341023,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
340839
341023
|
]);
|
|
340840
341024
|
});
|
|
340841
341025
|
|
|
340842
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
341026
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-DfP4AvAu.es.js
|
|
340843
341027
|
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
|
|
340845
|
-
|
|
340846
|
-
|
|
341028
|
+
var init_create_super_doc_ui_DfP4AvAu_es = __esm(() => {
|
|
341029
|
+
init_SuperConverter_DA0uKCdy_es();
|
|
341030
|
+
init_create_headless_toolbar_CHdUF_l4_es();
|
|
340847
341031
|
MOD_ALIASES = new Set([
|
|
340848
341032
|
"Mod",
|
|
340849
341033
|
"Meta",
|
|
@@ -340885,16 +341069,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
340885
341069
|
|
|
340886
341070
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
340887
341071
|
var init_super_editor_es = __esm(() => {
|
|
340888
|
-
|
|
340889
|
-
|
|
341072
|
+
init_src_CWBwwVmR_es();
|
|
341073
|
+
init_SuperConverter_DA0uKCdy_es();
|
|
340890
341074
|
init_jszip_C49i9kUs_es();
|
|
340891
341075
|
init_xml_js_CqGKpaft_es();
|
|
340892
|
-
|
|
341076
|
+
init_create_headless_toolbar_CHdUF_l4_es();
|
|
340893
341077
|
init_constants_DrU4EASo_es();
|
|
340894
341078
|
init_dist_B8HfvhaK_es();
|
|
340895
341079
|
init_unified_Dsuw2be5_es();
|
|
340896
341080
|
init_DocxZipper_CZMPWpOp_es();
|
|
340897
|
-
|
|
341081
|
+
init_create_super_doc_ui_DfP4AvAu_es();
|
|
340898
341082
|
init_ui_C5PAS9hY_es();
|
|
340899
341083
|
init_eventemitter3_BnGqBE_Q_es();
|
|
340900
341084
|
init_errors_CNaD6vcg_es();
|
|
@@ -343040,7 +343224,7 @@ More content with **bold** and *italic*.`
|
|
|
343040
343224
|
idempotency: "conditional",
|
|
343041
343225
|
supportsDryRun: true,
|
|
343042
343226
|
supportsTrackedMode: true,
|
|
343043
|
-
possibleFailureCodes: ["INVALID_TARGET"],
|
|
343227
|
+
possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
|
|
343044
343228
|
throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY2]
|
|
343045
343229
|
}),
|
|
343046
343230
|
referenceDocPath: "format/apply.mdx",
|
|
@@ -343113,7 +343297,7 @@ More content with **bold** and *italic*.`
|
|
|
343113
343297
|
idempotency: "conditional",
|
|
343114
343298
|
supportsDryRun: true,
|
|
343115
343299
|
supportsTrackedMode: true,
|
|
343116
|
-
possibleFailureCodes: ["INVALID_TARGET"],
|
|
343300
|
+
possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
|
|
343117
343301
|
throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET", "INVALID_INPUT", ...T_STORY2]
|
|
343118
343302
|
}),
|
|
343119
343303
|
referenceDocPath: "format/apply.mdx",
|
|
@@ -405313,6 +405497,37 @@ var init_tcPr = __esm(() => {
|
|
|
405313
405497
|
init_tcPr_translator();
|
|
405314
405498
|
});
|
|
405315
405499
|
|
|
405500
|
+
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/tr/row-cell-children.js
|
|
405501
|
+
var normalizeRowCellChildren2 = (row2) => {
|
|
405502
|
+
const out = [];
|
|
405503
|
+
const children = Array.isArray(row2?.elements) ? row2.elements : [];
|
|
405504
|
+
for (const child of children) {
|
|
405505
|
+
if (!child || typeof child.name !== "string")
|
|
405506
|
+
continue;
|
|
405507
|
+
if (child.name === "w:tc") {
|
|
405508
|
+
out.push({ node: child, cellSdt: null });
|
|
405509
|
+
continue;
|
|
405510
|
+
}
|
|
405511
|
+
if (child.name === "w:sdt") {
|
|
405512
|
+
const sdtPr = child.elements?.find((el) => el?.name === "w:sdtPr") ?? null;
|
|
405513
|
+
const sdtEndPr = child.elements?.find((el) => el?.name === "w:sdtEndPr") ?? null;
|
|
405514
|
+
const sdtContent = child.elements?.find((el) => el?.name === "w:sdtContent");
|
|
405515
|
+
const innerCells = sdtContent?.elements?.filter((el) => el?.name === "w:tc") ?? [];
|
|
405516
|
+
if (innerCells.length === 1 && sdtPr) {
|
|
405517
|
+
out.push({
|
|
405518
|
+
node: innerCells[0],
|
|
405519
|
+
cellSdt: { scope: "cell", sdtPr, sdtEndPr }
|
|
405520
|
+
});
|
|
405521
|
+
} else {
|
|
405522
|
+
for (const innerTc of innerCells) {
|
|
405523
|
+
out.push({ node: innerTc, cellSdt: null });
|
|
405524
|
+
}
|
|
405525
|
+
}
|
|
405526
|
+
}
|
|
405527
|
+
}
|
|
405528
|
+
return out;
|
|
405529
|
+
};
|
|
405530
|
+
|
|
405316
405531
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/tc/helpers/legacy-handle-table-cell-node.js
|
|
405317
405532
|
function handleTableCellNode2({
|
|
405318
405533
|
params: params3,
|
|
@@ -405510,7 +405725,7 @@ var getTableCellVMerge2 = (node4) => {
|
|
|
405510
405725
|
const value = typeof raw === "string" ? parseInt(raw, 10) : raw;
|
|
405511
405726
|
return Number.isFinite(value) && value > 0 ? value : 1;
|
|
405512
405727
|
}, findTableCellAtColumn2 = (row2, targetColumn) => {
|
|
405513
|
-
const cells = row2.
|
|
405728
|
+
const cells = normalizeRowCellChildren2(row2).map((entry) => entry.node);
|
|
405514
405729
|
let currentColumn = getGridBefore2(row2);
|
|
405515
405730
|
for (const cell2 of cells) {
|
|
405516
405731
|
const colSpan = getTableCellGridSpan2(cell2);
|
|
@@ -406116,7 +406331,7 @@ var XML_NODE_NAME14 = "w:tr", SD_NODE_NAME9 = "tableRow", validXmlAttributes7, g
|
|
|
406116
406331
|
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
406117
406332
|
while (pendingRowSpans.length < totalColumns)
|
|
406118
406333
|
pendingRowSpans.push(0);
|
|
406119
|
-
const
|
|
406334
|
+
const cellEntries = normalizeRowCellChildren2(row2);
|
|
406120
406335
|
const content4 = [];
|
|
406121
406336
|
let currentColumnIndex = 0;
|
|
406122
406337
|
const fillUntil = (target, reason) => {
|
|
@@ -406135,7 +406350,7 @@ var XML_NODE_NAME14 = "w:tr", SD_NODE_NAME9 = "tableRow", validXmlAttributes7, g
|
|
|
406135
406350
|
};
|
|
406136
406351
|
fillUntil(safeGridBefore, "gridBefore");
|
|
406137
406352
|
skipOccupiedColumns();
|
|
406138
|
-
|
|
406353
|
+
cellEntries.forEach(({ node: node4, cellSdt }) => {
|
|
406139
406354
|
skipOccupiedColumns();
|
|
406140
406355
|
const startColumn = currentColumnIndex;
|
|
406141
406356
|
if (node4._vMergeConsumed)
|
|
@@ -406152,6 +406367,9 @@ var XML_NODE_NAME14 = "w:tr", SD_NODE_NAME9 = "tableRow", validXmlAttributes7, g
|
|
|
406152
406367
|
columnWidth
|
|
406153
406368
|
}
|
|
406154
406369
|
});
|
|
406370
|
+
if (result && cellSdt) {
|
|
406371
|
+
result.attrs = { ...result.attrs || {}, cellSdt };
|
|
406372
|
+
}
|
|
406155
406373
|
if (result) {
|
|
406156
406374
|
content4.push(result);
|
|
406157
406375
|
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
@@ -406220,6 +406438,22 @@ var XML_NODE_NAME14 = "w:tr", SD_NODE_NAME9 = "tableRow", validXmlAttributes7, g
|
|
|
406220
406438
|
node: { ...node4, content: trimmedContent }
|
|
406221
406439
|
};
|
|
406222
406440
|
const elements = translateChildNodes2(translateParams);
|
|
406441
|
+
let cellCursor = 0;
|
|
406442
|
+
for (let i5 = 0;i5 < elements.length; i5 += 1) {
|
|
406443
|
+
const exportedEl = elements[i5];
|
|
406444
|
+
if (!exportedEl || exportedEl.name !== "w:tc")
|
|
406445
|
+
continue;
|
|
406446
|
+
const sourceCell = trimmedContent[cellCursor];
|
|
406447
|
+
cellCursor += 1;
|
|
406448
|
+
const cellSdt = sourceCell?.attrs?.cellSdt;
|
|
406449
|
+
if (!cellSdt || cellSdt.scope !== "cell" || !cellSdt.sdtPr)
|
|
406450
|
+
continue;
|
|
406451
|
+
const sdtChildren = [cellSdt.sdtPr];
|
|
406452
|
+
if (cellSdt.sdtEndPr)
|
|
406453
|
+
sdtChildren.push(cellSdt.sdtEndPr);
|
|
406454
|
+
sdtChildren.push({ name: "w:sdtContent", elements: [exportedEl] });
|
|
406455
|
+
elements[i5] = { name: "w:sdt", elements: sdtChildren };
|
|
406456
|
+
}
|
|
406223
406457
|
if (node4.attrs?.tableRowProperties) {
|
|
406224
406458
|
const tableRowProperties = { ...node4.attrs.tableRowProperties };
|
|
406225
406459
|
if (leadingPlaceholders > 0) {
|
|
@@ -435058,12 +435292,12 @@ class DocxExporter2 {
|
|
|
435058
435292
|
return text7;
|
|
435059
435293
|
return String(text7).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
435060
435294
|
}
|
|
435061
|
-
#generateXml(node4) {
|
|
435295
|
+
#generateXml(node4, insideDeletion = false) {
|
|
435062
435296
|
if (!node4)
|
|
435063
435297
|
return null;
|
|
435064
435298
|
let { name } = node4;
|
|
435065
435299
|
const { elements, attributes } = node4;
|
|
435066
|
-
if (name === "w:delInstrText") {
|
|
435300
|
+
if (name === "w:delInstrText" && !insideDeletion) {
|
|
435067
435301
|
name = "w:instrText";
|
|
435068
435302
|
}
|
|
435069
435303
|
let tag = `<${name}`;
|
|
@@ -435080,8 +435314,9 @@ class DocxExporter2 {
|
|
|
435080
435314
|
if (!name && node4.type === "text") {
|
|
435081
435315
|
return this.#replaceSpecialCharacters(node4.text ?? "");
|
|
435082
435316
|
}
|
|
435317
|
+
const nextInsideDeletion = insideDeletion || name === "w:del";
|
|
435083
435318
|
if (elements) {
|
|
435084
|
-
if (name === "w:instrText") {
|
|
435319
|
+
if (name === "w:instrText" || name === "w:delInstrText") {
|
|
435085
435320
|
const textContent2 = (elements || []).map((child) => typeof child?.text === "string" ? child.text : "").join("");
|
|
435086
435321
|
tags.push(this.#replaceSpecialCharacters(textContent2));
|
|
435087
435322
|
} else if (name === "w:t" || name === "w:delText" || name === "wp:posOffset") {
|
|
@@ -435098,7 +435333,7 @@ class DocxExporter2 {
|
|
|
435098
435333
|
} else {
|
|
435099
435334
|
if (elements) {
|
|
435100
435335
|
for (let child of elements) {
|
|
435101
|
-
const newElements = this.#generateXml(child);
|
|
435336
|
+
const newElements = this.#generateXml(child, nextInsideDeletion);
|
|
435102
435337
|
if (!newElements) {
|
|
435103
435338
|
continue;
|
|
435104
435339
|
}
|
|
@@ -456807,6 +457042,22 @@ var init_selection_info_resolver = __esm(() => {
|
|
|
456807
457042
|
TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
|
|
456808
457043
|
});
|
|
456809
457044
|
|
|
457045
|
+
// ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/identity-attrs.ts
|
|
457046
|
+
var NON_SEMANTIC_BLOCK_ATTRS2;
|
|
457047
|
+
var init_identity_attrs = __esm(() => {
|
|
457048
|
+
NON_SEMANTIC_BLOCK_ATTRS2 = new Set([
|
|
457049
|
+
"sdBlockId",
|
|
457050
|
+
"sdBlockRev",
|
|
457051
|
+
"paraId",
|
|
457052
|
+
"textId",
|
|
457053
|
+
"rsidR",
|
|
457054
|
+
"rsidRDefault",
|
|
457055
|
+
"rsidP",
|
|
457056
|
+
"rsidRPr",
|
|
457057
|
+
"rsidDel"
|
|
457058
|
+
]);
|
|
457059
|
+
});
|
|
457060
|
+
|
|
456810
457061
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/table-target-resolver.ts
|
|
456811
457062
|
function resolveLocatorToCandidate2(editor, locator, operationName) {
|
|
456812
457063
|
const hasTarget = locator.target != null;
|
|
@@ -460549,6 +460800,7 @@ function tablesClearDefaultStyleAdapter2(editor, _input, options) {
|
|
|
460549
460800
|
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
460801
|
var init_tables_adapter = __esm(() => {
|
|
460551
460802
|
init_wrapper();
|
|
460803
|
+
init_identity_attrs();
|
|
460552
460804
|
init_dist10();
|
|
460553
460805
|
init_index_cache();
|
|
460554
460806
|
init_table_target_resolver();
|
|
@@ -460601,17 +460853,7 @@ var init_tables_adapter = __esm(() => {
|
|
|
460601
460853
|
headerRowFill: null
|
|
460602
460854
|
}
|
|
460603
460855
|
};
|
|
460604
|
-
IDENTITY_BLOCK_ATTRS2 =
|
|
460605
|
-
"sdBlockId",
|
|
460606
|
-
"sdBlockRev",
|
|
460607
|
-
"paraId",
|
|
460608
|
-
"textId",
|
|
460609
|
-
"rsidR",
|
|
460610
|
-
"rsidRDefault",
|
|
460611
|
-
"rsidP",
|
|
460612
|
-
"rsidRPr",
|
|
460613
|
-
"rsidDel"
|
|
460614
|
-
]);
|
|
460856
|
+
IDENTITY_BLOCK_ATTRS2 = NON_SEMANTIC_BLOCK_ATTRS2;
|
|
460615
460857
|
WORD_DEFAULT_TBL_LOOK2 = {
|
|
460616
460858
|
firstRow: true,
|
|
460617
460859
|
lastRow: false,
|
|
@@ -463614,6 +463856,74 @@ function recordDeletedValue2(value, path3, diff, ignoreKeys) {
|
|
|
463614
463856
|
function joinPath2(base6, key2) {
|
|
463615
463857
|
return base6 ? `${base6}.${key2}` : key2;
|
|
463616
463858
|
}
|
|
463859
|
+
function applyAttrsDiff2(baseAttrs, attrsDiff) {
|
|
463860
|
+
const result = cloneAttrs2(baseAttrs ?? {});
|
|
463861
|
+
if (!attrsDiff) {
|
|
463862
|
+
return result;
|
|
463863
|
+
}
|
|
463864
|
+
for (const [path3, value] of Object.entries(attrsDiff.added ?? {})) {
|
|
463865
|
+
setAtPath2(result, path3, value);
|
|
463866
|
+
}
|
|
463867
|
+
for (const [path3, change] of Object.entries(attrsDiff.modified ?? {})) {
|
|
463868
|
+
setAtPath2(result, path3, change.to);
|
|
463869
|
+
}
|
|
463870
|
+
for (const path3 of Object.keys(attrsDiff.deleted ?? {})) {
|
|
463871
|
+
deleteAtPath2(result, path3);
|
|
463872
|
+
}
|
|
463873
|
+
return result;
|
|
463874
|
+
}
|
|
463875
|
+
function cloneAttrs2(value) {
|
|
463876
|
+
if (!isPlainObject9(value)) {
|
|
463877
|
+
return {};
|
|
463878
|
+
}
|
|
463879
|
+
const clone2 = {};
|
|
463880
|
+
for (const [key2, child] of Object.entries(value)) {
|
|
463881
|
+
clone2[key2] = cloneDeep2(child);
|
|
463882
|
+
}
|
|
463883
|
+
return clone2;
|
|
463884
|
+
}
|
|
463885
|
+
function cloneDeep2(value) {
|
|
463886
|
+
if (Array.isArray(value)) {
|
|
463887
|
+
return value.map(cloneDeep2);
|
|
463888
|
+
}
|
|
463889
|
+
if (isPlainObject9(value)) {
|
|
463890
|
+
const clone2 = {};
|
|
463891
|
+
for (const [key2, child] of Object.entries(value)) {
|
|
463892
|
+
clone2[key2] = cloneDeep2(child);
|
|
463893
|
+
}
|
|
463894
|
+
return clone2;
|
|
463895
|
+
}
|
|
463896
|
+
return value;
|
|
463897
|
+
}
|
|
463898
|
+
function splitPath2(path3) {
|
|
463899
|
+
return path3.split(".");
|
|
463900
|
+
}
|
|
463901
|
+
function setAtPath2(target, path3, value) {
|
|
463902
|
+
const segments = splitPath2(path3);
|
|
463903
|
+
let cursor = target;
|
|
463904
|
+
for (let i5 = 0;i5 < segments.length - 1; i5++) {
|
|
463905
|
+
const key2 = segments[i5];
|
|
463906
|
+
const next2 = cursor[key2];
|
|
463907
|
+
if (!isPlainObject9(next2)) {
|
|
463908
|
+
cursor[key2] = {};
|
|
463909
|
+
}
|
|
463910
|
+
cursor = cursor[key2];
|
|
463911
|
+
}
|
|
463912
|
+
cursor[segments[segments.length - 1]] = cloneDeep2(value);
|
|
463913
|
+
}
|
|
463914
|
+
function deleteAtPath2(target, path3) {
|
|
463915
|
+
const segments = splitPath2(path3);
|
|
463916
|
+
let cursor = target;
|
|
463917
|
+
for (let i5 = 0;i5 < segments.length - 1; i5++) {
|
|
463918
|
+
const key2 = segments[i5];
|
|
463919
|
+
const next2 = cursor[key2];
|
|
463920
|
+
if (!isPlainObject9(next2)) {
|
|
463921
|
+
return;
|
|
463922
|
+
}
|
|
463923
|
+
cursor = next2;
|
|
463924
|
+
}
|
|
463925
|
+
delete cursor[segments[segments.length - 1]];
|
|
463926
|
+
}
|
|
463617
463927
|
function isPlainObject9(value) {
|
|
463618
463928
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
463619
463929
|
}
|
|
@@ -463665,7 +463975,10 @@ function omitKeys2(attrs, keysToOmit) {
|
|
|
463665
463975
|
return result;
|
|
463666
463976
|
}
|
|
463667
463977
|
function normalizeParagraphAttrs2(attrs) {
|
|
463668
|
-
return omitKeys2(attrs,
|
|
463978
|
+
return omitKeys2(attrs, NON_SEMANTIC_BLOCK_ATTRS2);
|
|
463979
|
+
}
|
|
463980
|
+
function normalizeBlockAttrs2(attrs) {
|
|
463981
|
+
return omitKeys2(attrs, NON_SEMANTIC_BLOCK_ATTRS2);
|
|
463669
463982
|
}
|
|
463670
463983
|
function normalizeImageNodeJSON2(nodeJSON) {
|
|
463671
463984
|
const attrs = nodeJSON.attrs;
|
|
@@ -463738,19 +464051,70 @@ function normalizeDocNodeJSON2(nodeJSON) {
|
|
|
463738
464051
|
if (type === "paragraph") {
|
|
463739
464052
|
return normalizeParagraphNodeJSON2(nodeJSON);
|
|
463740
464053
|
}
|
|
464054
|
+
const attrs = nodeJSON.attrs;
|
|
463741
464055
|
const content5 = nodeJSON.content;
|
|
464056
|
+
const normalizedAttrs = attrs ? normalizeBlockAttrs2(attrs) : undefined;
|
|
463742
464057
|
if (content5) {
|
|
463743
464058
|
return {
|
|
463744
464059
|
...nodeJSON,
|
|
464060
|
+
...normalizedAttrs ? { attrs: normalizedAttrs } : {},
|
|
463745
464061
|
content: content5.map(normalizeDocNodeJSON2)
|
|
463746
464062
|
};
|
|
463747
464063
|
}
|
|
464064
|
+
if (normalizedAttrs) {
|
|
464065
|
+
return { ...nodeJSON, attrs: normalizedAttrs };
|
|
464066
|
+
}
|
|
463748
464067
|
return nodeJSON;
|
|
463749
464068
|
}
|
|
463750
|
-
|
|
464069
|
+
function normalizeParagraphAttrsLegacy2(attrs) {
|
|
464070
|
+
return omitKeys2(attrs, LEGACY_VOLATILE_PARAGRAPH_ATTRS2);
|
|
464071
|
+
}
|
|
464072
|
+
function normalizeParagraphNodeJSONLegacy2(nodeJSON) {
|
|
464073
|
+
const attrs = nodeJSON.attrs ?? {};
|
|
464074
|
+
const content5 = nodeJSON.content;
|
|
464075
|
+
return {
|
|
464076
|
+
...nodeJSON,
|
|
464077
|
+
attrs: normalizeParagraphAttrsLegacy2(attrs),
|
|
464078
|
+
...content5 ? { content: content5.map(normalizeContentNodeJSON2) } : {}
|
|
464079
|
+
};
|
|
464080
|
+
}
|
|
464081
|
+
function normalizeDocNodeJSONLegacy2(nodeJSON) {
|
|
464082
|
+
const type = nodeJSON.type;
|
|
464083
|
+
if (type === "paragraph") {
|
|
464084
|
+
return normalizeParagraphNodeJSONLegacy2(nodeJSON);
|
|
464085
|
+
}
|
|
464086
|
+
const content5 = nodeJSON.content;
|
|
464087
|
+
if (content5) {
|
|
464088
|
+
return {
|
|
464089
|
+
...nodeJSON,
|
|
464090
|
+
content: content5.map(normalizeDocNodeJSONLegacy2)
|
|
464091
|
+
};
|
|
464092
|
+
}
|
|
464093
|
+
return nodeJSON;
|
|
464094
|
+
}
|
|
464095
|
+
function normalizeDocJSONLegacy2(docJSON) {
|
|
464096
|
+
const content5 = docJSON.content;
|
|
464097
|
+
if (!content5) {
|
|
464098
|
+
return docJSON;
|
|
464099
|
+
}
|
|
464100
|
+
return {
|
|
464101
|
+
...docJSON,
|
|
464102
|
+
content: content5.map(normalizeDocNodeJSONLegacy2)
|
|
464103
|
+
};
|
|
464104
|
+
}
|
|
464105
|
+
var VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS2, LEGACY_VOLATILE_PARAGRAPH_ATTRS2;
|
|
463751
464106
|
var init_semantic_normalization = __esm(() => {
|
|
463752
|
-
|
|
464107
|
+
init_identity_attrs();
|
|
463753
464108
|
VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS2 = new Set(["wp14:anchorId", "wp14:editId"]);
|
|
464109
|
+
LEGACY_VOLATILE_PARAGRAPH_ATTRS2 = new Set([
|
|
464110
|
+
"paraId",
|
|
464111
|
+
"textId",
|
|
464112
|
+
"rsidR",
|
|
464113
|
+
"rsidRDefault",
|
|
464114
|
+
"rsidP",
|
|
464115
|
+
"rsidRPr",
|
|
464116
|
+
"rsidDel"
|
|
464117
|
+
]);
|
|
463754
464118
|
});
|
|
463755
464119
|
|
|
463756
464120
|
// ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/sequence-diffing.ts
|
|
@@ -464397,7 +464761,7 @@ function buildModifiedDiff2(oldNodeInfo, newNodeInfo) {
|
|
|
464397
464761
|
if (isParagraphNodeInfo2(oldNodeInfo) && isParagraphNodeInfo2(newNodeInfo)) {
|
|
464398
464762
|
return buildModifiedParagraphDiff2(oldNodeInfo, newNodeInfo);
|
|
464399
464763
|
}
|
|
464400
|
-
const attrsDiff = getAttributesDiff2(oldNodeInfo.node.attrs, newNodeInfo.node.attrs);
|
|
464764
|
+
const attrsDiff = getAttributesDiff2(oldNodeInfo.node.attrs, newNodeInfo.node.attrs, NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2);
|
|
464401
464765
|
if (!attrsDiff) {
|
|
464402
464766
|
return null;
|
|
464403
464767
|
}
|
|
@@ -464413,10 +464777,13 @@ function buildModifiedDiff2(oldNodeInfo, newNodeInfo) {
|
|
|
464413
464777
|
function isParagraphNodeInfo2(nodeInfo) {
|
|
464414
464778
|
return nodeInfo.node.type.name === "paragraph";
|
|
464415
464779
|
}
|
|
464780
|
+
var NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2;
|
|
464416
464781
|
var init_generic_diffing = __esm(() => {
|
|
464417
464782
|
init_paragraph_diffing();
|
|
464418
464783
|
init_sequence_diffing();
|
|
464419
464784
|
init_attributes_diffing();
|
|
464785
|
+
init_identity_attrs();
|
|
464786
|
+
NON_PARAGRAPH_BLOCK_IGNORED_ATTRS2 = Array.from(NON_SEMANTIC_BLOCK_ATTRS2);
|
|
464420
464787
|
});
|
|
464421
464788
|
|
|
464422
464789
|
// ../../packages/super-editor/src/editors/v1/extensions/diffing/algorithm/header-footer-diffing.ts
|
|
@@ -464912,12 +465279,9 @@ function replayNonParagraphDiff2({
|
|
|
464912
465279
|
skipWithWarning(`Node type mismatch at pos ${pos} for modification.`);
|
|
464913
465280
|
return result;
|
|
464914
465281
|
}
|
|
464915
|
-
if (!diff.newNodeJSON?.attrs) {
|
|
464916
|
-
skipWithWarning(`Missing newNodeJSON.attrs at pos ${pos} for modification.`);
|
|
464917
|
-
return result;
|
|
464918
|
-
}
|
|
464919
465282
|
try {
|
|
464920
|
-
|
|
465283
|
+
const mergedAttrs = applyAttrsDiff2(node4.attrs, diff.attrsDiff);
|
|
465284
|
+
tr.setNodeMarkup(pos, undefined, mergedAttrs, node4.marks);
|
|
464921
465285
|
result.applied += 1;
|
|
464922
465286
|
return result;
|
|
464923
465287
|
} catch (error48) {
|
|
@@ -464931,10 +465295,11 @@ function replayNonParagraphDiff2({
|
|
|
464931
465295
|
var init_replay_non_paragraph = __esm(() => {
|
|
464932
465296
|
init_dist2();
|
|
464933
465297
|
init_dist4();
|
|
465298
|
+
init_attributes_diffing();
|
|
464934
465299
|
});
|
|
464935
465300
|
|
|
464936
465301
|
// ../../packages/super-editor/src/editors/v1/extensions/diffing/replay/replay-attrs.ts
|
|
464937
|
-
function
|
|
465302
|
+
function applyAttrsDiff3({
|
|
464938
465303
|
attrs,
|
|
464939
465304
|
diff
|
|
464940
465305
|
}) {
|
|
@@ -465281,7 +465646,7 @@ var applyRunAttrsDiffInRange2 = (tr, from4, to, diff) => {
|
|
|
465281
465646
|
}
|
|
465282
465647
|
const failures = [];
|
|
465283
465648
|
runEntries.forEach(({ pos, node: node4 }) => {
|
|
465284
|
-
const updatedAttrs =
|
|
465649
|
+
const updatedAttrs = applyAttrsDiff3({ attrs: node4.attrs, diff });
|
|
465285
465650
|
if (deepEquals2(updatedAttrs, node4.attrs)) {
|
|
465286
465651
|
return;
|
|
465287
465652
|
}
|
|
@@ -465407,12 +465772,9 @@ function replayParagraphDiff2({
|
|
|
465407
465772
|
return result;
|
|
465408
465773
|
}
|
|
465409
465774
|
if (diff.attrsDiff) {
|
|
465410
|
-
if (!diff.newNodeJSON?.attrs) {
|
|
465411
|
-
skipWithWarning(`Missing newNodeJSON attrs at pos ${pos} for paragraph modification.`);
|
|
465412
|
-
return result;
|
|
465413
|
-
}
|
|
465414
465775
|
try {
|
|
465415
|
-
|
|
465776
|
+
const mergedAttrs = applyAttrsDiff2(node4.attrs, diff.attrsDiff);
|
|
465777
|
+
tr.setNodeMarkup(pos, undefined, mergedAttrs, node4.marks);
|
|
465416
465778
|
result.applied += 1;
|
|
465417
465779
|
} catch (error48) {
|
|
465418
465780
|
skipWithWarning(`Failed to update paragraph attrs at pos ${pos}.`);
|
|
@@ -465447,6 +465809,7 @@ function replayParagraphDiff2({
|
|
|
465447
465809
|
var init_replay_paragraph = __esm(() => {
|
|
465448
465810
|
init_dist2();
|
|
465449
465811
|
init_dist4();
|
|
465812
|
+
init_attributes_diffing();
|
|
465450
465813
|
init_replay_inline();
|
|
465451
465814
|
});
|
|
465452
465815
|
|
|
@@ -466582,6 +466945,16 @@ function buildCanonicalDiffableState2(doc6, comments, styles, numbering, headerF
|
|
|
466582
466945
|
partsState: partsState ? structuredClone(partsState) : null
|
|
466583
466946
|
};
|
|
466584
466947
|
}
|
|
466948
|
+
function buildLegacyCanonicalDiffableState2(doc6, comments, styles, numbering, headerFooters, partsState) {
|
|
466949
|
+
return {
|
|
466950
|
+
body: normalizeDocJSONLegacy2(doc6.toJSON()),
|
|
466951
|
+
comments: comments.map(canonicalizeComment2),
|
|
466952
|
+
styles: styles ? styles : null,
|
|
466953
|
+
numbering: numbering ? numbering : null,
|
|
466954
|
+
headerFooters: headerFooters ? structuredClone(headerFooters) : null,
|
|
466955
|
+
partsState: partsState ? structuredClone(partsState) : null
|
|
466956
|
+
};
|
|
466957
|
+
}
|
|
466585
466958
|
function sortKeysDeep2(value) {
|
|
466586
466959
|
if (value === null || value === undefined)
|
|
466587
466960
|
return value;
|
|
@@ -466808,6 +467181,9 @@ function getEditorPartsState2(editor, headerFooters) {
|
|
|
466808
467181
|
function buildCanonicalStateForCoverage2(doc6, comments, styles, numbering, headerFooters, partsState, coverage) {
|
|
466809
467182
|
return buildCanonicalDiffableState2(doc6, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
|
|
466810
467183
|
}
|
|
467184
|
+
function buildLegacyCanonicalStateForCoverage2(doc6, comments, styles, numbering, headerFooters, partsState, coverage) {
|
|
467185
|
+
return buildLegacyCanonicalDiffableState2(doc6, comments, styles, numbering, coverage.headerFooters ? headerFooters : null, coverage.headerFooters ? partsState : null);
|
|
467186
|
+
}
|
|
466811
467187
|
function captureSnapshot2(editor) {
|
|
466812
467188
|
const doc6 = editor.state.doc;
|
|
466813
467189
|
const comments = getEditorComments2(editor);
|
|
@@ -466856,7 +467232,11 @@ function compareToSnapshot2(editor, targetSnapshot) {
|
|
|
466856
467232
|
throw new DiffServiceError2("INVALID_INPUT", `Snapshot payload contains malformed data that failed during canonicalization: ${err instanceof Error ? err.message : String(err)}`);
|
|
466857
467233
|
}
|
|
466858
467234
|
if (reDerivedFingerprint !== targetSnapshot.fingerprint) {
|
|
466859
|
-
|
|
467235
|
+
const legacyCanonical = buildLegacyCanonicalStateForCoverage2(targetDoc, targetComments, targetStyles, targetNumbering, targetHeaderFooters, targetSnapshot.version === SNAPSHOT_VERSION_V22 ? targetPartsState : null, targetCoverage);
|
|
467236
|
+
const legacyFingerprint = computeFingerprint2(legacyCanonical);
|
|
467237
|
+
if (legacyFingerprint !== targetSnapshot.fingerprint) {
|
|
467238
|
+
throw new DiffServiceError2("INVALID_INPUT", `Target snapshot fingerprint does not match re-derived value. The snapshot may have been tampered with.`);
|
|
467239
|
+
}
|
|
466860
467240
|
}
|
|
466861
467241
|
const baseDoc = editor.state.doc;
|
|
466862
467242
|
const baseComments = getEditorComments2(editor);
|
|
@@ -466907,7 +467287,11 @@ function applyDiffPayload2(editor, diffPayload, options) {
|
|
|
466907
467287
|
const baseCanonical = buildCanonicalStateForCoverage2(baseDoc, baseComments, baseStyles, baseNumbering3, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V22 ? basePartsState : null, diffPayload.coverage);
|
|
466908
467288
|
const currentFingerprint = computeFingerprint2(baseCanonical);
|
|
466909
467289
|
if (currentFingerprint !== diffPayload.baseFingerprint) {
|
|
466910
|
-
|
|
467290
|
+
const legacyBaseCanonical = buildLegacyCanonicalStateForCoverage2(baseDoc, baseComments, baseStyles, baseNumbering3, baseHeaderFooters, diffPayload.version === PAYLOAD_VERSION_V22 ? basePartsState : null, diffPayload.coverage);
|
|
467291
|
+
const legacyFingerprint = computeFingerprint2(legacyBaseCanonical);
|
|
467292
|
+
if (legacyFingerprint !== diffPayload.baseFingerprint) {
|
|
467293
|
+
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.`);
|
|
467294
|
+
}
|
|
466911
467295
|
}
|
|
466912
467296
|
const rawDiff = parseDiffPayloadContents2(diffPayload.payload);
|
|
466913
467297
|
const comments = editor.converter ? Array.isArray(editor.converter.comments) ? editor.converter.comments : [] : [];
|