@superdoc-dev/cli 0.16.0-next.18 → 0.16.0-next.19
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 +2149 -382
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1237,7 +1237,8 @@ function mutationOperation(options) {
|
|
|
1237
1237
|
},
|
|
1238
1238
|
deterministicTargetResolution: options.deterministicTargetResolution ?? true,
|
|
1239
1239
|
remediationHints: options.remediationHints,
|
|
1240
|
-
historyUnsafe: options.historyUnsafe
|
|
1240
|
+
historyUnsafe: options.historyUnsafe,
|
|
1241
|
+
returnsPromise: options.returnsPromise
|
|
1241
1242
|
};
|
|
1242
1243
|
}
|
|
1243
1244
|
function camelToKebab(value) {
|
|
@@ -2014,6 +2015,28 @@ More content with **bold** and *italic*.`
|
|
|
2014
2015
|
referenceDocPath: "styles/apply.mdx",
|
|
2015
2016
|
referenceGroup: "styles"
|
|
2016
2017
|
},
|
|
2018
|
+
"templates.apply": {
|
|
2019
|
+
memberPath: "templates.apply",
|
|
2020
|
+
description: "Apply detected DOCX template/substrate (styles, numbering, settings, theme, font table, web settings, headers/footers, section defaults) from a source package onto the current document, preserving body content. Scopes are auto-detected from source package evidence.",
|
|
2021
|
+
expectedResult: "Returns a TemplatesApplyReceipt with detected/applied/skipped scopes, unsupported items, changed parts, id mappings, and warnings.",
|
|
2022
|
+
requiresDocumentContext: true,
|
|
2023
|
+
metadata: mutationOperation({
|
|
2024
|
+
idempotency: "conditional",
|
|
2025
|
+
supportsDryRun: true,
|
|
2026
|
+
supportsTrackedMode: false,
|
|
2027
|
+
possibleFailureCodes: [
|
|
2028
|
+
"UNSUPPORTED_SOURCE",
|
|
2029
|
+
"INVALID_PACKAGE",
|
|
2030
|
+
"CAPABILITY_UNAVAILABLE",
|
|
2031
|
+
"UNSUPPORTED_TEMPLATE_CONTENT"
|
|
2032
|
+
],
|
|
2033
|
+
throws: ["INVALID_INPUT", "CAPABILITY_UNAVAILABLE", "REVISION_MISMATCH"],
|
|
2034
|
+
historyUnsafe: true,
|
|
2035
|
+
returnsPromise: true
|
|
2036
|
+
}),
|
|
2037
|
+
referenceDocPath: "templates/apply.mdx",
|
|
2038
|
+
referenceGroup: "templates"
|
|
2039
|
+
},
|
|
2017
2040
|
"create.paragraph": {
|
|
2018
2041
|
memberPath: "create.paragraph",
|
|
2019
2042
|
description: "Create a standalone paragraph at the target position. To add a list item, use lists.insert instead.",
|
|
@@ -10762,6 +10785,99 @@ var init_schemas = __esm(() => {
|
|
|
10762
10785
|
failure: stylesFailureSchema
|
|
10763
10786
|
};
|
|
10764
10787
|
})(),
|
|
10788
|
+
"templates.apply": (() => {
|
|
10789
|
+
const templatesReceiptFailureCodes = [...COMMAND_CATALOG["templates.apply"].possibleFailureCodes];
|
|
10790
|
+
const pathSourceSchema = objectSchema({ kind: { const: "path" }, path: { type: "string" } }, ["kind", "path"]);
|
|
10791
|
+
const base64SourceSchema = objectSchema({ kind: { const: "base64" }, data: { type: "string" }, filename: { type: "string" } }, ["kind", "data"]);
|
|
10792
|
+
const inputSchema = objectSchema({
|
|
10793
|
+
source: { oneOf: [pathSourceSchema, base64SourceSchema] },
|
|
10794
|
+
bodyPolicy: { const: "preserve" }
|
|
10795
|
+
}, ["source"]);
|
|
10796
|
+
const scopeEnum = {
|
|
10797
|
+
enum: [
|
|
10798
|
+
"styles",
|
|
10799
|
+
"numbering",
|
|
10800
|
+
"settings",
|
|
10801
|
+
"theme",
|
|
10802
|
+
"fontTable",
|
|
10803
|
+
"webSettings",
|
|
10804
|
+
"headersFooters",
|
|
10805
|
+
"sectionDefaults"
|
|
10806
|
+
]
|
|
10807
|
+
};
|
|
10808
|
+
const scopeReportSchema = objectSchema({ scope: scopeEnum, part: { type: "string" }, detail: { type: "string" } }, ["scope", "part"]);
|
|
10809
|
+
const scopeSkipSchema = objectSchema({
|
|
10810
|
+
scope: { type: "string" },
|
|
10811
|
+
part: { type: "string" },
|
|
10812
|
+
reason: { enum: ["NOT_PRESENT_IN_SOURCE", "OUT_OF_SCOPE", "NO_CHANGE", "CAPABILITY_UNAVAILABLE"] },
|
|
10813
|
+
message: { type: "string" }
|
|
10814
|
+
}, ["scope", "reason", "message"]);
|
|
10815
|
+
const unsupportedItemSchema = objectSchema({ part: { type: "string" }, category: { type: "string" }, reason: { type: "string" } }, ["part", "category", "reason"]);
|
|
10816
|
+
const changedPartSchema = objectSchema({
|
|
10817
|
+
part: { type: "string" },
|
|
10818
|
+
scope: {
|
|
10819
|
+
enum: [
|
|
10820
|
+
"styles",
|
|
10821
|
+
"numbering",
|
|
10822
|
+
"settings",
|
|
10823
|
+
"theme",
|
|
10824
|
+
"fontTable",
|
|
10825
|
+
"webSettings",
|
|
10826
|
+
"headersFooters",
|
|
10827
|
+
"sectionDefaults",
|
|
10828
|
+
"package"
|
|
10829
|
+
]
|
|
10830
|
+
},
|
|
10831
|
+
change: { enum: ["created", "replaced", "merged", "imported"] }
|
|
10832
|
+
}, ["part", "scope", "change"]);
|
|
10833
|
+
const idMappingSchema = objectSchema({ kind: { enum: ["style", "numbering", "relationship"] }, from: { type: "string" }, to: { type: "string" } }, ["kind", "from", "to"]);
|
|
10834
|
+
const sourceInfoSchema = objectSchema({ kind: { enum: ["path", "base64"] }, fingerprint: { type: "string" }, partCount: { type: "integer" } }, ["kind", "fingerprint", "partCount"]);
|
|
10835
|
+
const warningSchema = objectSchema({ code: { type: "string" }, message: { type: "string" } }, ["code", "message"]);
|
|
10836
|
+
const templatesSuccessSchema = objectSchema({
|
|
10837
|
+
success: { const: true },
|
|
10838
|
+
changed: { type: "boolean" },
|
|
10839
|
+
dryRun: { type: "boolean" },
|
|
10840
|
+
bodyPolicy: { const: "preserve" },
|
|
10841
|
+
source: sourceInfoSchema,
|
|
10842
|
+
detectedScopes: arraySchema(scopeReportSchema),
|
|
10843
|
+
appliedScopes: arraySchema(scopeReportSchema),
|
|
10844
|
+
skippedScopes: arraySchema(scopeSkipSchema),
|
|
10845
|
+
unsupportedItems: arraySchema(unsupportedItemSchema),
|
|
10846
|
+
changedParts: arraySchema(changedPartSchema),
|
|
10847
|
+
idMappings: objectSchema({
|
|
10848
|
+
styles: arraySchema(idMappingSchema),
|
|
10849
|
+
numbering: arraySchema(idMappingSchema),
|
|
10850
|
+
relationships: arraySchema(idMappingSchema)
|
|
10851
|
+
}),
|
|
10852
|
+
warnings: arraySchema(warningSchema)
|
|
10853
|
+
}, [
|
|
10854
|
+
"success",
|
|
10855
|
+
"changed",
|
|
10856
|
+
"dryRun",
|
|
10857
|
+
"bodyPolicy",
|
|
10858
|
+
"source",
|
|
10859
|
+
"detectedScopes",
|
|
10860
|
+
"appliedScopes",
|
|
10861
|
+
"skippedScopes",
|
|
10862
|
+
"unsupportedItems",
|
|
10863
|
+
"changedParts",
|
|
10864
|
+
"idMappings",
|
|
10865
|
+
"warnings"
|
|
10866
|
+
]);
|
|
10867
|
+
const templatesFailureSchema = objectSchema({
|
|
10868
|
+
success: { const: false },
|
|
10869
|
+
failure: objectSchema({
|
|
10870
|
+
code: { enum: templatesReceiptFailureCodes },
|
|
10871
|
+
message: { type: "string" }
|
|
10872
|
+
}, ["code", "message"])
|
|
10873
|
+
}, ["success", "failure"]);
|
|
10874
|
+
return {
|
|
10875
|
+
input: inputSchema,
|
|
10876
|
+
output: { oneOf: [templatesSuccessSchema, templatesFailureSchema] },
|
|
10877
|
+
success: templatesSuccessSchema,
|
|
10878
|
+
failure: templatesFailureSchema
|
|
10879
|
+
};
|
|
10880
|
+
})(),
|
|
10765
10881
|
"create.paragraph": {
|
|
10766
10882
|
input: objectSchema({
|
|
10767
10883
|
in: storyLocatorSchema,
|
|
@@ -13960,6 +14076,11 @@ var init_reference_doc_map = __esm(() => {
|
|
|
13960
14076
|
description: "Document-level stylesheet mutations (docDefaults, style definitions).",
|
|
13961
14077
|
pagePath: "styles/index.mdx"
|
|
13962
14078
|
},
|
|
14079
|
+
templates: {
|
|
14080
|
+
title: "Templates",
|
|
14081
|
+
description: "Apply detected DOCX template/substrate from a source package, preserving body content.",
|
|
14082
|
+
pagePath: "templates/index.mdx"
|
|
14083
|
+
},
|
|
13963
14084
|
lists: {
|
|
13964
14085
|
title: "Lists",
|
|
13965
14086
|
description: "List inspection and list mutations.",
|
|
@@ -14714,6 +14835,83 @@ var init_format = __esm(() => {
|
|
|
14714
14835
|
INLINE_ALIAS_INPUT_ALLOWED_KEYS = new Set(["target", "ref", "value", "in"]);
|
|
14715
14836
|
});
|
|
14716
14837
|
|
|
14838
|
+
// ../../packages/document-api/src/templates/apply.ts
|
|
14839
|
+
function normalizeOptions2(options) {
|
|
14840
|
+
return {
|
|
14841
|
+
dryRun: options?.dryRun ?? false,
|
|
14842
|
+
expectedRevision: options?.expectedRevision === undefined ? undefined : String(options.expectedRevision)
|
|
14843
|
+
};
|
|
14844
|
+
}
|
|
14845
|
+
function validateTemplatesApplyInput(input) {
|
|
14846
|
+
if (!isRecord(input)) {
|
|
14847
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "templates.apply input must be a non-null object.");
|
|
14848
|
+
}
|
|
14849
|
+
const allowedKeys = new Set(["source", "bodyPolicy"]);
|
|
14850
|
+
for (const key of Object.keys(input)) {
|
|
14851
|
+
if (!allowedKeys.has(key)) {
|
|
14852
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `Unknown field "${key}" on templates.apply input. Allowed fields: ${[...allowedKeys].join(", ")}.`, { field: key });
|
|
14853
|
+
}
|
|
14854
|
+
}
|
|
14855
|
+
const { source, bodyPolicy } = input;
|
|
14856
|
+
if (!isRecord(source)) {
|
|
14857
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "templates.apply requires a source object.", {
|
|
14858
|
+
field: "source",
|
|
14859
|
+
value: source
|
|
14860
|
+
});
|
|
14861
|
+
}
|
|
14862
|
+
if (source.kind === "path") {
|
|
14863
|
+
const sourceKeys = new Set(["kind", "path"]);
|
|
14864
|
+
for (const key of Object.keys(source)) {
|
|
14865
|
+
if (!sourceKeys.has(key)) {
|
|
14866
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `Unknown field "source.${key}". Allowed fields: ${[...sourceKeys].join(", ")}.`, { field: `source.${key}` });
|
|
14867
|
+
}
|
|
14868
|
+
}
|
|
14869
|
+
if (typeof source.path !== "string" || source.path.length === 0) {
|
|
14870
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "source.path must be a non-empty string.", {
|
|
14871
|
+
field: "source.path",
|
|
14872
|
+
value: source.path
|
|
14873
|
+
});
|
|
14874
|
+
}
|
|
14875
|
+
} else if (source.kind === "base64") {
|
|
14876
|
+
const sourceKeys = new Set(["kind", "data", "filename"]);
|
|
14877
|
+
for (const key of Object.keys(source)) {
|
|
14878
|
+
if (!sourceKeys.has(key)) {
|
|
14879
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `Unknown field "source.${key}". Allowed fields: ${[...sourceKeys].join(", ")}.`, { field: `source.${key}` });
|
|
14880
|
+
}
|
|
14881
|
+
}
|
|
14882
|
+
if (typeof source.data !== "string" || source.data.length === 0) {
|
|
14883
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "source.data must be a non-empty string.", {
|
|
14884
|
+
field: "source.data",
|
|
14885
|
+
value: source.data
|
|
14886
|
+
});
|
|
14887
|
+
}
|
|
14888
|
+
if (source.filename !== undefined && typeof source.filename !== "string") {
|
|
14889
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "source.filename must be a string when present.", {
|
|
14890
|
+
field: "source.filename",
|
|
14891
|
+
value: source.filename
|
|
14892
|
+
});
|
|
14893
|
+
}
|
|
14894
|
+
} else {
|
|
14895
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `source.kind must be "path" or "base64", got ${JSON.stringify(source.kind)}.`, { field: "source.kind", value: source.kind });
|
|
14896
|
+
}
|
|
14897
|
+
if (bodyPolicy !== undefined && bodyPolicy !== "preserve") {
|
|
14898
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `bodyPolicy must be "preserve" when present, got ${JSON.stringify(bodyPolicy)}.`, { field: "bodyPolicy", value: bodyPolicy });
|
|
14899
|
+
}
|
|
14900
|
+
}
|
|
14901
|
+
function executeTemplatesApply(adapter, input, options) {
|
|
14902
|
+
validateTemplatesApplyInput(input);
|
|
14903
|
+
return adapter.apply(input, normalizeOptions2(options));
|
|
14904
|
+
}
|
|
14905
|
+
var init_apply2 = __esm(() => {
|
|
14906
|
+
init_errors2();
|
|
14907
|
+
init_validation_primitives();
|
|
14908
|
+
});
|
|
14909
|
+
|
|
14910
|
+
// ../../packages/document-api/src/templates/index.ts
|
|
14911
|
+
var init_templates = __esm(() => {
|
|
14912
|
+
init_apply2();
|
|
14913
|
+
});
|
|
14914
|
+
|
|
14717
14915
|
// ../../packages/document-api/src/get-node/get-node.ts
|
|
14718
14916
|
function executeGetNode(adapter, address2) {
|
|
14719
14917
|
return adapter.getNode(address2);
|
|
@@ -16620,6 +16818,7 @@ function buildDispatchTable(api) {
|
|
|
16620
16818
|
"format.paragraph.setDirection": (input, options) => api.format.paragraph.setDirection(input, options),
|
|
16621
16819
|
"format.paragraph.clearDirection": (input, options) => api.format.paragraph.clearDirection(input, options),
|
|
16622
16820
|
"styles.apply": (input, options) => api.styles.apply(input, options),
|
|
16821
|
+
"templates.apply": (input, options) => api.templates.apply(input, options),
|
|
16623
16822
|
"create.paragraph": (input, options) => api.create.paragraph(input, options),
|
|
16624
16823
|
"create.heading": (input, options) => api.create.heading(input, options),
|
|
16625
16824
|
"create.sectionBreak": (input, options) => api.create.sectionBreak(input, options),
|
|
@@ -19651,6 +19850,11 @@ function createDocumentApi(adapters) {
|
|
|
19651
19850
|
}
|
|
19652
19851
|
}
|
|
19653
19852
|
},
|
|
19853
|
+
templates: {
|
|
19854
|
+
apply(input, options) {
|
|
19855
|
+
return executeTemplatesApply(adapters.templates, input, options);
|
|
19856
|
+
}
|
|
19857
|
+
},
|
|
19654
19858
|
trackChanges: {
|
|
19655
19859
|
list(input) {
|
|
19656
19860
|
return executeTrackChangesList(adapters.trackChanges, input);
|
|
@@ -20713,6 +20917,7 @@ var init_src = __esm(() => {
|
|
|
20713
20917
|
init_format();
|
|
20714
20918
|
init_inline_run_patch();
|
|
20715
20919
|
init_styles();
|
|
20920
|
+
init_templates();
|
|
20716
20921
|
init_get_text();
|
|
20717
20922
|
init_get_markdown();
|
|
20718
20923
|
init_get_html();
|
|
@@ -20751,6 +20956,7 @@ var init_src = __esm(() => {
|
|
|
20751
20956
|
init_authorities();
|
|
20752
20957
|
init_inline_run_patch();
|
|
20753
20958
|
init_styles();
|
|
20959
|
+
init_templates();
|
|
20754
20960
|
init_content_controls_types();
|
|
20755
20961
|
init_paragraphs();
|
|
20756
20962
|
init_lists_types();
|
|
@@ -43569,6 +43775,7 @@ var init_operation_hints = __esm(() => {
|
|
|
43569
43775
|
...buildFormatInlineAliasRecord("applied style"),
|
|
43570
43776
|
...buildParagraphRecord("updated paragraph formatting"),
|
|
43571
43777
|
"styles.apply": "applied stylesheet defaults",
|
|
43778
|
+
"templates.apply": "applied template substrate",
|
|
43572
43779
|
"create.paragraph": "created paragraph",
|
|
43573
43780
|
"create.heading": "created heading",
|
|
43574
43781
|
"create.tableOfContents": "created table of contents",
|
|
@@ -43915,6 +44122,7 @@ var init_operation_hints = __esm(() => {
|
|
|
43915
44122
|
...buildFormatInlineAliasRecord("mutationReceipt"),
|
|
43916
44123
|
...buildParagraphRecord("plain"),
|
|
43917
44124
|
"styles.apply": "receipt",
|
|
44125
|
+
"templates.apply": "receipt",
|
|
43918
44126
|
"create.paragraph": "createResult",
|
|
43919
44127
|
"create.heading": "createResult",
|
|
43920
44128
|
"create.tableOfContents": "createResult",
|
|
@@ -44261,6 +44469,7 @@ var init_operation_hints = __esm(() => {
|
|
|
44261
44469
|
...buildFormatInlineAliasRecord(null),
|
|
44262
44470
|
...buildParagraphRecord("result"),
|
|
44263
44471
|
"styles.apply": "receipt",
|
|
44472
|
+
"templates.apply": "receipt",
|
|
44264
44473
|
"create.paragraph": "result",
|
|
44265
44474
|
"create.heading": "result",
|
|
44266
44475
|
"create.tableOfContents": "result",
|
|
@@ -44615,6 +44824,7 @@ var init_operation_hints = __esm(() => {
|
|
|
44615
44824
|
...buildFormatInlineAliasRecord("textMutation"),
|
|
44616
44825
|
...buildParagraphRecord("textMutation"),
|
|
44617
44826
|
"styles.apply": "general",
|
|
44827
|
+
"templates.apply": "templates",
|
|
44618
44828
|
"create.paragraph": "create",
|
|
44619
44829
|
"create.heading": "create",
|
|
44620
44830
|
"create.tableOfContents": "create",
|
|
@@ -68132,7 +68342,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
68132
68342
|
emptyOptions2 = {};
|
|
68133
68343
|
});
|
|
68134
68344
|
|
|
68135
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
68345
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-B9mZiCO9.es.js
|
|
68136
68346
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
68137
68347
|
const fieldValue = extension$1.config[field];
|
|
68138
68348
|
if (typeof fieldValue === "function")
|
|
@@ -69238,7 +69448,8 @@ function mutationOperation2(options) {
|
|
|
69238
69448
|
},
|
|
69239
69449
|
deterministicTargetResolution: options.deterministicTargetResolution ?? true,
|
|
69240
69450
|
remediationHints: options.remediationHints,
|
|
69241
|
-
historyUnsafe: options.historyUnsafe
|
|
69451
|
+
historyUnsafe: options.historyUnsafe,
|
|
69452
|
+
returnsPromise: options.returnsPromise
|
|
69242
69453
|
};
|
|
69243
69454
|
}
|
|
69244
69455
|
function camelToKebab3(value) {
|
|
@@ -69906,7 +70117,7 @@ function assertNoUnknownFields$1(obj, allowlist, prefix) {
|
|
|
69906
70117
|
throw new DocumentApiValidationError2("INVALID_INPUT", `Unknown field "${location2}" on styles.apply input. Allowed fields: ${[...allowlist].join(", ")}.`, { field: location2 });
|
|
69907
70118
|
}
|
|
69908
70119
|
}
|
|
69909
|
-
function
|
|
70120
|
+
function normalizeOptions$1(options) {
|
|
69910
70121
|
return {
|
|
69911
70122
|
dryRun: options?.dryRun ?? false,
|
|
69912
70123
|
expectedRevision: options?.expectedRevision
|
|
@@ -69915,7 +70126,7 @@ function normalizeOptions2(options) {
|
|
|
69915
70126
|
function executeStylesApply2(adapter, input, options) {
|
|
69916
70127
|
validateStylesApplyInput2(input);
|
|
69917
70128
|
validateStylesApplyOptions2(options);
|
|
69918
|
-
return adapter.apply(input,
|
|
70129
|
+
return adapter.apply(input, normalizeOptions$1(options));
|
|
69919
70130
|
}
|
|
69920
70131
|
function isUnsignedInt322(value) {
|
|
69921
70132
|
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 4294967295;
|
|
@@ -71047,6 +71258,69 @@ function executeInlineAlias2(adapter, key, input, options) {
|
|
|
71047
71258
|
};
|
|
71048
71259
|
return adapter.execute(request, normalizeMutationOptions2(options));
|
|
71049
71260
|
}
|
|
71261
|
+
function normalizeOptions3(options) {
|
|
71262
|
+
return {
|
|
71263
|
+
dryRun: options?.dryRun ?? false,
|
|
71264
|
+
expectedRevision: options?.expectedRevision === undefined ? undefined : String(options.expectedRevision)
|
|
71265
|
+
};
|
|
71266
|
+
}
|
|
71267
|
+
function validateTemplatesApplyInput2(input) {
|
|
71268
|
+
if (!isRecord5(input))
|
|
71269
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "templates.apply input must be a non-null object.");
|
|
71270
|
+
const allowedKeys = new Set(["source", "bodyPolicy"]);
|
|
71271
|
+
for (const key of Object.keys(input))
|
|
71272
|
+
if (!allowedKeys.has(key))
|
|
71273
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", `Unknown field "${key}" on templates.apply input. Allowed fields: ${[...allowedKeys].join(", ")}.`, { field: key });
|
|
71274
|
+
const { source, bodyPolicy } = input;
|
|
71275
|
+
if (!isRecord5(source))
|
|
71276
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "templates.apply requires a source object.", {
|
|
71277
|
+
field: "source",
|
|
71278
|
+
value: source
|
|
71279
|
+
});
|
|
71280
|
+
if (source.kind === "path") {
|
|
71281
|
+
const sourceKeys = new Set(["kind", "path"]);
|
|
71282
|
+
for (const key of Object.keys(source))
|
|
71283
|
+
if (!sourceKeys.has(key))
|
|
71284
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", `Unknown field "source.${key}". Allowed fields: ${[...sourceKeys].join(", ")}.`, { field: `source.${key}` });
|
|
71285
|
+
if (typeof source.path !== "string" || source.path.length === 0)
|
|
71286
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "source.path must be a non-empty string.", {
|
|
71287
|
+
field: "source.path",
|
|
71288
|
+
value: source.path
|
|
71289
|
+
});
|
|
71290
|
+
} else if (source.kind === "base64") {
|
|
71291
|
+
const sourceKeys = new Set([
|
|
71292
|
+
"kind",
|
|
71293
|
+
"data",
|
|
71294
|
+
"filename"
|
|
71295
|
+
]);
|
|
71296
|
+
for (const key of Object.keys(source))
|
|
71297
|
+
if (!sourceKeys.has(key))
|
|
71298
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", `Unknown field "source.${key}". Allowed fields: ${[...sourceKeys].join(", ")}.`, { field: `source.${key}` });
|
|
71299
|
+
if (typeof source.data !== "string" || source.data.length === 0)
|
|
71300
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "source.data must be a non-empty string.", {
|
|
71301
|
+
field: "source.data",
|
|
71302
|
+
value: source.data
|
|
71303
|
+
});
|
|
71304
|
+
if (source.filename !== undefined && typeof source.filename !== "string")
|
|
71305
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "source.filename must be a string when present.", {
|
|
71306
|
+
field: "source.filename",
|
|
71307
|
+
value: source.filename
|
|
71308
|
+
});
|
|
71309
|
+
} else
|
|
71310
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", `source.kind must be "path" or "base64", got ${JSON.stringify(source.kind)}.`, {
|
|
71311
|
+
field: "source.kind",
|
|
71312
|
+
value: source.kind
|
|
71313
|
+
});
|
|
71314
|
+
if (bodyPolicy !== undefined && bodyPolicy !== "preserve")
|
|
71315
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", `bodyPolicy must be "preserve" when present, got ${JSON.stringify(bodyPolicy)}.`, {
|
|
71316
|
+
field: "bodyPolicy",
|
|
71317
|
+
value: bodyPolicy
|
|
71318
|
+
});
|
|
71319
|
+
}
|
|
71320
|
+
function executeTemplatesApply2(adapter, input, options) {
|
|
71321
|
+
validateTemplatesApplyInput2(input);
|
|
71322
|
+
return adapter.apply(input, normalizeOptions3(options));
|
|
71323
|
+
}
|
|
71050
71324
|
function executeGetNode2(adapter, address2) {
|
|
71051
71325
|
return adapter.getNode(address2);
|
|
71052
71326
|
}
|
|
@@ -72704,6 +72978,7 @@ function buildDispatchTable2(api) {
|
|
|
72704
72978
|
"format.paragraph.setDirection": (input, options) => api.format.paragraph.setDirection(input, options),
|
|
72705
72979
|
"format.paragraph.clearDirection": (input, options) => api.format.paragraph.clearDirection(input, options),
|
|
72706
72980
|
"styles.apply": (input, options) => api.styles.apply(input, options),
|
|
72981
|
+
"templates.apply": (input, options) => api.templates.apply(input, options),
|
|
72707
72982
|
"create.paragraph": (input, options) => api.create.paragraph(input, options),
|
|
72708
72983
|
"create.heading": (input, options) => api.create.heading(input, options),
|
|
72709
72984
|
"create.sectionBreak": (input, options) => api.create.sectionBreak(input, options),
|
|
@@ -75353,6 +75628,9 @@ function createDocumentApi2(adapters) {
|
|
|
75353
75628
|
}
|
|
75354
75629
|
}
|
|
75355
75630
|
},
|
|
75631
|
+
templates: { apply(input, options) {
|
|
75632
|
+
return executeTemplatesApply2(adapters.templates, input, options);
|
|
75633
|
+
} },
|
|
75356
75634
|
trackChanges: {
|
|
75357
75635
|
list(input) {
|
|
75358
75636
|
return executeTrackChangesList2(adapters.trackChanges, input);
|
|
@@ -131301,7 +131579,7 @@ var isRegExp = (value) => {
|
|
|
131301
131579
|
state.kern = kernNode.attributes["w:val"];
|
|
131302
131580
|
}
|
|
131303
131581
|
}, SuperConverter;
|
|
131304
|
-
var
|
|
131582
|
+
var init_SuperConverter_B9mZiCO9_es = __esm(() => {
|
|
131305
131583
|
init_rolldown_runtime_Bg48TavK_es();
|
|
131306
131584
|
init_jszip_C49i9kUs_es();
|
|
131307
131585
|
init_xml_js_CqGKpaft_es();
|
|
@@ -134693,6 +134971,32 @@ var init_SuperConverter_9UTOqbve_es = __esm(() => {
|
|
|
134693
134971
|
referenceDocPath: "styles/apply.mdx",
|
|
134694
134972
|
referenceGroup: "styles"
|
|
134695
134973
|
},
|
|
134974
|
+
"templates.apply": {
|
|
134975
|
+
memberPath: "templates.apply",
|
|
134976
|
+
description: "Apply detected DOCX template/substrate (styles, numbering, settings, theme, font table, web settings, headers/footers, section defaults) from a source package onto the current document, preserving body content. Scopes are auto-detected from source package evidence.",
|
|
134977
|
+
expectedResult: "Returns a TemplatesApplyReceipt with detected/applied/skipped scopes, unsupported items, changed parts, id mappings, and warnings.",
|
|
134978
|
+
requiresDocumentContext: true,
|
|
134979
|
+
metadata: mutationOperation2({
|
|
134980
|
+
idempotency: "conditional",
|
|
134981
|
+
supportsDryRun: true,
|
|
134982
|
+
supportsTrackedMode: false,
|
|
134983
|
+
possibleFailureCodes: [
|
|
134984
|
+
"UNSUPPORTED_SOURCE",
|
|
134985
|
+
"INVALID_PACKAGE",
|
|
134986
|
+
"CAPABILITY_UNAVAILABLE",
|
|
134987
|
+
"UNSUPPORTED_TEMPLATE_CONTENT"
|
|
134988
|
+
],
|
|
134989
|
+
throws: [
|
|
134990
|
+
"INVALID_INPUT",
|
|
134991
|
+
"CAPABILITY_UNAVAILABLE",
|
|
134992
|
+
"REVISION_MISMATCH"
|
|
134993
|
+
],
|
|
134994
|
+
historyUnsafe: true,
|
|
134995
|
+
returnsPromise: true
|
|
134996
|
+
}),
|
|
134997
|
+
referenceDocPath: "templates/apply.mdx",
|
|
134998
|
+
referenceGroup: "templates"
|
|
134999
|
+
},
|
|
134696
135000
|
"create.paragraph": {
|
|
134697
135001
|
memberPath: "create.paragraph",
|
|
134698
135002
|
description: "Create a standalone paragraph at the target position. To add a list item, use lists.insert instead.",
|
|
@@ -143351,6 +143655,151 @@ var init_SuperConverter_9UTOqbve_es = __esm(() => {
|
|
|
143351
143655
|
success: stylesSuccessSchema,
|
|
143352
143656
|
failure: stylesFailureSchema
|
|
143353
143657
|
};
|
|
143658
|
+
})(), (() => {
|
|
143659
|
+
const templatesReceiptFailureCodes = [...COMMAND_CATALOG3["templates.apply"].possibleFailureCodes];
|
|
143660
|
+
const inputSchema = objectSchema2({
|
|
143661
|
+
source: { oneOf: [objectSchema2({
|
|
143662
|
+
kind: { const: "path" },
|
|
143663
|
+
path: { type: "string" }
|
|
143664
|
+
}, ["kind", "path"]), objectSchema2({
|
|
143665
|
+
kind: { const: "base64" },
|
|
143666
|
+
data: { type: "string" },
|
|
143667
|
+
filename: { type: "string" }
|
|
143668
|
+
}, ["kind", "data"])] },
|
|
143669
|
+
bodyPolicy: { const: "preserve" }
|
|
143670
|
+
}, ["source"]);
|
|
143671
|
+
const scopeReportSchema = objectSchema2({
|
|
143672
|
+
scope: { enum: [
|
|
143673
|
+
"styles",
|
|
143674
|
+
"numbering",
|
|
143675
|
+
"settings",
|
|
143676
|
+
"theme",
|
|
143677
|
+
"fontTable",
|
|
143678
|
+
"webSettings",
|
|
143679
|
+
"headersFooters",
|
|
143680
|
+
"sectionDefaults"
|
|
143681
|
+
] },
|
|
143682
|
+
part: { type: "string" },
|
|
143683
|
+
detail: { type: "string" }
|
|
143684
|
+
}, ["scope", "part"]);
|
|
143685
|
+
const scopeSkipSchema = objectSchema2({
|
|
143686
|
+
scope: { type: "string" },
|
|
143687
|
+
part: { type: "string" },
|
|
143688
|
+
reason: { enum: [
|
|
143689
|
+
"NOT_PRESENT_IN_SOURCE",
|
|
143690
|
+
"OUT_OF_SCOPE",
|
|
143691
|
+
"NO_CHANGE",
|
|
143692
|
+
"CAPABILITY_UNAVAILABLE"
|
|
143693
|
+
] },
|
|
143694
|
+
message: { type: "string" }
|
|
143695
|
+
}, [
|
|
143696
|
+
"scope",
|
|
143697
|
+
"reason",
|
|
143698
|
+
"message"
|
|
143699
|
+
]);
|
|
143700
|
+
const unsupportedItemSchema = objectSchema2({
|
|
143701
|
+
part: { type: "string" },
|
|
143702
|
+
category: { type: "string" },
|
|
143703
|
+
reason: { type: "string" }
|
|
143704
|
+
}, [
|
|
143705
|
+
"part",
|
|
143706
|
+
"category",
|
|
143707
|
+
"reason"
|
|
143708
|
+
]);
|
|
143709
|
+
const changedPartSchema = objectSchema2({
|
|
143710
|
+
part: { type: "string" },
|
|
143711
|
+
scope: { enum: [
|
|
143712
|
+
"styles",
|
|
143713
|
+
"numbering",
|
|
143714
|
+
"settings",
|
|
143715
|
+
"theme",
|
|
143716
|
+
"fontTable",
|
|
143717
|
+
"webSettings",
|
|
143718
|
+
"headersFooters",
|
|
143719
|
+
"sectionDefaults",
|
|
143720
|
+
"package"
|
|
143721
|
+
] },
|
|
143722
|
+
change: { enum: [
|
|
143723
|
+
"created",
|
|
143724
|
+
"replaced",
|
|
143725
|
+
"merged",
|
|
143726
|
+
"imported"
|
|
143727
|
+
] }
|
|
143728
|
+
}, [
|
|
143729
|
+
"part",
|
|
143730
|
+
"scope",
|
|
143731
|
+
"change"
|
|
143732
|
+
]);
|
|
143733
|
+
const idMappingSchema = objectSchema2({
|
|
143734
|
+
kind: { enum: [
|
|
143735
|
+
"style",
|
|
143736
|
+
"numbering",
|
|
143737
|
+
"relationship"
|
|
143738
|
+
] },
|
|
143739
|
+
from: { type: "string" },
|
|
143740
|
+
to: { type: "string" }
|
|
143741
|
+
}, [
|
|
143742
|
+
"kind",
|
|
143743
|
+
"from",
|
|
143744
|
+
"to"
|
|
143745
|
+
]);
|
|
143746
|
+
const sourceInfoSchema = objectSchema2({
|
|
143747
|
+
kind: { enum: ["path", "base64"] },
|
|
143748
|
+
fingerprint: { type: "string" },
|
|
143749
|
+
partCount: { type: "integer" }
|
|
143750
|
+
}, [
|
|
143751
|
+
"kind",
|
|
143752
|
+
"fingerprint",
|
|
143753
|
+
"partCount"
|
|
143754
|
+
]);
|
|
143755
|
+
const warningSchema = objectSchema2({
|
|
143756
|
+
code: { type: "string" },
|
|
143757
|
+
message: { type: "string" }
|
|
143758
|
+
}, ["code", "message"]);
|
|
143759
|
+
const templatesSuccessSchema = objectSchema2({
|
|
143760
|
+
success: { const: true },
|
|
143761
|
+
changed: { type: "boolean" },
|
|
143762
|
+
dryRun: { type: "boolean" },
|
|
143763
|
+
bodyPolicy: { const: "preserve" },
|
|
143764
|
+
source: sourceInfoSchema,
|
|
143765
|
+
detectedScopes: arraySchema2(scopeReportSchema),
|
|
143766
|
+
appliedScopes: arraySchema2(scopeReportSchema),
|
|
143767
|
+
skippedScopes: arraySchema2(scopeSkipSchema),
|
|
143768
|
+
unsupportedItems: arraySchema2(unsupportedItemSchema),
|
|
143769
|
+
changedParts: arraySchema2(changedPartSchema),
|
|
143770
|
+
idMappings: objectSchema2({
|
|
143771
|
+
styles: arraySchema2(idMappingSchema),
|
|
143772
|
+
numbering: arraySchema2(idMappingSchema),
|
|
143773
|
+
relationships: arraySchema2(idMappingSchema)
|
|
143774
|
+
}),
|
|
143775
|
+
warnings: arraySchema2(warningSchema)
|
|
143776
|
+
}, [
|
|
143777
|
+
"success",
|
|
143778
|
+
"changed",
|
|
143779
|
+
"dryRun",
|
|
143780
|
+
"bodyPolicy",
|
|
143781
|
+
"source",
|
|
143782
|
+
"detectedScopes",
|
|
143783
|
+
"appliedScopes",
|
|
143784
|
+
"skippedScopes",
|
|
143785
|
+
"unsupportedItems",
|
|
143786
|
+
"changedParts",
|
|
143787
|
+
"idMappings",
|
|
143788
|
+
"warnings"
|
|
143789
|
+
]);
|
|
143790
|
+
const templatesFailureSchema = objectSchema2({
|
|
143791
|
+
success: { const: false },
|
|
143792
|
+
failure: objectSchema2({
|
|
143793
|
+
code: { enum: templatesReceiptFailureCodes },
|
|
143794
|
+
message: { type: "string" }
|
|
143795
|
+
}, ["code", "message"])
|
|
143796
|
+
}, ["success", "failure"]);
|
|
143797
|
+
return {
|
|
143798
|
+
input: inputSchema,
|
|
143799
|
+
output: { oneOf: [templatesSuccessSchema, templatesFailureSchema] },
|
|
143800
|
+
success: templatesSuccessSchema,
|
|
143801
|
+
failure: templatesFailureSchema
|
|
143802
|
+
};
|
|
143354
143803
|
})(), objectSchema2({
|
|
143355
143804
|
in: storyLocatorSchema2,
|
|
143356
143805
|
at: {
|
|
@@ -146391,6 +146840,11 @@ var init_SuperConverter_9UTOqbve_es = __esm(() => {
|
|
|
146391
146840
|
description: "Document-level stylesheet mutations (docDefaults, style definitions).",
|
|
146392
146841
|
pagePath: "styles/index.mdx"
|
|
146393
146842
|
},
|
|
146843
|
+
templates: {
|
|
146844
|
+
title: "Templates",
|
|
146845
|
+
description: "Apply detected DOCX template/substrate from a source package, preserving body content.",
|
|
146846
|
+
pagePath: "templates/index.mdx"
|
|
146847
|
+
},
|
|
146394
146848
|
lists: {
|
|
146395
146849
|
title: "Lists",
|
|
146396
146850
|
description: "List inspection and list mutations.",
|
|
@@ -162555,7 +163009,7 @@ var init_SuperConverter_9UTOqbve_es = __esm(() => {
|
|
|
162555
163009
|
const converter = getConverter$8(editor);
|
|
162556
163010
|
if (!converter)
|
|
162557
163011
|
return;
|
|
162558
|
-
if (source.startsWith("collab:remote:"))
|
|
163012
|
+
if (source.startsWith("collab:remote:") || source === "templates.apply")
|
|
162559
163013
|
rebuildNumberingIndexFromPart(converter, part);
|
|
162560
163014
|
converter.translatedNumbering = rebuildTranslatedNumbering(converter.numbering);
|
|
162561
163015
|
clearPartCacheStale(editor, NUMBERING_PART_ID);
|
|
@@ -170160,7 +170614,7 @@ var init_SuperConverter_9UTOqbve_es = __esm(() => {
|
|
|
170160
170614
|
};
|
|
170161
170615
|
});
|
|
170162
170616
|
|
|
170163
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
170617
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-pn-wKqsL.es.js
|
|
170164
170618
|
function parseSizeUnit(val = "0") {
|
|
170165
170619
|
const length3 = val.toString() || "0";
|
|
170166
170620
|
const value = Number.parseFloat(length3);
|
|
@@ -180493,8 +180947,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
180493
180947
|
}
|
|
180494
180948
|
};
|
|
180495
180949
|
};
|
|
180496
|
-
var
|
|
180497
|
-
|
|
180950
|
+
var init_create_headless_toolbar_pn_wKqsL_es = __esm(() => {
|
|
180951
|
+
init_SuperConverter_B9mZiCO9_es();
|
|
180498
180952
|
init_uuid_qzgm05fK_es();
|
|
180499
180953
|
init_constants_D_X7xF4s_es();
|
|
180500
180954
|
init_dist_B8HfvhaK_es();
|
|
@@ -182393,7 +182847,7 @@ var init_decrypt_docx_G2a7hkiV_es = __esm(() => {
|
|
|
182393
182847
|
]);
|
|
182394
182848
|
});
|
|
182395
182849
|
|
|
182396
|
-
// ../../packages/superdoc/dist/chunks/DocxZipper-
|
|
182850
|
+
// ../../packages/superdoc/dist/chunks/DocxZipper-VodIk8WL.es.js
|
|
182397
182851
|
function sniffEncoding(u8) {
|
|
182398
182852
|
if (u8.length >= 2) {
|
|
182399
182853
|
const b0 = u8[0], b1 = u8[1];
|
|
@@ -183066,7 +183520,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
183066
183520
|
return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
|
|
183067
183521
|
}
|
|
183068
183522
|
}, DocxZipper_default;
|
|
183069
|
-
var
|
|
183523
|
+
var init_DocxZipper_VodIk8WL_es = __esm(() => {
|
|
183070
183524
|
init_rolldown_runtime_Bg48TavK_es();
|
|
183071
183525
|
init_jszip_C49i9kUs_es();
|
|
183072
183526
|
init_xml_js_CqGKpaft_es();
|
|
@@ -229657,7 +230111,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
229657
230111
|
init_remark_gfm_BhnWr3yf_es();
|
|
229658
230112
|
});
|
|
229659
230113
|
|
|
229660
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
230114
|
+
// ../../packages/superdoc/dist/chunks/src-CaxTbQ6c.es.js
|
|
229661
230115
|
function deleteProps(obj, propOrProps) {
|
|
229662
230116
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
229663
230117
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -231627,15 +232081,15 @@ function findRangeById(doc$12, id2) {
|
|
|
231627
232081
|
to
|
|
231628
232082
|
} : null;
|
|
231629
232083
|
}
|
|
231630
|
-
function isHeadingStyleId$1(styleId) {
|
|
231631
|
-
return typeof styleId === "string" && /^heading\s*[1-6]$/i.test(styleId.trim());
|
|
232084
|
+
function isHeadingStyleId$1(styleId$1) {
|
|
232085
|
+
return typeof styleId$1 === "string" && /^heading\s*[1-6]$/i.test(styleId$1.trim());
|
|
231632
232086
|
}
|
|
231633
232087
|
function clearHeadingStyleId$1(attrs) {
|
|
231634
232088
|
if (!attrs || typeof attrs !== "object")
|
|
231635
232089
|
return attrs;
|
|
231636
232090
|
const paragraphProperties = attrs.paragraphProperties;
|
|
231637
|
-
const styleId = paragraphProperties?.styleId;
|
|
231638
|
-
if (!isHeadingStyleId$1(styleId))
|
|
232091
|
+
const styleId$1 = paragraphProperties?.styleId;
|
|
232092
|
+
if (!isHeadingStyleId$1(styleId$1))
|
|
231639
232093
|
return attrs;
|
|
231640
232094
|
const nextParagraphProperties = { ...paragraphProperties };
|
|
231641
232095
|
delete nextParagraphProperties.styleId;
|
|
@@ -231854,13 +232308,13 @@ function splitBlockPatch(state, dispatch, editor) {
|
|
|
231854
232308
|
return true;
|
|
231855
232309
|
}
|
|
231856
232310
|
function applyStyleMarks(state, tr, editor, paragraphAttrs, tableInfo) {
|
|
231857
|
-
const styleId = paragraphAttrs?.paragraphProperties?.styleId;
|
|
232311
|
+
const styleId$1 = paragraphAttrs?.paragraphProperties?.styleId;
|
|
231858
232312
|
const explicitStoredMarks = state.storedMarks;
|
|
231859
232313
|
if (paragraphAttrs?.paragraphProperties && Object.prototype.hasOwnProperty.call(paragraphAttrs.paragraphProperties, "styleId") && paragraphAttrs.paragraphProperties.styleId == null) {
|
|
231860
232314
|
tr.setStoredMarks([]);
|
|
231861
232315
|
return;
|
|
231862
232316
|
}
|
|
231863
|
-
if (!editor?.converter && !styleId) {
|
|
232317
|
+
if (!editor?.converter && !styleId$1) {
|
|
231864
232318
|
if (explicitStoredMarks !== null)
|
|
231865
232319
|
tr.setStoredMarks(explicitStoredMarks);
|
|
231866
232320
|
return;
|
|
@@ -231876,8 +232330,8 @@ function applyStyleMarks(state, tr, editor, paragraphAttrs, tableInfo) {
|
|
|
231876
232330
|
translatedNumbering: editor?.converter?.translatedNumbering ?? {},
|
|
231877
232331
|
translatedLinkedStyles: editor?.converter?.translatedLinkedStyles ?? {}
|
|
231878
232332
|
};
|
|
231879
|
-
const runProperties = styleId ? resolveRunProperties(params$1, {}, styleId ? { styleId } : {}, tableInfo, false, Boolean(paragraphAttrs.paragraphProperties?.numberingProperties)) : {};
|
|
231880
|
-
const markDefsFromStyle = styleId ? encodeMarksFromRPr(runProperties, editor?.converter?.convertedXml ?? {}) : [];
|
|
232333
|
+
const runProperties = styleId$1 ? resolveRunProperties(params$1, {}, styleId$1 ? { styleId: styleId$1 } : {}, tableInfo, false, Boolean(paragraphAttrs.paragraphProperties?.numberingProperties)) : {};
|
|
232334
|
+
const markDefsFromStyle = styleId$1 ? encodeMarksFromRPr(runProperties, editor?.converter?.convertedXml ?? {}) : [];
|
|
231881
232335
|
const selectionMarks = tr.selection?.$from?.marks ? tr.selection.$from.marks() : [];
|
|
231882
232336
|
const selectionMarkDefs = selectionMarks.map((mark2) => ({
|
|
231883
232337
|
type: mark2.type.name,
|
|
@@ -233626,7 +234080,7 @@ function parseAttrs(node3) {
|
|
|
233626
234080
|
let rightToLeft;
|
|
233627
234081
|
let sectionProperties = null;
|
|
233628
234082
|
let pageBreakSource = null;
|
|
233629
|
-
const { styleid: styleId, ...extraAttrs } = Array.from(node3.attributes).reduce((acc, attr) => {
|
|
234083
|
+
const { styleid: styleId$1, ...extraAttrs } = Array.from(node3.attributes).reduce((acc, attr) => {
|
|
233630
234084
|
if (attr.name === "data-num-id")
|
|
233631
234085
|
numberingProperties.numId = parseInt(attr.value);
|
|
233632
234086
|
else if (attr.name === "data-level")
|
|
@@ -233718,7 +234172,7 @@ function parseAttrs(node3) {
|
|
|
233718
234172
|
rightToLeft = false;
|
|
233719
234173
|
}
|
|
233720
234174
|
let attrs = {
|
|
233721
|
-
paragraphProperties: { styleId: styleId || null },
|
|
234175
|
+
paragraphProperties: { styleId: styleId$1 || null },
|
|
233722
234176
|
extraAttrs
|
|
233723
234177
|
};
|
|
233724
234178
|
if (indent2 && Object.keys(indent2).length > 0)
|
|
@@ -234150,14 +234604,14 @@ function cloneBorders(borders, sides) {
|
|
|
234150
234604
|
return {};
|
|
234151
234605
|
const source = borders;
|
|
234152
234606
|
const keys$1 = Array.isArray(sides) ? sides : Object.keys(source);
|
|
234153
|
-
const clone = {};
|
|
234607
|
+
const clone$1 = {};
|
|
234154
234608
|
for (const side of keys$1) {
|
|
234155
234609
|
const borderValue = source[side];
|
|
234156
234610
|
if (!borderValue || typeof borderValue !== "object")
|
|
234157
234611
|
continue;
|
|
234158
|
-
clone[side] = { ...borderValue };
|
|
234612
|
+
clone$1[side] = { ...borderValue };
|
|
234159
234613
|
}
|
|
234160
|
-
return clone;
|
|
234614
|
+
return clone$1;
|
|
234161
234615
|
}
|
|
234162
234616
|
function mapBorderSizes(borders, sizeMapper) {
|
|
234163
234617
|
if (!borders || typeof borders !== "object")
|
|
@@ -237171,11 +237625,11 @@ function debounce(fn2, ms) {
|
|
|
237171
237625
|
};
|
|
237172
237626
|
}
|
|
237173
237627
|
function removeProperties(obj, keys$1) {
|
|
237174
|
-
var clone = Object.assign({}, obj);
|
|
237628
|
+
var clone$1 = Object.assign({}, obj);
|
|
237175
237629
|
keys$1.forEach(function(key2) {
|
|
237176
|
-
delete clone[key2];
|
|
237630
|
+
delete clone$1[key2];
|
|
237177
237631
|
});
|
|
237178
|
-
return clone;
|
|
237632
|
+
return clone$1;
|
|
237179
237633
|
}
|
|
237180
237634
|
function splitBySpaces(value) {
|
|
237181
237635
|
return value.split(/\s+/).filter(Boolean);
|
|
@@ -239032,19 +239486,19 @@ function applyAttrsDiff(baseAttrs, attrsDiff) {
|
|
|
239032
239486
|
function cloneAttrs(value) {
|
|
239033
239487
|
if (!isPlainObject$12(value))
|
|
239034
239488
|
return {};
|
|
239035
|
-
const clone = {};
|
|
239489
|
+
const clone$1 = {};
|
|
239036
239490
|
for (const [key2, child] of Object.entries(value))
|
|
239037
|
-
clone[key2] = cloneDeep(child);
|
|
239038
|
-
return clone;
|
|
239491
|
+
clone$1[key2] = cloneDeep(child);
|
|
239492
|
+
return clone$1;
|
|
239039
239493
|
}
|
|
239040
239494
|
function cloneDeep(value) {
|
|
239041
239495
|
if (Array.isArray(value))
|
|
239042
239496
|
return value.map(cloneDeep);
|
|
239043
239497
|
if (isPlainObject$12(value)) {
|
|
239044
|
-
const clone = {};
|
|
239498
|
+
const clone$1 = {};
|
|
239045
239499
|
for (const [key2, child] of Object.entries(value))
|
|
239046
|
-
clone[key2] = cloneDeep(child);
|
|
239047
|
-
return clone;
|
|
239500
|
+
clone$1[key2] = cloneDeep(child);
|
|
239501
|
+
return clone$1;
|
|
239048
239502
|
}
|
|
239049
239503
|
return value;
|
|
239050
239504
|
}
|
|
@@ -240239,8 +240693,8 @@ function shouldCaptureBodyRelationship(type) {
|
|
|
240239
240693
|
function partSnapshotsEqual(a2, b$1) {
|
|
240240
240694
|
return a2.kind === b$1.kind && JSON.stringify(a2.content) === JSON.stringify(b$1.content);
|
|
240241
240695
|
}
|
|
240242
|
-
function hasOwnStyle(styleMap, styleId) {
|
|
240243
|
-
return Object.prototype.hasOwnProperty.call(styleMap, styleId);
|
|
240696
|
+
function hasOwnStyle(styleMap, styleId$1) {
|
|
240697
|
+
return Object.prototype.hasOwnProperty.call(styleMap, styleId$1);
|
|
240244
240698
|
}
|
|
240245
240699
|
function diffStyles(oldStyles, newStyles) {
|
|
240246
240700
|
const oldStyleMap = oldStyles?.styles ?? {};
|
|
@@ -240248,17 +240702,17 @@ function diffStyles(oldStyles, newStyles) {
|
|
|
240248
240702
|
const addedStyles = {};
|
|
240249
240703
|
const removedStyles = {};
|
|
240250
240704
|
const modifiedStyles = {};
|
|
240251
|
-
for (const [styleId, styleDef] of Object.entries(newStyleMap))
|
|
240252
|
-
if (!hasOwnStyle(oldStyleMap, styleId))
|
|
240253
|
-
addedStyles[styleId] = styleDef;
|
|
240254
|
-
for (const [styleId, styleDef] of Object.entries(oldStyleMap)) {
|
|
240255
|
-
if (!hasOwnStyle(newStyleMap, styleId)) {
|
|
240256
|
-
removedStyles[styleId] = styleDef;
|
|
240705
|
+
for (const [styleId$1, styleDef] of Object.entries(newStyleMap))
|
|
240706
|
+
if (!hasOwnStyle(oldStyleMap, styleId$1))
|
|
240707
|
+
addedStyles[styleId$1] = styleDef;
|
|
240708
|
+
for (const [styleId$1, styleDef] of Object.entries(oldStyleMap)) {
|
|
240709
|
+
if (!hasOwnStyle(newStyleMap, styleId$1)) {
|
|
240710
|
+
removedStyles[styleId$1] = styleDef;
|
|
240257
240711
|
continue;
|
|
240258
240712
|
}
|
|
240259
|
-
const attrsDiff = getAttributesDiff(styleDef, newStyleMap[styleId]);
|
|
240713
|
+
const attrsDiff = getAttributesDiff(styleDef, newStyleMap[styleId$1]);
|
|
240260
240714
|
if (attrsDiff)
|
|
240261
|
-
modifiedStyles[styleId] = attrsDiff;
|
|
240715
|
+
modifiedStyles[styleId$1] = attrsDiff;
|
|
240262
240716
|
}
|
|
240263
240717
|
const docDefaultsDiff = getAttributesDiff(oldStyles?.docDefaults ?? {}, newStyles?.docDefaults ?? {});
|
|
240264
240718
|
const latentStylesDiff = getAttributesDiff(oldStyles?.latentStyles ?? {}, newStyles?.latentStyles ?? {});
|
|
@@ -240914,8 +241368,8 @@ function syncStylesDiffToConvertedXml(converter, stylesDiff) {
|
|
|
240914
241368
|
root3.elements = root3.elements.filter((element3) => {
|
|
240915
241369
|
if (element3.name !== "w:style")
|
|
240916
241370
|
return true;
|
|
240917
|
-
const styleId = getStyleId(element3);
|
|
240918
|
-
return !styleId || !removedStyleIds.has(styleId);
|
|
241371
|
+
const styleId$1 = getStyleId(element3);
|
|
241372
|
+
return !styleId$1 || !removedStyleIds.has(styleId$1);
|
|
240919
241373
|
});
|
|
240920
241374
|
const upsertStyleIds = [...Object.keys(stylesDiff.modifiedStyles ?? {}), ...Object.keys(stylesDiff.addedStyles ?? {})];
|
|
240921
241375
|
const uniqueUpsertStyleIds = [...new Set(upsertStyleIds)];
|
|
@@ -240923,14 +241377,14 @@ function syncStylesDiffToConvertedXml(converter, stylesDiff) {
|
|
|
240923
241377
|
return true;
|
|
240924
241378
|
if (!root3.elements)
|
|
240925
241379
|
root3.elements = [];
|
|
240926
|
-
for (const styleId of uniqueUpsertStyleIds) {
|
|
240927
|
-
const styleDef = translatedStyles[styleId];
|
|
241380
|
+
for (const styleId$1 of uniqueUpsertStyleIds) {
|
|
241381
|
+
const styleDef = translatedStyles[styleId$1];
|
|
240928
241382
|
if (!styleDef)
|
|
240929
241383
|
continue;
|
|
240930
241384
|
const nextStyleNode = decodeStyleNode(styleDef);
|
|
240931
241385
|
if (!nextStyleNode)
|
|
240932
241386
|
continue;
|
|
240933
|
-
const existingIndex = root3.elements.findIndex((element3) => element3.name === "w:style" && getStyleId(element3) === String(styleId));
|
|
241387
|
+
const existingIndex = root3.elements.findIndex((element3) => element3.name === "w:style" && getStyleId(element3) === String(styleId$1));
|
|
240934
241388
|
if (existingIndex >= 0) {
|
|
240935
241389
|
root3.elements[existingIndex] = nextStyleNode;
|
|
240936
241390
|
continue;
|
|
@@ -241052,20 +241506,20 @@ function replayStyles({ stylesDiff, editor }) {
|
|
|
241052
241506
|
let changed = false;
|
|
241053
241507
|
changed = applyAttributesDiff(translated.docDefaults, stylesDiff.docDefaultsDiff) || changed;
|
|
241054
241508
|
changed = applyAttributesDiff(translated.latentStyles, stylesDiff.latentStylesDiff) || changed;
|
|
241055
|
-
for (const styleId of Object.keys(stylesDiff.removedStyles ?? {}))
|
|
241056
|
-
if (Object.prototype.hasOwnProperty.call(translated.styles, styleId)) {
|
|
241057
|
-
delete translated.styles[styleId];
|
|
241509
|
+
for (const styleId$1 of Object.keys(stylesDiff.removedStyles ?? {}))
|
|
241510
|
+
if (Object.prototype.hasOwnProperty.call(translated.styles, styleId$1)) {
|
|
241511
|
+
delete translated.styles[styleId$1];
|
|
241058
241512
|
changed = true;
|
|
241059
241513
|
}
|
|
241060
|
-
for (const [styleId, styleDef] of Object.entries(stylesDiff.addedStyles ?? {})) {
|
|
241061
|
-
translated.styles[styleId] = structuredClone(styleDef);
|
|
241514
|
+
for (const [styleId$1, styleDef] of Object.entries(stylesDiff.addedStyles ?? {})) {
|
|
241515
|
+
translated.styles[styleId$1] = structuredClone(styleDef);
|
|
241062
241516
|
changed = true;
|
|
241063
241517
|
}
|
|
241064
|
-
for (const [styleId, diff] of Object.entries(stylesDiff.modifiedStyles ?? {})) {
|
|
241065
|
-
const styleTarget = translated.styles?.[styleId];
|
|
241518
|
+
for (const [styleId$1, diff] of Object.entries(stylesDiff.modifiedStyles ?? {})) {
|
|
241519
|
+
const styleTarget = translated.styles?.[styleId$1];
|
|
241066
241520
|
if (!styleTarget) {
|
|
241067
241521
|
result.skipped += 1;
|
|
241068
|
-
result.warnings.push(`Style replay skipped for "${styleId}": style was not found in translated styles.`);
|
|
241522
|
+
result.warnings.push(`Style replay skipped for "${styleId$1}": style was not found in translated styles.`);
|
|
241069
241523
|
continue;
|
|
241070
241524
|
}
|
|
241071
241525
|
changed = applyAttributesDiff(styleTarget, diff) || changed;
|
|
@@ -242557,8 +243011,8 @@ function wrapHeadingSelectionAsParagraph(slice2, state) {
|
|
|
242557
243011
|
return slice2;
|
|
242558
243012
|
if ($from.depth !== parentDepth || $to.depth !== parentDepth)
|
|
242559
243013
|
return slice2;
|
|
242560
|
-
const styleId = parentParagraph.attrs?.paragraphProperties?.styleId;
|
|
242561
|
-
if (typeof styleId !== "string" || !HEADING_STYLE_RE.test(styleId))
|
|
243014
|
+
const styleId$1 = parentParagraph.attrs?.paragraphProperties?.styleId;
|
|
243015
|
+
if (typeof styleId$1 !== "string" || !HEADING_STYLE_RE.test(styleId$1))
|
|
242562
243016
|
return slice2;
|
|
242563
243017
|
const wrapped = parentParagraph.type.create(parentParagraph.attrs, slice2.content, parentParagraph.marks);
|
|
242564
243018
|
return new Slice(Fragment.from(wrapped), 0, 0);
|
|
@@ -244674,15 +245128,15 @@ function buildParagraphStyle(node3) {
|
|
|
244674
245128
|
if (!node3)
|
|
244675
245129
|
return;
|
|
244676
245130
|
const attrs = node3.attrs;
|
|
244677
|
-
const styleId = attrs?.paragraphProperties?.styleId;
|
|
245131
|
+
const styleId$1 = attrs?.paragraphProperties?.styleId;
|
|
244678
245132
|
const listRendering = attrs?.listRendering;
|
|
244679
245133
|
const isListItem$1 = listRendering != null;
|
|
244680
245134
|
const listLevel = isListItem$1 ? listRendering?.level : undefined;
|
|
244681
|
-
if (!(styleId || isListItem$1))
|
|
245135
|
+
if (!(styleId$1 || isListItem$1))
|
|
244682
245136
|
return;
|
|
244683
245137
|
const result = {};
|
|
244684
|
-
if (typeof styleId === "string" && styleId.length > 0)
|
|
244685
|
-
result.styleId = styleId;
|
|
245138
|
+
if (typeof styleId$1 === "string" && styleId$1.length > 0)
|
|
245139
|
+
result.styleId = styleId$1;
|
|
244686
245140
|
if (isListItem$1)
|
|
244687
245141
|
result.isListItem = true;
|
|
244688
245142
|
if (typeof listLevel === "number" && listLevel >= 0)
|
|
@@ -245222,13 +245676,13 @@ function convertBlockNode2(node3, editor) {
|
|
|
245222
245676
|
}
|
|
245223
245677
|
function convertParagraph2(node3, editor) {
|
|
245224
245678
|
const pProps = node3.attrs.paragraphProperties;
|
|
245225
|
-
const styleId = pProps?.styleId;
|
|
245679
|
+
const styleId$1 = pProps?.styleId;
|
|
245226
245680
|
const numberingProps = pProps?.numberingProperties ?? node3.attrs.numberingProperties;
|
|
245227
245681
|
const inlineContent = convertInlineContent(node3, editor);
|
|
245228
|
-
if (styleId && styleId in HEADING_STYLE_DEPTH)
|
|
245682
|
+
if (styleId$1 && styleId$1 in HEADING_STYLE_DEPTH)
|
|
245229
245683
|
return [{
|
|
245230
245684
|
type: "heading",
|
|
245231
|
-
depth: HEADING_STYLE_DEPTH[styleId],
|
|
245685
|
+
depth: HEADING_STYLE_DEPTH[styleId$1],
|
|
245232
245686
|
children: inlineContent
|
|
245233
245687
|
}];
|
|
245234
245688
|
if (numberingProps && numberingProps.numId != null) {
|
|
@@ -245245,7 +245699,7 @@ function convertParagraph2(node3, editor) {
|
|
|
245245
245699
|
}]
|
|
245246
245700
|
}];
|
|
245247
245701
|
}
|
|
245248
|
-
if (styleId === "Quote")
|
|
245702
|
+
if (styleId$1 === "Quote")
|
|
245249
245703
|
return [{
|
|
245250
245704
|
type: "blockquote",
|
|
245251
245705
|
children: [{
|
|
@@ -245615,8 +246069,8 @@ function collectDocumentStyles(editor) {
|
|
|
245615
246069
|
sizeCounts.set(fmt.fontSize, (sizeCounts.get(fmt.fontSize) ?? 0) + 1);
|
|
245616
246070
|
}
|
|
245617
246071
|
});
|
|
245618
|
-
const paragraphStyles = Array.from(styleData.entries()).map(([styleId, data]) => ({
|
|
245619
|
-
styleId,
|
|
246072
|
+
const paragraphStyles = Array.from(styleData.entries()).map(([styleId$1, data]) => ({
|
|
246073
|
+
styleId: styleId$1,
|
|
245620
246074
|
count: data.count,
|
|
245621
246075
|
...data.fontFamily ? { fontFamily: data.fontFamily } : {},
|
|
245622
246076
|
...data.fontSize !== undefined ? { fontSize: data.fontSize } : {}
|
|
@@ -248445,7 +248899,7 @@ function pushReason(reasons, reason) {
|
|
|
248445
248899
|
reasons.push(reason);
|
|
248446
248900
|
}
|
|
248447
248901
|
function isNonCommandBackedOperation(operationId) {
|
|
248448
|
-
return operationId === "format.apply" || operationId === "styles.apply" || getInlineAliasKey(operationId) !== undefined;
|
|
248902
|
+
return operationId === "format.apply" || operationId === "styles.apply" || operationId === "templates.apply" || getInlineAliasKey(operationId) !== undefined;
|
|
248449
248903
|
}
|
|
248450
248904
|
function hasStylesRoot(stylesPart) {
|
|
248451
248905
|
return stylesPart?.elements?.some((el) => el.name === "w:styles") === true;
|
|
@@ -248467,6 +248921,10 @@ function getStylesApplyUnavailableReason(editor) {
|
|
|
248467
248921
|
if (!hasStylesRoot(converter.convertedXml["word/styles.xml"]))
|
|
248468
248922
|
return "STYLES_PART_MISSING";
|
|
248469
248923
|
}
|
|
248924
|
+
function isTemplatesApplyAvailable(editor) {
|
|
248925
|
+
const converter = editor.converter;
|
|
248926
|
+
return Boolean(converter?.convertedXml && typeof converter.parseXmlToJson === "function");
|
|
248927
|
+
}
|
|
248470
248928
|
function isOperationAvailable(editor, operationId) {
|
|
248471
248929
|
if (operationId === "format.apply")
|
|
248472
248930
|
return INLINE_PROPERTY_REGISTRY2.some((property) => isInlinePropertyAvailable(editor, property));
|
|
@@ -248475,6 +248933,8 @@ function isOperationAvailable(editor, operationId) {
|
|
|
248475
248933
|
return isInlinePropertyAvailable(editor, INLINE_PROPERTY_BY_KEY2[inlineKey2]);
|
|
248476
248934
|
if (operationId === "styles.apply")
|
|
248477
248935
|
return isStylesApplyAvailable(editor);
|
|
248936
|
+
if (operationId === "templates.apply")
|
|
248937
|
+
return isTemplatesApplyAvailable(editor);
|
|
248478
248938
|
return hasAllCommands(editor, operationId) && hasRequiredHelpers(editor, operationId);
|
|
248479
248939
|
}
|
|
248480
248940
|
function isCommandBackedAvailability(operationId) {
|
|
@@ -248493,7 +248953,9 @@ function buildOperationCapabilities(editor) {
|
|
|
248493
248953
|
const stylesReason = getStylesApplyUnavailableReason(editor);
|
|
248494
248954
|
if (stylesReason)
|
|
248495
248955
|
pushReason(reasons, stylesReason);
|
|
248496
|
-
} else if (
|
|
248956
|
+
} else if (operationId === "templates.apply")
|
|
248957
|
+
pushReason(reasons, "OPERATION_UNAVAILABLE");
|
|
248958
|
+
else if (isCommandBackedAvailability(operationId)) {
|
|
248497
248959
|
if (!hasAllCommands(editor, operationId))
|
|
248498
248960
|
pushReason(reasons, "COMMAND_UNAVAILABLE");
|
|
248499
248961
|
if (!hasRequiredHelpers(editor, operationId))
|
|
@@ -248824,6 +249286,1218 @@ function stylesApplyAdapter(editor, input2, options) {
|
|
|
248824
249286
|
}
|
|
248825
249287
|
}).result;
|
|
248826
249288
|
}
|
|
249289
|
+
async function readOpcPackage(bytes) {
|
|
249290
|
+
const zip = await import_jszip_min2.default.loadAsync(bytes);
|
|
249291
|
+
const entries2 = [];
|
|
249292
|
+
zip.forEach((relativePath, file) => {
|
|
249293
|
+
if (file.dir)
|
|
249294
|
+
return;
|
|
249295
|
+
entries2.push({
|
|
249296
|
+
name: relativePath,
|
|
249297
|
+
file
|
|
249298
|
+
});
|
|
249299
|
+
});
|
|
249300
|
+
const byName = /* @__PURE__ */ new Map;
|
|
249301
|
+
await Promise.all(entries2.map(async ({ name, file }) => {
|
|
249302
|
+
byName.set(name, await file.async("uint8array"));
|
|
249303
|
+
}));
|
|
249304
|
+
return { byName };
|
|
249305
|
+
}
|
|
249306
|
+
function decodeText(bytes) {
|
|
249307
|
+
return ensureXmlString(bytes);
|
|
249308
|
+
}
|
|
249309
|
+
function localName$1(el) {
|
|
249310
|
+
if (!el.name)
|
|
249311
|
+
return;
|
|
249312
|
+
return el.name.includes(":") ? el.name.split(":").pop() : el.name;
|
|
249313
|
+
}
|
|
249314
|
+
function rootElement(parsed, name) {
|
|
249315
|
+
return parsed.elements?.find((el) => localName$1(el) === name);
|
|
249316
|
+
}
|
|
249317
|
+
function childrenByLocalName(el, name) {
|
|
249318
|
+
return (el.elements ?? []).filter((c) => localName$1(c) === name);
|
|
249319
|
+
}
|
|
249320
|
+
function firstChildByLocalName(el, name) {
|
|
249321
|
+
return (el.elements ?? []).find((c) => localName$1(c) === name);
|
|
249322
|
+
}
|
|
249323
|
+
function clone(value) {
|
|
249324
|
+
return structuredClone(value);
|
|
249325
|
+
}
|
|
249326
|
+
function mergeIgnorableValues(currentValue, sourceValue) {
|
|
249327
|
+
const merged = [...new Set([...(currentValue ?? "").split(/\s+/).filter(Boolean), ...(sourceValue ?? "").split(/\s+/).filter(Boolean)])];
|
|
249328
|
+
return merged.length ? merged.join(" ") : undefined;
|
|
249329
|
+
}
|
|
249330
|
+
function mergeNamespaceAttributes(currentEl, sourceEl) {
|
|
249331
|
+
const sourceAttrs = sourceEl.attributes ?? {};
|
|
249332
|
+
if (Object.keys(sourceAttrs).length === 0)
|
|
249333
|
+
return;
|
|
249334
|
+
const nextAttrs = { ...currentEl.attributes ?? {} };
|
|
249335
|
+
for (const [key2, value] of Object.entries(sourceAttrs)) {
|
|
249336
|
+
if (key2 === "mc:Ignorable") {
|
|
249337
|
+
const merged = mergeIgnorableValues(nextAttrs[key2], value);
|
|
249338
|
+
if (merged)
|
|
249339
|
+
nextAttrs[key2] = merged;
|
|
249340
|
+
continue;
|
|
249341
|
+
}
|
|
249342
|
+
if (key2 === "xmlns" || key2.startsWith("xmlns:"))
|
|
249343
|
+
nextAttrs[key2] = value;
|
|
249344
|
+
}
|
|
249345
|
+
currentEl.attributes = nextAttrs;
|
|
249346
|
+
}
|
|
249347
|
+
function deepEqualValue(a2, b$1) {
|
|
249348
|
+
if (a2 === b$1)
|
|
249349
|
+
return true;
|
|
249350
|
+
if (a2 == null || b$1 == null)
|
|
249351
|
+
return a2 === b$1;
|
|
249352
|
+
if (typeof a2 !== typeof b$1)
|
|
249353
|
+
return false;
|
|
249354
|
+
if (Array.isArray(a2) || Array.isArray(b$1)) {
|
|
249355
|
+
if (!Array.isArray(a2) || !Array.isArray(b$1) || a2.length !== b$1.length)
|
|
249356
|
+
return false;
|
|
249357
|
+
for (let i4 = 0;i4 < a2.length; i4++)
|
|
249358
|
+
if (!deepEqualValue(a2[i4], b$1[i4]))
|
|
249359
|
+
return false;
|
|
249360
|
+
return true;
|
|
249361
|
+
}
|
|
249362
|
+
if (typeof a2 !== "object")
|
|
249363
|
+
return false;
|
|
249364
|
+
const aRecord = a2;
|
|
249365
|
+
const bRecord = b$1;
|
|
249366
|
+
const aKeys = Object.keys(aRecord);
|
|
249367
|
+
const bKeys = Object.keys(bRecord);
|
|
249368
|
+
if (aKeys.length !== bKeys.length)
|
|
249369
|
+
return false;
|
|
249370
|
+
for (const key2 of aKeys) {
|
|
249371
|
+
if (!(key2 in bRecord))
|
|
249372
|
+
return false;
|
|
249373
|
+
if (!deepEqualValue(aRecord[key2], bRecord[key2]))
|
|
249374
|
+
return false;
|
|
249375
|
+
}
|
|
249376
|
+
return true;
|
|
249377
|
+
}
|
|
249378
|
+
function xmlDeepEqual(a2, b$1) {
|
|
249379
|
+
return deepEqualValue(a2, b$1);
|
|
249380
|
+
}
|
|
249381
|
+
function styleId(el) {
|
|
249382
|
+
return el.attributes?.["w:styleId"];
|
|
249383
|
+
}
|
|
249384
|
+
function replaceSingleton(stylesEl, name, sourceNode) {
|
|
249385
|
+
if (!sourceNode)
|
|
249386
|
+
return false;
|
|
249387
|
+
if (!stylesEl.elements)
|
|
249388
|
+
stylesEl.elements = [];
|
|
249389
|
+
const existingSingletons = stylesEl.elements.filter((c) => localName$1(c) === name);
|
|
249390
|
+
const existingIndex = stylesEl.elements.findIndex((c) => localName$1(c) === name);
|
|
249391
|
+
const desiredIndex = name === "docDefaults" ? 0 : stylesEl.elements.some((c) => localName$1(c) === "docDefaults") ? 1 : 0;
|
|
249392
|
+
if (existingSingletons.length === 1 && existingIndex === desiredIndex && xmlDeepEqual(existingSingletons[0], sourceNode))
|
|
249393
|
+
return false;
|
|
249394
|
+
stylesEl.elements = stylesEl.elements.filter((c) => localName$1(c) !== name);
|
|
249395
|
+
const next2 = clone(sourceNode);
|
|
249396
|
+
if (name === "docDefaults") {
|
|
249397
|
+
stylesEl.elements.unshift(next2);
|
|
249398
|
+
return true;
|
|
249399
|
+
}
|
|
249400
|
+
const insertAt = stylesEl.elements.some((c) => localName$1(c) === "docDefaults") ? 1 : 0;
|
|
249401
|
+
stylesEl.elements.splice(insertAt, 0, next2);
|
|
249402
|
+
return true;
|
|
249403
|
+
}
|
|
249404
|
+
function mergeStylesAuthoritative(currentRoot, sourceRoot) {
|
|
249405
|
+
const result = {
|
|
249406
|
+
replacedIds: [],
|
|
249407
|
+
addedIds: [],
|
|
249408
|
+
docDefaultsAdopted: false,
|
|
249409
|
+
latentStylesAdopted: false,
|
|
249410
|
+
importedStyleEls: []
|
|
249411
|
+
};
|
|
249412
|
+
const curStyles = rootElement(currentRoot, "styles");
|
|
249413
|
+
const srcStyles = rootElement(sourceRoot, "styles");
|
|
249414
|
+
if (!curStyles || !srcStyles)
|
|
249415
|
+
return result;
|
|
249416
|
+
mergeNamespaceAttributes(curStyles, srcStyles);
|
|
249417
|
+
if (!curStyles.elements)
|
|
249418
|
+
curStyles.elements = [];
|
|
249419
|
+
result.docDefaultsAdopted = replaceSingleton(curStyles, "docDefaults", firstChildByLocalName(srcStyles, "docDefaults"));
|
|
249420
|
+
result.latentStylesAdopted = replaceSingleton(curStyles, "latentStyles", firstChildByLocalName(srcStyles, "latentStyles"));
|
|
249421
|
+
const indexById = /* @__PURE__ */ new Map;
|
|
249422
|
+
curStyles.elements.forEach((el, idx) => {
|
|
249423
|
+
if (localName$1(el) === "style") {
|
|
249424
|
+
const id2 = styleId(el);
|
|
249425
|
+
if (id2)
|
|
249426
|
+
indexById.set(id2, idx);
|
|
249427
|
+
}
|
|
249428
|
+
});
|
|
249429
|
+
const srcStyleEls = childrenByLocalName(srcStyles, "style");
|
|
249430
|
+
for (const srcEl of srcStyleEls) {
|
|
249431
|
+
const id2 = styleId(srcEl);
|
|
249432
|
+
if (!id2)
|
|
249433
|
+
continue;
|
|
249434
|
+
const next2 = clone(srcEl);
|
|
249435
|
+
if (indexById.has(id2)) {
|
|
249436
|
+
const idx = indexById.get(id2);
|
|
249437
|
+
curStyles.elements[idx] = next2;
|
|
249438
|
+
result.replacedIds.push(id2);
|
|
249439
|
+
} else {
|
|
249440
|
+
curStyles.elements.push(next2);
|
|
249441
|
+
indexById.set(id2, curStyles.elements.length - 1);
|
|
249442
|
+
result.addedIds.push(id2);
|
|
249443
|
+
}
|
|
249444
|
+
result.importedStyleEls.push(next2);
|
|
249445
|
+
}
|
|
249446
|
+
return result;
|
|
249447
|
+
}
|
|
249448
|
+
function rewriteImportedStyleNumbering(importedStyleEls, numRemap) {
|
|
249449
|
+
if (numRemap.size === 0)
|
|
249450
|
+
return;
|
|
249451
|
+
const walk = (el) => {
|
|
249452
|
+
if (localName$1(el) === "numId") {
|
|
249453
|
+
const v = el.attributes?.["w:val"];
|
|
249454
|
+
if (v !== undefined && numRemap.has(v))
|
|
249455
|
+
el.attributes["w:val"] = numRemap.get(v);
|
|
249456
|
+
}
|
|
249457
|
+
if (el.elements)
|
|
249458
|
+
for (const c of el.elements)
|
|
249459
|
+
walk(c);
|
|
249460
|
+
};
|
|
249461
|
+
for (const styleEl of importedStyleEls)
|
|
249462
|
+
walk(styleEl);
|
|
249463
|
+
}
|
|
249464
|
+
function numAttr(el, attr) {
|
|
249465
|
+
return el.attributes?.[attr];
|
|
249466
|
+
}
|
|
249467
|
+
function mergeNumberingGraph(currentRoot, sourceRoot) {
|
|
249468
|
+
const result = {
|
|
249469
|
+
numRemap: /* @__PURE__ */ new Map,
|
|
249470
|
+
abstractRemap: /* @__PURE__ */ new Map,
|
|
249471
|
+
mappings: []
|
|
249472
|
+
};
|
|
249473
|
+
const cur = rootElement(currentRoot, "numbering");
|
|
249474
|
+
const src = rootElement(sourceRoot, "numbering");
|
|
249475
|
+
if (!cur || !src)
|
|
249476
|
+
return result;
|
|
249477
|
+
mergeNamespaceAttributes(cur, src);
|
|
249478
|
+
if (!cur.elements)
|
|
249479
|
+
cur.elements = [];
|
|
249480
|
+
const usedAbstract = /* @__PURE__ */ new Set;
|
|
249481
|
+
const usedNum = /* @__PURE__ */ new Set;
|
|
249482
|
+
for (const el of cur.elements) {
|
|
249483
|
+
const ln = localName$1(el);
|
|
249484
|
+
if (ln === "abstractNum") {
|
|
249485
|
+
const id2 = numAttr(el, "w:abstractNumId");
|
|
249486
|
+
if (id2 !== undefined)
|
|
249487
|
+
usedAbstract.add(id2);
|
|
249488
|
+
} else if (ln === "num") {
|
|
249489
|
+
const id2 = numAttr(el, "w:numId");
|
|
249490
|
+
if (id2 !== undefined)
|
|
249491
|
+
usedNum.add(id2);
|
|
249492
|
+
}
|
|
249493
|
+
}
|
|
249494
|
+
const nextFree = (used) => {
|
|
249495
|
+
let i4 = 1;
|
|
249496
|
+
while (used.has(String(i4)))
|
|
249497
|
+
i4++;
|
|
249498
|
+
const v = String(i4);
|
|
249499
|
+
used.add(v);
|
|
249500
|
+
return v;
|
|
249501
|
+
};
|
|
249502
|
+
const srcAbstract = childrenByLocalName(src, "abstractNum");
|
|
249503
|
+
const srcNums = childrenByLocalName(src, "num");
|
|
249504
|
+
for (const el of srcAbstract) {
|
|
249505
|
+
const id2 = numAttr(el, "w:abstractNumId");
|
|
249506
|
+
if (id2 === undefined)
|
|
249507
|
+
continue;
|
|
249508
|
+
const next2 = clone(el);
|
|
249509
|
+
let finalId = id2;
|
|
249510
|
+
if (usedAbstract.has(id2)) {
|
|
249511
|
+
finalId = nextFree(usedAbstract);
|
|
249512
|
+
next2.attributes = next2.attributes ?? {};
|
|
249513
|
+
next2.attributes["w:abstractNumId"] = finalId;
|
|
249514
|
+
result.mappings.push({
|
|
249515
|
+
kind: "numbering",
|
|
249516
|
+
from: `abstractNumId:${id2}`,
|
|
249517
|
+
to: `abstractNumId:${finalId}`
|
|
249518
|
+
});
|
|
249519
|
+
} else
|
|
249520
|
+
usedAbstract.add(id2);
|
|
249521
|
+
result.abstractRemap.set(id2, finalId);
|
|
249522
|
+
cur.elements.push(next2);
|
|
249523
|
+
}
|
|
249524
|
+
for (const el of srcNums) {
|
|
249525
|
+
const id2 = numAttr(el, "w:numId");
|
|
249526
|
+
if (id2 === undefined)
|
|
249527
|
+
continue;
|
|
249528
|
+
const next2 = clone(el);
|
|
249529
|
+
const absRef = firstChildByLocalName(next2, "abstractNumId");
|
|
249530
|
+
const absVal = absRef?.attributes?.["w:val"];
|
|
249531
|
+
if (absRef && absVal !== undefined && result.abstractRemap.has(absVal)) {
|
|
249532
|
+
absRef.attributes = absRef.attributes ?? {};
|
|
249533
|
+
absRef.attributes["w:val"] = result.abstractRemap.get(absVal);
|
|
249534
|
+
}
|
|
249535
|
+
let finalId = id2;
|
|
249536
|
+
if (usedNum.has(id2)) {
|
|
249537
|
+
finalId = nextFree(usedNum);
|
|
249538
|
+
next2.attributes = next2.attributes ?? {};
|
|
249539
|
+
next2.attributes["w:numId"] = finalId;
|
|
249540
|
+
result.numRemap.set(id2, finalId);
|
|
249541
|
+
result.mappings.push({
|
|
249542
|
+
kind: "numbering",
|
|
249543
|
+
from: `numId:${id2}`,
|
|
249544
|
+
to: `numId:${finalId}`
|
|
249545
|
+
});
|
|
249546
|
+
} else
|
|
249547
|
+
usedNum.add(id2);
|
|
249548
|
+
cur.elements.push(next2);
|
|
249549
|
+
}
|
|
249550
|
+
return result;
|
|
249551
|
+
}
|
|
249552
|
+
function reconcileSettings(currentRoot, sourceRoot) {
|
|
249553
|
+
const result = {
|
|
249554
|
+
adopted: [],
|
|
249555
|
+
changed: false
|
|
249556
|
+
};
|
|
249557
|
+
const cur = rootElement(currentRoot, "settings");
|
|
249558
|
+
const src = rootElement(sourceRoot, "settings");
|
|
249559
|
+
if (!cur || !src)
|
|
249560
|
+
return result;
|
|
249561
|
+
mergeNamespaceAttributes(cur, src);
|
|
249562
|
+
if (!cur.elements)
|
|
249563
|
+
cur.elements = [];
|
|
249564
|
+
for (const srcEl of src.elements ?? []) {
|
|
249565
|
+
const ln = localName$1(srcEl);
|
|
249566
|
+
if (!ln || !LAYOUT_AFFECTING_SETTING_NAMES.has(ln))
|
|
249567
|
+
continue;
|
|
249568
|
+
const idx = cur.elements.findIndex((c) => localName$1(c) === ln);
|
|
249569
|
+
const next2 = clone(srcEl);
|
|
249570
|
+
if (idx >= 0) {
|
|
249571
|
+
if (xmlDeepEqual(cur.elements[idx], next2))
|
|
249572
|
+
continue;
|
|
249573
|
+
cur.elements[idx] = next2;
|
|
249574
|
+
} else
|
|
249575
|
+
cur.elements.push(next2);
|
|
249576
|
+
result.adopted.push(ln);
|
|
249577
|
+
result.changed = true;
|
|
249578
|
+
}
|
|
249579
|
+
return result;
|
|
249580
|
+
}
|
|
249581
|
+
function findFinalBodySectPr(documentRoot) {
|
|
249582
|
+
const doc$12 = rootElement(documentRoot, "document");
|
|
249583
|
+
if (!doc$12)
|
|
249584
|
+
return;
|
|
249585
|
+
const body = firstChildByLocalName(doc$12, "body");
|
|
249586
|
+
if (!body)
|
|
249587
|
+
return;
|
|
249588
|
+
const sectPrs = childrenByLocalName(body, "sectPr");
|
|
249589
|
+
return sectPrs.length ? sectPrs[sectPrs.length - 1] : undefined;
|
|
249590
|
+
}
|
|
249591
|
+
function findParagraphSectPr(paragraph2) {
|
|
249592
|
+
if (localName$1(paragraph2) !== "p")
|
|
249593
|
+
return;
|
|
249594
|
+
const pPr = firstChildByLocalName(paragraph2, "pPr");
|
|
249595
|
+
return pPr ? firstChildByLocalName(pPr, "sectPr") : undefined;
|
|
249596
|
+
}
|
|
249597
|
+
function findFirstSectionBreakSectPr(node3) {
|
|
249598
|
+
const directSectPr = findParagraphSectPr(node3);
|
|
249599
|
+
if (directSectPr)
|
|
249600
|
+
return directSectPr;
|
|
249601
|
+
if (localName$1(node3) === "pPrChange")
|
|
249602
|
+
return;
|
|
249603
|
+
for (const child of node3.elements ?? []) {
|
|
249604
|
+
const sectPr = findFirstSectionBreakSectPr(child);
|
|
249605
|
+
if (sectPr)
|
|
249606
|
+
return sectPr;
|
|
249607
|
+
}
|
|
249608
|
+
}
|
|
249609
|
+
function findPageOneSectPr(documentRoot) {
|
|
249610
|
+
const doc$12 = rootElement(documentRoot, "document");
|
|
249611
|
+
if (!doc$12)
|
|
249612
|
+
return;
|
|
249613
|
+
const body = firstChildByLocalName(doc$12, "body");
|
|
249614
|
+
if (!body)
|
|
249615
|
+
return;
|
|
249616
|
+
for (const child of body.elements ?? []) {
|
|
249617
|
+
if (localName$1(child) === "sectPr")
|
|
249618
|
+
continue;
|
|
249619
|
+
const sectPr = findFirstSectionBreakSectPr(child);
|
|
249620
|
+
if (sectPr)
|
|
249621
|
+
return sectPr;
|
|
249622
|
+
}
|
|
249623
|
+
return findFinalBodySectPr(documentRoot);
|
|
249624
|
+
}
|
|
249625
|
+
function rewriteSectPrRefs(sectPr, relIdRemap) {
|
|
249626
|
+
for (const el of sectPr.elements ?? []) {
|
|
249627
|
+
const ln = localName$1(el);
|
|
249628
|
+
if (ln === "headerReference" || ln === "footerReference") {
|
|
249629
|
+
const rid = el.attributes?.["r:id"];
|
|
249630
|
+
if (rid !== undefined && relIdRemap.has(rid))
|
|
249631
|
+
el.attributes["r:id"] = relIdRemap.get(rid);
|
|
249632
|
+
}
|
|
249633
|
+
}
|
|
249634
|
+
}
|
|
249635
|
+
function getRelationshipsRoot$1(part) {
|
|
249636
|
+
if (!part)
|
|
249637
|
+
return;
|
|
249638
|
+
return rootElement(part, "Relationships");
|
|
249639
|
+
}
|
|
249640
|
+
function relTargetToWordPath(target) {
|
|
249641
|
+
const cleaned = target.replace(/^\.\//, "").replace(/^\.\.\//, "");
|
|
249642
|
+
if (cleaned.startsWith("word/"))
|
|
249643
|
+
return cleaned;
|
|
249644
|
+
if (cleaned.startsWith("/"))
|
|
249645
|
+
return cleaned.slice(1);
|
|
249646
|
+
return `word/${cleaned}`;
|
|
249647
|
+
}
|
|
249648
|
+
function baseName(p$12) {
|
|
249649
|
+
return p$12.split("/").pop() ?? p$12;
|
|
249650
|
+
}
|
|
249651
|
+
function extOf(name) {
|
|
249652
|
+
const m$1 = name.match(/\.([^.]+)$/);
|
|
249653
|
+
return m$1 ? m$1[1] : "";
|
|
249654
|
+
}
|
|
249655
|
+
function importHeaderFooterAssets(editor, converter, byName, dryRun) {
|
|
249656
|
+
const result = {
|
|
249657
|
+
relIdRemap: /* @__PURE__ */ new Map,
|
|
249658
|
+
changedParts: [],
|
|
249659
|
+
mappings: [],
|
|
249660
|
+
warnings: [],
|
|
249661
|
+
detected: false,
|
|
249662
|
+
applied: false
|
|
249663
|
+
};
|
|
249664
|
+
const srcRelsRaw = byName.get(DOCUMENT_RELS_PART$1);
|
|
249665
|
+
const srcRelEls = getRelationshipsRoot$1(srcRelsRaw ? converter.parseXmlToJson(decodeText(srcRelsRaw)) : undefined)?.elements ?? [];
|
|
249666
|
+
const hfPartNames = [...byName.keys()].filter((n) => /^word\/(header|footer)\d+\.xml$/.test(n)).sort();
|
|
249667
|
+
if (hfPartNames.length === 0)
|
|
249668
|
+
return result;
|
|
249669
|
+
result.detected = true;
|
|
249670
|
+
if (dryRun) {
|
|
249671
|
+
for (const srcPart of hfPartNames)
|
|
249672
|
+
result.changedParts.push({
|
|
249673
|
+
part: srcPart,
|
|
249674
|
+
scope: "headersFooters",
|
|
249675
|
+
change: "imported"
|
|
249676
|
+
});
|
|
249677
|
+
return result;
|
|
249678
|
+
}
|
|
249679
|
+
const usedPartNames = new Set(Object.keys(converter.convertedXml));
|
|
249680
|
+
const allocatePartName = (sourceTarget, kind) => {
|
|
249681
|
+
const desired = `word/${sourceTarget}`;
|
|
249682
|
+
if (!usedPartNames.has(desired)) {
|
|
249683
|
+
usedPartNames.add(desired);
|
|
249684
|
+
return desired;
|
|
249685
|
+
}
|
|
249686
|
+
let i4 = 1;
|
|
249687
|
+
while (usedPartNames.has(`word/${kind}${i4}.xml`))
|
|
249688
|
+
i4++;
|
|
249689
|
+
const allocated = `word/${kind}${i4}.xml`;
|
|
249690
|
+
usedPartNames.add(allocated);
|
|
249691
|
+
return allocated;
|
|
249692
|
+
};
|
|
249693
|
+
let docRelsPart = converter.convertedXml[DOCUMENT_RELS_PART$1];
|
|
249694
|
+
if (!docRelsPart) {
|
|
249695
|
+
docRelsPart = { elements: [{
|
|
249696
|
+
type: "element",
|
|
249697
|
+
name: "Relationships",
|
|
249698
|
+
attributes: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" },
|
|
249699
|
+
elements: []
|
|
249700
|
+
}] };
|
|
249701
|
+
converter.convertedXml[DOCUMENT_RELS_PART$1] = docRelsPart;
|
|
249702
|
+
}
|
|
249703
|
+
const docRelsRoot = getRelationshipsRoot$1(docRelsPart);
|
|
249704
|
+
if (!docRelsRoot.elements)
|
|
249705
|
+
docRelsRoot.elements = [];
|
|
249706
|
+
const usedRelIds = new Set(docRelsRoot.elements.map((el) => el.attributes?.Id).filter((x) => !!x));
|
|
249707
|
+
const allocateRelId = () => {
|
|
249708
|
+
let max$2 = 0;
|
|
249709
|
+
for (const id2 of usedRelIds) {
|
|
249710
|
+
const m$1 = id2.match(/^rId(\d+)$/);
|
|
249711
|
+
if (m$1)
|
|
249712
|
+
max$2 = Math.max(max$2, Number(m$1[1]));
|
|
249713
|
+
}
|
|
249714
|
+
const next2 = `rId${max$2 + 1}`;
|
|
249715
|
+
usedRelIds.add(next2);
|
|
249716
|
+
return next2;
|
|
249717
|
+
};
|
|
249718
|
+
const mediaStore = converter.convertedXml.media ?? converter.media ?? {};
|
|
249719
|
+
converter.convertedXml.media = mediaStore;
|
|
249720
|
+
converter.media = mediaStore;
|
|
249721
|
+
if (!converter.addedMedia)
|
|
249722
|
+
converter.addedMedia = {};
|
|
249723
|
+
const usedMedia = new Set([...Object.keys(mediaStore), ...Object.keys(converter.convertedXml).filter((p$12) => p$12.startsWith("word/media/"))]);
|
|
249724
|
+
const allocateMediaPath = (sourceMediaPath) => {
|
|
249725
|
+
const base5 = baseName(sourceMediaPath);
|
|
249726
|
+
const desired = `word/media/${base5}`;
|
|
249727
|
+
if (!usedMedia.has(desired)) {
|
|
249728
|
+
usedMedia.add(desired);
|
|
249729
|
+
return desired;
|
|
249730
|
+
}
|
|
249731
|
+
const ext = extOf(base5);
|
|
249732
|
+
let i4 = 1;
|
|
249733
|
+
while (usedMedia.has(`word/media/tmpl-image${i4}.${ext}`))
|
|
249734
|
+
i4++;
|
|
249735
|
+
const allocated = `word/media/tmpl-image${i4}.${ext}`;
|
|
249736
|
+
usedMedia.add(allocated);
|
|
249737
|
+
return allocated;
|
|
249738
|
+
};
|
|
249739
|
+
const sourceRelByTarget = /* @__PURE__ */ new Map;
|
|
249740
|
+
for (const rel of srcRelEls) {
|
|
249741
|
+
const type = rel.attributes?.Type;
|
|
249742
|
+
const target = rel.attributes?.Target;
|
|
249743
|
+
const id2 = rel.attributes?.Id;
|
|
249744
|
+
if (!type || !target || !id2)
|
|
249745
|
+
continue;
|
|
249746
|
+
if (type === HEADER_REL_TYPE2 || type === FOOTER_REL_TYPE2)
|
|
249747
|
+
sourceRelByTarget.set(relTargetToWordPath(target).replace(/^word\//, ""), {
|
|
249748
|
+
id: id2,
|
|
249749
|
+
type
|
|
249750
|
+
});
|
|
249751
|
+
}
|
|
249752
|
+
const setHeaderIdsArray = (idsHolder, relId) => {
|
|
249753
|
+
if (!Array.isArray(idsHolder.ids))
|
|
249754
|
+
idsHolder.ids = [];
|
|
249755
|
+
idsHolder.ids.push(relId);
|
|
249756
|
+
};
|
|
249757
|
+
let docRelsChanged = false;
|
|
249758
|
+
let contentTypesChanged = false;
|
|
249759
|
+
for (const srcPart of hfPartNames) {
|
|
249760
|
+
const kind = /header/.test(baseName(srcPart)) ? "header" : "footer";
|
|
249761
|
+
const sourceTarget = baseName(srcPart);
|
|
249762
|
+
const targetPartName = allocatePartName(sourceTarget, kind);
|
|
249763
|
+
const targetBase = baseName(targetPartName);
|
|
249764
|
+
let parsedPart;
|
|
249765
|
+
try {
|
|
249766
|
+
parsedPart = converter.parseXmlToJson(decodeText(byName.get(srcPart)));
|
|
249767
|
+
} catch {
|
|
249768
|
+
result.warnings.push({
|
|
249769
|
+
code: "HEADER_FOOTER_PARSE_FAILED",
|
|
249770
|
+
message: `Could not parse source ${srcPart}; skipped.`
|
|
249771
|
+
});
|
|
249772
|
+
continue;
|
|
249773
|
+
}
|
|
249774
|
+
const srcPartRelsPath = `word/_rels/${sourceTarget}.rels`;
|
|
249775
|
+
const srcPartRelsRaw = byName.get(srcPartRelsPath);
|
|
249776
|
+
if (srcPartRelsRaw) {
|
|
249777
|
+
let parsedRels;
|
|
249778
|
+
try {
|
|
249779
|
+
parsedRels = converter.parseXmlToJson(decodeText(srcPartRelsRaw));
|
|
249780
|
+
} catch {
|
|
249781
|
+
parsedRels = { elements: [] };
|
|
249782
|
+
}
|
|
249783
|
+
const relsRoot = getRelationshipsRoot$1(parsedRels);
|
|
249784
|
+
for (const rel of relsRoot?.elements ?? []) {
|
|
249785
|
+
const type = rel.attributes?.Type;
|
|
249786
|
+
const target = rel.attributes?.Target;
|
|
249787
|
+
const mode = rel.attributes?.TargetMode;
|
|
249788
|
+
if (!type || !target)
|
|
249789
|
+
continue;
|
|
249790
|
+
if (mode === "External")
|
|
249791
|
+
continue;
|
|
249792
|
+
if (type === IMAGE_REL_TYPE2 || /\/media\//.test(relTargetToWordPath(target))) {
|
|
249793
|
+
const srcMediaPath = relTargetToWordPath(target);
|
|
249794
|
+
const bytes = byName.get(srcMediaPath);
|
|
249795
|
+
if (!bytes) {
|
|
249796
|
+
result.warnings.push({
|
|
249797
|
+
code: "MEDIA_MISSING",
|
|
249798
|
+
message: `Header/footer ${srcPart} references missing media ${srcMediaPath}.`
|
|
249799
|
+
});
|
|
249800
|
+
continue;
|
|
249801
|
+
}
|
|
249802
|
+
const targetMediaPath = allocateMediaPath(srcMediaPath);
|
|
249803
|
+
mediaStore[targetMediaPath] = bytes;
|
|
249804
|
+
converter.addedMedia[targetMediaPath] = bytes;
|
|
249805
|
+
const imgStorage = editor.storage?.image?.media;
|
|
249806
|
+
if (imgStorage)
|
|
249807
|
+
imgStorage[targetMediaPath] = bytes;
|
|
249808
|
+
rel.attributes.Target = `media/${baseName(targetMediaPath)}`;
|
|
249809
|
+
result.changedParts.push({
|
|
249810
|
+
part: targetMediaPath,
|
|
249811
|
+
scope: "headersFooters",
|
|
249812
|
+
change: "imported"
|
|
249813
|
+
});
|
|
249814
|
+
if (baseName(targetMediaPath) !== baseName(srcMediaPath))
|
|
249815
|
+
result.mappings.push({
|
|
249816
|
+
kind: "relationship",
|
|
249817
|
+
from: baseName(srcMediaPath),
|
|
249818
|
+
to: baseName(targetMediaPath)
|
|
249819
|
+
});
|
|
249820
|
+
}
|
|
249821
|
+
}
|
|
249822
|
+
converter.convertedXml[`word/_rels/${targetBase}.rels`] = parsedRels;
|
|
249823
|
+
}
|
|
249824
|
+
converter.convertedXml[targetPartName] = parsedPart;
|
|
249825
|
+
result.changedParts.push({
|
|
249826
|
+
part: targetPartName,
|
|
249827
|
+
scope: "headersFooters",
|
|
249828
|
+
change: "imported"
|
|
249829
|
+
});
|
|
249830
|
+
const relId = allocateRelId();
|
|
249831
|
+
docRelsRoot.elements.push({
|
|
249832
|
+
type: "element",
|
|
249833
|
+
name: "Relationship",
|
|
249834
|
+
attributes: {
|
|
249835
|
+
Id: relId,
|
|
249836
|
+
Type: kind === "header" ? HEADER_REL_TYPE2 : FOOTER_REL_TYPE2,
|
|
249837
|
+
Target: targetBase
|
|
249838
|
+
}
|
|
249839
|
+
});
|
|
249840
|
+
docRelsChanged = true;
|
|
249841
|
+
const srcRel = sourceRelByTarget.get(sourceTarget);
|
|
249842
|
+
if (srcRel) {
|
|
249843
|
+
result.relIdRemap.set(srcRel.id, relId);
|
|
249844
|
+
result.mappings.push({
|
|
249845
|
+
kind: "relationship",
|
|
249846
|
+
from: srcRel.id,
|
|
249847
|
+
to: relId
|
|
249848
|
+
});
|
|
249849
|
+
}
|
|
249850
|
+
if (ensureContentTypeOverride$1(converter, targetPartName, kind === "header" ? HEADER_CONTENT_TYPE : FOOTER_CONTENT_TYPE))
|
|
249851
|
+
contentTypesChanged = true;
|
|
249852
|
+
try {
|
|
249853
|
+
const pmJson = converter.reimportHeaderFooterPart?.(targetPartName);
|
|
249854
|
+
if (pmJson) {
|
|
249855
|
+
const collection = kind === "header" ? converter.headers ??= {} : converter.footers ??= {};
|
|
249856
|
+
collection[relId] = pmJson;
|
|
249857
|
+
setHeaderIdsArray(kind === "header" ? converter.headerIds ??= {} : converter.footerIds ??= {}, relId);
|
|
249858
|
+
}
|
|
249859
|
+
} catch {}
|
|
249860
|
+
}
|
|
249861
|
+
if (docRelsChanged)
|
|
249862
|
+
result.changedParts.push({
|
|
249863
|
+
part: DOCUMENT_RELS_PART$1,
|
|
249864
|
+
scope: "package",
|
|
249865
|
+
change: "merged"
|
|
249866
|
+
});
|
|
249867
|
+
if (contentTypesChanged)
|
|
249868
|
+
result.changedParts.push({
|
|
249869
|
+
part: CONTENT_TYPES_PART$1,
|
|
249870
|
+
scope: "package",
|
|
249871
|
+
change: "merged"
|
|
249872
|
+
});
|
|
249873
|
+
result.applied = result.changedParts.length > 0;
|
|
249874
|
+
return result;
|
|
249875
|
+
}
|
|
249876
|
+
function ensureContentTypeOverride$1(converter, partPath, contentType) {
|
|
249877
|
+
const ct = converter.convertedXml[CONTENT_TYPES_PART$1];
|
|
249878
|
+
const types3 = ct ? rootElement(ct, "Types") : undefined;
|
|
249879
|
+
if (!types3)
|
|
249880
|
+
return false;
|
|
249881
|
+
if (!types3.elements)
|
|
249882
|
+
types3.elements = [];
|
|
249883
|
+
const partName = `/${partPath}`;
|
|
249884
|
+
if (types3.elements.some((el) => el.name === "Override" && el.attributes?.PartName === partName))
|
|
249885
|
+
return false;
|
|
249886
|
+
types3.elements.push({
|
|
249887
|
+
type: "element",
|
|
249888
|
+
name: "Override",
|
|
249889
|
+
attributes: {
|
|
249890
|
+
PartName: partName,
|
|
249891
|
+
ContentType: contentType
|
|
249892
|
+
}
|
|
249893
|
+
});
|
|
249894
|
+
return true;
|
|
249895
|
+
}
|
|
249896
|
+
function applyPageOneSectionDefaults(editor, sourceDocumentXml, relIdRemap, parseXml2, dryRun) {
|
|
249897
|
+
const result = {
|
|
249898
|
+
detected: false,
|
|
249899
|
+
applied: false,
|
|
249900
|
+
changed: false,
|
|
249901
|
+
changedParts: [],
|
|
249902
|
+
warnings: []
|
|
249903
|
+
};
|
|
249904
|
+
let parsedDoc;
|
|
249905
|
+
try {
|
|
249906
|
+
parsedDoc = parseXml2(sourceDocumentXml);
|
|
249907
|
+
} catch {
|
|
249908
|
+
return result;
|
|
249909
|
+
}
|
|
249910
|
+
const sourceSectPr = findPageOneSectPr(parsedDoc);
|
|
249911
|
+
if (!sourceSectPr)
|
|
249912
|
+
return result;
|
|
249913
|
+
result.detected = true;
|
|
249914
|
+
const sectPr = clone(sourceSectPr);
|
|
249915
|
+
rewriteSectPrRefs(sectPr, relIdRemap);
|
|
249916
|
+
let projections;
|
|
249917
|
+
try {
|
|
249918
|
+
projections = resolveSectionProjections(editor);
|
|
249919
|
+
} catch {
|
|
249920
|
+
result.warnings.push({
|
|
249921
|
+
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
249922
|
+
message: "Could not resolve sections to apply the source page-1 sectPr."
|
|
249923
|
+
});
|
|
249924
|
+
return result;
|
|
249925
|
+
}
|
|
249926
|
+
const bodyProjection = [...projections].reverse().find((p$12) => p$12.target.kind === "body") ?? projections[projections.length - 1];
|
|
249927
|
+
if (!bodyProjection) {
|
|
249928
|
+
result.warnings.push({
|
|
249929
|
+
code: "SECTION_DEFAULTS_UNAVAILABLE",
|
|
249930
|
+
message: "No body section projection found for page-1 sectPr adoption."
|
|
249931
|
+
});
|
|
249932
|
+
return result;
|
|
249933
|
+
}
|
|
249934
|
+
if (xmlDeepEqual(readTargetSectPr(editor, bodyProjection), sectPr))
|
|
249935
|
+
return result;
|
|
249936
|
+
result.changed = true;
|
|
249937
|
+
result.changedParts.push({
|
|
249938
|
+
part: "word/document.xml",
|
|
249939
|
+
scope: "sectionDefaults",
|
|
249940
|
+
change: "replaced"
|
|
249941
|
+
});
|
|
249942
|
+
if (dryRun)
|
|
249943
|
+
return result;
|
|
249944
|
+
try {
|
|
249945
|
+
applySectPrToProjection(editor, bodyProjection, sectPr);
|
|
249946
|
+
result.applied = true;
|
|
249947
|
+
} catch (err) {
|
|
249948
|
+
result.changed = false;
|
|
249949
|
+
result.changedParts = [];
|
|
249950
|
+
result.warnings.push({
|
|
249951
|
+
code: "SECTION_DEFAULTS_FAILED",
|
|
249952
|
+
message: `Failed to apply source page-1 sectPr: ${err.message ?? "unknown error"}.`
|
|
249953
|
+
});
|
|
249954
|
+
}
|
|
249955
|
+
return result;
|
|
249956
|
+
}
|
|
249957
|
+
function categorizeOutOfScope(name) {
|
|
249958
|
+
if (name.startsWith("customXml/"))
|
|
249959
|
+
return { category: "customXml" };
|
|
249960
|
+
if (name.startsWith("docProps/"))
|
|
249961
|
+
return { category: "docProps" };
|
|
249962
|
+
if (name.startsWith("word/glossary/"))
|
|
249963
|
+
return { category: "glossary" };
|
|
249964
|
+
if (name.startsWith("_xmlsignatures/") || name.includes("/_xmlsignatures/") || /signatures/i.test(name))
|
|
249965
|
+
return { category: "signatures" };
|
|
249966
|
+
if (name.startsWith("word/embeddings/"))
|
|
249967
|
+
return { category: "embeddings" };
|
|
249968
|
+
}
|
|
249969
|
+
function detectScopes(byName) {
|
|
249970
|
+
const substrate = [];
|
|
249971
|
+
const unsupported = [];
|
|
249972
|
+
const has = (p$12) => byName.has(p$12);
|
|
249973
|
+
const text5 = (p$12) => decodeText(byName.get(p$12));
|
|
249974
|
+
if (has("word/styles.xml"))
|
|
249975
|
+
substrate.push({
|
|
249976
|
+
scope: "styles",
|
|
249977
|
+
part: "word/styles.xml",
|
|
249978
|
+
xml: text5("word/styles.xml")
|
|
249979
|
+
});
|
|
249980
|
+
if (has("word/numbering.xml"))
|
|
249981
|
+
substrate.push({
|
|
249982
|
+
scope: "numbering",
|
|
249983
|
+
part: "word/numbering.xml",
|
|
249984
|
+
xml: text5("word/numbering.xml")
|
|
249985
|
+
});
|
|
249986
|
+
if (has("word/settings.xml"))
|
|
249987
|
+
substrate.push({
|
|
249988
|
+
scope: "settings",
|
|
249989
|
+
part: "word/settings.xml",
|
|
249990
|
+
xml: text5("word/settings.xml")
|
|
249991
|
+
});
|
|
249992
|
+
const themeParts = [...byName.keys()].filter((n) => /^word\/theme\/[^/]+\.xml$/.test(n)).sort();
|
|
249993
|
+
if (themeParts.length > 0)
|
|
249994
|
+
substrate.push({
|
|
249995
|
+
scope: "theme",
|
|
249996
|
+
part: "word/theme/theme1.xml",
|
|
249997
|
+
xml: text5(themeParts[0])
|
|
249998
|
+
});
|
|
249999
|
+
if (has("word/fontTable.xml"))
|
|
250000
|
+
substrate.push({
|
|
250001
|
+
scope: "fontTable",
|
|
250002
|
+
part: "word/fontTable.xml",
|
|
250003
|
+
xml: text5("word/fontTable.xml")
|
|
250004
|
+
});
|
|
250005
|
+
if (has("word/webSettings.xml"))
|
|
250006
|
+
substrate.push({
|
|
250007
|
+
scope: "webSettings",
|
|
250008
|
+
part: "word/webSettings.xml",
|
|
250009
|
+
xml: text5("word/webSettings.xml")
|
|
250010
|
+
});
|
|
250011
|
+
const hfParts = [...byName.keys()].filter((n) => /^word\/(header|footer)\d+\.xml$/.test(n)).sort();
|
|
250012
|
+
const headersFooters = {
|
|
250013
|
+
detected: hfParts.length > 0,
|
|
250014
|
+
part: hfParts[0] ?? "word/header1.xml"
|
|
250015
|
+
};
|
|
250016
|
+
const sectionDefaults = has("word/document.xml") ? {
|
|
250017
|
+
detected: true,
|
|
250018
|
+
documentXml: text5("word/document.xml")
|
|
250019
|
+
} : { detected: false };
|
|
250020
|
+
for (const name of [...byName.keys()].sort()) {
|
|
250021
|
+
const cat = categorizeOutOfScope(name);
|
|
250022
|
+
if (cat)
|
|
250023
|
+
unsupported.push({
|
|
250024
|
+
part: name,
|
|
250025
|
+
category: cat.category,
|
|
250026
|
+
reason: "out of initial apply scope"
|
|
250027
|
+
});
|
|
250028
|
+
}
|
|
250029
|
+
substrate.sort((a2, b$1) => {
|
|
250030
|
+
const sa = SUBSTRATE_SCOPE_ORDER.indexOf(a2.scope);
|
|
250031
|
+
const sb = SUBSTRATE_SCOPE_ORDER.indexOf(b$1.scope);
|
|
250032
|
+
return sa !== sb ? sa - sb : a2.part.localeCompare(b$1.part);
|
|
250033
|
+
});
|
|
250034
|
+
return {
|
|
250035
|
+
substrate,
|
|
250036
|
+
headersFooters,
|
|
250037
|
+
sectionDefaults,
|
|
250038
|
+
unsupported
|
|
250039
|
+
};
|
|
250040
|
+
}
|
|
250041
|
+
function fnv1aHex(bytes) {
|
|
250042
|
+
let h$2 = 2166136261;
|
|
250043
|
+
for (let i4 = 0;i4 < bytes.length; i4++) {
|
|
250044
|
+
h$2 ^= bytes[i4];
|
|
250045
|
+
h$2 = Math.imul(h$2, 16777619);
|
|
250046
|
+
}
|
|
250047
|
+
return (h$2 >>> 0).toString(16).padStart(8, "0");
|
|
250048
|
+
}
|
|
250049
|
+
function getBuiltinModule(id2) {
|
|
250050
|
+
const proc = globalThis.process;
|
|
250051
|
+
if (typeof proc?.getBuiltinModule !== "function")
|
|
250052
|
+
return;
|
|
250053
|
+
const direct = proc.getBuiltinModule(id2);
|
|
250054
|
+
if (direct != null)
|
|
250055
|
+
return direct;
|
|
250056
|
+
if (id2.startsWith("node:")) {
|
|
250057
|
+
const bare = proc.getBuiltinModule(id2.slice(5));
|
|
250058
|
+
if (bare != null)
|
|
250059
|
+
return bare;
|
|
250060
|
+
}
|
|
250061
|
+
}
|
|
250062
|
+
function getNodeRequire() {
|
|
250063
|
+
const req = globalThis.require;
|
|
250064
|
+
if (typeof req === "function")
|
|
250065
|
+
return req;
|
|
250066
|
+
try {
|
|
250067
|
+
return Function("try { return require; } catch { return undefined; }")();
|
|
250068
|
+
} catch {
|
|
250069
|
+
return;
|
|
250070
|
+
}
|
|
250071
|
+
}
|
|
250072
|
+
function getNodeFs() {
|
|
250073
|
+
const builtin = getBuiltinModule("node:fs");
|
|
250074
|
+
if (builtin && typeof builtin.readFileSync === "function")
|
|
250075
|
+
return builtin;
|
|
250076
|
+
const req = getNodeRequire();
|
|
250077
|
+
try {
|
|
250078
|
+
const fs = req?.("node:fs");
|
|
250079
|
+
if (fs && typeof fs.readFileSync === "function")
|
|
250080
|
+
return fs;
|
|
250081
|
+
} catch {}
|
|
250082
|
+
}
|
|
250083
|
+
function resolveSourceBytes(input2) {
|
|
250084
|
+
const source = input2.source;
|
|
250085
|
+
if (source.kind === "path") {
|
|
250086
|
+
const fs = getNodeFs();
|
|
250087
|
+
if (!fs)
|
|
250088
|
+
return { failure: {
|
|
250089
|
+
code: "CAPABILITY_UNAVAILABLE",
|
|
250090
|
+
message: "templates.apply path source requires Node fs."
|
|
250091
|
+
} };
|
|
250092
|
+
try {
|
|
250093
|
+
const buf = fs.readFileSync(source.path);
|
|
250094
|
+
return { bytes: new Uint8Array(buf) };
|
|
250095
|
+
} catch {
|
|
250096
|
+
return { failure: {
|
|
250097
|
+
code: "UNSUPPORTED_SOURCE",
|
|
250098
|
+
message: "templates.apply could not read source path."
|
|
250099
|
+
} };
|
|
250100
|
+
}
|
|
250101
|
+
}
|
|
250102
|
+
try {
|
|
250103
|
+
let bytes;
|
|
250104
|
+
const g$1 = globalThis;
|
|
250105
|
+
if (g$1.Buffer && typeof g$1.Buffer.from === "function")
|
|
250106
|
+
bytes = new Uint8Array(g$1.Buffer.from(source.data, "base64"));
|
|
250107
|
+
else if (typeof g$1.atob === "function") {
|
|
250108
|
+
const bin = g$1.atob(source.data);
|
|
250109
|
+
bytes = new Uint8Array(bin.length);
|
|
250110
|
+
for (let i4 = 0;i4 < bin.length; i4++)
|
|
250111
|
+
bytes[i4] = bin.charCodeAt(i4);
|
|
250112
|
+
} else
|
|
250113
|
+
return { failure: {
|
|
250114
|
+
code: "CAPABILITY_UNAVAILABLE",
|
|
250115
|
+
message: "templates.apply base64 source requires Buffer or atob."
|
|
250116
|
+
} };
|
|
250117
|
+
return { bytes };
|
|
250118
|
+
} catch {
|
|
250119
|
+
return { failure: {
|
|
250120
|
+
code: "INVALID_PACKAGE",
|
|
250121
|
+
message: "templates.apply could not decode base64 source."
|
|
250122
|
+
} };
|
|
250123
|
+
}
|
|
250124
|
+
}
|
|
250125
|
+
function failure$2(code7, message) {
|
|
250126
|
+
return {
|
|
250127
|
+
success: false,
|
|
250128
|
+
failure: {
|
|
250129
|
+
code: code7,
|
|
250130
|
+
message
|
|
250131
|
+
}
|
|
250132
|
+
};
|
|
250133
|
+
}
|
|
250134
|
+
function pushNoChangeSkip(skippedScopes, scope, part, message) {
|
|
250135
|
+
skippedScopes.push({
|
|
250136
|
+
scope,
|
|
250137
|
+
part,
|
|
250138
|
+
reason: "NO_CHANGE",
|
|
250139
|
+
message
|
|
250140
|
+
});
|
|
250141
|
+
}
|
|
250142
|
+
function templatesApplyAdapter(editor, input2, options) {
|
|
250143
|
+
const converter = editor.converter;
|
|
250144
|
+
if (!converter || !converter.convertedXml || typeof converter.parseXmlToJson !== "function")
|
|
250145
|
+
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "templates.apply requires a document converter.", { reason: "converter_missing" });
|
|
250146
|
+
checkRevision(editor, options.expectedRevision);
|
|
250147
|
+
return applyTemplateAsync(editor, converter, input2, options);
|
|
250148
|
+
}
|
|
250149
|
+
async function applyTemplateAsync(editor, converter, input2, options) {
|
|
250150
|
+
const resolved = resolveSourceBytes(input2);
|
|
250151
|
+
if (resolved.failure)
|
|
250152
|
+
return failure$2(resolved.failure.code, resolved.failure.message);
|
|
250153
|
+
const bytes = resolved.bytes;
|
|
250154
|
+
let byName;
|
|
250155
|
+
try {
|
|
250156
|
+
({ byName } = await readOpcPackage(bytes));
|
|
250157
|
+
} catch (err) {
|
|
250158
|
+
return failure$2("INVALID_PACKAGE", `templates.apply source is not a valid DOCX package: ${err.message ?? "invalid package"}`);
|
|
250159
|
+
}
|
|
250160
|
+
const partCount = byName.size;
|
|
250161
|
+
if (!byName.has(CONTENT_TYPES_PART))
|
|
250162
|
+
return failure$2("INVALID_PACKAGE", "templates.apply source is missing [Content_Types].xml.");
|
|
250163
|
+
const fingerprint = fnv1aHex(bytes);
|
|
250164
|
+
const sourceInfo = {
|
|
250165
|
+
kind: input2.source.kind,
|
|
250166
|
+
fingerprint,
|
|
250167
|
+
partCount
|
|
250168
|
+
};
|
|
250169
|
+
const detection = detectScopes(byName);
|
|
250170
|
+
const dryRun = options.dryRun;
|
|
250171
|
+
const detectedScopes = [];
|
|
250172
|
+
const appliedScopes = [];
|
|
250173
|
+
const skippedScopes = [];
|
|
250174
|
+
const changedParts = [];
|
|
250175
|
+
const warnings = [];
|
|
250176
|
+
const idMappings = {};
|
|
250177
|
+
const styleMappings = [];
|
|
250178
|
+
const numberingMappings = [];
|
|
250179
|
+
const relationshipMappings = [];
|
|
250180
|
+
for (const d of detection.substrate)
|
|
250181
|
+
detectedScopes.push({
|
|
250182
|
+
scope: d.scope,
|
|
250183
|
+
part: d.part
|
|
250184
|
+
});
|
|
250185
|
+
if (detection.headersFooters.detected)
|
|
250186
|
+
detectedScopes.push({
|
|
250187
|
+
scope: "headersFooters",
|
|
250188
|
+
part: detection.headersFooters.part
|
|
250189
|
+
});
|
|
250190
|
+
if (detection.sectionDefaults.detected)
|
|
250191
|
+
detectedScopes.push({
|
|
250192
|
+
scope: "sectionDefaults",
|
|
250193
|
+
part: "word/document.xml"
|
|
250194
|
+
});
|
|
250195
|
+
const presentSubstrate = new Set(detection.substrate.map((d) => d.scope));
|
|
250196
|
+
for (const scope of SUBSTRATE_SCOPE_ORDER)
|
|
250197
|
+
if (!presentSubstrate.has(scope))
|
|
250198
|
+
skippedScopes.push({
|
|
250199
|
+
scope,
|
|
250200
|
+
reason: "NOT_PRESENT_IN_SOURCE",
|
|
250201
|
+
message: `Source package does not contain a ${scope} part.`
|
|
250202
|
+
});
|
|
250203
|
+
for (const item of detection.unsupported)
|
|
250204
|
+
if (item.category === "customXml") {
|
|
250205
|
+
if (!skippedScopes.some((s2) => s2.scope === "customXml"))
|
|
250206
|
+
skippedScopes.push({
|
|
250207
|
+
scope: "customXml",
|
|
250208
|
+
part: item.part,
|
|
250209
|
+
reason: "OUT_OF_SCOPE",
|
|
250210
|
+
message: "customXml is not part of the supported template surface and was not applied."
|
|
250211
|
+
});
|
|
250212
|
+
}
|
|
250213
|
+
const parsedByPart = /* @__PURE__ */ new Map;
|
|
250214
|
+
for (const d of detection.substrate)
|
|
250215
|
+
try {
|
|
250216
|
+
parsedByPart.set(d.part, converter.parseXmlToJson(d.xml));
|
|
250217
|
+
} catch {
|
|
250218
|
+
return failure$2("UNSUPPORTED_TEMPLATE_CONTENT", `templates.apply could not parse source part ${d.part}.`);
|
|
250219
|
+
}
|
|
250220
|
+
const substrateByScope = /* @__PURE__ */ new Map;
|
|
250221
|
+
for (const d of detection.substrate)
|
|
250222
|
+
substrateByScope.set(d.scope, d);
|
|
250223
|
+
const applyDescriptorPart = (partId, mutateFn) => {
|
|
250224
|
+
return mutatePart({
|
|
250225
|
+
editor,
|
|
250226
|
+
partId,
|
|
250227
|
+
operation: "mutate",
|
|
250228
|
+
source: "templates.apply",
|
|
250229
|
+
dryRun,
|
|
250230
|
+
mutate() {
|
|
250231
|
+
mutateFn();
|
|
250232
|
+
}
|
|
250233
|
+
}).changed;
|
|
250234
|
+
};
|
|
250235
|
+
let numRemap = /* @__PURE__ */ new Map;
|
|
250236
|
+
const numbering = substrateByScope.get("numbering");
|
|
250237
|
+
if (numbering) {
|
|
250238
|
+
const parsed = parsedByPart.get(numbering.part);
|
|
250239
|
+
const hadCurrent = !!converter.convertedXml["word/numbering.xml"];
|
|
250240
|
+
if (applyDescriptorPart("word/numbering.xml", () => {
|
|
250241
|
+
const res = mergeNumberingGraph(converter.convertedXml["word/numbering.xml"], parsed);
|
|
250242
|
+
numRemap = res.numRemap;
|
|
250243
|
+
numberingMappings.push(...res.mappings);
|
|
250244
|
+
})) {
|
|
250245
|
+
appliedScopes.push({
|
|
250246
|
+
scope: "numbering",
|
|
250247
|
+
part: "word/numbering.xml"
|
|
250248
|
+
});
|
|
250249
|
+
changedParts.push({
|
|
250250
|
+
part: "word/numbering.xml",
|
|
250251
|
+
scope: "numbering",
|
|
250252
|
+
change: hadCurrent ? "merged" : "created"
|
|
250253
|
+
});
|
|
250254
|
+
} else
|
|
250255
|
+
pushNoChangeSkip(skippedScopes, "numbering", "word/numbering.xml", "Source numbering graph does not change the current numbering definitions.");
|
|
250256
|
+
}
|
|
250257
|
+
const styles = substrateByScope.get("styles");
|
|
250258
|
+
if (styles) {
|
|
250259
|
+
const parsed = parsedByPart.get(styles.part);
|
|
250260
|
+
const hadCurrent = !!converter.convertedXml["word/styles.xml"];
|
|
250261
|
+
let docDefaultsAdopted = false;
|
|
250262
|
+
let latentStylesAdopted = false;
|
|
250263
|
+
const runMerge = (target) => {
|
|
250264
|
+
const res = mergeStylesAuthoritative(target, parsed);
|
|
250265
|
+
rewriteImportedStyleNumbering(res.importedStyleEls, numRemap);
|
|
250266
|
+
docDefaultsAdopted = res.docDefaultsAdopted;
|
|
250267
|
+
latentStylesAdopted = res.latentStylesAdopted;
|
|
250268
|
+
};
|
|
250269
|
+
if (applyDescriptorPart("word/styles.xml", () => {
|
|
250270
|
+
runMerge(converter.convertedXml["word/styles.xml"]);
|
|
250271
|
+
})) {
|
|
250272
|
+
if (docDefaultsAdopted)
|
|
250273
|
+
warnings.push({
|
|
250274
|
+
code: "DOC_DEFAULTS_ADOPTED",
|
|
250275
|
+
message: "Adopted source w:docDefaults (style baseline)."
|
|
250276
|
+
});
|
|
250277
|
+
if (latentStylesAdopted)
|
|
250278
|
+
warnings.push({
|
|
250279
|
+
code: "LATENT_STYLES_ADOPTED",
|
|
250280
|
+
message: "Adopted source w:latentStyles."
|
|
250281
|
+
});
|
|
250282
|
+
appliedScopes.push({
|
|
250283
|
+
scope: "styles",
|
|
250284
|
+
part: "word/styles.xml"
|
|
250285
|
+
});
|
|
250286
|
+
changedParts.push({
|
|
250287
|
+
part: "word/styles.xml",
|
|
250288
|
+
scope: "styles",
|
|
250289
|
+
change: hadCurrent ? "merged" : "created"
|
|
250290
|
+
});
|
|
250291
|
+
} else
|
|
250292
|
+
pushNoChangeSkip(skippedScopes, "styles", "word/styles.xml", "Source styles already match the current style system.");
|
|
250293
|
+
}
|
|
250294
|
+
const settings = substrateByScope.get("settings");
|
|
250295
|
+
if (settings) {
|
|
250296
|
+
const parsed = parsedByPart.get(settings.part);
|
|
250297
|
+
const hadCurrent = !!converter.convertedXml["word/settings.xml"];
|
|
250298
|
+
if (applyDescriptorPart("word/settings.xml", () => {
|
|
250299
|
+
reconcileSettings(converter.convertedXml["word/settings.xml"], parsed);
|
|
250300
|
+
})) {
|
|
250301
|
+
appliedScopes.push({
|
|
250302
|
+
scope: "settings",
|
|
250303
|
+
part: "word/settings.xml"
|
|
250304
|
+
});
|
|
250305
|
+
changedParts.push({
|
|
250306
|
+
part: "word/settings.xml",
|
|
250307
|
+
scope: "settings",
|
|
250308
|
+
change: hadCurrent ? "merged" : "created"
|
|
250309
|
+
});
|
|
250310
|
+
} else
|
|
250311
|
+
pushNoChangeSkip(skippedScopes, "settings", "word/settings.xml", "Source settings do not change the current layout-affecting settings.");
|
|
250312
|
+
}
|
|
250313
|
+
for (const scope of [
|
|
250314
|
+
"theme",
|
|
250315
|
+
"fontTable",
|
|
250316
|
+
"webSettings"
|
|
250317
|
+
]) {
|
|
250318
|
+
const d = substrateByScope.get(scope);
|
|
250319
|
+
if (!d)
|
|
250320
|
+
continue;
|
|
250321
|
+
const parsed = parsedByPart.get(d.part);
|
|
250322
|
+
const currentPart = converter.convertedXml[d.part];
|
|
250323
|
+
const hadCurrent = !!currentPart;
|
|
250324
|
+
const partChanged = !currentPart || !xmlDeepEqual(currentPart, parsed);
|
|
250325
|
+
const contentType = CONTENT_TYPE_BY_SCOPE[scope];
|
|
250326
|
+
const relType = REL_TYPE_BY_PART[scope];
|
|
250327
|
+
const target = d.part.replace(/^word\//, "");
|
|
250328
|
+
const willRegisterContentType = Boolean(contentType && canRegisterContentTypeOverride(converter, d.part));
|
|
250329
|
+
const willRegisterDocumentRelationship = Boolean(relType && canRegisterDocumentRelationship(converter, relType));
|
|
250330
|
+
if (!(partChanged || willRegisterContentType || willRegisterDocumentRelationship)) {
|
|
250331
|
+
pushNoChangeSkip(skippedScopes, scope, d.part, `Source ${scope} part already matches the current package state.`);
|
|
250332
|
+
continue;
|
|
250333
|
+
}
|
|
250334
|
+
if (!dryRun && partChanged)
|
|
250335
|
+
converter.convertedXml[d.part] = parsed;
|
|
250336
|
+
appliedScopes.push({
|
|
250337
|
+
scope,
|
|
250338
|
+
part: d.part
|
|
250339
|
+
});
|
|
250340
|
+
if (partChanged)
|
|
250341
|
+
changedParts.push({
|
|
250342
|
+
part: d.part,
|
|
250343
|
+
scope,
|
|
250344
|
+
change: hadCurrent ? "replaced" : "created"
|
|
250345
|
+
});
|
|
250346
|
+
if (contentType) {
|
|
250347
|
+
if (dryRun) {
|
|
250348
|
+
if (willRegisterContentType)
|
|
250349
|
+
changedParts.push({
|
|
250350
|
+
part: CONTENT_TYPES_PART,
|
|
250351
|
+
scope: "package",
|
|
250352
|
+
change: "merged"
|
|
250353
|
+
});
|
|
250354
|
+
} else if (ensureContentTypeOverride(converter, d.part, contentType))
|
|
250355
|
+
changedParts.push({
|
|
250356
|
+
part: CONTENT_TYPES_PART,
|
|
250357
|
+
scope: "package",
|
|
250358
|
+
change: "merged"
|
|
250359
|
+
});
|
|
250360
|
+
else if (!converter.convertedXml[CONTENT_TYPES_PART])
|
|
250361
|
+
warnings.push({
|
|
250362
|
+
code: "CONTENT_TYPE_NOT_REGISTERED",
|
|
250363
|
+
message: `Could not register content-type override for ${d.part}; [Content_Types].xml not present.`
|
|
250364
|
+
});
|
|
250365
|
+
}
|
|
250366
|
+
if (relType) {
|
|
250367
|
+
if (dryRun) {
|
|
250368
|
+
if (willRegisterDocumentRelationship)
|
|
250369
|
+
changedParts.push({
|
|
250370
|
+
part: DOCUMENT_RELS_PART,
|
|
250371
|
+
scope: "package",
|
|
250372
|
+
change: "merged"
|
|
250373
|
+
});
|
|
250374
|
+
} else if (ensureDocumentRelationship(converter, relType, target))
|
|
250375
|
+
changedParts.push({
|
|
250376
|
+
part: DOCUMENT_RELS_PART,
|
|
250377
|
+
scope: "package",
|
|
250378
|
+
change: "merged"
|
|
250379
|
+
});
|
|
250380
|
+
else if (!converter.convertedXml[DOCUMENT_RELS_PART])
|
|
250381
|
+
warnings.push({
|
|
250382
|
+
code: "RELATIONSHIP_NOT_REGISTERED",
|
|
250383
|
+
message: `Could not register document relationship for ${d.part}; ${DOCUMENT_RELS_PART} not present.`
|
|
250384
|
+
});
|
|
250385
|
+
}
|
|
250386
|
+
}
|
|
250387
|
+
let relIdRemap = /* @__PURE__ */ new Map;
|
|
250388
|
+
if (detection.headersFooters.detected) {
|
|
250389
|
+
const hf = importHeaderFooterAssets(editor, converter, byName, dryRun);
|
|
250390
|
+
relIdRemap = hf.relIdRemap;
|
|
250391
|
+
changedParts.push(...hf.changedParts);
|
|
250392
|
+
relationshipMappings.push(...hf.mappings);
|
|
250393
|
+
warnings.push(...hf.warnings);
|
|
250394
|
+
if (hf.changedParts.length > 0)
|
|
250395
|
+
appliedScopes.push({
|
|
250396
|
+
scope: "headersFooters",
|
|
250397
|
+
part: detection.headersFooters.part
|
|
250398
|
+
});
|
|
250399
|
+
else
|
|
250400
|
+
pushNoChangeSkip(skippedScopes, "headersFooters", detection.headersFooters.part, "Source headers and footers do not produce any importable changes.");
|
|
250401
|
+
}
|
|
250402
|
+
if (detection.sectionDefaults.detected && detection.sectionDefaults.documentXml) {
|
|
250403
|
+
const sec = applyPageOneSectionDefaults(editor, detection.sectionDefaults.documentXml, relIdRemap, (xml2) => converter.parseXmlToJson(xml2), dryRun);
|
|
250404
|
+
if (sec.changed) {
|
|
250405
|
+
changedParts.push(...sec.changedParts);
|
|
250406
|
+
warnings.push(...sec.warnings);
|
|
250407
|
+
appliedScopes.push({
|
|
250408
|
+
scope: "sectionDefaults",
|
|
250409
|
+
part: "word/document.xml"
|
|
250410
|
+
});
|
|
250411
|
+
} else if (sec.detected) {
|
|
250412
|
+
warnings.push(...sec.warnings);
|
|
250413
|
+
pushNoChangeSkip(skippedScopes, "sectionDefaults", "word/document.xml", sec.warnings.length > 0 ? "Source page-1 section defaults could not be applied." : "Source page-1 section defaults already match the active section defaults.");
|
|
250414
|
+
}
|
|
250415
|
+
}
|
|
250416
|
+
if (styleMappings.length > 0)
|
|
250417
|
+
idMappings.styles = styleMappings;
|
|
250418
|
+
if (numberingMappings.length > 0)
|
|
250419
|
+
idMappings.numbering = numberingMappings;
|
|
250420
|
+
if (relationshipMappings.length > 0)
|
|
250421
|
+
idMappings.relationships = relationshipMappings;
|
|
250422
|
+
const changed = appliedScopes.length > 0;
|
|
250423
|
+
if (!dryRun && changed)
|
|
250424
|
+
converter.documentModified = true;
|
|
250425
|
+
return {
|
|
250426
|
+
success: true,
|
|
250427
|
+
changed,
|
|
250428
|
+
dryRun,
|
|
250429
|
+
bodyPolicy: "preserve",
|
|
250430
|
+
source: sourceInfo,
|
|
250431
|
+
detectedScopes,
|
|
250432
|
+
appliedScopes,
|
|
250433
|
+
skippedScopes,
|
|
250434
|
+
unsupportedItems: detection.unsupported,
|
|
250435
|
+
changedParts,
|
|
250436
|
+
idMappings,
|
|
250437
|
+
warnings
|
|
250438
|
+
};
|
|
250439
|
+
}
|
|
250440
|
+
function ensureContentTypeOverride(converter, partPath, contentType) {
|
|
250441
|
+
const ct = converter.convertedXml[CONTENT_TYPES_PART];
|
|
250442
|
+
const types3 = ct ? rootElement(ct, "Types") : undefined;
|
|
250443
|
+
if (!types3)
|
|
250444
|
+
return false;
|
|
250445
|
+
if (!types3.elements)
|
|
250446
|
+
types3.elements = [];
|
|
250447
|
+
const partName = `/${partPath}`;
|
|
250448
|
+
if (types3.elements.some((el) => el.name === "Override" && el.attributes?.PartName === partName))
|
|
250449
|
+
return false;
|
|
250450
|
+
types3.elements.push({
|
|
250451
|
+
type: "element",
|
|
250452
|
+
name: "Override",
|
|
250453
|
+
attributes: {
|
|
250454
|
+
PartName: partName,
|
|
250455
|
+
ContentType: contentType
|
|
250456
|
+
}
|
|
250457
|
+
});
|
|
250458
|
+
return true;
|
|
250459
|
+
}
|
|
250460
|
+
function canRegisterContentTypeOverride(converter, partPath) {
|
|
250461
|
+
const ct = converter.convertedXml[CONTENT_TYPES_PART];
|
|
250462
|
+
const types3 = ct ? rootElement(ct, "Types") : undefined;
|
|
250463
|
+
if (!types3)
|
|
250464
|
+
return false;
|
|
250465
|
+
const partName = `/${partPath}`;
|
|
250466
|
+
return !types3.elements?.some((el) => el.name === "Override" && el.attributes?.PartName === partName);
|
|
250467
|
+
}
|
|
250468
|
+
function ensureDocumentRelationship(converter, relType, target) {
|
|
250469
|
+
const rels = converter.convertedXml[DOCUMENT_RELS_PART];
|
|
250470
|
+
const relsRoot = rels ? rootElement(rels, "Relationships") : undefined;
|
|
250471
|
+
if (!relsRoot)
|
|
250472
|
+
return false;
|
|
250473
|
+
if (!relsRoot.elements)
|
|
250474
|
+
relsRoot.elements = [];
|
|
250475
|
+
if (relsRoot.elements.some((el) => el.name === "Relationship" && el.attributes?.Type === relType))
|
|
250476
|
+
return false;
|
|
250477
|
+
let max$2 = 0;
|
|
250478
|
+
for (const el of relsRoot.elements) {
|
|
250479
|
+
const m$1 = el.attributes?.Id?.match(/^rId(\d+)$/);
|
|
250480
|
+
if (m$1)
|
|
250481
|
+
max$2 = Math.max(max$2, Number(m$1[1]));
|
|
250482
|
+
}
|
|
250483
|
+
relsRoot.elements.push({
|
|
250484
|
+
type: "element",
|
|
250485
|
+
name: "Relationship",
|
|
250486
|
+
attributes: {
|
|
250487
|
+
Id: `rId${max$2 + 1}`,
|
|
250488
|
+
Type: relType,
|
|
250489
|
+
Target: target
|
|
250490
|
+
}
|
|
250491
|
+
});
|
|
250492
|
+
return true;
|
|
250493
|
+
}
|
|
250494
|
+
function canRegisterDocumentRelationship(converter, relType) {
|
|
250495
|
+
const rels = converter.convertedXml[DOCUMENT_RELS_PART];
|
|
250496
|
+
const relsRoot = rels ? rootElement(rels, "Relationships") : undefined;
|
|
250497
|
+
if (!relsRoot)
|
|
250498
|
+
return false;
|
|
250499
|
+
return !relsRoot.elements?.some((el) => el.name === "Relationship" && el.attributes?.Type === relType);
|
|
250500
|
+
}
|
|
248827
250501
|
function collectTrackInsertRefsInRange(editor, from$1, to) {
|
|
248828
250502
|
if (to <= from$1)
|
|
248829
250503
|
return;
|
|
@@ -249121,10 +250795,10 @@ function buildStyleContext(editor) {
|
|
|
249121
250795
|
docDefaultsFontSizeHp: typeof styleProps.docDefaults?.runProperties?.fontSize === "number" ? styleProps.docDefaults.runProperties.fontSize : undefined
|
|
249122
250796
|
};
|
|
249123
250797
|
}
|
|
249124
|
-
function resolveBlockFontSizePt(styleCtx, styleId) {
|
|
250798
|
+
function resolveBlockFontSizePt(styleCtx, styleId$1) {
|
|
249125
250799
|
if (!styleCtx)
|
|
249126
250800
|
return OOXML_DEFAULT_FONT_SIZE_PT;
|
|
249127
|
-
let currentId = styleId ?? "Normal";
|
|
250801
|
+
let currentId = styleId$1 ?? "Normal";
|
|
249128
250802
|
const visited = /* @__PURE__ */ new Set;
|
|
249129
250803
|
while (currentId && !visited.has(currentId)) {
|
|
249130
250804
|
visited.add(currentId);
|
|
@@ -249147,7 +250821,7 @@ function resolveBlockFontSizePt(styleCtx, styleId) {
|
|
|
249147
250821
|
}
|
|
249148
250822
|
function extractBlockFormatting(node3, styleCtx) {
|
|
249149
250823
|
const pProps = node3.attrs.paragraphProperties;
|
|
249150
|
-
const styleId = pProps?.styleId ?? null;
|
|
250824
|
+
const styleId$1 = pProps?.styleId ?? null;
|
|
249151
250825
|
let fontFamily;
|
|
249152
250826
|
let fontSize;
|
|
249153
250827
|
let bold2;
|
|
@@ -249183,15 +250857,15 @@ function extractBlockFormatting(node3, styleCtx) {
|
|
|
249183
250857
|
if (color2 === "auto")
|
|
249184
250858
|
color2 = undefined;
|
|
249185
250859
|
let headingLevel;
|
|
249186
|
-
if (typeof styleId === "string") {
|
|
249187
|
-
const m$1 = HEADING_PATTERN.exec(styleId);
|
|
250860
|
+
if (typeof styleId$1 === "string") {
|
|
250861
|
+
const m$1 = HEADING_PATTERN.exec(styleId$1);
|
|
249188
250862
|
if (m$1)
|
|
249189
250863
|
headingLevel = parseInt(m$1[1], 10);
|
|
249190
250864
|
}
|
|
249191
250865
|
return {
|
|
249192
|
-
...styleId ? { styleId } : {},
|
|
250866
|
+
...styleId$1 ? { styleId: styleId$1 } : {},
|
|
249193
250867
|
...fontFamily ? { fontFamily } : {},
|
|
249194
|
-
...fontSize !== undefined ? { fontSize } : styleCtx ? { fontSize: resolveBlockFontSizePt(styleCtx, styleId) } : {},
|
|
250868
|
+
...fontSize !== undefined ? { fontSize } : styleCtx ? { fontSize: resolveBlockFontSizePt(styleCtx, styleId$1) } : {},
|
|
249195
250869
|
...bold2 ? { bold: bold2 } : {},
|
|
249196
250870
|
...underline ? { underline } : {},
|
|
249197
250871
|
...color2 ? { color: color2 } : {},
|
|
@@ -250120,12 +251794,12 @@ function isAbstractShared(editor, abstractNumId, numId) {
|
|
|
250120
251794
|
return false;
|
|
250121
251795
|
}
|
|
250122
251796
|
function deepCloneElement(element3) {
|
|
250123
|
-
const clone = { ...element3 };
|
|
251797
|
+
const clone$1 = { ...element3 };
|
|
250124
251798
|
if (element3.attributes)
|
|
250125
|
-
clone.attributes = { ...element3.attributes };
|
|
251799
|
+
clone$1.attributes = { ...element3.attributes };
|
|
250126
251800
|
if (element3.elements)
|
|
250127
|
-
clone.elements = element3.elements.map((child) => deepCloneElement(child));
|
|
250128
|
-
return clone;
|
|
251801
|
+
clone$1.elements = element3.elements.map((child) => deepCloneElement(child));
|
|
251802
|
+
return clone$1;
|
|
250129
251803
|
}
|
|
250130
251804
|
function cloneAbstractDefinition(editor, originalAbstractNumId) {
|
|
250131
251805
|
const numbering = editor.converter.numbering;
|
|
@@ -251883,15 +253557,15 @@ function previewPlan(editor, input2) {
|
|
|
251883
253557
|
}
|
|
251884
253558
|
stepPreviews.push(preview);
|
|
251885
253559
|
}
|
|
251886
|
-
for (const failure$
|
|
253560
|
+
for (const failure$5 of assertFailures)
|
|
251887
253561
|
failures.push({
|
|
251888
253562
|
code: "PRECONDITION_FAILED",
|
|
251889
|
-
stepId: failure$
|
|
253563
|
+
stepId: failure$5.stepId,
|
|
251890
253564
|
phase: "assert",
|
|
251891
|
-
message: `assert "${failure$
|
|
253565
|
+
message: `assert "${failure$5.stepId}" expected ${failure$5.expectedCount} matches but found ${failure$5.actualCount}`,
|
|
251892
253566
|
details: {
|
|
251893
|
-
expectedCount: failure$
|
|
251894
|
-
actualCount: failure$
|
|
253567
|
+
expectedCount: failure$5.expectedCount,
|
|
253568
|
+
actualCount: failure$5.actualCount
|
|
251895
253569
|
}
|
|
251896
253570
|
});
|
|
251897
253571
|
} catch (error3) {
|
|
@@ -252652,11 +254326,11 @@ function syncExtractedTableAttrs(tp) {
|
|
|
252652
254326
|
return extracted;
|
|
252653
254327
|
}
|
|
252654
254328
|
function convertTableBordersToPixelUnits(value) {
|
|
252655
|
-
const clone = cloneBorders(value);
|
|
252656
|
-
if (!clone || Object.keys(clone).length === 0)
|
|
254329
|
+
const clone$1 = cloneBorders(value);
|
|
254330
|
+
if (!clone$1 || Object.keys(clone$1).length === 0)
|
|
252657
254331
|
return;
|
|
252658
|
-
mapBorderSizes(clone, eighthPointsToPixels);
|
|
252659
|
-
return Object.keys(clone).length > 0 ? clone : undefined;
|
|
254332
|
+
mapBorderSizes(clone$1, eighthPointsToPixels);
|
|
254333
|
+
return Object.keys(clone$1).length > 0 ? clone$1 : undefined;
|
|
252660
254334
|
}
|
|
252661
254335
|
function buildWidthAuthoringTableAttrs(currentAttrs, attrOverrides = {}, tablePropertyOverrides = {}) {
|
|
252662
254336
|
const currentTableProps = currentAttrs.tableProperties ?? {};
|
|
@@ -261498,15 +263172,15 @@ function getLocalName2(name) {
|
|
|
261498
263172
|
const i4 = name.indexOf(":");
|
|
261499
263173
|
return i4 >= 0 ? name.slice(i4 + 1) : name;
|
|
261500
263174
|
}
|
|
261501
|
-
function findFirstElement(parent, localName$
|
|
263175
|
+
function findFirstElement(parent, localName$2) {
|
|
261502
263176
|
if (!parent?.elements?.length)
|
|
261503
263177
|
return null;
|
|
261504
|
-
return parent.elements.find((el) => el?.type === "element" && getLocalName2(el.name) === localName$
|
|
263178
|
+
return parent.elements.find((el) => el?.type === "element" && getLocalName2(el.name) === localName$2) ?? null;
|
|
261505
263179
|
}
|
|
261506
|
-
function findAllElements(parent, localName$
|
|
263180
|
+
function findAllElements(parent, localName$2) {
|
|
261507
263181
|
if (!parent?.elements?.length)
|
|
261508
263182
|
return [];
|
|
261509
|
-
return parent.elements.filter((el) => el?.type === "element" && getLocalName2(el.name) === localName$
|
|
263183
|
+
return parent.elements.filter((el) => el?.type === "element" && getLocalName2(el.name) === localName$2);
|
|
261510
263184
|
}
|
|
261511
263185
|
function partNameFromIndex(index2) {
|
|
261512
263186
|
return `customXml/item${index2}.xml`;
|
|
@@ -261657,14 +263331,14 @@ function nextCustomXmlItemIndex(convertedXml, converter) {
|
|
|
261657
263331
|
candidate += 1;
|
|
261658
263332
|
return candidate;
|
|
261659
263333
|
}
|
|
261660
|
-
function createXmlDocument2(rootElement, declaration) {
|
|
263334
|
+
function createXmlDocument2(rootElement$1, declaration) {
|
|
261661
263335
|
const nextDeclaration = declaration ?? DEFAULT_XML_DECLARATION;
|
|
261662
263336
|
return {
|
|
261663
263337
|
declaration: {
|
|
261664
263338
|
...nextDeclaration,
|
|
261665
263339
|
attributes: { ...nextDeclaration.attributes }
|
|
261666
263340
|
},
|
|
261667
|
-
elements: [rootElement]
|
|
263341
|
+
elements: [rootElement$1]
|
|
261668
263342
|
};
|
|
261669
263343
|
}
|
|
261670
263344
|
function parseContentToRootElement(content3) {
|
|
@@ -266024,6 +267698,7 @@ function assembleDocumentApiAdapters(editor) {
|
|
|
266024
267698
|
},
|
|
266025
267699
|
selectionMutation: { execute: (request, options) => selectionMutationWrapper(editor, request, options) },
|
|
266026
267700
|
styles: { apply: (input2, options) => stylesApplyAdapter(editor, input2, options) },
|
|
267701
|
+
templates: { apply: (input2, options) => templatesApplyAdapter(editor, input2, options) },
|
|
266027
267702
|
paragraphs: {
|
|
266028
267703
|
setStyle: (input2, options) => paragraphsSetStyleWrapper(editor, input2, options),
|
|
266029
267704
|
clearStyle: (input2, options) => paragraphsClearStyleWrapper(editor, input2, options),
|
|
@@ -270956,7 +272631,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
270956
272631
|
const attrs = getParagraphAttrs(block);
|
|
270957
272632
|
const spacing = attrs?.spacing ?? {};
|
|
270958
272633
|
const spacingExplicit = attrs?.spacingExplicit;
|
|
270959
|
-
const styleId = asString2(attrs?.styleId);
|
|
272634
|
+
const styleId$1 = asString2(attrs?.styleId);
|
|
270960
272635
|
const contextualSpacing = asBoolean$1(attrs?.contextualSpacing);
|
|
270961
272636
|
let spacingBefore = Math.max(0, Number(spacing.before ?? spacing.lineSpaceBefore ?? 0));
|
|
270962
272637
|
let spacingAfter = ctx$1.overrideSpacingAfter ?? Math.max(0, Number(spacing.after ?? spacing.lineSpaceAfter ?? 0));
|
|
@@ -271001,7 +272676,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
271001
272676
|
}
|
|
271002
272677
|
state.page.fragments.push(fragment2);
|
|
271003
272678
|
state.trailingSpacing = 0;
|
|
271004
|
-
state.lastParagraphStyleId = styleId;
|
|
272679
|
+
state.lastParagraphStyleId = styleId$1;
|
|
271005
272680
|
state.lastParagraphContextualSpacing = contextualSpacing;
|
|
271006
272681
|
return;
|
|
271007
272682
|
}
|
|
@@ -271048,9 +272723,9 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
271048
272723
|
state.trailingSpacing = 0;
|
|
271049
272724
|
if (inBorderGroup && fromLine === 0)
|
|
271050
272725
|
state.cursorY -= rawBorderExpansion.bottom;
|
|
271051
|
-
if (shouldSuppressOwnSpacing(styleId, contextualSpacing, state.lastParagraphStyleId))
|
|
272726
|
+
if (shouldSuppressOwnSpacing(styleId$1, contextualSpacing, state.lastParagraphStyleId))
|
|
271052
272727
|
spacingBefore = 0;
|
|
271053
|
-
if (shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId)) {
|
|
272728
|
+
if (shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId$1)) {
|
|
271054
272729
|
const prevTrailing = asSafeNumber(state.trailingSpacing);
|
|
271055
272730
|
if (prevTrailing > 0) {
|
|
271056
272731
|
state.cursorY -= prevTrailing;
|
|
@@ -271255,7 +272930,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
|
|
|
271255
272930
|
targetState.trailingSpacing = appliedSpacingAfter;
|
|
271256
272931
|
} else
|
|
271257
272932
|
lastState.trailingSpacing = 0;
|
|
271258
|
-
lastState.lastParagraphStyleId = styleId;
|
|
272933
|
+
lastState.lastParagraphStyleId = styleId$1;
|
|
271259
272934
|
lastState.lastParagraphContextualSpacing = contextualSpacing;
|
|
271260
272935
|
lastState.lastParagraphBorderHash = currentBorderHash;
|
|
271261
272936
|
}
|
|
@@ -272686,10 +274361,10 @@ function createPaginator(opts) {
|
|
|
272686
274361
|
pruneTrailingEmptyPages
|
|
272687
274362
|
};
|
|
272688
274363
|
}
|
|
272689
|
-
function normalizeHeadingStyleId(styleId) {
|
|
272690
|
-
if (typeof styleId !== "string")
|
|
274364
|
+
function normalizeHeadingStyleId(styleId$1) {
|
|
274365
|
+
if (typeof styleId$1 !== "string")
|
|
272691
274366
|
return;
|
|
272692
|
-
return styleId.replace(/[\s_-]+/g, "").toLowerCase();
|
|
274367
|
+
return styleId$1.replace(/[\s_-]+/g, "").toLowerCase();
|
|
272693
274368
|
}
|
|
272694
274369
|
function getHeadingLevel2(block) {
|
|
272695
274370
|
if (block.kind !== "paragraph")
|
|
@@ -273460,12 +275135,12 @@ function calculateChainHeight(chain, blocks2, measures, state) {
|
|
|
273460
275135
|
continue;
|
|
273461
275136
|
const spacingBefore = getParagraphSpacingBefore(block);
|
|
273462
275137
|
const spacingAfter = getParagraphSpacingAfter$1(block);
|
|
273463
|
-
const styleId = typeof block.attrs?.styleId === "string" ? block.attrs?.styleId : undefined;
|
|
275138
|
+
const styleId$1 = typeof block.attrs?.styleId === "string" ? block.attrs?.styleId : undefined;
|
|
273464
275139
|
const contextualSpacing = block.attrs?.contextualSpacing === true;
|
|
273465
275140
|
if (isFirstMember) {
|
|
273466
275141
|
const prevTrailing = Number.isFinite(state.trailingSpacing) && state.trailingSpacing > 0 ? state.trailingSpacing : 0;
|
|
273467
|
-
const prevSuppressAfter = shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId);
|
|
273468
|
-
const currSuppressBefore = shouldSuppressOwnSpacing(styleId, contextualSpacing, state.lastParagraphStyleId);
|
|
275142
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId$1);
|
|
275143
|
+
const currSuppressBefore = shouldSuppressOwnSpacing(styleId$1, contextualSpacing, state.lastParagraphStyleId);
|
|
273469
275144
|
let effectiveSpacingBefore;
|
|
273470
275145
|
if (prevSuppressAfter && currSuppressBefore)
|
|
273471
275146
|
effectiveSpacingBefore = 0;
|
|
@@ -273478,14 +275153,14 @@ function calculateChainHeight(chain, blocks2, measures, state) {
|
|
|
273478
275153
|
totalHeight += effectiveSpacingBefore;
|
|
273479
275154
|
isFirstMember = false;
|
|
273480
275155
|
} else {
|
|
273481
|
-
const prevSuppressAfter = shouldSuppressOwnSpacing(prevStyleId, prevContextualSpacing, styleId);
|
|
273482
|
-
const currSuppressBefore = shouldSuppressOwnSpacing(styleId, contextualSpacing, prevStyleId);
|
|
275156
|
+
const prevSuppressAfter = shouldSuppressOwnSpacing(prevStyleId, prevContextualSpacing, styleId$1);
|
|
275157
|
+
const currSuppressBefore = shouldSuppressOwnSpacing(styleId$1, contextualSpacing, prevStyleId);
|
|
273483
275158
|
const effectiveSpacingAfterPrev = prevSuppressAfter ? 0 : prevSpacingAfter;
|
|
273484
275159
|
const effectiveSpacingBefore = currSuppressBefore ? 0 : spacingBefore;
|
|
273485
275160
|
totalHeight += Math.max(effectiveSpacingAfterPrev, effectiveSpacingBefore);
|
|
273486
275161
|
}
|
|
273487
275162
|
totalHeight += getMeasureHeight(block, measure);
|
|
273488
|
-
prevStyleId = styleId;
|
|
275163
|
+
prevStyleId = styleId$1;
|
|
273489
275164
|
prevSpacingAfter = spacingAfter;
|
|
273490
275165
|
prevContextualSpacing = contextualSpacing;
|
|
273491
275166
|
}
|
|
@@ -278174,10 +279849,10 @@ function getPrelayoutHeadingLevel(block) {
|
|
|
278174
279849
|
const headingLevel = attrs?.headingLevel;
|
|
278175
279850
|
if (typeof headingLevel === "number" && Number.isInteger(headingLevel) && headingLevel > 0)
|
|
278176
279851
|
return headingLevel;
|
|
278177
|
-
const styleId = attrs?.styleId;
|
|
278178
|
-
if (typeof styleId !== "string")
|
|
279852
|
+
const styleId$1 = attrs?.styleId;
|
|
279853
|
+
if (typeof styleId$1 !== "string")
|
|
278179
279854
|
return;
|
|
278180
|
-
const normalizedStyleId = styleId.replace(/[\s_-]+/g, "").toLowerCase();
|
|
279855
|
+
const normalizedStyleId = styleId$1.replace(/[\s_-]+/g, "").toLowerCase();
|
|
278181
279856
|
const match$1 = /^heading(\d+)$/.exec(normalizedStyleId);
|
|
278182
279857
|
if (!match$1)
|
|
278183
279858
|
return;
|
|
@@ -289898,26 +291573,26 @@ var Node$13 = class Node$14 {
|
|
|
289898
291573
|
tr.setDocAttribute("bodySectPr", sectPr);
|
|
289899
291574
|
tr.setMeta("forceUpdatePagination", true);
|
|
289900
291575
|
return true;
|
|
289901
|
-
}, Document$1, Text$2, OxmlNode, isLinkedParagraphStyleId = (editor, styleId) => {
|
|
289902
|
-
if (!styleId)
|
|
291576
|
+
}, Document$1, Text$2, OxmlNode, isLinkedParagraphStyleId = (editor, styleId$1) => {
|
|
291577
|
+
if (!styleId$1)
|
|
289903
291578
|
return false;
|
|
289904
|
-
const styleDefinition = readTranslatedLinkedStyles(editor)?.styles?.[styleId];
|
|
291579
|
+
const styleDefinition = readTranslatedLinkedStyles(editor)?.styles?.[styleId$1];
|
|
289905
291580
|
return Boolean(styleDefinition?.type === "paragraph" && styleDefinition?.link);
|
|
289906
|
-
}, isLinkedCharacterStyleId = (editor, styleId) => {
|
|
289907
|
-
if (!styleId)
|
|
291581
|
+
}, isLinkedCharacterStyleId = (editor, styleId$1) => {
|
|
291582
|
+
if (!styleId$1)
|
|
289908
291583
|
return false;
|
|
289909
291584
|
const translatedStyles = readTranslatedLinkedStyles(editor)?.styles;
|
|
289910
291585
|
if (!translatedStyles)
|
|
289911
291586
|
return false;
|
|
289912
|
-
return Object.values(translatedStyles).some((def) => def?.type === "paragraph" && def?.link === styleId);
|
|
291587
|
+
return Object.values(translatedStyles).some((def) => def?.type === "paragraph" && def?.link === styleId$1);
|
|
289913
291588
|
}, clearInheritedLinkedStyleId = (attrs, editor, { emptyParagraph = false } = {}) => {
|
|
289914
291589
|
if (!emptyParagraph)
|
|
289915
291590
|
return attrs;
|
|
289916
291591
|
if (!attrs || typeof attrs !== "object")
|
|
289917
291592
|
return attrs;
|
|
289918
291593
|
const paragraphProperties = attrs.paragraphProperties;
|
|
289919
|
-
const styleId = paragraphProperties?.styleId;
|
|
289920
|
-
if (!isLinkedParagraphStyleId(editor, styleId))
|
|
291594
|
+
const styleId$1 = paragraphProperties?.styleId;
|
|
291595
|
+
if (!isLinkedParagraphStyleId(editor, styleId$1))
|
|
289921
291596
|
return attrs;
|
|
289922
291597
|
return {
|
|
289923
291598
|
...attrs,
|
|
@@ -291343,12 +293018,12 @@ var Node$13 = class Node$14 {
|
|
|
291343
293018
|
return tr;
|
|
291344
293019
|
}
|
|
291345
293020
|
});
|
|
291346
|
-
}, Run, isHeadingStyleId = (styleId) => typeof styleId === "string" && /^heading\s*[1-6]$/i.test(styleId.trim()), clearHeadingStyleId = (attrs) => {
|
|
293021
|
+
}, Run, isHeadingStyleId = (styleId$1) => typeof styleId$1 === "string" && /^heading\s*[1-6]$/i.test(styleId$1.trim()), clearHeadingStyleId = (attrs) => {
|
|
291347
293022
|
if (!attrs || typeof attrs !== "object")
|
|
291348
293023
|
return attrs;
|
|
291349
293024
|
const paragraphProperties = attrs.paragraphProperties;
|
|
291350
|
-
const styleId = paragraphProperties?.styleId;
|
|
291351
|
-
if (!isHeadingStyleId(styleId))
|
|
293025
|
+
const styleId$1 = paragraphProperties?.styleId;
|
|
293026
|
+
if (!isHeadingStyleId(styleId$1))
|
|
291352
293027
|
return attrs;
|
|
291353
293028
|
const nextParagraphProperties = { ...paragraphProperties };
|
|
291354
293029
|
delete nextParagraphProperties.styleId;
|
|
@@ -296606,7 +298281,7 @@ var Node$13 = class Node$14 {
|
|
|
296606
298281
|
return marks;
|
|
296607
298282
|
}, SUPPORTED_KINDS, EMPTY_STRUCTURAL_GAP_REFINEMENT_MAX_DISTANCE = 4, compileTrackedEdit = ({ state, tr, intent, replacements = "paired" }) => {
|
|
296608
298283
|
if (!intent || !SUPPORTED_KINDS.has(intent.kind))
|
|
296609
|
-
return failure$
|
|
298284
|
+
return failure$4("CAPABILITY_UNAVAILABLE", `Unsupported tracked edit kind ${intent?.kind ?? "unknown"}.`);
|
|
296610
298285
|
const ctx$1 = makeContext({
|
|
296611
298286
|
state,
|
|
296612
298287
|
tr,
|
|
@@ -296614,7 +298289,7 @@ var Node$13 = class Node$14 {
|
|
|
296614
298289
|
replacements
|
|
296615
298290
|
});
|
|
296616
298291
|
if (graphHasErrors(ctx$1.graph))
|
|
296617
|
-
return failure$
|
|
298292
|
+
return failure$4("PRECONDITION_FAILED", "Tracked review graph has invariant errors before edit.", { diagnostics: ctx$1.graph.validate() });
|
|
296618
298293
|
try {
|
|
296619
298294
|
switch (intent.kind) {
|
|
296620
298295
|
case "text-insert":
|
|
@@ -296627,10 +298302,10 @@ var Node$13 = class Node$14 {
|
|
|
296627
298302
|
case "format-remove":
|
|
296628
298303
|
return compileFormat(ctx$1, intent);
|
|
296629
298304
|
default:
|
|
296630
|
-
return failure$
|
|
298305
|
+
return failure$4("CAPABILITY_UNAVAILABLE", "Unsupported tracked edit kind.");
|
|
296631
298306
|
}
|
|
296632
298307
|
} catch (error3) {
|
|
296633
|
-
return failure$
|
|
298308
|
+
return failure$4("PRECONDITION_FAILED", error3.message ?? "compile failed.", { error: error3 });
|
|
296634
298309
|
}
|
|
296635
298310
|
}, makeContext = ({ state, tr, intent, replacements }) => {
|
|
296636
298311
|
return {
|
|
@@ -296650,7 +298325,7 @@ var Node$13 = class Node$14 {
|
|
|
296650
298325
|
remappedChangeIds: [],
|
|
296651
298326
|
diagnostics: []
|
|
296652
298327
|
};
|
|
296653
|
-
}, failure$
|
|
298328
|
+
}, failure$4 = (code7, message, details) => ({
|
|
296654
298329
|
ok: false,
|
|
296655
298330
|
code: code7,
|
|
296656
298331
|
message,
|
|
@@ -296834,10 +298509,10 @@ var Node$13 = class Node$14 {
|
|
|
296834
298509
|
const { at, content: content3 } = intent;
|
|
296835
298510
|
const docSize = ctx$1.tr.doc.content.size;
|
|
296836
298511
|
if (at < 0 || at > docSize)
|
|
296837
|
-
return failure$
|
|
298512
|
+
return failure$4("INVALID_TARGET", `text-insert position ${at} out of range [0, ${docSize}].`);
|
|
296838
298513
|
const sanitizedSlice = stripTrackedMarksFromSlice(content3 ?? Slice.empty, ctx$1.schema);
|
|
296839
298514
|
if (!sanitizedSlice.content.size)
|
|
296840
|
-
return failure$
|
|
298515
|
+
return failure$4("INVALID_TARGET", "text-insert requires non-empty content.");
|
|
296841
298516
|
const containing = findContainingSegment(ctx$1, at);
|
|
296842
298517
|
const overlapParent = containing && containing.from < at && containing.to > at ? containing : null;
|
|
296843
298518
|
const boundaryAdjacent = !overlapParent && containing && (containing.to === at || containing.from === at) ? containing : null;
|
|
@@ -296868,11 +298543,11 @@ var Node$13 = class Node$14 {
|
|
|
296868
298543
|
try {
|
|
296869
298544
|
ctx$1.tr.replaceRange(at, at, slice2);
|
|
296870
298545
|
} catch (error3) {
|
|
296871
|
-
return failure$
|
|
298546
|
+
return failure$4("INVALID_TARGET", error3.message ?? "replaceRange failed.");
|
|
296872
298547
|
}
|
|
296873
298548
|
const afterSize = ctx$1.tr.doc.content.size;
|
|
296874
298549
|
if (afterSize === beforeSize)
|
|
296875
|
-
return failure$
|
|
298550
|
+
return failure$4("INVALID_TARGET", "text-insert did not change the document.");
|
|
296876
298551
|
const insertedFrom = at;
|
|
296877
298552
|
const insertedTo = at + (afterSize - beforeSize);
|
|
296878
298553
|
ctx$1.tr.addMark(insertedFrom, insertedTo, insertMark);
|
|
@@ -296905,9 +298580,9 @@ var Node$13 = class Node$14 {
|
|
|
296905
298580
|
}, compileTextDelete = (ctx$1, intent) => {
|
|
296906
298581
|
const docSize = ctx$1.tr.doc.content.size;
|
|
296907
298582
|
if (intent.from < 0 || intent.to > docSize)
|
|
296908
|
-
return failure$
|
|
298583
|
+
return failure$4("INVALID_TARGET", `text-delete range [${intent.from}, ${intent.to}] out of bounds.`);
|
|
296909
298584
|
if (intent.from === intent.to)
|
|
296910
|
-
return failure$
|
|
298585
|
+
return failure$4("INVALID_TARGET", "text-delete requires a non-empty range.");
|
|
296911
298586
|
const coalesceTarget = intent.replacementGroupHint || intent.preserveExistingReviewState ? null : findAdjacentDeletedSegment(ctx$1, intent.from, intent.to);
|
|
296912
298587
|
const sharedDeletionId = intent.replacementGroupHint || coalesceTarget?.changeId || null;
|
|
296913
298588
|
const result = applyTrackedDelete(ctx$1, intent.from, intent.to, {
|
|
@@ -297018,7 +298693,7 @@ var Node$13 = class Node$14 {
|
|
|
297018
298693
|
});
|
|
297019
298694
|
});
|
|
297020
298695
|
if (!ops.length)
|
|
297021
|
-
return failure$
|
|
298696
|
+
return failure$4("CAPABILITY_UNAVAILABLE", `text-delete range [${from$1}, ${to}] has no inline text content to track.`);
|
|
297022
298697
|
const sortedOps = [...ops].sort((a2, b$1) => b$1.from - a2.from);
|
|
297023
298698
|
const deletionId = sharedDeletionId ?? v4_default();
|
|
297024
298699
|
let mintedThisCall = false;
|
|
@@ -297028,7 +298703,7 @@ var Node$13 = class Node$14 {
|
|
|
297028
298703
|
try {
|
|
297029
298704
|
ctx$1.tr.replaceRange(op.from, op.to, Slice.empty);
|
|
297030
298705
|
} catch {
|
|
297031
|
-
return failure$
|
|
298706
|
+
return failure$4("INVALID_TARGET", `Cannot collapse own-insertion range [${op.from}, ${op.to}].`);
|
|
297032
298707
|
}
|
|
297033
298708
|
if (op.changeId)
|
|
297034
298709
|
collapsedIds.add(op.changeId);
|
|
@@ -297056,7 +298731,7 @@ var Node$13 = class Node$14 {
|
|
|
297056
298731
|
mintedThisCall = true;
|
|
297057
298732
|
}
|
|
297058
298733
|
} catch (error3) {
|
|
297059
|
-
return failure$
|
|
298734
|
+
return failure$4("INVALID_TARGET", error3.message ?? "addMark failed.");
|
|
297060
298735
|
}
|
|
297061
298736
|
continue;
|
|
297062
298737
|
}
|
|
@@ -297078,7 +298753,7 @@ var Node$13 = class Node$14 {
|
|
|
297078
298753
|
mintedThisCall = true;
|
|
297079
298754
|
}
|
|
297080
298755
|
} catch (error3) {
|
|
297081
|
-
return failure$
|
|
298756
|
+
return failure$4("INVALID_TARGET", error3.message ?? "addMark failed.");
|
|
297082
298757
|
}
|
|
297083
298758
|
}
|
|
297084
298759
|
}
|
|
@@ -297103,12 +298778,12 @@ var Node$13 = class Node$14 {
|
|
|
297103
298778
|
}, compileTextReplace = (ctx$1, intent) => {
|
|
297104
298779
|
const docSize = ctx$1.tr.doc.content.size;
|
|
297105
298780
|
if (intent.from < 0 || intent.to > docSize)
|
|
297106
|
-
return failure$
|
|
298781
|
+
return failure$4("INVALID_TARGET", `text-replace range [${intent.from}, ${intent.to}] out of bounds.`);
|
|
297107
298782
|
if (intent.from > intent.to)
|
|
297108
|
-
return failure$
|
|
298783
|
+
return failure$4("INVALID_TARGET", "text-replace `from` must be <= `to`.");
|
|
297109
298784
|
const sanitizedSlice = stripTrackedMarksFromSlice(intent.content ?? Slice.empty, ctx$1.schema);
|
|
297110
298785
|
if (!sanitizedSlice.content.size && intent.from === intent.to)
|
|
297111
|
-
return failure$
|
|
298786
|
+
return failure$4("INVALID_TARGET", "text-replace requires a non-empty replacement or non-empty range.");
|
|
297112
298787
|
const segments = segmentsInRange(ctx$1, intent.from, intent.to);
|
|
297113
298788
|
const ownInsertedTarget = getSingleFullyCoveringOwnInsertedSegment(ctx$1, segments, intent.from, intent.to);
|
|
297114
298789
|
if (ownInsertedTarget && !intent.preserveExistingReviewState) {
|
|
@@ -297193,7 +298868,7 @@ var Node$13 = class Node$14 {
|
|
|
297193
298868
|
const openSlice = Slice.maxOpen(sanitizedSlice.content, true);
|
|
297194
298869
|
insertion = tryTempInsert(sanitizedSlice) || tryTempInsert(openSlice);
|
|
297195
298870
|
if (!insertion)
|
|
297196
|
-
return failure$
|
|
298871
|
+
return failure$4("CAPABILITY_UNAVAILABLE", "replacement slice could not be inserted into the document.");
|
|
297197
298872
|
}
|
|
297198
298873
|
let insertedMark = null;
|
|
297199
298874
|
let trackedInsertedSlice = Slice.empty;
|
|
@@ -297210,7 +298885,7 @@ var Node$13 = class Node$14 {
|
|
|
297210
298885
|
id: forcedInsertId
|
|
297211
298886
|
});
|
|
297212
298887
|
if (!insertedMark)
|
|
297213
|
-
return failure$
|
|
298888
|
+
return failure$4("PRECONDITION_FAILED", "Failed to create tracked insertion mark for replacement.");
|
|
297214
298889
|
if (replacementParentId || replacementGroupId) {
|
|
297215
298890
|
const overlayMark = makeInsertMark(ctx$1, {
|
|
297216
298891
|
id: insertedMark.attrs.id,
|
|
@@ -297239,7 +298914,7 @@ var Node$13 = class Node$14 {
|
|
|
297239
298914
|
const stepIndexBeforeCondensed = ctx$1.tr.steps.length;
|
|
297240
298915
|
condensedStep = new ReplaceStep(positionTo, positionTo, trackedInsertedSlice, false);
|
|
297241
298916
|
if (ctx$1.tr.maybeStep(condensedStep).failed)
|
|
297242
|
-
return failure$
|
|
298917
|
+
return failure$4("INVALID_TARGET", "condensed insertion step failed to apply.");
|
|
297243
298918
|
const condensedMap = ctx$1.tr.steps[stepIndexBeforeCondensed].getMap();
|
|
297244
298919
|
insertedFromAbs = condensedMap.map(positionTo, -1);
|
|
297245
298920
|
insertedToAbs = condensedMap.map(positionTo, 1);
|
|
@@ -297316,14 +298991,14 @@ var Node$13 = class Node$14 {
|
|
|
297316
298991
|
return "";
|
|
297317
298992
|
}, compileFormat = (ctx$1, intent) => {
|
|
297318
298993
|
if (!TrackedFormatMarkNames.includes(intent.mark.type.name))
|
|
297319
|
-
return failure$
|
|
298994
|
+
return failure$4("CAPABILITY_UNAVAILABLE", `Mark ${intent.mark.type.name} is not a tracked formatting mark.`);
|
|
297320
298995
|
const subranges = computeFormatLeafRanges(ctx$1, intent.from, intent.to);
|
|
297321
298996
|
if (!subranges)
|
|
297322
|
-
return failure$
|
|
298997
|
+
return failure$4("CAPABILITY_UNAVAILABLE", "format range crosses tracked-deleted content.");
|
|
297323
298998
|
const trackFormatType = ctx$1.schema.marks[TrackFormatMarkName];
|
|
297324
298999
|
const needsTrackFormat = subranges.some((range) => !range.fold);
|
|
297325
299000
|
if (!trackFormatType && needsTrackFormat)
|
|
297326
|
-
return failure$
|
|
299001
|
+
return failure$4("CAPABILITY_UNAVAILABLE", "schema is missing trackFormat mark.");
|
|
297327
299002
|
const formatMarks = [];
|
|
297328
299003
|
let sharedWid = null;
|
|
297329
299004
|
for (const range of subranges) {
|
|
@@ -298522,14 +300197,14 @@ var Node$13 = class Node$14 {
|
|
|
298522
300197
|
});
|
|
298523
300198
|
}
|
|
298524
300199
|
return plan;
|
|
298525
|
-
}, failure$
|
|
300200
|
+
}, failure$3 = (code7, message, extra) => ({
|
|
298526
300201
|
ok: false,
|
|
298527
300202
|
code: code7,
|
|
298528
300203
|
message,
|
|
298529
300204
|
...extra || {}
|
|
298530
300205
|
}), decideTrackedChanges = ({ state, editor, decision, target, replacements = "paired" }) => {
|
|
298531
300206
|
if (decision !== "accept" && decision !== "reject")
|
|
298532
|
-
return failure$
|
|
300207
|
+
return failure$3("INVALID_TARGET", `decision must be "accept" or "reject" (got "${String(decision)}").`);
|
|
298533
300208
|
const normalized = normalizeDecisionTarget(target);
|
|
298534
300209
|
if (!normalized.ok)
|
|
298535
300210
|
return normalized.failure;
|
|
@@ -298538,7 +300213,7 @@ var Node$13 = class Node$14 {
|
|
|
298538
300213
|
replacementsMode: replacements
|
|
298539
300214
|
});
|
|
298540
300215
|
if (graphHasErrors(graph))
|
|
298541
|
-
return failure$
|
|
300216
|
+
return failure$3("PRECONDITION_FAILED", "tracked review graph has invariant errors before decision.", { diagnostics: graph.validate() });
|
|
298542
300217
|
const selectionResult = resolveTargetToSelections({
|
|
298543
300218
|
graph,
|
|
298544
300219
|
normalized: normalized.value
|
|
@@ -298547,7 +300222,7 @@ var Node$13 = class Node$14 {
|
|
|
298547
300222
|
return selectionResult.failure;
|
|
298548
300223
|
const { selections } = selectionResult;
|
|
298549
300224
|
if (!selections.length)
|
|
298550
|
-
return failure$
|
|
300225
|
+
return failure$3("TARGET_NOT_FOUND", "no tracked changes match the requested decision target.");
|
|
298551
300226
|
const permissionResult = runPermissionPreflight({
|
|
298552
300227
|
editor,
|
|
298553
300228
|
decision,
|
|
@@ -298582,14 +300257,14 @@ var Node$13 = class Node$14 {
|
|
|
298582
300257
|
if (!target || typeof target !== "object")
|
|
298583
300258
|
return {
|
|
298584
300259
|
ok: false,
|
|
298585
|
-
failure: failure$
|
|
300260
|
+
failure: failure$3("INVALID_TARGET", "decision target must be an object.")
|
|
298586
300261
|
};
|
|
298587
300262
|
const t = target;
|
|
298588
300263
|
if (t.kind === "id") {
|
|
298589
300264
|
if (typeof t.id !== "string" || !t.id)
|
|
298590
300265
|
return {
|
|
298591
300266
|
ok: false,
|
|
298592
|
-
failure: failure$
|
|
300267
|
+
failure: failure$3("INVALID_TARGET", 'target.kind = "id" requires a non-empty id.')
|
|
298593
300268
|
};
|
|
298594
300269
|
return {
|
|
298595
300270
|
ok: true,
|
|
@@ -298605,7 +300280,7 @@ var Node$13 = class Node$14 {
|
|
|
298605
300280
|
if (!Number.isFinite(from$1) || !Number.isFinite(to) || from$1 < 0 || to < 0 || from$1 > to)
|
|
298606
300281
|
return {
|
|
298607
300282
|
ok: false,
|
|
298608
|
-
failure: failure$
|
|
300283
|
+
failure: failure$3("INVALID_TARGET", 'target.kind = "range" requires from <= to.')
|
|
298609
300284
|
};
|
|
298610
300285
|
return {
|
|
298611
300286
|
ok: true,
|
|
@@ -298640,7 +300315,7 @@ var Node$13 = class Node$14 {
|
|
|
298640
300315
|
if (from$1 > to)
|
|
298641
300316
|
return {
|
|
298642
300317
|
ok: false,
|
|
298643
|
-
failure: failure$
|
|
300318
|
+
failure: failure$3("INVALID_TARGET", "range target requires from <= to.")
|
|
298644
300319
|
};
|
|
298645
300320
|
return {
|
|
298646
300321
|
ok: true,
|
|
@@ -298653,7 +300328,7 @@ var Node$13 = class Node$14 {
|
|
|
298653
300328
|
}
|
|
298654
300329
|
return {
|
|
298655
300330
|
ok: false,
|
|
298656
|
-
failure: failure$
|
|
300331
|
+
failure: failure$3("INVALID_TARGET", "decision target shape was not recognised.")
|
|
298657
300332
|
};
|
|
298658
300333
|
}, resolveTargetToSelections = ({ graph, normalized }) => {
|
|
298659
300334
|
if (normalized.kind === "all") {
|
|
@@ -298678,7 +300353,7 @@ var Node$13 = class Node$14 {
|
|
|
298678
300353
|
if (!change)
|
|
298679
300354
|
return {
|
|
298680
300355
|
ok: false,
|
|
298681
|
-
failure: failure$
|
|
300356
|
+
failure: failure$3("TARGET_NOT_FOUND", `no tracked change with id "${normalized.id}".`)
|
|
298682
300357
|
};
|
|
298683
300358
|
return {
|
|
298684
300359
|
ok: true,
|
|
@@ -298812,7 +300487,7 @@ var Node$13 = class Node$14 {
|
|
|
298812
300487
|
}) === false)
|
|
298813
300488
|
return {
|
|
298814
300489
|
ok: false,
|
|
298815
|
-
failure: failure$
|
|
300490
|
+
failure: failure$3("PERMISSION_DENIED", `permission denied for ${decision} of change "${change.id}".`, { details: {
|
|
298816
300491
|
changeId: change.id,
|
|
298817
300492
|
permission
|
|
298818
300493
|
} })
|
|
@@ -298833,12 +300508,12 @@ var Node$13 = class Node$14 {
|
|
|
298833
300508
|
if (change.type === CanonicalChangeType.Replacement)
|
|
298834
300509
|
return {
|
|
298835
300510
|
ok: false,
|
|
298836
|
-
failure: failure$
|
|
300511
|
+
failure: failure$3("CAPABILITY_UNAVAILABLE", "partial-range replacement decisions are not yet fixture-backed.", { details: { changeId: change.id } })
|
|
298837
300512
|
};
|
|
298838
300513
|
if (change.type === CanonicalChangeType.Formatting)
|
|
298839
300514
|
return {
|
|
298840
300515
|
ok: false,
|
|
298841
|
-
failure: failure$
|
|
300516
|
+
failure: failure$3("CAPABILITY_UNAVAILABLE", "partial-range formatting decisions are not yet fixture-backed.", { details: { changeId: change.id } })
|
|
298842
300517
|
};
|
|
298843
300518
|
}
|
|
298844
300519
|
touched.add(change.id);
|
|
@@ -298907,13 +300582,13 @@ var Node$13 = class Node$14 {
|
|
|
298907
300582
|
else
|
|
298908
300583
|
return {
|
|
298909
300584
|
ok: false,
|
|
298910
|
-
failure: failure$
|
|
300585
|
+
failure: failure$3("CAPABILITY_UNAVAILABLE", `unsupported change type "${change.type}" for change "${change.id}".`)
|
|
298911
300586
|
};
|
|
298912
300587
|
}
|
|
298913
300588
|
if (!ops.length)
|
|
298914
300589
|
return {
|
|
298915
300590
|
ok: false,
|
|
298916
|
-
failure: failure$
|
|
300591
|
+
failure: failure$3("NO_OP", "decision target produced no operations.", { details: { selections: selections.map((s2) => s2.change.id) } })
|
|
298917
300592
|
};
|
|
298918
300593
|
const affectedChildren = [];
|
|
298919
300594
|
for (const change of graph.changes.values()) {
|
|
@@ -299037,7 +300712,7 @@ var Node$13 = class Node$14 {
|
|
|
299037
300712
|
if (!inserted.length || !deleted.length)
|
|
299038
300713
|
return {
|
|
299039
300714
|
ok: false,
|
|
299040
|
-
failure: failure$
|
|
300715
|
+
failure: failure$3("PRECONDITION_FAILED", `replacement "${change.id}" missing inserted or deleted side.`)
|
|
299041
300716
|
};
|
|
299042
300717
|
if (decision === "accept") {
|
|
299043
300718
|
for (const seg of deleted) {
|
|
@@ -299232,7 +300907,7 @@ var Node$13 = class Node$14 {
|
|
|
299232
300907
|
if (!segments.length)
|
|
299233
300908
|
return {
|
|
299234
300909
|
ok: false,
|
|
299235
|
-
failure: failure$
|
|
300910
|
+
failure: failure$3("PRECONDITION_FAILED", `change "${change.id}" has no ${side} segments.`)
|
|
299236
300911
|
};
|
|
299237
300912
|
const selectedRanges = mergeRanges2(selection.ranges);
|
|
299238
300913
|
const successorRanges = [];
|
|
@@ -299482,7 +301157,7 @@ var Node$13 = class Node$14 {
|
|
|
299482
301157
|
} catch (error3) {
|
|
299483
301158
|
return {
|
|
299484
301159
|
ok: false,
|
|
299485
|
-
failure: failure$
|
|
301160
|
+
failure: failure$3("PRECONDITION_FAILED", error3.message ?? "failed to apply mutation plan.", { details: { error: String(error3) } })
|
|
299486
301161
|
};
|
|
299487
301162
|
}
|
|
299488
301163
|
tr.setMeta(TrackChangesBasePluginKey, {
|
|
@@ -302608,8 +304283,8 @@ var Node$13 = class Node$14 {
|
|
|
302608
304283
|
})]);
|
|
302609
304284
|
}
|
|
302610
304285
|
}],
|
|
302611
|
-
onActivate: ({ styleId }) => {
|
|
302612
|
-
const selectedStyle = getQuickFormatList(superToolbar.activeEditor)?.find((style2) => style2.id === styleId);
|
|
304286
|
+
onActivate: ({ styleId: styleId$1 }) => {
|
|
304287
|
+
const selectedStyle = getQuickFormatList(superToolbar.activeEditor)?.find((style2) => style2.id === styleId$1);
|
|
302613
304288
|
linkedStyles.label.value = selectedStyle && selectedStyle.id !== "Normal" ? selectedStyle.definition.attrs.name : toolbarTexts$1.formatText;
|
|
302614
304289
|
linkedStyles.disabled.value = false;
|
|
302615
304290
|
},
|
|
@@ -304220,7 +305895,7 @@ var Node$13 = class Node$14 {
|
|
|
304220
305895
|
listener(snapshot2);
|
|
304221
305896
|
} catch {}
|
|
304222
305897
|
}
|
|
304223
|
-
}, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
305898
|
+
}, projectedTrackedChangeCache, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, import_jszip_min2, LAYOUT_AFFECTING_SETTING_NAMES, HEADER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", IMAGE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", HEADER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", FOOTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", CONTENT_TYPES_PART$1 = "[Content_Types].xml", DOCUMENT_RELS_PART$1 = "word/_rels/document.xml.rels", SUBSTRATE_SCOPE_ORDER, CONTENT_TYPE_BY_SCOPE, REL_TYPE_BY_PART, CONTENT_TYPES_PART = "[Content_Types].xml", DOCUMENT_RELS_PART = "word/_rels/document.xml.rels", SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, COMMENT_MARK_NAME2 = "commentMark", TRACK_CHANGE_MARK_NAMES, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", PRESET_GREY = "999999", PRESET_BLACK = "000000", STATIC_PRESETS, IDENTITY_BLOCK_ATTRS, WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, BatchHistoryAdapter = class {
|
|
304224
305899
|
#done = [];
|
|
304225
305900
|
#redone = [];
|
|
304226
305901
|
#listeners = /* @__PURE__ */ new Set;
|
|
@@ -311384,7 +313059,7 @@ menclose::after {
|
|
|
311384
313059
|
const borderStyle = underlineStyle === "double" || underlineStyle === "dotted" || underlineStyle === "dashed" ? underlineStyle : "solid";
|
|
311385
313060
|
const underlineColor = getRunUnderline(run2)?.color ?? getRunColor(run2) ?? "#000000";
|
|
311386
313061
|
return `${underlineThicknessPx(getRunFontSize(run2))}px ${borderStyle} ${underlineColor}`;
|
|
311387
|
-
}, renderInlineTabRun = (run2, line, doc$12, layoutEpoch, styleId, paintUnderline = true) => {
|
|
313062
|
+
}, renderInlineTabRun = (run2, line, doc$12, layoutEpoch, styleId$1, paintUnderline = true) => {
|
|
311388
313063
|
const tabEl = doc$12.createElement("span");
|
|
311389
313064
|
tabEl.classList.add("superdoc-tab");
|
|
311390
313065
|
const tabWidth = run2.width ?? 48;
|
|
@@ -311400,15 +313075,15 @@ menclose::after {
|
|
|
311400
313075
|
}
|
|
311401
313076
|
if (shouldPaintUnderline)
|
|
311402
313077
|
applyTabUnderlineBorder(tabEl, run2);
|
|
311403
|
-
if (styleId)
|
|
311404
|
-
tabEl.setAttribute("styleid", styleId);
|
|
313078
|
+
if (styleId$1)
|
|
313079
|
+
tabEl.setAttribute("styleid", styleId$1);
|
|
311405
313080
|
if (run2.pmStart != null)
|
|
311406
313081
|
tabEl.dataset.pmStart = String(run2.pmStart);
|
|
311407
313082
|
if (run2.pmEnd != null)
|
|
311408
313083
|
tabEl.dataset.pmEnd = String(run2.pmEnd);
|
|
311409
313084
|
tabEl.dataset.layoutEpoch = String(layoutEpoch);
|
|
311410
313085
|
return tabEl;
|
|
311411
|
-
}, renderPositionedTabRun = (run2, line, doc$12, layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId, paintUnderline = true) => {
|
|
313086
|
+
}, renderPositionedTabRun = (run2, line, doc$12, layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId$1, paintUnderline = true) => {
|
|
311412
313087
|
const measuredTabEndX = tabStartX + (run2.width ?? 0);
|
|
311413
313088
|
const tabEndX = immediateNextSegment?.precedingTabEndX ?? immediateNextSegment?.x ?? measuredTabEndX;
|
|
311414
313089
|
const actualTabWidth = tabEndX - tabStartX;
|
|
@@ -311426,8 +313101,8 @@ menclose::after {
|
|
|
311426
313101
|
applyTabUnderlineBorder(tabEl, run2);
|
|
311427
313102
|
else
|
|
311428
313103
|
tabEl.style.visibility = "hidden";
|
|
311429
|
-
if (styleId)
|
|
311430
|
-
tabEl.setAttribute("styleid", styleId);
|
|
313104
|
+
if (styleId$1)
|
|
313105
|
+
tabEl.setAttribute("styleid", styleId$1);
|
|
311431
313106
|
if (run2.pmStart != null)
|
|
311432
313107
|
tabEl.dataset.pmStart = String(run2.pmStart);
|
|
311433
313108
|
if (run2.pmEnd != null)
|
|
@@ -311627,9 +313302,9 @@ menclose::after {
|
|
|
311627
313302
|
el.classList.add(CLASS_NAMES$1.line);
|
|
311628
313303
|
applyStyles$1(el, lineStyles(line.lineHeight));
|
|
311629
313304
|
el.dataset.layoutEpoch = String(runContext.layoutEpoch);
|
|
311630
|
-
const styleId = (block.attrs ?? {}).styleId;
|
|
311631
|
-
if (styleId)
|
|
311632
|
-
el.setAttribute("styleid", styleId);
|
|
313305
|
+
const styleId$1 = (block.attrs ?? {}).styleId;
|
|
313306
|
+
if (styleId$1)
|
|
313307
|
+
el.setAttribute("styleid", styleId$1);
|
|
311633
313308
|
const pAttrs = block.attrs;
|
|
311634
313309
|
const isRtl = applyRtlStyles(el, pAttrs);
|
|
311635
313310
|
if (lineRange.pmStart != null)
|
|
@@ -311743,7 +313418,7 @@ menclose::after {
|
|
|
311743
313418
|
el,
|
|
311744
313419
|
lineTextStartOffsetPx,
|
|
311745
313420
|
spacingPerSpace,
|
|
311746
|
-
styleId,
|
|
313421
|
+
styleId: styleId$1,
|
|
311747
313422
|
runContext,
|
|
311748
313423
|
trackedConfig,
|
|
311749
313424
|
lineContainsInlineImage,
|
|
@@ -311756,7 +313431,7 @@ menclose::after {
|
|
|
311756
313431
|
line,
|
|
311757
313432
|
context,
|
|
311758
313433
|
el,
|
|
311759
|
-
styleId,
|
|
313434
|
+
styleId: styleId$1,
|
|
311760
313435
|
runContext,
|
|
311761
313436
|
trackedConfig,
|
|
311762
313437
|
lineContainsInlineImage,
|
|
@@ -311776,7 +313451,7 @@ menclose::after {
|
|
|
311776
313451
|
}
|
|
311777
313452
|
});
|
|
311778
313453
|
return el;
|
|
311779
|
-
}, renderExplicitlyPositionedRuns = ({ block, line, context, el, lineTextStartOffsetPx, spacingPerSpace, styleId, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay, underlineSpanCollector }) => {
|
|
313454
|
+
}, renderExplicitlyPositionedRuns = ({ block, line, context, el, lineTextStartOffsetPx, spacingPerSpace, styleId: styleId$1, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay, underlineSpanCollector }) => {
|
|
311780
313455
|
const indentOffset = lineTextStartOffsetPx;
|
|
311781
313456
|
let cumulativeX = 0;
|
|
311782
313457
|
const segments = line.segments;
|
|
@@ -311846,7 +313521,7 @@ menclose::after {
|
|
|
311846
313521
|
const immediateNextSegment = findImmediateNextSegment(runIndex);
|
|
311847
313522
|
const tabStartX = cumulativeX;
|
|
311848
313523
|
const coveredByOverlay$1 = useLineUnderlineOverlay && canPaintUnderlineOverlay(baseRun);
|
|
311849
|
-
const { element: tabEl, tabEndX, actualTabWidth } = renderPositionedTabRun(baseRun, line, runContext.doc, runContext.layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId, !coveredByOverlay$1);
|
|
313524
|
+
const { element: tabEl, tabEndX, actualTabWidth } = renderPositionedTabRun(baseRun, line, runContext.doc, runContext.layoutEpoch, tabStartX, indentOffset, immediateNextSegment, styleId$1, !coveredByOverlay$1);
|
|
311850
313525
|
appendToLineGeo(tabEl, baseRun, tabStartX + indentOffset, actualTabWidth);
|
|
311851
313526
|
if (coveredByOverlay$1 && underlineSpanCollector)
|
|
311852
313527
|
appendUnderlineOverlaySpan(underlineSpanCollector, tabStartX + indentOffset, tabStartX + indentOffset + actualTabWidth, underlineBorderForRun(baseRun));
|
|
@@ -311856,8 +313531,8 @@ menclose::after {
|
|
|
311856
313531
|
if (isImageRun$1(baseRun)) {
|
|
311857
313532
|
const elem = renderRun(baseRun, context, runContext, trackedConfig);
|
|
311858
313533
|
if (elem) {
|
|
311859
|
-
if (styleId)
|
|
311860
|
-
elem.setAttribute("styleid", styleId);
|
|
313534
|
+
if (styleId$1)
|
|
313535
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311861
313536
|
const runSegments$1 = segmentsByRun.get(runIndex);
|
|
311862
313537
|
const baseSegX = runSegments$1 && runSegments$1[0]?.x !== undefined ? runSegments$1[0].x : cumulativeX;
|
|
311863
313538
|
const segX = baseSegX + indentOffset;
|
|
@@ -311876,8 +313551,8 @@ menclose::after {
|
|
|
311876
313551
|
if (isFieldAnnotationRun$1(baseRun)) {
|
|
311877
313552
|
const elem = renderRun(baseRun, context, runContext, trackedConfig);
|
|
311878
313553
|
if (elem) {
|
|
311879
|
-
if (styleId)
|
|
311880
|
-
elem.setAttribute("styleid", styleId);
|
|
313554
|
+
if (styleId$1)
|
|
313555
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311881
313556
|
const runSegments$1 = segmentsByRun.get(runIndex);
|
|
311882
313557
|
const baseSegX = runSegments$1 && runSegments$1[0]?.x !== undefined ? runSegments$1[0].x : cumulativeX;
|
|
311883
313558
|
const segX = baseSegX + indentOffset;
|
|
@@ -311892,8 +313567,8 @@ menclose::after {
|
|
|
311892
313567
|
if (isMathRun(baseRun)) {
|
|
311893
313568
|
const elem = renderRun(baseRun, context, runContext, trackedConfig);
|
|
311894
313569
|
if (elem) {
|
|
311895
|
-
if (styleId)
|
|
311896
|
-
elem.setAttribute("styleid", styleId);
|
|
313570
|
+
if (styleId$1)
|
|
313571
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311897
313572
|
const runSegments$1 = segmentsByRun.get(runIndex);
|
|
311898
313573
|
const baseSegX = runSegments$1 && runSegments$1[0]?.x !== undefined ? runSegments$1[0].x : cumulativeX;
|
|
311899
313574
|
const segX = baseSegX + indentOffset;
|
|
@@ -311911,8 +313586,8 @@ menclose::after {
|
|
|
311911
313586
|
if (isEmptySdtPlaceholderRun(baseRun)) {
|
|
311912
313587
|
const elem = renderRun(baseRun, context, runContext, trackedConfig);
|
|
311913
313588
|
if (elem) {
|
|
311914
|
-
if (styleId)
|
|
311915
|
-
elem.setAttribute("styleid", styleId);
|
|
313589
|
+
if (styleId$1)
|
|
313590
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311916
313591
|
const segment = runSegments[0];
|
|
311917
313592
|
const baseX = segment.x !== undefined ? segment.x : cumulativeX;
|
|
311918
313593
|
const xPos = baseX + indentOffset;
|
|
@@ -311946,8 +313621,8 @@ menclose::after {
|
|
|
311946
313621
|
if (elem) {
|
|
311947
313622
|
if (coveredByOverlay)
|
|
311948
313623
|
elem.style.textDecorationLine = segmentRun.strike ? "line-through" : "none";
|
|
311949
|
-
if (styleId)
|
|
311950
|
-
elem.setAttribute("styleid", styleId);
|
|
313624
|
+
if (styleId$1)
|
|
313625
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311951
313626
|
alignNormalTextBesideInlineImage(elem, segmentRun, lineContainsInlineImage);
|
|
311952
313627
|
const baseX = segment.x !== undefined ? segment.x : cumulativeX;
|
|
311953
313628
|
const xPos = baseX + indentOffset;
|
|
@@ -311964,7 +313639,7 @@ menclose::after {
|
|
|
311964
313639
|
});
|
|
311965
313640
|
}
|
|
311966
313641
|
closeGeoSdtWrapper();
|
|
311967
|
-
}, renderInlineRuns = ({ runsForLine, line, context, el, styleId, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay }) => {
|
|
313642
|
+
}, renderInlineRuns = ({ runsForLine, line, context, el, styleId: styleId$1, runContext, trackedConfig, lineContainsInlineImage, useLineUnderlineOverlay }) => {
|
|
311968
313643
|
let currentInlineSdtWrapper = null;
|
|
311969
313644
|
let currentInlineSdtId = null;
|
|
311970
313645
|
const closeCurrentWrapper = () => {
|
|
@@ -311981,12 +313656,12 @@ menclose::after {
|
|
|
311981
313656
|
closeCurrentWrapper();
|
|
311982
313657
|
const suppressUnderline = useLineUnderlineOverlay && canPaintUnderlineOverlay(run2);
|
|
311983
313658
|
const runForRender = suppressUnderline ? cloneRunWithoutUnderline(run2) : run2;
|
|
311984
|
-
const elem = run2.kind === "tab" ? renderInlineTabRun(runForRender, line, runContext.doc, runContext.layoutEpoch, styleId, !suppressUnderline) : renderRun(runForRender, context, runContext, trackedConfig);
|
|
313659
|
+
const elem = run2.kind === "tab" ? renderInlineTabRun(runForRender, line, runContext.doc, runContext.layoutEpoch, styleId$1, !suppressUnderline) : renderRun(runForRender, context, runContext, trackedConfig);
|
|
311985
313660
|
if (elem) {
|
|
311986
313661
|
if (suppressUnderline && run2.kind !== "tab")
|
|
311987
313662
|
elem.style.textDecorationLine = "strike" in runForRender && runForRender.strike ? "line-through" : "none";
|
|
311988
|
-
if (styleId)
|
|
311989
|
-
elem.setAttribute("styleid", styleId);
|
|
313663
|
+
if (styleId$1)
|
|
313664
|
+
elem.setAttribute("styleid", styleId$1);
|
|
311990
313665
|
alignNormalTextBesideInlineImage(elem, runForRender, lineContainsInlineImage);
|
|
311991
313666
|
if (resolved) {
|
|
311992
313667
|
if (!currentInlineSdtWrapper) {
|
|
@@ -323766,19 +325441,19 @@ menclose::after {
|
|
|
323766
325441
|
return;
|
|
323767
325442
|
console.log(...args$1);
|
|
323768
325443
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
323769
|
-
var
|
|
325444
|
+
var init_src_CaxTbQ6c_es = __esm(() => {
|
|
323770
325445
|
init_rolldown_runtime_Bg48TavK_es();
|
|
323771
|
-
|
|
325446
|
+
init_SuperConverter_B9mZiCO9_es();
|
|
323772
325447
|
init_jszip_C49i9kUs_es();
|
|
323773
325448
|
init_xml_js_CqGKpaft_es();
|
|
323774
325449
|
init_uuid_qzgm05fK_es();
|
|
323775
|
-
|
|
325450
|
+
init_create_headless_toolbar_pn_wKqsL_es();
|
|
323776
325451
|
init_constants_D_X7xF4s_es();
|
|
323777
325452
|
init_dist_B8HfvhaK_es();
|
|
323778
325453
|
init_unified_Dsuw2be5_es();
|
|
323779
325454
|
init_remark_gfm_BhnWr3yf_es();
|
|
323780
325455
|
init_remark_stringify_6MMJfY0k_es();
|
|
323781
|
-
|
|
325456
|
+
init_DocxZipper_VodIk8WL_es();
|
|
323782
325457
|
init__plugin_vue_export_helper_5t5P5NuM_es();
|
|
323783
325458
|
init_eventemitter3_BnGqBE_Q_es();
|
|
323784
325459
|
init_errors_CNaD6vcg_es();
|
|
@@ -339047,14 +340722,14 @@ ${err.toString()}`);
|
|
|
339047
340722
|
function wrapperPlant(value) {
|
|
339048
340723
|
var result$1, parent$1 = this;
|
|
339049
340724
|
while (parent$1 instanceof baseLodash) {
|
|
339050
|
-
var clone$
|
|
339051
|
-
clone$
|
|
339052
|
-
clone$
|
|
340725
|
+
var clone$2 = wrapperClone(parent$1);
|
|
340726
|
+
clone$2.__index__ = 0;
|
|
340727
|
+
clone$2.__values__ = undefined$1;
|
|
339053
340728
|
if (result$1)
|
|
339054
|
-
previous3.__wrapped__ = clone$
|
|
340729
|
+
previous3.__wrapped__ = clone$2;
|
|
339055
340730
|
else
|
|
339056
|
-
result$1 = clone$
|
|
339057
|
-
var previous3 = clone$
|
|
340731
|
+
result$1 = clone$2;
|
|
340732
|
+
var previous3 = clone$2;
|
|
339058
340733
|
parent$1 = parent$1.__wrapped__;
|
|
339059
340734
|
}
|
|
339060
340735
|
previous3.__wrapped__ = value;
|
|
@@ -339444,7 +341119,7 @@ ${err.toString()}`);
|
|
|
339444
341119
|
var value = arguments[0];
|
|
339445
341120
|
return isArray$2(value) ? value : [value];
|
|
339446
341121
|
}
|
|
339447
|
-
function clone(value) {
|
|
341122
|
+
function clone$1(value) {
|
|
339448
341123
|
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
339449
341124
|
}
|
|
339450
341125
|
function cloneWith(value, customizer) {
|
|
@@ -340527,7 +342202,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
340527
342202
|
lodash.capitalize = capitalize$1;
|
|
340528
342203
|
lodash.ceil = ceil;
|
|
340529
342204
|
lodash.clamp = clamp$2;
|
|
340530
|
-
lodash.clone = clone;
|
|
342205
|
+
lodash.clone = clone$1;
|
|
340531
342206
|
lodash.cloneDeep = cloneDeep$1;
|
|
340532
342207
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
340533
342208
|
lodash.cloneWith = cloneWith;
|
|
@@ -347345,6 +349020,45 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347345
349020
|
underline: new Set(["color", "w:color"]),
|
|
347346
349021
|
borders: new Set(["color"])
|
|
347347
349022
|
};
|
|
349023
|
+
import_jszip_min2 = /* @__PURE__ */ __toESM2(require_jszip_min(), 1);
|
|
349024
|
+
LAYOUT_AFFECTING_SETTING_NAMES = new Set([
|
|
349025
|
+
"defaultTabStop",
|
|
349026
|
+
"autoHyphenation",
|
|
349027
|
+
"consecutiveHyphenLimit",
|
|
349028
|
+
"hyphenationZone",
|
|
349029
|
+
"doNotHyphenateCaps",
|
|
349030
|
+
"characterSpacingControl",
|
|
349031
|
+
"decimalSymbol",
|
|
349032
|
+
"listSeparator",
|
|
349033
|
+
"mirrorMargins",
|
|
349034
|
+
"gutterAtTop",
|
|
349035
|
+
"bookFoldPrinting",
|
|
349036
|
+
"bookFoldRevPrinting",
|
|
349037
|
+
"bookFoldPrintingSheets",
|
|
349038
|
+
"evenAndOddHeaders",
|
|
349039
|
+
"compat",
|
|
349040
|
+
"themeFontLang",
|
|
349041
|
+
"displayBackgroundShape",
|
|
349042
|
+
"noPunctuationKerning",
|
|
349043
|
+
"kerning"
|
|
349044
|
+
]);
|
|
349045
|
+
SUBSTRATE_SCOPE_ORDER = [
|
|
349046
|
+
"styles",
|
|
349047
|
+
"numbering",
|
|
349048
|
+
"settings",
|
|
349049
|
+
"theme",
|
|
349050
|
+
"fontTable",
|
|
349051
|
+
"webSettings"
|
|
349052
|
+
];
|
|
349053
|
+
CONTENT_TYPE_BY_SCOPE = {
|
|
349054
|
+
theme: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
349055
|
+
fontTable: "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml",
|
|
349056
|
+
webSettings: "application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"
|
|
349057
|
+
};
|
|
349058
|
+
REL_TYPE_BY_PART = {
|
|
349059
|
+
theme: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
|
349060
|
+
fontTable: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
|
|
349061
|
+
};
|
|
347348
349062
|
SUPPORTED_DELETE_NODE_TYPES3 = new Set(DELETABLE_BLOCK_NODE_TYPES2);
|
|
347349
349063
|
REJECTED_DELETE_NODE_TYPES3 = new Set(["tableRow", "tableCell"]);
|
|
347350
349064
|
RANGE_DELETE_SAFE_NODE_TYPES = new Set(["passthroughBlock", "passthroughInline"]);
|
|
@@ -347670,7 +349384,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347670
349384
|
};
|
|
347671
349385
|
},
|
|
347672
349386
|
afterCommit(ctx$1) {
|
|
347673
|
-
if (ctx$1.source.startsWith("collab:remote:")) {
|
|
349387
|
+
if (ctx$1.source.startsWith("collab:remote:") || ctx$1.source === "templates.apply") {
|
|
347674
349388
|
const converter = getConverter$72(ctx$1.editor);
|
|
347675
349389
|
if (converter)
|
|
347676
349390
|
try {
|
|
@@ -348325,14 +350039,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
348325
350039
|
if (!allowed.includes(this.#editorLifecycleState))
|
|
348326
350040
|
throw new InvalidStateError(`Invalid operation: editor is in '${this.#editorLifecycleState}' state, expected one of: ${allowed.join(", ")}`);
|
|
348327
350041
|
}
|
|
348328
|
-
async#withState(during, success, failure$
|
|
350042
|
+
async#withState(during, success, failure$5, operation) {
|
|
348329
350043
|
this.#editorLifecycleState = during;
|
|
348330
350044
|
try {
|
|
348331
350045
|
const result = await operation();
|
|
348332
350046
|
this.#editorLifecycleState = success;
|
|
348333
350047
|
return result;
|
|
348334
350048
|
} catch (error3) {
|
|
348335
|
-
this.#editorLifecycleState = failure$
|
|
350049
|
+
this.#editorLifecycleState = failure$5;
|
|
348336
350050
|
throw error3;
|
|
348337
350051
|
}
|
|
348338
350052
|
}
|
|
@@ -349918,6 +351632,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
349918
351632
|
if (partData?.elements?.[0])
|
|
349919
351633
|
updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
|
|
349920
351634
|
}
|
|
351635
|
+
const templateSubstratePaths = Object.keys(this.converter.convertedXml).filter((path2) => /^word\/theme\/[^/]+\.xml$/.test(path2) || path2 === "word/fontTable.xml" || path2 === "word/webSettings.xml");
|
|
351636
|
+
for (const path2 of templateSubstratePaths) {
|
|
351637
|
+
if (Object.prototype.hasOwnProperty.call(updatedDocs, path2))
|
|
351638
|
+
continue;
|
|
351639
|
+
const partData = this.converter.convertedXml[path2];
|
|
351640
|
+
if (partData?.elements?.[0])
|
|
351641
|
+
updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
|
|
351642
|
+
}
|
|
351643
|
+
for (const path2 of ["[Content_Types].xml", "word/_rels/document.xml.rels"]) {
|
|
351644
|
+
if (Object.prototype.hasOwnProperty.call(updatedDocs, path2))
|
|
351645
|
+
continue;
|
|
351646
|
+
const partData = this.converter.convertedXml[path2];
|
|
351647
|
+
if (partData?.elements?.[0])
|
|
351648
|
+
updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
|
|
351649
|
+
}
|
|
349921
351650
|
const removedCustomXmlPaths = this.converter.removedCustomXmlPaths;
|
|
349922
351651
|
if (removedCustomXmlPaths instanceof Set)
|
|
349923
351652
|
for (const path2 of removedCustomXmlPaths)
|
|
@@ -358334,11 +360063,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
358334
360063
|
]);
|
|
358335
360064
|
});
|
|
358336
360065
|
|
|
358337
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
360066
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-CxQcY_QQ.es.js
|
|
358338
360067
|
var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
358339
|
-
var
|
|
358340
|
-
|
|
358341
|
-
|
|
360068
|
+
var init_create_super_doc_ui_CxQcY_QQ_es = __esm(() => {
|
|
360069
|
+
init_SuperConverter_B9mZiCO9_es();
|
|
360070
|
+
init_create_headless_toolbar_pn_wKqsL_es();
|
|
358342
360071
|
MOD_ALIASES = new Set([
|
|
358343
360072
|
"Mod",
|
|
358344
360073
|
"Meta",
|
|
@@ -358371,25 +360100,25 @@ var init_create_super_doc_ui_Bl19tgn8_es = __esm(() => {
|
|
|
358371
360100
|
var init_ui_C5PAS9hY_es = () => {};
|
|
358372
360101
|
|
|
358373
360102
|
// ../../packages/superdoc/dist/chunks/zipper-yaJVJ4z9.es.js
|
|
358374
|
-
var
|
|
360103
|
+
var import_jszip_min3;
|
|
358375
360104
|
var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
358376
360105
|
init_rolldown_runtime_Bg48TavK_es();
|
|
358377
360106
|
init_jszip_C49i9kUs_es();
|
|
358378
|
-
|
|
360107
|
+
import_jszip_min3 = /* @__PURE__ */ __toESM2(require_jszip_min(), 1);
|
|
358379
360108
|
});
|
|
358380
360109
|
|
|
358381
360110
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
358382
360111
|
var init_super_editor_es = __esm(() => {
|
|
358383
|
-
|
|
358384
|
-
|
|
360112
|
+
init_src_CaxTbQ6c_es();
|
|
360113
|
+
init_SuperConverter_B9mZiCO9_es();
|
|
358385
360114
|
init_jszip_C49i9kUs_es();
|
|
358386
360115
|
init_xml_js_CqGKpaft_es();
|
|
358387
|
-
|
|
360116
|
+
init_create_headless_toolbar_pn_wKqsL_es();
|
|
358388
360117
|
init_constants_D_X7xF4s_es();
|
|
358389
360118
|
init_dist_B8HfvhaK_es();
|
|
358390
360119
|
init_unified_Dsuw2be5_es();
|
|
358391
|
-
|
|
358392
|
-
|
|
360120
|
+
init_DocxZipper_VodIk8WL_es();
|
|
360121
|
+
init_create_super_doc_ui_CxQcY_QQ_es();
|
|
358393
360122
|
init_ui_C5PAS9hY_es();
|
|
358394
360123
|
init_eventemitter3_BnGqBE_Q_es();
|
|
358395
360124
|
init_errors_CNaD6vcg_es();
|
|
@@ -358397,7 +360126,7 @@ var init_super_editor_es = __esm(() => {
|
|
|
358397
360126
|
});
|
|
358398
360127
|
|
|
358399
360128
|
// ../../node_modules/.pnpm/happy-dom@20.4.0/node_modules/happy-dom/lib/PropertySymbol.js
|
|
358400
|
-
var abort, activeElement, asyncTaskManager, bodyBuffer, buffer3, cachedResponse, callbacks, checked, childNodes, children, classList, connectedToNode, disconnectedFromNode, connectedToDocument, disconnectedFromDocument, contentLength, contentType, cssText, currentScript, currentTarget, data, defaultView, destroy, dirtyness, end, entries2, evaluateCSS, evaluateScript, exceptionObserver, formNode, internalId, height, immediatePropagationStopped, indeterminate, isFirstWrite, isFirstWriteAfterOpen, isInPassiveEventListener, isValue, listenerOptions, listeners, itemsByName, nextActiveElement, observeMutations, mutationListeners, ownerDocument, ownerElement, propagationStopped, readyStateManager, referrer, registry2, relList, resetSelection, rootNode, selectNode, selectedness, selection, setupVMContext, shadowRoot, start2, style2, target, textAreaNode, unobserveMutations, reportMutation, updateSelectedness, url2, value, width, window2, windowResizeListener, mutationObservers, openerFrame, openerWindow, popup, isConnected, parentNode2, nodeType, tagName, prefix2, scrollHeight, scrollWidth, scrollTop, scrollLeft, attributes, attributesProxy, namespaceURI, accessKey, accessKeyLabel, offsetHeight, offsetWidth, offsetLeft, offsetTop, clientHeight, clientWidth, clientLeft, clientTop, name, specified, adoptedStyleSheets, implementation, readyState, publicId, systemId, validationMessage, validity, returnValue, elements, length4, complete, naturalHeight, naturalWidth, loading, x, y2, defaultChecked2, files, sheet, volume, paused, currentTime, playbackRate, defaultPlaybackRate, muted, defaultMuted, preservesPitch, buffered, duration, error3, ended, networkState, textTracks, seeking, seekable, played, options, content3, mode, host, setURL, localName2, classRegistry, nodeStream, location3, history2, navigator2, screen2, sessionStorage, localStorage2, sandbox, cloneNode2, appendChild, removeChild, insertBefore, replaceChild, tracks, constraints, capabilities2, settings,
|
|
360129
|
+
var abort, activeElement, asyncTaskManager, bodyBuffer, buffer3, cachedResponse, callbacks, checked, childNodes, children, classList, connectedToNode, disconnectedFromNode, connectedToDocument, disconnectedFromDocument, contentLength, contentType, cssText, currentScript, currentTarget, data, defaultView, destroy, dirtyness, end, entries2, evaluateCSS, evaluateScript, exceptionObserver, formNode, internalId, height, immediatePropagationStopped, indeterminate, isFirstWrite, isFirstWriteAfterOpen, isInPassiveEventListener, isValue, listenerOptions, listeners, itemsByName, nextActiveElement, observeMutations, mutationListeners, ownerDocument, ownerElement, propagationStopped, readyStateManager, referrer, registry2, relList, resetSelection, rootNode, selectNode, selectedness, selection, setupVMContext, shadowRoot, start2, style2, target, textAreaNode, unobserveMutations, reportMutation, updateSelectedness, url2, value, width, window2, windowResizeListener, mutationObservers, openerFrame, openerWindow, popup, isConnected, parentNode2, nodeType, tagName, prefix2, scrollHeight, scrollWidth, scrollTop, scrollLeft, attributes, attributesProxy, namespaceURI, accessKey, accessKeyLabel, offsetHeight, offsetWidth, offsetLeft, offsetTop, clientHeight, clientWidth, clientLeft, clientTop, name, specified, adoptedStyleSheets, implementation, readyState, publicId, systemId, validationMessage, validity, returnValue, elements, length4, complete, naturalHeight, naturalWidth, loading, x, y2, defaultChecked2, files, sheet, volume, paused, currentTime, playbackRate, defaultPlaybackRate, muted, defaultMuted, preservesPitch, buffered, duration, error3, ended, networkState, textTracks, seeking, seekable, played, options, content3, mode, host, setURL, localName2, classRegistry, nodeStream, location3, history2, navigator2, screen2, sessionStorage, localStorage2, sandbox, cloneNode2, appendChild, removeChild, insertBefore, replaceChild, tracks, constraints, capabilities2, settings, clone2, removeNamedItem, items, selectedOptions, styleNode, updateSheet, clearCache, onSetAttribute, onRemoveAttribute, nodeArray, elementArray, cache2, affectsCache, forms, affectsComputedStyleCache, query2, computedStyle, getFormControlItems, getFormControlNamedItem, dataset, getNamespaceItemKey, getNamedItemKey, itemsByNamespaceURI, proxy, setNamedItem, getTokenList, attributeName, selectedIndex, self2, parent, top, areas, defaultValue, elementIdMap, clonable, delegatesFocus, serializable, slotAssignment, assignedNodes, assignedToSlot, cells, rows, headers, tBodies, track2, controlsList, mediaKeys, remote, sinkId, srcObject, cues, activeCues, kind, label, language, id2, illegalConstructor, state, canvas2, popoverTargetElement, composed, bubbles, cancelable, defaultPrevented, eventPhase, timeStamp, type, detail, globalObject, destroyed, aborted, browserFrames, windowInternalId, getItemList, requiredExtensions, systemLanguage, transform, baseVal, animVal, pathLength, unitType, viewBox, markerUnits, markerWidth, markerHeight, values, orientType, orientAngle, refX, refY, readOnly, preserveAspectRatio, animatedPoints, points, rx, ry, cx, cy, r2, clipPathUnits, maskUnits, maskContentUnits, filterUnits, primitiveUnits, href, x1, y1, x2, y22, gradientUnits, gradientTransform, spreadMethod, patternUnits, patternContentUnits, patternTransform, fx, fy, offset2, disabled, textLength, lengthAdjust, getAttribute, setAttribute, z2, w, toArray, fromString, fromArray, angle, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44, setMatrixValue, translateSelf, rotateSelf, rotateAxisAngleSelf, scaleSelf, scale3dSelf, scaleNonUniformSelf, skewXSelf, skewYSelf, multiplySelf, matrix, domMatrix, getDOMMatrix, setDOMMatrix, attributeValue, startOffset, method, spacing, in1, in2, result, bias, divisor, edgeMode, kernelMatrix, kernelUnitLengthX, kernelUnitLengthY, orderX, orderY, preserveAlpha, targetX, targetY, diffuseConstant, surfaceScale, scale, xChannelSelector, yChannelSelector, azimuth, elevation, dx, dy, stdDeviationX, stdDeviationY, tableValues, slope, intercept, amplitude, exponent, crossOrigin, operator, radiusX, radiusY, specularConstant, specularExponent, pointsAtX, pointsAtY, pointsAtZ, limitingConeAngle, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles, rotateFromVectorSelf, flipXSelf, flipYSelf, invertSelf, getLength, currentScale, rotate, bindMethods, xmlProcessingInstruction, root3, filterNode, customElementReactionStack, dispatching, modules, preloads, body, redirect, referrerPolicy, signal, bodyUsed, credentials, blocking, moduleImportMap, dispatchError, supports, reason, propertyEventListeners, cssRules, parentRule, parentStyleSheet, conditionText, keyText, media2, styleMap, selectorText, cssParser, cssRule, rulePrefix, virtualServerFile, frames, disableEvaluation, validateJavaScriptExecutionEnvironment, currentNode, openWebSockets, webSocket, moduleCache;
|
|
358401
360130
|
var init_PropertySymbol = __esm(() => {
|
|
358402
360131
|
abort = Symbol("abort");
|
|
358403
360132
|
activeElement = Symbol("activeElement");
|
|
@@ -358557,7 +360286,7 @@ var init_PropertySymbol = __esm(() => {
|
|
|
358557
360286
|
constraints = Symbol("constraints");
|
|
358558
360287
|
capabilities2 = Symbol("capabilities");
|
|
358559
360288
|
settings = Symbol("settings");
|
|
358560
|
-
|
|
360289
|
+
clone2 = Symbol("clone");
|
|
358561
360290
|
removeNamedItem = Symbol("removeNamedItem");
|
|
358562
360291
|
items = Symbol("items");
|
|
358563
360292
|
selectedOptions = Symbol("selectedOptions");
|
|
@@ -363203,10 +364932,10 @@ class CSSStyleDeclarationPropertyManager {
|
|
|
363203
364932
|
}
|
|
363204
364933
|
clone() {
|
|
363205
364934
|
const _class = this.constructor;
|
|
363206
|
-
const
|
|
363207
|
-
|
|
363208
|
-
|
|
363209
|
-
return
|
|
364935
|
+
const clone3 = new _class;
|
|
364936
|
+
clone3.properties = JSON.parse(JSON.stringify(this.properties));
|
|
364937
|
+
clone3.definedPropertyNames = Object.assign({}, this.definedPropertyNames);
|
|
364938
|
+
return clone3;
|
|
363210
364939
|
}
|
|
363211
364940
|
size() {
|
|
363212
364941
|
return Object.keys(this.properties).length;
|
|
@@ -363216,17 +364945,17 @@ class CSSStyleDeclarationPropertyManager {
|
|
|
363216
364945
|
}
|
|
363217
364946
|
toString() {
|
|
363218
364947
|
const result2 = [];
|
|
363219
|
-
const
|
|
364948
|
+
const clone3 = this.clone();
|
|
363220
364949
|
const properties = {};
|
|
363221
364950
|
for (const shorthandPropertyGroup of TO_STRING_SHORTHAND_PROPERTIES) {
|
|
363222
364951
|
for (const shorthandProperty of shorthandPropertyGroup) {
|
|
363223
364952
|
if (Array.isArray(shorthandProperty)) {
|
|
363224
364953
|
let isMatch = false;
|
|
363225
364954
|
for (const childShorthandProperty of shorthandProperty) {
|
|
363226
|
-
const property =
|
|
364955
|
+
const property = clone3.get(childShorthandProperty);
|
|
363227
364956
|
if (property) {
|
|
363228
364957
|
properties[childShorthandProperty] = property;
|
|
363229
|
-
|
|
364958
|
+
clone3.remove(childShorthandProperty);
|
|
363230
364959
|
isMatch = true;
|
|
363231
364960
|
}
|
|
363232
364961
|
}
|
|
@@ -363234,17 +364963,17 @@ class CSSStyleDeclarationPropertyManager {
|
|
|
363234
364963
|
break;
|
|
363235
364964
|
}
|
|
363236
364965
|
} else {
|
|
363237
|
-
const property =
|
|
364966
|
+
const property = clone3.get(shorthandProperty);
|
|
363238
364967
|
if (property) {
|
|
363239
364968
|
properties[shorthandProperty] = property;
|
|
363240
|
-
|
|
364969
|
+
clone3.remove(shorthandProperty);
|
|
363241
364970
|
break;
|
|
363242
364971
|
}
|
|
363243
364972
|
}
|
|
363244
364973
|
}
|
|
363245
364974
|
}
|
|
363246
|
-
for (const name2 of Object.keys(
|
|
363247
|
-
properties[name2] =
|
|
364975
|
+
for (const name2 of Object.keys(clone3.properties)) {
|
|
364976
|
+
properties[name2] = clone3.get(name2);
|
|
363248
364977
|
}
|
|
363249
364978
|
for (const definedPropertyName of Object.keys(this.definedPropertyNames)) {
|
|
363250
364979
|
const property = properties[definedPropertyName];
|
|
@@ -364555,7 +366284,7 @@ class QuerySelector {
|
|
|
364555
366284
|
}
|
|
364556
366285
|
return null;
|
|
364557
366286
|
}
|
|
364558
|
-
static findAll(
|
|
366287
|
+
static findAll(rootElement2, children2, selectorItems, cachedItem, documentPosition) {
|
|
364559
366288
|
const selectorItem = selectorItems[0];
|
|
364560
366289
|
const nextSelectorItem = selectorItems[1];
|
|
364561
366290
|
let matched = [];
|
|
@@ -364566,7 +366295,7 @@ class QuerySelector {
|
|
|
364566
366295
|
child[affectsCache].push(cachedItem);
|
|
364567
366296
|
if (selectorItem.match(child)) {
|
|
364568
366297
|
if (!nextSelectorItem) {
|
|
364569
|
-
if (
|
|
366298
|
+
if (rootElement2 !== child) {
|
|
364570
366299
|
matched.push({
|
|
364571
366300
|
documentPosition: position4,
|
|
364572
366301
|
element: child
|
|
@@ -364577,30 +366306,30 @@ class QuerySelector {
|
|
|
364577
366306
|
case SelectorCombinatorEnum_default.adjacentSibling:
|
|
364578
366307
|
const nextElementSibling = child.nextElementSibling;
|
|
364579
366308
|
if (nextElementSibling) {
|
|
364580
|
-
matched = matched.concat(this.findAll(
|
|
366309
|
+
matched = matched.concat(this.findAll(rootElement2, [nextElementSibling], selectorItems.slice(1), cachedItem, position4));
|
|
364581
366310
|
}
|
|
364582
366311
|
break;
|
|
364583
366312
|
case SelectorCombinatorEnum_default.descendant:
|
|
364584
366313
|
case SelectorCombinatorEnum_default.child:
|
|
364585
|
-
matched = matched.concat(this.findAll(
|
|
366314
|
+
matched = matched.concat(this.findAll(rootElement2, childrenOfChild, selectorItems.slice(1), cachedItem, position4));
|
|
364586
366315
|
break;
|
|
364587
366316
|
case SelectorCombinatorEnum_default.subsequentSibling:
|
|
364588
366317
|
const index2 = children2.indexOf(child);
|
|
364589
366318
|
for (let j = index2 + 1;j < children2.length; j++) {
|
|
364590
366319
|
const sibling = children2[j];
|
|
364591
|
-
matched = matched.concat(this.findAll(
|
|
366320
|
+
matched = matched.concat(this.findAll(rootElement2, [sibling], selectorItems.slice(1), cachedItem, position4));
|
|
364592
366321
|
}
|
|
364593
366322
|
break;
|
|
364594
366323
|
}
|
|
364595
366324
|
}
|
|
364596
366325
|
}
|
|
364597
366326
|
if (selectorItem.combinator === SelectorCombinatorEnum_default.descendant && childrenOfChild.length) {
|
|
364598
|
-
matched = matched.concat(this.findAll(
|
|
366327
|
+
matched = matched.concat(this.findAll(rootElement2, childrenOfChild, selectorItems, cachedItem, position4));
|
|
364599
366328
|
}
|
|
364600
366329
|
}
|
|
364601
366330
|
return matched;
|
|
364602
366331
|
}
|
|
364603
|
-
static findFirst(
|
|
366332
|
+
static findFirst(rootElement2, children2, selectorItems, cachedItem, documentPosition) {
|
|
364604
366333
|
const selectorItem = selectorItems[0];
|
|
364605
366334
|
const nextSelectorItem = selectorItems[1];
|
|
364606
366335
|
for (let i4 = 0, max5 = children2.length;i4 < max5; i4++) {
|
|
@@ -364610,7 +366339,7 @@ class QuerySelector {
|
|
|
364610
366339
|
child[affectsCache].push(cachedItem);
|
|
364611
366340
|
if (selectorItem.match(child)) {
|
|
364612
366341
|
if (!nextSelectorItem) {
|
|
364613
|
-
if (
|
|
366342
|
+
if (rootElement2 !== child) {
|
|
364614
366343
|
return { documentPosition: position4, element: child };
|
|
364615
366344
|
}
|
|
364616
366345
|
} else {
|
|
@@ -364618,7 +366347,7 @@ class QuerySelector {
|
|
|
364618
366347
|
case SelectorCombinatorEnum_default.adjacentSibling:
|
|
364619
366348
|
const nextElementSibling = child.nextElementSibling;
|
|
364620
366349
|
if (nextElementSibling) {
|
|
364621
|
-
const match3 = this.findFirst(
|
|
366350
|
+
const match3 = this.findFirst(rootElement2, [nextElementSibling], selectorItems.slice(1), cachedItem, position4);
|
|
364622
366351
|
if (match3) {
|
|
364623
366352
|
return match3;
|
|
364624
366353
|
}
|
|
@@ -364626,7 +366355,7 @@ class QuerySelector {
|
|
|
364626
366355
|
break;
|
|
364627
366356
|
case SelectorCombinatorEnum_default.descendant:
|
|
364628
366357
|
case SelectorCombinatorEnum_default.child:
|
|
364629
|
-
const match2 = this.findFirst(
|
|
366358
|
+
const match2 = this.findFirst(rootElement2, childrenOfChild, selectorItems.slice(1), cachedItem, position4);
|
|
364630
366359
|
if (match2) {
|
|
364631
366360
|
return match2;
|
|
364632
366361
|
}
|
|
@@ -364635,7 +366364,7 @@ class QuerySelector {
|
|
|
364635
366364
|
const index2 = children2.indexOf(child);
|
|
364636
366365
|
for (let i5 = index2 + 1;i5 < children2.length; i5++) {
|
|
364637
366366
|
const sibling = children2[i5];
|
|
364638
|
-
const match3 = this.findFirst(
|
|
366367
|
+
const match3 = this.findFirst(rootElement2, [sibling], selectorItems.slice(1), cachedItem, position4);
|
|
364639
366368
|
if (match3) {
|
|
364640
366369
|
return match3;
|
|
364641
366370
|
}
|
|
@@ -364645,7 +366374,7 @@ class QuerySelector {
|
|
|
364645
366374
|
}
|
|
364646
366375
|
}
|
|
364647
366376
|
if (selectorItem.combinator === SelectorCombinatorEnum_default.descendant && childrenOfChild.length) {
|
|
364648
|
-
const match2 = this.findFirst(
|
|
366377
|
+
const match2 = this.findFirst(rootElement2, childrenOfChild, selectorItems, cachedItem, position4);
|
|
364649
366378
|
if (match2) {
|
|
364650
366379
|
return match2;
|
|
364651
366380
|
}
|
|
@@ -374041,24 +375770,24 @@ var init_Node = __esm(() => {
|
|
|
374041
375770
|
return this[replaceChild](newChild, oldChild);
|
|
374042
375771
|
}
|
|
374043
375772
|
[cloneNode2](deep = false) {
|
|
374044
|
-
const
|
|
374045
|
-
if (
|
|
374046
|
-
const childNodes2 =
|
|
375773
|
+
const clone3 = NodeFactory.createNode(this[ownerDocument], this.constructor);
|
|
375774
|
+
if (clone3[nodeArray].length) {
|
|
375775
|
+
const childNodes2 = clone3[nodeArray];
|
|
374047
375776
|
while (childNodes2.length) {
|
|
374048
|
-
|
|
375777
|
+
clone3.removeChild(childNodes2[0]);
|
|
374049
375778
|
}
|
|
374050
375779
|
}
|
|
374051
375780
|
if (deep) {
|
|
374052
375781
|
for (const childNode of this[nodeArray]) {
|
|
374053
375782
|
const childClone = childNode.cloneNode(true);
|
|
374054
|
-
childClone[parentNode2] =
|
|
374055
|
-
|
|
375783
|
+
childClone[parentNode2] = clone3;
|
|
375784
|
+
clone3[nodeArray].push(childClone);
|
|
374056
375785
|
if (childClone[nodeType] === NodeTypeEnum_default.elementNode) {
|
|
374057
|
-
|
|
375786
|
+
clone3[elementArray].push(childClone);
|
|
374058
375787
|
}
|
|
374059
375788
|
}
|
|
374060
375789
|
}
|
|
374061
|
-
return
|
|
375790
|
+
return clone3;
|
|
374062
375791
|
}
|
|
374063
375792
|
[appendChild](node3, disableValidations = false) {
|
|
374064
375793
|
if (node3[proxy]) {
|
|
@@ -374629,14 +376358,14 @@ var init_Attr = __esm(() => {
|
|
|
374629
376358
|
return this[namespaceURI];
|
|
374630
376359
|
}
|
|
374631
376360
|
[cloneNode2](deep = false) {
|
|
374632
|
-
const
|
|
374633
|
-
|
|
374634
|
-
|
|
374635
|
-
|
|
374636
|
-
|
|
374637
|
-
|
|
374638
|
-
|
|
374639
|
-
return
|
|
376361
|
+
const clone3 = super[cloneNode2](deep);
|
|
376362
|
+
clone3[namespaceURI] = this[namespaceURI];
|
|
376363
|
+
clone3[name] = this[name];
|
|
376364
|
+
clone3[localName2] = this[localName2];
|
|
376365
|
+
clone3[prefix2] = this[prefix2];
|
|
376366
|
+
clone3[value] = this[value];
|
|
376367
|
+
clone3[specified] = this[specified];
|
|
376368
|
+
return clone3;
|
|
374640
376369
|
}
|
|
374641
376370
|
};
|
|
374642
376371
|
});
|
|
@@ -374813,9 +376542,9 @@ var init_CharacterData = __esm(() => {
|
|
|
374813
376542
|
ChildNodeUtility.after(this, ...nodes);
|
|
374814
376543
|
}
|
|
374815
376544
|
[cloneNode2](deep = false) {
|
|
374816
|
-
const
|
|
374817
|
-
|
|
374818
|
-
return
|
|
376545
|
+
const clone3 = super[cloneNode2](deep);
|
|
376546
|
+
clone3[data] = this[data];
|
|
376547
|
+
return clone3;
|
|
374819
376548
|
}
|
|
374820
376549
|
};
|
|
374821
376550
|
});
|
|
@@ -374847,11 +376576,11 @@ var init_DocumentType = __esm(() => {
|
|
|
374847
376576
|
return "[object DocumentType]";
|
|
374848
376577
|
}
|
|
374849
376578
|
[cloneNode2](deep = false) {
|
|
374850
|
-
const
|
|
374851
|
-
|
|
374852
|
-
|
|
374853
|
-
|
|
374854
|
-
return
|
|
376579
|
+
const clone3 = super[cloneNode2](deep);
|
|
376580
|
+
clone3[name] = this[name];
|
|
376581
|
+
clone3[publicId] = this[publicId];
|
|
376582
|
+
clone3[systemId] = this[systemId];
|
|
376583
|
+
return clone3;
|
|
374855
376584
|
}
|
|
374856
376585
|
};
|
|
374857
376586
|
});
|
|
@@ -378666,9 +380395,9 @@ var init_Document = __esm(() => {
|
|
|
378666
380395
|
if (!(node3 instanceof Node2)) {
|
|
378667
380396
|
throw new this[window2].DOMException("Parameter 1 was not of type Node.");
|
|
378668
380397
|
}
|
|
378669
|
-
const
|
|
378670
|
-
this.#importNode(
|
|
378671
|
-
return
|
|
380398
|
+
const clone3 = node3.cloneNode(deep);
|
|
380399
|
+
this.#importNode(clone3);
|
|
380400
|
+
return clone3;
|
|
378672
380401
|
}
|
|
378673
380402
|
createRange() {
|
|
378674
380403
|
return new this[window2].Range;
|
|
@@ -379567,19 +381296,19 @@ var init_Element = __esm(() => {
|
|
|
379567
381296
|
return html3;
|
|
379568
381297
|
}
|
|
379569
381298
|
[cloneNode2](deep = false) {
|
|
379570
|
-
const
|
|
379571
|
-
|
|
379572
|
-
|
|
379573
|
-
|
|
381299
|
+
const clone3 = super[cloneNode2](deep);
|
|
381300
|
+
clone3[tagName] = this[tagName];
|
|
381301
|
+
clone3[localName2] = this[localName2];
|
|
381302
|
+
clone3[namespaceURI] = this[namespaceURI];
|
|
379574
381303
|
if (this[shadowRoot]?.[clonable]) {
|
|
379575
|
-
|
|
379576
|
-
|
|
381304
|
+
clone3[shadowRoot] = this[shadowRoot].cloneNode(deep);
|
|
381305
|
+
clone3[shadowRoot][host] = clone3;
|
|
379577
381306
|
}
|
|
379578
|
-
|
|
381307
|
+
clone3[attributes] = new NamedNodeMap(clone3);
|
|
379579
381308
|
for (const attr of this[attributes][items].values()) {
|
|
379580
|
-
|
|
381309
|
+
clone3[attributes].setNamedItem(attr.cloneNode(deep));
|
|
379581
381310
|
}
|
|
379582
|
-
return
|
|
381311
|
+
return clone3;
|
|
379583
381312
|
}
|
|
379584
381313
|
remove() {
|
|
379585
381314
|
ChildNodeUtility.remove(this);
|
|
@@ -380765,9 +382494,9 @@ var init_HTMLElement = __esm(() => {
|
|
|
380765
382494
|
HTMLElementUtility.focus(this);
|
|
380766
382495
|
}
|
|
380767
382496
|
[cloneNode2](deep = false) {
|
|
380768
|
-
const
|
|
380769
|
-
|
|
380770
|
-
return
|
|
382497
|
+
const clone3 = super[cloneNode2](deep);
|
|
382498
|
+
clone3[accessKey] = this[accessKey];
|
|
382499
|
+
return clone3;
|
|
380771
382500
|
}
|
|
380772
382501
|
[connectedToDocument]() {
|
|
380773
382502
|
const window3 = this[window2];
|
|
@@ -383089,15 +384818,15 @@ var init_HTMLInputElement = __esm(() => {
|
|
|
383089
384818
|
}
|
|
383090
384819
|
}
|
|
383091
384820
|
[cloneNode2](deep = false) {
|
|
383092
|
-
const
|
|
383093
|
-
|
|
383094
|
-
|
|
383095
|
-
|
|
383096
|
-
|
|
383097
|
-
|
|
383098
|
-
|
|
383099
|
-
|
|
383100
|
-
return
|
|
384821
|
+
const clone3 = super[cloneNode2](deep);
|
|
384822
|
+
clone3[value] = this[value];
|
|
384823
|
+
clone3[height] = this[height];
|
|
384824
|
+
clone3[width] = this[width];
|
|
384825
|
+
clone3[files] = this[files].slice();
|
|
384826
|
+
clone3.#selectionStart = this.#selectionStart;
|
|
384827
|
+
clone3.#selectionEnd = this.#selectionEnd;
|
|
384828
|
+
clone3.#selectionDirection = this.#selectionDirection;
|
|
384829
|
+
return clone3;
|
|
383101
384830
|
}
|
|
383102
384831
|
dispatchEvent(event) {
|
|
383103
384832
|
if (event[type] !== "click" || event[eventPhase] !== EventPhaseEnum_default.none || !(event instanceof MouseEvent2)) {
|
|
@@ -383444,12 +385173,12 @@ var init_HTMLTextAreaElement = __esm(() => {
|
|
|
383444
385173
|
return this.checkValidity();
|
|
383445
385174
|
}
|
|
383446
385175
|
[cloneNode2](deep = false) {
|
|
383447
|
-
const
|
|
383448
|
-
|
|
383449
|
-
|
|
383450
|
-
|
|
383451
|
-
|
|
383452
|
-
return
|
|
385176
|
+
const clone3 = super[cloneNode2](deep);
|
|
385177
|
+
clone3[value] = this[value];
|
|
385178
|
+
clone3.#selectionStart = this.#selectionStart;
|
|
385179
|
+
clone3.#selectionEnd = this.#selectionEnd;
|
|
385180
|
+
clone3.#selectionDirection = this.#selectionDirection;
|
|
385181
|
+
return clone3;
|
|
383453
385182
|
}
|
|
383454
385183
|
[resetSelection]() {
|
|
383455
385184
|
if (this[value] === null) {
|
|
@@ -390168,9 +391897,9 @@ var init_HTMLTemplateElement = __esm(() => {
|
|
|
390168
391897
|
return this[content3][replaceChild](newChild, oldChild);
|
|
390169
391898
|
}
|
|
390170
391899
|
[cloneNode2](deep = false) {
|
|
390171
|
-
const
|
|
390172
|
-
|
|
390173
|
-
return
|
|
391900
|
+
const clone3 = super[cloneNode2](deep);
|
|
391901
|
+
clone3[content3] = this[content3].cloneNode(deep);
|
|
391902
|
+
return clone3;
|
|
390174
391903
|
}
|
|
390175
391904
|
};
|
|
390176
391905
|
});
|
|
@@ -390504,13 +392233,13 @@ var init_ShadowRoot = __esm(() => {
|
|
|
390504
392233
|
return this.innerHTML;
|
|
390505
392234
|
}
|
|
390506
392235
|
[cloneNode2](deep = false) {
|
|
390507
|
-
const
|
|
390508
|
-
|
|
390509
|
-
|
|
390510
|
-
|
|
390511
|
-
|
|
390512
|
-
|
|
390513
|
-
return
|
|
392236
|
+
const clone3 = super[cloneNode2](deep);
|
|
392237
|
+
clone3[mode] = this[mode];
|
|
392238
|
+
clone3[clonable] = this[clonable];
|
|
392239
|
+
clone3[delegatesFocus] = this[delegatesFocus];
|
|
392240
|
+
clone3[serializable] = this[serializable];
|
|
392241
|
+
clone3[slotAssignment] = this[slotAssignment];
|
|
392242
|
+
return clone3;
|
|
390514
392243
|
}
|
|
390515
392244
|
};
|
|
390516
392245
|
});
|
|
@@ -393363,9 +395092,9 @@ var init_Range = __esm(() => {
|
|
|
393363
395092
|
return fragment2;
|
|
393364
395093
|
}
|
|
393365
395094
|
if (this[start2].node === this[end].node && (this[start2].node[nodeType] === NodeTypeEnum_default.textNode || this[start2].node[nodeType] === NodeTypeEnum_default.processingInstructionNode || this[start2].node[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393366
|
-
const
|
|
393367
|
-
|
|
393368
|
-
fragment2.appendChild(
|
|
395095
|
+
const clone3 = this[start2].node.cloneNode(false);
|
|
395096
|
+
clone3[data] = clone3.substringData(startOffset2, endOffset - startOffset2);
|
|
395097
|
+
fragment2.appendChild(clone3);
|
|
393369
395098
|
return fragment2;
|
|
393370
395099
|
}
|
|
393371
395100
|
let commonAncestor = this[start2].node;
|
|
@@ -393402,48 +395131,48 @@ var init_Range = __esm(() => {
|
|
|
393402
395131
|
}
|
|
393403
395132
|
}
|
|
393404
395133
|
if (firstPartialContainedChild !== null && (firstPartialContainedChild[nodeType] === NodeTypeEnum_default.textNode || firstPartialContainedChild[nodeType] === NodeTypeEnum_default.processingInstructionNode || firstPartialContainedChild[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393405
|
-
const
|
|
393406
|
-
|
|
393407
|
-
fragment2.appendChild(
|
|
395134
|
+
const clone3 = this[start2].node.cloneNode(false);
|
|
395135
|
+
clone3[data] = clone3.substringData(startOffset2, NodeUtility.getNodeLength(this[start2].node) - startOffset2);
|
|
395136
|
+
fragment2.appendChild(clone3);
|
|
393408
395137
|
} else if (firstPartialContainedChild !== null) {
|
|
393409
|
-
const
|
|
393410
|
-
fragment2.appendChild(
|
|
395138
|
+
const clone3 = firstPartialContainedChild.cloneNode();
|
|
395139
|
+
fragment2.appendChild(clone3);
|
|
393411
395140
|
const subRange = new window3.Range;
|
|
393412
395141
|
subRange[start2].node = this[start2].node;
|
|
393413
395142
|
subRange[start2].offset = startOffset2;
|
|
393414
395143
|
subRange[end].node = firstPartialContainedChild;
|
|
393415
395144
|
subRange[end].offset = NodeUtility.getNodeLength(firstPartialContainedChild);
|
|
393416
395145
|
const subDocumentFragment = subRange.cloneContents();
|
|
393417
|
-
|
|
395146
|
+
clone3.appendChild(subDocumentFragment);
|
|
393418
395147
|
}
|
|
393419
395148
|
for (const containedChild of containedChildren) {
|
|
393420
|
-
const
|
|
393421
|
-
fragment2.appendChild(
|
|
395149
|
+
const clone3 = containedChild.cloneNode(true);
|
|
395150
|
+
fragment2.appendChild(clone3);
|
|
393422
395151
|
}
|
|
393423
395152
|
if (lastPartiallyContainedChild !== null && (lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.textNode || lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.processingInstructionNode || lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393424
|
-
const
|
|
393425
|
-
|
|
393426
|
-
fragment2.appendChild(
|
|
395153
|
+
const clone3 = this[end].node.cloneNode(false);
|
|
395154
|
+
clone3[data] = clone3.substringData(0, endOffset);
|
|
395155
|
+
fragment2.appendChild(clone3);
|
|
393427
395156
|
} else if (lastPartiallyContainedChild !== null) {
|
|
393428
|
-
const
|
|
393429
|
-
fragment2.appendChild(
|
|
395157
|
+
const clone3 = lastPartiallyContainedChild.cloneNode(false);
|
|
395158
|
+
fragment2.appendChild(clone3);
|
|
393430
395159
|
const subRange = new window3.Range;
|
|
393431
395160
|
subRange[start2].node = lastPartiallyContainedChild;
|
|
393432
395161
|
subRange[start2].offset = 0;
|
|
393433
395162
|
subRange[end].node = this[end].node;
|
|
393434
395163
|
subRange[end].offset = endOffset;
|
|
393435
395164
|
const subFragment = subRange.cloneContents();
|
|
393436
|
-
|
|
395165
|
+
clone3.appendChild(subFragment);
|
|
393437
395166
|
}
|
|
393438
395167
|
return fragment2;
|
|
393439
395168
|
}
|
|
393440
395169
|
cloneRange() {
|
|
393441
|
-
const
|
|
393442
|
-
|
|
393443
|
-
|
|
393444
|
-
|
|
393445
|
-
|
|
393446
|
-
return
|
|
395170
|
+
const clone3 = new this[window2].Range;
|
|
395171
|
+
clone3[start2].node = this[start2].node;
|
|
395172
|
+
clone3[start2].offset = this[start2].offset;
|
|
395173
|
+
clone3[end].node = this[end].node;
|
|
395174
|
+
clone3[end].offset = this[end].offset;
|
|
395175
|
+
return clone3;
|
|
393447
395176
|
}
|
|
393448
395177
|
createContextualFragment(tagString) {
|
|
393449
395178
|
return new HTMLParser(this[window2]).parse(tagString);
|
|
@@ -393505,9 +395234,9 @@ var init_Range = __esm(() => {
|
|
|
393505
395234
|
return fragment2;
|
|
393506
395235
|
}
|
|
393507
395236
|
if (this[start2].node === this[end].node && (this[start2].node[nodeType] === NodeTypeEnum_default.textNode || this[start2].node[nodeType] === NodeTypeEnum_default.processingInstructionNode || this[start2].node[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393508
|
-
const
|
|
393509
|
-
|
|
393510
|
-
fragment2.appendChild(
|
|
395237
|
+
const clone3 = this[start2].node.cloneNode(false);
|
|
395238
|
+
clone3[data] = clone3.substringData(startOffset2, endOffset - startOffset2);
|
|
395239
|
+
fragment2.appendChild(clone3);
|
|
393511
395240
|
this[start2].node.replaceData(startOffset2, endOffset - startOffset2, "");
|
|
393512
395241
|
return fragment2;
|
|
393513
395242
|
}
|
|
@@ -393558,39 +395287,39 @@ var init_Range = __esm(() => {
|
|
|
393558
395287
|
newOffset = referenceNode[parentNode2][nodeArray].indexOf(referenceNode) + 1;
|
|
393559
395288
|
}
|
|
393560
395289
|
if (firstPartialContainedChild !== null && (firstPartialContainedChild[nodeType] === NodeTypeEnum_default.textNode || firstPartialContainedChild[nodeType] === NodeTypeEnum_default.processingInstructionNode || firstPartialContainedChild[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393561
|
-
const
|
|
393562
|
-
|
|
393563
|
-
fragment2.appendChild(
|
|
395290
|
+
const clone3 = this[start2].node.cloneNode(false);
|
|
395291
|
+
clone3[data] = clone3.substringData(startOffset2, NodeUtility.getNodeLength(this[start2].node) - startOffset2);
|
|
395292
|
+
fragment2.appendChild(clone3);
|
|
393564
395293
|
this[start2].node.replaceData(startOffset2, NodeUtility.getNodeLength(this[start2].node) - startOffset2, "");
|
|
393565
395294
|
} else if (firstPartialContainedChild !== null) {
|
|
393566
|
-
const
|
|
393567
|
-
fragment2.appendChild(
|
|
395295
|
+
const clone3 = firstPartialContainedChild.cloneNode(false);
|
|
395296
|
+
fragment2.appendChild(clone3);
|
|
393568
395297
|
const subRange = new window3.Range;
|
|
393569
395298
|
subRange[start2].node = this[start2].node;
|
|
393570
395299
|
subRange[start2].offset = startOffset2;
|
|
393571
395300
|
subRange[end].node = firstPartialContainedChild;
|
|
393572
395301
|
subRange[end].offset = NodeUtility.getNodeLength(firstPartialContainedChild);
|
|
393573
395302
|
const subFragment = subRange.extractContents();
|
|
393574
|
-
|
|
395303
|
+
clone3.appendChild(subFragment);
|
|
393575
395304
|
}
|
|
393576
395305
|
for (const containedChild of containedChildren) {
|
|
393577
395306
|
fragment2.appendChild(containedChild);
|
|
393578
395307
|
}
|
|
393579
395308
|
if (lastPartiallyContainedChild !== null && (lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.textNode || lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.processingInstructionNode || lastPartiallyContainedChild[nodeType] === NodeTypeEnum_default.commentNode)) {
|
|
393580
|
-
const
|
|
393581
|
-
|
|
393582
|
-
fragment2.appendChild(
|
|
395309
|
+
const clone3 = this[end].node.cloneNode(false);
|
|
395310
|
+
clone3[data] = clone3.substringData(0, endOffset);
|
|
395311
|
+
fragment2.appendChild(clone3);
|
|
393583
395312
|
this[end].node.replaceData(0, endOffset, "");
|
|
393584
395313
|
} else if (lastPartiallyContainedChild !== null) {
|
|
393585
|
-
const
|
|
393586
|
-
fragment2.appendChild(
|
|
395314
|
+
const clone3 = lastPartiallyContainedChild.cloneNode(false);
|
|
395315
|
+
fragment2.appendChild(clone3);
|
|
393587
395316
|
const subRange = new window3.Range;
|
|
393588
395317
|
subRange[start2].node = lastPartiallyContainedChild;
|
|
393589
395318
|
subRange[start2].offset = 0;
|
|
393590
395319
|
subRange[end].node = this[end].node;
|
|
393591
395320
|
subRange[end].offset = endOffset;
|
|
393592
395321
|
const subFragment = subRange.extractContents();
|
|
393593
|
-
|
|
395322
|
+
clone3.appendChild(subFragment);
|
|
393594
395323
|
}
|
|
393595
395324
|
this[start2].node = newNode;
|
|
393596
395325
|
this[start2].offset = newOffset;
|
|
@@ -394627,17 +396356,17 @@ var init_MediaStreamTrack = __esm(() => {
|
|
|
394627
396356
|
return this[settings];
|
|
394628
396357
|
}
|
|
394629
396358
|
clone() {
|
|
394630
|
-
const
|
|
394631
|
-
|
|
394632
|
-
|
|
394633
|
-
|
|
394634
|
-
|
|
394635
|
-
|
|
394636
|
-
|
|
394637
|
-
|
|
394638
|
-
|
|
394639
|
-
|
|
394640
|
-
return
|
|
396359
|
+
const clone3 = new this.constructor(illegalConstructor);
|
|
396360
|
+
clone3[kind] = this[kind];
|
|
396361
|
+
clone3[constraints] = this[constraints];
|
|
396362
|
+
clone3[capabilities2] = this[capabilities2];
|
|
396363
|
+
clone3[settings] = this[settings];
|
|
396364
|
+
clone3.contentHint = this.contentHint;
|
|
396365
|
+
clone3.enabled = this.enabled;
|
|
396366
|
+
clone3.label = this.label;
|
|
396367
|
+
clone3.muted = this.muted;
|
|
396368
|
+
clone3.readyState = this.readyState;
|
|
396369
|
+
return clone3;
|
|
394641
396370
|
}
|
|
394642
396371
|
stop() {
|
|
394643
396372
|
this.readyState = "ended";
|
|
@@ -394673,9 +396402,9 @@ var init_CanvasCaptureMediaStreamTrack = __esm(() => {
|
|
|
394673
396402
|
}
|
|
394674
396403
|
requestFrame() {}
|
|
394675
396404
|
clone() {
|
|
394676
|
-
const
|
|
394677
|
-
|
|
394678
|
-
return
|
|
396405
|
+
const clone3 = super.clone();
|
|
396406
|
+
clone3[canvas2] = this.canvas;
|
|
396407
|
+
return clone3;
|
|
394679
396408
|
}
|
|
394680
396409
|
};
|
|
394681
396410
|
});
|
|
@@ -407142,6 +408871,28 @@ function mapDiffError(operationId, error4, code7) {
|
|
|
407142
408871
|
return error4;
|
|
407143
408872
|
return new CliError("COMMAND_FAILED", message, { operationId, details });
|
|
407144
408873
|
}
|
|
408874
|
+
function mapTemplatesError(operationId, error4, code7) {
|
|
408875
|
+
const message = extractErrorMessage(error4);
|
|
408876
|
+
const details = extractErrorDetails(error4);
|
|
408877
|
+
const planEngineError = tryMapPlanEngineError(operationId, error4, code7);
|
|
408878
|
+
if (planEngineError)
|
|
408879
|
+
return planEngineError;
|
|
408880
|
+
if (code7 === "CAPABILITY_UNAVAILABLE") {
|
|
408881
|
+
return new CliError("CAPABILITY_UNAVAILABLE", message, { operationId, details });
|
|
408882
|
+
}
|
|
408883
|
+
if (code7 === "UNSUPPORTED_SOURCE") {
|
|
408884
|
+
return new CliError("UNSUPPORTED_SOURCE", message, { operationId, details });
|
|
408885
|
+
}
|
|
408886
|
+
if (code7 === "INVALID_PACKAGE") {
|
|
408887
|
+
return new CliError("INVALID_PACKAGE", message, { operationId, details });
|
|
408888
|
+
}
|
|
408889
|
+
if (code7 === "UNSUPPORTED_TEMPLATE_CONTENT") {
|
|
408890
|
+
return new CliError("UNSUPPORTED_TEMPLATE_CONTENT", message, { operationId, details });
|
|
408891
|
+
}
|
|
408892
|
+
if (error4 instanceof CliError)
|
|
408893
|
+
return error4;
|
|
408894
|
+
return new CliError("COMMAND_FAILED", message, { operationId, details });
|
|
408895
|
+
}
|
|
407145
408896
|
function resolveOperationFamily(operationId) {
|
|
407146
408897
|
return OPERATION_FAMILY[operationId] ?? "general";
|
|
407147
408898
|
}
|
|
@@ -407265,6 +409016,21 @@ function mapFailedReceipt(operationId, result2, context) {
|
|
|
407265
409016
|
}
|
|
407266
409017
|
return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
|
|
407267
409018
|
}
|
|
409019
|
+
if (family2 === "templates") {
|
|
409020
|
+
if (failureCode === "CAPABILITY_UNAVAILABLE") {
|
|
409021
|
+
return new CliError("CAPABILITY_UNAVAILABLE", failureMessage, { operationId, failure: failure2 });
|
|
409022
|
+
}
|
|
409023
|
+
if (failureCode === "UNSUPPORTED_SOURCE") {
|
|
409024
|
+
return new CliError("UNSUPPORTED_SOURCE", failureMessage, { operationId, failure: failure2 });
|
|
409025
|
+
}
|
|
409026
|
+
if (failureCode === "INVALID_PACKAGE") {
|
|
409027
|
+
return new CliError("INVALID_PACKAGE", failureMessage, { operationId, failure: failure2 });
|
|
409028
|
+
}
|
|
409029
|
+
if (failureCode === "UNSUPPORTED_TEMPLATE_CONTENT") {
|
|
409030
|
+
return new CliError("UNSUPPORTED_TEMPLATE_CONTENT", failureMessage, { operationId, failure: failure2 });
|
|
409031
|
+
}
|
|
409032
|
+
return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
|
|
409033
|
+
}
|
|
407268
409034
|
return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure: failure2 });
|
|
407269
409035
|
}
|
|
407270
409036
|
var TRACK_CHANGES_REVIEW_HELPER_COMMANDS, PLAN_ENGINE_PASSTHROUGH_CODES, FAMILY_MAPPERS;
|
|
@@ -407297,6 +409063,7 @@ var init_error_mapping = __esm(() => {
|
|
|
407297
409063
|
blocks: mapBlocksError,
|
|
407298
409064
|
query: mapQueryError,
|
|
407299
409065
|
diff: mapDiffError,
|
|
409066
|
+
templates: mapTemplatesError,
|
|
407300
409067
|
general: (operationId, error4, code7) => {
|
|
407301
409068
|
const planEngineError = tryMapPlanEngineError(operationId, error4, code7);
|
|
407302
409069
|
if (planEngineError)
|
|
@@ -408554,13 +410321,13 @@ var init_read_orchestrator = __esm(() => {
|
|
|
408554
410321
|
function deriveCommandName2(operationId) {
|
|
408555
410322
|
return cliCommandTokens(`doc.${operationId}`).join(" ");
|
|
408556
410323
|
}
|
|
408557
|
-
function invokeOperation2(editor, operationId, input2, options2, commandName) {
|
|
410324
|
+
async function invokeOperation2(editor, operationId, input2, options2, commandName) {
|
|
408558
410325
|
const apiInput = extractInvokeInput(operationId, input2);
|
|
408559
410326
|
const preHook = PRE_INVOKE_HOOKS[operationId];
|
|
408560
410327
|
const transformedInput = preHook ? preHook(apiInput, { editor }) : apiInput;
|
|
408561
410328
|
let result2;
|
|
408562
410329
|
try {
|
|
408563
|
-
result2 = editor.doc.invoke({
|
|
410330
|
+
result2 = await editor.doc.invoke({
|
|
408564
410331
|
operationId,
|
|
408565
410332
|
input: transformedInput,
|
|
408566
410333
|
options: options2
|
|
@@ -408618,7 +410385,7 @@ async function executeMutationOperation(request) {
|
|
|
408618
410385
|
const source = doc3 === "-" ? "stdin" : "path";
|
|
408619
410386
|
const opened = await openDocument(doc3, context.io);
|
|
408620
410387
|
try {
|
|
408621
|
-
const result2 = invokeOperation2(opened.editor, operationId, input2, invokeOptions, commandName);
|
|
410388
|
+
const result2 = await invokeOperation2(opened.editor, operationId, input2, invokeOptions, commandName);
|
|
408622
410389
|
const document2 = {
|
|
408623
410390
|
path: source === "path" ? doc3 : undefined,
|
|
408624
410391
|
source,
|
|
@@ -408658,7 +410425,7 @@ async function executeMutationOperation(request) {
|
|
|
408658
410425
|
sessionPool: context.sessionPool
|
|
408659
410426
|
});
|
|
408660
410427
|
try {
|
|
408661
|
-
const result2 = invokeOperation2(opened.editor, operationId, input2, invokeOptions, commandName);
|
|
410428
|
+
const result2 = await invokeOperation2(opened.editor, operationId, input2, invokeOptions, commandName);
|
|
408662
410429
|
if (dryRun) {
|
|
408663
410430
|
const document3 = {
|
|
408664
410431
|
path: metadata.sourcePath,
|
|
@@ -411558,29 +413325,29 @@ var init_operation_args = __esm(() => {
|
|
|
411558
413325
|
});
|
|
411559
413326
|
|
|
411560
413327
|
// src/lib/payload.ts
|
|
411561
|
-
async function requireNodeAddressPayload(parsed, commandName,
|
|
411562
|
-
const payload = await resolveJsonInput(parsed,
|
|
413328
|
+
async function requireNodeAddressPayload(parsed, commandName, baseName2 = "address") {
|
|
413329
|
+
const payload = await resolveJsonInput(parsed, baseName2);
|
|
411563
413330
|
if (!payload) {
|
|
411564
|
-
throw new CliError("MISSING_REQUIRED", `${commandName}: provide --${
|
|
413331
|
+
throw new CliError("MISSING_REQUIRED", `${commandName}: provide --${baseName2}-json or --${baseName2}-file.`);
|
|
411565
413332
|
}
|
|
411566
|
-
return validateNodeAddress(payload,
|
|
413333
|
+
return validateNodeAddress(payload, baseName2);
|
|
411567
413334
|
}
|
|
411568
|
-
async function resolveListsListQueryPayload(parsed,
|
|
411569
|
-
const payload = await resolveJsonInput(parsed,
|
|
413335
|
+
async function resolveListsListQueryPayload(parsed, baseName2 = "query") {
|
|
413336
|
+
const payload = await resolveJsonInput(parsed, baseName2);
|
|
411570
413337
|
if (!payload)
|
|
411571
413338
|
return;
|
|
411572
|
-
return validateListsListQuery(payload,
|
|
413339
|
+
return validateListsListQuery(payload, baseName2);
|
|
411573
413340
|
}
|
|
411574
|
-
async function resolveListItemAddressPayload(parsed,
|
|
411575
|
-
const payload = await resolveJsonInput(parsed,
|
|
413341
|
+
async function resolveListItemAddressPayload(parsed, baseName2 = "target") {
|
|
413342
|
+
const payload = await resolveJsonInput(parsed, baseName2);
|
|
411576
413343
|
if (!payload)
|
|
411577
413344
|
return;
|
|
411578
|
-
return validateListItemAddress3(payload,
|
|
413345
|
+
return validateListItemAddress3(payload, baseName2);
|
|
411579
413346
|
}
|
|
411580
|
-
async function requireListItemAddressPayload(parsed, commandName,
|
|
411581
|
-
const payload = await resolveListItemAddressPayload(parsed,
|
|
413347
|
+
async function requireListItemAddressPayload(parsed, commandName, baseName2 = "target") {
|
|
413348
|
+
const payload = await resolveListItemAddressPayload(parsed, baseName2);
|
|
411582
413349
|
if (!payload) {
|
|
411583
|
-
throw new CliError("MISSING_REQUIRED", `${commandName}: provide --${
|
|
413350
|
+
throw new CliError("MISSING_REQUIRED", `${commandName}: provide --${baseName2}-json or --${baseName2}-file.`);
|
|
411584
413351
|
}
|
|
411585
413352
|
return payload;
|
|
411586
413353
|
}
|