@superdoc/mcp 1.10.0-next.10 → 1.10.0-next.12
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 +334 -79
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31630,7 +31630,7 @@ var init_host = __esm(() => {
|
|
|
31630
31630
|
});
|
|
31631
31631
|
|
|
31632
31632
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31633
|
-
var SDK_VERSION = "2.23.0-next.
|
|
31633
|
+
var SDK_VERSION = "2.23.0-next.12";
|
|
31634
31634
|
|
|
31635
31635
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31636
31636
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -218056,6 +218056,7 @@ function compileSemanticStyleDependencies(state, requestedRoles, roleStyleIdHint
|
|
|
218056
218056
|
const occupied = new Set(Object.keys(records));
|
|
218057
218057
|
const styleIdByRole = new Map;
|
|
218058
218058
|
const definitions = [];
|
|
218059
|
+
const hasThemePart = documentHasThemePart(state);
|
|
218059
218060
|
for (const role of roles) {
|
|
218060
218061
|
const resolution = index.resolve(role);
|
|
218061
218062
|
if (resolution.status === "authored") {
|
|
@@ -218082,6 +218083,8 @@ function compileSemanticStyleDependencies(state, requestedRoles, roleStyleIdHint
|
|
|
218082
218083
|
});
|
|
218083
218084
|
if (!definition)
|
|
218084
218085
|
return { ok: false, reason: "style-reference-not-found" };
|
|
218086
|
+
if (!hasThemePart)
|
|
218087
|
+
withoutThemeReferences(definition);
|
|
218085
218088
|
definitions.push(definition);
|
|
218086
218089
|
occupied.add(styleId);
|
|
218087
218090
|
records[styleId] = definition;
|
|
@@ -218453,7 +218456,52 @@ function byteWindowPrecondition3(partUri, bytes) {
|
|
|
218453
218456
|
exactLength: bytes.length
|
|
218454
218457
|
};
|
|
218455
218458
|
}
|
|
218456
|
-
|
|
218459
|
+
function withoutThemeReferences(definition) {
|
|
218460
|
+
const run = definition.runProperties;
|
|
218461
|
+
if (!run)
|
|
218462
|
+
return;
|
|
218463
|
+
const fontFamily = run.fontFamily;
|
|
218464
|
+
if (fontFamily) {
|
|
218465
|
+
const literal3 = {};
|
|
218466
|
+
for (const [key3, value] of Object.entries(fontFamily)) {
|
|
218467
|
+
if (!/Theme$|^cstheme$/i.test(key3))
|
|
218468
|
+
literal3[key3] = value;
|
|
218469
|
+
}
|
|
218470
|
+
const ascii = fontFamily.ascii ?? THEME_FONT_FALLBACKS[fontFamily.asciiTheme ?? ""];
|
|
218471
|
+
const hAnsi = fontFamily.hAnsi ?? THEME_FONT_FALLBACKS[fontFamily.hAnsiTheme ?? ""] ?? ascii;
|
|
218472
|
+
if (ascii)
|
|
218473
|
+
literal3.ascii = ascii;
|
|
218474
|
+
if (hAnsi)
|
|
218475
|
+
literal3.hAnsi = hAnsi;
|
|
218476
|
+
if (Object.keys(literal3).length)
|
|
218477
|
+
run.fontFamily = literal3;
|
|
218478
|
+
else
|
|
218479
|
+
delete run.fontFamily;
|
|
218480
|
+
}
|
|
218481
|
+
const color = run.color;
|
|
218482
|
+
if (color?.themeColor) {
|
|
218483
|
+
if (color.val)
|
|
218484
|
+
run.color = { val: color.val };
|
|
218485
|
+
else
|
|
218486
|
+
delete run.color;
|
|
218487
|
+
}
|
|
218488
|
+
}
|
|
218489
|
+
function documentHasThemePart(state) {
|
|
218490
|
+
const relsUri = "/word/_rels/document.xml.rels";
|
|
218491
|
+
const relsBytes = ensurePackagePartBytes(state, relsUri);
|
|
218492
|
+
if (relsBytes) {
|
|
218493
|
+
const rels = parseRelationshipsXml(new TextDecoder().decode(relsBytes), {
|
|
218494
|
+
ownerPartUri: "/word/document.xml",
|
|
218495
|
+
relsUri,
|
|
218496
|
+
resolveTarget: (target, mode) => mode === "External" ? target : resolveTargetUri("/word/document.xml", target, mode, state.parts)
|
|
218497
|
+
});
|
|
218498
|
+
const related = rels.relationships.some((rel) => rel.targetMode === "Internal" && rel.type.endsWith("/relationships/theme") && state.parts.has(rel.resolvedTarget));
|
|
218499
|
+
if (related)
|
|
218500
|
+
return true;
|
|
218501
|
+
}
|
|
218502
|
+
return [...state.parts.keys()].some((uri) => /\/theme\/theme\d*\.xml$/i.test(uri));
|
|
218503
|
+
}
|
|
218504
|
+
var TE22, TD48, CONTENT_TYPES_NS3 = "http://schemas.openxmlformats.org/package/2006/content-types", STYLES_PART_URI, CONTENT_TYPES_PART_URI4 = "/[Content_Types].xml", STYLES_CONTENT_TYPE, STYLES_RELATIONSHIP_TYPE, THEME_FONT_FALLBACKS;
|
|
218457
218505
|
var init_semantic_style_dependencies = __esm(() => {
|
|
218458
218506
|
init_semantic_style_roles();
|
|
218459
218507
|
init_semantic_style_definitions();
|
|
@@ -218468,6 +218516,12 @@ var init_semantic_style_dependencies = __esm(() => {
|
|
|
218468
218516
|
STYLES_PART_URI = CANONICAL_STYLE_DEFINITIONS_PART_URI;
|
|
218469
218517
|
STYLES_CONTENT_TYPE = CONTENT_TYPE_FOR_KIND.styles;
|
|
218470
218518
|
STYLES_RELATIONSHIP_TYPE = RELATIONSHIP_TYPE_FOR_KIND.styles;
|
|
218519
|
+
THEME_FONT_FALLBACKS = {
|
|
218520
|
+
majorHAnsi: "Calibri Light",
|
|
218521
|
+
majorAscii: "Calibri Light",
|
|
218522
|
+
minorHAnsi: "Calibri",
|
|
218523
|
+
minorAscii: "Calibri"
|
|
218524
|
+
};
|
|
218471
218525
|
});
|
|
218472
218526
|
|
|
218473
218527
|
// ../../../v2/editor-core/dist/document/transactions/types.js
|
|
@@ -223018,6 +223072,7 @@ function runListApplyCommit(input) {
|
|
|
223018
223072
|
const paraRewrite = trackedFormatting ? rewriteParagraphNumPrTracked(paraXml, { numId: chosenNumId, ilvl }, trackedFormatting) : rewriteParagraphNumPr(paraXml, { numId: chosenNumId, ilvl });
|
|
223019
223073
|
if (!paraRewrite.ok)
|
|
223020
223074
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223075
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223021
223076
|
const paragraphPatch = {
|
|
223022
223077
|
kind: "replaceBytes",
|
|
223023
223078
|
order: 0,
|
|
@@ -223059,10 +223114,10 @@ function runListApplyCommit(input) {
|
|
|
223059
223114
|
perPart,
|
|
223060
223115
|
preconditions,
|
|
223061
223116
|
extraPatchMaps,
|
|
223062
|
-
createdRefs:
|
|
223117
|
+
createdRefs: recordedRevision ? [
|
|
223063
223118
|
{
|
|
223064
223119
|
kind: "trackedChange",
|
|
223065
|
-
entityId:
|
|
223120
|
+
entityId: recordedRevision.entityKey,
|
|
223066
223121
|
storyId: op.target.storyId
|
|
223067
223122
|
}
|
|
223068
223123
|
] : [],
|
|
@@ -223260,10 +223315,11 @@ function runListApplyRangeCommit(input) {
|
|
|
223260
223315
|
const paraRewrite = trackedFormatting ? rewriteParagraphNumPrTracked(target.paraXml, { numId: chosenNumId, ilvl: writeIlvl }, trackedFormatting) : rewriteParagraphNumPr(target.paraXml, { numId: chosenNumId, ilvl: writeIlvl });
|
|
223261
223316
|
if (!paraRewrite.ok)
|
|
223262
223317
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223263
|
-
|
|
223318
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223319
|
+
if (recordedRevision) {
|
|
223264
223320
|
trackedCreatedRefs.push({
|
|
223265
223321
|
kind: "trackedChange",
|
|
223266
|
-
entityId:
|
|
223322
|
+
entityId: recordedRevision.entityKey,
|
|
223267
223323
|
storyId: op.target.storyId
|
|
223268
223324
|
});
|
|
223269
223325
|
}
|
|
@@ -223438,6 +223494,7 @@ function runListRestartCommit(input) {
|
|
|
223438
223494
|
});
|
|
223439
223495
|
if (!paraRewrite.ok)
|
|
223440
223496
|
return rejected4(input.txId, paraRewrite.reason);
|
|
223497
|
+
const recordedRevision = recordedFormatting(trackedFormatting, paraRewrite);
|
|
223441
223498
|
const paragraphPatch = {
|
|
223442
223499
|
kind: "replaceBytes",
|
|
223443
223500
|
order: 0,
|
|
@@ -223481,10 +223538,10 @@ function runListRestartCommit(input) {
|
|
|
223481
223538
|
extraPatchMaps: {
|
|
223482
223539
|
[NUMBERING_PART_URI]: { partUri: NUMBERING_PART_URI, ranges: [] }
|
|
223483
223540
|
},
|
|
223484
|
-
createdRefs:
|
|
223541
|
+
createdRefs: recordedRevision ? [
|
|
223485
223542
|
{
|
|
223486
223543
|
kind: "trackedChange",
|
|
223487
|
-
entityId:
|
|
223544
|
+
entityId: recordedRevision.entityKey,
|
|
223488
223545
|
storyId: op.target.storyId
|
|
223489
223546
|
}
|
|
223490
223547
|
] : [],
|
|
@@ -223516,21 +223573,28 @@ function runListSetLevelCommit(input) {
|
|
|
223516
223573
|
if (!bytes)
|
|
223517
223574
|
return rejected4(input.txId, "invalid-range");
|
|
223518
223575
|
const paraXml = decodeByteRange(bytes, target.entry.byteStart, target.entry.byteEnd);
|
|
223519
|
-
const structural = classifyParagraphForList(paraXml
|
|
223576
|
+
const structural = classifyParagraphForList(paraXml, {
|
|
223577
|
+
allowParagraphPropertyChanges: Boolean(trackedFormatting)
|
|
223578
|
+
});
|
|
223520
223579
|
if (!structural.ok)
|
|
223521
223580
|
return rejected4(input.txId, structural.reason);
|
|
223522
|
-
const
|
|
223581
|
+
const effective = resolveEffectiveListReferenceForState(input.state, paraXml);
|
|
223582
|
+
const plan = decideListSetLevel(effective, op.ilvl);
|
|
223523
223583
|
if (plan.kind === "reject")
|
|
223524
223584
|
return rejected4(input.txId, plan.reason);
|
|
223525
223585
|
if (plan.kind === "no-op") {
|
|
223526
223586
|
return { txId: input.txId, status: "committed", packageRevision: input.state.packageRevision };
|
|
223527
223587
|
}
|
|
223588
|
+
const targetStyle = resolveTargetLevelParagraphStyle(input.state, effective, plan.ilvl);
|
|
223589
|
+
if (!targetStyle.ok)
|
|
223590
|
+
return rejected4(input.txId, targetStyle.reason);
|
|
223528
223591
|
return commitParagraphNumPrRewrite({
|
|
223529
223592
|
input,
|
|
223530
223593
|
target,
|
|
223531
223594
|
bytes,
|
|
223532
223595
|
paraXml,
|
|
223533
223596
|
numPr: { numId: plan.numId, ilvl: plan.ilvl },
|
|
223597
|
+
paragraphStyleId: targetStyle.paragraphStyleId,
|
|
223534
223598
|
trackedFormatting
|
|
223535
223599
|
});
|
|
223536
223600
|
}
|
|
@@ -223718,7 +223782,7 @@ function changeIlvlRange(input, delta) {
|
|
|
223718
223782
|
entry: target.entry,
|
|
223719
223783
|
paraXml,
|
|
223720
223784
|
nextXml: rewrite.xml,
|
|
223721
|
-
trackedEntityKey: trackedFormatting?.entityKey ?? null
|
|
223785
|
+
trackedEntityKey: recordedFormatting(trackedFormatting, rewrite)?.entityKey ?? null
|
|
223722
223786
|
});
|
|
223723
223787
|
}
|
|
223724
223788
|
if (!storyPartUri || !storyBytes)
|
|
@@ -223818,15 +223882,16 @@ function runListRemoveCommit(input) {
|
|
|
223818
223882
|
const rewrite = trackedFormatting ? wrapParagraphTrackedChange(directRewrite.xml, paraXml, trackedFormatting) : directRewrite;
|
|
223819
223883
|
if (!rewrite.ok)
|
|
223820
223884
|
return rejected4(input.txId, rewrite.reason);
|
|
223885
|
+
const recordedRevision = recordedFormatting(trackedFormatting, rewrite);
|
|
223821
223886
|
return commitParagraphRewrite({
|
|
223822
223887
|
input,
|
|
223823
223888
|
target,
|
|
223824
223889
|
bytes,
|
|
223825
223890
|
nextXml: rewrite.xml,
|
|
223826
|
-
createdRefs:
|
|
223891
|
+
createdRefs: recordedRevision ? [
|
|
223827
223892
|
{
|
|
223828
223893
|
kind: "trackedChange",
|
|
223829
|
-
entityId:
|
|
223894
|
+
entityId: recordedRevision.entityKey,
|
|
223830
223895
|
storyId: op.target.storyId
|
|
223831
223896
|
}
|
|
223832
223897
|
] : [],
|
|
@@ -224103,15 +224168,16 @@ function commitParagraphNumPrRewrite(args) {
|
|
|
224103
224168
|
const rewrite = args.trackedFormatting ? rewriteParagraphNumPrTracked(args.paraXml, args.numPr, args.trackedFormatting, args.paragraphStyleId) : rewriteParagraphNumPr(args.paraXml, args.numPr, args.paragraphStyleId);
|
|
224104
224169
|
if (!rewrite.ok)
|
|
224105
224170
|
return rejected4(args.input.txId, rewrite.reason);
|
|
224171
|
+
const recordedRevision = recordedFormatting(args.trackedFormatting, rewrite);
|
|
224106
224172
|
return commitParagraphRewrite({
|
|
224107
224173
|
input: args.input,
|
|
224108
224174
|
target: args.target,
|
|
224109
224175
|
bytes: args.bytes,
|
|
224110
224176
|
nextXml: rewrite.xml,
|
|
224111
|
-
createdRefs:
|
|
224177
|
+
createdRefs: recordedRevision ? [
|
|
224112
224178
|
{
|
|
224113
224179
|
kind: "trackedChange",
|
|
224114
|
-
entityId:
|
|
224180
|
+
entityId: recordedRevision.entityKey,
|
|
224115
224181
|
storyId: args.input.op.target.storyId
|
|
224116
224182
|
}
|
|
224117
224183
|
] : [],
|
|
@@ -224201,6 +224267,9 @@ function buildTrackedListFormattingAllocator(input, storyId) {
|
|
|
224201
224267
|
}
|
|
224202
224268
|
};
|
|
224203
224269
|
}
|
|
224270
|
+
function recordedFormatting(tracked, rewrite) {
|
|
224271
|
+
return tracked && rewrite.recorded ? tracked : undefined;
|
|
224272
|
+
}
|
|
224204
224273
|
function rewriteParagraphNumPrTracked(paraXml, numPr, tracked, paragraphStyleId) {
|
|
224205
224274
|
const direct = rewriteParagraphNumPr(paraXml, numPr, paragraphStyleId);
|
|
224206
224275
|
if (!direct.ok)
|
|
@@ -224216,6 +224285,9 @@ function wrapParagraphTrackedChange(nextParaXml, beforeParaXml, tracked) {
|
|
|
224216
224285
|
if (existingChange && existingChange.author !== tracked.author) {
|
|
224217
224286
|
return { ok: false, reason: "list-tracked-wrapper-unsupported" };
|
|
224218
224287
|
}
|
|
224288
|
+
if (beforeBlock && paragraphMarkInsertedBy(beforeBlock.inner, tracked.author) || paragraphMarkInsertedBy(afterBlock.inner, tracked.author)) {
|
|
224289
|
+
return { ok: true, xml: nextParaXml, recorded: false };
|
|
224290
|
+
}
|
|
224219
224291
|
const beforeXml = buildParagraphPropertyBaseSnapshot(existingChange?.innerXml ?? beforeBlock?.fullXml, afterBlock.prefix);
|
|
224220
224292
|
const afterInner = removeParagraphPropertyChangeBlocks(afterBlock.inner);
|
|
224221
224293
|
const names = wordNamesForPrefix(afterBlock.prefix);
|
|
@@ -224224,9 +224296,23 @@ function wrapParagraphTrackedChange(nextParaXml, beforeParaXml, tracked) {
|
|
|
224224
224296
|
const replacement2 = `${afterBlock.openTag}${afterInner}${wrapper}${afterBlock.closeTag}`;
|
|
224225
224297
|
return {
|
|
224226
224298
|
ok: true,
|
|
224227
|
-
xml: nextParaXml.slice(0, afterBlock.start) + replacement2 + nextParaXml.slice(afterBlock.end)
|
|
224299
|
+
xml: nextParaXml.slice(0, afterBlock.start) + replacement2 + nextParaXml.slice(afterBlock.end),
|
|
224300
|
+
recorded: true
|
|
224228
224301
|
};
|
|
224229
224302
|
}
|
|
224303
|
+
function paragraphMarkInsertedBy(pPrInner, author) {
|
|
224304
|
+
const markProps = /<(?:\w+:)?rPr\b[^>]*>([\s\S]*?)<\/(?:\w+:)?rPr>/.exec(pPrInner)?.[1];
|
|
224305
|
+
if (!markProps)
|
|
224306
|
+
return false;
|
|
224307
|
+
const ins = /<(?:\w+:)?ins\b([^>]*)\/?>/.exec(markProps)?.[1];
|
|
224308
|
+
if (ins == null)
|
|
224309
|
+
return false;
|
|
224310
|
+
const insAuthor = /(?:^|\s)(?:\w+:)?author="([^"]*)"/.exec(ins)?.[1];
|
|
224311
|
+
return insAuthor != null && unescapeAttr(insAuthor) === author;
|
|
224312
|
+
}
|
|
224313
|
+
function unescapeAttr(value) {
|
|
224314
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
224315
|
+
}
|
|
224230
224316
|
function directXmlChildren(xml) {
|
|
224231
224317
|
const tagPattern = /<\/?([\w.-]+):([\w.-]+)\b[^>]*>/g;
|
|
224232
224318
|
const children = [];
|
|
@@ -271532,7 +271618,7 @@ function prepareLocalCommentInsert(state, bytes, range, commentId) {
|
|
|
271532
271618
|
});
|
|
271533
271619
|
if (!rewritten.ok)
|
|
271534
271620
|
return rewritten;
|
|
271535
|
-
const after = TE46.encode(rewritten.xml);
|
|
271621
|
+
const after = TE46.encode(hoistCommentAnchorsOutOfTrackedWrappers(rewritten.xml, commentId));
|
|
271536
271622
|
const evidence = commentParagraphEvidence(bytes, paragraph, paragraph.byteStart, paragraph.byteEnd, after.length);
|
|
271537
271623
|
return evidence ? {
|
|
271538
271624
|
ok: true,
|
|
@@ -271579,10 +271665,30 @@ function rewriteDocumentXml(documentXml, range, commentId, commentReferenceXml,
|
|
|
271579
271665
|
});
|
|
271580
271666
|
if (!rewritten.ok)
|
|
271581
271667
|
return rewritten;
|
|
271582
|
-
xml = xml.slice(0, p.byteStart) + rewritten.xml + xml.slice(p.byteEnd);
|
|
271668
|
+
xml = xml.slice(0, p.byteStart) + hoistCommentAnchorsOutOfTrackedWrappers(rewritten.xml, commentId) + xml.slice(p.byteEnd);
|
|
271583
271669
|
}
|
|
271584
271670
|
return { ok: true, xml };
|
|
271585
271671
|
}
|
|
271672
|
+
function hoistCommentAnchorsOutOfTrackedWrappers(paragraphXml, commentId) {
|
|
271673
|
+
const id = commentId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
271674
|
+
const start = `(?:\\s*<(?:[\\w.-]+:)?commentRangeStart\\b[^>]*\\bw:id="${id}"[^>]*/>)`;
|
|
271675
|
+
const end = `(?:\\s*<(?:[\\w.-]+:)?commentRangeEnd\\b[^>]*\\bw:id="${id}"[^>]*/>)`;
|
|
271676
|
+
const reference = `(?:\\s*<(?:[\\w.-]+:)?r\\b[^>]*>(?:<(?:[\\w.-]+:)?rPr>[\\s\\S]*?</(?:[\\w.-]+:)?rPr>)?<(?:[\\w.-]+:)?commentReference\\b[^>]*\\bw:id="${id}"[^>]*/></(?:[\\w.-]+:)?r>)`;
|
|
271677
|
+
const leading = new RegExp(`^(${start}+)`);
|
|
271678
|
+
const trailing = new RegExp(`(${end}(?:${reference})?)\\s*$`);
|
|
271679
|
+
const wrapper = /<((?:[\w.-]+:)?(?:ins|del))\b([^>]*)>([\s\S]*?)<\/\1>/g;
|
|
271680
|
+
return paragraphXml.replace(wrapper, (whole, tag, attrs, inner) => {
|
|
271681
|
+
const before = leading.exec(inner)?.[1] ?? "";
|
|
271682
|
+
let body = inner.slice(before.length);
|
|
271683
|
+
const tail = trailing.exec(body);
|
|
271684
|
+
const after = tail ? body.slice(tail.index) : "";
|
|
271685
|
+
body = tail ? body.slice(0, tail.index) : body;
|
|
271686
|
+
if (!before && !after)
|
|
271687
|
+
return whole;
|
|
271688
|
+
const kept = body.trim() ? `<${tag}${attrs}>${body}</${tag}>` : "";
|
|
271689
|
+
return `${before}${kept}${after}`;
|
|
271690
|
+
});
|
|
271691
|
+
}
|
|
271586
271692
|
function prepareCommentAnchor(documentXml, range, inheritedNamespaceBindings) {
|
|
271587
271693
|
if (range.startBlockId !== range.endBlockId)
|
|
271588
271694
|
return null;
|
|
@@ -326289,22 +326395,75 @@ function setPageBordersXml(sectPrXml, borders) {
|
|
|
326289
326395
|
function clearPageBordersXml(sectPrXml) {
|
|
326290
326396
|
return removeSectPrChild(sectPrXml, "pgBorders");
|
|
326291
326397
|
}
|
|
326292
|
-
function
|
|
326293
|
-
const
|
|
326294
|
-
|
|
326295
|
-
|
|
326398
|
+
function prepareSettingsPart(context) {
|
|
326399
|
+
const relsBytes = readPartBytes2(context, DOCUMENT_RELS_PART_URI12);
|
|
326400
|
+
const relsXml = relsBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" : EMPTY_RELATIONSHIPS_XML3;
|
|
326401
|
+
const rels = readDocumentRelationships(relsXml);
|
|
326402
|
+
const related = rels.settingsUri;
|
|
326403
|
+
const settingsUri = related ?? SETTINGS_PART_URI5;
|
|
326404
|
+
const settingsBytes = readPartBytes2(context, settingsUri);
|
|
326405
|
+
if (settingsBytes) {
|
|
326406
|
+
return {
|
|
326407
|
+
ok: true,
|
|
326408
|
+
xml: readPartXml(context, settingsUri) ?? "",
|
|
326409
|
+
perPart: (nextXml) => ({ [settingsUri]: replaceWholePartEntry(settingsBytes, encodeXml(nextXml)) })
|
|
326410
|
+
};
|
|
326296
326411
|
}
|
|
326297
|
-
|
|
326298
|
-
|
|
326412
|
+
if (related) {
|
|
326413
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: `settings part ${related} is related but unreadable.` } };
|
|
326414
|
+
}
|
|
326415
|
+
if (rels.parseError) {
|
|
326416
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: `document relationships are unreadable: ${rels.parseError}` } };
|
|
326417
|
+
}
|
|
326418
|
+
const contentTypesBytes = readPartBytes2(context, CONTENT_TYPES_PART_URI14);
|
|
326419
|
+
if (!contentTypesBytes) {
|
|
326420
|
+
return { ok: false, failure: { code: "PRECONDITION_FAILED", message: "[Content_Types].xml bytes are unavailable." } };
|
|
326421
|
+
}
|
|
326422
|
+
let index = 1;
|
|
326423
|
+
while (rels.ids.has(`rId${index}`))
|
|
326424
|
+
index += 1;
|
|
326425
|
+
const nextRelsXml = addRelationship(relsXml, { id: `rId${index}`, type: SETTINGS_REL, target: "settings.xml" });
|
|
326426
|
+
const nextContentTypesXml = addContentTypeOverride(readPartXml(context, CONTENT_TYPES_PART_URI14) ?? "", SETTINGS_PART_URI5, SETTINGS_CT);
|
|
326427
|
+
return {
|
|
326428
|
+
ok: true,
|
|
326429
|
+
xml: EMPTY_SETTINGS_XML,
|
|
326430
|
+
perPart: (nextXml) => ({
|
|
326431
|
+
[SETTINGS_PART_URI5]: { kind: "create", bytes: encodeXml(nextXml), contentType: SETTINGS_CT },
|
|
326432
|
+
[DOCUMENT_RELS_PART_URI12]: relsBytes ? replaceWholePartEntry(relsBytes, encodeXml(nextRelsXml)) : { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT },
|
|
326433
|
+
[CONTENT_TYPES_PART_URI14]: replaceWholePartEntry(contentTypesBytes, encodeXml(nextContentTypesXml))
|
|
326434
|
+
})
|
|
326435
|
+
};
|
|
326436
|
+
}
|
|
326437
|
+
function readableSettingsPartUri(context) {
|
|
326438
|
+
return readDocumentRelationships(readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "").settingsUri ?? SETTINGS_PART_URI5;
|
|
326439
|
+
}
|
|
326440
|
+
function readDocumentRelationships(relsXml) {
|
|
326441
|
+
if (!relsXml.trim())
|
|
326442
|
+
return { settingsUri: null, ids: new Set, parseError: null };
|
|
326443
|
+
const parsed = parseRelationshipsXml(relsXml, {
|
|
326444
|
+
ownerPartUri: DOCUMENT_PART_URI5,
|
|
326445
|
+
relsUri: DOCUMENT_RELS_PART_URI12,
|
|
326446
|
+
resolveTarget: (target, mode) => mode === "External" ? target : resolveTargetUri(DOCUMENT_PART_URI5, target, mode)
|
|
326447
|
+
});
|
|
326448
|
+
const settings = parsed.relationships.find((rel) => rel.targetMode === "Internal" && rel.type.endsWith("/relationships/settings"));
|
|
326449
|
+
return {
|
|
326450
|
+
settingsUri: settings?.resolvedTarget ?? null,
|
|
326451
|
+
ids: new Set(parsed.relationships.map((rel) => rel.id)),
|
|
326452
|
+
parseError: parsed.parseError
|
|
326453
|
+
};
|
|
326454
|
+
}
|
|
326455
|
+
function setOddEvenHeadersFootersXml(context, enabled, options) {
|
|
326456
|
+
const settings = prepareSettingsPart(context);
|
|
326457
|
+
if (!settings.ok)
|
|
326458
|
+
return settings;
|
|
326459
|
+
const nextXml = enabled ? upsertSettingsChild(settings.xml, "evenAndOddHeaders", "<w:evenAndOddHeaders/>") : removeSettingsChild(settings.xml, "evenAndOddHeaders");
|
|
326299
326460
|
if (options?.dryRun)
|
|
326300
326461
|
return { ok: true, dryRun: true };
|
|
326301
326462
|
const committed = commitKernelStorySurfacePatch({
|
|
326302
326463
|
context,
|
|
326303
326464
|
txIdPrefix: "sections-settings",
|
|
326304
326465
|
expectedRevision: options?.expectedRevision,
|
|
326305
|
-
perPart:
|
|
326306
|
-
[SETTINGS_PART_URI5]: replaceWholePartEntry(settingsBytes, encodeXml(nextXml))
|
|
326307
|
-
},
|
|
326466
|
+
perPart: settings.perPart(nextXml),
|
|
326308
326467
|
signalLanesToRebuild: ["sections"]
|
|
326309
326468
|
});
|
|
326310
326469
|
if (!committed.ok)
|
|
@@ -326513,12 +326672,14 @@ function borderElement(name, border) {
|
|
|
326513
326672
|
attrs.frame = border.frame ? "1" : "0";
|
|
326514
326673
|
return emptyElement(name, attrs);
|
|
326515
326674
|
}
|
|
326516
|
-
var RELATIONSHIPS_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", LIVE_SECTION_SIGNALS_CACHE, SECTPR_CHILD_ORDER, SECTPR_CHILD_RANK;
|
|
326675
|
+
var RELATIONSHIPS_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", LIVE_SECTION_SIGNALS_CACHE, SETTINGS_CT = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", SETTINGS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", RELATIONSHIPS_CT = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_SETTINGS_XML, EMPTY_RELATIONSHIPS_XML3, SECTPR_CHILD_ORDER, SECTPR_CHILD_RANK;
|
|
326517
326676
|
var init_section_xml = __esm(() => {
|
|
326518
326677
|
init_xml();
|
|
326519
326678
|
init_sd_document_session_internal();
|
|
326520
326679
|
init_tracked_pr_change();
|
|
326521
326680
|
LIVE_SECTION_SIGNALS_CACHE = new WeakMap;
|
|
326681
|
+
EMPTY_SETTINGS_XML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"></w:settings>';
|
|
326682
|
+
EMPTY_RELATIONSHIPS_XML3 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
326522
326683
|
SECTPR_CHILD_ORDER = [
|
|
326523
326684
|
"headerReference",
|
|
326524
326685
|
"footerReference",
|
|
@@ -336809,12 +336970,18 @@ function pushTrackedSourceMap(map3, sourceId, changeId) {
|
|
|
336809
336970
|
function visibleParagraphTextFromXml(xml) {
|
|
336810
336971
|
const stripped = stripTextboxContent2(stripParagraphProperties3(stripDeletedRevisions(xml)));
|
|
336811
336972
|
let out = "";
|
|
336812
|
-
for (const token of stripped.matchAll(/<[\w.-]+:t\b[^>]*>([\s\S]*?)<\/[\w.-]+:t>|<[\w.-]+:(tab|br|cr)\b[^>]
|
|
336973
|
+
for (const token of stripped.matchAll(/<(?:[\w.-]+:)?t\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?(tab|br|cr|noBreakHyphen|footnoteReference|endnoteReference)\b[^>]*\/?>/g)) {
|
|
336813
336974
|
if (token[1] != null) {
|
|
336814
336975
|
out += decodeXmlText9(token[1]);
|
|
336815
336976
|
continue;
|
|
336816
336977
|
}
|
|
336817
|
-
|
|
336978
|
+
const control2 = token[2];
|
|
336979
|
+
if (control2 === "noBreakHyphen")
|
|
336980
|
+
out += "‑";
|
|
336981
|
+
else if (control2 === "footnoteReference" || control2 === "endnoteReference")
|
|
336982
|
+
out += "";
|
|
336983
|
+
else
|
|
336984
|
+
out += control2 === "tab" ? "\t" : `
|
|
336818
336985
|
`;
|
|
336819
336986
|
}
|
|
336820
336987
|
return out;
|
|
@@ -336902,9 +337069,9 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336902
337069
|
const slices = [];
|
|
336903
337070
|
const activeSourceIdStack = [];
|
|
336904
337071
|
const elementStack = [];
|
|
336905
|
-
let
|
|
337072
|
+
let removalDepth = 0;
|
|
336906
337073
|
let cursor = 0;
|
|
336907
|
-
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr)\b([^>]*)\/?>/g;
|
|
337074
|
+
const tokenRe = /<\/(?:[\w.-]+:)?(ins|del|moveFrom|moveTo)>|<(?:[\w.-]+:)?t\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?t>|<(?:[\w.-]+:)?delText\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/(?:[\w.-]+:)?delText>|<(?:[\w.-]+:)?(ins|del|moveFrom|moveTo|tab|br|cr|noBreakHyphen|footnoteReference|endnoteReference)\b([^>]*)\/?>/g;
|
|
336908
337075
|
for (const match of stripped.matchAll(tokenRe)) {
|
|
336909
337076
|
const closingName = match[1];
|
|
336910
337077
|
const tText = match[2];
|
|
@@ -336915,12 +337082,12 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336915
337082
|
const frame = elementStack.pop();
|
|
336916
337083
|
if (frame?.hadId)
|
|
336917
337084
|
activeSourceIdStack.pop();
|
|
336918
|
-
if (closingName === "del")
|
|
336919
|
-
|
|
337085
|
+
if (closingName === "del" || closingName === "moveFrom")
|
|
337086
|
+
removalDepth = Math.max(0, removalDepth - 1);
|
|
336920
337087
|
continue;
|
|
336921
337088
|
}
|
|
336922
337089
|
if (tText != null) {
|
|
336923
|
-
if (
|
|
337090
|
+
if (removalDepth > 0) {
|
|
336924
337091
|
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
336925
337092
|
} else {
|
|
336926
337093
|
cursor = pushTrackedSourceSlice(slices, cursor, decodeXmlText9(tText).length, activeSourceIdStack);
|
|
@@ -336933,8 +337100,8 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336933
337100
|
}
|
|
336934
337101
|
if (!openingName)
|
|
336935
337102
|
continue;
|
|
336936
|
-
if (openingName === "tab" || openingName === "br" || openingName === "cr") {
|
|
336937
|
-
if (
|
|
337103
|
+
if (openingName === "tab" || openingName === "br" || openingName === "cr" || openingName === "noBreakHyphen" || openingName === "footnoteReference" || openingName === "endnoteReference") {
|
|
337104
|
+
if (removalDepth > 0) {
|
|
336938
337105
|
pushZeroWidthTrackedSourceSlice(slices, cursor, activeSourceIdStack);
|
|
336939
337106
|
} else {
|
|
336940
337107
|
cursor = pushTrackedSourceSlice(slices, cursor, 1, activeSourceIdStack);
|
|
@@ -336949,8 +337116,8 @@ function visibleTrackedChangeSourceSlicesFromXml(xml, qualified, storyId) {
|
|
|
336949
337116
|
elementStack.push({ name: openingName, hadId: Boolean(sourceId) });
|
|
336950
337117
|
if (sourceId)
|
|
336951
337118
|
activeSourceIdStack.push(sourceId);
|
|
336952
|
-
if (openingName === "del")
|
|
336953
|
-
|
|
337119
|
+
if (openingName === "del" || openingName === "moveFrom")
|
|
337120
|
+
removalDepth += 1;
|
|
336954
337121
|
}
|
|
336955
337122
|
}
|
|
336956
337123
|
return slices;
|
|
@@ -336995,7 +337162,7 @@ function stripParagraphProperties3(xml) {
|
|
|
336995
337162
|
return stripElements(xml, "pPr");
|
|
336996
337163
|
}
|
|
336997
337164
|
function stripDeletedRevisions(xml) {
|
|
336998
|
-
return xml
|
|
337165
|
+
return stripElements(stripElements(xml, "del"), "moveFrom");
|
|
336999
337166
|
}
|
|
337000
337167
|
function stripTextboxContent2(xml) {
|
|
337001
337168
|
return xml.replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*?<\/(?:[\w.-]+:)?txbxContent>/g, "").replace(/<(?:[\w.-]+:)?txbxContent\b[^>]*>[\s\S]*$/g, "");
|
|
@@ -366811,12 +366978,25 @@ function greedyTokenMatches(before, after, aStart, aEnd, bStart, bEnd) {
|
|
|
366811
366978
|
}
|
|
366812
366979
|
return matches;
|
|
366813
366980
|
}
|
|
366981
|
+
function wordTokens(text4) {
|
|
366982
|
+
const out = [];
|
|
366983
|
+
for (const chunk of text4.match(/\S+|\s+/gu) ?? []) {
|
|
366984
|
+
const trailing = /\S/.test(chunk) ? TRAILING_PUNCTUATION.exec(chunk)?.[0] : undefined;
|
|
366985
|
+
if (trailing && trailing.length < chunk.length) {
|
|
366986
|
+
out.push(chunk.slice(0, chunk.length - trailing.length));
|
|
366987
|
+
for (const mark of trailing)
|
|
366988
|
+
out.push(mark);
|
|
366989
|
+
} else {
|
|
366990
|
+
out.push(chunk);
|
|
366991
|
+
}
|
|
366992
|
+
}
|
|
366993
|
+
return out;
|
|
366994
|
+
}
|
|
366814
366995
|
function narrowTextReplacement(before, after) {
|
|
366815
366996
|
if (before === after)
|
|
366816
366997
|
return null;
|
|
366817
|
-
const
|
|
366818
|
-
const
|
|
366819
|
-
const newTokens = after.match(tokens) ?? [];
|
|
366998
|
+
const oldTokens = wordTokens(before);
|
|
366999
|
+
const newTokens = wordTokens(after);
|
|
366820
367000
|
let prefix2 = 0;
|
|
366821
367001
|
let start = 0;
|
|
366822
367002
|
while (prefix2 < oldTokens.length && prefix2 < newTokens.length && oldTokens[prefix2] === newTokens[prefix2]) {
|
|
@@ -366837,9 +367017,8 @@ function planTextReplacement(before, after) {
|
|
|
366837
367017
|
const boundary = narrowTextReplacement(before, after);
|
|
366838
367018
|
if (!boundary)
|
|
366839
367019
|
return [];
|
|
366840
|
-
const
|
|
366841
|
-
const
|
|
366842
|
-
const newTokens = boundary.text.match(tokens) ?? [];
|
|
367020
|
+
const oldTokens = wordTokens(before.slice(boundary.start, boundary.end));
|
|
367021
|
+
const newTokens = wordTokens(boundary.text);
|
|
366843
367022
|
const matches = [];
|
|
366844
367023
|
const oldValues = new Set(oldTokens);
|
|
366845
367024
|
if (!newTokens.some((token) => oldValues.has(token)))
|
|
@@ -366931,6 +367110,10 @@ function planTextReplacement(before, after) {
|
|
|
366931
367110
|
}
|
|
366932
367111
|
return spans;
|
|
366933
367112
|
}
|
|
367113
|
+
var TRAILING_PUNCTUATION;
|
|
367114
|
+
var init_replacement_span = __esm(() => {
|
|
367115
|
+
TRAILING_PUNCTUATION = /[.,;:!?)\]}'"\u00bb\u2019\u201d]+$/u;
|
|
367116
|
+
});
|
|
366934
367117
|
|
|
366935
367118
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/structural-rewrite-span.js
|
|
366936
367119
|
function planTrackedRewriteReplacement(before, after, scope) {
|
|
@@ -366971,6 +367154,7 @@ function rewriteRangeContainsCoupledStructure(paragraphXml, start, end, coordina
|
|
|
366971
367154
|
}
|
|
366972
367155
|
var init_structural_rewrite_span = __esm(() => {
|
|
366973
367156
|
init_sd_document_session_internal();
|
|
367157
|
+
init_replacement_span();
|
|
366974
367158
|
});
|
|
366975
367159
|
|
|
366976
367160
|
// ../../../v2/document-api-v2-adapter/dist/fields/tracked-field-removal.js
|
|
@@ -372152,6 +372336,7 @@ var init_adapter7 = __esm(() => {
|
|
|
372152
372336
|
init_mutation_guard();
|
|
372153
372337
|
init_story_surface();
|
|
372154
372338
|
init_textbox_story();
|
|
372339
|
+
init_replacement_span();
|
|
372155
372340
|
init_structural_rewrite_span();
|
|
372156
372341
|
init_runtime2();
|
|
372157
372342
|
init_tracked_field_removal();
|
|
@@ -391761,7 +391946,7 @@ function projectSectionDomain(mainStory, section, index2, oddEvenHeadersFooters)
|
|
|
391761
391946
|
};
|
|
391762
391947
|
}
|
|
391763
391948
|
function readLiveOddEvenHeadersFooters(context, snapshot2) {
|
|
391764
|
-
const settingsXml = readPartXml(context,
|
|
391949
|
+
const settingsXml = readPartXml(context, readableSettingsPartUri(context));
|
|
391765
391950
|
if (!settingsXml)
|
|
391766
391951
|
return projectToggle(snapshot2.settings?.evenAndOddHeaders ?? null) ?? false;
|
|
391767
391952
|
const match = /<w:evenAndOddHeaders\b[^>]*\/?>/i.exec(settingsXml);
|
|
@@ -392322,6 +392507,7 @@ class V2CreateAdapter {
|
|
|
392322
392507
|
});
|
|
392323
392508
|
const carrierParagraph = `<w:p><w:pPr>${sectPrPlan.previousSectPr}</w:pPr></w:p>`;
|
|
392324
392509
|
let nextXml;
|
|
392510
|
+
let splitSectionIndex = null;
|
|
392325
392511
|
if (!input.at || input.at.kind === "documentEnd") {
|
|
392326
392512
|
if (representation === "attachToPreviousParagraph") {
|
|
392327
392513
|
const attached = attachSectPrToPreviousBodyParagraph(documentXml, sectPrPlan);
|
|
@@ -392337,8 +392523,24 @@ class V2CreateAdapter {
|
|
|
392337
392523
|
nextXml = documentXml.replace(/<\/w:body>/, `${carrierParagraph}${sectPrPlan.finalSectPr}</w:body>`);
|
|
392338
392524
|
}
|
|
392339
392525
|
}
|
|
392526
|
+
} else if ((input.at.kind === "before" || input.at.kind === "after") && input.at.target?.kind === "block" && (!input.at.target.story || input.at.target.story.storyType === "body")) {
|
|
392527
|
+
if (options?.changeMode === "tracked") {
|
|
392528
|
+
return createFailure("CAPABILITY_UNAVAILABLE", "create.sectionBreak records only document-end breaks as tracked changes.");
|
|
392529
|
+
}
|
|
392530
|
+
const placed = placeSectionBreakAtBodyParagraph(documentXml, {
|
|
392531
|
+
nodeId: input.at.target.nodeId,
|
|
392532
|
+
placement: input.at.kind,
|
|
392533
|
+
representation,
|
|
392534
|
+
breakType,
|
|
392535
|
+
pageMargins: input.pageMargins,
|
|
392536
|
+
headerFooterMargins: input.headerFooterMargins
|
|
392537
|
+
});
|
|
392538
|
+
if (!placed.ok)
|
|
392539
|
+
return createFailure(placed.code, placed.message);
|
|
392540
|
+
nextXml = placed.xml;
|
|
392541
|
+
splitSectionIndex = placed.sectionIndex;
|
|
392340
392542
|
} else {
|
|
392341
|
-
return createFailure("INVALID_TARGET", "create.sectionBreak
|
|
392543
|
+
return createFailure("INVALID_TARGET", "create.sectionBreak supports documentEnd and before/after a body paragraph on v2.");
|
|
392342
392544
|
}
|
|
392343
392545
|
const dryRun = options?.dryRun || input.dryRun;
|
|
392344
392546
|
const createdRefs = [];
|
|
@@ -392371,8 +392573,8 @@ class V2CreateAdapter {
|
|
|
392371
392573
|
if (!committed.ok)
|
|
392372
392574
|
return createFailure(committed.code, committed.message);
|
|
392373
392575
|
const sectionItems = new V2SectionsAdapter(this.context).list().items;
|
|
392374
|
-
const
|
|
392375
|
-
const section = { kind: "section", sectionId:
|
|
392576
|
+
const createdSectionId = splitSectionIndex === null ? sectionItems[sectionItems.length - 1]?.id : sectionItems[splitSectionIndex]?.id;
|
|
392577
|
+
const section = { kind: "section", sectionId: createdSectionId ?? "section-0" };
|
|
392376
392578
|
const trackedChangeRefs = projectTrackedStructuralEntityIds(this.context, createdRefs.flatMap((ref5) => ref5.kind === "trackedChange" ? [ref5.entityId] : [])).map((entityId) => ({ kind: "entity", entityType: "trackedChange", entityId }));
|
|
392377
392579
|
return { success: true, section, ...trackedChangeRefs.length ? { trackedChangeRefs } : {} };
|
|
392378
392580
|
}
|
|
@@ -392794,6 +392996,54 @@ function attachSectPrToPreviousBodyParagraph(documentXml, plan) {
|
|
|
392794
392996
|
xml: documentXml.slice(0, body.start + target.start) + merged + documentXml.slice(body.start + target.end, finalStart) + plan.finalSectPr + documentXml.slice(finalEnd)
|
|
392795
392997
|
};
|
|
392796
392998
|
}
|
|
392999
|
+
function placeSectionBreakAtBodyParagraph(documentXml, input) {
|
|
393000
|
+
const body = readBodyInnerWithOffsets(documentXml);
|
|
393001
|
+
if (!body)
|
|
393002
|
+
return { ok: false, code: "PRECONDITION_FAILED", message: "document body was not found." };
|
|
393003
|
+
const children2 = scanDirectBodyChildrenWithOffsets(body.inner);
|
|
393004
|
+
const index2 = children2.findIndex((child) => isWordParagraphQName2(child.qname) && bodyParagraphIdOf(body.inner.slice(child.start, child.end)) === input.nodeId);
|
|
393005
|
+
if (index2 < 0) {
|
|
393006
|
+
return { ok: false, code: "INVALID_TARGET", message: "The target is not a body paragraph with a durable id; re-inspect and pass its nodeId." };
|
|
393007
|
+
}
|
|
393008
|
+
const boundary = body.start + (input.placement === "after" ? children2[index2].end : children2[index2].start);
|
|
393009
|
+
if (!findAllElements(documentXml, "sectPr").some((element) => element.start >= boundary)) {
|
|
393010
|
+
const bodyEnd = body.start + body.inner.length;
|
|
393011
|
+
documentXml = `${documentXml.slice(0, bodyEnd)}<w:sectPr/>${documentXml.slice(bodyEnd)}`;
|
|
393012
|
+
}
|
|
393013
|
+
const sectPrs = findAllElements(documentXml, "sectPr");
|
|
393014
|
+
const sectionIndex = sectPrs.findIndex((element) => element.start >= boundary);
|
|
393015
|
+
const governing = sectPrs[sectionIndex];
|
|
393016
|
+
if (!governing)
|
|
393017
|
+
return { ok: false, code: "PRECONDITION_FAILED", message: "The body has no section properties after the target." };
|
|
393018
|
+
const closingSectPr = setSectionBreakTypeXml(governing.xml, input.breakType);
|
|
393019
|
+
let trailingSectPr = governing.xml;
|
|
393020
|
+
if (input.pageMargins)
|
|
393021
|
+
trailingSectPr = setPageMarginsXml(trailingSectPr, input.pageMargins);
|
|
393022
|
+
if (input.headerFooterMargins)
|
|
393023
|
+
trailingSectPr = setPageMarginsXml(trailingSectPr, input.headerFooterMargins);
|
|
393024
|
+
let xml = `${documentXml.slice(0, governing.start)}${trailingSectPr}${documentXml.slice(governing.end)}`;
|
|
393025
|
+
if (input.representation === "attachToPreviousParagraph") {
|
|
393026
|
+
const carrier = children2[input.placement === "after" ? index2 : index2 - 1];
|
|
393027
|
+
if (!carrier || !isWordParagraphQName2(carrier.qname)) {
|
|
393028
|
+
return { ok: false, code: "INVALID_TARGET", message: 'No body paragraph ends the section at that boundary; use representation "asNewParagraph".' };
|
|
393029
|
+
}
|
|
393030
|
+
const carrierXml = body.inner.slice(carrier.start, carrier.end);
|
|
393031
|
+
if (findFirstElement(carrierXml, "sectPr")) {
|
|
393032
|
+
return { ok: false, code: "INVALID_TARGET", message: "That paragraph already carries a section break." };
|
|
393033
|
+
}
|
|
393034
|
+
const merged = mergeSectPrIntoParagraph(carrierXml, closingSectPr);
|
|
393035
|
+
if (!merged)
|
|
393036
|
+
return { ok: false, code: "INVALID_TARGET", message: "That paragraph cannot carry this section break." };
|
|
393037
|
+
xml = xml.slice(0, body.start + carrier.start) + merged + xml.slice(body.start + carrier.end);
|
|
393038
|
+
return { ok: true, xml, sectionIndex };
|
|
393039
|
+
}
|
|
393040
|
+
xml = `${xml.slice(0, boundary)}<w:p><w:pPr>${closingSectPr}</w:pPr></w:p>${xml.slice(boundary)}`;
|
|
393041
|
+
return { ok: true, xml, sectionIndex };
|
|
393042
|
+
}
|
|
393043
|
+
function bodyParagraphIdOf(paragraphXml) {
|
|
393044
|
+
const open2 = /^<w:p\b[^>]*>/.exec(paragraphXml)?.[0] ?? "";
|
|
393045
|
+
return /\sw14:paraId="([^"]+)"/.exec(open2)?.[1] ?? null;
|
|
393046
|
+
}
|
|
392797
393047
|
function readBodyInnerWithOffsets(documentXml) {
|
|
392798
393048
|
const bodyOpen = /<[\w.-]+:body\b[^>]*>/.exec(documentXml);
|
|
392799
393049
|
if (!bodyOpen)
|
|
@@ -406706,8 +406956,8 @@ function createHeaderFooterPart(context, input, options) {
|
|
|
406706
406956
|
const relType = input.kind === "header" ? HEADER_REL2 : FOOTER_REL2;
|
|
406707
406957
|
const nextRelsXml = addRelationship(relsXml, { id: refId, type: relType, target: partUri.replace(/^\/word\//, "") });
|
|
406708
406958
|
let nextContentTypesXml = addContentTypeOverride(contentTypesXml, partUri, contentType);
|
|
406709
|
-
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !==
|
|
406710
|
-
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri),
|
|
406959
|
+
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !== RELATIONSHIPS_CT2) {
|
|
406960
|
+
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri), RELATIONSHIPS_CT2);
|
|
406711
406961
|
}
|
|
406712
406962
|
const partPath = partUri.replace(/^\//, "");
|
|
406713
406963
|
if (options?.dryRun)
|
|
@@ -406864,8 +407114,8 @@ function prepareHeaderFooterSlotMaterialization(context, target, additionalTarge
|
|
|
406864
407114
|
const relType = input.kind === "header" ? HEADER_REL2 : FOOTER_REL2;
|
|
406865
407115
|
const nextRelsXml = addRelationship(relsXml, { id: refId, type: relType, target: partUri.replace(/^\/word\//, "") });
|
|
406866
407116
|
let nextContentTypesXml = addContentTypeOverride(contentTypesXml, partUri, contentType);
|
|
406867
|
-
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !==
|
|
406868
|
-
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri),
|
|
407117
|
+
if (Object.keys(clonedRelationships.perPart).length > 0 && parseContentTypes(contentTypesXml).defaults.get("rels") !== RELATIONSHIPS_CT2) {
|
|
407118
|
+
nextContentTypesXml = addContentTypeOverride(nextContentTypesXml, relsUriFor(partUri), RELATIONSHIPS_CT2);
|
|
406869
407119
|
}
|
|
406870
407120
|
const prepared = prepareHeaderFooterRefTargetsSectionXmlMutationsUnchecked(context, [normalizedTarget, ...normalizedAdditionalTargets], refId);
|
|
406871
407121
|
if (!prepared.ok)
|
|
@@ -406938,15 +407188,15 @@ function prepareClonedPartRelationships(context, sourcePartUri, destinationPartU
|
|
|
406938
407188
|
[relsUriFor(destinationPartUri)]: {
|
|
406939
407189
|
kind: "create",
|
|
406940
407190
|
bytes: cloned.value === sourceXml ? new Uint8Array(sourceBytes) : encodeXml(cloned.value),
|
|
406941
|
-
contentType:
|
|
407191
|
+
contentType: RELATIONSHIPS_CT2
|
|
406942
407192
|
}
|
|
406943
407193
|
} };
|
|
406944
407194
|
}
|
|
406945
407195
|
function prepareDocumentRelationshipsPart(context) {
|
|
406946
407196
|
const existingBytes = readPartBytes2(context, DOCUMENT_RELS_PART_URI12);
|
|
406947
407197
|
return {
|
|
406948
|
-
xml: existingBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" :
|
|
406949
|
-
buildPatch: (nextXml) => existingBytes ? replaceWholePartEntry(existingBytes, encodeXml(nextXml)) : { kind: "create", bytes: encodeXml(nextXml), contentType:
|
|
407198
|
+
xml: existingBytes ? readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? "" : EMPTY_RELATIONSHIPS_XML4,
|
|
407199
|
+
buildPatch: (nextXml) => existingBytes ? replaceWholePartEntry(existingBytes, encodeXml(nextXml)) : { kind: "create", bytes: encodeXml(nextXml), contentType: RELATIONSHIPS_CT2 }
|
|
406950
407200
|
};
|
|
406951
407201
|
}
|
|
406952
407202
|
function resolveTrailingFinalSectionInheritedRefTarget(context, target) {
|
|
@@ -407191,7 +407441,7 @@ function structuredError3(code2, message) {
|
|
|
407191
407441
|
error48.code = code2;
|
|
407192
407442
|
return error48;
|
|
407193
407443
|
}
|
|
407194
|
-
var HEADER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", HEADER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
|
|
407444
|
+
var HEADER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CT2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", HEADER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", RELATIONSHIPS_CT2 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML4;
|
|
407195
407445
|
var init_adapter18 = __esm(() => {
|
|
407196
407446
|
init_src3();
|
|
407197
407447
|
init_sd_document_session_internal();
|
|
@@ -407200,7 +407450,7 @@ var init_adapter18 = __esm(() => {
|
|
|
407200
407450
|
init_xml();
|
|
407201
407451
|
init_xml3();
|
|
407202
407452
|
init_section_xml();
|
|
407203
|
-
|
|
407453
|
+
EMPTY_RELATIONSHIPS_XML4 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
407204
407454
|
});
|
|
407205
407455
|
|
|
407206
407456
|
// ../../../v2/document-api-v2-adapter/dist/address/materialize-slot.js
|
|
@@ -440743,6 +440993,7 @@ var init_engine3 = __esm(() => {
|
|
|
440743
440993
|
init_query_adapter();
|
|
440744
440994
|
init_within();
|
|
440745
440995
|
init_tracked_text_search();
|
|
440996
|
+
init_replacement_span();
|
|
440746
440997
|
init_structural_rewrite_span();
|
|
440747
440998
|
init_adapter7();
|
|
440748
440999
|
init_adapter17();
|
|
@@ -441836,7 +442087,7 @@ function preparePicturePlan(context, part, input, shapeId, contentTypesXml) {
|
|
|
441836
442087
|
return { ok: false, message: "Header relationships path could not be resolved." };
|
|
441837
442088
|
const preparedRels = part.perPart[relsUri];
|
|
441838
442089
|
const existingRelsBytes = resultingWholePartBytes(context, relsUri, preparedRels);
|
|
441839
|
-
const relsXml = existingRelsBytes ? TD133.decode(existingRelsBytes) :
|
|
442090
|
+
const relsXml = existingRelsBytes ? TD133.decode(existingRelsBytes) : EMPTY_RELATIONSHIPS_XML5;
|
|
441840
442091
|
const imageRefId = allocateRId2(relsXml);
|
|
441841
442092
|
const mediaPartUri = allocateMediaPartUri(context, decoded.format);
|
|
441842
442093
|
const mediaTarget = relativeTarget3(part.partUri, mediaPartUri);
|
|
@@ -441852,7 +442103,7 @@ function preparePicturePlan(context, part, input, shapeId, contentTypesXml) {
|
|
|
441852
442103
|
bytes: decoded.binary,
|
|
441853
442104
|
contentType: imageMimeType2(decoded.format)
|
|
441854
442105
|
},
|
|
441855
|
-
[relsUri]: preparedRels?.kind === "create" ? { kind: "create", bytes: encodeXml(nextRelsXml), contentType:
|
|
442106
|
+
[relsUri]: preparedRels?.kind === "create" ? { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT3 } : readPartBytes2(context, relsUri) ? replaceWholePartEntry(readPartBytes2(context, relsUri), encodeXml(nextRelsXml)) : { kind: "create", bytes: encodeXml(nextRelsXml), contentType: RELATIONSHIPS_CT3 }
|
|
441856
442107
|
};
|
|
441857
442108
|
return {
|
|
441858
442109
|
ok: true,
|
|
@@ -441868,7 +442119,7 @@ function removePictureResources(context, entry, perPart, contentTypesXml) {
|
|
|
441868
442119
|
if (!relsUri || !entry.imageRefId || !entry.mediaPartUri)
|
|
441869
442120
|
return { contentTypesXml };
|
|
441870
442121
|
const relsBytes = readPartBytes2(context, relsUri);
|
|
441871
|
-
const relsXml = relsBytes ? TD133.decode(relsBytes) :
|
|
442122
|
+
const relsXml = relsBytes ? TD133.decode(relsBytes) : EMPTY_RELATIONSHIPS_XML5;
|
|
441872
442123
|
const remainingPartXml = replaceExactlyOnce4(entry.partXml, entry.pictXml, "");
|
|
441873
442124
|
if (remainingPartXml && [...remainingPartXml.matchAll(/<[A-Za-z_][^>]*>/g)].some((match) => ["r:id", "r:embed", "r:link"].some((attribute3) => xmlAttribute3(match[0], attribute3) === entry.imageRefId))) {
|
|
441874
442125
|
return { contentTypesXml };
|
|
@@ -442162,7 +442413,7 @@ function readAspectLock(pictXml) {
|
|
|
442162
442413
|
return /^(?:t|true|1)$/.test(instanceLock[1] ?? instanceLock[2] ?? "");
|
|
442163
442414
|
return /<o:lock\b[^>]*\baspectratio=["'](?:t|true|1)["']/.test(pictXml);
|
|
442164
442415
|
}
|
|
442165
|
-
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
442416
|
+
var IMAGE_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT3 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELATIONSHIPS_XML5, TD133;
|
|
442166
442417
|
var init_parts = __esm(() => {
|
|
442167
442418
|
init_sd_document_session_internal();
|
|
442168
442419
|
init_adapter18();
|
|
@@ -442172,7 +442423,7 @@ var init_parts = __esm(() => {
|
|
|
442172
442423
|
init_xml();
|
|
442173
442424
|
init_xml3();
|
|
442174
442425
|
init_serialization();
|
|
442175
|
-
|
|
442426
|
+
EMPTY_RELATIONSHIPS_XML5 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
442176
442427
|
TD133 = new TextDecoder;
|
|
442177
442428
|
});
|
|
442178
442429
|
|
|
@@ -442394,7 +442645,7 @@ function applyWatermarks(context, input, options) {
|
|
|
442394
442645
|
perPart[header.partUri] = partPatch(context, header.partUri, encodeXml(header.xml), HEADER_CT3);
|
|
442395
442646
|
const relsUri = relsPartUriForPart2(header.partUri);
|
|
442396
442647
|
if (header.relsXml !== EMPTY_RELS || readPartBytes2(context, relsUri) || perPart[relsUri])
|
|
442397
|
-
perPart[relsUri] = partPatch(context, relsUri, encodeXml(header.relsXml),
|
|
442648
|
+
perPart[relsUri] = partPatch(context, relsUri, encodeXml(header.relsXml), RELATIONSHIPS_CT4);
|
|
442398
442649
|
}
|
|
442399
442650
|
for (const mediaPartUri of new Set(removedImages.map((entry) => entry.mediaPartUri))) {
|
|
442400
442651
|
if (isReferencedInFinalRelationships(context, perPart, mediaPartUri))
|
|
@@ -442403,7 +442654,7 @@ function applyWatermarks(context, input, options) {
|
|
|
442403
442654
|
contentTypesXml = removeContentTypeOverride(contentTypesXml, mediaPartUri);
|
|
442404
442655
|
}
|
|
442405
442656
|
if (documentRelsXml !== (readPartXml(context, DOCUMENT_RELS_PART_URI12) ?? EMPTY_RELS))
|
|
442406
|
-
perPart[DOCUMENT_RELS_PART_URI12] = partPatch(context, DOCUMENT_RELS_PART_URI12, encodeXml(documentRelsXml),
|
|
442657
|
+
perPart[DOCUMENT_RELS_PART_URI12] = partPatch(context, DOCUMENT_RELS_PART_URI12, encodeXml(documentRelsXml), RELATIONSHIPS_CT4);
|
|
442407
442658
|
if (contentTypesXml !== readPartXml(context, CONTENT_TYPES_PART_URI14))
|
|
442408
442659
|
perPart[CONTENT_TYPES_PART_URI14] = partPatch(context, CONTENT_TYPES_PART_URI14, encodeXml(contentTypesXml), "application/xml");
|
|
442409
442660
|
const impact = { affectedSlots: affected.map((slot2) => slot2.address), preservedSlots };
|
|
@@ -442565,7 +442816,7 @@ function isReferencedInFinalRelationships(context, perPart, mediaPartUri) {
|
|
|
442565
442816
|
}
|
|
442566
442817
|
return false;
|
|
442567
442818
|
}
|
|
442568
|
-
var HEADER_CT3 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", HEADER_REL3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", IMAGE_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
|
442819
|
+
var HEADER_CT3 = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", HEADER_REL3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", IMAGE_REL2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", RELATIONSHIPS_CT4 = "application/vnd.openxmlformats-package.relationships+xml", EMPTY_RELS = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>', VARIANTS;
|
|
442569
442820
|
var init_scoped_apply = __esm(() => {
|
|
442570
442821
|
init_sd_document_session_internal();
|
|
442571
442822
|
init_document_reader();
|
|
@@ -443456,19 +443707,16 @@ class V2FootnotesAdapter {
|
|
|
443456
443707
|
message: "section-scoped note configuration is not supported by v2 yet."
|
|
443457
443708
|
});
|
|
443458
443709
|
}
|
|
443459
|
-
const
|
|
443460
|
-
if (!
|
|
443461
|
-
return failure24(
|
|
443462
|
-
|
|
443463
|
-
message: "settings.xml bytes are unavailable."
|
|
443464
|
-
});
|
|
443465
|
-
const nextXml = configureSettings(readPartXml(this.context, SETTINGS_PART_URI5) ?? "", input);
|
|
443710
|
+
const settings = prepareSettingsPart(this.context);
|
|
443711
|
+
if (!settings.ok)
|
|
443712
|
+
return failure24(settings.failure);
|
|
443713
|
+
const nextXml = configureSettings(settings.xml, input);
|
|
443466
443714
|
if (options?.dryRun)
|
|
443467
443715
|
return { success: true };
|
|
443468
443716
|
const committed = commitKernelStorySurfacePatch({
|
|
443469
443717
|
context: this.context,
|
|
443470
443718
|
txIdPrefix: "footnotes-configure",
|
|
443471
|
-
perPart:
|
|
443719
|
+
perPart: settings.perPart(nextXml),
|
|
443472
443720
|
signalLanesToRebuild: ["sections"]
|
|
443473
443721
|
});
|
|
443474
443722
|
if (!committed.ok)
|
|
@@ -444008,6 +444256,7 @@ var W14_NS4 = "http://schemas.microsoft.com/office/word/2010/wordml", FOOTNOTES_
|
|
|
444008
444256
|
var init_adapter36 = __esm(() => {
|
|
444009
444257
|
init_src3();
|
|
444010
444258
|
init_document_styles();
|
|
444259
|
+
init_section_xml();
|
|
444011
444260
|
init_tracked_pr_change();
|
|
444012
444261
|
init_tracked_structural_wrapper();
|
|
444013
444262
|
init_common();
|
|
@@ -448596,7 +448845,7 @@ function planPackageCompanion(input) {
|
|
|
448596
448845
|
}
|
|
448597
448846
|
};
|
|
448598
448847
|
}
|
|
448599
|
-
let documentRelsXml = input.documentRelsXml ??
|
|
448848
|
+
let documentRelsXml = input.documentRelsXml ?? EMPTY_RELATIONSHIPS_XML6;
|
|
448600
448849
|
const relationshipTarget = relativeRelationshipTarget(input.relationshipOwnerPartName, input.def.partName);
|
|
448601
448850
|
const relationshipElements = findEmptyXmlElements(documentRelsXml, "Relationship");
|
|
448602
448851
|
if (input.def.scope === "styles") {
|
|
@@ -448767,7 +449016,7 @@ function importHeaderFooterAssets(input) {
|
|
|
448767
449016
|
}
|
|
448768
449017
|
let nextContentTypesXml = input.contentTypesXml;
|
|
448769
449018
|
let contentTypesChanged = false;
|
|
448770
|
-
let nextDocumentRelsXml = input.documentRelsXml ??
|
|
449019
|
+
let nextDocumentRelsXml = input.documentRelsXml ?? EMPTY_RELATIONSHIPS_XML6;
|
|
448771
449020
|
let documentRelsChanged = false;
|
|
448772
449021
|
let changed = false;
|
|
448773
449022
|
const idMappings = [];
|
|
@@ -449644,7 +449893,7 @@ function replaceChildValAttr(defXml, tag, value3) {
|
|
|
449644
449893
|
const escaped = escapeTag(tag);
|
|
449645
449894
|
return defXml.replace(new RegExp(`(<${escaped}\\b[^>]*\\bw:val=")[^"]*(")`), `$1${value3}$2`);
|
|
449646
449895
|
}
|
|
449647
|
-
var CONTENT_TYPES_NAME = "[Content_Types].xml", CONTENT_TYPES_PART_URI16 = "/[Content_Types].xml", DOCUMENT_PART_URI7 = "/word/document.xml", STYLES_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", STRICT_WORDPROCESSINGML_NAMESPACE3 = "http://purl.oclc.org/ooxml/wordprocessingml/main", THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", FONT_TABLE_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", WEB_SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", SINGLE_SCOPE_DEFS, STYLES_PART_NAME = "word/styles.xml", STYLES_SCOPE_DEF, NUMBERING_PART_NAME = "word/numbering.xml", WORDPROCESSINGML_NAMESPACE9 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", SETTINGS_ADOPTION_LOCAL_NAMES, UNSUPPORTED_CATEGORIES,
|
|
449896
|
+
var CONTENT_TYPES_NAME = "[Content_Types].xml", CONTENT_TYPES_PART_URI16 = "/[Content_Types].xml", DOCUMENT_PART_URI7 = "/word/document.xml", STYLES_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", STRICT_WORDPROCESSINGML_NAMESPACE3 = "http://purl.oclc.org/ooxml/wordprocessingml/main", THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", FONT_TABLE_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", WEB_SETTINGS_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", SINGLE_SCOPE_DEFS, STYLES_PART_NAME = "word/styles.xml", STYLES_SCOPE_DEF, NUMBERING_PART_NAME = "word/numbering.xml", WORDPROCESSINGML_NAMESPACE9 = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", SETTINGS_ADOPTION_LOCAL_NAMES, UNSUPPORTED_CATEGORIES, EMPTY_RELATIONSHIPS_XML6;
|
|
449648
449897
|
var init_adapter40 = __esm(() => {
|
|
449649
449898
|
init_src3();
|
|
449650
449899
|
init_esm2();
|
|
@@ -449715,7 +449964,7 @@ var init_adapter40 = __esm(() => {
|
|
|
449715
449964
|
{ test: (n) => n === "word/footnotes.xml" || n === "word/endnotes.xml", category: "notes" },
|
|
449716
449965
|
{ test: (n) => n === "word/people.xml", category: "people" }
|
|
449717
449966
|
];
|
|
449718
|
-
|
|
449967
|
+
EMPTY_RELATIONSHIPS_XML6 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>';
|
|
449719
449968
|
});
|
|
449720
449969
|
|
|
449721
449970
|
// ../../../v2/document-api-v2-adapter/dist/atomic-plan.js
|
|
@@ -493581,6 +493830,9 @@ var init_dist9 = __esm(() => {
|
|
|
493581
493830
|
});
|
|
493582
493831
|
|
|
493583
493832
|
// ../../../v2/collaboration-v2/dist/backend/story-surface-execution-backend.js
|
|
493833
|
+
function isCollapsedDirectTextInsertion(source) {
|
|
493834
|
+
return source.kind === "editText" && source.changeMode === "direct" && source.newText.length > 0 && source.on.startBlockId === source.on.endBlockId && source.on.startOffset === source.on.endOffset;
|
|
493835
|
+
}
|
|
493584
493836
|
function storyTextRequiresMergedCarrierSync(validation) {
|
|
493585
493837
|
if (!validation)
|
|
493586
493838
|
return false;
|
|
@@ -494849,6 +495101,9 @@ function admitPreparedStorySurfaceMutation(prepared, options) {
|
|
|
494849
495101
|
}
|
|
494850
495102
|
if (extension2.family === "storyText") {
|
|
494851
495103
|
if (extension2.historyReplay || extension2.resyncFromSession || extension2.sessionSync || isNoteTextEdit(prepared)) {
|
|
495104
|
+
if (extension2.sessionSync && extension2.targetBlockIds.length === 1 && options.isSessionProjectionCurrent?.() === false && isCollapsedDirectTextInsertion(prepared.source)) {
|
|
495105
|
+
return { ok: false, message: "text insertion session sync requires a current session projection" };
|
|
495106
|
+
}
|
|
494852
495107
|
return validateStoryTextSessionSync(prepared, extension2, options);
|
|
494853
495108
|
}
|
|
494854
495109
|
const direct = validateDirectStoryText(prepared, extension2, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.10.0-next.
|
|
3
|
+
"version": "1.10.0-next.12",
|
|
4
4
|
"description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
-
"@superdoc/sdk": "2.23.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.23.0-next.12",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.26.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.25.0-next.
|
|
32
|
+
"superdoc": "2.26.0-next.12",
|
|
33
|
+
"@superdoc/docx-engine": "0.25.0-next.12",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|