@superdoc/mcp 1.6.0-next.12 → 1.6.0-next.13
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 +622 -319
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31443,7 +31443,7 @@ var init_host = __esm(() => {
|
|
|
31443
31443
|
});
|
|
31444
31444
|
|
|
31445
31445
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31446
|
-
var SDK_VERSION = "2.19.0-next.
|
|
31446
|
+
var SDK_VERSION = "2.19.0-next.13";
|
|
31447
31447
|
|
|
31448
31448
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31449
31449
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -200399,7 +200399,8 @@ function commitTracked(input, view) {
|
|
|
200399
200399
|
storyId: op.on.storyId
|
|
200400
200400
|
}));
|
|
200401
200401
|
const followsDeletedManualBreak = isPureTrackedInsert(op) && op.on.coordinateSpace === "tracked" && parseParagraphInlineMap(paragraphXml).leaves().some((leaf) => leaf.kind === "control" && leaf.control === "br" && leaf.deleted && leaf.trackedEnd === op.on.startOffset);
|
|
200402
|
-
const
|
|
200402
|
+
const sharesDeletedTextBoundary = isPureTrackedInsert(op) && visibleStartOffset !== null && parseParagraphInlineMap(paragraphXml).leaves().some((leaf) => leaf.kind === "text" && leaf.textRole === "deleted" && leaf.decodedText.length > 0 && leaf.visibleStart === visibleStartOffset && leaf.visibleEnd === visibleStartOffset);
|
|
200403
|
+
const resyncFromSession = usedSpanningDelete || usedBookmarkDelete || spansLiveInlineControl || usedTrackedControlRunFallback || followsDeletedManualBreak || sharesDeletedTextBoundary;
|
|
200403
200404
|
return finalizeCommit({
|
|
200404
200405
|
input,
|
|
200405
200406
|
perPart,
|
|
@@ -278090,7 +278091,12 @@ function projectAffectedRefs(refs, trackedChangeIdProjector) {
|
|
|
278090
278091
|
projected.push({ kind: "block", nodeId: ref5.nodeId });
|
|
278091
278092
|
break;
|
|
278092
278093
|
case "text":
|
|
278093
|
-
projected.push({
|
|
278094
|
+
projected.push({
|
|
278095
|
+
kind: "text",
|
|
278096
|
+
blockId: ref5.blockId,
|
|
278097
|
+
range: ref5.range,
|
|
278098
|
+
...ref5.storyId?.startsWith("main:") && ref5.range.start === 0 && ref5.range.end === 0 ? { story: { kind: "story", storyType: "body" } } : {}
|
|
278099
|
+
});
|
|
278094
278100
|
break;
|
|
278095
278101
|
default:
|
|
278096
278102
|
break;
|
|
@@ -330538,6 +330544,275 @@ var init_raw_block_ref = __esm(() => {
|
|
|
330538
330544
|
init_story_surface();
|
|
330539
330545
|
});
|
|
330540
330546
|
|
|
330547
|
+
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-body-replacement.js
|
|
330548
|
+
function prepareTrackedBodyReplacement(input) {
|
|
330549
|
+
if (!input.context.readAuthor()?.name)
|
|
330550
|
+
return {
|
|
330551
|
+
ok: false,
|
|
330552
|
+
code: "PRECONDITION_FAILED",
|
|
330553
|
+
message: "Tracked body replacement requires an author."
|
|
330554
|
+
};
|
|
330555
|
+
const before = readBody(input.beforeXml);
|
|
330556
|
+
const after = readBody(input.afterXml);
|
|
330557
|
+
if (!before || !after || before.sectionProperties !== after.sectionProperties) {
|
|
330558
|
+
return {
|
|
330559
|
+
ok: false,
|
|
330560
|
+
code: "CAPABILITY_UNAVAILABLE",
|
|
330561
|
+
message: "Tracked body replacement requires unchanged body section properties."
|
|
330562
|
+
};
|
|
330563
|
+
}
|
|
330564
|
+
const replacement = prepareTrackedBlockRangeReplacement({
|
|
330565
|
+
...input,
|
|
330566
|
+
beforeXml: before.content,
|
|
330567
|
+
afterXml: after.content,
|
|
330568
|
+
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings))
|
|
330569
|
+
});
|
|
330570
|
+
if (!replacement.ok)
|
|
330571
|
+
return replacement;
|
|
330572
|
+
if (input.dryRun)
|
|
330573
|
+
return { ...replacement, xml: input.beforeXml };
|
|
330574
|
+
return {
|
|
330575
|
+
...replacement,
|
|
330576
|
+
xml: input.beforeXml.slice(0, before.body.openEnd) + replacement.xml + before.sectionProperties + input.beforeXml.slice(before.body.closeStart)
|
|
330577
|
+
};
|
|
330578
|
+
}
|
|
330579
|
+
function readBody(xml) {
|
|
330580
|
+
const parsed = collectXmlElementRanges(xml);
|
|
330581
|
+
if (parsed.errors.length)
|
|
330582
|
+
return null;
|
|
330583
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS3 && range.tag.localName === "body");
|
|
330584
|
+
if (!body || body.tag.isSelfClosing)
|
|
330585
|
+
return null;
|
|
330586
|
+
const children2 = [];
|
|
330587
|
+
let cursor = body.openEnd;
|
|
330588
|
+
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start || b.end - a.end)) {
|
|
330589
|
+
if (range.start < cursor || range.end > body.closeStart)
|
|
330590
|
+
continue;
|
|
330591
|
+
if (xml.slice(cursor, range.start).trim())
|
|
330592
|
+
return null;
|
|
330593
|
+
children2.push(range);
|
|
330594
|
+
cursor = range.end;
|
|
330595
|
+
}
|
|
330596
|
+
if (xml.slice(cursor, body.closeStart).trim())
|
|
330597
|
+
return null;
|
|
330598
|
+
const last = children2.at(-1);
|
|
330599
|
+
const sectionStart = last?.tag.localName === "sectPr" && last.tag.namespaceUri === WORD_NS3 ? last.start : body.closeStart;
|
|
330600
|
+
return {
|
|
330601
|
+
body,
|
|
330602
|
+
children: children2,
|
|
330603
|
+
content: xml.slice(body.openEnd, sectionStart),
|
|
330604
|
+
sectionProperties: xml.slice(sectionStart, body.closeStart)
|
|
330605
|
+
};
|
|
330606
|
+
}
|
|
330607
|
+
var WORD_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
330608
|
+
var init_tracked_body_replacement = __esm(() => {
|
|
330609
|
+
init_sd_document_session_internal();
|
|
330610
|
+
init_tracked_block_range();
|
|
330611
|
+
});
|
|
330612
|
+
|
|
330613
|
+
// ../../../v2/document-api-v2-adapter/dist/core/clear-content-adapter.js
|
|
330614
|
+
class V2ClearContentAdapter {
|
|
330615
|
+
constructor(context) {
|
|
330616
|
+
this.context = context;
|
|
330617
|
+
}
|
|
330618
|
+
clearContent(_input, options) {
|
|
330619
|
+
return this.clearBody(options);
|
|
330620
|
+
}
|
|
330621
|
+
clearSelection(blockIds, options) {
|
|
330622
|
+
return this.clearBody(options, blockIds);
|
|
330623
|
+
}
|
|
330624
|
+
clearBody(options, selectedBlockIds) {
|
|
330625
|
+
const expectedRevision = options?.expectedRevision != null ? String(options.expectedRevision) : undefined;
|
|
330626
|
+
const mutationFailure2 = this.context.validateMutation(options);
|
|
330627
|
+
if (mutationFailure2)
|
|
330628
|
+
return { success: false, failure: mutationFailure2 };
|
|
330629
|
+
const bodyStory = this.context.resolveFullStoryLocator({ kind: "story", storyType: "body" });
|
|
330630
|
+
if ("error" in bodyStory) {
|
|
330631
|
+
return {
|
|
330632
|
+
success: false,
|
|
330633
|
+
failure: {
|
|
330634
|
+
code: "TARGET_NOT_FOUND",
|
|
330635
|
+
message: `body story could not be resolved: ${bodyStory.error}.`
|
|
330636
|
+
}
|
|
330637
|
+
};
|
|
330638
|
+
}
|
|
330639
|
+
const topLevelItems = readTopLevelBodyItems(this.context);
|
|
330640
|
+
const imagesByPara = readBodyParagraphImageMap(this.context);
|
|
330641
|
+
if (isAlreadyClear(topLevelItems, imagesByPara)) {
|
|
330642
|
+
return { success: true, status: "NO_OP" };
|
|
330643
|
+
}
|
|
330644
|
+
const bytes = getSDDocumentSessionInternalPartBytes(this.context.session, bodyStory.partUri);
|
|
330645
|
+
if (!bytes) {
|
|
330646
|
+
return {
|
|
330647
|
+
success: false,
|
|
330648
|
+
failure: { code: "PRECONDITION_FAILED", message: "body part bytes are unavailable." }
|
|
330649
|
+
};
|
|
330650
|
+
}
|
|
330651
|
+
const sourceXml = new TextDecoder().decode(bytes);
|
|
330652
|
+
const paragraphId2 = selectedBlockIds ? getSDDocumentSessionInternalParagraphIndex(this.context.session)?.entries.find((entry) => entry.directBodyChildOrdinal != null)?.blockId ?? selectedBlockIds.at(-1) ?? "00000000" : firstParagraphId(topLevelItems);
|
|
330653
|
+
const removedBlockIds = selectedBlockIds?.filter((blockId) => blockId !== paragraphId2) ?? [];
|
|
330654
|
+
const remappedRefs = selectedBlockIds ? [
|
|
330655
|
+
{
|
|
330656
|
+
from: {
|
|
330657
|
+
kind: "text",
|
|
330658
|
+
blockId: selectedBlockIds[0],
|
|
330659
|
+
range: { start: 0, end: 0 },
|
|
330660
|
+
storyId: bodyStory.storyId
|
|
330661
|
+
},
|
|
330662
|
+
to: {
|
|
330663
|
+
kind: "text",
|
|
330664
|
+
blockId: paragraphId2,
|
|
330665
|
+
range: { start: 0, end: 0 },
|
|
330666
|
+
storyId: bodyStory.storyId
|
|
330667
|
+
}
|
|
330668
|
+
}
|
|
330669
|
+
] : [];
|
|
330670
|
+
let nextXml = rewriteBodyToSingleEmptyParagraph(sourceXml, paragraphId2);
|
|
330671
|
+
if (nextXml == null) {
|
|
330672
|
+
return {
|
|
330673
|
+
success: false,
|
|
330674
|
+
failure: { code: "INTERNAL_ERROR", message: "document body could not be rewritten." }
|
|
330675
|
+
};
|
|
330676
|
+
}
|
|
330677
|
+
const changeMode = options?.changeMode ?? "direct";
|
|
330678
|
+
const createdRefs = [];
|
|
330679
|
+
if (changeMode === "tracked") {
|
|
330680
|
+
const replacement = prepareTrackedBodyReplacement({
|
|
330681
|
+
context: this.context,
|
|
330682
|
+
beforeXml: sourceXml,
|
|
330683
|
+
afterXml: nextXml,
|
|
330684
|
+
dryRun: options?.dryRun
|
|
330685
|
+
});
|
|
330686
|
+
if (!replacement.ok) {
|
|
330687
|
+
return { success: false, failure: { code: replacement.code, message: replacement.message } };
|
|
330688
|
+
}
|
|
330689
|
+
nextXml = replacement.xml;
|
|
330690
|
+
createdRefs.push(...replacement.wordIds.map((entityId) => ({
|
|
330691
|
+
kind: "trackedChange",
|
|
330692
|
+
entityId,
|
|
330693
|
+
storyId: bodyStory.storyId
|
|
330694
|
+
})));
|
|
330695
|
+
createdRefs.push(...replacement.paragraphIds.map((nodeId) => ({
|
|
330696
|
+
kind: "block",
|
|
330697
|
+
nodeId,
|
|
330698
|
+
storyId: bodyStory.storyId
|
|
330699
|
+
})));
|
|
330700
|
+
}
|
|
330701
|
+
if (options?.dryRun)
|
|
330702
|
+
return { success: true };
|
|
330703
|
+
const nextBytes = TE49.encode(nextXml);
|
|
330704
|
+
const committed = commitKernelStorySurfacePatch({
|
|
330705
|
+
context: this.context,
|
|
330706
|
+
txIdPrefix: selectedBlockIds ? "range-ref-whole-body-replace" : "internal-clearContent",
|
|
330707
|
+
expectedRevision,
|
|
330708
|
+
perPart: {
|
|
330709
|
+
[bodyStory.partUri]: replaceWholePartEntry(bytes, nextBytes)
|
|
330710
|
+
},
|
|
330711
|
+
storyIds: [bodyStory.storyId],
|
|
330712
|
+
createdRefs,
|
|
330713
|
+
remappedRefs,
|
|
330714
|
+
invalidatedRefs: removedBlockIds.map((nodeId) => ({ kind: "block", nodeId, storyId: bodyStory.storyId })),
|
|
330715
|
+
signalLanesToRebuild: ["paragraphIndex", "sections", "headings", "manualPageBreaks", "drawings", "noteAnchorRefs"],
|
|
330716
|
+
indexRefreshScope: {
|
|
330717
|
+
perPart: {
|
|
330718
|
+
[bodyStory.partUri]: {
|
|
330719
|
+
beforeWindow: { startByte: 0, endByte: bytes.length },
|
|
330720
|
+
kind: "wide-rewrite",
|
|
330721
|
+
reason: "clear-content-whole-body-rewrite"
|
|
330722
|
+
}
|
|
330723
|
+
}
|
|
330724
|
+
},
|
|
330725
|
+
storySurface: {
|
|
330726
|
+
family: "storyBlocks",
|
|
330727
|
+
...selectedBlockIds ? { targetBlockIds: [...selectedBlockIds] } : {},
|
|
330728
|
+
changeMode
|
|
330729
|
+
}
|
|
330730
|
+
});
|
|
330731
|
+
if (!committed.ok) {
|
|
330732
|
+
return {
|
|
330733
|
+
success: false,
|
|
330734
|
+
failure: {
|
|
330735
|
+
code: committed.code,
|
|
330736
|
+
message: committed.message
|
|
330737
|
+
}
|
|
330738
|
+
};
|
|
330739
|
+
}
|
|
330740
|
+
const inserted = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
330741
|
+
const receipt3 = {
|
|
330742
|
+
success: true,
|
|
330743
|
+
txId: committed.txId,
|
|
330744
|
+
affectedStories: [{ kind: "story", storyType: "body" }],
|
|
330745
|
+
...selectedBlockIds ? {
|
|
330746
|
+
remappedRefs: remappedRefs.map(({ from, to }) => ({
|
|
330747
|
+
from: {
|
|
330748
|
+
kind: "text",
|
|
330749
|
+
blockId: from.blockId,
|
|
330750
|
+
range: from.range,
|
|
330751
|
+
story: { kind: "story", storyType: "body" }
|
|
330752
|
+
},
|
|
330753
|
+
to: {
|
|
330754
|
+
kind: "text",
|
|
330755
|
+
blockId: to.blockId,
|
|
330756
|
+
range: to.range,
|
|
330757
|
+
story: { kind: "story", storyType: "body" }
|
|
330758
|
+
}
|
|
330759
|
+
})),
|
|
330760
|
+
invalidatedRefs: removedBlockIds.map((nodeId) => ({ kind: "block", nodeId, story: { kind: "story", storyType: "body" } }))
|
|
330761
|
+
} : {},
|
|
330762
|
+
...inserted.length ? { inserted } : {}
|
|
330763
|
+
};
|
|
330764
|
+
const renderCommit = getSDRenderCommitEnvelope(committed);
|
|
330765
|
+
if (renderCommit)
|
|
330766
|
+
attachSDRenderCommitEnvelope(receipt3, renderCommit);
|
|
330767
|
+
return receipt3;
|
|
330768
|
+
}
|
|
330769
|
+
}
|
|
330770
|
+
function isAlreadyClear(items, imagesByPara) {
|
|
330771
|
+
if (items.length !== 1 || items[0]?.kind !== "paragraph")
|
|
330772
|
+
return false;
|
|
330773
|
+
const paragraph3 = items[0].paragraph;
|
|
330774
|
+
return paragraph3.text.length === 0 && (imagesByPara.get(paragraph3.blockId)?.length ?? 0) === 0;
|
|
330775
|
+
}
|
|
330776
|
+
function firstParagraphId(items) {
|
|
330777
|
+
const paragraph3 = items.find((item) => item.kind === "paragraph");
|
|
330778
|
+
return paragraph3?.paragraph.blockId ?? "00000000";
|
|
330779
|
+
}
|
|
330780
|
+
function rewriteBodyToSingleEmptyParagraph(xml, paragraphId2) {
|
|
330781
|
+
const parsed = collectXmlElementRanges(xml);
|
|
330782
|
+
if (parsed.errors.length)
|
|
330783
|
+
return null;
|
|
330784
|
+
const body = parsed.ranges.find(({ tag }) => (tag.namespaceUri === WORD_NS4 || tag.namespaceUri === STRICT_WORD_NS) && tag.localName === "body" && tag.prefix);
|
|
330785
|
+
if (!body || body.tag.isSelfClosing)
|
|
330786
|
+
return null;
|
|
330787
|
+
let trailingBodyChild;
|
|
330788
|
+
for (const range of parsed.ranges) {
|
|
330789
|
+
if (range.start >= body.openEnd && range.end <= body.closeStart && (!trailingBodyChild || range.end > trailingBodyChild.end)) {
|
|
330790
|
+
trailingBodyChild = range;
|
|
330791
|
+
}
|
|
330792
|
+
}
|
|
330793
|
+
const sectPrXml = trailingBodyChild?.tag.localName === "sectPr" && (trailingBodyChild.tag.namespaceUri === WORD_NS4 || trailingBodyChild.tag.namespaceUri === STRICT_WORD_NS) ? xml.slice(trailingBodyChild.start, trailingBodyChild.end) : "";
|
|
330794
|
+
const wordPrefix = body.tag.prefix;
|
|
330795
|
+
let identityPrefix = Object.entries(body.namespaceBindings).find(([prefix, uri]) => prefix && uri === WORD_2010_NS)?.[0];
|
|
330796
|
+
let identityNamespace = "";
|
|
330797
|
+
if (!identityPrefix) {
|
|
330798
|
+
identityPrefix = "w14";
|
|
330799
|
+
while (body.namespaceBindings[identityPrefix])
|
|
330800
|
+
identityPrefix += "sd";
|
|
330801
|
+
identityNamespace = ` xmlns:${identityPrefix}="${WORD_2010_NS}"`;
|
|
330802
|
+
}
|
|
330803
|
+
const emptyParagraph = `<${wordPrefix}:p${identityNamespace} ${identityPrefix}:paraId="${paragraphId2}">` + `<${wordPrefix}:r><${wordPrefix}:t></${wordPrefix}:t></${wordPrefix}:r></${wordPrefix}:p>`;
|
|
330804
|
+
return `${xml.slice(0, body.openEnd)}${emptyParagraph}${sectPrXml}${xml.slice(body.closeStart)}`;
|
|
330805
|
+
}
|
|
330806
|
+
var TE49, WORD_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", STRICT_WORD_NS = "http://purl.oclc.org/ooxml/wordprocessingml/main", WORD_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
330807
|
+
var init_clear_content_adapter = __esm(() => {
|
|
330808
|
+
init_sd_document_session_internal();
|
|
330809
|
+
init_document_reader();
|
|
330810
|
+
init_xml();
|
|
330811
|
+
init_tracked_body_replacement();
|
|
330812
|
+
init_receipt_entities();
|
|
330813
|
+
TE49 = new TextEncoder;
|
|
330814
|
+
});
|
|
330815
|
+
|
|
330541
330816
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/replacement-span.js
|
|
330542
330817
|
function uniqueTokenAnchors(before, after) {
|
|
330543
330818
|
const uniquePositions = (tokens) => {
|
|
@@ -331193,72 +331468,6 @@ var init_adapter8 = __esm(() => {
|
|
|
331193
331468
|
TD90 = new TextDecoder;
|
|
331194
331469
|
});
|
|
331195
331470
|
|
|
331196
|
-
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-body-replacement.js
|
|
331197
|
-
function prepareTrackedBodyReplacement(input) {
|
|
331198
|
-
if (!input.context.readAuthor()?.name)
|
|
331199
|
-
return {
|
|
331200
|
-
ok: false,
|
|
331201
|
-
code: "PRECONDITION_FAILED",
|
|
331202
|
-
message: "Tracked body replacement requires an author."
|
|
331203
|
-
};
|
|
331204
|
-
const before = readBody(input.beforeXml);
|
|
331205
|
-
const after = readBody(input.afterXml);
|
|
331206
|
-
if (!before || !after || before.sectionProperties !== after.sectionProperties) {
|
|
331207
|
-
return {
|
|
331208
|
-
ok: false,
|
|
331209
|
-
code: "CAPABILITY_UNAVAILABLE",
|
|
331210
|
-
message: "Tracked body replacement requires unchanged body section properties."
|
|
331211
|
-
};
|
|
331212
|
-
}
|
|
331213
|
-
const replacement = prepareTrackedBlockRangeReplacement({
|
|
331214
|
-
...input,
|
|
331215
|
-
beforeXml: before.content,
|
|
331216
|
-
afterXml: after.content,
|
|
331217
|
-
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings))
|
|
331218
|
-
});
|
|
331219
|
-
if (!replacement.ok)
|
|
331220
|
-
return replacement;
|
|
331221
|
-
if (input.dryRun)
|
|
331222
|
-
return { ...replacement, xml: input.beforeXml };
|
|
331223
|
-
return {
|
|
331224
|
-
...replacement,
|
|
331225
|
-
xml: input.beforeXml.slice(0, before.body.openEnd) + replacement.xml + before.sectionProperties + input.beforeXml.slice(before.body.closeStart)
|
|
331226
|
-
};
|
|
331227
|
-
}
|
|
331228
|
-
function readBody(xml) {
|
|
331229
|
-
const parsed = collectXmlElementRanges(xml);
|
|
331230
|
-
if (parsed.errors.length)
|
|
331231
|
-
return null;
|
|
331232
|
-
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS3 && range.tag.localName === "body");
|
|
331233
|
-
if (!body || body.tag.isSelfClosing)
|
|
331234
|
-
return null;
|
|
331235
|
-
const children2 = [];
|
|
331236
|
-
let cursor = body.openEnd;
|
|
331237
|
-
for (const range of [...parsed.ranges].sort((a, b) => a.start - b.start || b.end - a.end)) {
|
|
331238
|
-
if (range.start < cursor || range.end > body.closeStart)
|
|
331239
|
-
continue;
|
|
331240
|
-
if (xml.slice(cursor, range.start).trim())
|
|
331241
|
-
return null;
|
|
331242
|
-
children2.push(range);
|
|
331243
|
-
cursor = range.end;
|
|
331244
|
-
}
|
|
331245
|
-
if (xml.slice(cursor, body.closeStart).trim())
|
|
331246
|
-
return null;
|
|
331247
|
-
const last = children2.at(-1);
|
|
331248
|
-
const sectionStart = last?.tag.localName === "sectPr" && last.tag.namespaceUri === WORD_NS3 ? last.start : body.closeStart;
|
|
331249
|
-
return {
|
|
331250
|
-
body,
|
|
331251
|
-
children: children2,
|
|
331252
|
-
content: xml.slice(body.openEnd, sectionStart),
|
|
331253
|
-
sectionProperties: xml.slice(sectionStart, body.closeStart)
|
|
331254
|
-
};
|
|
331255
|
-
}
|
|
331256
|
-
var WORD_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
331257
|
-
var init_tracked_body_replacement = __esm(() => {
|
|
331258
|
-
init_sd_document_session_internal();
|
|
331259
|
-
init_tracked_block_range();
|
|
331260
|
-
});
|
|
331261
|
-
|
|
331262
331471
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/whole-body-selection-text.js
|
|
331263
331472
|
function rewriteWholeBodySelectionText(bytes, index2, text4) {
|
|
331264
331473
|
const first = index2.entries[0];
|
|
@@ -332471,6 +332680,35 @@ class V2SelectionMutationAdapter {
|
|
|
332471
332680
|
if (!selectionIsAllowedByDocumentProtection(this.context, target, index2, story.storyId)) {
|
|
332472
332681
|
return failureWithoutResolution("PERMISSION_DENIED", PERMISSION_DENIED_DOC_PROTECTION);
|
|
332473
332682
|
}
|
|
332683
|
+
if (request.text === "" && (options?.changeMode ?? "direct") === "direct" && story.storyKind === "main") {
|
|
332684
|
+
const wholeStory = resolveExactDirectWholeBodySelection({
|
|
332685
|
+
target,
|
|
332686
|
+
index: index2,
|
|
332687
|
+
session: this.context.session,
|
|
332688
|
+
offsetSpace,
|
|
332689
|
+
storyLocator
|
|
332690
|
+
});
|
|
332691
|
+
if (wholeStory) {
|
|
332692
|
+
if ("error" in wholeStory)
|
|
332693
|
+
return failureWithoutResolution(wholeStory.error, wholeStory.message);
|
|
332694
|
+
const resolution2 = buildCrossParagraphResolution({
|
|
332695
|
+
plan: {
|
|
332696
|
+
kind: "cross-paragraph",
|
|
332697
|
+
startBlockId: wholeStory.resolved.startBlockId,
|
|
332698
|
+
endBlockId: wholeStory.resolved.endBlockId,
|
|
332699
|
+
startOffset: wholeStory.resolved.startOffset,
|
|
332700
|
+
endOffset: wholeStory.resolved.endOffset,
|
|
332701
|
+
startTextLength: index2.entries[0].textLength,
|
|
332702
|
+
normalizedTarget: wholeStory.normalizedTarget,
|
|
332703
|
+
resolved: wholeStory.resolved
|
|
332704
|
+
},
|
|
332705
|
+
story: effectiveResolutionStory(story, storyLocator),
|
|
332706
|
+
selectedText: readResolvedMultiParagraphText(index2, this.context.session, wholeStory.resolved)
|
|
332707
|
+
});
|
|
332708
|
+
const receipt4 = new V2ClearContentAdapter(this.context).clearSelection(index2.entries.map((entry) => entry.blockId), options);
|
|
332709
|
+
return { ...receipt4, resolution: resolution2 };
|
|
332710
|
+
}
|
|
332711
|
+
}
|
|
332474
332712
|
if ((options?.changeMode ?? "direct") === "tracked" && story.storyKind === "main") {
|
|
332475
332713
|
const wholeStory = resolveExactTrackedWholeStorySelection({
|
|
332476
332714
|
target,
|
|
@@ -332529,7 +332767,7 @@ class V2SelectionMutationAdapter {
|
|
|
332529
332767
|
});
|
|
332530
332768
|
}
|
|
332531
332769
|
}
|
|
332532
|
-
if (
|
|
332770
|
+
if (target.start.kind === "text" && target.end.kind === "text" && target.start.blockId !== target.end.blockId && selectionCrossesTableCells(index2, (partUri) => getSDDocumentSessionInternalPartBytes(this.context.session, partUri), target)) {
|
|
332533
332771
|
return this.executeCrossTableTextReplace({
|
|
332534
332772
|
target,
|
|
332535
332773
|
index: index2,
|
|
@@ -332829,6 +333067,7 @@ class V2SelectionMutationAdapter {
|
|
|
332829
333067
|
}
|
|
332830
333068
|
executeCrossTableTextReplace(input) {
|
|
332831
333069
|
const { target, index: index2, text: text4, story, storyLocator, offsetSpace, options } = input;
|
|
333070
|
+
const directDelete = text4 === "" && (options?.changeMode ?? "direct") === "direct";
|
|
332832
333071
|
if (target.coordinateSpace === "tracked") {
|
|
332833
333072
|
return failureWithoutResolution("CAPABILITY_UNAVAILABLE", "text-range-cross-paragraph-tracked-coordinate-unsupported");
|
|
332834
333073
|
}
|
|
@@ -332843,6 +333082,8 @@ class V2SelectionMutationAdapter {
|
|
|
332843
333082
|
if ("error" in plan)
|
|
332844
333083
|
return failureWithoutResolution(plan.error, plan.message);
|
|
332845
333084
|
if (plan.segments.some((segment) => segment.firstBlockId !== segment.lastBlockId || segment.selectedObjects.length > 0)) {
|
|
333085
|
+
if (directDelete)
|
|
333086
|
+
return this.executeCrossCellDelete(input);
|
|
332846
333087
|
return failureWithoutResolution("CAPABILITY_UNAVAILABLE", "table text replacement requires one text paragraph per selected container.");
|
|
332847
333088
|
}
|
|
332848
333089
|
const first = index2.byParaId(plan.startBlockId);
|
|
@@ -332850,6 +333091,9 @@ class V2SelectionMutationAdapter {
|
|
|
332850
333091
|
if (!bytes)
|
|
332851
333092
|
return failureWithoutResolution("PRECONDITION_FAILED", "selection story bytes are unavailable.");
|
|
332852
333093
|
const globalFailure = validateSelectionTextReplacement({ bytes, index: index2, on: plan });
|
|
333094
|
+
if (directDelete && (globalFailure || plan.segments.every((segment) => segment.firstOffset === segment.lastOffset) || selectedParagraphsContainNativeFields(bytes, index2, plan))) {
|
|
333095
|
+
return this.executeCrossCellDelete(input);
|
|
333096
|
+
}
|
|
332853
333097
|
if (globalFailure)
|
|
332854
333098
|
return failureWithoutResolution(mapRejectionReason(globalFailure), globalFailure);
|
|
332855
333099
|
const edits = [];
|
|
@@ -333983,7 +334227,7 @@ class V2SelectionMutationAdapter {
|
|
|
333983
334227
|
txIdPrefix: "range-ref-whole-body-replace",
|
|
333984
334228
|
expectedRevision: options?.expectedRevision != null ? String(options.expectedRevision) : undefined,
|
|
333985
334229
|
perPart: {
|
|
333986
|
-
[story.partUri]: replaceWholePartEntry(bytes,
|
|
334230
|
+
[story.partUri]: replaceWholePartEntry(bytes, TE50.encode(nextXml))
|
|
333987
334231
|
},
|
|
333988
334232
|
storyIds: [story.storyId],
|
|
333989
334233
|
createdRefs,
|
|
@@ -334387,6 +334631,206 @@ function resolveExactTrackedWholeStorySelection(input) {
|
|
|
334387
334631
|
}
|
|
334388
334632
|
};
|
|
334389
334633
|
}
|
|
334634
|
+
function selectedParagraphsContainNativeFields(bytes, index2, plan) {
|
|
334635
|
+
const first = index2.byParaId(plan.startBlockId);
|
|
334636
|
+
const last = index2.byParaId(plan.endBlockId);
|
|
334637
|
+
const start = TD93.decode(bytes.subarray(0, first.byteStart)).length;
|
|
334638
|
+
const end = TD93.decode(bytes.subarray(0, last.byteEnd)).length;
|
|
334639
|
+
const parsed = collectXmlElementRanges(TD93.decode(bytes));
|
|
334640
|
+
if (parsed.errors.length)
|
|
334641
|
+
return true;
|
|
334642
|
+
return parsed.ranges.some(({ tag, start: fieldStart, end: fieldEnd }) => fieldStart >= start && fieldEnd <= end && (tag.namespaceUri === "http://schemas.openxmlformats.org/wordprocessingml/2006/main" || tag.namespaceUri === "http://purl.oclc.org/ooxml/wordprocessingml/main") && ["fldSimple", "fldChar", "instrText"].includes(tag.localName));
|
|
334643
|
+
}
|
|
334644
|
+
function resolveExactDirectWholeBodySelection(input) {
|
|
334645
|
+
const { target, index: index2 } = input;
|
|
334646
|
+
if (!isBodyStory(input.storyLocator) || !selectionTargetStoriesMatch(target, input.storyLocator) || target.start.kind !== "text" || target.end.kind !== "text" || target.coordinateSpace === "tracked" || index2.entries.length === 0)
|
|
334647
|
+
return null;
|
|
334648
|
+
if (target.start.blockId === target.end.blockId && target.start.offset === target.end.offset)
|
|
334649
|
+
return null;
|
|
334650
|
+
const first = index2.entries[0];
|
|
334651
|
+
const last = index2.entries[index2.entries.length - 1];
|
|
334652
|
+
let start = target.start;
|
|
334653
|
+
let end = target.end;
|
|
334654
|
+
if (first.blockId !== last.blockId && start.blockId === last.blockId && end.blockId === first.blockId) {
|
|
334655
|
+
[start, end] = [end, start];
|
|
334656
|
+
}
|
|
334657
|
+
if (start.blockId !== first.blockId || end.blockId !== last.blockId || start.offset !== 0)
|
|
334658
|
+
return null;
|
|
334659
|
+
const bytes = getSDDocumentSessionInternalPartBytes(input.session, first.partUri);
|
|
334660
|
+
if (!bytes)
|
|
334661
|
+
return null;
|
|
334662
|
+
const map3 = buildStructuralBoundaryMap(bytes);
|
|
334663
|
+
if (map3.contexts.length !== index2.entries.length)
|
|
334664
|
+
return null;
|
|
334665
|
+
if (!map3.contexts.some((context) => context.blockSdtPath.length > 0))
|
|
334666
|
+
return null;
|
|
334667
|
+
if (map3.contexts.some((context) => context.sectionIndex !== 0 || context.carriesSectionBreak || context.blockCustomXmlPath.length > 0 || context.hasMathObject))
|
|
334668
|
+
return null;
|
|
334669
|
+
const namespaces = getSDDocumentSessionInternalMainStoryRootNamespaceBindings(input.session) ?? {};
|
|
334670
|
+
const inlineMap = (entry) => parseParagraphInlineMap(TD93.decode(bytes.subarray(entry.byteStart, entry.byteEnd)), namespaces);
|
|
334671
|
+
const firstInline = inlineMap(first);
|
|
334672
|
+
const lastInline = first === last ? firstInline : inlineMap(last);
|
|
334673
|
+
const objectCount = (inline) => inline.leaves().filter((piece) => piece.kind === "container" && ["drawing", "object", "pict"].includes(piece.containerKind)).length;
|
|
334674
|
+
const firstObjects = objectCount(firstInline);
|
|
334675
|
+
const lastObjects = first === last ? firstObjects : objectCount(lastInline);
|
|
334676
|
+
if ((firstObjects > 0 || lastObjects > 0) && input.offsetSpace !== "selection")
|
|
334677
|
+
return null;
|
|
334678
|
+
const lastPaintedObjects = input.offsetSpace === "selection" ? preparePaintedOffsets(TD93.decode(bytes.subarray(last.byteStart, last.byteEnd)), namespaces).containedObjectOrdinals(0, Infinity).length : 0;
|
|
334679
|
+
if (end.offset !== last.textLength + lastPaintedObjects)
|
|
334680
|
+
return null;
|
|
334681
|
+
const wholeStory = resolveExactTrackedWholeStorySelection(input);
|
|
334682
|
+
if (!wholeStory || "error" in wholeStory)
|
|
334683
|
+
return wholeStory;
|
|
334684
|
+
const xml = TD93.decode(bytes);
|
|
334685
|
+
const parsed = collectXmlElementRanges(xml);
|
|
334686
|
+
const wordNamespaces = [
|
|
334687
|
+
"http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
334688
|
+
"http://purl.oclc.org/ooxml/wordprocessingml/main"
|
|
334689
|
+
];
|
|
334690
|
+
const hasTrailingHiddenRevision = (pieces) => pieces.some((piece) => {
|
|
334691
|
+
if (piece.kind === "tracked" && piece.removesVisible && piece.visibleStart === lastInline.visibleLength && piece.visibleEnd === lastInline.visibleLength && wordNamespaces.includes(piece.namespaceBindings.get(piece.prefix ?? "") ?? ""))
|
|
334692
|
+
return true;
|
|
334693
|
+
return "children" in piece && hasTrailingHiddenRevision(piece.children);
|
|
334694
|
+
});
|
|
334695
|
+
if (hasTrailingHiddenRevision(lastInline.pieces))
|
|
334696
|
+
return null;
|
|
334697
|
+
const hasAmbiguousEndpointField = (inline, entry, boundary) => {
|
|
334698
|
+
const paragraphCharStart = TD93.decode(bytes.subarray(0, entry.byteStart)).length;
|
|
334699
|
+
const elementAt = (piece) => parsed.ranges.find((range) => range.start === paragraphCharStart + piece.charStart);
|
|
334700
|
+
const fields = [];
|
|
334701
|
+
const collectFields = (pieces) => {
|
|
334702
|
+
for (const piece of pieces) {
|
|
334703
|
+
if (piece.kind === "container" && ["fldSimple", "complexField"].includes(piece.containerKind)) {
|
|
334704
|
+
const element = piece.containerKind === "fldSimple" ? piece : piece.children[0];
|
|
334705
|
+
if (element && wordNamespaces.includes(elementAt(element)?.tag.namespaceUri ?? ""))
|
|
334706
|
+
fields.push(piece);
|
|
334707
|
+
}
|
|
334708
|
+
if ("children" in piece)
|
|
334709
|
+
collectFields(piece.children);
|
|
334710
|
+
}
|
|
334711
|
+
};
|
|
334712
|
+
collectFields(inline.pieces);
|
|
334713
|
+
const begins = [];
|
|
334714
|
+
for (const piece of inline.leaves()) {
|
|
334715
|
+
if (piece.kind !== "marker" || piece.role !== "field")
|
|
334716
|
+
continue;
|
|
334717
|
+
const element = elementAt(piece);
|
|
334718
|
+
if (!element || !wordNamespaces.includes(element.tag.namespaceUri))
|
|
334719
|
+
continue;
|
|
334720
|
+
const type = element.tag.attributes.find((attribute) => attribute.localName === "fldCharType" && wordNamespaces.includes(attribute.namespaceUri))?.value;
|
|
334721
|
+
if (type === "begin")
|
|
334722
|
+
begins.push(piece);
|
|
334723
|
+
if (type === "end" && begins.length > 0) {
|
|
334724
|
+
const begin = begins.pop();
|
|
334725
|
+
fields.push({
|
|
334726
|
+
byteStart: begin.byteStart,
|
|
334727
|
+
byteEnd: piece.byteEnd,
|
|
334728
|
+
visibleStart: begin.visibleStart,
|
|
334729
|
+
visibleEnd: piece.visibleEnd
|
|
334730
|
+
});
|
|
334731
|
+
}
|
|
334732
|
+
}
|
|
334733
|
+
return fields.some((field) => field.visibleStart === boundary && field.visibleEnd === boundary && !fields.some((parent) => parent.byteStart <= field.byteStart && parent.byteEnd >= field.byteEnd && parent.visibleStart < parent.visibleEnd));
|
|
334734
|
+
};
|
|
334735
|
+
if (hasAmbiguousEndpointField(firstInline, first, 0) || hasAmbiguousEndpointField(lastInline, last, lastInline.visibleLength))
|
|
334736
|
+
return null;
|
|
334737
|
+
const hasNativeUnknown = (pieces, paragraphCharStart) => pieces.some((piece) => {
|
|
334738
|
+
if (piece.kind === "unknown" || piece.kind === "container" && piece.containerKind === "unknown") {
|
|
334739
|
+
const element = parsed.ranges.find((range) => range.start === paragraphCharStart + piece.charStart);
|
|
334740
|
+
if (element && wordNamespaces.includes(element.tag.namespaceUri))
|
|
334741
|
+
return true;
|
|
334742
|
+
}
|
|
334743
|
+
return "children" in piece && hasNativeUnknown(piece.children, paragraphCharStart);
|
|
334744
|
+
});
|
|
334745
|
+
if (hasNativeUnknown(firstInline.pieces, TD93.decode(bytes.subarray(0, first.byteStart)).length) || first !== last && hasNativeUnknown(lastInline.pieces, TD93.decode(bytes.subarray(0, last.byteStart)).length)) {
|
|
334746
|
+
return null;
|
|
334747
|
+
}
|
|
334748
|
+
const mathNamespaces = [
|
|
334749
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/math",
|
|
334750
|
+
"http://purl.oclc.org/ooxml/officeDocument/math"
|
|
334751
|
+
];
|
|
334752
|
+
if (parsed.ranges.some((range) => ["altChunk", "subDoc"].includes(range.tag.localName) && wordNamespaces.includes(range.tag.namespaceUri)))
|
|
334753
|
+
return null;
|
|
334754
|
+
const paragraphProperties = parsed.ranges.filter((range) => range.tag.localName === "pPr" && wordNamespaces.includes(range.tag.namespaceUri));
|
|
334755
|
+
if (parsed.ranges.some((range) => mathNamespaces.includes(range.tag.namespaceUri) && ["oMath", "oMathPara"].includes(range.tag.localName) || wordNamespaces.includes(range.tag.namespaceUri) && range.tag.localName === "sectPr" && paragraphProperties.some((properties) => range.start >= properties.openEnd && range.end <= properties.closeStart)))
|
|
334756
|
+
return null;
|
|
334757
|
+
const anchoredNames = new Set([
|
|
334758
|
+
"commentRangeStart",
|
|
334759
|
+
"commentRangeEnd",
|
|
334760
|
+
"commentReference",
|
|
334761
|
+
"bookmarkStart",
|
|
334762
|
+
"bookmarkEnd",
|
|
334763
|
+
"footnoteReference",
|
|
334764
|
+
"endnoteReference",
|
|
334765
|
+
"permStart",
|
|
334766
|
+
"permEnd"
|
|
334767
|
+
]);
|
|
334768
|
+
if (parsed.ranges.some((range) => anchoredNames.has(range.tag.localName) && wordNamespaces.includes(range.tag.namespaceUri)))
|
|
334769
|
+
return null;
|
|
334770
|
+
const lockFailure = guardContentControlDeletion({ xml, start: 0, end: xml.length, operation: "whole-body-selection-delete" });
|
|
334771
|
+
if (lockFailure)
|
|
334772
|
+
return { error: lockFailure.code, message: lockFailure.message };
|
|
334773
|
+
const children2 = new Map;
|
|
334774
|
+
const ancestors = [];
|
|
334775
|
+
for (const range of [...parsed.ranges].sort((left, right) => left.start - right.start)) {
|
|
334776
|
+
while (ancestors.length && ancestors.at(-1).end <= range.start)
|
|
334777
|
+
ancestors.pop();
|
|
334778
|
+
const parent = ancestors.at(-1);
|
|
334779
|
+
if (parent) {
|
|
334780
|
+
const siblings = children2.get(parent.start) ?? [];
|
|
334781
|
+
siblings.push(range);
|
|
334782
|
+
children2.set(parent.start, siblings);
|
|
334783
|
+
}
|
|
334784
|
+
if (!range.tag.isSelfClosing)
|
|
334785
|
+
ancestors.push(range);
|
|
334786
|
+
}
|
|
334787
|
+
const nativeWord = (range, name) => range.tag.localName === name && wordNamespaces.includes(range.tag.namespaceUri);
|
|
334788
|
+
const propertyNamespaces = [
|
|
334789
|
+
...wordNamespaces,
|
|
334790
|
+
"http://schemas.microsoft.com/office/word/2010/wordml",
|
|
334791
|
+
"http://schemas.microsoft.com/office/word/2012/wordml"
|
|
334792
|
+
];
|
|
334793
|
+
const nonEditableProperties = new Set([
|
|
334794
|
+
"dataBinding",
|
|
334795
|
+
"checkbox",
|
|
334796
|
+
"dropDownList",
|
|
334797
|
+
"comboBox",
|
|
334798
|
+
"date",
|
|
334799
|
+
"picture",
|
|
334800
|
+
"repeatingSection",
|
|
334801
|
+
"repeatingSectionItem",
|
|
334802
|
+
"bibliography",
|
|
334803
|
+
"citation",
|
|
334804
|
+
"docPartObj",
|
|
334805
|
+
"docPartList",
|
|
334806
|
+
"group",
|
|
334807
|
+
"entityPicker",
|
|
334808
|
+
"equation"
|
|
334809
|
+
]);
|
|
334810
|
+
const alternateContent = parsed.ranges.filter((range) => range.tag.localName === "AlternateContent" && range.tag.namespaceUri === "http://schemas.openxmlformats.org/markup-compatibility/2006");
|
|
334811
|
+
const protectedPropertyElements = parsed.ranges.filter((range) => propertyNamespaces.includes(range.tag.namespaceUri) && nonEditableProperties.has(range.tag.localName) || nativeWord(range, "lock"));
|
|
334812
|
+
const hasWrappedControlProperties = (range) => {
|
|
334813
|
+
if (nativeWord(range, "sdtPr"))
|
|
334814
|
+
return true;
|
|
334815
|
+
if (nativeWord(range, "sdt") || nativeWord(range, "sdtContent"))
|
|
334816
|
+
return false;
|
|
334817
|
+
return (children2.get(range.start) ?? []).some(hasWrappedControlProperties);
|
|
334818
|
+
};
|
|
334819
|
+
for (const control2 of parsed.ranges.filter((range) => nativeWord(range, "sdt"))) {
|
|
334820
|
+
const directChildren4 = children2.get(control2.start) ?? [];
|
|
334821
|
+
const properties = directChildren4.filter((range) => nativeWord(range, "sdtPr"));
|
|
334822
|
+
if (directChildren4.some((range) => !properties.includes(range) && hasWrappedControlProperties(range)))
|
|
334823
|
+
return null;
|
|
334824
|
+
if (properties.some((property2) => alternateContent.some((range) => range.start >= property2.openEnd && range.end <= property2.closeStart)))
|
|
334825
|
+
return null;
|
|
334826
|
+
if (properties.some((property2) => protectedPropertyElements.some((range) => range.start >= property2.openEnd && range.end <= property2.closeStart && !(children2.get(property2.start) ?? []).includes(range))))
|
|
334827
|
+
return null;
|
|
334828
|
+
if (properties.length > 1 || directChildren4.filter((range) => nativeWord(range, "sdtContent")).length !== 1 || properties.some((property2) => (children2.get(property2.start) ?? []).some((range) => propertyNamespaces.includes(range.tag.namespaceUri) && nonEditableProperties.has(range.tag.localName)))) {
|
|
334829
|
+
return { error: "INVALID_CONTEXT", message: "whole-body selection contains a non-editable content control." };
|
|
334830
|
+
}
|
|
334831
|
+
}
|
|
334832
|
+
return wholeStory;
|
|
334833
|
+
}
|
|
334390
334834
|
function isBodyStory(storyLocator) {
|
|
334391
334835
|
return storyLocator == null || storyLocator.kind === "story" && storyLocator.storyType === "body";
|
|
334392
334836
|
}
|
|
@@ -334598,7 +335042,7 @@ function rewriteReviewId(on, resolution, origin) {
|
|
|
334598
335042
|
const noteId = story && "noteId" in story ? story.noteId : undefined;
|
|
334599
335043
|
return buildTextRewriteReviewGroupId(on.storyId, origin, noteId);
|
|
334600
335044
|
}
|
|
334601
|
-
var TD93,
|
|
335045
|
+
var TD93, TE50, PERMISSION_DENIED_DOC_PROTECTION = "document protection permits edits only within an everyone permission range.", FORMAT_STRADDLE_MARKER_KINDS;
|
|
334602
335046
|
var init_adapter9 = __esm(() => {
|
|
334603
335047
|
init_review_read_model();
|
|
334604
335048
|
init_sd_document_session_internal();
|
|
@@ -334609,6 +335053,7 @@ var init_adapter9 = __esm(() => {
|
|
|
334609
335053
|
init_stories();
|
|
334610
335054
|
init_text_range_shifts();
|
|
334611
335055
|
init_materialize_slot();
|
|
335056
|
+
init_painted_offsets();
|
|
334612
335057
|
init_selection_target();
|
|
334613
335058
|
init_range_collapse();
|
|
334614
335059
|
init_story_identity();
|
|
@@ -334616,6 +335061,8 @@ var init_adapter9 = __esm(() => {
|
|
|
334616
335061
|
init_raw_block_ref();
|
|
334617
335062
|
init_search();
|
|
334618
335063
|
init_document_reader();
|
|
335064
|
+
init_clear_content_adapter();
|
|
335065
|
+
init_deletion_locks();
|
|
334619
335066
|
init_note_story();
|
|
334620
335067
|
init_text_mutation_diagnostics();
|
|
334621
335068
|
init_adapter6();
|
|
@@ -334631,7 +335078,7 @@ var init_adapter9 = __esm(() => {
|
|
|
334631
335078
|
init_cross_cell_delete();
|
|
334632
335079
|
init_effective_inline_uniformity();
|
|
334633
335080
|
TD93 = new TextDecoder;
|
|
334634
|
-
|
|
335081
|
+
TE50 = new TextEncoder;
|
|
334635
335082
|
FORMAT_STRADDLE_MARKER_KINDS = new Set([
|
|
334636
335083
|
"bookmarkStart",
|
|
334637
335084
|
"bookmarkEnd",
|
|
@@ -335425,7 +335872,7 @@ function richWriteAnalysisSha256(input) {
|
|
|
335425
335872
|
return digest({ ...input, atomic: true });
|
|
335426
335873
|
}
|
|
335427
335874
|
function digest(value2) {
|
|
335428
|
-
return sha256HexSync(
|
|
335875
|
+
return sha256HexSync(TE51.encode(canonicalJson(value2)));
|
|
335429
335876
|
}
|
|
335430
335877
|
function canonicalJson(value2) {
|
|
335431
335878
|
if (value2 === null || typeof value2 === "boolean" || typeof value2 === "string")
|
|
@@ -335443,10 +335890,10 @@ function canonicalJson(value2) {
|
|
|
335443
335890
|
}
|
|
335444
335891
|
throw new Error(`Support-check digests cannot encode ${typeof value2}.`);
|
|
335445
335892
|
}
|
|
335446
|
-
var
|
|
335893
|
+
var TE51;
|
|
335447
335894
|
var init_digest = __esm(() => {
|
|
335448
335895
|
init_sd_document_session_internal();
|
|
335449
|
-
|
|
335896
|
+
TE51 = new TextEncoder;
|
|
335450
335897
|
});
|
|
335451
335898
|
|
|
335452
335899
|
// ../../../v2/document-api-v2-adapter/dist/write/rich-fragment-apply.js
|
|
@@ -336244,7 +336691,7 @@ function commitKernelXmlRewrites(input) {
|
|
|
336244
336691
|
}
|
|
336245
336692
|
};
|
|
336246
336693
|
}
|
|
336247
|
-
const nextBytes =
|
|
336694
|
+
const nextBytes = TE52.encode(rewrite.nextXml);
|
|
336248
336695
|
return bytesEqual16(currentBytes, nextBytes) ? null : {
|
|
336249
336696
|
rewrite,
|
|
336250
336697
|
currentBytes,
|
|
@@ -336319,11 +336766,11 @@ function bytesEqual16(left, right) {
|
|
|
336319
336766
|
}
|
|
336320
336767
|
return true;
|
|
336321
336768
|
}
|
|
336322
|
-
var
|
|
336769
|
+
var TE52, TD95;
|
|
336323
336770
|
var init_xml_rewrite = __esm(() => {
|
|
336324
336771
|
init_sd_document_session_internal();
|
|
336325
336772
|
init_xml();
|
|
336326
|
-
|
|
336773
|
+
TE52 = new TextEncoder;
|
|
336327
336774
|
TD95 = new TextDecoder;
|
|
336328
336775
|
});
|
|
336329
336776
|
|
|
@@ -343592,13 +344039,13 @@ function prepareTrackedSectionBreak(input) {
|
|
|
343592
344039
|
return unavailable4("Tracked section creation cannot yet materialize the final section or relocate its references.");
|
|
343593
344040
|
}
|
|
343594
344041
|
const changesFinalProperties = before.sectionXml !== after.sectionXml;
|
|
343595
|
-
if (collectXmlElementRanges(before.sectionXml, { fragment: true, additionalNamespaces: before.body.namespaceBindings }).ranges.some((range) => range.tag.namespaceUri ===
|
|
344042
|
+
if (collectXmlElementRanges(before.sectionXml, { fragment: true, additionalNamespaces: before.body.namespaceBindings }).ranges.some((range) => range.tag.namespaceUri === WORD_NS5 && range.tag.localName === "sectPrChange")) {
|
|
343596
344043
|
return unavailable4("Tracked section creation cannot copy an existing section property revision.");
|
|
343597
344044
|
}
|
|
343598
344045
|
const attached = input.representation === "attachToPreviousParagraph";
|
|
343599
344046
|
const oldParagraph = attached ? before.blocks.at(-1) : undefined;
|
|
343600
344047
|
const paragraph4 = after.blocks.at(-1);
|
|
343601
|
-
if (!paragraph4 || paragraph4.tag.namespaceUri !==
|
|
344048
|
+
if (!paragraph4 || paragraph4.tag.namespaceUri !== WORD_NS5 || paragraph4.tag.localName !== "p" || attached && (!oldParagraph || oldParagraph.tag.namespaceUri !== WORD_NS5 || oldParagraph.tag.localName !== "p") || after.blocks.length !== before.blocks.length + (attached ? 0 : 1)) {
|
|
343602
344049
|
return unavailable4("Tracked section creation requires one body paragraph carrier.");
|
|
343603
344050
|
}
|
|
343604
344051
|
const beforeStart = oldParagraph?.start ?? before.sectionStart;
|
|
@@ -343610,18 +344057,18 @@ function prepareTrackedSectionBreak(input) {
|
|
|
343610
344057
|
const prepare = (paragraphId3, revisionIds) => {
|
|
343611
344058
|
let open = input.afterXml.slice(paragraph4.start, paragraph4.openEnd);
|
|
343612
344059
|
for (const attribute of paragraph4.tag.attributes) {
|
|
343613
|
-
if (attribute.namespaceUri !==
|
|
344060
|
+
if (attribute.namespaceUri !== WORD_2010_NS2 || attribute.localName !== "paraId")
|
|
343614
344061
|
continue;
|
|
343615
344062
|
const name = attribute.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
343616
344063
|
open = open.replace(new RegExp(`\\s+${name}\\s*=\\s*(["'])[\\s\\S]*?\\1`), "");
|
|
343617
344064
|
}
|
|
343618
|
-
let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri ===
|
|
344065
|
+
let prefix = Object.entries(paragraph4.namespaceBindings).find(([name, uri]) => name && uri === WORD_2010_NS2)?.[0];
|
|
343619
344066
|
let namespace = "";
|
|
343620
344067
|
if (!prefix) {
|
|
343621
344068
|
prefix = "w14";
|
|
343622
344069
|
while (paragraph4.namespaceBindings[prefix])
|
|
343623
344070
|
prefix += "sd";
|
|
343624
|
-
namespace = ` xmlns:${prefix}="${
|
|
344071
|
+
namespace = ` xmlns:${prefix}="${WORD_2010_NS2}"`;
|
|
343625
344072
|
}
|
|
343626
344073
|
open = open.replace(/\/?>(?=$)/, (ending) => `${namespace} ${prefix}:paraId="${paragraphId3}"${ending}`);
|
|
343627
344074
|
return prepareTrackedBlockXmlReplacement({
|
|
@@ -343673,7 +344120,7 @@ function readBody2(xml) {
|
|
|
343673
344120
|
const parsed = collectXmlElementRanges(xml);
|
|
343674
344121
|
if (parsed.errors.length)
|
|
343675
344122
|
return null;
|
|
343676
|
-
const body = parsed.ranges.find((range) => range.tag.namespaceUri ===
|
|
344123
|
+
const body = parsed.ranges.find((range) => range.tag.namespaceUri === WORD_NS5 && range.tag.localName === "body");
|
|
343677
344124
|
if (!body || body.tag.isSelfClosing)
|
|
343678
344125
|
return null;
|
|
343679
344126
|
const blocks = [];
|
|
@@ -343689,10 +344136,10 @@ function readBody2(xml) {
|
|
|
343689
344136
|
if (xml.slice(cursor, body.closeStart).trim())
|
|
343690
344137
|
return null;
|
|
343691
344138
|
const last = blocks.at(-1);
|
|
343692
|
-
const section = last?.tag.namespaceUri ===
|
|
344139
|
+
const section = last?.tag.namespaceUri === WORD_NS5 && last.tag.localName === "sectPr" ? blocks.pop() : undefined;
|
|
343693
344140
|
return { body, blocks, sectionStart: section?.start ?? body.closeStart, sectionEnd: section?.end ?? body.closeStart, sectionXml: section ? xml.slice(section.start, section.end) : "" };
|
|
343694
344141
|
}
|
|
343695
|
-
var
|
|
344142
|
+
var WORD_NS5 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORD_2010_NS2 = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
343696
344143
|
var init_tracked_section_break = __esm(() => {
|
|
343697
344144
|
init_sd_document_session_internal();
|
|
343698
344145
|
init_paragraph_ids();
|
|
@@ -345887,7 +346334,7 @@ function storyErrorMessage3(error48) {
|
|
|
345887
346334
|
}
|
|
345888
346335
|
}
|
|
345889
346336
|
function splicePartBytes(bytes, start, end, replacementXml) {
|
|
345890
|
-
const replacement =
|
|
346337
|
+
const replacement = TE53.encode(replacementXml);
|
|
345891
346338
|
const next = new Uint8Array(start + replacement.length + (bytes.length - end));
|
|
345892
346339
|
next.set(bytes.subarray(0, start), 0);
|
|
345893
346340
|
next.set(replacement, start);
|
|
@@ -345990,7 +346437,7 @@ function txIdPrefixToOperation(prefix) {
|
|
|
345990
346437
|
return prefix;
|
|
345991
346438
|
}
|
|
345992
346439
|
}
|
|
345993
|
-
var TD97,
|
|
346440
|
+
var TD97, TE53;
|
|
345994
346441
|
var init_adapter15 = __esm(() => {
|
|
345995
346442
|
init_sd_document_session_internal();
|
|
345996
346443
|
init_src6();
|
|
@@ -346004,7 +346451,7 @@ var init_adapter15 = __esm(() => {
|
|
|
346004
346451
|
init_part();
|
|
346005
346452
|
init_paragraph();
|
|
346006
346453
|
TD97 = new TextDecoder;
|
|
346007
|
-
|
|
346454
|
+
TE53 = new TextEncoder;
|
|
346008
346455
|
});
|
|
346009
346456
|
|
|
346010
346457
|
// ../../../v2/document-api-v2-adapter/dist/header-footers/page-numbers.js
|
|
@@ -350942,7 +351389,7 @@ function readProjectionImages(paragraph4, namespaces, targets) {
|
|
|
350942
351389
|
fragment: true,
|
|
350943
351390
|
additionalNamespaces: namespaces,
|
|
350944
351391
|
onOpenTag: ({ tag, start }) => {
|
|
350945
|
-
if (tag.namespaceUri ===
|
|
351392
|
+
if (tag.namespaceUri === WORD_NS6 && tag.localName === "drawing") {
|
|
350946
351393
|
drawing = { start: paragraph4.byteStart + offsets.byteOffsetAt(start), blips: 0, alt: "" };
|
|
350947
351394
|
}
|
|
350948
351395
|
if (!drawing)
|
|
@@ -350957,7 +351404,7 @@ function readProjectionImages(paragraph4, namespaces, targets) {
|
|
|
350957
351404
|
}
|
|
350958
351405
|
},
|
|
350959
351406
|
onCloseTag: ({ tag }) => {
|
|
350960
|
-
if (tag.namespaceUri !==
|
|
351407
|
+
if (tag.namespaceUri !== WORD_NS6 || tag.localName !== "drawing" || !drawing)
|
|
350961
351408
|
return;
|
|
350962
351409
|
if (drawing.blips === 1 && drawing.src && isPublicImageUrl(drawing.src)) {
|
|
350963
351410
|
images.set(drawing.start, { src: drawing.src, alt: drawing.alt });
|
|
@@ -350977,7 +351424,7 @@ function isPublicImageUrl(value2) {
|
|
|
350977
351424
|
return false;
|
|
350978
351425
|
}
|
|
350979
351426
|
}
|
|
350980
|
-
var DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
351427
|
+
var DRAWING_NS = "http://schemas.openxmlformats.org/drawingml/2006/main", WORD_NS6 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WP_NS = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
350981
351428
|
var init_images2 = __esm(() => {
|
|
350982
351429
|
init_sd_document_session_internal();
|
|
350983
351430
|
});
|
|
@@ -357328,11 +357775,11 @@ function findStructuredImageDrawings(partXml, identity2) {
|
|
|
357328
357775
|
const relationshipId = /\br:embed="([^"]+)"/.exec(drawing.xml)?.[1] ?? null;
|
|
357329
357776
|
if (!relationshipId || normalizeImageIdComponent(relationshipId) !== identity2.relationshipScope)
|
|
357330
357777
|
continue;
|
|
357331
|
-
const byteStart =
|
|
357778
|
+
const byteStart = TE54.encode(partXml.slice(0, drawing.start)).byteLength;
|
|
357332
357779
|
out.push({
|
|
357333
357780
|
start: drawing.start,
|
|
357334
357781
|
byteStart,
|
|
357335
|
-
byteEnd: byteStart +
|
|
357782
|
+
byteEnd: byteStart + TE54.encode(drawing.xml).byteLength,
|
|
357336
357783
|
relationshipId,
|
|
357337
357784
|
xml: drawing.xml
|
|
357338
357785
|
});
|
|
@@ -357810,14 +358257,14 @@ function decodeXmlAttr2(value2) {
|
|
|
357810
358257
|
function emuToPx(value2) {
|
|
357811
358258
|
return value2 / EMU_PER_PX4;
|
|
357812
358259
|
}
|
|
357813
|
-
var TD98,
|
|
358260
|
+
var TD98, TE54, EMU_PER_PX4 = 9525, CROP_SCALE = 1000, DECORATIVE_DESCRIPTION_CLEARED, BODY_IMAGE_ENTRIES_CACHE, TRACKED_WRAPPER_KINDS2;
|
|
357814
358261
|
var init_public_model = __esm(() => {
|
|
357815
358262
|
init_sd_document_session_internal();
|
|
357816
358263
|
init_caption_style();
|
|
357817
358264
|
init_xml_rewrite();
|
|
357818
358265
|
init_document_reader();
|
|
357819
358266
|
TD98 = new TextDecoder;
|
|
357820
|
-
|
|
358267
|
+
TE54 = new TextEncoder;
|
|
357821
358268
|
DECORATIVE_DESCRIPTION_CLEARED = new WeakMap;
|
|
357822
358269
|
BODY_IMAGE_ENTRIES_CACHE = new WeakMap;
|
|
357823
358270
|
TRACKED_WRAPPER_KINDS2 = new Set(["ins", "del", "moveFrom", "moveTo"]);
|
|
@@ -361786,15 +362233,15 @@ function rewriteImageMoveDestinationParagraphXml(paragraphXml, context, partXml,
|
|
|
361786
362233
|
}
|
|
361787
362234
|
function rewriteParagraphParaIds(xml, context) {
|
|
361788
362235
|
const allocate = createParaIdAllocator(context);
|
|
361789
|
-
let
|
|
362236
|
+
let firstParagraphId2 = null;
|
|
361790
362237
|
return {
|
|
361791
362238
|
xml: xml.replace(/\bw14:paraId="([0-9A-Fa-f]{8})"/g, () => {
|
|
361792
362239
|
const nextId = allocate();
|
|
361793
|
-
if (!
|
|
361794
|
-
|
|
362240
|
+
if (!firstParagraphId2)
|
|
362241
|
+
firstParagraphId2 = nextId;
|
|
361795
362242
|
return `w14:paraId="${nextId}"`;
|
|
361796
362243
|
}),
|
|
361797
|
-
firstParagraphId
|
|
362244
|
+
firstParagraphId: firstParagraphId2
|
|
361798
362245
|
};
|
|
361799
362246
|
}
|
|
361800
362247
|
function rewriteWp14DrawingIds(xml, partXml) {
|
|
@@ -365437,8 +365884,8 @@ var init_adapter23 = __esm(() => {
|
|
|
365437
365884
|
|
|
365438
365885
|
// ../../../v2/document-api-v2-adapter/dist/diff/tracked-table-property-replay.js
|
|
365439
365886
|
function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
365440
|
-
const baseBytes =
|
|
365441
|
-
const targetBytes =
|
|
365887
|
+
const baseBytes = TE55.encode(base3.xml);
|
|
365888
|
+
const targetBytes = TE55.encode(target.xml);
|
|
365442
365889
|
const baseTables = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID });
|
|
365443
365890
|
const targetTables = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID });
|
|
365444
365891
|
const baseBody = collectXmlElementRanges(base3.xml).ranges.find((range) => range.tag.namespaceUri === W20 && range.tag.localName === "body");
|
|
@@ -365484,10 +365931,10 @@ function buildTrackedTablePropertyReplayPlan(base3, target) {
|
|
|
365484
365931
|
}
|
|
365485
365932
|
return steps.length ? { steps } : null;
|
|
365486
365933
|
}
|
|
365487
|
-
var
|
|
365934
|
+
var TE55, TD101, STORY_ID = "body:/word/document.xml", W20 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
365488
365935
|
var init_tracked_table_property_replay = __esm(() => {
|
|
365489
365936
|
init_sd_document_session_internal();
|
|
365490
|
-
|
|
365937
|
+
TE55 = new TextEncoder;
|
|
365491
365938
|
TD101 = new TextDecoder;
|
|
365492
365939
|
});
|
|
365493
365940
|
|
|
@@ -365586,15 +366033,15 @@ var init_fingerprint = __esm(() => {
|
|
|
365586
366033
|
// ../../../v2/document-api-v2-adapter/dist/compare/part-fingerprint.js
|
|
365587
366034
|
function comparePartContentFingerprint(partUri, bytes) {
|
|
365588
366035
|
const partHash = sha256HexSync(bytes);
|
|
365589
|
-
return `fp:${sha256HexSync(
|
|
366036
|
+
return `fp:${sha256HexSync(TE56.encode(`${partUri}:${partHash}`))}`;
|
|
365590
366037
|
}
|
|
365591
366038
|
function comparePartXmlFingerprint(partUri, xml) {
|
|
365592
|
-
return comparePartContentFingerprint(partUri,
|
|
366039
|
+
return comparePartContentFingerprint(partUri, TE56.encode(xml));
|
|
365593
366040
|
}
|
|
365594
|
-
var
|
|
366041
|
+
var TE56;
|
|
365595
366042
|
var init_part_fingerprint = __esm(() => {
|
|
365596
366043
|
init_sd_document_session_internal();
|
|
365597
|
-
|
|
366044
|
+
TE56 = new TextEncoder;
|
|
365598
366045
|
});
|
|
365599
366046
|
|
|
365600
366047
|
// ../../../v2/document-api-v2-adapter/dist/compare/inventory.js
|
|
@@ -365815,7 +366262,7 @@ function captureCompareSourceInventory(context) {
|
|
|
365815
366262
|
return buildCompareSourceInventory(buildCompareSourceObservation(context));
|
|
365816
366263
|
}
|
|
365817
366264
|
function textBytes(value2) {
|
|
365818
|
-
return
|
|
366265
|
+
return TE57.encode(value2);
|
|
365819
366266
|
}
|
|
365820
366267
|
function countOccurrences(haystack, needle) {
|
|
365821
366268
|
let count = 0;
|
|
@@ -365872,19 +366319,19 @@ function accumulateStoryCatalogs(context, story, acc) {
|
|
|
365872
366319
|
}
|
|
365873
366320
|
} catch {}
|
|
365874
366321
|
}
|
|
365875
|
-
var TD102, BODY_PART_URI = "/word/document.xml",
|
|
366322
|
+
var TD102, BODY_PART_URI = "/word/document.xml", TE57;
|
|
365876
366323
|
var init_inventory = __esm(() => {
|
|
365877
366324
|
init_src2();
|
|
365878
366325
|
init_sd_document_session_internal();
|
|
365879
366326
|
init_document_reader();
|
|
365880
366327
|
init_part_fingerprint();
|
|
365881
366328
|
TD102 = new TextDecoder("utf-8", { fatal: false });
|
|
365882
|
-
|
|
366329
|
+
TE57 = new TextEncoder;
|
|
365883
366330
|
});
|
|
365884
366331
|
|
|
365885
366332
|
// ../../../v2/document-api-v2-adapter/dist/compare/definitions.js
|
|
365886
366333
|
function digest2(value2) {
|
|
365887
|
-
return sha256HexSync(
|
|
366334
|
+
return sha256HexSync(TE58.encode(value2));
|
|
365888
366335
|
}
|
|
365889
366336
|
function tagAttr2(tag, local) {
|
|
365890
366337
|
const match = new RegExp(`\\b(?:[\\w.-]+:)?${local}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`).exec(tag);
|
|
@@ -366188,14 +366635,14 @@ function projectCompareDefinitions(context) {
|
|
|
366188
366635
|
{ family: "theme", entries: projectTheme(context) }
|
|
366189
366636
|
];
|
|
366190
366637
|
}
|
|
366191
|
-
var TD103,
|
|
366638
|
+
var TD103, TE58, SETTINGS_PART_URI4 = "/word/settings.xml", WORDPROCESSINGML_NS3 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", XML_ATTR_RE;
|
|
366192
366639
|
var init_definitions = __esm(() => {
|
|
366193
366640
|
init_src2();
|
|
366194
366641
|
init_sd_document_session_internal();
|
|
366195
366642
|
init_adapter13();
|
|
366196
366643
|
init_part();
|
|
366197
366644
|
TD103 = new TextDecoder("utf-8", { fatal: false });
|
|
366198
|
-
|
|
366645
|
+
TE58 = new TextEncoder;
|
|
366199
366646
|
XML_ATTR_RE = /\s+[\w.-]+(?::[\w.-]+)?=(?:"[^"]*"|'[^']*')/g;
|
|
366200
366647
|
});
|
|
366201
366648
|
|
|
@@ -366210,7 +366657,7 @@ function contentControlIdentity(properties) {
|
|
|
366210
366657
|
|
|
366211
366658
|
// ../../../v2/document-api-v2-adapter/dist/compare/annotations.js
|
|
366212
366659
|
function digest3(value2) {
|
|
366213
|
-
return sha256HexSync(
|
|
366660
|
+
return sha256HexSync(TE59.encode(value2));
|
|
366214
366661
|
}
|
|
366215
366662
|
function storyLocatorSignature(story) {
|
|
366216
366663
|
if (!story || story.storyType === "body")
|
|
@@ -366557,17 +367004,17 @@ function projectCompareAnnotations(context) {
|
|
|
366557
367004
|
{ family: "permissions", entries: projectPermissions(context) }
|
|
366558
367005
|
];
|
|
366559
367006
|
}
|
|
366560
|
-
var TD104,
|
|
367007
|
+
var TD104, TE59, BODY_PART_URI2 = "/word/document.xml", CUSTOM_XML_PROPS_RELS_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps";
|
|
366561
367008
|
var init_annotations2 = __esm(() => {
|
|
366562
367009
|
init_sd_document_session_internal();
|
|
366563
367010
|
init_read();
|
|
366564
367011
|
TD104 = new TextDecoder("utf-8", { fatal: false });
|
|
366565
|
-
|
|
367012
|
+
TE59 = new TextEncoder;
|
|
366566
367013
|
});
|
|
366567
367014
|
|
|
366568
367015
|
// ../../../v2/document-api-v2-adapter/dist/compare/objects.js
|
|
366569
367016
|
function digest4(value2) {
|
|
366570
|
-
return sha256HexSync(
|
|
367017
|
+
return sha256HexSync(TE60.encode(value2));
|
|
366571
367018
|
}
|
|
366572
367019
|
function isMediaKind(partKind) {
|
|
366573
367020
|
return classifyComparePartKind(partKind).family === "media";
|
|
@@ -366784,12 +367231,12 @@ function projectCompareObjects(context) {
|
|
|
366784
367231
|
{ family: "package-graph", entries: projectPackageGraph(context) }
|
|
366785
367232
|
];
|
|
366786
367233
|
}
|
|
366787
|
-
var TD105,
|
|
367234
|
+
var TD105, TE60, CONTENT_TYPES_PART_URI15 = "/[Content_Types].xml", PACKAGE_ROOT_OWNER = "/";
|
|
366788
367235
|
var init_objects = __esm(() => {
|
|
366789
367236
|
init_src2();
|
|
366790
367237
|
init_sd_document_session_internal();
|
|
366791
367238
|
TD105 = new TextDecoder("utf-8", { fatal: false });
|
|
366792
|
-
|
|
367239
|
+
TE60 = new TextEncoder;
|
|
366793
367240
|
});
|
|
366794
367241
|
|
|
366795
367242
|
// ../../../v2/document-api-v2-adapter/dist/compare/run-signature.js
|
|
@@ -371056,7 +371503,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371056
371503
|
family: "header-footer-parts",
|
|
371057
371504
|
partUri: DOCUMENT_RELS_URI2,
|
|
371058
371505
|
kind: "create",
|
|
371059
|
-
nextBytes:
|
|
371506
|
+
nextBytes: TE61.encode(nextRels),
|
|
371060
371507
|
contentType: "application/vnd.openxmlformats-package.relationships+xml"
|
|
371061
371508
|
});
|
|
371062
371509
|
} else if (nextRels !== baseRels) {
|
|
@@ -371064,7 +371511,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371064
371511
|
family: "header-footer-parts",
|
|
371065
371512
|
partUri: DOCUMENT_RELS_URI2,
|
|
371066
371513
|
kind: "modify",
|
|
371067
|
-
nextBytes:
|
|
371514
|
+
nextBytes: TE61.encode(nextRels)
|
|
371068
371515
|
});
|
|
371069
371516
|
}
|
|
371070
371517
|
const baseContentTypes = TD108.decode(Uint8Array.from(base3.contentTypesBytes));
|
|
@@ -371077,7 +371524,7 @@ function buildHeaderFooterLifecyclePlan(base3, target) {
|
|
|
371077
371524
|
family: "header-footer-parts",
|
|
371078
371525
|
partUri: CONTENT_TYPES_URI2,
|
|
371079
371526
|
kind: "modify",
|
|
371080
|
-
nextBytes:
|
|
371527
|
+
nextBytes: TE61.encode(nextContentTypes)
|
|
371081
371528
|
});
|
|
371082
371529
|
}
|
|
371083
371530
|
return {
|
|
@@ -371226,8 +371673,8 @@ function coveredGraphKeys(baseRels, targetRels, baseContentTypes, targetContentT
|
|
|
371226
371673
|
}
|
|
371227
371674
|
}
|
|
371228
371675
|
const partUris = new Set([
|
|
371229
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
371230
|
-
...headerFooterPartsFromDocumentRelationships(
|
|
371676
|
+
...headerFooterPartsFromDocumentRelationships(TE61.encode(baseRels)).keys(),
|
|
371677
|
+
...headerFooterPartsFromDocumentRelationships(TE61.encode(targetRels)).keys()
|
|
371231
371678
|
]);
|
|
371232
371679
|
const baseOverrides = headerFooterOverrideRecords(baseContentTypes, partUris);
|
|
371233
371680
|
const targetOverrides = headerFooterOverrideRecords(targetContentTypes, partUris);
|
|
@@ -371250,14 +371697,14 @@ function headerFooterOverrideRecords(xml, partUris) {
|
|
|
371250
371697
|
function relationshipSemanticKey(relationship) {
|
|
371251
371698
|
return JSON.stringify([relationship.id, relationship.type, relationship.target, relationship.targetMode ?? "Internal"]);
|
|
371252
371699
|
}
|
|
371253
|
-
var TD108,
|
|
371700
|
+
var TD108, TE61, DOCUMENT_RELS_URI2 = "/word/_rels/document.xml.rels", CONTENT_TYPES_URI2 = "/[Content_Types].xml", EMPTY_RELS_XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>', HEADER_REL_SUFFIX2 = "/relationships/header", FOOTER_REL_SUFFIX2 = "/relationships/footer", OFFICE_RELATIONSHIPS_NAMESPACES, RELATIONSHIP_REFERENCE_ATTRIBUTES;
|
|
371254
371701
|
var init_header_footer_lifecycle = __esm(() => {
|
|
371255
371702
|
init_sd_document_session_internal();
|
|
371256
371703
|
init_part_fingerprint();
|
|
371257
371704
|
init_header_footer_parts();
|
|
371258
371705
|
init_opc_xml();
|
|
371259
371706
|
TD108 = new TextDecoder;
|
|
371260
|
-
|
|
371707
|
+
TE61 = new TextEncoder;
|
|
371261
371708
|
OFFICE_RELATIONSHIPS_NAMESPACES = new Set([
|
|
371262
371709
|
"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
371263
371710
|
"http://purl.oclc.org/ooxml/officeDocument/relationships"
|
|
@@ -371425,8 +371872,8 @@ function buildTrackedTableRowReplayPlan(input) {
|
|
|
371425
371872
|
if (input.base.xml === input.target.xml) {
|
|
371426
371873
|
return { steps: [], bodyOperations: input.bodyOperations, unsafeReasons: [] };
|
|
371427
371874
|
}
|
|
371428
|
-
const baseBytes =
|
|
371429
|
-
const targetBytes =
|
|
371875
|
+
const baseBytes = TE62.encode(input.base.xml);
|
|
371876
|
+
const targetBytes = TE62.encode(input.target.xml);
|
|
371430
371877
|
const baseCatalog = buildTableCatalog({ bytes: baseBytes, storyId: STORY_ID2 });
|
|
371431
371878
|
const targetCatalog = buildTableCatalog({ bytes: targetBytes, storyId: STORY_ID2 });
|
|
371432
371879
|
const baseRoot = documentRootContext(input.base.xml);
|
|
@@ -372099,10 +372546,10 @@ function escapeRegExp18(value2) {
|
|
|
372099
372546
|
function escapeXmlAttribute5(value2) {
|
|
372100
372547
|
return value2.replaceAll("&", "&").replaceAll('"', """);
|
|
372101
372548
|
}
|
|
372102
|
-
var
|
|
372549
|
+
var TE62, STORY_ID2 = "body:/word/document.xml", WORDPROCESSINGML_NS4 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS = "http://schemas.microsoft.com/office/word/2010/wordml", MARKUP_COMPATIBILITY_NS2 = "http://schemas.openxmlformats.org/markup-compatibility/2006", MC_PREFIX_LIST_ATTRIBUTES, MC_QNAME_LIST_ATTRIBUTES, EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2, EXACT_ROW_UNSAFE_W14_REVISION_LOCAL_NAMES2;
|
|
372103
372550
|
var init_tracked_table_row_replay = __esm(() => {
|
|
372104
372551
|
init_sd_document_session_internal();
|
|
372105
|
-
|
|
372552
|
+
TE62 = new TextEncoder;
|
|
372106
372553
|
MC_PREFIX_LIST_ATTRIBUTES = new Set(["Ignorable", "MustUnderstand"]);
|
|
372107
372554
|
MC_QNAME_LIST_ATTRIBUTES = new Set(["PreserveElements", "PreserveAttributes", "ProcessContent"]);
|
|
372108
372555
|
EXACT_ROW_UNSAFE_REVISION_LOCAL_NAMES2 = new Set([
|
|
@@ -372156,7 +372603,7 @@ function read(xml) {
|
|
|
372156
372603
|
children2.push(range);
|
|
372157
372604
|
cursor = range.end;
|
|
372158
372605
|
}
|
|
372159
|
-
const bytes =
|
|
372606
|
+
const bytes = TE63.encode(xml);
|
|
372160
372607
|
const byteOffsets = buildUtf8ByteOffsetTable(xml);
|
|
372161
372608
|
const tables2 = buildTableCatalog({ bytes, storyId: STORY }).tables;
|
|
372162
372609
|
if (tables2.some((table) => table.containsNestedTable || !table.isRectangular || table.hasVMerge || table.hasGridSpan))
|
|
@@ -372278,11 +372725,11 @@ function buildTrackedTableBlockReplayPlan(input) {
|
|
|
372278
372725
|
bodyOperations: input.bodyOperations.filter((operation) => !ownedIds.has(operation.blockId))
|
|
372279
372726
|
};
|
|
372280
372727
|
}
|
|
372281
|
-
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml",
|
|
372728
|
+
var W21 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", W146 = "http://schemas.microsoft.com/office/word/2010/wordml", STORY = "body:/word/document.xml", TE63, paragraphId2 = (range) => range.tag.attributes.find((attr3) => attr3.namespaceUri === W146 && attr3.localName === "paraId")?.value;
|
|
372282
372729
|
var init_tracked_table_block_replay = __esm(() => {
|
|
372283
372730
|
init_sd_document_session_internal();
|
|
372284
372731
|
init_tracked_table_row_replay();
|
|
372285
|
-
|
|
372732
|
+
TE63 = new TextEncoder;
|
|
372286
372733
|
});
|
|
372287
372734
|
|
|
372288
372735
|
// ../../../v2/document-api-v2-adapter/dist/diff/comments-replay.js
|
|
@@ -372334,7 +372781,7 @@ function validateDiffCommentSource(source, snapshot2, label) {
|
|
|
372334
372781
|
return problems;
|
|
372335
372782
|
}
|
|
372336
372783
|
function digest5(value2) {
|
|
372337
|
-
return sha256HexSync(
|
|
372784
|
+
return sha256HexSync(TE64.encode(value2));
|
|
372338
372785
|
}
|
|
372339
372786
|
function commentContentSignature(record3) {
|
|
372340
372787
|
return digest5(`body:${record3.bodyText}#author:${record3.author}#parent:${record3.parentParaId ?? ""}` + `#done:${record3.doneState ? "1" : "0"}#date:${record3.date ?? ""}` + `#anchor:${commentAnchorSignature2(record3.anchor)}`);
|
|
@@ -372682,12 +373129,12 @@ function isResolutionSidecarAddition(key2, targetEntry) {
|
|
|
372682
373129
|
if (!targetEntry)
|
|
372683
373130
|
return false;
|
|
372684
373131
|
if (key2 === "ct:override:/word/commentsExtended.xml") {
|
|
372685
|
-
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(
|
|
373132
|
+
return targetEntry.semanticKey === key2 && targetEntry.contentSignature === sha256HexSync(TE64.encode("override:/word/commentsExtended.xml=" + "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"));
|
|
372686
373133
|
}
|
|
372687
373134
|
if (!key2.startsWith("rel:/word/document.xml|"))
|
|
372688
373135
|
return false;
|
|
372689
373136
|
const type = "http://schemas.microsoft.com/office/2011/relationships/commentsExtended";
|
|
372690
|
-
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(
|
|
373137
|
+
return targetEntry.semanticKey === `/word/document.xml|${type}` && targetEntry.contentSignature === sha256HexSync(TE64.encode(`type:${type}#mode:Internal#target:/word/commentsExtended.xml`));
|
|
372691
373138
|
}
|
|
372692
373139
|
function isCommentScopedPackageKey(context, key2, presentInBase, hasCommentCreate, targetEntry) {
|
|
372693
373140
|
if (key2.startsWith("ct:")) {
|
|
@@ -372805,14 +373252,14 @@ function validateAnchorResolvable(context, commentId, anchor) {
|
|
|
372805
373252
|
});
|
|
372806
373253
|
return page.hits.length > 0 ? null : `comment "${commentId}" target text was not found`;
|
|
372807
373254
|
}
|
|
372808
|
-
var
|
|
373255
|
+
var TE64;
|
|
372809
373256
|
var init_comments_replay = __esm(() => {
|
|
372810
373257
|
init_sd_document_session_internal();
|
|
372811
373258
|
init_read();
|
|
372812
373259
|
init_collect_text_page();
|
|
372813
373260
|
init_scope2();
|
|
372814
373261
|
init_part_fingerprint();
|
|
372815
|
-
|
|
373262
|
+
TE64 = new TextEncoder;
|
|
372816
373263
|
});
|
|
372817
373264
|
|
|
372818
373265
|
// ../../../v2/document-api-v2-adapter/dist/diff/styles-replay.js
|
|
@@ -372950,8 +373397,8 @@ function snapshotNumberingInventory(snapshot2) {
|
|
|
372950
373397
|
return snapshot2.sourceInventory?.families.find((f) => f.family === "numbering") ?? null;
|
|
372951
373398
|
}
|
|
372952
373399
|
function capturedNumberingFingerprint(xml) {
|
|
372953
|
-
const partHash = sha256HexSync(
|
|
372954
|
-
return `fp:${sha256HexSync(
|
|
373400
|
+
const partHash = sha256HexSync(TE65.encode(xml));
|
|
373401
|
+
return `fp:${sha256HexSync(TE65.encode(`${NUMBERING_PART_URI}:${partHash}`))}`;
|
|
372955
373402
|
}
|
|
372956
373403
|
function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
372957
373404
|
const problems = [];
|
|
@@ -372994,12 +373441,12 @@ function validateNumberingSourceAgainstSnapshot(source, snapshot2, label) {
|
|
|
372994
373441
|
}
|
|
372995
373442
|
return problems;
|
|
372996
373443
|
}
|
|
372997
|
-
var TD110,
|
|
373444
|
+
var TD110, TE65;
|
|
372998
373445
|
var init_numbering_replay = __esm(() => {
|
|
372999
373446
|
init_sd_document_session_internal();
|
|
373000
373447
|
init_definitions();
|
|
373001
373448
|
TD110 = new TextDecoder("utf-8", { fatal: false });
|
|
373002
|
-
|
|
373449
|
+
TE65 = new TextEncoder;
|
|
373003
373450
|
});
|
|
373004
373451
|
|
|
373005
373452
|
// ../../../v2/document-api-v2-adapter/dist/diff/settings-replay.js
|
|
@@ -373166,7 +373613,7 @@ function paragraphStyleOutlineLevelsFromStylesSource(stylesXml) {
|
|
|
373166
373613
|
return stylesXml == null ? new Map : parseParagraphStyleOutlineLevels(stylesXml);
|
|
373167
373614
|
}
|
|
373168
373615
|
function projectMainDocumentBodyEntries(source, options = {}) {
|
|
373169
|
-
const bytes =
|
|
373616
|
+
const bytes = TE66.encode(source.xml);
|
|
373170
373617
|
const paragraphStyleOutlineLevels = options.paragraphStyleOutlineLevels ?? paragraphStyleOutlineLevelMap(source.paragraphStyleOutlineLevels);
|
|
373171
373618
|
const paragraphIndex = buildParagraphIndex({
|
|
373172
373619
|
bytes,
|
|
@@ -373215,14 +373662,14 @@ function paragraphStyleOutlineLevelMap(record3) {
|
|
|
373215
373662
|
function capturedMainDocumentFingerprint(xml) {
|
|
373216
373663
|
return comparePartXmlFingerprint(MAIN_DOCUMENT_PART_URI, xml);
|
|
373217
373664
|
}
|
|
373218
|
-
var TD112,
|
|
373665
|
+
var TD112, TE66, MAIN_DOCUMENT_PART_URI = "/word/document.xml", MAIN_DOCUMENT_STORY_ID = "body:/word/document.xml", SNAPSHOT_REVISION = "snapshot";
|
|
373219
373666
|
var init_main_document_source = __esm(() => {
|
|
373220
373667
|
init_sd_document_session_internal();
|
|
373221
373668
|
init_document_reader();
|
|
373222
373669
|
init_run_signature2();
|
|
373223
373670
|
init_part_fingerprint();
|
|
373224
373671
|
TD112 = new TextDecoder("utf-8", { fatal: false });
|
|
373225
|
-
|
|
373672
|
+
TE66 = new TextEncoder;
|
|
373226
373673
|
});
|
|
373227
373674
|
|
|
373228
373675
|
// ../../../v2/document-api-v2-adapter/dist/diff/payloads.js
|
|
@@ -376465,7 +376912,7 @@ class V2DiffAdapter {
|
|
|
376465
376912
|
family: "tables",
|
|
376466
376913
|
partUri: DOCUMENT_PART_URI6,
|
|
376467
376914
|
kind: "modify",
|
|
376468
|
-
nextBytes:
|
|
376915
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
376469
376916
|
}));
|
|
376470
376917
|
const packageRewrites = [
|
|
376471
376918
|
...slotPlan.rewrites,
|
|
@@ -377053,7 +377500,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377053
377500
|
family: "styles",
|
|
377054
377501
|
partUri: step3.partUri,
|
|
377055
377502
|
kind: "modify",
|
|
377056
|
-
nextBytes:
|
|
377503
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377057
377504
|
});
|
|
377058
377505
|
}
|
|
377059
377506
|
for (const step3 of numberingSteps) {
|
|
@@ -377063,7 +377510,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377063
377510
|
family: "numbering",
|
|
377064
377511
|
partUri: NUMBERING_PART_URI4,
|
|
377065
377512
|
kind: "modify",
|
|
377066
|
-
nextBytes:
|
|
377513
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377067
377514
|
});
|
|
377068
377515
|
}
|
|
377069
377516
|
for (const step3 of settingsSteps) {
|
|
@@ -377071,7 +377518,7 @@ function buildKernelPackageRewrites(styleSteps, numberingSteps, settingsSteps) {
|
|
|
377071
377518
|
family: "settings",
|
|
377072
377519
|
partUri: step3.partUri,
|
|
377073
377520
|
kind: "modify",
|
|
377074
|
-
nextBytes:
|
|
377521
|
+
nextBytes: TE67.encode(step3.nextXml)
|
|
377075
377522
|
});
|
|
377076
377523
|
}
|
|
377077
377524
|
return rewrites;
|
|
@@ -378043,7 +378490,7 @@ function stripRootReplayNamespaceDeclarations(xml) {
|
|
|
378043
378490
|
const openEnd = xml.indexOf(">") + 1;
|
|
378044
378491
|
return stripReplayNamespaceDeclarations(xml.slice(0, openEnd)) + xml.slice(openEnd);
|
|
378045
378492
|
}
|
|
378046
|
-
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES,
|
|
378493
|
+
var FULL_DIFF_APPLY_SUPPORTED_FAMILIES, TE67, TD114, DOCUMENT_PART_URI6 = "/word/document.xml", NUMBERING_PART_URI4 = "/word/numbering.xml", EMPTY_MAIN_DOCUMENT_SOURCE, WORDPROCESSINGML_NS7 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", WORDPROCESSINGML_2010_NS2 = "http://schemas.microsoft.com/office/word/2010/wordml", WORDPROCESSING_MATH_NS = "http://schemas.openxmlformats.org/officeDocument/2006/math", MARKUP_COMPATIBILITY_NS3 = "http://schemas.openxmlformats.org/markup-compatibility/2006", VML_NS = "urn:schemas-microsoft-com:vml", STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES, STRUCTURAL_PARA_EDIT_DELETE_MATH_NAMES, STRUCTURAL_PARA_FORMAT_EDIT_WML_NAMES;
|
|
378047
378494
|
var init_adapter25 = __esm(() => {
|
|
378048
378495
|
init_tracked_table_property_replay();
|
|
378049
378496
|
init_src2();
|
|
@@ -378083,7 +378530,7 @@ var init_adapter25 = __esm(() => {
|
|
|
378083
378530
|
"fields-references",
|
|
378084
378531
|
"tracked-changes"
|
|
378085
378532
|
]);
|
|
378086
|
-
|
|
378533
|
+
TE67 = new TextEncoder;
|
|
378087
378534
|
TD114 = new TextDecoder;
|
|
378088
378535
|
EMPTY_MAIN_DOCUMENT_SOURCE = { xml: "" };
|
|
378089
378536
|
STRUCTURAL_PARA_EDIT_DELETE_WML_NAMES = new Set([
|
|
@@ -379851,8 +380298,8 @@ function commitTrackedDefinitionMutation(runtime, abstractNumId, txIdPrefix, mut
|
|
|
379851
380298
|
const id = reference.tag.attributes.find((attr3) => attr3.namespaceUri === WORDPROCESSINGML_NAMESPACE8 && attr3.localName === "val")?.value;
|
|
379852
380299
|
if (!id || !numIds.has(id))
|
|
379853
380300
|
continue;
|
|
379854
|
-
const startByte =
|
|
379855
|
-
const endByte =
|
|
380301
|
+
const startByte = TE68.encode(xml.slice(0, reference.start)).length;
|
|
380302
|
+
const endByte = TE68.encode(xml.slice(0, reference.end)).length;
|
|
379856
380303
|
if (!owners.some((owner) => owner.runtime.partUri === partUri && owner.paragraph.byteStart < startByte && owner.paragraph.byteEnd > endByte)) {
|
|
379857
380304
|
return { ok: false, code: "CAPABILITY_UNAVAILABLE", message: "Tracked shared numbering has an owner outside the editable paragraph stories." };
|
|
379858
380305
|
}
|
|
@@ -380262,7 +380709,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
380262
380709
|
paraId: edit.paraId,
|
|
380263
380710
|
startByte: paragraph4.byteStart,
|
|
380264
380711
|
endByte: paragraph4.byteEnd,
|
|
380265
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
380712
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE68.encode(edit.replacementXml)
|
|
380266
380713
|
};
|
|
380267
380714
|
}).filter((row) => row !== null).sort((left, right) => left.startByte - right.startByte);
|
|
380268
380715
|
if (patchRows.length !== input.documentEdits.length || patchRows.length === 0) {
|
|
@@ -380309,7 +380756,7 @@ function commitLocalizedRuntimeMutation(input) {
|
|
|
380309
380756
|
order: 0,
|
|
380310
380757
|
startByte: 0,
|
|
380311
380758
|
endByte: currentBytes.length,
|
|
380312
|
-
bytes:
|
|
380759
|
+
bytes: TE68.encode(serializeNumberingDocument(input.nextNumbering))
|
|
380313
380760
|
}]
|
|
380314
380761
|
};
|
|
380315
380762
|
}
|
|
@@ -380361,7 +380808,7 @@ function applyParagraphEdits(currentBytes, paragraphs, edits) {
|
|
|
380361
380808
|
return {
|
|
380362
380809
|
startByte: paragraph4.byteStart,
|
|
380363
380810
|
endByte: paragraph4.byteEnd,
|
|
380364
|
-
bytes: edit.replacementXml === null ? new Uint8Array :
|
|
380811
|
+
bytes: edit.replacementXml === null ? new Uint8Array : TE68.encode(edit.replacementXml)
|
|
380365
380812
|
};
|
|
380366
380813
|
}).filter((entry) => entry !== null).sort((left, right) => left.startByte - right.startByte);
|
|
380367
380814
|
const chunks = [];
|
|
@@ -380918,7 +381365,7 @@ function escapeForRegex2(value2) {
|
|
|
380918
381365
|
function createEmptyLevelXml(level, prefix = "w") {
|
|
380919
381366
|
return `<${prefix}:lvl w:ilvl="${level}"></${prefix}:lvl>`;
|
|
380920
381367
|
}
|
|
380921
|
-
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
381368
|
+
var NUMBERING_PART_URI5 = "/word/numbering.xml", WORDPROCESSINGML_NAMESPACE8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE68, TD115;
|
|
380922
381369
|
var init_runtime3 = __esm(() => {
|
|
380923
381370
|
init_src3();
|
|
380924
381371
|
init_sd_document_session_internal();
|
|
@@ -380928,7 +381375,7 @@ var init_runtime3 = __esm(() => {
|
|
|
380928
381375
|
init_xml();
|
|
380929
381376
|
init_xml_rewrite();
|
|
380930
381377
|
init_tracked_sequence_edits();
|
|
380931
|
-
|
|
381378
|
+
TE68 = new TextEncoder;
|
|
380932
381379
|
TD115 = new TextDecoder;
|
|
380933
381380
|
});
|
|
380934
381381
|
|
|
@@ -388140,7 +388587,7 @@ class V2HyperlinksAdapter {
|
|
|
388140
388587
|
after: {
|
|
388141
388588
|
partUri: entry.partUri,
|
|
388142
388589
|
startByte: entry.descriptor.byteStart,
|
|
388143
|
-
endByte: entry.descriptor.byteEnd +
|
|
388590
|
+
endByte: entry.descriptor.byteEnd + TE69.encode(nextHyperlinkXml).length - TE69.encode(hyperlinkXml).length
|
|
388144
388591
|
},
|
|
388145
388592
|
...input.patch.rel !== undefined ? { rel: input.patch.rel } : {}
|
|
388146
388593
|
}],
|
|
@@ -388422,7 +388869,7 @@ function hyperlinkSessionAnchor(partUri, descriptor) {
|
|
|
388422
388869
|
}
|
|
388423
388870
|
function createdHyperlinkAnchor(paragraph4, nextParagraphXml, nextDocumentXml, start, end) {
|
|
388424
388871
|
const catalog = buildHyperlinkCatalog({
|
|
388425
|
-
bytes:
|
|
388872
|
+
bytes: TE69.encode(nextDocumentXml),
|
|
388426
388873
|
storyId: paragraph4.storyId,
|
|
388427
388874
|
partUri: paragraph4.partUri,
|
|
388428
388875
|
relsBytes: null
|
|
@@ -388747,7 +389194,7 @@ function escapeRegex15(value2) {
|
|
|
388747
389194
|
function defaultRelationshipsXml3() {
|
|
388748
389195
|
return '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
388749
389196
|
}
|
|
388750
|
-
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120,
|
|
389197
|
+
var HYPERLINK_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", TD120, TE69;
|
|
388751
389198
|
var init_adapter34 = __esm(() => {
|
|
388752
389199
|
init_sd_document_session_internal();
|
|
388753
389200
|
init_inline();
|
|
@@ -388758,7 +389205,7 @@ var init_adapter34 = __esm(() => {
|
|
|
388758
389205
|
init_stories();
|
|
388759
389206
|
init_registry3();
|
|
388760
389207
|
TD120 = new TextDecoder;
|
|
388761
|
-
|
|
389208
|
+
TE69 = new TextEncoder;
|
|
388762
389209
|
});
|
|
388763
389210
|
|
|
388764
389211
|
// ../../../v2/document-api-v2-adapter/dist/watermarks/serialization.js
|
|
@@ -392975,9 +393422,9 @@ function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
|
392975
393422
|
const id = readXmlAttributes(note.tag, W_NS8, "id")[0]?.value;
|
|
392976
393423
|
if (!id || groups.has(id))
|
|
392977
393424
|
return null;
|
|
392978
|
-
byteCursor +=
|
|
393425
|
+
byteCursor += TE70.encode(xml.slice(charCursor, note.start)).byteLength;
|
|
392979
393426
|
const byteStart = byteCursor;
|
|
392980
|
-
byteCursor +=
|
|
393427
|
+
byteCursor += TE70.encode(xml.slice(note.start, note.end)).byteLength;
|
|
392981
393428
|
charCursor = note.end;
|
|
392982
393429
|
const group = [];
|
|
392983
393430
|
while (entryCursor < sourceEntries.length && sourceEntries[entryCursor].byteStart < byteCursor) {
|
|
@@ -393015,11 +393462,11 @@ function resolveFootnoteRangeIndex(session, index2, start, end) {
|
|
|
393015
393462
|
byParaId: (blockId) => byBlockId.get(blockId) ?? null
|
|
393016
393463
|
};
|
|
393017
393464
|
}
|
|
393018
|
-
var W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
393465
|
+
var W_NS8 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", TE70;
|
|
393019
393466
|
var init_footnote_range = __esm(() => {
|
|
393020
393467
|
init_sd_document_session_internal();
|
|
393021
393468
|
init_note_story();
|
|
393022
|
-
|
|
393469
|
+
TE70 = new TextEncoder;
|
|
393023
393470
|
});
|
|
393024
393471
|
|
|
393025
393472
|
// ../../../v2/document-api-v2-adapter/dist/clipboard/serialize.js
|
|
@@ -395423,7 +395870,7 @@ function clipReferencedDefinitions(bytes, kind, ids) {
|
|
|
395423
395870
|
if (children2.length !== ids.size) {
|
|
395424
395871
|
invalid4("PRECONDITION_FAILED", `Selected ${kind} definition is missing.`);
|
|
395425
395872
|
}
|
|
395426
|
-
return
|
|
395873
|
+
return TE71.encode(`${xml.slice(root.range.start, root.range.openEnd)}` + children2.map((child) => xml.slice(child.range.start, child.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395427
395874
|
}
|
|
395428
395875
|
function wordValue(range, name) {
|
|
395429
395876
|
return range.tag.attributes.find((attribute2) => attribute2.namespaceUri === W23 && attribute2.localName === name)?.value ?? null;
|
|
@@ -395467,7 +395914,7 @@ function clipStylesPart(bytes, requestedIds) {
|
|
|
395467
395914
|
}
|
|
395468
395915
|
}
|
|
395469
395916
|
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W23 && (node4.range.tag.localName === "docDefaults" || node4.range.tag.localName === "style" && wanted.has(wordValue(node4.range, "styleId") ?? "")));
|
|
395470
|
-
return
|
|
395917
|
+
return TE71.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395471
395918
|
}
|
|
395472
395919
|
function clipNumberingPart(bytes, requestedIds) {
|
|
395473
395920
|
const xml = TD122.decode(bytes);
|
|
@@ -395486,7 +395933,7 @@ function clipNumberingPart(bytes, requestedIds) {
|
|
|
395486
395933
|
invalid4("PRECONDITION_FAILED", "Selected abstract numbering definition is missing.");
|
|
395487
395934
|
const pictureIds = new Set(abstracts.flatMap((node4) => parsed.ranges.filter((range) => range.start > node4.range.start && range.end < node4.range.end && range.tag.namespaceUri === W23 && range.tag.localName === "lvlPicBulletId").map((range) => wordValue(range, "val")).filter((id) => id != null)));
|
|
395488
395935
|
const retained = root.children.filter((node4) => node4.range.tag.namespaceUri === W23 && (node4.range.tag.localName === "num" && requestedIds.has(wordValue(node4.range, "numId") ?? "") || node4.range.tag.localName === "abstractNum" && abstractIds.has(wordValue(node4.range, "abstractNumId") ?? "") || node4.range.tag.localName === "numPicBullet" && pictureIds.has(wordValue(node4.range, "numPicBulletId") ?? "")));
|
|
395489
|
-
return
|
|
395936
|
+
return TE71.encode(xml.slice(root.range.start, root.range.openEnd) + retained.map((node4) => xml.slice(node4.range.start, node4.range.end)).join("") + xml.slice(root.range.closeStart, root.range.end));
|
|
395490
395937
|
}
|
|
395491
395938
|
function collectPairedMarkerContext(partXml, ranges, selectionStart, selectionEnd, context) {
|
|
395492
395939
|
const pairs = [
|
|
@@ -395575,8 +396022,8 @@ function captureTableSelection(context, at, resultAt = at, whole = false) {
|
|
|
395575
396022
|
const nested = parsed.ranges.some((ancestor) => ancestor.start < range.start && ancestor.end > range.end && ancestor.tag.namespaceUri === W23 && ancestor.tag.localName === "tbl");
|
|
395576
396023
|
if (!nested)
|
|
395577
396024
|
continue;
|
|
395578
|
-
const byteStart =
|
|
395579
|
-
const byteEnd =
|
|
396025
|
+
const byteStart = TE71.encode(partXml.slice(0, range.start)).byteLength;
|
|
396026
|
+
const byteEnd = TE71.encode(partXml.slice(0, range.end)).byteLength;
|
|
395580
396027
|
const nestedCatalog = buildTableCatalog({
|
|
395581
396028
|
bytes: bytes.subarray(byteStart, byteEnd),
|
|
395582
396029
|
storyId: story.storyId,
|
|
@@ -396407,7 +396854,7 @@ function captureSelectionOoxml(context, input) {
|
|
|
396407
396854
|
diagnostics: []
|
|
396408
396855
|
};
|
|
396409
396856
|
}
|
|
396410
|
-
var W23 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", TD122,
|
|
396857
|
+
var W23 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", R2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", TD122, TE71, MAX_CAPTURE_DEPENDENCIES = 1024, MAX_CAPTURE_DEPENDENCY_BYTES, PROPERTY_NODES;
|
|
396411
396858
|
var init_capture2 = __esm(() => {
|
|
396412
396859
|
init_src3();
|
|
396413
396860
|
init_sd_document_session_internal();
|
|
@@ -396416,7 +396863,7 @@ var init_capture2 = __esm(() => {
|
|
|
396416
396863
|
init_public_model();
|
|
396417
396864
|
init_runtime2();
|
|
396418
396865
|
TD122 = new TextDecoder;
|
|
396419
|
-
|
|
396866
|
+
TE71 = new TextEncoder;
|
|
396420
396867
|
MAX_CAPTURE_DEPENDENCY_BYTES = 128 * 1024 * 1024;
|
|
396421
396868
|
PROPERTY_NODES = new Set([
|
|
396422
396869
|
"tblPr",
|
|
@@ -396483,150 +396930,6 @@ var init_adapter38 = __esm(() => {
|
|
|
396483
396930
|
init_capture2();
|
|
396484
396931
|
});
|
|
396485
396932
|
|
|
396486
|
-
// ../../../v2/document-api-v2-adapter/dist/core/clear-content-adapter.js
|
|
396487
|
-
class V2ClearContentAdapter {
|
|
396488
|
-
constructor(context) {
|
|
396489
|
-
this.context = context;
|
|
396490
|
-
}
|
|
396491
|
-
clearContent(_input, options) {
|
|
396492
|
-
const expectedRevision = options?.expectedRevision != null ? String(options.expectedRevision) : undefined;
|
|
396493
|
-
const mutationFailure5 = this.context.validateMutation(options);
|
|
396494
|
-
if (mutationFailure5)
|
|
396495
|
-
return { success: false, failure: mutationFailure5 };
|
|
396496
|
-
const bodyStory = this.context.resolveFullStoryLocator({ kind: "story", storyType: "body" });
|
|
396497
|
-
if ("error" in bodyStory) {
|
|
396498
|
-
return {
|
|
396499
|
-
success: false,
|
|
396500
|
-
failure: {
|
|
396501
|
-
code: "TARGET_NOT_FOUND",
|
|
396502
|
-
message: `body story could not be resolved: ${bodyStory.error}.`
|
|
396503
|
-
}
|
|
396504
|
-
};
|
|
396505
|
-
}
|
|
396506
|
-
const topLevelItems = readTopLevelBodyItems(this.context);
|
|
396507
|
-
const imagesByPara = readBodyParagraphImageMap(this.context);
|
|
396508
|
-
if (isAlreadyClear(topLevelItems, imagesByPara)) {
|
|
396509
|
-
return { success: true, status: "NO_OP" };
|
|
396510
|
-
}
|
|
396511
|
-
const bytes = getSDDocumentSessionInternalPartBytes(this.context.session, bodyStory.partUri);
|
|
396512
|
-
if (!bytes) {
|
|
396513
|
-
return {
|
|
396514
|
-
success: false,
|
|
396515
|
-
failure: { code: "PRECONDITION_FAILED", message: "body part bytes are unavailable." }
|
|
396516
|
-
};
|
|
396517
|
-
}
|
|
396518
|
-
const sourceXml = new TextDecoder().decode(bytes);
|
|
396519
|
-
const paragraphId4 = firstParagraphId(topLevelItems);
|
|
396520
|
-
let nextXml = rewriteBodyToSingleEmptyParagraph(sourceXml, paragraphId4);
|
|
396521
|
-
if (nextXml == null) {
|
|
396522
|
-
return {
|
|
396523
|
-
success: false,
|
|
396524
|
-
failure: { code: "INTERNAL_ERROR", message: "document body could not be rewritten." }
|
|
396525
|
-
};
|
|
396526
|
-
}
|
|
396527
|
-
const changeMode = options?.changeMode ?? "direct";
|
|
396528
|
-
const createdRefs = [];
|
|
396529
|
-
if (changeMode === "tracked") {
|
|
396530
|
-
const replacement = prepareTrackedBodyReplacement({
|
|
396531
|
-
context: this.context,
|
|
396532
|
-
beforeXml: sourceXml,
|
|
396533
|
-
afterXml: nextXml,
|
|
396534
|
-
dryRun: options?.dryRun
|
|
396535
|
-
});
|
|
396536
|
-
if (!replacement.ok) {
|
|
396537
|
-
return { success: false, failure: { code: replacement.code, message: replacement.message } };
|
|
396538
|
-
}
|
|
396539
|
-
nextXml = replacement.xml;
|
|
396540
|
-
createdRefs.push(...replacement.wordIds.map((entityId) => ({
|
|
396541
|
-
kind: "trackedChange",
|
|
396542
|
-
entityId,
|
|
396543
|
-
storyId: bodyStory.storyId
|
|
396544
|
-
})));
|
|
396545
|
-
createdRefs.push(...replacement.paragraphIds.map((nodeId) => ({
|
|
396546
|
-
kind: "block",
|
|
396547
|
-
nodeId,
|
|
396548
|
-
storyId: bodyStory.storyId
|
|
396549
|
-
})));
|
|
396550
|
-
}
|
|
396551
|
-
if (options?.dryRun)
|
|
396552
|
-
return { success: true };
|
|
396553
|
-
const nextBytes = TE71.encode(nextXml);
|
|
396554
|
-
const committed = commitKernelStorySurfacePatch({
|
|
396555
|
-
context: this.context,
|
|
396556
|
-
txIdPrefix: "internal-clearContent",
|
|
396557
|
-
expectedRevision,
|
|
396558
|
-
perPart: {
|
|
396559
|
-
[bodyStory.partUri]: replaceWholePartEntry(bytes, nextBytes)
|
|
396560
|
-
},
|
|
396561
|
-
storyIds: [bodyStory.storyId],
|
|
396562
|
-
createdRefs,
|
|
396563
|
-
signalLanesToRebuild: ["paragraphIndex", "sections", "headings", "manualPageBreaks", "drawings", "noteAnchorRefs"],
|
|
396564
|
-
indexRefreshScope: {
|
|
396565
|
-
perPart: {
|
|
396566
|
-
[bodyStory.partUri]: {
|
|
396567
|
-
beforeWindow: { startByte: 0, endByte: bytes.length },
|
|
396568
|
-
kind: "wide-rewrite",
|
|
396569
|
-
reason: "clear-content-whole-body-rewrite"
|
|
396570
|
-
}
|
|
396571
|
-
}
|
|
396572
|
-
},
|
|
396573
|
-
storySurface: { family: "storyBlocks", changeMode }
|
|
396574
|
-
});
|
|
396575
|
-
if (!committed.ok) {
|
|
396576
|
-
return {
|
|
396577
|
-
success: false,
|
|
396578
|
-
failure: {
|
|
396579
|
-
code: committed.code,
|
|
396580
|
-
message: committed.message
|
|
396581
|
-
}
|
|
396582
|
-
};
|
|
396583
|
-
}
|
|
396584
|
-
const inserted = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
396585
|
-
return {
|
|
396586
|
-
success: true,
|
|
396587
|
-
txId: committed.txId,
|
|
396588
|
-
affectedStories: [{ kind: "story", storyType: "body" }],
|
|
396589
|
-
...inserted.length ? { inserted } : {}
|
|
396590
|
-
};
|
|
396591
|
-
}
|
|
396592
|
-
}
|
|
396593
|
-
function isAlreadyClear(items, imagesByPara) {
|
|
396594
|
-
if (items.length !== 1 || items[0]?.kind !== "paragraph")
|
|
396595
|
-
return false;
|
|
396596
|
-
const paragraph4 = items[0].paragraph;
|
|
396597
|
-
return paragraph4.text.length === 0 && (imagesByPara.get(paragraph4.blockId)?.length ?? 0) === 0;
|
|
396598
|
-
}
|
|
396599
|
-
function firstParagraphId(items) {
|
|
396600
|
-
const paragraph4 = items.find((item) => item.kind === "paragraph");
|
|
396601
|
-
return paragraph4?.paragraph.blockId ?? "00000000";
|
|
396602
|
-
}
|
|
396603
|
-
function rewriteBodyToSingleEmptyParagraph(xml, paragraphId4) {
|
|
396604
|
-
const bodyMatch = xml.match(/(<[\w.-]+:body\b[^>]*>)([\s\S]*?)(<\/[\w.-]+:body>)/);
|
|
396605
|
-
if (!bodyMatch)
|
|
396606
|
-
return null;
|
|
396607
|
-
const bodyOpen = bodyMatch[1];
|
|
396608
|
-
const bodyInner = bodyMatch[2];
|
|
396609
|
-
const bodyClose = bodyMatch[3];
|
|
396610
|
-
const sectPrXml = readTrailingBodySectPr2(bodyInner);
|
|
396611
|
-
const emptyParagraph = `<w:p w14:paraId="${paragraphId4}"><w:r><w:t></w:t></w:r></w:p>`;
|
|
396612
|
-
return xml.replace(bodyMatch[0], `${bodyOpen}${emptyParagraph}${sectPrXml}${bodyClose}`);
|
|
396613
|
-
}
|
|
396614
|
-
function readTrailingBodySectPr2(bodyInner) {
|
|
396615
|
-
if (!bodyInner)
|
|
396616
|
-
return "";
|
|
396617
|
-
const match = bodyInner.match(/(<([\w.-]+):sectPr\b[^>]*\/>|<([\w.-]+):sectPr\b(?:(?!<[\w.-]+:sectPr\b)[\s\S])*?<\/\3:sectPr>)\s*$/);
|
|
396618
|
-
return match?.[1] ?? "";
|
|
396619
|
-
}
|
|
396620
|
-
var TE71;
|
|
396621
|
-
var init_clear_content_adapter = __esm(() => {
|
|
396622
|
-
init_sd_document_session_internal();
|
|
396623
|
-
init_document_reader();
|
|
396624
|
-
init_xml();
|
|
396625
|
-
init_tracked_body_replacement();
|
|
396626
|
-
init_receipt_entities();
|
|
396627
|
-
TE71 = new TextEncoder;
|
|
396628
|
-
});
|
|
396629
|
-
|
|
396630
396933
|
// ../../../v2/document-api-v2-adapter/dist/formatting/styles.js
|
|
396631
396934
|
function applyStylesDocDefaultsPatch(stylesXml, input) {
|
|
396632
396935
|
const normalized = normalizeStylesWordprocessingMlQNames(stylesXml);
|