@superdoc/mcp 1.6.0-next.14 → 1.6.0-next.15
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 +359 -129
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31600,7 +31600,7 @@ var init_host = __esm(() => {
|
|
|
31600
31600
|
});
|
|
31601
31601
|
|
|
31602
31602
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31603
|
-
var SDK_VERSION = "2.19.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.19.0-next.15";
|
|
31604
31604
|
|
|
31605
31605
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31606
31606
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -252114,6 +252114,193 @@ var init_large_streaming_save = __esm(() => {
|
|
|
252114
252114
|
STREAM_PUSH_CHUNK = 64 * 1024;
|
|
252115
252115
|
});
|
|
252116
252116
|
|
|
252117
|
+
// ../../../v2/editor-core/dist/export/docx-package-sanitizer.js
|
|
252118
|
+
function partKey(uri) {
|
|
252119
|
+
const normalized = normalizePartUri(uri);
|
|
252120
|
+
try {
|
|
252121
|
+
return decodeURIComponent(normalized).normalize("NFC").toLowerCase();
|
|
252122
|
+
} catch {
|
|
252123
|
+
return normalized.normalize("NFC").toLowerCase();
|
|
252124
|
+
}
|
|
252125
|
+
}
|
|
252126
|
+
function relationshipOwnerUri(relsUri) {
|
|
252127
|
+
if (partKey(relsUri) === "/_rels/.rels")
|
|
252128
|
+
return "/";
|
|
252129
|
+
const match = /^(.*)\/_rels\/([^/]+)\.rels$/i.exec(relsUri);
|
|
252130
|
+
return match ? `${match[1]}/${match[2]}` : null;
|
|
252131
|
+
}
|
|
252132
|
+
function targetPartUris(ownerUri, target) {
|
|
252133
|
+
const path6 = target.split(/[?#]/, 1)[0] ?? "";
|
|
252134
|
+
if (!path6)
|
|
252135
|
+
return [];
|
|
252136
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(path6) || path6.startsWith("//"))
|
|
252137
|
+
return [];
|
|
252138
|
+
const normalized = path6.replace(/\\/g, "/");
|
|
252139
|
+
const resolved = resolveTargetUri(ownerUri, normalized, "Internal");
|
|
252140
|
+
try {
|
|
252141
|
+
return [resolved, resolveTargetUri(ownerUri, decodeURIComponent(normalized), "Internal")];
|
|
252142
|
+
} catch {
|
|
252143
|
+
return [resolved];
|
|
252144
|
+
}
|
|
252145
|
+
}
|
|
252146
|
+
function ownerReferencesRelationship(ownerBytes, id) {
|
|
252147
|
+
if (!ownerBytes)
|
|
252148
|
+
return false;
|
|
252149
|
+
const xml = TEXT_DECODER6.decode(ownerBytes);
|
|
252150
|
+
const collected = collectXmlElementRanges(xml);
|
|
252151
|
+
if (collected.errors.length) {
|
|
252152
|
+
return xml.includes(`="${id}"`) || xml.includes(`='${id}'`);
|
|
252153
|
+
}
|
|
252154
|
+
return collected.ranges.some((range) => range.tag.attributes.some((attribute) => attribute.namespaceUri === OFFICE_RELATIONSHIPS_NS && attribute.value === id));
|
|
252155
|
+
}
|
|
252156
|
+
function sanitizeRelationships(relsUri, bytes, finalPartKeys, ownerBytes) {
|
|
252157
|
+
const ownerUri = relationshipOwnerUri(relsUri);
|
|
252158
|
+
if (!ownerUri)
|
|
252159
|
+
return bytes;
|
|
252160
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252161
|
+
const collected = collectXmlElementRanges(xml);
|
|
252162
|
+
if (collected.errors.length)
|
|
252163
|
+
return bytes;
|
|
252164
|
+
const removals = collected.ranges.filter((range) => {
|
|
252165
|
+
if (range.tag.namespaceUri !== RELATIONSHIPS_NS2 || range.tag.localName !== "Relationship")
|
|
252166
|
+
return false;
|
|
252167
|
+
if (readXmlAttribute(range.tag, "", "Type")?.value !== STYLES_WITH_EFFECTS_RELATIONSHIP_NS)
|
|
252168
|
+
return false;
|
|
252169
|
+
if (readXmlAttribute(range.tag, "", "TargetMode")?.value === "External")
|
|
252170
|
+
return false;
|
|
252171
|
+
const target = readXmlAttribute(range.tag, "", "Target")?.value;
|
|
252172
|
+
if (!target)
|
|
252173
|
+
return false;
|
|
252174
|
+
const resolved = targetPartUris(ownerUri, target);
|
|
252175
|
+
if (!resolved.length || resolved.some((uri) => finalPartKeys.has(partKey(uri))))
|
|
252176
|
+
return false;
|
|
252177
|
+
const id = readXmlAttribute(range.tag, "", "Id")?.value;
|
|
252178
|
+
return !id || !ownerReferencesRelationship(ownerBytes, id);
|
|
252179
|
+
});
|
|
252180
|
+
if (!removals.length)
|
|
252181
|
+
return bytes;
|
|
252182
|
+
let sanitized = xml;
|
|
252183
|
+
for (const range of removals.reverse()) {
|
|
252184
|
+
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
252185
|
+
}
|
|
252186
|
+
return TEXT_ENCODER.encode(sanitized);
|
|
252187
|
+
}
|
|
252188
|
+
function insertRootAttribute(tag, attribute) {
|
|
252189
|
+
return tag.replace(/\/?>(?=$)/, (ending) => ` ${attribute}${ending}`);
|
|
252190
|
+
}
|
|
252191
|
+
function sanitizeWordNamespaces(bytes) {
|
|
252192
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252193
|
+
const used = new Set;
|
|
252194
|
+
for (const match of xml.matchAll(/(?:<\/?|\s)(w14|w15|w16):[\w.-]+(?=[\s=/>])/g)) {
|
|
252195
|
+
used.add(match[1]);
|
|
252196
|
+
}
|
|
252197
|
+
if (!used.size)
|
|
252198
|
+
return bytes;
|
|
252199
|
+
const root = /<(?![!?/])(?:[A-Za-z_][\w.-]*:)?[A-Za-z_][\w.-]*(?:"[^"]*"|'[^']*'|[^>"'])*>/g.exec(xml);
|
|
252200
|
+
if (!root)
|
|
252201
|
+
return bytes;
|
|
252202
|
+
let tag = root[0];
|
|
252203
|
+
const declarations = new Map;
|
|
252204
|
+
for (const match of tag.matchAll(/\sxmlns:([A-Za-z_][\w.-]*)\s*=\s*(["'])(.*?)\2/g)) {
|
|
252205
|
+
declarations.set(match[1], match[3]);
|
|
252206
|
+
}
|
|
252207
|
+
const missing = [...used].filter((prefix) => !declarations.has(prefix));
|
|
252208
|
+
if (!missing.length || !collectXmlElementRanges(xml).errors.length)
|
|
252209
|
+
return bytes;
|
|
252210
|
+
for (const prefix of missing) {
|
|
252211
|
+
tag = insertRootAttribute(tag, `xmlns:${prefix}="${OFFICE_WORD_NAMESPACES[prefix]}"`);
|
|
252212
|
+
}
|
|
252213
|
+
const ignorableAttribute = [...tag.matchAll(/\s([A-Za-z_][\w.-]*):Ignorable\s*=\s*(["'])(.*?)\2/g)].find((match) => declarations.get(match[1]) === MC_NS2);
|
|
252214
|
+
let mcPrefix = ignorableAttribute?.[1] ?? [...declarations].find(([, uri]) => uri === MC_NS2)?.[0];
|
|
252215
|
+
if (!mcPrefix) {
|
|
252216
|
+
mcPrefix = "mc";
|
|
252217
|
+
for (let suffix = 1;declarations.has(mcPrefix); suffix++)
|
|
252218
|
+
mcPrefix = `mc${suffix}`;
|
|
252219
|
+
tag = insertRootAttribute(tag, `xmlns:${mcPrefix}="${MC_NS2}"`);
|
|
252220
|
+
}
|
|
252221
|
+
const ignorable = new RegExp(`\\s${mcPrefix}:Ignorable\\s*=\\s*(["'])(.*?)\\1`).exec(tag);
|
|
252222
|
+
if (ignorable) {
|
|
252223
|
+
const prefixes = ignorable[2].trim().split(/\s+/).filter(Boolean);
|
|
252224
|
+
const next = [...new Set([...prefixes, ...missing])];
|
|
252225
|
+
if (next.length !== prefixes.length) {
|
|
252226
|
+
tag = tag.replace(ignorable[0], ` ${mcPrefix}:Ignorable="${next.join(" ")}"`);
|
|
252227
|
+
}
|
|
252228
|
+
} else {
|
|
252229
|
+
tag = insertRootAttribute(tag, `${mcPrefix}:Ignorable="${missing.join(" ")}"`);
|
|
252230
|
+
}
|
|
252231
|
+
return TEXT_ENCODER.encode(xml.slice(0, root.index) + tag + xml.slice(root.index + root[0].length));
|
|
252232
|
+
}
|
|
252233
|
+
function removeOrphanContentTypeOverrides(bytes, removedRels) {
|
|
252234
|
+
if (!removedRels.size)
|
|
252235
|
+
return bytes;
|
|
252236
|
+
const xml = TEXT_DECODER6.decode(bytes);
|
|
252237
|
+
const collected = collectXmlElementRanges(xml);
|
|
252238
|
+
if (collected.errors.length)
|
|
252239
|
+
return bytes;
|
|
252240
|
+
const removals = collected.ranges.filter((range) => range.tag.namespaceUri === CONTENT_TYPES_NS5 && range.tag.localName === "Override" && removedRels.has(partKey(readXmlAttribute(range.tag, "", "PartName")?.value ?? "")));
|
|
252241
|
+
if (!removals.length)
|
|
252242
|
+
return bytes;
|
|
252243
|
+
let sanitized = xml;
|
|
252244
|
+
for (const range of removals.reverse()) {
|
|
252245
|
+
sanitized = sanitized.slice(0, range.start) + sanitized.slice(range.end);
|
|
252246
|
+
}
|
|
252247
|
+
return TEXT_ENCODER.encode(sanitized);
|
|
252248
|
+
}
|
|
252249
|
+
function sanitizeDocxPackageEntries(entries, options = {}) {
|
|
252250
|
+
const allKeys = new Set([...entries.keys()].map(partKey));
|
|
252251
|
+
const bytesByKey = new Map([...entries].map(([uri, bytes]) => [partKey(uri), bytes]));
|
|
252252
|
+
const typesBytes = bytesByKey.get("/[content_types].xml");
|
|
252253
|
+
const contentTypes = typesBytes ? parseContentTypes(TEXT_DECODER6.decode(typesBytes)) : null;
|
|
252254
|
+
const removedRels = new Set;
|
|
252255
|
+
const changes = new Map;
|
|
252256
|
+
for (const uri of entries.keys()) {
|
|
252257
|
+
if (!uri.toLowerCase().endsWith(".rels"))
|
|
252258
|
+
continue;
|
|
252259
|
+
const owner = relationshipOwnerUri(uri);
|
|
252260
|
+
if (owner && owner !== "/" && !allKeys.has(partKey(owner)) && (options.removeOrphan?.(uri, owner) ?? true)) {
|
|
252261
|
+
removedRels.add(partKey(uri));
|
|
252262
|
+
changes.set(uri, null);
|
|
252263
|
+
}
|
|
252264
|
+
}
|
|
252265
|
+
const finalKeys = new Set([...allKeys].filter((key2) => !removedRels.has(key2)));
|
|
252266
|
+
for (const [uri, bytes] of entries) {
|
|
252267
|
+
if (!bytes || changes.has(uri))
|
|
252268
|
+
continue;
|
|
252269
|
+
const owner = relationshipOwnerUri(uri);
|
|
252270
|
+
const ownerBytes = owner ? bytesByKey.get(partKey(owner)) : undefined;
|
|
252271
|
+
if (owner && owner !== "/" && !ownerBytes)
|
|
252272
|
+
continue;
|
|
252273
|
+
const contentType = contentTypes && !contentTypes.parseError ? resolveContentType(contentTypes, uri) : null;
|
|
252274
|
+
const isWordXml = /^\/word\/.+\.xml$/i.test(uri) || uri.toLowerCase().endsWith(".xml") && contentType?.includes("wordprocessingml.") === true;
|
|
252275
|
+
const sanitized = options.sanitizePart?.(uri) === false ? bytes : sanitizeDocxPartForExport(uri, bytes, finalKeys, ownerBytes, isWordXml);
|
|
252276
|
+
const finalBytes = partKey(uri) === "/[content_types].xml" ? removeOrphanContentTypeOverrides(sanitized, removedRels) : sanitized;
|
|
252277
|
+
if (finalBytes !== bytes)
|
|
252278
|
+
changes.set(uri, finalBytes);
|
|
252279
|
+
}
|
|
252280
|
+
return changes;
|
|
252281
|
+
}
|
|
252282
|
+
function sanitizeDocxPartForExport(partUri, bytes, finalPartUris, ownerBytes, isWordXml = /^\/word\/.+\.xml$/i.test(partUri)) {
|
|
252283
|
+
if (partUri.toLowerCase().endsWith(".rels")) {
|
|
252284
|
+
return sanitizeRelationships(partUri, bytes, new Set([...finalPartUris].map(partKey)), ownerBytes);
|
|
252285
|
+
}
|
|
252286
|
+
if (isWordXml) {
|
|
252287
|
+
return sanitizeWordNamespaces(bytes);
|
|
252288
|
+
}
|
|
252289
|
+
return bytes;
|
|
252290
|
+
}
|
|
252291
|
+
var TEXT_DECODER6, TEXT_ENCODER, RELATIONSHIPS_NS2 = "http://schemas.openxmlformats.org/package/2006/relationships", OFFICE_RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", STYLES_WITH_EFFECTS_RELATIONSHIP_NS = "http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects", CONTENT_TYPES_NS5 = "http://schemas.openxmlformats.org/package/2006/content-types", MC_NS2 = "http://schemas.openxmlformats.org/markup-compatibility/2006", OFFICE_WORD_NAMESPACES;
|
|
252292
|
+
var init_docx_package_sanitizer = __esm(() => {
|
|
252293
|
+
init_xml_sax();
|
|
252294
|
+
init_content_types();
|
|
252295
|
+
TEXT_DECODER6 = new TextDecoder;
|
|
252296
|
+
TEXT_ENCODER = new TextEncoder;
|
|
252297
|
+
OFFICE_WORD_NAMESPACES = {
|
|
252298
|
+
w14: "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
252299
|
+
w15: "http://schemas.microsoft.com/office/word/2012/wordml",
|
|
252300
|
+
w16: "http://schemas.microsoft.com/office/word/2018/wordml"
|
|
252301
|
+
};
|
|
252302
|
+
});
|
|
252303
|
+
|
|
252117
252304
|
// ../../../v2/editor-core/dist/document/transactions/comment-export-normalization.js
|
|
252118
252305
|
function normalizeCommentPackageForSave(state) {
|
|
252119
252306
|
const overrides = new Map;
|
|
@@ -254063,6 +254250,15 @@ function serializeSDDocumentSessionInternalPackageWithDiagnostics(session, optio
|
|
|
254063
254250
|
continue;
|
|
254064
254251
|
finalizeEntry(partUri, bytes);
|
|
254065
254252
|
}
|
|
254253
|
+
if (!exactPackageSave) {
|
|
254254
|
+
const changes = sanitizeDocxPackageEntries(new Map(Object.entries(entries).map(([entryPath, bytes]) => [`/${entryPath}`, bytes])));
|
|
254255
|
+
for (const [partUri, bytes] of changes) {
|
|
254256
|
+
if (bytes === null)
|
|
254257
|
+
delete entries[partUri.slice(1)];
|
|
254258
|
+
else
|
|
254259
|
+
entries[partUri.slice(1)] = bytes;
|
|
254260
|
+
}
|
|
254261
|
+
}
|
|
254066
254262
|
const compressionLevel = options.compressionLevel ?? DEFAULT_SAVE_COMPRESSION_LEVEL;
|
|
254067
254263
|
const zippable = {};
|
|
254068
254264
|
for (const [entryPath, bytes] of Object.entries(entries)) {
|
|
@@ -254226,6 +254422,7 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254226
254422
|
};
|
|
254227
254423
|
const entries = [];
|
|
254228
254424
|
const emitted = new Set;
|
|
254425
|
+
const changedPartUris = new Set;
|
|
254229
254426
|
const pushBytes = (partUri, bytes, originalMethod, normalizeChangedBytes = true) => {
|
|
254230
254427
|
const entryName = partUri.startsWith("/") ? partUri.slice(1) : partUri;
|
|
254231
254428
|
entries.push({
|
|
@@ -254237,6 +254434,8 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254237
254434
|
compression: compressionFor(entryName, originalMethod)
|
|
254238
254435
|
});
|
|
254239
254436
|
emitted.add(partUri);
|
|
254437
|
+
if (normalizeChangedBytes)
|
|
254438
|
+
changedPartUris.add(partUri);
|
|
254240
254439
|
};
|
|
254241
254440
|
const pushStream = (partUri, entryName, chunks, originalMethod) => {
|
|
254242
254441
|
entries.push({
|
|
@@ -254311,6 +254510,26 @@ function planSourceBackedStreamingSave(internal, mainPartUri, options) {
|
|
|
254311
254510
|
continue;
|
|
254312
254511
|
pushBytes(partUri, bytes);
|
|
254313
254512
|
}
|
|
254513
|
+
const inspectable = new Map(entries.map((entry) => {
|
|
254514
|
+
const partUri = `/${entry.name}`;
|
|
254515
|
+
const contentType = state.parts.get(partUri)?.descriptor.contentType ?? "";
|
|
254516
|
+
const needsInspection = entry.name.endsWith(".rels") || entry.name === "[Content_Types].xml" || /^word\/.+\.xml$/i.test(entry.name) || contentType.includes("wordprocessingml.");
|
|
254517
|
+
const bytes = entry.source.kind === "bytes" ? entry.source.bytes : needsInspection && (partUri !== mainPartUri || hasResidentMain) ? state.packageBytes.get(partUri) ?? (partUri !== mainPartUri ? inventory.readPayload?.(entry.name) : undefined) : undefined;
|
|
254518
|
+
return [partUri, bytes];
|
|
254519
|
+
}));
|
|
254520
|
+
const sourcePartUris = new Set(inventory.entries.filter((entry) => !entry.isDirectory).map((entry) => partUriForEntry(entry.name)));
|
|
254521
|
+
const changes = sanitizeDocxPackageEntries(inspectable, {
|
|
254522
|
+
sanitizePart: (partUri) => changedPartUris.has(partUri),
|
|
254523
|
+
removeOrphan: (relsUri, ownerUri) => changedPartUris.has(relsUri) || sourcePartUris.has(ownerUri)
|
|
254524
|
+
});
|
|
254525
|
+
for (let index = entries.length - 1;index >= 0; index--) {
|
|
254526
|
+
const entry = entries[index];
|
|
254527
|
+
const change = changes.get(`/${entry.name}`);
|
|
254528
|
+
if (change === null)
|
|
254529
|
+
entries.splice(index, 1);
|
|
254530
|
+
else if (change)
|
|
254531
|
+
entry.source = { kind: "bytes", bytes: change };
|
|
254532
|
+
}
|
|
254314
254533
|
return {
|
|
254315
254534
|
entries,
|
|
254316
254535
|
warnings: [...commentWarnings, ...trackedChangesProjection.warnings],
|
|
@@ -257901,6 +258120,7 @@ var init_sd_document_session = __esm(() => {
|
|
|
257901
258120
|
init_source_coverage_chunks();
|
|
257902
258121
|
init_section_source_cache();
|
|
257903
258122
|
init_large_streaming_save();
|
|
258123
|
+
init_docx_package_sanitizer();
|
|
257904
258124
|
init_relationships();
|
|
257905
258125
|
init_esm2();
|
|
257906
258126
|
init_source_backed_main_overlay();
|
|
@@ -259209,6 +259429,7 @@ var init_selection_text_replacement_preflight = __esm(() => {
|
|
|
259209
259429
|
// ../../../v2/editor-core/dist/document/sd-document-session-internal.js
|
|
259210
259430
|
var init_sd_document_session_internal = __esm(() => {
|
|
259211
259431
|
init_core_properties();
|
|
259432
|
+
init_docx_package_sanitizer();
|
|
259212
259433
|
init_scalar_properties();
|
|
259213
259434
|
init_sd_document_session();
|
|
259214
259435
|
init_review_projection_overlay();
|
|
@@ -294666,7 +294887,7 @@ class V2AnchoredMetadataAdapter {
|
|
|
294666
294887
|
throw metadataWrapRejectError(wrapped.reason);
|
|
294667
294888
|
if (wrapped.contained) {
|
|
294668
294889
|
const ids = countBodyControlIds(documentXml);
|
|
294669
|
-
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(
|
|
294890
|
+
if (!ids || wrapped.parentId !== null && ids.get(wrapped.parentId) !== 1 || buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml)).byBlockId(segment.blockId)?.blockSdtPath.length) {
|
|
294670
294891
|
throw metadataWrapRejectError("text-range-in-sdt");
|
|
294671
294892
|
}
|
|
294672
294893
|
}
|
|
@@ -295098,7 +295319,7 @@ function countBodyControlIds(documentXml) {
|
|
|
295098
295319
|
function contiguousAnchorPrefix(documentXml, matches) {
|
|
295099
295320
|
if (matches.length <= 1)
|
|
295100
295321
|
return [...matches];
|
|
295101
|
-
const map3 = buildStructuralBoundaryMap(
|
|
295322
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml));
|
|
295102
295323
|
const first = map3.byBlockId(matches[0].blockId);
|
|
295103
295324
|
if (!first)
|
|
295104
295325
|
return [matches[0]];
|
|
@@ -295187,7 +295408,7 @@ function resolveMultiSegmentTarget(documentXml, target) {
|
|
|
295187
295408
|
function validateContiguousStructuralRun(documentXml, blockIds) {
|
|
295188
295409
|
if (blockIds.length <= 1)
|
|
295189
295410
|
return null;
|
|
295190
|
-
const map3 = buildStructuralBoundaryMap(
|
|
295411
|
+
const map3 = buildStructuralBoundaryMap(TEXT_ENCODER2.encode(documentXml));
|
|
295191
295412
|
const contexts = blockIds.map((blockId) => map3.byBlockId(blockId));
|
|
295192
295413
|
const first = contexts[0];
|
|
295193
295414
|
if (!first) {
|
|
@@ -295437,7 +295658,7 @@ function overlaps(left, right) {
|
|
|
295437
295658
|
return false;
|
|
295438
295659
|
return leftSegments.some((leftSegment) => rightSegments.some((rightSegment) => leftSegment.blockId === rightSegment.blockId && rangesStrictlyOverlap(leftSegment.start, leftSegment.end, rightSegment.start, rightSegment.end)));
|
|
295439
295660
|
}
|
|
295440
|
-
var
|
|
295661
|
+
var TEXT_ENCODER2, WORD_NAMESPACE6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", METADATA_ANCHOR_ALIAS = "Anchored metadata", W15_NS = "http://schemas.microsoft.com/office/word/2012/wordml", MAX_SDT_ID = 2147483646;
|
|
295441
295662
|
var init_adapter3 = __esm(() => {
|
|
295442
295663
|
init_src3();
|
|
295443
295664
|
init_sd_document_session_internal();
|
|
@@ -295447,7 +295668,7 @@ var init_adapter3 = __esm(() => {
|
|
|
295447
295668
|
init_adapter2();
|
|
295448
295669
|
init_shared();
|
|
295449
295670
|
init_xml();
|
|
295450
|
-
|
|
295671
|
+
TEXT_ENCODER2 = new TextEncoder;
|
|
295451
295672
|
});
|
|
295452
295673
|
|
|
295453
295674
|
// ../../../v2/document-api-v2-adapter/dist/core/cooperative-slices.js
|
|
@@ -367526,7 +367747,7 @@ var init_run_signature2 = __esm(() => {
|
|
|
367526
367747
|
// ../../../v2/document-api-v2-adapter/dist/compare/opc-xml.js
|
|
367527
367748
|
function parseOpcRelationshipsXml(xml) {
|
|
367528
367749
|
return parseElementDocument(xml, {
|
|
367529
|
-
namespaceUri:
|
|
367750
|
+
namespaceUri: RELATIONSHIPS_NS3,
|
|
367530
367751
|
rootLocalName: "Relationships",
|
|
367531
367752
|
childLocalName: "Relationship",
|
|
367532
367753
|
mapElement: (tag, range) => {
|
|
@@ -367541,7 +367762,7 @@ function parseOpcRelationshipsXml(xml) {
|
|
|
367541
367762
|
}
|
|
367542
367763
|
function parseContentTypeOverridesXml(xml) {
|
|
367543
367764
|
return parseElementDocument(xml, {
|
|
367544
|
-
namespaceUri:
|
|
367765
|
+
namespaceUri: CONTENT_TYPES_NS6,
|
|
367545
367766
|
rootLocalName: "Types",
|
|
367546
367767
|
childLocalName: "Override",
|
|
367547
367768
|
mapElement: (tag, range) => {
|
|
@@ -367674,7 +367895,7 @@ function pendingHasEntries(pending) {
|
|
|
367674
367895
|
function arraysEqual(left, right) {
|
|
367675
367896
|
return left.length === right.length && left.every((value2, index2) => value2 === right[index2]);
|
|
367676
367897
|
}
|
|
367677
|
-
var
|
|
367898
|
+
var RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships", CONTENT_TYPES_NS6 = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
367678
367899
|
var init_opc_xml = __esm(() => {
|
|
367679
367900
|
init_sd_document_session_internal();
|
|
367680
367901
|
});
|
|
@@ -370577,7 +370798,7 @@ function extractStructuralCellTexts(xml, side) {
|
|
|
370577
370798
|
}
|
|
370578
370799
|
function extractStructuralText(xml, side) {
|
|
370579
370800
|
const readText = side === "deleted" ? extractTrackedTextFromXml : extractVisibleTextFromXml;
|
|
370580
|
-
const paragraphs = scanParagraphXmlSpans({ bytes:
|
|
370801
|
+
const paragraphs = scanParagraphXmlSpans({ bytes: TEXT_ENCODER3.encode(xml) });
|
|
370581
370802
|
if (paragraphs.length === 0)
|
|
370582
370803
|
return readText(xml);
|
|
370583
370804
|
return paragraphs.map((paragraph4) => readText(paragraph4.xml).trim()).filter(Boolean).join(`
|
|
@@ -371152,8 +371373,8 @@ function structuralFieldSemanticSubtype(entry, context, resolveSession) {
|
|
|
371152
371373
|
if (!partBytes)
|
|
371153
371374
|
return null;
|
|
371154
371375
|
const partXml = decodeTrackedChangePartXml(partBytes, entry.partUri, resolveSession);
|
|
371155
|
-
const entryByteStart =
|
|
371156
|
-
const entryByteEnd =
|
|
371376
|
+
const entryByteStart = TEXT_ENCODER3.encode(partXml.slice(0, entry.documentOrderStart)).byteLength;
|
|
371377
|
+
const entryByteEnd = TEXT_ENCODER3.encode(partXml.slice(0, entry.documentOrderEnd)).byteLength;
|
|
371157
371378
|
const fields = catalog.fields.filter((candidate2) => candidate2.complete && candidate2.byteStart >= entryByteStart && candidate2.byteEnd <= entryByteEnd);
|
|
371158
371379
|
const field = fields.length === 1 ? fields[0] : undefined;
|
|
371159
371380
|
const subtype = field && field.classification !== "unknown" ? field.classification : null;
|
|
@@ -371488,7 +371709,7 @@ function createSuccessorRsidAllocator(raw) {
|
|
|
371488
371709
|
return counter.toString(16).toUpperCase().padStart(8, "0");
|
|
371489
371710
|
};
|
|
371490
371711
|
}
|
|
371491
|
-
var resolvedTrackedChangeIdsBySession,
|
|
371712
|
+
var resolvedTrackedChangeIdsBySession, TEXT_ENCODER3, EMUS_PER_CSS_PIXEL = 9525, BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES, DocumentApiAdapterError, STRUCTURAL_DESCRIPTOR_OPERATIONS;
|
|
371492
371713
|
var init_adapter24 = __esm(() => {
|
|
371493
371714
|
init_review_read_model();
|
|
371494
371715
|
init_review_read_model();
|
|
@@ -371505,7 +371726,7 @@ var init_adapter24 = __esm(() => {
|
|
|
371505
371726
|
init_logical_view_cache();
|
|
371506
371727
|
init_local_text_projection();
|
|
371507
371728
|
resolvedTrackedChangeIdsBySession = new WeakMap;
|
|
371508
|
-
|
|
371729
|
+
TEXT_ENCODER3 = new TextEncoder;
|
|
371509
371730
|
BROWSER_RENDERABLE_IMAGE_CONTENT_TYPES = new Map([
|
|
371510
371731
|
["png", "image/png"],
|
|
371511
371732
|
["jpg", "image/jpeg"],
|
|
@@ -375270,11 +375491,11 @@ function contentTypeRecords(source) {
|
|
|
375270
375491
|
const parsed = parseXml(TD113.decode(decodePartBytes(source)), {
|
|
375271
375492
|
onOpenTag: (tag) => {
|
|
375272
375493
|
if (depth === 0) {
|
|
375273
|
-
if (rootSeen || tag.localName !== "Types" || tag.namespaceUri !==
|
|
375494
|
+
if (rootSeen || tag.localName !== "Types" || tag.namespaceUri !== CONTENT_TYPES_NS7)
|
|
375274
375495
|
invalid4 = true;
|
|
375275
375496
|
else
|
|
375276
375497
|
rootSeen = true;
|
|
375277
|
-
} else if (depth === 1 && tag.namespaceUri ===
|
|
375498
|
+
} else if (depth === 1 && tag.namespaceUri === CONTENT_TYPES_NS7 && (tag.localName === "Default" || tag.localName === "Override")) {
|
|
375278
375499
|
const contentType = unqualifiedAttribute(tag, "ContentType");
|
|
375279
375500
|
const identifier = tag.localName === "Default" ? unqualifiedAttribute(tag, "Extension")?.toLowerCase() : unqualifiedAttribute(tag, "PartName");
|
|
375280
375501
|
const key2 = identifier ? `${tag.localName === "Default" ? "default" : "override"}:${identifier}` : null;
|
|
@@ -375327,7 +375548,7 @@ function decodePartBytes(source) {
|
|
|
375327
375548
|
const length = base64DecodedLength(source.bytesBase64);
|
|
375328
375549
|
return length === null ? null : base64ToBytes(source.bytesBase64, length);
|
|
375329
375550
|
}
|
|
375330
|
-
var DOCUMENT_RELS_URI3 = "/word/_rels/document.xml.rels", DOCUMENT_URI = "/word/document.xml", CONTENT_TYPES_URI3 = "/[Content_Types].xml", SAVE_NOISE_PART_URIS, IMAGE_REL_TYPES, OFFICE_DOCUMENT_RELATIONSHIP_NAMESPACES, PACKAGE_RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
375551
|
+
var DOCUMENT_RELS_URI3 = "/word/_rels/document.xml.rels", DOCUMENT_URI = "/word/document.xml", CONTENT_TYPES_URI3 = "/[Content_Types].xml", SAVE_NOISE_PART_URIS, IMAGE_REL_TYPES, OFFICE_DOCUMENT_RELATIONSHIP_NAMESPACES, PACKAGE_RELATIONSHIPS_NS3 = "http://schemas.openxmlformats.org/package/2006/relationships", CONTENT_TYPES_NS7 = "http://schemas.openxmlformats.org/package/2006/content-types", DRAWINGML_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main", WORDPROCESSINGML_NS5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", CORE_PROPERTIES_NS3 = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties", DCTERMS_NS3 = "http://purl.org/dc/terms/", EXTENDED_PROPERTIES_NS2 = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties", TD113, PROTECTED_BODY_ELEMENTS;
|
|
375331
375552
|
var init_relationship_backed_body_replay = __esm(() => {
|
|
375332
375553
|
init_sd_document_session_internal();
|
|
375333
375554
|
init_part_fingerprint();
|
|
@@ -400467,7 +400688,7 @@ function readParagraphInlineMap(session, entry) {
|
|
|
400467
400688
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400468
400689
|
if (!bytes)
|
|
400469
400690
|
return null;
|
|
400470
|
-
return parseParagraphInlineMap(
|
|
400691
|
+
return parseParagraphInlineMap(TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd)));
|
|
400471
400692
|
}
|
|
400472
400693
|
function resolveTrackedSelectionEndpoint(map3, point3, bias) {
|
|
400473
400694
|
if (point3.trackedOffset != null) {
|
|
@@ -400603,7 +400824,7 @@ function readSelectionText(session, entries, segments) {
|
|
|
400603
400824
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400604
400825
|
if (!bytes)
|
|
400605
400826
|
return "";
|
|
400606
|
-
const xml =
|
|
400827
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400607
400828
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400608
400829
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400609
400830
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400619,7 +400840,7 @@ function readActiveMarks(session, entries, segments) {
|
|
|
400619
400840
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400620
400841
|
if (!bytes)
|
|
400621
400842
|
return [];
|
|
400622
|
-
const xml =
|
|
400843
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400623
400844
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400624
400845
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400625
400846
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400677,7 +400898,7 @@ function readActiveChangeIds(session, entries, segments, options) {
|
|
|
400677
400898
|
const bytes = getSDDocumentSessionInternalPartBytes(session, entry.partUri);
|
|
400678
400899
|
if (!bytes)
|
|
400679
400900
|
return [];
|
|
400680
|
-
const xml =
|
|
400901
|
+
const xml = TEXT_DECODER7.decode(bytes.subarray(entry.byteStart, entry.byteEnd));
|
|
400681
400902
|
const paragraphText3 = visibleParagraphTextFromXml(xml);
|
|
400682
400903
|
const start = clampOffset(segment.range.start, paragraphText3.length);
|
|
400683
400904
|
const end = clampOffset(segment.range.end, paragraphText3.length);
|
|
@@ -400948,12 +401169,12 @@ function pushUnique(out, id) {
|
|
|
400948
401169
|
if (typeof id === "string" && id.length > 0 && !out.includes(id))
|
|
400949
401170
|
out.push(id);
|
|
400950
401171
|
}
|
|
400951
|
-
var
|
|
401172
|
+
var TEXT_DECODER7, ACTIVE_MARK_ORDER;
|
|
400952
401173
|
var init_live_selection = __esm(() => {
|
|
400953
401174
|
init_sd_document_session_internal();
|
|
400954
401175
|
init_sd_document_session_internal();
|
|
400955
401176
|
init_footnote_range();
|
|
400956
|
-
|
|
401177
|
+
TEXT_DECODER7 = new TextDecoder;
|
|
400957
401178
|
ACTIVE_MARK_ORDER = ["bold", "italic", "underline", "strikethrough"];
|
|
400958
401179
|
});
|
|
400959
401180
|
|
|
@@ -423024,20 +423245,20 @@ function collectExpectedRequiredShards(snapshot3, readiness, diagnostics) {
|
|
|
423024
423245
|
}
|
|
423025
423246
|
return [...required2.values()].sort((a, b) => a.shardId < b.shardId ? -1 : a.shardId > b.shardId ? 1 : 0);
|
|
423026
423247
|
}
|
|
423027
|
-
function expectIndexedPart(snapshot3, partByKey,
|
|
423028
|
-
if (!
|
|
423248
|
+
function expectIndexedPart(snapshot3, partByKey, partKey2, fieldName, diagnostics) {
|
|
423249
|
+
if (!partKey2) {
|
|
423029
423250
|
diagnostics.push({
|
|
423030
423251
|
code: COLLAB_V2_DIAGNOSTICS.COLLAB_V2_ROOM_MANIFEST_CORRUPT,
|
|
423031
423252
|
message: `${fieldName} is missing`
|
|
423032
423253
|
});
|
|
423033
423254
|
return null;
|
|
423034
423255
|
}
|
|
423035
|
-
const part = partByKey.get(
|
|
423256
|
+
const part = partByKey.get(partKey2) ?? null;
|
|
423036
423257
|
if (part)
|
|
423037
423258
|
return part;
|
|
423038
423259
|
diagnostics.push({
|
|
423039
423260
|
code: COLLAB_V2_DIAGNOSTICS.COLLAB_V2_ROOM_MANIFEST_CORRUPT,
|
|
423040
|
-
message: `${fieldName} points at missing package part "${
|
|
423261
|
+
message: `${fieldName} points at missing package part "${partKey2}"`
|
|
423041
423262
|
});
|
|
423042
423263
|
return null;
|
|
423043
423264
|
}
|
|
@@ -425431,6 +425652,7 @@ function insertBlock(input) {
|
|
|
425431
425652
|
if (input.text) {
|
|
425432
425653
|
created.text.insert(0, input.text);
|
|
425433
425654
|
}
|
|
425655
|
+
invalidateStoryBlockIndex(scope);
|
|
425434
425656
|
scope.blocks.push([created.block]);
|
|
425435
425657
|
scope.order.set(blockId, assignOrderWindow(scope, ordered, targetIndex, 1, blockId)[0]);
|
|
425436
425658
|
}, input.origin ?? STORY_MUTATION_ORIGIN.blockInsert);
|
|
@@ -425447,6 +425669,7 @@ function deleteBlock(input) {
|
|
|
425447
425669
|
order.delete(target.blockId);
|
|
425448
425670
|
}
|
|
425449
425671
|
const physicalIndices = [...new Set(targets.map((target) => target.physicalIndex))].sort((a, b) => b - a);
|
|
425672
|
+
invalidateStoryBlockIndex(scope);
|
|
425450
425673
|
for (const physicalIndex of physicalIndices) {
|
|
425451
425674
|
blocks.delete(physicalIndex, 1);
|
|
425452
425675
|
}
|
|
@@ -427587,13 +427810,13 @@ function registerMediaAsset(input) {
|
|
|
427587
427810
|
}).id;
|
|
427588
427811
|
partUri = `/word/media/image${ordinal}.${ext}`;
|
|
427589
427812
|
}
|
|
427590
|
-
const
|
|
427591
|
-
if (byPart.has(
|
|
427592
|
-
throw new CollabV2DiagnosticError(COLLAB_V2_DIAGNOSTICS.COLLAB_V2_PACKAGE_PART_IDENTITY_CONFLICT, `media part ${
|
|
427813
|
+
const partKey2 = input.partKey ?? encodePartKey(partUri);
|
|
427814
|
+
if (byPart.has(partKey2)) {
|
|
427815
|
+
throw new CollabV2DiagnosticError(COLLAB_V2_DIAGNOSTICS.COLLAB_V2_PACKAGE_PART_IDENTITY_CONFLICT, `media part ${partKey2} already exists`, { partKey: partKey2, partUri });
|
|
427593
427816
|
}
|
|
427594
427817
|
snapshot3 = {
|
|
427595
427818
|
assetId,
|
|
427596
|
-
partKey,
|
|
427819
|
+
partKey: partKey2,
|
|
427597
427820
|
partUri,
|
|
427598
427821
|
contentType: input.contentType,
|
|
427599
427822
|
sha256: input.sha256,
|
|
@@ -427604,7 +427827,7 @@ function registerMediaAsset(input) {
|
|
|
427604
427827
|
hasBytes: false
|
|
427605
427828
|
};
|
|
427606
427829
|
assets.set(assetId, assetRecordToMap(snapshot3));
|
|
427607
|
-
byPart.set(
|
|
427830
|
+
byPart.set(partKey2, assetId);
|
|
427608
427831
|
}, "package-part:media-manifest:register");
|
|
427609
427832
|
return snapshot3;
|
|
427610
427833
|
}
|
|
@@ -427677,10 +427900,10 @@ function deleteMediaAsset(doc2, assetId) {
|
|
|
427677
427900
|
const record3 = readAssetRecord(assets, assetId);
|
|
427678
427901
|
if (!record3)
|
|
427679
427902
|
return;
|
|
427680
|
-
const
|
|
427903
|
+
const partKey2 = String(record3.get("partKey") ?? "");
|
|
427681
427904
|
assets.delete(assetId);
|
|
427682
|
-
if (
|
|
427683
|
-
byPart.delete(
|
|
427905
|
+
if (partKey2 && byPart.get(partKey2) === assetId) {
|
|
427906
|
+
byPart.delete(partKey2);
|
|
427684
427907
|
}
|
|
427685
427908
|
removed = true;
|
|
427686
427909
|
}, "package-part:media-manifest:delete");
|
|
@@ -434048,10 +434271,10 @@ function serializeWebSettingsXml(settings, bootstrap) {
|
|
|
434048
434271
|
sb.push(bootstrap?.containerCloseTagXml ?? "</w:webSettings>");
|
|
434049
434272
|
return sb.join("");
|
|
434050
434273
|
}
|
|
434051
|
-
function partKeyToPartName(
|
|
434052
|
-
if (
|
|
434053
|
-
return
|
|
434054
|
-
return `/${
|
|
434274
|
+
function partKeyToPartName(partKey2) {
|
|
434275
|
+
if (partKey2.startsWith("/"))
|
|
434276
|
+
return partKey2;
|
|
434277
|
+
return `/${partKey2.replace(/_/g, "/")}`;
|
|
434055
434278
|
}
|
|
434056
434279
|
function renderCommentBodyParagraphXml(paraId, bodyText) {
|
|
434057
434280
|
const lines = bodyText.split(`
|
|
@@ -434954,10 +435177,10 @@ function filterContentTypesForProjectedParts(contentTypes, activePartUris) {
|
|
|
434954
435177
|
return {
|
|
434955
435178
|
defaults: contentTypes.defaults,
|
|
434956
435179
|
overrides: contentTypes.overrides.filter((override) => {
|
|
434957
|
-
const
|
|
434958
|
-
if (!isCustomXmlPartKey(
|
|
435180
|
+
const partKey2 = normalizePartKey(override.partKey);
|
|
435181
|
+
if (!isCustomXmlPartKey(partKey2))
|
|
434959
435182
|
return true;
|
|
434960
|
-
return activePartKeys.has(
|
|
435183
|
+
return activePartKeys.has(partKey2);
|
|
434961
435184
|
})
|
|
434962
435185
|
};
|
|
434963
435186
|
}
|
|
@@ -434977,8 +435200,8 @@ function replaceContentTypesProjection(parts, contentTypes) {
|
|
|
434977
435200
|
function isCustomXmlPartUri(partUri) {
|
|
434978
435201
|
return /^\/customXml\//i.test(partUri);
|
|
434979
435202
|
}
|
|
434980
|
-
function isCustomXmlPartKey(
|
|
434981
|
-
return /^customXml_/i.test(
|
|
435203
|
+
function isCustomXmlPartKey(partKey2) {
|
|
435204
|
+
return /^customXml_/i.test(partKey2);
|
|
434982
435205
|
}
|
|
434983
435206
|
function resolveRelationshipTarget5(ownerPartUri, target) {
|
|
434984
435207
|
if (target.startsWith("/"))
|
|
@@ -438018,8 +438241,8 @@ function pairedPartKeysOf(handle) {
|
|
|
438018
438241
|
}
|
|
438019
438242
|
return normalized;
|
|
438020
438243
|
}
|
|
438021
|
-
function normalizePartKey(
|
|
438022
|
-
return
|
|
438244
|
+
function normalizePartKey(partKey2) {
|
|
438245
|
+
return partKey2.replace(/^\/+/, "").replace(/\//g, "_");
|
|
438023
438246
|
}
|
|
438024
438247
|
function shouldEmitCommentsFamilyPart(pairedPartKeys, canonicalPartKey, hasRows) {
|
|
438025
438248
|
return hasRows || pairedPartKeys.has(normalizePartKey(canonicalPartKey));
|
|
@@ -438101,7 +438324,7 @@ function collectPackageParts(registry2, options) {
|
|
|
438101
438324
|
out.push({
|
|
438102
438325
|
partUri: commentsPartUri,
|
|
438103
438326
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
|
438104
|
-
content: { kind: "xml", xml: commentsSource ?
|
|
438327
|
+
content: { kind: "xml", xml: commentsSource ? TEXT_DECODER8.decode(commentsSource) : serializeCommentsXml(comments) }
|
|
438105
438328
|
});
|
|
438106
438329
|
}
|
|
438107
438330
|
const commentsExtendedSource = readCommentsSourcePart(readTarget, "/word/commentsExtended.xml");
|
|
@@ -438111,7 +438334,7 @@ function collectPackageParts(registry2, options) {
|
|
|
438111
438334
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
|
|
438112
438335
|
content: {
|
|
438113
438336
|
kind: "xml",
|
|
438114
|
-
xml: commentsExtendedSource ?
|
|
438337
|
+
xml: commentsExtendedSource ? TEXT_DECODER8.decode(commentsExtendedSource) : serializeCommentsExtendedXml(comments)
|
|
438115
438338
|
}
|
|
438116
438339
|
});
|
|
438117
438340
|
}
|
|
@@ -438122,7 +438345,7 @@ function collectPackageParts(registry2, options) {
|
|
|
438122
438345
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",
|
|
438123
438346
|
content: {
|
|
438124
438347
|
kind: "xml",
|
|
438125
|
-
xml: commentsIdsSource ?
|
|
438348
|
+
xml: commentsIdsSource ? TEXT_DECODER8.decode(commentsIdsSource) : serializeCommentsIdsXml(comments)
|
|
438126
438349
|
}
|
|
438127
438350
|
});
|
|
438128
438351
|
}
|
|
@@ -438131,7 +438354,7 @@ function collectPackageParts(registry2, options) {
|
|
|
438131
438354
|
out.push({
|
|
438132
438355
|
partUri: "/word/people.xml",
|
|
438133
438356
|
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml",
|
|
438134
|
-
content: { kind: "xml", xml: peopleSource ?
|
|
438357
|
+
content: { kind: "xml", xml: peopleSource ? TEXT_DECODER8.decode(peopleSource) : serializePeopleXml(people) }
|
|
438135
438358
|
});
|
|
438136
438359
|
}
|
|
438137
438360
|
}
|
|
@@ -438243,7 +438466,7 @@ function canonicalStoryDigestInputs(stories) {
|
|
|
438243
438466
|
tableStructuralOverlays: [...story.tableStructuralOverlays ?? []].sort((left, right) => left.tableNodeId < right.tableNodeId ? -1 : left.tableNodeId > right.tableNodeId ? 1 : 0)
|
|
438244
438467
|
}));
|
|
438245
438468
|
}
|
|
438246
|
-
var WORD_ML_NS2 = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"', WORD_ML_2010_NS = 'xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"', STORY_ROOT_NS,
|
|
438469
|
+
var WORD_ML_NS2 = 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"', WORD_ML_2010_NS = 'xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"', STORY_ROOT_NS, TEXT_DECODER8, STORY_BLOCK_INDEX_CACHE, SYNTHETIC_PARAGRAPH_BLOCK_ID_PREFIX4 = "__sd:paragraph:", UTF8_ENCODER3, SOURCE_XML_BYTE_ALIGNED_CACHE, XML_EMISSION_CONTEXTS, CONTENT_CONTROL_TOPOLOGIES, PROJECTED_NAMESPACE_CONTEXTS, TEXT_LOCAL_STORY_SNAPSHOTS, PARAGRAPH_PROPERTY_ORDER, RUN_PROPERTY_CONTENT_LOCAL_NAMES;
|
|
438247
438470
|
var init_materialize = __esm(() => {
|
|
438248
438471
|
init_package_part();
|
|
438249
438472
|
init_anchors();
|
|
@@ -438264,7 +438487,7 @@ var init_materialize = __esm(() => {
|
|
|
438264
438487
|
init_table_revision_decisions();
|
|
438265
438488
|
init_xml_emission_context();
|
|
438266
438489
|
STORY_ROOT_NS = `${WORD_ML_NS2} ${WORD_ML_2010_NS}`;
|
|
438267
|
-
|
|
438490
|
+
TEXT_DECODER8 = new TextDecoder("utf-8", { fatal: false });
|
|
438268
438491
|
STORY_BLOCK_INDEX_CACHE = new WeakMap;
|
|
438269
438492
|
UTF8_ENCODER3 = new TextEncoder;
|
|
438270
438493
|
SOURCE_XML_BYTE_ALIGNED_CACHE = new WeakMap;
|
|
@@ -438463,10 +438686,10 @@ function extensionOf(partUri) {
|
|
|
438463
438686
|
return null;
|
|
438464
438687
|
return partUri.slice(dot + 1).toLowerCase();
|
|
438465
438688
|
}
|
|
438466
|
-
function partKeyToPartUri(
|
|
438467
|
-
if (
|
|
438468
|
-
return
|
|
438469
|
-
return `/${
|
|
438689
|
+
function partKeyToPartUri(partKey2) {
|
|
438690
|
+
if (partKey2.startsWith("/"))
|
|
438691
|
+
return partKey2;
|
|
438692
|
+
return `/${partKey2.replace(/_/g, "/")}`;
|
|
438470
438693
|
}
|
|
438471
438694
|
var init_validator = __esm(() => {
|
|
438472
438695
|
init_reducer();
|
|
@@ -439747,13 +439970,13 @@ function createParagraphNamespaceBindingResolver(bytes, rootBindings) {
|
|
|
439747
439970
|
};
|
|
439748
439971
|
}
|
|
439749
439972
|
function readParagraphNamespaceBindings(bytes) {
|
|
439750
|
-
const xml =
|
|
439973
|
+
const xml = TEXT_DECODER9.decode(bytes);
|
|
439751
439974
|
const paragraphs = scanWmlParagraphSpans(xml).paragraphs;
|
|
439752
439975
|
const bindingsByByteStart = new Map;
|
|
439753
439976
|
let charCursor = 0;
|
|
439754
439977
|
let byteCursor = leadingBomLength(bytes);
|
|
439755
439978
|
for (const paragraph4 of paragraphs) {
|
|
439756
|
-
byteCursor +=
|
|
439979
|
+
byteCursor += TEXT_ENCODER4.encode(xml.slice(charCursor, paragraph4.openStart)).byteLength;
|
|
439757
439980
|
bindingsByByteStart.set(byteCursor, paragraph4.namespaceBindings);
|
|
439758
439981
|
charCursor = paragraph4.openStart;
|
|
439759
439982
|
}
|
|
@@ -439776,7 +439999,7 @@ function hasLocalBinding(xml, prefix) {
|
|
|
439776
439999
|
}
|
|
439777
440000
|
function countNamespaceDeclarations(bytes) {
|
|
439778
440001
|
const counts = new Map;
|
|
439779
|
-
const xml =
|
|
440002
|
+
const xml = TEXT_DECODER9.decode(bytes);
|
|
439780
440003
|
const declaration = /\bxmlns:([\w.-]+)\s*=/g;
|
|
439781
440004
|
let match;
|
|
439782
440005
|
while (match = declaration.exec(xml)) {
|
|
@@ -439791,11 +440014,11 @@ function escapeRegex17(value2) {
|
|
|
439791
440014
|
function leadingBomLength(bytes) {
|
|
439792
440015
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
439793
440016
|
}
|
|
439794
|
-
var
|
|
440017
|
+
var TEXT_DECODER9, TEXT_ENCODER4;
|
|
439795
440018
|
var init_paragraph_namespace_bindings = __esm(() => {
|
|
439796
440019
|
init_sd_document_session_internal();
|
|
439797
|
-
|
|
439798
|
-
|
|
440020
|
+
TEXT_DECODER9 = new TextDecoder("utf-8", { fatal: false });
|
|
440021
|
+
TEXT_ENCODER4 = new TextEncoder;
|
|
439799
440022
|
});
|
|
439800
440023
|
|
|
439801
440024
|
// ../../../v2/collaboration-v2/dist/story-shard/table-structural-refs.js
|
|
@@ -445654,6 +445877,13 @@ async function encodeProjectionRecordAsDocx(input) {
|
|
|
445654
445877
|
const bytes = await resolveProjectedPartBytes(part.partUri, input.projectionRegistry, input.blobAdapter);
|
|
445655
445878
|
entries2.set(zipKey(part.partUri), bytes);
|
|
445656
445879
|
}
|
|
445880
|
+
const changes = sanitizeDocxPackageEntries(new Map([...entries2].map(([key2, bytes]) => [`/${key2}`, bytes])));
|
|
445881
|
+
for (const [partUri, bytes] of changes) {
|
|
445882
|
+
if (bytes === null)
|
|
445883
|
+
entries2.delete(zipKey(partUri));
|
|
445884
|
+
else
|
|
445885
|
+
entries2.set(zipKey(partUri), bytes);
|
|
445886
|
+
}
|
|
445657
445887
|
const ordered = {};
|
|
445658
445888
|
for (const key2 of [...entries2.keys()].sort()) {
|
|
445659
445889
|
ordered[key2] = entries2.get(key2);
|
|
@@ -446007,11 +446237,11 @@ function storySeedForSource(input) {
|
|
|
446007
446237
|
const trailingStart = rawParagraphs.at(-1)?.byteEnd ?? window2.byteStart;
|
|
446008
446238
|
return {
|
|
446009
446239
|
paragraphs,
|
|
446010
|
-
trailingXml:
|
|
446240
|
+
trailingXml: TEXT_DECODER10.decode(input.bytes.slice(trailingStart, window2.byteEnd))
|
|
446011
446241
|
};
|
|
446012
446242
|
}
|
|
446013
446243
|
function scanWmlParagraphSeedSpans(bytes) {
|
|
446014
|
-
const xml =
|
|
446244
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
446015
446245
|
const scan = scanWmlParagraphSpans(xml);
|
|
446016
446246
|
if (!scan.ok)
|
|
446017
446247
|
return [];
|
|
@@ -446023,10 +446253,10 @@ function scanWmlParagraphSeedSpans(bytes) {
|
|
|
446023
446253
|
if (paragraph4.openStart < containingParagraphEnd)
|
|
446024
446254
|
continue;
|
|
446025
446255
|
const ordinal = spans.length;
|
|
446026
|
-
byteCursor +=
|
|
446256
|
+
byteCursor += TEXT_ENCODER5.encode(xml.slice(charCursor, paragraph4.openStart)).length;
|
|
446027
446257
|
const paragraphXml = xml.slice(paragraph4.openStart, paragraph4.closeEnd);
|
|
446028
446258
|
const byteStart = byteCursor;
|
|
446029
|
-
const byteEnd = byteStart +
|
|
446259
|
+
const byteEnd = byteStart + TEXT_ENCODER5.encode(paragraphXml).length;
|
|
446030
446260
|
spans.push({
|
|
446031
446261
|
xml: paragraphXml,
|
|
446032
446262
|
byteStart,
|
|
@@ -446070,7 +446300,7 @@ function addLeadingXml(bytes, storyKind, spans) {
|
|
|
446070
446300
|
const window2 = resolveStoryContentWindow2(bytes, storyKind, spans);
|
|
446071
446301
|
let cursor = window2.byteStart;
|
|
446072
446302
|
return spans.map((span) => {
|
|
446073
|
-
const leadingXml =
|
|
446303
|
+
const leadingXml = TEXT_DECODER10.decode(bytes.slice(cursor, span.byteStart));
|
|
446074
446304
|
cursor = span.byteEnd;
|
|
446075
446305
|
return {
|
|
446076
446306
|
...span,
|
|
@@ -446079,7 +446309,7 @@ function addLeadingXml(bytes, storyKind, spans) {
|
|
|
446079
446309
|
});
|
|
446080
446310
|
}
|
|
446081
446311
|
function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
446082
|
-
const xml =
|
|
446312
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
446083
446313
|
const spans = [];
|
|
446084
446314
|
const re = new RegExp(PARAGRAPH_REGEX.source, "g");
|
|
446085
446315
|
let match;
|
|
@@ -446090,10 +446320,10 @@ function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
|
446090
446320
|
const paragraphXml = match[0];
|
|
446091
446321
|
const matchIndex = match.index ?? 0;
|
|
446092
446322
|
if (matchIndex > charCursor) {
|
|
446093
|
-
byteCursor +=
|
|
446323
|
+
byteCursor += TEXT_ENCODER5.encode(xml.slice(charCursor, matchIndex)).length;
|
|
446094
446324
|
}
|
|
446095
446325
|
const byteStart = byteCursor;
|
|
446096
|
-
const byteEnd = byteStart +
|
|
446326
|
+
const byteEnd = byteStart + TEXT_ENCODER5.encode(paragraphXml).length;
|
|
446097
446327
|
const openTag = paragraphXml.match(/^<[\w.-]+:p\b[^>]*[/]?>/)?.[0] ?? "";
|
|
446098
446328
|
const paraId = attrLocal3(openTag, "paraId");
|
|
446099
446329
|
spans.push({
|
|
@@ -446113,7 +446343,7 @@ function scanParagraphXmlSpansLocal(bytes, storyKind) {
|
|
|
446113
446343
|
return addLeadingXml(bytes, storyKind, spans);
|
|
446114
446344
|
}
|
|
446115
446345
|
function resolveStoryContentWindow2(bytes, storyKind, entries2) {
|
|
446116
|
-
const xml =
|
|
446346
|
+
const xml = TEXT_DECODER10.decode(bytes);
|
|
446117
446347
|
const root = extractRootEnvelope2(xml);
|
|
446118
446348
|
if (!root) {
|
|
446119
446349
|
return deriveContentWindowFromEntrySpans2(bytes, entries2);
|
|
@@ -446187,7 +446417,7 @@ function xmlDeclarationPrefixLength2(xml) {
|
|
|
446187
446417
|
function utf8ByteLength9(xml, codeUnitIndex) {
|
|
446188
446418
|
if (codeUnitIndex <= 0)
|
|
446189
446419
|
return 0;
|
|
446190
|
-
return
|
|
446420
|
+
return TEXT_ENCODER5.encode(xml.slice(0, codeUnitIndex)).length;
|
|
446191
446421
|
}
|
|
446192
446422
|
function leadingBomLength2(bytes) {
|
|
446193
446423
|
return bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191 ? 3 : 0;
|
|
@@ -446196,14 +446426,14 @@ function attrLocal3(tag, localName3) {
|
|
|
446196
446426
|
const re = new RegExp(String.raw`(?:[\w.-]+:)?${localName3}="([^"]+)"`);
|
|
446197
446427
|
return tag.match(re)?.[1] ?? null;
|
|
446198
446428
|
}
|
|
446199
|
-
var
|
|
446429
|
+
var TEXT_DECODER10, TEXT_ENCODER5, PARAGRAPH_REGEX;
|
|
446200
446430
|
var init_story_paragraph_seed = __esm(() => {
|
|
446201
446431
|
init_sd_document_session_internal();
|
|
446202
446432
|
init_parse_paragraph();
|
|
446203
446433
|
init_paragraph_namespace_bindings();
|
|
446204
446434
|
init_table_structural_refs();
|
|
446205
|
-
|
|
446206
|
-
|
|
446435
|
+
TEXT_DECODER10 = new TextDecoder("utf-8", { fatal: false });
|
|
446436
|
+
TEXT_ENCODER5 = new TextEncoder;
|
|
446207
446437
|
PARAGRAPH_REGEX = /<[\w.-]+:p\b[^>]*\/>|<[\w.-]+:p\b[^>]*>[\s\S]*?<\/[\w.-]+:p>/g;
|
|
446208
446438
|
});
|
|
446209
446439
|
|
|
@@ -446467,8 +446697,8 @@ function pruneReplacedRoomOrphans(root) {
|
|
|
446467
446697
|
return;
|
|
446468
446698
|
const seededIds = new Set(snapshot3.meta.contentUnitIds);
|
|
446469
446699
|
const orphanIds = snapshot3.shards.flatMap((shard) => {
|
|
446470
|
-
const
|
|
446471
|
-
return
|
|
446700
|
+
const partKey2 = shard.story?.sourcePartKey ?? shard.part?.partKey;
|
|
446701
|
+
return partKey2 && !parts.has(partKey2) && !seededIds.has(shard.shardId) ? [shard.shardId] : [];
|
|
446472
446702
|
});
|
|
446473
446703
|
if (orphanIds.length === 0)
|
|
446474
446704
|
return;
|
|
@@ -446862,7 +447092,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446862
447092
|
return;
|
|
446863
447093
|
const manifest2 = collabUnitTargetOrDoc(ensureMediaManifestShard().handle);
|
|
446864
447094
|
const contentTypesBytes = getSDDocumentSessionInternalPartBytes(options.session, CONTENT_TYPES_PART_URI17);
|
|
446865
|
-
const contentTypes = contentTypesBytes ? parseContentTypes(
|
|
447095
|
+
const contentTypes = contentTypesBytes ? parseContentTypes(TEXT_DECODER11.decode(contentTypesBytes)) : null;
|
|
446866
447096
|
for (const [partUri, entry] of entries2) {
|
|
446867
447097
|
const assetId = assetIdForPartUri(partUri);
|
|
446868
447098
|
if (entry.kind === "remove") {
|
|
@@ -446882,10 +447112,10 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446882
447112
|
sha256: payload.sha256,
|
|
446883
447113
|
...payload.mode === BINARY_MODE.blob ? { blobRef: payload.blobRef, byteLength: payload.byteLength } : { bytes }
|
|
446884
447114
|
});
|
|
446885
|
-
const
|
|
447115
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
446886
447116
|
ensureChildMap(getPartRecordsMap(manifest2), "assets").set(assetId, createMediaAssetRecord({
|
|
446887
447117
|
assetId,
|
|
446888
|
-
partKey,
|
|
447118
|
+
partKey: partKey2,
|
|
446889
447119
|
partUri,
|
|
446890
447120
|
contentType,
|
|
446891
447121
|
sha256: payload.sha256,
|
|
@@ -446895,8 +447125,8 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
446895
447125
|
mode: payload.mode,
|
|
446896
447126
|
hasBytes: true
|
|
446897
447127
|
}));
|
|
446898
|
-
ensureChildMap(getPartIndexMap(manifest2), "byPartKey").set(
|
|
446899
|
-
recordManifestPart({ partKey, partUri, partKind: "image", contentType, binary: true, uncompressedSize: bytes.byteLength });
|
|
447128
|
+
ensureChildMap(getPartIndexMap(manifest2), "byPartKey").set(partKey2, assetId);
|
|
447129
|
+
recordManifestPart({ partKey: partKey2, partUri, partKind: "image", contentType, binary: true, uncompressedSize: bytes.byteLength });
|
|
446900
447130
|
}
|
|
446901
447131
|
}
|
|
446902
447132
|
function syncPreparedListSidecar(sidecar) {
|
|
@@ -447203,7 +447433,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447203
447433
|
if (!rels) {
|
|
447204
447434
|
throw new Error(`relationships shard for ${partUri} could not be created`);
|
|
447205
447435
|
}
|
|
447206
|
-
const parsed = parseRelationshipsXml(
|
|
447436
|
+
const parsed = parseRelationshipsXml(TEXT_DECODER11.decode(bytes), {
|
|
447207
447437
|
ownerPartUri: ownerPartUri2,
|
|
447208
447438
|
relsUri: partUri,
|
|
447209
447439
|
resolveTarget(target, targetMode) {
|
|
@@ -447254,7 +447484,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447254
447484
|
recordManifestPart(relationshipsPartDescriptor(partUri, bytes.byteLength));
|
|
447255
447485
|
}
|
|
447256
447486
|
function syncContentTypesPart(bytes) {
|
|
447257
|
-
const parsed = parseContentTypes(
|
|
447487
|
+
const parsed = parseContentTypes(TEXT_DECODER11.decode(bytes));
|
|
447258
447488
|
const handle = requireContentTypesHandle();
|
|
447259
447489
|
resetPackagePartPayload(collabUnitTargetOrDoc(handle));
|
|
447260
447490
|
for (const [extension2, contentType] of parsed.defaults.entries()) {
|
|
@@ -447306,7 +447536,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447306
447536
|
}
|
|
447307
447537
|
function syncStylesPart(bytes) {
|
|
447308
447538
|
const handle = ensureStylesShard();
|
|
447309
|
-
const parsed = parseStylesPart2(
|
|
447539
|
+
const parsed = parseStylesPart2(TEXT_DECODER11.decode(bytes));
|
|
447310
447540
|
resetPackagePartPayload(collabUnitTargetOrDoc(handle));
|
|
447311
447541
|
updateDocumentDefaults(collabUnitTargetOrDoc(handle), parsed.documentDefaults);
|
|
447312
447542
|
for (const style of parsed.styles) {
|
|
@@ -447433,8 +447663,8 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447433
447663
|
}
|
|
447434
447664
|
if (!additiveInsert) {
|
|
447435
447665
|
const stalePartUris = [];
|
|
447436
|
-
for (const [
|
|
447437
|
-
const descriptor = toManifestPartDescriptor(
|
|
447666
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(options.rootDoc).entries()) {
|
|
447667
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
447438
447668
|
if (!descriptor)
|
|
447439
447669
|
continue;
|
|
447440
447670
|
if (descriptor.partKind !== "image" && descriptor.partKind !== "media")
|
|
@@ -447515,10 +447745,10 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447515
447745
|
options.graph.commentsHandle = null;
|
|
447516
447746
|
}
|
|
447517
447747
|
const descriptors = [];
|
|
447518
|
-
for (const [
|
|
447748
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(options.rootDoc).entries()) {
|
|
447519
447749
|
if (disposed)
|
|
447520
447750
|
return;
|
|
447521
|
-
const descriptor = toManifestPartDescriptor(
|
|
447751
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
447522
447752
|
if (!descriptor)
|
|
447523
447753
|
continue;
|
|
447524
447754
|
descriptors.push(descriptor);
|
|
@@ -447705,7 +447935,7 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
447705
447935
|
});
|
|
447706
447936
|
}
|
|
447707
447937
|
const handle = options.graph.storyHandles.get(shardId);
|
|
447708
|
-
const xml =
|
|
447938
|
+
const xml = TEXT_DECODER11.decode(bytes);
|
|
447709
447939
|
const parsed = collectXmlElementRanges(xml);
|
|
447710
447940
|
const root = parsed.ranges.find((range) => range.tag.localName === (kind === "header" ? "hdr" : "ftr"));
|
|
447711
447941
|
if (!parsed.errors.length && root) {
|
|
@@ -449167,14 +449397,14 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449167
449397
|
const existing = meta4.get(PACKAGE_PART_META_KEY.pairedPartKeys);
|
|
449168
449398
|
const merged = new Set;
|
|
449169
449399
|
if (Array.isArray(existing)) {
|
|
449170
|
-
for (const
|
|
449171
|
-
if (typeof
|
|
449172
|
-
merged.add(
|
|
449400
|
+
for (const partKey2 of existing) {
|
|
449401
|
+
if (typeof partKey2 === "string" && partKey2.length > 0)
|
|
449402
|
+
merged.add(partKey2);
|
|
449173
449403
|
}
|
|
449174
449404
|
}
|
|
449175
|
-
for (const
|
|
449176
|
-
if (
|
|
449177
|
-
merged.add(
|
|
449405
|
+
for (const partKey2 of pairedPartKeys) {
|
|
449406
|
+
if (partKey2.length > 0)
|
|
449407
|
+
merged.add(partKey2);
|
|
449178
449408
|
}
|
|
449179
449409
|
meta4.set(PACKAGE_PART_META_KEY.pairedPartKeys, Array.from(merged).sort());
|
|
449180
449410
|
}
|
|
@@ -449351,16 +449581,16 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449351
449581
|
const records = getPartRecordsMap(doc2);
|
|
449352
449582
|
ensureChildMap(records, "fields");
|
|
449353
449583
|
ensureChildMap(records, "webFields");
|
|
449354
|
-
records.set("opaqueXml", settingsBytes ? innerXmlOfRoot(
|
|
449355
|
-
records.set("webOpaqueXml", webSettingsBytes ? innerXmlOfRoot(
|
|
449584
|
+
records.set("opaqueXml", settingsBytes ? innerXmlOfRoot(TEXT_DECODER11.decode(settingsBytes)) : null);
|
|
449585
|
+
records.set("webOpaqueXml", webSettingsBytes ? innerXmlOfRoot(TEXT_DECODER11.decode(webSettingsBytes)) : null);
|
|
449356
449586
|
}, "headless:collab-v2:settings-sync");
|
|
449357
449587
|
}
|
|
449358
449588
|
function writeOpaquePartSnapshot(doc2, partUri, payload) {
|
|
449359
|
-
const
|
|
449589
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449360
449590
|
const committedAt = new Date().toISOString();
|
|
449361
449591
|
targetDurableDoc(doc2).transact(() => {
|
|
449362
449592
|
const opaque = getPartOpaqueMap(doc2);
|
|
449363
|
-
opaque.set("partKey",
|
|
449593
|
+
opaque.set("partKey", partKey2);
|
|
449364
449594
|
opaque.set("partUri", partUri);
|
|
449365
449595
|
opaque.set(OPAQUE_PART_KEY.contentType, contentTypeForPackagePart(partUri));
|
|
449366
449596
|
if (payload.mode === BINARY_MODE.blob) {
|
|
@@ -449430,12 +449660,12 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449430
449660
|
return record3;
|
|
449431
449661
|
}
|
|
449432
449662
|
function retireBinaryPart(partUri) {
|
|
449433
|
-
const
|
|
449663
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449434
449664
|
const shardId = packageShardId(options.rootId, SHARD_KIND.binary, partUri);
|
|
449435
|
-
const staleMediaDescriptorId = packageShardId(options.rootId, SHARD_KIND.mediaManifest,
|
|
449665
|
+
const staleMediaDescriptorId = packageShardId(options.rootId, SHARD_KIND.mediaManifest, partKey2);
|
|
449436
449666
|
options.rootDoc.transact(() => {
|
|
449437
449667
|
const parts = getPackagePartsMap(options.rootDoc);
|
|
449438
|
-
parts.delete(
|
|
449668
|
+
parts.delete(partKey2);
|
|
449439
449669
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449440
449670
|
deleteShardDescriptor(options.rootDoc, staleMediaDescriptorId);
|
|
449441
449671
|
}, "headless:collab-v2:manifest-retire-binary");
|
|
@@ -449444,12 +449674,12 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449444
449674
|
options.onRegistryChanged();
|
|
449445
449675
|
}
|
|
449446
449676
|
function retirePackagePart(partUri) {
|
|
449447
|
-
const
|
|
449677
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449448
449678
|
const shardKind = shardKindForPackagePartUri(partUri);
|
|
449449
449679
|
const shardOwner = shardKind === SHARD_KIND.settings ? SETTINGS_PART_URI6 : partUri;
|
|
449450
449680
|
const shardId = packageShardId(options.rootId, shardKind, shardOwner);
|
|
449451
449681
|
options.rootDoc.transact(() => {
|
|
449452
|
-
getPackagePartsMap(options.rootDoc).delete(
|
|
449682
|
+
getPackagePartsMap(options.rootDoc).delete(partKey2);
|
|
449453
449683
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449454
449684
|
}, "headless:collab-v2:manifest-retire-package-part");
|
|
449455
449685
|
options.graph.projectionHandles.delete(shardId);
|
|
@@ -449457,16 +449687,16 @@ function createHeadlessCollabRoomCoordinator(options) {
|
|
|
449457
449687
|
options.onRegistryChanged();
|
|
449458
449688
|
}
|
|
449459
449689
|
function retireStoryPart(partUri) {
|
|
449460
|
-
const
|
|
449690
|
+
const partKey2 = encodeLogicalOwnerKey(partUri);
|
|
449461
449691
|
const shardIds = new Set([...storyInfos.values()].filter((info) => info.partUri === partUri).map((info) => info.shardId));
|
|
449462
449692
|
const snapshot3 = readRoomManifest(options.rootDoc).snapshot;
|
|
449463
449693
|
for (const descriptor of snapshot3?.shards ?? []) {
|
|
449464
|
-
if (descriptor.shardKind === SHARD_KIND.story && descriptor.story?.sourcePartKey ===
|
|
449694
|
+
if (descriptor.shardKind === SHARD_KIND.story && descriptor.story?.sourcePartKey === partKey2) {
|
|
449465
449695
|
shardIds.add(descriptor.shardId);
|
|
449466
449696
|
}
|
|
449467
449697
|
}
|
|
449468
449698
|
options.rootDoc.transact(() => {
|
|
449469
|
-
getPackagePartsMap(options.rootDoc).delete(
|
|
449699
|
+
getPackagePartsMap(options.rootDoc).delete(partKey2);
|
|
449470
449700
|
for (const shardId of shardIds)
|
|
449471
449701
|
deleteShardDescriptor(options.rootDoc, shardId);
|
|
449472
449702
|
}, "headless:collab-v2:manifest-retire-story");
|
|
@@ -449658,12 +449888,12 @@ function shardKindForPackagePartUri(partUri) {
|
|
|
449658
449888
|
function isOpaqueManifestPartKind(partKind) {
|
|
449659
449889
|
return partKind === "customXml" || partKind === "customXmlProps" || partKind === "docProps" || partKind === "docProps-core" || partKind === "docProps-app" || partKind === "docProps-custom" || partKind === "fontTable" || partKind === "theme" || partKind === "webExtension" || partKind === "chart" || partKind === "diagram" || partKind === "comments-extensible" || partKind === "threaded-comments" || partKind === "unknown";
|
|
449660
449890
|
}
|
|
449661
|
-
function toManifestPartDescriptor(
|
|
449891
|
+
function toManifestPartDescriptor(partKey2, value2) {
|
|
449662
449892
|
if (!value2 || typeof value2 !== "object" || value2 instanceof YMap)
|
|
449663
449893
|
return null;
|
|
449664
449894
|
const record3 = value2;
|
|
449665
449895
|
return {
|
|
449666
|
-
partKey,
|
|
449896
|
+
partKey: partKey2,
|
|
449667
449897
|
partUri: String(record3.partUri ?? ""),
|
|
449668
449898
|
partKind: String(record3.partKind ?? ""),
|
|
449669
449899
|
contentType: record3.contentType == null ? null : String(record3.contentType),
|
|
@@ -450328,15 +450558,15 @@ function xmlEscape2(value2) {
|
|
|
450328
450558
|
}
|
|
450329
450559
|
function listManifestPartUris(rootDoc, partKinds) {
|
|
450330
450560
|
const out = [];
|
|
450331
|
-
for (const [
|
|
450332
|
-
const descriptor = toManifestPartDescriptor(
|
|
450561
|
+
for (const [partKey2, rawValue] of getPackagePartsMap(rootDoc).entries()) {
|
|
450562
|
+
const descriptor = toManifestPartDescriptor(partKey2, rawValue);
|
|
450333
450563
|
if (!descriptor || !partKinds.includes(descriptor.partKind))
|
|
450334
450564
|
continue;
|
|
450335
450565
|
out.push(descriptor.partUri);
|
|
450336
450566
|
}
|
|
450337
450567
|
return out;
|
|
450338
450568
|
}
|
|
450339
|
-
var
|
|
450569
|
+
var TEXT_DECODER11, CONTENT_TYPES_PART_URI17 = "/[Content_Types].xml", NUMBERING_PART_URI6 = "/word/numbering.xml", SETTINGS_PART_URI6 = "/word/settings.xml", WEB_SETTINGS_PART_URI = "/word/webSettings.xml", MAIN_DOCUMENT_PART_URI2 = "/word/document.xml", MAIN_DOCUMENT_RELS_PART_URI = "/word/_rels/document.xml.rels", ROOT_RELS_PART_URI = "/_rels/.rels", COMMENTS_PART_URI5 = "/word/comments.xml", COMMENTS_EXTENDED_PART_URI5 = "/word/commentsExtended.xml", COMMENTS_IDS_PART_URI5 = "/word/commentsIds.xml", PEOPLE_PART_URI = "/word/people.xml", NOTES_FOOTNOTES_URI = "/word/footnotes.xml", NOTES_ENDNOTES_URI = "/word/endnotes.xml", MEDIA_OWNER_URI = "/word/media", REL_CONTENT_TYPE = "application/vnd.openxmlformats-package.relationships+xml", COMMENTS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", COMMENTS_EXTENDED_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", COMMENTS_IDS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", PEOPLE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", NUMBERING_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", IMAGE_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HYPERLINK_REL_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", NUMBERING_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", FIRST_LIST_LEVEL_OPAQUE_XML = '<w:lvlJc w:val="left"/><w:pPr><w:ind w:left="720" w:hanging="360"/></w:pPr>';
|
|
450340
450570
|
var init_collaboration_v2_room_coordinator = __esm(() => {
|
|
450341
450571
|
init_yjs();
|
|
450342
450572
|
init_dist9();
|
|
@@ -450344,7 +450574,7 @@ var init_collaboration_v2_room_coordinator = __esm(() => {
|
|
|
450344
450574
|
init_collaboration_v2_room_state();
|
|
450345
450575
|
init_sd_document_session_internal();
|
|
450346
450576
|
init_dist9();
|
|
450347
|
-
|
|
450577
|
+
TEXT_DECODER11 = new TextDecoder("utf-8", { fatal: false });
|
|
450348
450578
|
});
|
|
450349
450579
|
|
|
450350
450580
|
// ../../../v2/headless/dist/internal/collaboration-v2-runtime.js
|
|
@@ -451252,8 +451482,8 @@ function createOpenTrace(rootId) {
|
|
|
451252
451482
|
const mainBytes = getSDDocumentSessionInternalPartBytes(session, "/word/document.xml");
|
|
451253
451483
|
const mainIndex = getSDDocumentSessionInternalParagraphIndex(session);
|
|
451254
451484
|
const first = mainIndex?.entries[0] ?? null;
|
|
451255
|
-
const firstXml = first && mainBytes ?
|
|
451256
|
-
const mainXml = mainBytes ?
|
|
451485
|
+
const firstXml = first && mainBytes ? TEXT_DECODER12.decode(mainBytes.subarray(first.byteStart, first.byteEnd)) : "";
|
|
451486
|
+
const mainXml = mainBytes ? TEXT_DECODER12.decode(mainBytes) : "";
|
|
451257
451487
|
writeTraceLine(`[v2:open-collab] ${rootId} ${label} ` + `mainBytes=${mainBytes?.byteLength ?? -1} ` + `paragraphs=${mainIndex?.entries.length ?? -1} ` + `firstRange=${first ? `${first.byteStart}-${first.byteEnd}` : "none"} ` + `firstText=${JSON.stringify(firstXml.replace(/<[^>]+>/g, "").slice(0, 80))} ` + `borrowerOffset=${mainXml.indexOf("Borrower:")}
|
|
451258
451488
|
`);
|
|
451259
451489
|
}
|
|
@@ -451295,7 +451525,7 @@ async function buildCanonicalShardGraph(input) {
|
|
|
451295
451525
|
await waitForStoryShardSeeded(rootDoc, shardId);
|
|
451296
451526
|
unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.story });
|
|
451297
451527
|
}
|
|
451298
|
-
const storyBootstrap = bytes ? bootstrapStoryProjection(
|
|
451528
|
+
const storyBootstrap = bytes ? bootstrapStoryProjection(TEXT_DECODER12.decode(bytes), story.storyKind, {
|
|
451299
451529
|
includeSourceXml: true
|
|
451300
451530
|
}) : undefined;
|
|
451301
451531
|
if (input.retainImportedStorySources && maySeedStoryShardsFromLocalSource && storyBootstrap) {
|
|
@@ -451500,7 +451730,7 @@ async function connectRelationshipsShard(rootDoc, shardId, part) {
|
|
|
451500
451730
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.relationships });
|
|
451501
451731
|
if (part.bytes) {
|
|
451502
451732
|
const ownerPartUri2 = ownerPartUriForRels3(part.partUri);
|
|
451503
|
-
const xml =
|
|
451733
|
+
const xml = TEXT_DECODER12.decode(part.bytes);
|
|
451504
451734
|
const parsed = parseRelationshipsXml(xml, {
|
|
451505
451735
|
ownerPartUri: ownerPartUri2,
|
|
451506
451736
|
relsUri: part.partUri,
|
|
@@ -451532,7 +451762,7 @@ async function connectRelationshipsShard(rootDoc, shardId, part) {
|
|
|
451532
451762
|
async function connectContentTypesShard(rootDoc, shardId, part) {
|
|
451533
451763
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.contentTypes });
|
|
451534
451764
|
if (part.bytes) {
|
|
451535
|
-
const parsed = parseContentTypes(
|
|
451765
|
+
const parsed = parseContentTypes(TEXT_DECODER12.decode(part.bytes));
|
|
451536
451766
|
try {
|
|
451537
451767
|
seedContentTypesShard({
|
|
451538
451768
|
doc: unit,
|
|
@@ -451543,8 +451773,8 @@ async function connectContentTypesShard(rootDoc, shardId, part) {
|
|
|
451543
451773
|
extension: extension2,
|
|
451544
451774
|
contentType
|
|
451545
451775
|
})),
|
|
451546
|
-
overrides: Array.from(parsed.overrides.entries()).map(([
|
|
451547
|
-
partKey,
|
|
451776
|
+
overrides: Array.from(parsed.overrides.entries()).map(([partKey2, contentType]) => ({
|
|
451777
|
+
partKey: partKey2,
|
|
451548
451778
|
contentType
|
|
451549
451779
|
}))
|
|
451550
451780
|
});
|
|
@@ -451559,7 +451789,7 @@ async function connectStylesShard(rootDoc, shardId, part) {
|
|
|
451559
451789
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.styles });
|
|
451560
451790
|
let bootstrap;
|
|
451561
451791
|
if (part.bytes) {
|
|
451562
|
-
const xml =
|
|
451792
|
+
const xml = TEXT_DECODER12.decode(part.bytes);
|
|
451563
451793
|
const parsed = parseStylesPart3(xml);
|
|
451564
451794
|
bootstrap = bootstrapPartProjection(xml);
|
|
451565
451795
|
try {
|
|
@@ -451582,7 +451812,7 @@ async function connectNumberingShard(rootDoc, shardId, part, numbering) {
|
|
|
451582
451812
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.numbering });
|
|
451583
451813
|
let bootstrap;
|
|
451584
451814
|
if (part.bytes) {
|
|
451585
|
-
bootstrap = bootstrapPartProjection(
|
|
451815
|
+
bootstrap = bootstrapPartProjection(TEXT_DECODER12.decode(part.bytes));
|
|
451586
451816
|
}
|
|
451587
451817
|
if (part.bytes && numbering.present) {
|
|
451588
451818
|
try {
|
|
@@ -451622,8 +451852,8 @@ async function connectNumberingShard(rootDoc, shardId, part, numbering) {
|
|
|
451622
451852
|
}
|
|
451623
451853
|
async function connectSettingsShard(rootDoc, shardId, settingsPart, webSettingsPart) {
|
|
451624
451854
|
const unit = createCollabUnitHandle({ rootDoc, shardId, shardKind: SHARD_KIND.settings });
|
|
451625
|
-
const settingsBootstrap = settingsPart?.bytes ? bootstrapPartProjection(
|
|
451626
|
-
const webSettingsBootstrap = webSettingsPart?.bytes ? bootstrapPartProjection(
|
|
451855
|
+
const settingsBootstrap = settingsPart?.bytes ? bootstrapPartProjection(TEXT_DECODER12.decode(settingsPart.bytes)) : null;
|
|
451856
|
+
const webSettingsBootstrap = webSettingsPart?.bytes ? bootstrapPartProjection(TEXT_DECODER12.decode(webSettingsPart.bytes)) : null;
|
|
451627
451857
|
if (settingsPart?.bytes || webSettingsPart?.bytes) {
|
|
451628
451858
|
try {
|
|
451629
451859
|
seedSettingsShard({
|
|
@@ -451635,8 +451865,8 @@ async function connectSettingsShard(rootDoc, shardId, settingsPart, webSettingsP
|
|
|
451635
451865
|
settings: {
|
|
451636
451866
|
fields: {},
|
|
451637
451867
|
webFields: {},
|
|
451638
|
-
opaqueXml: settingsPart?.bytes ? innerXmlOfRoot2(
|
|
451639
|
-
webOpaqueXml: webSettingsPart?.bytes ? innerXmlOfRoot2(
|
|
451868
|
+
opaqueXml: settingsPart?.bytes ? innerXmlOfRoot2(TEXT_DECODER12.decode(settingsPart.bytes)) : null,
|
|
451869
|
+
webOpaqueXml: webSettingsPart?.bytes ? innerXmlOfRoot2(TEXT_DECODER12.decode(webSettingsPart.bytes)) : null
|
|
451640
451870
|
}
|
|
451641
451871
|
});
|
|
451642
451872
|
} catch (error50) {
|
|
@@ -452103,7 +452333,7 @@ function formatLateJoinValidationFailure(validation) {
|
|
|
452103
452333
|
const diagnostics = validation.diagnostics.length > 0 ? validation.diagnostics.map((diagnostic2) => `${diagnostic2.code}: ${diagnostic2.message}`).join("; ") : "no diagnostics reported";
|
|
452104
452334
|
return `v2 collaboration late-join validation failed (${validation.classification.classification}, ${readiness}): ${diagnostics}`;
|
|
452105
452335
|
}
|
|
452106
|
-
var
|
|
452336
|
+
var TEXT_DECODER12, REPLACEMENT_REQUEST_KEY_PREFIX = "replaceFile:", REPLACEMENT_HEARTBEAT_INTERVAL_MS = 5000, REPLACEMENT_LEASE_TIMEOUT_MS = 30000, BOOTSTRAP_HEARTBEAT_INTERVAL_MS = 5000, BOOTSTRAP_LEASE_TIMEOUT_MS = 30000, BOOTSTRAP_LEASE_KEY_PREFIX = "bootstrapSeed:", SETTINGS_PART_URI7 = "/word/settings.xml", WEB_SETTINGS_PART_URI2 = "/word/webSettings.xml", COMMENTS_PART_URI6 = "/word/comments.xml", COMMENTS_EXTENDED_PART_URI6 = "/word/commentsExtended.xml", COMMENTS_IDS_PART_URI6 = "/word/commentsIds.xml", PEOPLE_PART_URI2 = "/word/people.xml", MEDIA_OWNER_URI2 = "/word/media", INLINE_BINARY_FAMILIES, OPAQUE_PART_FAMILIES, DEFAULT_OPEN_INTENT, POST_SYNC_SETTLE_MAX_MS = 1000, POST_SYNC_QUIET_WINDOW_MS = 20, replacementSequence = 0, replacementHeartbeatObservations;
|
|
452107
452337
|
var init_collaboration_v2_open = __esm(() => {
|
|
452108
452338
|
init_dist9();
|
|
452109
452339
|
init_setup();
|
|
@@ -452114,7 +452344,7 @@ var init_collaboration_v2_open = __esm(() => {
|
|
|
452114
452344
|
init_yjs();
|
|
452115
452345
|
init_collaboration_v2_room_state();
|
|
452116
452346
|
init_collaboration_v2_runtime();
|
|
452117
|
-
|
|
452347
|
+
TEXT_DECODER12 = new TextDecoder("utf-8", { fatal: false });
|
|
452118
452348
|
INLINE_BINARY_FAMILIES = new Set(["image", "media", "embedded", "oleObject", "vbaProject", "vbaData"]);
|
|
452119
452349
|
OPAQUE_PART_FAMILIES = new Set([
|
|
452120
452350
|
"fontTable",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.6.0-next.
|
|
3
|
+
"version": "1.6.0-next.15",
|
|
4
4
|
"description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
-
"@superdoc/sdk": "2.19.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.19.0-next.15",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.22.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.21.0-next.
|
|
32
|
+
"superdoc": "2.22.0-next.14",
|
|
33
|
+
"@superdoc/docx-engine": "0.21.0-next.15",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|