@superdoc-dev/mcp 0.3.0-next.96 → 0.3.0-next.97
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 +1809 -156
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
51891
51891
|
emptyOptions2 = {};
|
|
51892
51892
|
});
|
|
51893
51893
|
|
|
51894
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
51894
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-Db6xeFxo.es.js
|
|
51895
51895
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
51896
51896
|
const fieldValue = extension$1.config[field];
|
|
51897
51897
|
if (typeof fieldValue === "function")
|
|
@@ -56705,7 +56705,12 @@ function buildDispatchTable(api2) {
|
|
|
56705
56705
|
"permissionRanges.get": (input) => api2.permissionRanges.get(input),
|
|
56706
56706
|
"permissionRanges.create": (input, options) => api2.permissionRanges.create(input, options),
|
|
56707
56707
|
"permissionRanges.remove": (input, options) => api2.permissionRanges.remove(input, options),
|
|
56708
|
-
"permissionRanges.updatePrincipal": (input, options) => api2.permissionRanges.updatePrincipal(input, options)
|
|
56708
|
+
"permissionRanges.updatePrincipal": (input, options) => api2.permissionRanges.updatePrincipal(input, options),
|
|
56709
|
+
"customXml.parts.list": (input) => api2.customXml.parts.list(input),
|
|
56710
|
+
"customXml.parts.get": (input) => api2.customXml.parts.get(input),
|
|
56711
|
+
"customXml.parts.create": (input, options) => api2.customXml.parts.create(input, options),
|
|
56712
|
+
"customXml.parts.patch": (input, options) => api2.customXml.parts.patch(input, options),
|
|
56713
|
+
"customXml.parts.remove": (input, options) => api2.customXml.parts.remove(input, options)
|
|
56709
56714
|
};
|
|
56710
56715
|
}
|
|
56711
56716
|
function executeHistoryGet(adapter) {
|
|
@@ -58258,6 +58263,61 @@ function executeBookmarksRemove(adapter, input, options) {
|
|
|
58258
58263
|
validateBookmarkTarget(input.target, "bookmarks.remove");
|
|
58259
58264
|
return adapter.remove(input, normalizeMutationOptions(options));
|
|
58260
58265
|
}
|
|
58266
|
+
function validateTarget(target, operationName) {
|
|
58267
|
+
if (!target || typeof target !== "object")
|
|
58268
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a target with either { id } or { partName }.`, { target });
|
|
58269
|
+
const t = target;
|
|
58270
|
+
const hasId = typeof t.id === "string" && t.id.length > 0;
|
|
58271
|
+
const hasPartName = typeof t.partName === "string" && t.partName.length > 0;
|
|
58272
|
+
if (!hasId && !hasPartName)
|
|
58273
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must have a non-empty 'id' or 'partName'.`, { target });
|
|
58274
|
+
if (hasId && hasPartName)
|
|
58275
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must not provide both 'id' and 'partName'; choose one.`, { target });
|
|
58276
|
+
}
|
|
58277
|
+
function validateContent(content$2, operationName) {
|
|
58278
|
+
if (typeof content$2 !== "string" || content$2.length === 0)
|
|
58279
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a non-empty 'content' string of well-formed XML.`, { contentType: typeof content$2 });
|
|
58280
|
+
if (!/<\s*[A-Za-z_]/.test(content$2))
|
|
58281
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'content' does not contain a root XML element.`);
|
|
58282
|
+
}
|
|
58283
|
+
function validateSchemaRefs(schemaRefs, operationName) {
|
|
58284
|
+
if (!Array.isArray(schemaRefs))
|
|
58285
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'schemaRefs' must be an array of strings.`);
|
|
58286
|
+
for (const [i$1, entry] of schemaRefs.entries())
|
|
58287
|
+
if (typeof entry !== "string" || entry.length === 0)
|
|
58288
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} 'schemaRefs[${i$1}]' must be a non-empty string.`);
|
|
58289
|
+
}
|
|
58290
|
+
function executeCustomXmlPartsList(adapter, query) {
|
|
58291
|
+
if (query?.rootNamespace !== undefined && typeof query.rootNamespace !== "string")
|
|
58292
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `customXml.parts.list 'rootNamespace' must be a string when provided.`);
|
|
58293
|
+
if (query?.schemaRef !== undefined && typeof query.schemaRef !== "string")
|
|
58294
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `customXml.parts.list 'schemaRef' must be a string when provided.`);
|
|
58295
|
+
return adapter.list(query);
|
|
58296
|
+
}
|
|
58297
|
+
function executeCustomXmlPartsGet(adapter, input) {
|
|
58298
|
+
validateTarget(input.target, "customXml.parts.get");
|
|
58299
|
+
return adapter.get(input);
|
|
58300
|
+
}
|
|
58301
|
+
function executeCustomXmlPartsCreate(adapter, input, options) {
|
|
58302
|
+
validateContent(input.content, "customXml.parts.create");
|
|
58303
|
+
if (input.schemaRefs !== undefined)
|
|
58304
|
+
validateSchemaRefs(input.schemaRefs, "customXml.parts.create");
|
|
58305
|
+
return adapter.create(input, normalizeMutationOptions(options));
|
|
58306
|
+
}
|
|
58307
|
+
function executeCustomXmlPartsPatch(adapter, input, options) {
|
|
58308
|
+
validateTarget(input.target, "customXml.parts.patch");
|
|
58309
|
+
if (input.content === undefined && input.schemaRefs === undefined)
|
|
58310
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `customXml.parts.patch requires at least one of 'content' or 'schemaRefs'.`);
|
|
58311
|
+
if (input.content !== undefined)
|
|
58312
|
+
validateContent(input.content, "customXml.parts.patch");
|
|
58313
|
+
if (input.schemaRefs !== undefined)
|
|
58314
|
+
validateSchemaRefs(input.schemaRefs, "customXml.parts.patch");
|
|
58315
|
+
return adapter.patch(input, normalizeMutationOptions(options));
|
|
58316
|
+
}
|
|
58317
|
+
function executeCustomXmlPartsRemove(adapter, input, options) {
|
|
58318
|
+
validateTarget(input.target, "customXml.parts.remove");
|
|
58319
|
+
return adapter.remove(input, normalizeMutationOptions(options));
|
|
58320
|
+
}
|
|
58261
58321
|
function validateSetEditingRestrictionInput(input) {
|
|
58262
58322
|
if (!input || typeof input !== "object")
|
|
58263
58323
|
throw new DocumentApiValidationError("INVALID_INPUT", "protection.setEditingRestriction requires an object with a mode property.");
|
|
@@ -59866,6 +59926,23 @@ function createDocumentApi(adapters) {
|
|
|
59866
59926
|
return executePermissionRangesUpdatePrincipal(adapters.permissionRanges, input, options);
|
|
59867
59927
|
}
|
|
59868
59928
|
},
|
|
59929
|
+
customXml: { parts: {
|
|
59930
|
+
list(input) {
|
|
59931
|
+
return executeCustomXmlPartsList(requireAdapter(adapters.customXml, "customXml").parts, input);
|
|
59932
|
+
},
|
|
59933
|
+
get(input) {
|
|
59934
|
+
return executeCustomXmlPartsGet(requireAdapter(adapters.customXml, "customXml").parts, input);
|
|
59935
|
+
},
|
|
59936
|
+
create(input, options) {
|
|
59937
|
+
return executeCustomXmlPartsCreate(requireAdapter(adapters.customXml, "customXml").parts, input, options);
|
|
59938
|
+
},
|
|
59939
|
+
patch(input, options) {
|
|
59940
|
+
return executeCustomXmlPartsPatch(requireAdapter(adapters.customXml, "customXml").parts, input, options);
|
|
59941
|
+
},
|
|
59942
|
+
remove(input, options) {
|
|
59943
|
+
return executeCustomXmlPartsRemove(requireAdapter(adapters.customXml, "customXml").parts, input, options);
|
|
59944
|
+
}
|
|
59945
|
+
} },
|
|
59869
59946
|
invoke(request) {
|
|
59870
59947
|
if (!Object.prototype.hasOwnProperty.call(dispatch, request.operationId))
|
|
59871
59948
|
throw new Error(`Unknown operationId: "${request.operationId}"`);
|
|
@@ -90695,7 +90772,7 @@ var isRegExp = (value) => {
|
|
|
90695
90772
|
tracked: false,
|
|
90696
90773
|
carrier: runAttributeCarrier(runPropertyKey ?? key),
|
|
90697
90774
|
schema
|
|
90698
|
-
}), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, TABLE_COLOR_PATTERN_SOURCE = "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$", TABLE_COLOR_PATTERN, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, tableBorderColorPattern, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQueryProperties, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$218) => ({
|
|
90775
|
+
}), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, TABLE_COLOR_PATTERN_SOURCE = "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$", TABLE_COLOR_PATTERN, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, tableBorderColorPattern, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQueryProperties, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, customXmlPartTargetSchema, customXmlPartMutation, customXmlPartCreateMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$218) => ({
|
|
90699
90776
|
handlerName,
|
|
90700
90777
|
handler: (params) => {
|
|
90701
90778
|
const { nodes } = params;
|
|
@@ -105551,7 +105628,7 @@ var isRegExp = (value) => {
|
|
|
105551
105628
|
state.kern = kernNode.attributes["w:val"];
|
|
105552
105629
|
}
|
|
105553
105630
|
}, SuperConverter;
|
|
105554
|
-
var
|
|
105631
|
+
var init_SuperConverter_Db6xeFxo_es = __esm(() => {
|
|
105555
105632
|
init_rolldown_runtime_Bg48TavK_es();
|
|
105556
105633
|
init_jszip_C49i9kUs_es();
|
|
105557
105634
|
init_xml_js_CqGKpaft_es();
|
|
@@ -114057,6 +114134,72 @@ var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
|
114057
114134
|
referenceDocPath: "permission-ranges/update-principal.mdx",
|
|
114058
114135
|
referenceGroup: "permissionRanges",
|
|
114059
114136
|
skipAsATool: true
|
|
114137
|
+
},
|
|
114138
|
+
"customXml.parts.list": {
|
|
114139
|
+
memberPath: "customXml.parts.list",
|
|
114140
|
+
description: "List Custom XML Data Storage Parts in the document, optionally filtered by root namespace or schema reference.",
|
|
114141
|
+
expectedResult: "Returns a CustomXmlPartsListResult with summary entries (no content); fetch content via get.",
|
|
114142
|
+
requiresDocumentContext: true,
|
|
114143
|
+
metadata: readOperation({
|
|
114144
|
+
idempotency: "idempotent",
|
|
114145
|
+
throws: T_REF_READ_LIST
|
|
114146
|
+
}),
|
|
114147
|
+
referenceDocPath: "custom-xml/parts/list.mdx",
|
|
114148
|
+
referenceGroup: "customXml"
|
|
114149
|
+
},
|
|
114150
|
+
"customXml.parts.get": {
|
|
114151
|
+
memberPath: "customXml.parts.get",
|
|
114152
|
+
description: "Get a single Custom XML Data Storage Part by itemID or package part name, including its full content. v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
114153
|
+
expectedResult: "Returns a CustomXmlPartInfo with id, partName, namespaces, schemaRefs, and content; or null if not found.",
|
|
114154
|
+
requiresDocumentContext: true,
|
|
114155
|
+
metadata: readOperation({ throws: T_NOT_FOUND_CAPABLE }),
|
|
114156
|
+
referenceDocPath: "custom-xml/parts/get.mdx",
|
|
114157
|
+
referenceGroup: "customXml"
|
|
114158
|
+
},
|
|
114159
|
+
"customXml.parts.create": {
|
|
114160
|
+
memberPath: "customXml.parts.create",
|
|
114161
|
+
description: "Add a new Custom XML Data Storage Part to the document. Generates a fresh itemID GUID and emits the Properties Part.",
|
|
114162
|
+
expectedResult: "Returns a CustomXmlPartsCreateResult with the generated id and package part names on success.",
|
|
114163
|
+
requiresDocumentContext: true,
|
|
114164
|
+
metadata: mutationOperation({
|
|
114165
|
+
idempotency: "non-idempotent",
|
|
114166
|
+
supportsDryRun: true,
|
|
114167
|
+
supportsTrackedMode: false,
|
|
114168
|
+
possibleFailureCodes: ["INVALID_INPUT"],
|
|
114169
|
+
throws: T_REF_INSERT
|
|
114170
|
+
}),
|
|
114171
|
+
referenceDocPath: "custom-xml/parts/create.mdx",
|
|
114172
|
+
referenceGroup: "customXml"
|
|
114173
|
+
},
|
|
114174
|
+
"customXml.parts.patch": {
|
|
114175
|
+
memberPath: "customXml.parts.patch",
|
|
114176
|
+
description: "Replace the content and/or schemaRefs of an existing Custom XML Data Storage Part. At least one of content or schemaRefs is required. v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
114177
|
+
expectedResult: "Returns a CustomXmlPartsMutationResult indicating success with the resolved target or a failure.",
|
|
114178
|
+
requiresDocumentContext: true,
|
|
114179
|
+
metadata: mutationOperation({
|
|
114180
|
+
idempotency: "idempotent",
|
|
114181
|
+
supportsDryRun: true,
|
|
114182
|
+
supportsTrackedMode: false,
|
|
114183
|
+
possibleFailureCodes: ["TARGET_NOT_FOUND", "INVALID_INPUT"],
|
|
114184
|
+
throws: T_REF_MUTATION
|
|
114185
|
+
}),
|
|
114186
|
+
referenceDocPath: "custom-xml/parts/patch.mdx",
|
|
114187
|
+
referenceGroup: "customXml"
|
|
114188
|
+
},
|
|
114189
|
+
"customXml.parts.remove": {
|
|
114190
|
+
memberPath: "customXml.parts.remove",
|
|
114191
|
+
description: "Remove a Custom XML Data Storage Part and clean up all linked package files (item, props, rels, content-types entry). v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
114192
|
+
expectedResult: "Returns a CustomXmlPartsMutationResult indicating success or a failure.",
|
|
114193
|
+
requiresDocumentContext: true,
|
|
114194
|
+
metadata: mutationOperation({
|
|
114195
|
+
idempotency: "non-idempotent",
|
|
114196
|
+
supportsDryRun: true,
|
|
114197
|
+
supportsTrackedMode: false,
|
|
114198
|
+
possibleFailureCodes: ["TARGET_NOT_FOUND"],
|
|
114199
|
+
throws: T_REF_MUTATION_REMOVE
|
|
114200
|
+
}),
|
|
114201
|
+
referenceDocPath: "custom-xml/parts/remove.mdx",
|
|
114202
|
+
referenceGroup: "customXml"
|
|
114060
114203
|
}
|
|
114061
114204
|
};
|
|
114062
114205
|
OPERATION_IDS = Object.freeze(Object.keys(OPERATION_DEFINITIONS));
|
|
@@ -116312,6 +116455,29 @@ var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
|
116312
116455
|
"name"
|
|
116313
116456
|
]);
|
|
116314
116457
|
bookmarkMutation = refMutationSchemas({ bookmark: bookmarkAddressSchema }, ["bookmark"]);
|
|
116458
|
+
customXmlPartTargetSchema = { oneOf: [objectSchema({ id: {
|
|
116459
|
+
type: "string",
|
|
116460
|
+
minLength: 1
|
|
116461
|
+
} }, ["id"]), objectSchema({ partName: {
|
|
116462
|
+
type: "string",
|
|
116463
|
+
minLength: 1
|
|
116464
|
+
} }, ["partName"])] };
|
|
116465
|
+
customXmlPartMutation = refMutationSchemas({
|
|
116466
|
+
target: customXmlPartTargetSchema,
|
|
116467
|
+
id: {
|
|
116468
|
+
type: "string",
|
|
116469
|
+
minLength: 1
|
|
116470
|
+
}
|
|
116471
|
+
}, ["target"]);
|
|
116472
|
+
customXmlPartCreateMutation = refMutationSchemas({
|
|
116473
|
+
id: { type: "string" },
|
|
116474
|
+
partName: { type: "string" },
|
|
116475
|
+
propsPartName: { type: "string" }
|
|
116476
|
+
}, [
|
|
116477
|
+
"id",
|
|
116478
|
+
"partName",
|
|
116479
|
+
"propsPartName"
|
|
116480
|
+
]);
|
|
116315
116481
|
footnoteAddressSchema = objectSchema({
|
|
116316
116482
|
kind: { const: "entity" },
|
|
116317
116483
|
entityType: { const: "footnote" },
|
|
@@ -120216,7 +120382,23 @@ var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
|
120216
120382
|
},
|
|
120217
120383
|
id: { type: "string" }
|
|
120218
120384
|
}, ["kind"])
|
|
120219
|
-
}, ["id", "principal"])
|
|
120385
|
+
}, ["id", "principal"]), objectSchema({
|
|
120386
|
+
...refListQueryProperties,
|
|
120387
|
+
rootNamespace: { type: "string" },
|
|
120388
|
+
schemaRef: { type: "string" }
|
|
120389
|
+
}), objectSchema({ target: customXmlPartTargetSchema }, ["target"]), objectSchema({
|
|
120390
|
+
content: {
|
|
120391
|
+
type: "string",
|
|
120392
|
+
minLength: 1
|
|
120393
|
+
},
|
|
120394
|
+
schemaRefs: {
|
|
120395
|
+
type: "array",
|
|
120396
|
+
items: {
|
|
120397
|
+
type: "string",
|
|
120398
|
+
minLength: 1
|
|
120399
|
+
}
|
|
120400
|
+
}
|
|
120401
|
+
}, ["content"]), { ...customXmlPartCreateMutation }, { ...customXmlPartMutation }, objectSchema({ target: customXmlPartTargetSchema }, ["target"]), { ...customXmlPartMutation };
|
|
120220
120402
|
projectFromDefinitions((_id, entry) => entry.memberPath);
|
|
120221
120403
|
[...new Set(OPERATION_IDS.map((id) => OPERATION_DEFINITIONS[id].memberPath))];
|
|
120222
120404
|
projectFromDefinitions((_id, entry) => entry.referenceDocPath);
|
|
@@ -120390,6 +120572,11 @@ var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
|
120390
120572
|
title: "Permission Ranges",
|
|
120391
120573
|
description: "Permission range exception operations for protected documents.",
|
|
120392
120574
|
pagePath: "permission-ranges/index.mdx"
|
|
120575
|
+
},
|
|
120576
|
+
customXml: {
|
|
120577
|
+
title: "Custom XML",
|
|
120578
|
+
description: "Custom XML Data Storage Part operations (ECMA-376 §15.2.5, §15.2.6). Raw read and write of custom XML parts in the OOXML package.",
|
|
120579
|
+
pagePath: "custom-xml/index.mdx"
|
|
120393
120580
|
}
|
|
120394
120581
|
};
|
|
120395
120582
|
Object.keys(GROUP_METADATA).map((key) => ({
|
|
@@ -143431,7 +143618,7 @@ var init_SuperConverter_1Voea3gd_es = __esm(() => {
|
|
|
143431
143618
|
};
|
|
143432
143619
|
});
|
|
143433
143620
|
|
|
143434
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
143621
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-BongFwHh.es.js
|
|
143435
143622
|
function parseSizeUnit(val = "0") {
|
|
143436
143623
|
const length = val.toString() || "0";
|
|
143437
143624
|
const value = Number.parseFloat(length);
|
|
@@ -146153,8 +146340,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
146153
146340
|
}
|
|
146154
146341
|
};
|
|
146155
146342
|
};
|
|
146156
|
-
var
|
|
146157
|
-
|
|
146343
|
+
var init_create_headless_toolbar_BongFwHh_es = __esm(() => {
|
|
146344
|
+
init_SuperConverter_Db6xeFxo_es();
|
|
146158
146345
|
init_constants_DrU4EASo_es();
|
|
146159
146346
|
init_dist_B8HfvhaK_es();
|
|
146160
146347
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -147601,7 +147788,7 @@ var init_decrypt_docx_4kQ488M9_es = __esm(() => {
|
|
|
147601
147788
|
]);
|
|
147602
147789
|
});
|
|
147603
147790
|
|
|
147604
|
-
// ../../packages/superdoc/dist/chunks/DocxZipper-
|
|
147791
|
+
// ../../packages/superdoc/dist/chunks/DocxZipper-Bphhij1P.es.js
|
|
147605
147792
|
function sniffEncoding(u8) {
|
|
147606
147793
|
if (u8.length >= 2) {
|
|
147607
147794
|
const b0 = u8[0], b1 = u8[1];
|
|
@@ -148098,6 +148285,19 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
148098
148285
|
const staleOverridePartNames = COMMENT_FILE_BASENAMES.map((name) => `/word/${name}`).filter((partName) => {
|
|
148099
148286
|
return !hasFile(partName.slice(1));
|
|
148100
148287
|
});
|
|
148288
|
+
const CUSTOM_XML_PROPS_CT = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml";
|
|
148289
|
+
if (types2?.elements?.length)
|
|
148290
|
+
for (const el of types2.elements) {
|
|
148291
|
+
if (el?.name !== "Override")
|
|
148292
|
+
continue;
|
|
148293
|
+
if (el?.attributes?.ContentType !== CUSTOM_XML_PROPS_CT)
|
|
148294
|
+
continue;
|
|
148295
|
+
const partName = el?.attributes?.PartName;
|
|
148296
|
+
if (typeof partName !== "string" || !partName.startsWith("/"))
|
|
148297
|
+
continue;
|
|
148298
|
+
if (!hasFile(partName.slice(1)))
|
|
148299
|
+
staleOverridePartNames.push(partName);
|
|
148300
|
+
}
|
|
148101
148301
|
const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
|
|
148102
148302
|
let updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
|
|
148103
148303
|
for (const partName of staleOverridePartNames) {
|
|
@@ -148261,7 +148461,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
148261
148461
|
return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
|
|
148262
148462
|
}
|
|
148263
148463
|
}, DocxZipper_default;
|
|
148264
|
-
var
|
|
148464
|
+
var init_DocxZipper_Bphhij1P_es = __esm(() => {
|
|
148265
148465
|
init_rolldown_runtime_Bg48TavK_es();
|
|
148266
148466
|
init_jszip_C49i9kUs_es();
|
|
148267
148467
|
init_xml_js_CqGKpaft_es();
|
|
@@ -200373,7 +200573,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
200373
200573
|
init_remark_gfm_BhnWr3yf_es();
|
|
200374
200574
|
});
|
|
200375
200575
|
|
|
200376
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
200576
|
+
// ../../packages/superdoc/dist/chunks/src-ChfKFC3W.es.js
|
|
200377
200577
|
function deleteProps(obj, propOrProps) {
|
|
200378
200578
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
200379
200579
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -200623,9 +200823,9 @@ function getParagraphInlineDirection(attrs) {
|
|
|
200623
200823
|
if (fromContext != null)
|
|
200624
200824
|
return fromContext;
|
|
200625
200825
|
const ppRtl = attrs?.paragraphProperties?.rightToLeft;
|
|
200626
|
-
if (
|
|
200826
|
+
if (ppRtl === true)
|
|
200627
200827
|
return "rtl";
|
|
200628
|
-
if (
|
|
200828
|
+
if (ppRtl === false)
|
|
200629
200829
|
return "ltr";
|
|
200630
200830
|
}
|
|
200631
200831
|
function getTableVisualDirection(attrs) {
|
|
@@ -202538,11 +202738,11 @@ function syncSplitParagraphRunProperties(attrs, runProperties) {
|
|
|
202538
202738
|
paragraphProperties: nextParagraphProperties
|
|
202539
202739
|
};
|
|
202540
202740
|
}
|
|
202541
|
-
function getConverter$
|
|
202741
|
+
function getConverter$82(editor) {
|
|
202542
202742
|
return editor.converter;
|
|
202543
202743
|
}
|
|
202544
202744
|
function readTranslatedLinkedStyles(editor) {
|
|
202545
|
-
return getConverter$
|
|
202745
|
+
return getConverter$82(editor)?.translatedLinkedStyles ?? null;
|
|
202546
202746
|
}
|
|
202547
202747
|
function isHeadingStyleId$1(styleId) {
|
|
202548
202748
|
return typeof styleId === "string" && /^heading\s*[1-6]$/i.test(styleId.trim());
|
|
@@ -223502,7 +223702,7 @@ function makeTrackedChangeAnchorKey(ref$1) {
|
|
|
223502
223702
|
function makeCommentAnchorKey(commentId) {
|
|
223503
223703
|
return `${COMMENT_ANCHOR_KEY_PREFIX}${commentId}`;
|
|
223504
223704
|
}
|
|
223505
|
-
function getConverter$
|
|
223705
|
+
function getConverter$72(editor) {
|
|
223506
223706
|
return editor.converter;
|
|
223507
223707
|
}
|
|
223508
223708
|
function toRevisionCapableNoteId(note) {
|
|
@@ -223519,7 +223719,7 @@ function enumerateRevisionCapableStories(editor) {
|
|
|
223519
223719
|
kind: "story",
|
|
223520
223720
|
storyType: "body"
|
|
223521
223721
|
}];
|
|
223522
|
-
const converter = getConverter$
|
|
223722
|
+
const converter = getConverter$72(editor);
|
|
223523
223723
|
if (!converter)
|
|
223524
223724
|
return stories;
|
|
223525
223725
|
if (converter.headers)
|
|
@@ -227609,15 +227809,15 @@ function previewPlan(editor, input2) {
|
|
|
227609
227809
|
}
|
|
227610
227810
|
stepPreviews.push(preview);
|
|
227611
227811
|
}
|
|
227612
|
-
for (const failure of assertFailures)
|
|
227812
|
+
for (const failure$1 of assertFailures)
|
|
227613
227813
|
failures.push({
|
|
227614
227814
|
code: "PRECONDITION_FAILED",
|
|
227615
|
-
stepId: failure.stepId,
|
|
227815
|
+
stepId: failure$1.stepId,
|
|
227616
227816
|
phase: "assert",
|
|
227617
|
-
message: `assert "${failure.stepId}" expected ${failure.expectedCount} matches but found ${failure.actualCount}`,
|
|
227817
|
+
message: `assert "${failure$1.stepId}" expected ${failure$1.expectedCount} matches but found ${failure$1.actualCount}`,
|
|
227618
227818
|
details: {
|
|
227619
|
-
expectedCount: failure.expectedCount,
|
|
227620
|
-
actualCount: failure.actualCount
|
|
227819
|
+
expectedCount: failure$1.expectedCount,
|
|
227820
|
+
actualCount: failure$1.actualCount
|
|
227621
227821
|
}
|
|
227622
227822
|
});
|
|
227623
227823
|
} catch (error48) {
|
|
@@ -232009,10 +232209,10 @@ function registerBuiltInExecutors() {
|
|
|
232009
232209
|
};
|
|
232010
232210
|
} });
|
|
232011
232211
|
}
|
|
232012
|
-
function getConverter$
|
|
232212
|
+
function getConverter$62(editor) {
|
|
232013
232213
|
return editor.converter;
|
|
232014
232214
|
}
|
|
232015
|
-
function getConverter$
|
|
232215
|
+
function getConverter$52(editor) {
|
|
232016
232216
|
return editor.converter;
|
|
232017
232217
|
}
|
|
232018
232218
|
function createEmptyHeaderFooterJson() {
|
|
@@ -232025,7 +232225,7 @@ function createEmptyHeaderFooterJson() {
|
|
|
232025
232225
|
};
|
|
232026
232226
|
}
|
|
232027
232227
|
function syncHeaderFooterCaches(editor, part) {
|
|
232028
|
-
const converter = getConverter$
|
|
232228
|
+
const converter = getConverter$52(editor);
|
|
232029
232229
|
if (!converter)
|
|
232030
232230
|
return;
|
|
232031
232231
|
const relsRoot = part?.elements?.find((el) => el.name === "Relationships");
|
|
@@ -232087,7 +232287,7 @@ function createTableWrapper(editor, input2, options) {
|
|
|
232087
232287
|
});
|
|
232088
232288
|
return adapterResult;
|
|
232089
232289
|
}
|
|
232090
|
-
function getConverter$
|
|
232290
|
+
function getConverter$42(editor) {
|
|
232091
232291
|
return editor.converter;
|
|
232092
232292
|
}
|
|
232093
232293
|
function toSectionFailure2(code7, message) {
|
|
@@ -232155,7 +232355,7 @@ function buildSectionMarginsForAttrs2(sectPr) {
|
|
|
232155
232355
|
};
|
|
232156
232356
|
}
|
|
232157
232357
|
function syncConverterBodySection2(editor, sectPr) {
|
|
232158
|
-
const converter = getConverter$
|
|
232358
|
+
const converter = getConverter$42(editor);
|
|
232159
232359
|
if (!converter)
|
|
232160
232360
|
return;
|
|
232161
232361
|
converter.bodySectPr = cloneXmlElement(sectPr);
|
|
@@ -232275,7 +232475,7 @@ function createSectionBreakNode(editor, breakParagraphId, input2) {
|
|
|
232275
232475
|
return paragraphNode;
|
|
232276
232476
|
}
|
|
232277
232477
|
function updateGlobalTitlePageFlag(editor) {
|
|
232278
|
-
const converter = getConverter$
|
|
232478
|
+
const converter = getConverter$42(editor);
|
|
232279
232479
|
if (!converter)
|
|
232280
232480
|
return;
|
|
232281
232481
|
const anyTitlePage = resolveSectionProjections(editor).some((entry) => entry.domain.titlePage === true);
|
|
@@ -232359,7 +232559,7 @@ function sectionsSetTitlePageAdapter(editor, input2, options) {
|
|
|
232359
232559
|
}
|
|
232360
232560
|
function sectionsSetOddEvenHeadersFootersAdapter(editor, input2, options) {
|
|
232361
232561
|
rejectTrackedMode("sections.setOddEvenHeadersFooters", options);
|
|
232362
|
-
const converter = getConverter$
|
|
232562
|
+
const converter = getConverter$42(editor);
|
|
232363
232563
|
if (!converter)
|
|
232364
232564
|
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "sections.setOddEvenHeadersFooters requires an active document converter.");
|
|
232365
232565
|
return mutatePart({
|
|
@@ -232395,13 +232595,13 @@ function sectionsSetSectionDirectionAdapter(editor, input2, options) {
|
|
|
232395
232595
|
}
|
|
232396
232596
|
function sectionsSetHeaderFooterRefAdapter(editor, input2, options) {
|
|
232397
232597
|
return sectionMutationBySectPr$1(editor, input2, options, "sections.setHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
|
|
232398
|
-
const converter = getConverter$
|
|
232598
|
+
const converter = getConverter$42(editor) ?? null;
|
|
232399
232599
|
return setHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, input2.refId, converter, "sections.setHeaderFooterRef", dryRun);
|
|
232400
232600
|
});
|
|
232401
232601
|
}
|
|
232402
232602
|
function sectionsClearHeaderFooterRefAdapter(editor, input2, options) {
|
|
232403
232603
|
return sectionMutationBySectPr$1(editor, input2, options, "sections.clearHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
|
|
232404
|
-
const converter = getConverter$
|
|
232604
|
+
const converter = getConverter$42(editor) ?? null;
|
|
232405
232605
|
clearHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, converter, dryRun);
|
|
232406
232606
|
});
|
|
232407
232607
|
}
|
|
@@ -237030,11 +237230,11 @@ function createContentControlsAdapter(editor) {
|
|
|
237030
237230
|
create: (input2, options) => createWrapper(editor, input2, options)
|
|
237031
237231
|
};
|
|
237032
237232
|
}
|
|
237033
|
-
function getConverter$
|
|
237233
|
+
function getConverter$32(editor) {
|
|
237034
237234
|
return editor.converter;
|
|
237035
237235
|
}
|
|
237036
237236
|
function requireConverter$1(editor, operationName) {
|
|
237037
|
-
const converter = getConverter$
|
|
237237
|
+
const converter = getConverter$32(editor);
|
|
237038
237238
|
if (!converter)
|
|
237039
237239
|
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${operationName} requires an active document converter.`);
|
|
237040
237240
|
return converter;
|
|
@@ -237140,7 +237340,7 @@ function headerFootersResolveAdapter(editor, input2) {
|
|
|
237140
237340
|
function headerFootersRefsSetAdapter(editor, input2, options) {
|
|
237141
237341
|
const { section, headerFooterKind, variant } = input2.target;
|
|
237142
237342
|
const result = sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.set", (sectPr, _projection, _sections, dryRun) => {
|
|
237143
|
-
const converter = getConverter$
|
|
237343
|
+
const converter = getConverter$32(editor) ?? null;
|
|
237144
237344
|
return setHeaderFooterRefMutation(sectPr, headerFooterKind, variant, input2.refId, converter, "headerFooters.refs.set", dryRun);
|
|
237145
237345
|
});
|
|
237146
237346
|
invalidateSlotRuntimesAfterRefChange(editor, result, options);
|
|
@@ -237149,7 +237349,7 @@ function headerFootersRefsSetAdapter(editor, input2, options) {
|
|
|
237149
237349
|
function headerFootersRefsClearAdapter(editor, input2, options) {
|
|
237150
237350
|
const { section, headerFooterKind, variant } = input2.target;
|
|
237151
237351
|
const result = sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.clear", (sectPr, _projection, _sections, dryRun) => {
|
|
237152
|
-
clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter$
|
|
237352
|
+
clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter$32(editor) ?? null, dryRun);
|
|
237153
237353
|
});
|
|
237154
237354
|
invalidateSlotRuntimesAfterRefChange(editor, result, options);
|
|
237155
237355
|
return result;
|
|
@@ -237985,6 +238185,672 @@ function bookmarksRemoveWrapper(editor, input2, options) {
|
|
|
237985
238185
|
disposeEphemeralWriteRuntime(runtime);
|
|
237986
238186
|
}
|
|
237987
238187
|
}
|
|
238188
|
+
function executeOutOfBandMutation(editor, mutateFn, options) {
|
|
238189
|
+
if (!options.dryRun)
|
|
238190
|
+
if (editor.options?.collaborationProvider && editor.options?.ydoc)
|
|
238191
|
+
try {
|
|
238192
|
+
yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing();
|
|
238193
|
+
} catch {}
|
|
238194
|
+
else
|
|
238195
|
+
try {
|
|
238196
|
+
editor.view?.dispatch?.(closeHistory(editor.state.tr));
|
|
238197
|
+
} catch {}
|
|
238198
|
+
checkRevision(editor, options.expectedRevision);
|
|
238199
|
+
const result = mutateFn(options.dryRun);
|
|
238200
|
+
if (result.changed && !options.dryRun) {
|
|
238201
|
+
const converter = editor.converter;
|
|
238202
|
+
if (converter) {
|
|
238203
|
+
converter.documentModified = true;
|
|
238204
|
+
if (!converter.documentGuid && typeof converter.promoteToGuid === "function")
|
|
238205
|
+
converter.promoteToGuid();
|
|
238206
|
+
}
|
|
238207
|
+
incrementRevision(editor);
|
|
238208
|
+
}
|
|
238209
|
+
return result.payload;
|
|
238210
|
+
}
|
|
238211
|
+
function getLocalName2(name) {
|
|
238212
|
+
if (!name || typeof name !== "string")
|
|
238213
|
+
return "";
|
|
238214
|
+
const i4 = name.indexOf(":");
|
|
238215
|
+
return i4 >= 0 ? name.slice(i4 + 1) : name;
|
|
238216
|
+
}
|
|
238217
|
+
function findFirstElement(parent, localName) {
|
|
238218
|
+
if (!parent?.elements?.length)
|
|
238219
|
+
return null;
|
|
238220
|
+
return parent.elements.find((el) => el?.type === "element" && getLocalName2(el.name) === localName) ?? null;
|
|
238221
|
+
}
|
|
238222
|
+
function findAllElements(parent, localName) {
|
|
238223
|
+
if (!parent?.elements?.length)
|
|
238224
|
+
return [];
|
|
238225
|
+
return parent.elements.filter((el) => el?.type === "element" && getLocalName2(el.name) === localName);
|
|
238226
|
+
}
|
|
238227
|
+
function partNameFromIndex(index2) {
|
|
238228
|
+
return `customXml/item${index2}.xml`;
|
|
238229
|
+
}
|
|
238230
|
+
function propsPartNameFromIndex(index2) {
|
|
238231
|
+
return `customXml/itemProps${index2}.xml`;
|
|
238232
|
+
}
|
|
238233
|
+
function indexFromPartName(partName) {
|
|
238234
|
+
const m$1 = /^customXml\/item(\d+)\.xml$/i.exec(partName ?? "");
|
|
238235
|
+
return m$1 ? Number.parseInt(m$1[1], 10) : null;
|
|
238236
|
+
}
|
|
238237
|
+
function indexFromPropsPartName(propsPartName) {
|
|
238238
|
+
const m$1 = /^customXml\/itemProps(\d+)\.xml$/i.exec(propsPartName ?? "");
|
|
238239
|
+
return m$1 ? Number.parseInt(m$1[1], 10) : null;
|
|
238240
|
+
}
|
|
238241
|
+
function isCustomXmlStoragePartName(partName) {
|
|
238242
|
+
return indexFromPartName(partName) != null;
|
|
238243
|
+
}
|
|
238244
|
+
function listCustomXmlStoragePartNames(convertedXml) {
|
|
238245
|
+
if (!convertedXml || typeof convertedXml !== "object")
|
|
238246
|
+
return [];
|
|
238247
|
+
const indexes = [];
|
|
238248
|
+
for (const path2 of Object.keys(convertedXml)) {
|
|
238249
|
+
const idx = indexFromPartName(path2);
|
|
238250
|
+
if (idx != null)
|
|
238251
|
+
indexes.push(idx);
|
|
238252
|
+
}
|
|
238253
|
+
indexes.sort((a2, b$1) => a2 - b$1);
|
|
238254
|
+
return indexes.map(partNameFromIndex);
|
|
238255
|
+
}
|
|
238256
|
+
function findPropsPartFor(convertedXml, partName) {
|
|
238257
|
+
if (!convertedXml)
|
|
238258
|
+
return null;
|
|
238259
|
+
const idx = indexFromPartName(partName);
|
|
238260
|
+
if (idx == null)
|
|
238261
|
+
return null;
|
|
238262
|
+
const relsRoot = convertedXml[`customXml/_rels/item${idx}.xml.rels`]?.elements?.find((el) => getLocalName2(el?.name) === "Relationships");
|
|
238263
|
+
if (relsRoot?.elements?.length)
|
|
238264
|
+
for (const rel of relsRoot.elements) {
|
|
238265
|
+
if (rel?.attributes?.Type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps")
|
|
238266
|
+
continue;
|
|
238267
|
+
const target = rel?.attributes?.Target;
|
|
238268
|
+
if (typeof target !== "string" || target.length === 0)
|
|
238269
|
+
continue;
|
|
238270
|
+
const candidate = resolveOpcTargetPath(target, "customXml");
|
|
238271
|
+
if (candidate && convertedXml[candidate])
|
|
238272
|
+
return candidate;
|
|
238273
|
+
}
|
|
238274
|
+
const indexCandidate = propsPartNameFromIndex(idx);
|
|
238275
|
+
return convertedXml[indexCandidate] ? indexCandidate : null;
|
|
238276
|
+
}
|
|
238277
|
+
function parsePropsPart(propsDoc) {
|
|
238278
|
+
const root3 = propsDoc?.elements?.find((el) => el?.type === "element" && getLocalName2(el.name) === "datastoreItem");
|
|
238279
|
+
if (!root3)
|
|
238280
|
+
return null;
|
|
238281
|
+
const itemId = root3.attributes?.["ds:itemID"] ?? root3.attributes?.itemID ?? null;
|
|
238282
|
+
const schemaRefs = findAllElements(findFirstElement(root3, "schemaRefs"), "schemaRef").map((el) => el.attributes?.["ds:uri"] ?? el.attributes?.uri ?? null).filter((uri) => typeof uri === "string" && uri.length > 0);
|
|
238283
|
+
return {
|
|
238284
|
+
itemId: typeof itemId === "string" && itemId.length > 0 ? itemId : null,
|
|
238285
|
+
schemaRefs
|
|
238286
|
+
};
|
|
238287
|
+
}
|
|
238288
|
+
function parseStoragePartRootNamespace(storageDoc) {
|
|
238289
|
+
const root3 = storageDoc?.elements?.find((el) => el?.type === "element");
|
|
238290
|
+
if (!root3)
|
|
238291
|
+
return null;
|
|
238292
|
+
const xmlns2 = root3.attributes?.xmlns;
|
|
238293
|
+
if (typeof xmlns2 === "string" && xmlns2.length > 0)
|
|
238294
|
+
return xmlns2;
|
|
238295
|
+
const elementName = root3.name ?? "";
|
|
238296
|
+
const colonIdx = elementName.indexOf(":");
|
|
238297
|
+
if (colonIdx > 0) {
|
|
238298
|
+
const prefixedAttr = `xmlns:${elementName.slice(0, colonIdx)}`;
|
|
238299
|
+
const prefixedValue = root3.attributes?.[prefixedAttr];
|
|
238300
|
+
if (typeof prefixedValue === "string" && prefixedValue.length > 0)
|
|
238301
|
+
return prefixedValue;
|
|
238302
|
+
}
|
|
238303
|
+
return null;
|
|
238304
|
+
}
|
|
238305
|
+
function serializeXmlDoc(xmlDoc) {
|
|
238306
|
+
if (!xmlDoc)
|
|
238307
|
+
return "";
|
|
238308
|
+
return import_lib4.js2xml(xmlDoc, {
|
|
238309
|
+
compact: false,
|
|
238310
|
+
spaces: 0
|
|
238311
|
+
});
|
|
238312
|
+
}
|
|
238313
|
+
function readCustomXmlPart(convertedXml, target) {
|
|
238314
|
+
if (!target || !convertedXml)
|
|
238315
|
+
return null;
|
|
238316
|
+
let partName = null;
|
|
238317
|
+
let itemId = null;
|
|
238318
|
+
if (typeof target.partName === "string" && target.partName.length > 0) {
|
|
238319
|
+
if (!isCustomXmlStoragePartName(target.partName))
|
|
238320
|
+
return null;
|
|
238321
|
+
partName = target.partName;
|
|
238322
|
+
} else if (typeof target.id === "string" && target.id.length > 0) {
|
|
238323
|
+
itemId = target.id;
|
|
238324
|
+
for (const candidatePartName of listCustomXmlStoragePartNames(convertedXml)) {
|
|
238325
|
+
const propsName = findPropsPartFor(convertedXml, candidatePartName);
|
|
238326
|
+
if (!propsName)
|
|
238327
|
+
continue;
|
|
238328
|
+
if (parsePropsPart(convertedXml[propsName])?.itemId === itemId) {
|
|
238329
|
+
partName = candidatePartName;
|
|
238330
|
+
break;
|
|
238331
|
+
}
|
|
238332
|
+
}
|
|
238333
|
+
if (!partName)
|
|
238334
|
+
return null;
|
|
238335
|
+
} else
|
|
238336
|
+
return null;
|
|
238337
|
+
const storageDoc = convertedXml[partName];
|
|
238338
|
+
if (!storageDoc)
|
|
238339
|
+
return null;
|
|
238340
|
+
const propsPartName = findPropsPartFor(convertedXml, partName);
|
|
238341
|
+
const props = propsPartName ? parsePropsPart(convertedXml[propsPartName]) : null;
|
|
238342
|
+
return {
|
|
238343
|
+
id: props?.itemId ?? null,
|
|
238344
|
+
partName,
|
|
238345
|
+
propsPartName: propsPartName ?? null,
|
|
238346
|
+
rootNamespace: parseStoragePartRootNamespace(storageDoc),
|
|
238347
|
+
schemaRefs: props?.schemaRefs ?? [],
|
|
238348
|
+
content: serializeXmlDoc(storageDoc)
|
|
238349
|
+
};
|
|
238350
|
+
}
|
|
238351
|
+
function listCustomXmlParts(convertedXml) {
|
|
238352
|
+
return listCustomXmlStoragePartNames(convertedXml).map((partName) => {
|
|
238353
|
+
const propsPartName = findPropsPartFor(convertedXml, partName);
|
|
238354
|
+
const props = propsPartName ? parsePropsPart(convertedXml[propsPartName]) : null;
|
|
238355
|
+
return {
|
|
238356
|
+
id: props?.itemId ?? null,
|
|
238357
|
+
partName,
|
|
238358
|
+
propsPartName: propsPartName ?? null,
|
|
238359
|
+
rootNamespace: parseStoragePartRootNamespace(convertedXml[partName]),
|
|
238360
|
+
schemaRefs: props?.schemaRefs ?? []
|
|
238361
|
+
};
|
|
238362
|
+
});
|
|
238363
|
+
}
|
|
238364
|
+
function nextCustomXmlItemIndex(convertedXml, converter) {
|
|
238365
|
+
const used = /* @__PURE__ */ new Set;
|
|
238366
|
+
for (const path2 of Object.keys(convertedXml ?? {})) {
|
|
238367
|
+
const idx = indexFromPartName(path2) ?? indexFromPropsPartName(path2);
|
|
238368
|
+
if (idx != null)
|
|
238369
|
+
used.add(idx);
|
|
238370
|
+
}
|
|
238371
|
+
let candidate = 1;
|
|
238372
|
+
while (used.has(candidate))
|
|
238373
|
+
candidate += 1;
|
|
238374
|
+
return candidate;
|
|
238375
|
+
}
|
|
238376
|
+
function createXmlDocument2(rootElement, declaration) {
|
|
238377
|
+
const nextDeclaration = declaration ?? DEFAULT_XML_DECLARATION;
|
|
238378
|
+
return {
|
|
238379
|
+
declaration: {
|
|
238380
|
+
...nextDeclaration,
|
|
238381
|
+
attributes: { ...nextDeclaration.attributes }
|
|
238382
|
+
},
|
|
238383
|
+
elements: [rootElement]
|
|
238384
|
+
};
|
|
238385
|
+
}
|
|
238386
|
+
function parseContentToRootElement(content3) {
|
|
238387
|
+
const parsed = import_lib4.xml2js(content3, { compact: false });
|
|
238388
|
+
const root3 = (parsed.elements ?? []).find((el) => el?.type === "element");
|
|
238389
|
+
if (!root3)
|
|
238390
|
+
throw new Error("Custom XML content is missing a root element.");
|
|
238391
|
+
return {
|
|
238392
|
+
root: root3,
|
|
238393
|
+
declaration: parsed.declaration ?? null
|
|
238394
|
+
};
|
|
238395
|
+
}
|
|
238396
|
+
function ensureDocumentRelationshipsRoot2(convertedXml) {
|
|
238397
|
+
if (!convertedXml["word/_rels/document.xml.rels"])
|
|
238398
|
+
convertedXml["word/_rels/document.xml.rels"] = createXmlDocument2({
|
|
238399
|
+
type: "element",
|
|
238400
|
+
name: "Relationships",
|
|
238401
|
+
attributes: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" },
|
|
238402
|
+
elements: []
|
|
238403
|
+
});
|
|
238404
|
+
const relsData = convertedXml["word/_rels/document.xml.rels"];
|
|
238405
|
+
relsData.elements ??= [];
|
|
238406
|
+
let relsRoot = relsData.elements.find((el) => getLocalName2(el?.name) === "Relationships");
|
|
238407
|
+
if (!relsRoot) {
|
|
238408
|
+
relsRoot = {
|
|
238409
|
+
type: "element",
|
|
238410
|
+
name: "Relationships",
|
|
238411
|
+
attributes: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" },
|
|
238412
|
+
elements: []
|
|
238413
|
+
};
|
|
238414
|
+
relsData.elements.push(relsRoot);
|
|
238415
|
+
}
|
|
238416
|
+
relsRoot.elements ??= [];
|
|
238417
|
+
return relsRoot;
|
|
238418
|
+
}
|
|
238419
|
+
function getNextRelationshipId2(relsRoot) {
|
|
238420
|
+
const used = (relsRoot?.elements ?? []).map((rel) => {
|
|
238421
|
+
const id2 = rel?.attributes?.Id;
|
|
238422
|
+
const m$1 = typeof id2 === "string" ? /^rId(\d+)$/.exec(id2) : null;
|
|
238423
|
+
return m$1 ? Number.parseInt(m$1[1], 10) : NaN;
|
|
238424
|
+
}).filter((n) => Number.isFinite(n));
|
|
238425
|
+
return `rId${(used.length > 0 ? Math.max(...used) : 0) + 1}`;
|
|
238426
|
+
}
|
|
238427
|
+
function buildDocumentRelTarget(partName) {
|
|
238428
|
+
return partName.startsWith("customXml/") ? `../${partName}` : partName;
|
|
238429
|
+
}
|
|
238430
|
+
function buildItemPropsRoot(itemId, schemaRefs) {
|
|
238431
|
+
return [{
|
|
238432
|
+
type: "element",
|
|
238433
|
+
name: "ds:datastoreItem",
|
|
238434
|
+
attributes: {
|
|
238435
|
+
"ds:itemID": itemId,
|
|
238436
|
+
"xmlns:ds": CUSTOM_XML_DATASTORE_NAMESPACE
|
|
238437
|
+
},
|
|
238438
|
+
elements: schemaRefs === undefined ? [] : [{
|
|
238439
|
+
type: "element",
|
|
238440
|
+
name: "ds:schemaRefs",
|
|
238441
|
+
elements: schemaRefs.map((uri) => ({
|
|
238442
|
+
type: "element",
|
|
238443
|
+
name: "ds:schemaRef",
|
|
238444
|
+
attributes: { "ds:uri": uri }
|
|
238445
|
+
}))
|
|
238446
|
+
}]
|
|
238447
|
+
}][0];
|
|
238448
|
+
}
|
|
238449
|
+
function buildItemRelsRoot(propsPartFileName) {
|
|
238450
|
+
return {
|
|
238451
|
+
type: "element",
|
|
238452
|
+
name: "Relationships",
|
|
238453
|
+
attributes: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" },
|
|
238454
|
+
elements: [{
|
|
238455
|
+
type: "element",
|
|
238456
|
+
name: "Relationship",
|
|
238457
|
+
attributes: {
|
|
238458
|
+
Id: "rId1",
|
|
238459
|
+
Type: CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2,
|
|
238460
|
+
Target: propsPartFileName
|
|
238461
|
+
}
|
|
238462
|
+
}]
|
|
238463
|
+
};
|
|
238464
|
+
}
|
|
238465
|
+
function resolveTargetPartName(convertedXml, target) {
|
|
238466
|
+
if (!target)
|
|
238467
|
+
return null;
|
|
238468
|
+
if (typeof target.partName === "string" && target.partName.length > 0) {
|
|
238469
|
+
if (!isCustomXmlStoragePartName(target.partName))
|
|
238470
|
+
return null;
|
|
238471
|
+
return convertedXml[target.partName] ? target.partName : null;
|
|
238472
|
+
}
|
|
238473
|
+
if (typeof target.id === "string" && target.id.length > 0)
|
|
238474
|
+
for (const partName of listCustomXmlStoragePartNames(convertedXml)) {
|
|
238475
|
+
const propsName = findPropsPartFor(convertedXml, partName);
|
|
238476
|
+
if (!propsName)
|
|
238477
|
+
continue;
|
|
238478
|
+
if (parsePropsPart(convertedXml[propsName])?.itemId === target.id)
|
|
238479
|
+
return partName;
|
|
238480
|
+
}
|
|
238481
|
+
return null;
|
|
238482
|
+
}
|
|
238483
|
+
function createCustomXmlPart(convertedXml, { content: content3, schemaRefs }, converter) {
|
|
238484
|
+
const { root: root3, declaration } = parseContentToRootElement(content3);
|
|
238485
|
+
const index2 = nextCustomXmlItemIndex(convertedXml, converter);
|
|
238486
|
+
const partName = partNameFromIndex(index2);
|
|
238487
|
+
const propsPartName = propsPartNameFromIndex(index2);
|
|
238488
|
+
const itemRelsPath = `customXml/_rels/item${index2}.xml.rels`;
|
|
238489
|
+
const itemId = `{${v4_default().toUpperCase()}}`;
|
|
238490
|
+
convertedXml[partName] = createXmlDocument2(root3, declaration);
|
|
238491
|
+
convertedXml[propsPartName] = createXmlDocument2(buildItemPropsRoot(itemId, schemaRefs));
|
|
238492
|
+
convertedXml[itemRelsPath] = createXmlDocument2(buildItemRelsRoot(`itemProps${index2}.xml`));
|
|
238493
|
+
const relsRoot = ensureDocumentRelationshipsRoot2(convertedXml);
|
|
238494
|
+
relsRoot.elements.push({
|
|
238495
|
+
type: "element",
|
|
238496
|
+
name: "Relationship",
|
|
238497
|
+
attributes: {
|
|
238498
|
+
Id: getNextRelationshipId2(relsRoot),
|
|
238499
|
+
Type: CUSTOM_XML_DATA_RELATIONSHIP_TYPE,
|
|
238500
|
+
Target: buildDocumentRelTarget(partName)
|
|
238501
|
+
}
|
|
238502
|
+
});
|
|
238503
|
+
if (converter?.removedCustomXmlPaths instanceof Set) {
|
|
238504
|
+
converter.removedCustomXmlPaths.delete(partName);
|
|
238505
|
+
converter.removedCustomXmlPaths.delete(propsPartName);
|
|
238506
|
+
converter.removedCustomXmlPaths.delete(itemRelsPath);
|
|
238507
|
+
}
|
|
238508
|
+
return {
|
|
238509
|
+
id: itemId,
|
|
238510
|
+
partName,
|
|
238511
|
+
propsPartName
|
|
238512
|
+
};
|
|
238513
|
+
}
|
|
238514
|
+
function patchCustomXmlPart(convertedXml, target, { content: content3, schemaRefs }, converter) {
|
|
238515
|
+
const partName = resolveTargetPartName(convertedXml, target);
|
|
238516
|
+
if (!partName)
|
|
238517
|
+
return null;
|
|
238518
|
+
if (content3 !== undefined) {
|
|
238519
|
+
const { root: root3, declaration } = parseContentToRootElement(content3);
|
|
238520
|
+
convertedXml[partName] = createXmlDocument2(root3, convertedXml[partName]?.declaration ?? declaration);
|
|
238521
|
+
}
|
|
238522
|
+
let resolvedId = null;
|
|
238523
|
+
if (schemaRefs !== undefined) {
|
|
238524
|
+
let propsPartName = findPropsPartFor(convertedXml, partName);
|
|
238525
|
+
if (propsPartName)
|
|
238526
|
+
resolvedId = parsePropsPart(convertedXml[propsPartName])?.itemId ?? null;
|
|
238527
|
+
if (!propsPartName) {
|
|
238528
|
+
const idx = indexFromPartName(partName);
|
|
238529
|
+
if (idx == null)
|
|
238530
|
+
return null;
|
|
238531
|
+
propsPartName = propsPartNameFromIndex(idx);
|
|
238532
|
+
const itemRelsPath = `customXml/_rels/item${idx}.xml.rels`;
|
|
238533
|
+
resolvedId = `{${v4_default().toUpperCase()}}`;
|
|
238534
|
+
convertedXml[itemRelsPath] = createXmlDocument2(buildItemRelsRoot(`itemProps${idx}.xml`));
|
|
238535
|
+
}
|
|
238536
|
+
if (!resolvedId)
|
|
238537
|
+
resolvedId = `{${v4_default().toUpperCase()}}`;
|
|
238538
|
+
const existingDecl = convertedXml[propsPartName]?.declaration;
|
|
238539
|
+
convertedXml[propsPartName] = createXmlDocument2(buildItemPropsRoot(resolvedId, schemaRefs), existingDecl);
|
|
238540
|
+
} else {
|
|
238541
|
+
const propsPartName = findPropsPartFor(convertedXml, partName);
|
|
238542
|
+
if (propsPartName)
|
|
238543
|
+
resolvedId = parsePropsPart(convertedXml[propsPartName])?.itemId ?? null;
|
|
238544
|
+
}
|
|
238545
|
+
if (converter)
|
|
238546
|
+
invalidateConverterCachesForPath(converter, partName);
|
|
238547
|
+
return resolvedId ? {
|
|
238548
|
+
partName,
|
|
238549
|
+
id: resolvedId
|
|
238550
|
+
} : { partName };
|
|
238551
|
+
}
|
|
238552
|
+
function removeCustomXmlPart(convertedXml, target, converter) {
|
|
238553
|
+
const partName = resolveTargetPartName(convertedXml, target);
|
|
238554
|
+
if (!partName)
|
|
238555
|
+
return false;
|
|
238556
|
+
const index2 = indexFromPartName(partName);
|
|
238557
|
+
const removedPaths = [
|
|
238558
|
+
partName,
|
|
238559
|
+
findPropsPartFor(convertedXml, partName),
|
|
238560
|
+
index2 == null ? null : `customXml/_rels/item${index2}.xml.rels`
|
|
238561
|
+
].filter((path2) => typeof path2 === "string" && path2.length > 0);
|
|
238562
|
+
for (const path2 of removedPaths)
|
|
238563
|
+
delete convertedXml[path2];
|
|
238564
|
+
const relsRoot = convertedXml["word/_rels/document.xml.rels"]?.elements?.find((el) => getLocalName2(el?.name) === "Relationships");
|
|
238565
|
+
if (relsRoot?.elements?.length)
|
|
238566
|
+
relsRoot.elements = relsRoot.elements.filter((rel) => {
|
|
238567
|
+
if (rel?.attributes?.Type !== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml")
|
|
238568
|
+
return true;
|
|
238569
|
+
return resolveOpcTargetPath(rel?.attributes?.Target, "word") !== partName;
|
|
238570
|
+
});
|
|
238571
|
+
if (converter) {
|
|
238572
|
+
if (!(converter.removedCustomXmlPaths instanceof Set))
|
|
238573
|
+
converter.removedCustomXmlPaths = /* @__PURE__ */ new Set;
|
|
238574
|
+
for (const path2 of removedPaths)
|
|
238575
|
+
converter.removedCustomXmlPaths.add(path2);
|
|
238576
|
+
invalidateConverterCachesForPath(converter, partName);
|
|
238577
|
+
}
|
|
238578
|
+
return true;
|
|
238579
|
+
}
|
|
238580
|
+
function invalidateConverterCachesForPath(converter, partName) {
|
|
238581
|
+
if (!converter || typeof partName !== "string")
|
|
238582
|
+
return;
|
|
238583
|
+
const biblio = converter.bibliographyPart;
|
|
238584
|
+
if (biblio && biblio.partPath === partName)
|
|
238585
|
+
converter.bibliographyPart = {
|
|
238586
|
+
sources: [],
|
|
238587
|
+
partPath: null,
|
|
238588
|
+
itemPropsPath: null,
|
|
238589
|
+
itemRelsPath: null,
|
|
238590
|
+
selectedStyle: null,
|
|
238591
|
+
styleName: null,
|
|
238592
|
+
version: null
|
|
238593
|
+
};
|
|
238594
|
+
}
|
|
238595
|
+
function getConverter$22(editor) {
|
|
238596
|
+
return editor.converter ?? null;
|
|
238597
|
+
}
|
|
238598
|
+
function getConvertedXml2(editor) {
|
|
238599
|
+
return getConverter$22(editor)?.convertedXml ?? {};
|
|
238600
|
+
}
|
|
238601
|
+
function toSummary(record3) {
|
|
238602
|
+
const summary = {
|
|
238603
|
+
partName: record3.partName,
|
|
238604
|
+
schemaRefs: record3.schemaRefs
|
|
238605
|
+
};
|
|
238606
|
+
if (record3.id)
|
|
238607
|
+
summary.id = record3.id;
|
|
238608
|
+
if (record3.propsPartName)
|
|
238609
|
+
summary.propsPartName = record3.propsPartName;
|
|
238610
|
+
if (record3.rootNamespace)
|
|
238611
|
+
summary.rootNamespace = record3.rootNamespace;
|
|
238612
|
+
return summary;
|
|
238613
|
+
}
|
|
238614
|
+
function customXmlPartsListWrapper(editor, query) {
|
|
238615
|
+
const revision = getRevision(editor);
|
|
238616
|
+
let filtered = listCustomXmlParts(getConvertedXml2(editor));
|
|
238617
|
+
if (query?.rootNamespace !== undefined)
|
|
238618
|
+
filtered = filtered.filter((p$12) => p$12.rootNamespace === query.rootNamespace);
|
|
238619
|
+
if (query?.schemaRef !== undefined)
|
|
238620
|
+
filtered = filtered.filter((p$12) => p$12.schemaRefs.includes(query.schemaRef));
|
|
238621
|
+
const { total, items: paged } = paginate(filtered.map((record3) => {
|
|
238622
|
+
const summary = toSummary(record3);
|
|
238623
|
+
const stableId = summary.id ?? summary.partName;
|
|
238624
|
+
return buildDiscoveryItem(stableId, buildResolvedHandle(`customXml:${stableId}`, "ephemeral", "ext:customXmlPart"), summary);
|
|
238625
|
+
}), query?.offset, query?.limit);
|
|
238626
|
+
return buildDiscoveryResult({
|
|
238627
|
+
evaluatedRevision: revision,
|
|
238628
|
+
total,
|
|
238629
|
+
items: paged,
|
|
238630
|
+
page: {
|
|
238631
|
+
limit: query?.limit ?? total,
|
|
238632
|
+
offset: query?.offset ?? 0,
|
|
238633
|
+
returned: paged.length
|
|
238634
|
+
}
|
|
238635
|
+
});
|
|
238636
|
+
}
|
|
238637
|
+
function customXmlPartsGetWrapper(editor, input2) {
|
|
238638
|
+
const record3 = readCustomXmlPart(getConvertedXml2(editor), input2.target);
|
|
238639
|
+
if (!record3)
|
|
238640
|
+
return null;
|
|
238641
|
+
const info = {
|
|
238642
|
+
partName: record3.partName,
|
|
238643
|
+
rootNamespace: record3.rootNamespace ?? undefined,
|
|
238644
|
+
schemaRefs: record3.schemaRefs,
|
|
238645
|
+
content: record3.content
|
|
238646
|
+
};
|
|
238647
|
+
if (record3.id)
|
|
238648
|
+
info.id = record3.id;
|
|
238649
|
+
if (record3.propsPartName)
|
|
238650
|
+
info.propsPartName = record3.propsPartName;
|
|
238651
|
+
return info;
|
|
238652
|
+
}
|
|
238653
|
+
function failure(code7, message) {
|
|
238654
|
+
return {
|
|
238655
|
+
success: false,
|
|
238656
|
+
failure: {
|
|
238657
|
+
code: code7,
|
|
238658
|
+
message
|
|
238659
|
+
}
|
|
238660
|
+
};
|
|
238661
|
+
}
|
|
238662
|
+
function isWriteFailure(outcome) {
|
|
238663
|
+
return outcome.ok === false;
|
|
238664
|
+
}
|
|
238665
|
+
function targetNotFound() {
|
|
238666
|
+
return {
|
|
238667
|
+
ok: false,
|
|
238668
|
+
code: "TARGET_NOT_FOUND",
|
|
238669
|
+
message: "No custom XML part matched the supplied target."
|
|
238670
|
+
};
|
|
238671
|
+
}
|
|
238672
|
+
function safeValidate(fn2) {
|
|
238673
|
+
try {
|
|
238674
|
+
return {
|
|
238675
|
+
ok: true,
|
|
238676
|
+
payload: fn2()
|
|
238677
|
+
};
|
|
238678
|
+
} catch (e) {
|
|
238679
|
+
return {
|
|
238680
|
+
ok: false,
|
|
238681
|
+
code: "INVALID_INPUT",
|
|
238682
|
+
message: e instanceof Error ? e.message : String(e)
|
|
238683
|
+
};
|
|
238684
|
+
}
|
|
238685
|
+
}
|
|
238686
|
+
function customXmlPartsCreateWrapper(editor, input2, options) {
|
|
238687
|
+
rejectTrackedMode("customXml.parts.create", options);
|
|
238688
|
+
const outcome = executeOutOfBandMutation(editor, (dryRun) => {
|
|
238689
|
+
if (dryRun) {
|
|
238690
|
+
const probe$1 = safeValidate(() => createCustomXmlPart({}, {
|
|
238691
|
+
content: input2.content,
|
|
238692
|
+
schemaRefs: input2.schemaRefs
|
|
238693
|
+
}));
|
|
238694
|
+
if (isWriteFailure(probe$1))
|
|
238695
|
+
return {
|
|
238696
|
+
changed: false,
|
|
238697
|
+
payload: probe$1
|
|
238698
|
+
};
|
|
238699
|
+
return {
|
|
238700
|
+
changed: false,
|
|
238701
|
+
payload: {
|
|
238702
|
+
ok: true,
|
|
238703
|
+
payload: {
|
|
238704
|
+
id: "{DRY-RUN}",
|
|
238705
|
+
partName: "",
|
|
238706
|
+
propsPartName: ""
|
|
238707
|
+
}
|
|
238708
|
+
}
|
|
238709
|
+
};
|
|
238710
|
+
}
|
|
238711
|
+
const probe = safeValidate(() => createCustomXmlPart(getConvertedXml2(editor), {
|
|
238712
|
+
content: input2.content,
|
|
238713
|
+
schemaRefs: input2.schemaRefs
|
|
238714
|
+
}, getConverter$22(editor)));
|
|
238715
|
+
if (isWriteFailure(probe))
|
|
238716
|
+
return {
|
|
238717
|
+
changed: false,
|
|
238718
|
+
payload: probe
|
|
238719
|
+
};
|
|
238720
|
+
return {
|
|
238721
|
+
changed: true,
|
|
238722
|
+
payload: {
|
|
238723
|
+
ok: true,
|
|
238724
|
+
payload: probe.payload
|
|
238725
|
+
}
|
|
238726
|
+
};
|
|
238727
|
+
}, {
|
|
238728
|
+
dryRun: options?.dryRun === true,
|
|
238729
|
+
expectedRevision: options?.expectedRevision
|
|
238730
|
+
});
|
|
238731
|
+
if (isWriteFailure(outcome))
|
|
238732
|
+
return failure(outcome.code, outcome.message);
|
|
238733
|
+
return {
|
|
238734
|
+
success: true,
|
|
238735
|
+
id: outcome.payload.id,
|
|
238736
|
+
partName: outcome.payload.partName,
|
|
238737
|
+
propsPartName: outcome.payload.propsPartName
|
|
238738
|
+
};
|
|
238739
|
+
}
|
|
238740
|
+
function customXmlPartsPatchWrapper(editor, input2, options) {
|
|
238741
|
+
rejectTrackedMode("customXml.parts.patch", options);
|
|
238742
|
+
const outcome = executeOutOfBandMutation(editor, (dryRun) => {
|
|
238743
|
+
if (dryRun) {
|
|
238744
|
+
if (!resolveTargetPartName(getConvertedXml2(editor), input2.target))
|
|
238745
|
+
return {
|
|
238746
|
+
changed: false,
|
|
238747
|
+
payload: targetNotFound()
|
|
238748
|
+
};
|
|
238749
|
+
if (input2.content !== undefined) {
|
|
238750
|
+
const probe$1 = safeValidate(() => createCustomXmlPart({}, {
|
|
238751
|
+
content: input2.content,
|
|
238752
|
+
schemaRefs: undefined
|
|
238753
|
+
}));
|
|
238754
|
+
if (isWriteFailure(probe$1))
|
|
238755
|
+
return {
|
|
238756
|
+
changed: false,
|
|
238757
|
+
payload: probe$1
|
|
238758
|
+
};
|
|
238759
|
+
}
|
|
238760
|
+
return {
|
|
238761
|
+
changed: false,
|
|
238762
|
+
payload: {
|
|
238763
|
+
ok: true,
|
|
238764
|
+
payload: { id: null }
|
|
238765
|
+
}
|
|
238766
|
+
};
|
|
238767
|
+
}
|
|
238768
|
+
if (!resolveTargetPartName(getConvertedXml2(editor), input2.target))
|
|
238769
|
+
return {
|
|
238770
|
+
changed: false,
|
|
238771
|
+
payload: targetNotFound()
|
|
238772
|
+
};
|
|
238773
|
+
const probe = safeValidate(() => patchCustomXmlPart(getConvertedXml2(editor), input2.target, {
|
|
238774
|
+
content: input2.content,
|
|
238775
|
+
schemaRefs: input2.schemaRefs
|
|
238776
|
+
}, getConverter$22(editor)));
|
|
238777
|
+
if (isWriteFailure(probe))
|
|
238778
|
+
return {
|
|
238779
|
+
changed: false,
|
|
238780
|
+
payload: probe
|
|
238781
|
+
};
|
|
238782
|
+
if (!probe.payload)
|
|
238783
|
+
return {
|
|
238784
|
+
changed: false,
|
|
238785
|
+
payload: targetNotFound()
|
|
238786
|
+
};
|
|
238787
|
+
return {
|
|
238788
|
+
changed: true,
|
|
238789
|
+
payload: {
|
|
238790
|
+
ok: true,
|
|
238791
|
+
payload: { id: probe.payload.id ?? null }
|
|
238792
|
+
}
|
|
238793
|
+
};
|
|
238794
|
+
}, {
|
|
238795
|
+
dryRun: options?.dryRun === true,
|
|
238796
|
+
expectedRevision: options?.expectedRevision
|
|
238797
|
+
});
|
|
238798
|
+
if (isWriteFailure(outcome))
|
|
238799
|
+
return failure(outcome.code, outcome.message);
|
|
238800
|
+
const result = {
|
|
238801
|
+
success: true,
|
|
238802
|
+
target: input2.target
|
|
238803
|
+
};
|
|
238804
|
+
if (outcome.payload.id)
|
|
238805
|
+
result.id = outcome.payload.id;
|
|
238806
|
+
return result;
|
|
238807
|
+
}
|
|
238808
|
+
function customXmlPartsRemoveWrapper(editor, input2, options) {
|
|
238809
|
+
rejectTrackedMode("customXml.parts.remove", options);
|
|
238810
|
+
const outcome = executeOutOfBandMutation(editor, (dryRun) => {
|
|
238811
|
+
if (dryRun)
|
|
238812
|
+
return resolveTargetPartName(getConvertedXml2(editor), input2.target) ? {
|
|
238813
|
+
changed: false,
|
|
238814
|
+
payload: {
|
|
238815
|
+
ok: true,
|
|
238816
|
+
payload: true
|
|
238817
|
+
}
|
|
238818
|
+
} : {
|
|
238819
|
+
changed: false,
|
|
238820
|
+
payload: targetNotFound()
|
|
238821
|
+
};
|
|
238822
|
+
if (!removeCustomXmlPart(getConvertedXml2(editor), input2.target, getConverter$22(editor)))
|
|
238823
|
+
return {
|
|
238824
|
+
changed: false,
|
|
238825
|
+
payload: targetNotFound()
|
|
238826
|
+
};
|
|
238827
|
+
return {
|
|
238828
|
+
changed: true,
|
|
238829
|
+
payload: {
|
|
238830
|
+
ok: true,
|
|
238831
|
+
payload: true
|
|
238832
|
+
}
|
|
238833
|
+
};
|
|
238834
|
+
}, {
|
|
238835
|
+
dryRun: options?.dryRun === true,
|
|
238836
|
+
expectedRevision: options?.expectedRevision
|
|
238837
|
+
});
|
|
238838
|
+
if (isWriteFailure(outcome))
|
|
238839
|
+
return failure(outcome.code, outcome.message);
|
|
238840
|
+
return {
|
|
238841
|
+
success: true,
|
|
238842
|
+
target: input2.target
|
|
238843
|
+
};
|
|
238844
|
+
}
|
|
238845
|
+
function createCustomXmlPartsAdapter(editor) {
|
|
238846
|
+
return {
|
|
238847
|
+
list: (query) => customXmlPartsListWrapper(editor, query),
|
|
238848
|
+
get: (input2) => customXmlPartsGetWrapper(editor, input2),
|
|
238849
|
+
create: (input2, options) => customXmlPartsCreateWrapper(editor, input2, options),
|
|
238850
|
+
patch: (input2, options) => customXmlPartsPatchWrapper(editor, input2, options),
|
|
238851
|
+
remove: (input2, options) => customXmlPartsRemoveWrapper(editor, input2, options)
|
|
238852
|
+
};
|
|
238853
|
+
}
|
|
237988
238854
|
function getConverter$12(editor) {
|
|
237989
238855
|
return editor.converter ?? undefined;
|
|
237990
238856
|
}
|
|
@@ -240381,29 +241247,6 @@ function buildCitationAddress(doc$12, resolved) {
|
|
|
240381
241247
|
}
|
|
240382
241248
|
};
|
|
240383
241249
|
}
|
|
240384
|
-
function executeOutOfBandMutation(editor, mutateFn, options) {
|
|
240385
|
-
if (!options.dryRun)
|
|
240386
|
-
if (editor.options?.collaborationProvider && editor.options?.ydoc)
|
|
240387
|
-
try {
|
|
240388
|
-
yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing();
|
|
240389
|
-
} catch {}
|
|
240390
|
-
else
|
|
240391
|
-
try {
|
|
240392
|
-
editor.view?.dispatch?.(closeHistory(editor.state.tr));
|
|
240393
|
-
} catch {}
|
|
240394
|
-
checkRevision(editor, options.expectedRevision);
|
|
240395
|
-
const result = mutateFn(options.dryRun);
|
|
240396
|
-
if (result.changed && !options.dryRun) {
|
|
240397
|
-
const converter = editor.converter;
|
|
240398
|
-
if (converter) {
|
|
240399
|
-
converter.documentModified = true;
|
|
240400
|
-
if (!converter.documentGuid && typeof converter.promoteToGuid === "function")
|
|
240401
|
-
converter.promoteToGuid();
|
|
240402
|
-
}
|
|
240403
|
-
incrementRevision(editor);
|
|
240404
|
-
}
|
|
240405
|
-
return result.payload;
|
|
240406
|
-
}
|
|
240407
241250
|
function citationSuccess(address) {
|
|
240408
241251
|
return {
|
|
240409
241252
|
success: true,
|
|
@@ -241621,6 +242464,7 @@ function assembleDocumentApiAdapters(editor) {
|
|
|
241621
242464
|
rename: (input2, options) => bookmarksRenameWrapper(editor, input2, options),
|
|
241622
242465
|
remove: (input2, options) => bookmarksRemoveWrapper(editor, input2, options)
|
|
241623
242466
|
},
|
|
242467
|
+
customXml: { parts: createCustomXmlPartsAdapter(editor) },
|
|
241624
242468
|
footnotes: {
|
|
241625
242469
|
list: (query) => footnotesListWrapper(editor, query),
|
|
241626
242470
|
get: (input2) => footnotesGetWrapper(editor, input2),
|
|
@@ -278449,7 +279293,7 @@ var Node$13 = class Node$14 {
|
|
|
278449
279293
|
return () => {};
|
|
278450
279294
|
const handle3 = setInterval(callback, intervalMs);
|
|
278451
279295
|
return () => clearInterval(handle3);
|
|
278452
|
-
}, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", ALLOWED_SOURCE_MARK_TYPES, TEXT_STYLE_ALLOWED_ATTRS, DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TOC_ENTRY_STYLE_RE, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.32.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, cloneExtensionInstance = (extension2) => {
|
|
279296
|
+
}, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", ALLOWED_SOURCE_MARK_TYPES, TEXT_STYLE_ALLOWED_ATTRS, DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TOC_ENTRY_STYLE_RE, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.32.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, cloneExtensionInstance = (extension2) => {
|
|
278453
279297
|
const extensionLike = extension2;
|
|
278454
279298
|
const config3 = extensionLike?.config;
|
|
278455
279299
|
const ExtensionCtor = extensionLike?.constructor;
|
|
@@ -285024,7 +285868,7 @@ menclose::after {
|
|
|
285024
285868
|
return true;
|
|
285025
285869
|
if (!a2 || !b$1)
|
|
285026
285870
|
return !a2 && !b$1;
|
|
285027
|
-
if (a2.alignment !== b$1.alignment || a2.contextualSpacing !== b$1.contextualSpacing || a2.suppressFirstLineIndent !== b$1.suppressFirstLineIndent || a2.dropCap !== b$1.dropCap || a2.decimalSeparator !== b$1.decimalSeparator || a2.tabIntervalTwips !== b$1.tabIntervalTwips || a2.keepNext !== b$1.keepNext || a2.keepLines !== b$1.keepLines || a2
|
|
285871
|
+
if (a2.alignment !== b$1.alignment || a2.contextualSpacing !== b$1.contextualSpacing || a2.suppressFirstLineIndent !== b$1.suppressFirstLineIndent || a2.dropCap !== b$1.dropCap || a2.decimalSeparator !== b$1.decimalSeparator || a2.tabIntervalTwips !== b$1.tabIntervalTwips || a2.keepNext !== b$1.keepNext || a2.keepLines !== b$1.keepLines || getParagraphInlineDirection(a2) !== getParagraphInlineDirection(b$1) || a2.floatAlignment !== b$1.floatAlignment)
|
|
285028
285872
|
return false;
|
|
285029
285873
|
if (!paragraphSpacingEqual(a2.spacing, b$1.spacing))
|
|
285030
285874
|
return false;
|
|
@@ -287480,7 +288324,6 @@ menclose::after {
|
|
|
287480
288324
|
keepLines: resolvedParagraphProperties.keepLines,
|
|
287481
288325
|
floatAlignment,
|
|
287482
288326
|
pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
|
|
287483
|
-
...normalizedDirection ? { direction: normalizedDirection } : {},
|
|
287484
288327
|
directionContext
|
|
287485
288328
|
};
|
|
287486
288329
|
if (normalizedNumberingProperties && normalizedListRendering) {
|
|
@@ -294188,18 +295031,19 @@ menclose::after {
|
|
|
294188
295031
|
return;
|
|
294189
295032
|
console.log(...args$1);
|
|
294190
295033
|
}, 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;
|
|
294191
|
-
var
|
|
295034
|
+
var init_src_ChfKFC3W_es = __esm(() => {
|
|
294192
295035
|
init_rolldown_runtime_Bg48TavK_es();
|
|
294193
|
-
|
|
295036
|
+
init_SuperConverter_Db6xeFxo_es();
|
|
294194
295037
|
init_jszip_C49i9kUs_es();
|
|
295038
|
+
init_xml_js_CqGKpaft_es();
|
|
294195
295039
|
init_uuid_qzgm05fK_es();
|
|
294196
|
-
|
|
295040
|
+
init_create_headless_toolbar_BongFwHh_es();
|
|
294197
295041
|
init_constants_DrU4EASo_es();
|
|
294198
295042
|
init_dist_B8HfvhaK_es();
|
|
294199
295043
|
init_unified_Dsuw2be5_es();
|
|
294200
295044
|
init_remark_gfm_BhnWr3yf_es();
|
|
294201
295045
|
init_remark_stringify_6MMJfY0k_es();
|
|
294202
|
-
|
|
295046
|
+
init_DocxZipper_Bphhij1P_es();
|
|
294203
295047
|
init__plugin_vue_export_helper_HmhZBO0u_es();
|
|
294204
295048
|
init_eventemitter3_UwU_CLPU_es();
|
|
294205
295049
|
init_errors_C_DoKMoN_es();
|
|
@@ -318038,7 +318882,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318038
318882
|
stylesPartDescriptor = {
|
|
318039
318883
|
id: STYLES_PART_ID,
|
|
318040
318884
|
ensurePart(editor) {
|
|
318041
|
-
const converter = getConverter$
|
|
318885
|
+
const converter = getConverter$62(editor);
|
|
318042
318886
|
if (converter?.convertedXml[STYLES_PART_ID])
|
|
318043
318887
|
return converter.convertedXml[STYLES_PART_ID];
|
|
318044
318888
|
return {
|
|
@@ -318053,7 +318897,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318053
318897
|
},
|
|
318054
318898
|
afterCommit(ctx$1) {
|
|
318055
318899
|
if (ctx$1.source.startsWith("collab:remote:")) {
|
|
318056
|
-
const converter = getConverter$
|
|
318900
|
+
const converter = getConverter$62(ctx$1.editor);
|
|
318057
318901
|
if (converter)
|
|
318058
318902
|
try {
|
|
318059
318903
|
converter.translatedLinkedStyles = translateStyleDefinitions(converter.convertedXml);
|
|
@@ -318481,6 +319325,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318481
319325
|
HEADER_FILE_PATTERN2 = /header(\d+)\.xml$/;
|
|
318482
319326
|
FOOTER_FILE_PATTERN2 = /footer(\d+)\.xml$/;
|
|
318483
319327
|
SPECIAL_NOTE_TYPES = new Set(["separator", "continuationSeparator"]);
|
|
319328
|
+
import_lib4 = /* @__PURE__ */ __toESM2(require_lib(), 1);
|
|
318484
319329
|
SETTINGS_PART = SETTINGS_PART_PATH;
|
|
318485
319330
|
RESTART_POLICY_TO_OOXML = {
|
|
318486
319331
|
continuous: "continuous",
|
|
@@ -318731,14 +319576,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318731
319576
|
if (!allowed.includes(this.#editorLifecycleState))
|
|
318732
319577
|
throw new InvalidStateError(`Invalid operation: editor is in '${this.#editorLifecycleState}' state, expected one of: ${allowed.join(", ")}`);
|
|
318733
319578
|
}
|
|
318734
|
-
async#withState(during, success2, failure, operation) {
|
|
319579
|
+
async#withState(during, success2, failure$1, operation) {
|
|
318735
319580
|
this.#editorLifecycleState = during;
|
|
318736
319581
|
try {
|
|
318737
319582
|
const result = await operation();
|
|
318738
319583
|
this.#editorLifecycleState = success2;
|
|
318739
319584
|
return result;
|
|
318740
319585
|
} catch (error48) {
|
|
318741
|
-
this.#editorLifecycleState = failure;
|
|
319586
|
+
this.#editorLifecycleState = failure$1;
|
|
318742
319587
|
throw error48;
|
|
318743
319588
|
}
|
|
318744
319589
|
}
|
|
@@ -320118,6 +320963,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320118
320963
|
if (partData?.elements?.[0])
|
|
320119
320964
|
updatedDocs[path2] = String(this.converter.schemaToXml(partData.elements[0]));
|
|
320120
320965
|
}
|
|
320966
|
+
const removedCustomXmlPaths = this.converter.removedCustomXmlPaths;
|
|
320967
|
+
if (removedCustomXmlPaths instanceof Set)
|
|
320968
|
+
for (const path2 of removedCustomXmlPaths)
|
|
320969
|
+
updatedDocs[path2] = null;
|
|
320121
320970
|
const zipper = new DocxZipper_default;
|
|
320122
320971
|
if (getUpdatedDocs) {
|
|
320123
320972
|
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes({ files: this.options.content }, media2, true, updatedDocs, this.options.fonts);
|
|
@@ -332255,11 +333104,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
332255
333104
|
];
|
|
332256
333105
|
});
|
|
332257
333106
|
|
|
332258
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
333107
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-DWR-WlL-.es.js
|
|
332259
333108
|
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;
|
|
332260
|
-
var
|
|
332261
|
-
|
|
332262
|
-
|
|
333109
|
+
var init_create_super_doc_ui_DWR_WlL_es = __esm(() => {
|
|
333110
|
+
init_SuperConverter_Db6xeFxo_es();
|
|
333111
|
+
init_create_headless_toolbar_BongFwHh_es();
|
|
332263
333112
|
MOD_ALIASES = new Set([
|
|
332264
333113
|
"Mod",
|
|
332265
333114
|
"Meta",
|
|
@@ -332301,16 +333150,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
332301
333150
|
|
|
332302
333151
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
332303
333152
|
var init_super_editor_es = __esm(() => {
|
|
332304
|
-
|
|
332305
|
-
|
|
333153
|
+
init_src_ChfKFC3W_es();
|
|
333154
|
+
init_SuperConverter_Db6xeFxo_es();
|
|
332306
333155
|
init_jszip_C49i9kUs_es();
|
|
332307
333156
|
init_xml_js_CqGKpaft_es();
|
|
332308
|
-
|
|
333157
|
+
init_create_headless_toolbar_BongFwHh_es();
|
|
332309
333158
|
init_constants_DrU4EASo_es();
|
|
332310
333159
|
init_dist_B8HfvhaK_es();
|
|
332311
333160
|
init_unified_Dsuw2be5_es();
|
|
332312
|
-
|
|
332313
|
-
|
|
333161
|
+
init_DocxZipper_Bphhij1P_es();
|
|
333162
|
+
init_create_super_doc_ui_DWR_WlL_es();
|
|
332314
333163
|
init_ui_CGB3qmy3_es();
|
|
332315
333164
|
init_eventemitter3_UwU_CLPU_es();
|
|
332316
333165
|
init_errors_C_DoKMoN_es();
|
|
@@ -339341,6 +340190,74 @@ More content with **bold** and *italic*.`
|
|
|
339341
340190
|
referenceDocPath: "permission-ranges/update-principal.mdx",
|
|
339342
340191
|
referenceGroup: "permissionRanges",
|
|
339343
340192
|
skipAsATool: true
|
|
340193
|
+
},
|
|
340194
|
+
"customXml.parts.list": {
|
|
340195
|
+
memberPath: "customXml.parts.list",
|
|
340196
|
+
description: "List Custom XML Data Storage Parts in the document, optionally filtered by root namespace or schema reference.",
|
|
340197
|
+
expectedResult: "Returns a CustomXmlPartsListResult with summary entries (no content); fetch content via get.",
|
|
340198
|
+
requiresDocumentContext: true,
|
|
340199
|
+
metadata: readOperation2({
|
|
340200
|
+
idempotency: "idempotent",
|
|
340201
|
+
throws: T_REF_READ_LIST2
|
|
340202
|
+
}),
|
|
340203
|
+
referenceDocPath: "custom-xml/parts/list.mdx",
|
|
340204
|
+
referenceGroup: "customXml"
|
|
340205
|
+
},
|
|
340206
|
+
"customXml.parts.get": {
|
|
340207
|
+
memberPath: "customXml.parts.get",
|
|
340208
|
+
description: "Get a single Custom XML Data Storage Part by itemID or package part name, including its full content. " + "v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
340209
|
+
expectedResult: "Returns a CustomXmlPartInfo with id, partName, namespaces, schemaRefs, and content; or null if not found.",
|
|
340210
|
+
requiresDocumentContext: true,
|
|
340211
|
+
metadata: readOperation2({
|
|
340212
|
+
throws: T_NOT_FOUND_CAPABLE2
|
|
340213
|
+
}),
|
|
340214
|
+
referenceDocPath: "custom-xml/parts/get.mdx",
|
|
340215
|
+
referenceGroup: "customXml"
|
|
340216
|
+
},
|
|
340217
|
+
"customXml.parts.create": {
|
|
340218
|
+
memberPath: "customXml.parts.create",
|
|
340219
|
+
description: "Add a new Custom XML Data Storage Part to the document. Generates a fresh itemID GUID and emits the Properties Part.",
|
|
340220
|
+
expectedResult: "Returns a CustomXmlPartsCreateResult with the generated id and package part names on success.",
|
|
340221
|
+
requiresDocumentContext: true,
|
|
340222
|
+
metadata: mutationOperation2({
|
|
340223
|
+
idempotency: "non-idempotent",
|
|
340224
|
+
supportsDryRun: true,
|
|
340225
|
+
supportsTrackedMode: false,
|
|
340226
|
+
possibleFailureCodes: ["INVALID_INPUT"],
|
|
340227
|
+
throws: T_REF_INSERT2
|
|
340228
|
+
}),
|
|
340229
|
+
referenceDocPath: "custom-xml/parts/create.mdx",
|
|
340230
|
+
referenceGroup: "customXml"
|
|
340231
|
+
},
|
|
340232
|
+
"customXml.parts.patch": {
|
|
340233
|
+
memberPath: "customXml.parts.patch",
|
|
340234
|
+
description: "Replace the content and/or schemaRefs of an existing Custom XML Data Storage Part. " + "At least one of content or schemaRefs is required. " + "v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
340235
|
+
expectedResult: "Returns a CustomXmlPartsMutationResult indicating success with the resolved target or a failure.",
|
|
340236
|
+
requiresDocumentContext: true,
|
|
340237
|
+
metadata: mutationOperation2({
|
|
340238
|
+
idempotency: "idempotent",
|
|
340239
|
+
supportsDryRun: true,
|
|
340240
|
+
supportsTrackedMode: false,
|
|
340241
|
+
possibleFailureCodes: ["TARGET_NOT_FOUND", "INVALID_INPUT"],
|
|
340242
|
+
throws: T_REF_MUTATION2
|
|
340243
|
+
}),
|
|
340244
|
+
referenceDocPath: "custom-xml/parts/patch.mdx",
|
|
340245
|
+
referenceGroup: "customXml"
|
|
340246
|
+
},
|
|
340247
|
+
"customXml.parts.remove": {
|
|
340248
|
+
memberPath: "customXml.parts.remove",
|
|
340249
|
+
description: "Remove a Custom XML Data Storage Part and clean up all linked package files (item, props, rels, content-types entry). " + "v1 partName targeting is limited to Word-style customXml/itemN.xml paths.",
|
|
340250
|
+
expectedResult: "Returns a CustomXmlPartsMutationResult indicating success or a failure.",
|
|
340251
|
+
requiresDocumentContext: true,
|
|
340252
|
+
metadata: mutationOperation2({
|
|
340253
|
+
idempotency: "non-idempotent",
|
|
340254
|
+
supportsDryRun: true,
|
|
340255
|
+
supportsTrackedMode: false,
|
|
340256
|
+
possibleFailureCodes: ["TARGET_NOT_FOUND"],
|
|
340257
|
+
throws: T_REF_MUTATION_REMOVE2
|
|
340258
|
+
}),
|
|
340259
|
+
referenceDocPath: "custom-xml/parts/remove.mdx",
|
|
340260
|
+
referenceGroup: "customXml"
|
|
339344
340261
|
}
|
|
339345
340262
|
};
|
|
339346
340263
|
OPERATION_IDS2 = Object.freeze(Object.keys(OPERATION_DEFINITIONS2));
|
|
@@ -341079,7 +341996,7 @@ function refConfigSchemas2() {
|
|
|
341079
341996
|
failure: refFailureSchema2
|
|
341080
341997
|
};
|
|
341081
341998
|
}
|
|
341082
|
-
var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern2, tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQueryProperties2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
|
|
341999
|
+
var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern2, tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQueryProperties2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, customXmlPartTargetSchema2, customXmlPartMutation2, customXmlPartCreateMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
|
|
341083
342000
|
var init_schemas4 = __esm(() => {
|
|
341084
342001
|
init_command_catalog();
|
|
341085
342002
|
init_types4();
|
|
@@ -342181,6 +343098,21 @@ var init_schemas4 = __esm(() => {
|
|
|
342181
343098
|
story: ref3("StoryLocator")
|
|
342182
343099
|
}, ["kind", "entityType", "name"]);
|
|
342183
343100
|
bookmarkMutation2 = refMutationSchemas2({ bookmark: bookmarkAddressSchema2 }, ["bookmark"]);
|
|
343101
|
+
customXmlPartTargetSchema2 = {
|
|
343102
|
+
oneOf: [
|
|
343103
|
+
objectSchema2({ id: { type: "string", minLength: 1 } }, ["id"]),
|
|
343104
|
+
objectSchema2({ partName: { type: "string", minLength: 1 } }, ["partName"])
|
|
343105
|
+
]
|
|
343106
|
+
};
|
|
343107
|
+
customXmlPartMutation2 = refMutationSchemas2({
|
|
343108
|
+
target: customXmlPartTargetSchema2,
|
|
343109
|
+
id: { type: "string", minLength: 1 }
|
|
343110
|
+
}, ["target"]);
|
|
343111
|
+
customXmlPartCreateMutation2 = refMutationSchemas2({
|
|
343112
|
+
id: { type: "string" },
|
|
343113
|
+
partName: { type: "string" },
|
|
343114
|
+
propsPartName: { type: "string" }
|
|
343115
|
+
}, ["id", "partName", "propsPartName"]);
|
|
342184
343116
|
footnoteAddressSchema2 = objectSchema2({ kind: { const: "entity" }, entityType: { const: "footnote" }, noteId: { type: "string" } }, ["kind", "entityType", "noteId"]);
|
|
342185
343117
|
footnoteConfigScopeSchema2 = {
|
|
342186
343118
|
oneOf: [
|
|
@@ -346049,6 +346981,43 @@ var init_schemas4 = __esm(() => {
|
|
|
346049
346981
|
output: { type: "object" },
|
|
346050
346982
|
success: { type: "object" },
|
|
346051
346983
|
failure: { type: "object" }
|
|
346984
|
+
},
|
|
346985
|
+
"customXml.parts.list": {
|
|
346986
|
+
input: objectSchema2({
|
|
346987
|
+
...refListQueryProperties2,
|
|
346988
|
+
rootNamespace: { type: "string" },
|
|
346989
|
+
schemaRef: { type: "string" }
|
|
346990
|
+
}),
|
|
346991
|
+
output: discoveryOutputSchema
|
|
346992
|
+
},
|
|
346993
|
+
"customXml.parts.get": {
|
|
346994
|
+
input: objectSchema2({ target: customXmlPartTargetSchema2 }, ["target"]),
|
|
346995
|
+
output: { oneOf: [{ type: "object" }, { type: "null" }] }
|
|
346996
|
+
},
|
|
346997
|
+
"customXml.parts.create": {
|
|
346998
|
+
input: objectSchema2({
|
|
346999
|
+
content: { type: "string", minLength: 1 },
|
|
347000
|
+
schemaRefs: { type: "array", items: { type: "string", minLength: 1 } }
|
|
347001
|
+
}, ["content"]),
|
|
347002
|
+
...customXmlPartCreateMutation2
|
|
347003
|
+
},
|
|
347004
|
+
"customXml.parts.patch": {
|
|
347005
|
+
input: {
|
|
347006
|
+
type: "object",
|
|
347007
|
+
properties: {
|
|
347008
|
+
target: customXmlPartTargetSchema2,
|
|
347009
|
+
content: { type: "string", minLength: 1 },
|
|
347010
|
+
schemaRefs: { type: "array", items: { type: "string", minLength: 1 } }
|
|
347011
|
+
},
|
|
347012
|
+
required: ["target"],
|
|
347013
|
+
anyOf: [{ required: ["content"] }, { required: ["schemaRefs"] }],
|
|
347014
|
+
additionalProperties: false
|
|
347015
|
+
},
|
|
347016
|
+
...customXmlPartMutation2
|
|
347017
|
+
},
|
|
347018
|
+
"customXml.parts.remove": {
|
|
347019
|
+
input: objectSchema2({ target: customXmlPartTargetSchema2 }, ["target"]),
|
|
347020
|
+
...customXmlPartMutation2
|
|
346052
347021
|
}
|
|
346053
347022
|
};
|
|
346054
347023
|
});
|
|
@@ -346238,6 +347207,11 @@ var init_reference_doc_map = __esm(() => {
|
|
|
346238
347207
|
title: "Permission Ranges",
|
|
346239
347208
|
description: "Permission range exception operations for protected documents.",
|
|
346240
347209
|
pagePath: "permission-ranges/index.mdx"
|
|
347210
|
+
},
|
|
347211
|
+
customXml: {
|
|
347212
|
+
title: "Custom XML",
|
|
347213
|
+
description: "Custom XML Data Storage Part operations (ECMA-376 §15.2.5, §15.2.6). Raw read and write of custom XML parts in the OOXML package.",
|
|
347214
|
+
pagePath: "custom-xml/index.mdx"
|
|
346241
347215
|
}
|
|
346242
347216
|
};
|
|
346243
347217
|
REFERENCE_OPERATION_GROUPS = Object.keys(GROUP_METADATA2).map((key2) => ({
|
|
@@ -347510,7 +348484,7 @@ function textReceiptToSDReceipt2(receipt2) {
|
|
|
347510
348484
|
resolution: receipt2.resolution ? buildResolution2(receipt2.resolution) : undefined
|
|
347511
348485
|
};
|
|
347512
348486
|
}
|
|
347513
|
-
const
|
|
348487
|
+
const failure2 = {
|
|
347514
348488
|
code: "INTERNAL_ERROR",
|
|
347515
348489
|
message: receipt2.failure.message,
|
|
347516
348490
|
...receipt2.failure.details != null ? { details: receipt2.failure.details } : {}
|
|
@@ -347528,14 +348502,14 @@ function textReceiptToSDReceipt2(receipt2) {
|
|
|
347528
348502
|
REVISION_MISMATCH: "REVISION_MISMATCH",
|
|
347529
348503
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
347530
348504
|
};
|
|
347531
|
-
|
|
348505
|
+
failure2.code = CODE_MAP[receipt2.failure.code] ?? "INTERNAL_ERROR";
|
|
347532
348506
|
return {
|
|
347533
348507
|
success: false,
|
|
347534
|
-
failure,
|
|
348508
|
+
failure: failure2,
|
|
347535
348509
|
resolution: receipt2.resolution ? buildResolution2(receipt2.resolution) : undefined
|
|
347536
348510
|
};
|
|
347537
348511
|
}
|
|
347538
|
-
function buildStructuralReceipt2(success2, params3,
|
|
348512
|
+
function buildStructuralReceipt2(success2, params3, failure2) {
|
|
347539
348513
|
const resolution = {
|
|
347540
348514
|
target: params3.target,
|
|
347541
348515
|
range: params3.range,
|
|
@@ -347546,7 +348520,7 @@ function buildStructuralReceipt2(success2, params3, failure) {
|
|
|
347546
348520
|
}
|
|
347547
348521
|
return {
|
|
347548
348522
|
success: false,
|
|
347549
|
-
failure: { code:
|
|
348523
|
+
failure: { code: failure2?.code ?? "INTERNAL_ERROR", message: failure2?.message ?? "" },
|
|
347550
348524
|
resolution
|
|
347551
348525
|
};
|
|
347552
348526
|
}
|
|
@@ -349050,7 +350024,12 @@ function buildDispatchTable2(api2) {
|
|
|
349050
350024
|
"permissionRanges.get": (input2) => api2.permissionRanges.get(input2),
|
|
349051
350025
|
"permissionRanges.create": (input2, options) => api2.permissionRanges.create(input2, options),
|
|
349052
350026
|
"permissionRanges.remove": (input2, options) => api2.permissionRanges.remove(input2, options),
|
|
349053
|
-
"permissionRanges.updatePrincipal": (input2, options) => api2.permissionRanges.updatePrincipal(input2, options)
|
|
350027
|
+
"permissionRanges.updatePrincipal": (input2, options) => api2.permissionRanges.updatePrincipal(input2, options),
|
|
350028
|
+
"customXml.parts.list": (input2) => api2.customXml.parts.list(input2),
|
|
350029
|
+
"customXml.parts.get": (input2) => api2.customXml.parts.get(input2),
|
|
350030
|
+
"customXml.parts.create": (input2, options) => api2.customXml.parts.create(input2, options),
|
|
350031
|
+
"customXml.parts.patch": (input2, options) => api2.customXml.parts.patch(input2, options),
|
|
350032
|
+
"customXml.parts.remove": (input2, options) => api2.customXml.parts.remove(input2, options)
|
|
349054
350033
|
};
|
|
349055
350034
|
}
|
|
349056
350035
|
var init_invoke = __esm(() => {
|
|
@@ -350858,6 +351837,80 @@ var init_bookmarks = __esm(() => {
|
|
|
350858
351837
|
init_story_validator();
|
|
350859
351838
|
});
|
|
350860
351839
|
|
|
351840
|
+
// ../../packages/document-api/src/customXml/customXml.ts
|
|
351841
|
+
function validateTarget2(target, operationName) {
|
|
351842
|
+
if (!target || typeof target !== "object") {
|
|
351843
|
+
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} requires a target with either { id } or { partName }.`, { target });
|
|
351844
|
+
}
|
|
351845
|
+
const t = target;
|
|
351846
|
+
const hasId = typeof t.id === "string" && t.id.length > 0;
|
|
351847
|
+
const hasPartName = typeof t.partName === "string" && t.partName.length > 0;
|
|
351848
|
+
if (!hasId && !hasPartName) {
|
|
351849
|
+
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} target must have a non-empty 'id' or 'partName'.`, { target });
|
|
351850
|
+
}
|
|
351851
|
+
if (hasId && hasPartName) {
|
|
351852
|
+
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} target must not provide both 'id' and 'partName'; choose one.`, { target });
|
|
351853
|
+
}
|
|
351854
|
+
}
|
|
351855
|
+
function validateContent2(content3, operationName) {
|
|
351856
|
+
if (typeof content3 !== "string" || content3.length === 0) {
|
|
351857
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} requires a non-empty 'content' string of well-formed XML.`, { contentType: typeof content3 });
|
|
351858
|
+
}
|
|
351859
|
+
if (!/<\s*[A-Za-z_]/.test(content3)) {
|
|
351860
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'content' does not contain a root XML element.`);
|
|
351861
|
+
}
|
|
351862
|
+
}
|
|
351863
|
+
function validateSchemaRefs2(schemaRefs, operationName) {
|
|
351864
|
+
if (!Array.isArray(schemaRefs)) {
|
|
351865
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'schemaRefs' must be an array of strings.`);
|
|
351866
|
+
}
|
|
351867
|
+
for (const [i4, entry] of schemaRefs.entries()) {
|
|
351868
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
351869
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `${operationName} 'schemaRefs[${i4}]' must be a non-empty string.`);
|
|
351870
|
+
}
|
|
351871
|
+
}
|
|
351872
|
+
}
|
|
351873
|
+
function executeCustomXmlPartsList2(adapter, query2) {
|
|
351874
|
+
if (query2?.rootNamespace !== undefined && typeof query2.rootNamespace !== "string") {
|
|
351875
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `customXml.parts.list 'rootNamespace' must be a string when provided.`);
|
|
351876
|
+
}
|
|
351877
|
+
if (query2?.schemaRef !== undefined && typeof query2.schemaRef !== "string") {
|
|
351878
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `customXml.parts.list 'schemaRef' must be a string when provided.`);
|
|
351879
|
+
}
|
|
351880
|
+
return adapter.list(query2);
|
|
351881
|
+
}
|
|
351882
|
+
function executeCustomXmlPartsGet2(adapter, input2) {
|
|
351883
|
+
validateTarget2(input2.target, "customXml.parts.get");
|
|
351884
|
+
return adapter.get(input2);
|
|
351885
|
+
}
|
|
351886
|
+
function executeCustomXmlPartsCreate2(adapter, input2, options) {
|
|
351887
|
+
validateContent2(input2.content, "customXml.parts.create");
|
|
351888
|
+
if (input2.schemaRefs !== undefined) {
|
|
351889
|
+
validateSchemaRefs2(input2.schemaRefs, "customXml.parts.create");
|
|
351890
|
+
}
|
|
351891
|
+
return adapter.create(input2, normalizeMutationOptions2(options));
|
|
351892
|
+
}
|
|
351893
|
+
function executeCustomXmlPartsPatch2(adapter, input2, options) {
|
|
351894
|
+
validateTarget2(input2.target, "customXml.parts.patch");
|
|
351895
|
+
if (input2.content === undefined && input2.schemaRefs === undefined) {
|
|
351896
|
+
throw new DocumentApiValidationError3("INVALID_INPUT", `customXml.parts.patch requires at least one of 'content' or 'schemaRefs'.`);
|
|
351897
|
+
}
|
|
351898
|
+
if (input2.content !== undefined) {
|
|
351899
|
+
validateContent2(input2.content, "customXml.parts.patch");
|
|
351900
|
+
}
|
|
351901
|
+
if (input2.schemaRefs !== undefined) {
|
|
351902
|
+
validateSchemaRefs2(input2.schemaRefs, "customXml.parts.patch");
|
|
351903
|
+
}
|
|
351904
|
+
return adapter.patch(input2, normalizeMutationOptions2(options));
|
|
351905
|
+
}
|
|
351906
|
+
function executeCustomXmlPartsRemove2(adapter, input2, options) {
|
|
351907
|
+
validateTarget2(input2.target, "customXml.parts.remove");
|
|
351908
|
+
return adapter.remove(input2, normalizeMutationOptions2(options));
|
|
351909
|
+
}
|
|
351910
|
+
var init_customXml = __esm(() => {
|
|
351911
|
+
init_errors5();
|
|
351912
|
+
});
|
|
351913
|
+
|
|
350861
351914
|
// ../../packages/document-api/src/protection/protection.ts
|
|
350862
351915
|
function validateSetEditingRestrictionInput2(input2) {
|
|
350863
351916
|
if (!input2 || typeof input2 !== "object") {
|
|
@@ -352589,6 +353642,25 @@ function createDocumentApi2(adapters) {
|
|
|
352589
353642
|
return executePermissionRangesUpdatePrincipal2(adapters.permissionRanges, input2, options);
|
|
352590
353643
|
}
|
|
352591
353644
|
},
|
|
353645
|
+
customXml: {
|
|
353646
|
+
parts: {
|
|
353647
|
+
list(input2) {
|
|
353648
|
+
return executeCustomXmlPartsList2(requireAdapter2(adapters.customXml, "customXml").parts, input2);
|
|
353649
|
+
},
|
|
353650
|
+
get(input2) {
|
|
353651
|
+
return executeCustomXmlPartsGet2(requireAdapter2(adapters.customXml, "customXml").parts, input2);
|
|
353652
|
+
},
|
|
353653
|
+
create(input2, options) {
|
|
353654
|
+
return executeCustomXmlPartsCreate2(requireAdapter2(adapters.customXml, "customXml").parts, input2, options);
|
|
353655
|
+
},
|
|
353656
|
+
patch(input2, options) {
|
|
353657
|
+
return executeCustomXmlPartsPatch2(requireAdapter2(adapters.customXml, "customXml").parts, input2, options);
|
|
353658
|
+
},
|
|
353659
|
+
remove(input2, options) {
|
|
353660
|
+
return executeCustomXmlPartsRemove2(requireAdapter2(adapters.customXml, "customXml").parts, input2, options);
|
|
353661
|
+
}
|
|
353662
|
+
}
|
|
353663
|
+
},
|
|
352592
353664
|
invoke(request) {
|
|
352593
353665
|
if (!Object.prototype.hasOwnProperty.call(dispatch, request.operationId)) {
|
|
352594
353666
|
throw new Error(`Unknown operationId: "${request.operationId}"`);
|
|
@@ -352635,6 +353707,7 @@ var init_src = __esm(() => {
|
|
|
352635
353707
|
init_hyperlinks();
|
|
352636
353708
|
init_content_controls();
|
|
352637
353709
|
init_bookmarks();
|
|
353710
|
+
init_customXml();
|
|
352638
353711
|
init_protection();
|
|
352639
353712
|
init_permission_ranges();
|
|
352640
353713
|
init_footnotes();
|
|
@@ -368632,7 +369705,7 @@ var init_part_registry = __esm(() => {
|
|
|
368632
369705
|
});
|
|
368633
369706
|
|
|
368634
369707
|
// ../../packages/super-editor/src/editors/v1/core/parts/store/part-store.ts
|
|
368635
|
-
function
|
|
369708
|
+
function getConvertedXml3(editor) {
|
|
368636
369709
|
const converter = editor.converter;
|
|
368637
369710
|
if (!converter?.convertedXml) {
|
|
368638
369711
|
throw new Error("PartStore: editor.converter.convertedXml is not available.");
|
|
@@ -368640,19 +369713,19 @@ function getConvertedXml2(editor) {
|
|
|
368640
369713
|
return converter.convertedXml;
|
|
368641
369714
|
}
|
|
368642
369715
|
function getPart2(editor, partId) {
|
|
368643
|
-
const store =
|
|
369716
|
+
const store = getConvertedXml3(editor);
|
|
368644
369717
|
return store[partId];
|
|
368645
369718
|
}
|
|
368646
369719
|
function hasPart2(editor, partId) {
|
|
368647
|
-
const store =
|
|
369720
|
+
const store = getConvertedXml3(editor);
|
|
368648
369721
|
return partId in store && store[partId] !== undefined;
|
|
368649
369722
|
}
|
|
368650
369723
|
function setPart2(editor, partId, data) {
|
|
368651
|
-
const store =
|
|
369724
|
+
const store = getConvertedXml3(editor);
|
|
368652
369725
|
store[partId] = data;
|
|
368653
369726
|
}
|
|
368654
369727
|
function removePart2(editor, partId) {
|
|
368655
|
-
const store =
|
|
369728
|
+
const store = getConvertedXml3(editor);
|
|
368656
369729
|
delete store[partId];
|
|
368657
369730
|
}
|
|
368658
369731
|
function clonePart2(part) {
|
|
@@ -397090,7 +398163,7 @@ var init_sdt_node_type_strategy = __esm(() => {
|
|
|
397090
398163
|
});
|
|
397091
398164
|
|
|
397092
398165
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/wp/helpers/drawingml-utils.js
|
|
397093
|
-
var
|
|
398166
|
+
var getLocalName3 = (name) => {
|
|
397094
398167
|
if (typeof name !== "string")
|
|
397095
398168
|
return "";
|
|
397096
398169
|
const parts = name.split(":");
|
|
@@ -397098,7 +398171,7 @@ var getLocalName2 = (name) => {
|
|
|
397098
398171
|
}, hasLocalName2 = (node4, localName) => {
|
|
397099
398172
|
if (!node4 || typeof node4 !== "object")
|
|
397100
398173
|
return false;
|
|
397101
|
-
return
|
|
398174
|
+
return getLocalName3(node4.name) === localName;
|
|
397102
398175
|
}, findChildByLocalName2 = (elements, localName) => {
|
|
397103
398176
|
if (!Array.isArray(elements))
|
|
397104
398177
|
return;
|
|
@@ -397481,7 +398554,7 @@ function convertDrawingMLPathToSvg2(pathEl) {
|
|
|
397481
398554
|
return "";
|
|
397482
398555
|
const parts = [];
|
|
397483
398556
|
for (const cmd of pathEl.elements) {
|
|
397484
|
-
switch (
|
|
398557
|
+
switch (getLocalName3(cmd.name)) {
|
|
397485
398558
|
case "moveTo": {
|
|
397486
398559
|
const pt = findChildByLocalName2(cmd.elements, "pt");
|
|
397487
398560
|
if (pt) {
|
|
@@ -426687,7 +427760,7 @@ var init_refresh_stat_fields = __esm(() => {
|
|
|
426687
427760
|
});
|
|
426688
427761
|
|
|
426689
427762
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/citation-sources.js
|
|
426690
|
-
function
|
|
427763
|
+
function getLocalName4(name) {
|
|
426691
427764
|
if (!name || typeof name !== "string")
|
|
426692
427765
|
return "";
|
|
426693
427766
|
const separatorIndex = name.indexOf(":");
|
|
@@ -426706,7 +427779,7 @@ function createTextElement3(name, text7) {
|
|
|
426706
427779
|
elements: [{ type: "text", text: String(text7) }]
|
|
426707
427780
|
};
|
|
426708
427781
|
}
|
|
426709
|
-
function
|
|
427782
|
+
function createXmlDocument3(rootElement, declaration) {
|
|
426710
427783
|
const nextDeclaration = declaration ?? DEFAULT_XML_DECLARATION2;
|
|
426711
427784
|
return {
|
|
426712
427785
|
declaration: {
|
|
@@ -426724,7 +427797,7 @@ function collectPersonNodes2(node4, output) {
|
|
|
426724
427797
|
for (const child of node4.elements) {
|
|
426725
427798
|
if (!child || child.type !== "element")
|
|
426726
427799
|
continue;
|
|
426727
|
-
if (
|
|
427800
|
+
if (getLocalName4(child.name) === "Person") {
|
|
426728
427801
|
output.push(child);
|
|
426729
427802
|
continue;
|
|
426730
427803
|
}
|
|
@@ -426736,7 +427809,7 @@ function parsePersonNode2(personNode) {
|
|
|
426736
427809
|
for (const child of personNode?.elements ?? []) {
|
|
426737
427810
|
if (!child || child.type !== "element")
|
|
426738
427811
|
continue;
|
|
426739
|
-
const localName =
|
|
427812
|
+
const localName = getLocalName4(child.name);
|
|
426740
427813
|
const value = readTextNode2(child);
|
|
426741
427814
|
if (!value)
|
|
426742
427815
|
continue;
|
|
@@ -426750,7 +427823,7 @@ function parsePersonNode2(personNode) {
|
|
|
426750
427823
|
return typeof person.last === "string" && person.last.length > 0 ? person : null;
|
|
426751
427824
|
}
|
|
426752
427825
|
function parseContributorPeople2(sourceElement, contributorTag) {
|
|
426753
|
-
const contributorNode = (sourceElement?.elements ?? []).find((child) => child?.type === "element" &&
|
|
427826
|
+
const contributorNode = (sourceElement?.elements ?? []).find((child) => child?.type === "element" && getLocalName4(child.name) === contributorTag);
|
|
426754
427827
|
if (!contributorNode)
|
|
426755
427828
|
return [];
|
|
426756
427829
|
const peopleNodes = [];
|
|
@@ -426863,7 +427936,7 @@ function parseSourceNode2(sourceNode) {
|
|
|
426863
427936
|
for (const child of sourceNode?.elements ?? []) {
|
|
426864
427937
|
if (!child || child.type !== "element")
|
|
426865
427938
|
continue;
|
|
426866
|
-
const localName =
|
|
427939
|
+
const localName = getLocalName4(child.name);
|
|
426867
427940
|
if (localName === "Tag") {
|
|
426868
427941
|
tag = readTextNode2(child);
|
|
426869
427942
|
continue;
|
|
@@ -426922,7 +427995,7 @@ function buildSourceNode2(sourceRecord) {
|
|
|
426922
427995
|
function isBibliographySourcesRoot2(rootNode) {
|
|
426923
427996
|
if (!rootNode || rootNode.type !== "element")
|
|
426924
427997
|
return false;
|
|
426925
|
-
if (
|
|
427998
|
+
if (getLocalName4(rootNode.name) !== "Sources")
|
|
426926
427999
|
return false;
|
|
426927
428000
|
const rootNamespace = rootNode.attributes?.xmlns;
|
|
426928
428001
|
const prefixedNamespace = rootNode.attributes?.["xmlns:b"];
|
|
@@ -426939,11 +428012,11 @@ function getExistingDocumentRelationshipsRoot2(convertedXml) {
|
|
|
426939
428012
|
const relsData = convertedXml?.["word/_rels/document.xml.rels"];
|
|
426940
428013
|
if (!relsData?.elements?.length)
|
|
426941
428014
|
return null;
|
|
426942
|
-
return relsData.elements.find((element3) =>
|
|
428015
|
+
return relsData.elements.find((element3) => getLocalName4(element3.name) === "Relationships") || null;
|
|
426943
428016
|
}
|
|
426944
|
-
function
|
|
428017
|
+
function ensureDocumentRelationshipsRoot3(convertedXml) {
|
|
426945
428018
|
if (!convertedXml["word/_rels/document.xml.rels"]) {
|
|
426946
|
-
convertedXml["word/_rels/document.xml.rels"] =
|
|
428019
|
+
convertedXml["word/_rels/document.xml.rels"] = createXmlDocument3({
|
|
426947
428020
|
type: "element",
|
|
426948
428021
|
name: "Relationships",
|
|
426949
428022
|
attributes: {
|
|
@@ -426954,7 +428027,7 @@ function ensureDocumentRelationshipsRoot2(convertedXml) {
|
|
|
426954
428027
|
}
|
|
426955
428028
|
const relsData = convertedXml["word/_rels/document.xml.rels"];
|
|
426956
428029
|
relsData.elements ??= [];
|
|
426957
|
-
let relationshipsRoot = relsData.elements.find((element3) =>
|
|
428030
|
+
let relationshipsRoot = relsData.elements.find((element3) => getLocalName4(element3.name) === "Relationships");
|
|
426958
428031
|
if (!relationshipsRoot) {
|
|
426959
428032
|
relationshipsRoot = {
|
|
426960
428033
|
type: "element",
|
|
@@ -426969,7 +428042,7 @@ function ensureDocumentRelationshipsRoot2(convertedXml) {
|
|
|
426969
428042
|
relationshipsRoot.elements ??= [];
|
|
426970
428043
|
return relationshipsRoot;
|
|
426971
428044
|
}
|
|
426972
|
-
function
|
|
428045
|
+
function getNextRelationshipId3(relationshipsRoot) {
|
|
426973
428046
|
const existingNumericIds = (relationshipsRoot?.elements ?? []).map((relationship) => {
|
|
426974
428047
|
const id2 = relationship?.attributes?.Id;
|
|
426975
428048
|
if (typeof id2 !== "string")
|
|
@@ -427056,7 +428129,7 @@ function buildCustomXmlItemRelationshipsRoot2(itemPropsFileName) {
|
|
|
427056
428129
|
name: "Relationship",
|
|
427057
428130
|
attributes: {
|
|
427058
428131
|
Id: "rId1",
|
|
427059
|
-
Type:
|
|
428132
|
+
Type: CUSTOM_XML_PROPS_RELATIONSHIP_TYPE3,
|
|
427060
428133
|
Target: itemPropsFileName
|
|
427061
428134
|
}
|
|
427062
428135
|
}
|
|
@@ -427116,7 +428189,7 @@ function loadBibliographyPartFromPackage2(convertedXml) {
|
|
|
427116
428189
|
}
|
|
427117
428190
|
}
|
|
427118
428191
|
for (const child of rootElement.elements ?? []) {
|
|
427119
|
-
if (!child || child.type !== "element" ||
|
|
428192
|
+
if (!child || child.type !== "element" || getLocalName4(child.name) !== "Source")
|
|
427120
428193
|
continue;
|
|
427121
428194
|
const source = parseSourceNode2(child);
|
|
427122
428195
|
if (source)
|
|
@@ -427147,8 +428220,8 @@ function syncBibliographyPartToPackage2(convertedXml, bibliographyPart) {
|
|
|
427147
428220
|
const version4 = bibliographyPart?.version ?? currentPackageState.version ?? DEFAULT_VERSION2;
|
|
427148
428221
|
const existingPartDeclaration = convertedXml[partPath]?.declaration;
|
|
427149
428222
|
const sourcesRoot = buildSourcesRootElement2(normalizedSources, { selectedStyle, styleName, version: version4 });
|
|
427150
|
-
convertedXml[partPath] =
|
|
427151
|
-
const relationshipsRoot =
|
|
428223
|
+
convertedXml[partPath] = createXmlDocument3(sourcesRoot, existingPartDeclaration);
|
|
428224
|
+
const relationshipsRoot = ensureDocumentRelationshipsRoot3(convertedXml);
|
|
427152
428225
|
const expectedTarget = buildDocumentRelationshipTarget2(partPath);
|
|
427153
428226
|
const hasCustomXmlRelationship = relationshipsRoot.elements.some((relationship) => {
|
|
427154
428227
|
if (relationship?.attributes?.Type !== CUSTOM_XML_RELATIONSHIP_TYPE2)
|
|
@@ -427161,7 +428234,7 @@ function syncBibliographyPartToPackage2(convertedXml, bibliographyPart) {
|
|
|
427161
428234
|
type: "element",
|
|
427162
428235
|
name: "Relationship",
|
|
427163
428236
|
attributes: {
|
|
427164
|
-
Id:
|
|
428237
|
+
Id: getNextRelationshipId3(relationshipsRoot),
|
|
427165
428238
|
Type: CUSTOM_XML_RELATIONSHIP_TYPE2,
|
|
427166
428239
|
Target: expectedTarget
|
|
427167
428240
|
}
|
|
@@ -427170,9 +428243,9 @@ function syncBibliographyPartToPackage2(convertedXml, bibliographyPart) {
|
|
|
427170
428243
|
const existingItemProps = convertedXml[itemPropsPath];
|
|
427171
428244
|
const existingItemPropsDeclaration = existingItemProps?.declaration;
|
|
427172
428245
|
const dataStoreItemId = extractExistingDataStoreItemId2(existingItemProps) || `{${v42().toUpperCase()}}`;
|
|
427173
|
-
convertedXml[itemPropsPath] =
|
|
428246
|
+
convertedXml[itemPropsPath] = createXmlDocument3(buildItemPropsRootElement2(dataStoreItemId), existingItemPropsDeclaration);
|
|
427174
428247
|
const existingItemRelsDeclaration = convertedXml[itemRelsPath]?.declaration;
|
|
427175
|
-
convertedXml[itemRelsPath] =
|
|
428248
|
+
convertedXml[itemRelsPath] = createXmlDocument3(buildCustomXmlItemRelationshipsRoot2(`itemProps${itemIndex}.xml`), existingItemRelsDeclaration);
|
|
427176
428249
|
return {
|
|
427177
428250
|
sources: normalizedSources,
|
|
427178
428251
|
partPath,
|
|
@@ -427187,7 +428260,7 @@ function getBibliographyPartExportPaths2(bibliographyPart) {
|
|
|
427187
428260
|
const paths = [bibliographyPart?.partPath, bibliographyPart?.itemPropsPath, bibliographyPart?.itemRelsPath];
|
|
427188
428261
|
return paths.filter((path3) => typeof path3 === "string" && path3.length > 0);
|
|
427189
428262
|
}
|
|
427190
|
-
var BIBLIOGRAPHY_NAMESPACE_URI2 = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",
|
|
428263
|
+
var BIBLIOGRAPHY_NAMESPACE_URI2 = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE2 = "/APA.XSL", DEFAULT_STYLE_NAME2 = "APA", DEFAULT_VERSION2 = "6", API_TO_OOXML_SOURCE_TYPE2, OOXML_TO_API_SOURCE_TYPE2, SIMPLE_FIELD_TO_XML_TAG2, XML_TAG_TO_SIMPLE_FIELD2;
|
|
427191
428264
|
var init_citation_sources = __esm(() => {
|
|
427192
428265
|
init_wrapper();
|
|
427193
428266
|
init_helpers();
|
|
@@ -444858,13 +445931,13 @@ function previewPlan2(editor, input2) {
|
|
|
444858
445931
|
}
|
|
444859
445932
|
stepPreviews.push(preview);
|
|
444860
445933
|
}
|
|
444861
|
-
for (const
|
|
445934
|
+
for (const failure2 of assertFailures) {
|
|
444862
445935
|
failures.push({
|
|
444863
445936
|
code: "PRECONDITION_FAILED",
|
|
444864
|
-
stepId:
|
|
445937
|
+
stepId: failure2.stepId,
|
|
444865
445938
|
phase: "assert",
|
|
444866
|
-
message: `assert "${
|
|
444867
|
-
details: { expectedCount:
|
|
445939
|
+
message: `assert "${failure2.stepId}" expected ${failure2.expectedCount} matches but found ${failure2.actualCount}`,
|
|
445940
|
+
details: { expectedCount: failure2.expectedCount, actualCount: failure2.actualCount }
|
|
444868
445941
|
});
|
|
444869
445942
|
}
|
|
444870
445943
|
} catch (error48) {
|
|
@@ -460578,12 +461651,621 @@ var init_bookmark_wrappers = __esm(() => {
|
|
|
460578
461651
|
init_story_key();
|
|
460579
461652
|
});
|
|
460580
461653
|
|
|
460581
|
-
// ../../packages/super-editor/src/editors/v1/document-api-adapters/
|
|
461654
|
+
// ../../packages/super-editor/src/editors/v1/document-api-adapters/out-of-band-mutation.ts
|
|
461655
|
+
function executeOutOfBandMutation2(editor, mutateFn, options) {
|
|
461656
|
+
if (!options.dryRun) {
|
|
461657
|
+
if (editor.options?.collaborationProvider && editor.options?.ydoc) {
|
|
461658
|
+
try {
|
|
461659
|
+
yUndoPluginKey2.getState(editor.state)?.undoManager?.stopCapturing();
|
|
461660
|
+
} catch {}
|
|
461661
|
+
} else {
|
|
461662
|
+
try {
|
|
461663
|
+
editor.view?.dispatch?.(closeHistory2(editor.state.tr));
|
|
461664
|
+
} catch {}
|
|
461665
|
+
}
|
|
461666
|
+
}
|
|
461667
|
+
checkRevision2(editor, options.expectedRevision);
|
|
461668
|
+
const result = mutateFn(options.dryRun);
|
|
461669
|
+
if (result.changed && !options.dryRun) {
|
|
461670
|
+
const converter = editor.converter;
|
|
461671
|
+
if (converter) {
|
|
461672
|
+
converter.documentModified = true;
|
|
461673
|
+
if (!converter.documentGuid && typeof converter.promoteToGuid === "function") {
|
|
461674
|
+
converter.promoteToGuid();
|
|
461675
|
+
}
|
|
461676
|
+
}
|
|
461677
|
+
incrementRevision2(editor);
|
|
461678
|
+
}
|
|
461679
|
+
return result.payload;
|
|
461680
|
+
}
|
|
461681
|
+
var init_out_of_band_mutation = __esm(() => {
|
|
461682
|
+
init_dist6();
|
|
461683
|
+
init_y_prosemirror();
|
|
461684
|
+
init_revision_tracker();
|
|
461685
|
+
});
|
|
461686
|
+
|
|
461687
|
+
// ../../packages/super-editor/src/editors/v1/core/super-converter/custom-xml-parts.js
|
|
461688
|
+
function getLocalName5(name) {
|
|
461689
|
+
if (!name || typeof name !== "string")
|
|
461690
|
+
return "";
|
|
461691
|
+
const i5 = name.indexOf(":");
|
|
461692
|
+
return i5 >= 0 ? name.slice(i5 + 1) : name;
|
|
461693
|
+
}
|
|
461694
|
+
function findFirstElement2(parent, localName) {
|
|
461695
|
+
if (!parent?.elements?.length)
|
|
461696
|
+
return null;
|
|
461697
|
+
return parent.elements.find((el) => el?.type === "element" && getLocalName5(el.name) === localName) ?? null;
|
|
461698
|
+
}
|
|
461699
|
+
function findAllElements2(parent, localName) {
|
|
461700
|
+
if (!parent?.elements?.length)
|
|
461701
|
+
return [];
|
|
461702
|
+
return parent.elements.filter((el) => el?.type === "element" && getLocalName5(el.name) === localName);
|
|
461703
|
+
}
|
|
461704
|
+
function partNameFromIndex2(index3) {
|
|
461705
|
+
return `customXml/item${index3}.xml`;
|
|
461706
|
+
}
|
|
461707
|
+
function propsPartNameFromIndex2(index3) {
|
|
461708
|
+
return `customXml/itemProps${index3}.xml`;
|
|
461709
|
+
}
|
|
461710
|
+
function indexFromPartName2(partName) {
|
|
461711
|
+
const m2 = /^customXml\/item(\d+)\.xml$/i.exec(partName ?? "");
|
|
461712
|
+
return m2 ? Number.parseInt(m2[1], 10) : null;
|
|
461713
|
+
}
|
|
461714
|
+
function indexFromPropsPartName2(propsPartName) {
|
|
461715
|
+
const m2 = /^customXml\/itemProps(\d+)\.xml$/i.exec(propsPartName ?? "");
|
|
461716
|
+
return m2 ? Number.parseInt(m2[1], 10) : null;
|
|
461717
|
+
}
|
|
461718
|
+
function isCustomXmlStoragePartName2(partName) {
|
|
461719
|
+
return indexFromPartName2(partName) != null;
|
|
461720
|
+
}
|
|
461721
|
+
function listCustomXmlStoragePartNames2(convertedXml) {
|
|
461722
|
+
if (!convertedXml || typeof convertedXml !== "object")
|
|
461723
|
+
return [];
|
|
461724
|
+
const indexes = [];
|
|
461725
|
+
for (const path3 of Object.keys(convertedXml)) {
|
|
461726
|
+
const idx = indexFromPartName2(path3);
|
|
461727
|
+
if (idx != null)
|
|
461728
|
+
indexes.push(idx);
|
|
461729
|
+
}
|
|
461730
|
+
indexes.sort((a2, b2) => a2 - b2);
|
|
461731
|
+
return indexes.map(partNameFromIndex2);
|
|
461732
|
+
}
|
|
461733
|
+
function findPropsPartFor2(convertedXml, partName) {
|
|
461734
|
+
if (!convertedXml)
|
|
461735
|
+
return null;
|
|
461736
|
+
const idx = indexFromPartName2(partName);
|
|
461737
|
+
if (idx == null)
|
|
461738
|
+
return null;
|
|
461739
|
+
const relsPath = `customXml/_rels/item${idx}.xml.rels`;
|
|
461740
|
+
const relsDoc = convertedXml[relsPath];
|
|
461741
|
+
const relsRoot = relsDoc?.elements?.find((el) => getLocalName5(el?.name) === "Relationships");
|
|
461742
|
+
if (relsRoot?.elements?.length) {
|
|
461743
|
+
for (const rel of relsRoot.elements) {
|
|
461744
|
+
if (rel?.attributes?.Type !== CUSTOM_XML_PROPS_RELATIONSHIP_TYPE4)
|
|
461745
|
+
continue;
|
|
461746
|
+
const target = rel?.attributes?.Target;
|
|
461747
|
+
if (typeof target !== "string" || target.length === 0)
|
|
461748
|
+
continue;
|
|
461749
|
+
const candidate = resolveOpcTargetPath2(target, "customXml");
|
|
461750
|
+
if (candidate && convertedXml[candidate])
|
|
461751
|
+
return candidate;
|
|
461752
|
+
}
|
|
461753
|
+
}
|
|
461754
|
+
const indexCandidate = propsPartNameFromIndex2(idx);
|
|
461755
|
+
return convertedXml[indexCandidate] ? indexCandidate : null;
|
|
461756
|
+
}
|
|
461757
|
+
function parsePropsPart2(propsDoc) {
|
|
461758
|
+
const root4 = propsDoc?.elements?.find((el) => el?.type === "element" && getLocalName5(el.name) === "datastoreItem");
|
|
461759
|
+
if (!root4)
|
|
461760
|
+
return null;
|
|
461761
|
+
const itemId = root4.attributes?.["ds:itemID"] ?? root4.attributes?.itemID ?? null;
|
|
461762
|
+
const schemaRefsEl = findFirstElement2(root4, "schemaRefs");
|
|
461763
|
+
const schemaRefs = findAllElements2(schemaRefsEl, "schemaRef").map((el) => el.attributes?.["ds:uri"] ?? el.attributes?.uri ?? null).filter((uri) => typeof uri === "string" && uri.length > 0);
|
|
461764
|
+
return { itemId: typeof itemId === "string" && itemId.length > 0 ? itemId : null, schemaRefs };
|
|
461765
|
+
}
|
|
461766
|
+
function parseStoragePartRootNamespace2(storageDoc) {
|
|
461767
|
+
const root4 = storageDoc?.elements?.find((el) => el?.type === "element");
|
|
461768
|
+
if (!root4)
|
|
461769
|
+
return null;
|
|
461770
|
+
const xmlns2 = root4.attributes?.xmlns;
|
|
461771
|
+
if (typeof xmlns2 === "string" && xmlns2.length > 0)
|
|
461772
|
+
return xmlns2;
|
|
461773
|
+
const elementName = root4.name ?? "";
|
|
461774
|
+
const colonIdx = elementName.indexOf(":");
|
|
461775
|
+
if (colonIdx > 0) {
|
|
461776
|
+
const prefix2 = elementName.slice(0, colonIdx);
|
|
461777
|
+
const prefixedAttr = `xmlns:${prefix2}`;
|
|
461778
|
+
const prefixedValue = root4.attributes?.[prefixedAttr];
|
|
461779
|
+
if (typeof prefixedValue === "string" && prefixedValue.length > 0)
|
|
461780
|
+
return prefixedValue;
|
|
461781
|
+
}
|
|
461782
|
+
return null;
|
|
461783
|
+
}
|
|
461784
|
+
function serializeXmlDoc2(xmlDoc) {
|
|
461785
|
+
if (!xmlDoc)
|
|
461786
|
+
return "";
|
|
461787
|
+
return xmljs3.js2xml(xmlDoc, { compact: false, spaces: 0 });
|
|
461788
|
+
}
|
|
461789
|
+
function readCustomXmlPart2(convertedXml, target) {
|
|
461790
|
+
if (!target || !convertedXml)
|
|
461791
|
+
return null;
|
|
461792
|
+
let partName = null;
|
|
461793
|
+
let itemId = null;
|
|
461794
|
+
if (typeof target.partName === "string" && target.partName.length > 0) {
|
|
461795
|
+
if (!isCustomXmlStoragePartName2(target.partName))
|
|
461796
|
+
return null;
|
|
461797
|
+
partName = target.partName;
|
|
461798
|
+
} else if (typeof target.id === "string" && target.id.length > 0) {
|
|
461799
|
+
itemId = target.id;
|
|
461800
|
+
for (const candidatePartName of listCustomXmlStoragePartNames2(convertedXml)) {
|
|
461801
|
+
const propsName = findPropsPartFor2(convertedXml, candidatePartName);
|
|
461802
|
+
if (!propsName)
|
|
461803
|
+
continue;
|
|
461804
|
+
const parsed = parsePropsPart2(convertedXml[propsName]);
|
|
461805
|
+
if (parsed?.itemId === itemId) {
|
|
461806
|
+
partName = candidatePartName;
|
|
461807
|
+
break;
|
|
461808
|
+
}
|
|
461809
|
+
}
|
|
461810
|
+
if (!partName)
|
|
461811
|
+
return null;
|
|
461812
|
+
} else {
|
|
461813
|
+
return null;
|
|
461814
|
+
}
|
|
461815
|
+
const storageDoc = convertedXml[partName];
|
|
461816
|
+
if (!storageDoc)
|
|
461817
|
+
return null;
|
|
461818
|
+
const propsPartName = findPropsPartFor2(convertedXml, partName);
|
|
461819
|
+
const props = propsPartName ? parsePropsPart2(convertedXml[propsPartName]) : null;
|
|
461820
|
+
return {
|
|
461821
|
+
id: props?.itemId ?? null,
|
|
461822
|
+
partName,
|
|
461823
|
+
propsPartName: propsPartName ?? null,
|
|
461824
|
+
rootNamespace: parseStoragePartRootNamespace2(storageDoc),
|
|
461825
|
+
schemaRefs: props?.schemaRefs ?? [],
|
|
461826
|
+
content: serializeXmlDoc2(storageDoc)
|
|
461827
|
+
};
|
|
461828
|
+
}
|
|
461829
|
+
function listCustomXmlParts2(convertedXml) {
|
|
461830
|
+
return listCustomXmlStoragePartNames2(convertedXml).map((partName) => {
|
|
461831
|
+
const propsPartName = findPropsPartFor2(convertedXml, partName);
|
|
461832
|
+
const props = propsPartName ? parsePropsPart2(convertedXml[propsPartName]) : null;
|
|
461833
|
+
return {
|
|
461834
|
+
id: props?.itemId ?? null,
|
|
461835
|
+
partName,
|
|
461836
|
+
propsPartName: propsPartName ?? null,
|
|
461837
|
+
rootNamespace: parseStoragePartRootNamespace2(convertedXml[partName]),
|
|
461838
|
+
schemaRefs: props?.schemaRefs ?? []
|
|
461839
|
+
};
|
|
461840
|
+
});
|
|
461841
|
+
}
|
|
461842
|
+
function nextCustomXmlItemIndex2(convertedXml, converter) {
|
|
461843
|
+
const used = new Set;
|
|
461844
|
+
for (const path3 of Object.keys(convertedXml ?? {})) {
|
|
461845
|
+
const idx = indexFromPartName2(path3) ?? indexFromPropsPartName2(path3);
|
|
461846
|
+
if (idx != null)
|
|
461847
|
+
used.add(idx);
|
|
461848
|
+
}
|
|
461849
|
+
let candidate = 1;
|
|
461850
|
+
while (used.has(candidate))
|
|
461851
|
+
candidate += 1;
|
|
461852
|
+
return candidate;
|
|
461853
|
+
}
|
|
461854
|
+
function createXmlDocument4(rootElement, declaration) {
|
|
461855
|
+
const nextDeclaration = declaration ?? DEFAULT_XML_DECLARATION2;
|
|
461856
|
+
return {
|
|
461857
|
+
declaration: {
|
|
461858
|
+
...nextDeclaration,
|
|
461859
|
+
attributes: { ...nextDeclaration.attributes }
|
|
461860
|
+
},
|
|
461861
|
+
elements: [rootElement]
|
|
461862
|
+
};
|
|
461863
|
+
}
|
|
461864
|
+
function parseContentToRootElement2(content5) {
|
|
461865
|
+
const parsed = xmljs3.xml2js(content5, { compact: false });
|
|
461866
|
+
const root4 = (parsed.elements ?? []).find((el) => el?.type === "element");
|
|
461867
|
+
if (!root4) {
|
|
461868
|
+
throw new Error("Custom XML content is missing a root element.");
|
|
461869
|
+
}
|
|
461870
|
+
return { root: root4, declaration: parsed.declaration ?? null };
|
|
461871
|
+
}
|
|
461872
|
+
function ensureDocumentRelationshipsRoot4(convertedXml) {
|
|
461873
|
+
if (!convertedXml["word/_rels/document.xml.rels"]) {
|
|
461874
|
+
convertedXml["word/_rels/document.xml.rels"] = createXmlDocument4({
|
|
461875
|
+
type: "element",
|
|
461876
|
+
name: "Relationships",
|
|
461877
|
+
attributes: {
|
|
461878
|
+
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
461879
|
+
},
|
|
461880
|
+
elements: []
|
|
461881
|
+
});
|
|
461882
|
+
}
|
|
461883
|
+
const relsData = convertedXml["word/_rels/document.xml.rels"];
|
|
461884
|
+
relsData.elements ??= [];
|
|
461885
|
+
let relsRoot = relsData.elements.find((el) => getLocalName5(el?.name) === "Relationships");
|
|
461886
|
+
if (!relsRoot) {
|
|
461887
|
+
relsRoot = {
|
|
461888
|
+
type: "element",
|
|
461889
|
+
name: "Relationships",
|
|
461890
|
+
attributes: {
|
|
461891
|
+
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
461892
|
+
},
|
|
461893
|
+
elements: []
|
|
461894
|
+
};
|
|
461895
|
+
relsData.elements.push(relsRoot);
|
|
461896
|
+
}
|
|
461897
|
+
relsRoot.elements ??= [];
|
|
461898
|
+
return relsRoot;
|
|
461899
|
+
}
|
|
461900
|
+
function getNextRelationshipId4(relsRoot) {
|
|
461901
|
+
const used = (relsRoot?.elements ?? []).map((rel) => {
|
|
461902
|
+
const id2 = rel?.attributes?.Id;
|
|
461903
|
+
const m2 = typeof id2 === "string" ? /^rId(\d+)$/.exec(id2) : null;
|
|
461904
|
+
return m2 ? Number.parseInt(m2[1], 10) : NaN;
|
|
461905
|
+
}).filter((n) => Number.isFinite(n));
|
|
461906
|
+
const max3 = used.length > 0 ? Math.max(...used) : 0;
|
|
461907
|
+
return `rId${max3 + 1}`;
|
|
461908
|
+
}
|
|
461909
|
+
function buildDocumentRelTarget2(partName) {
|
|
461910
|
+
return partName.startsWith("customXml/") ? `../${partName}` : partName;
|
|
461911
|
+
}
|
|
461912
|
+
function buildItemPropsRoot2(itemId, schemaRefs) {
|
|
461913
|
+
const elements = [
|
|
461914
|
+
{
|
|
461915
|
+
type: "element",
|
|
461916
|
+
name: "ds:datastoreItem",
|
|
461917
|
+
attributes: {
|
|
461918
|
+
"ds:itemID": itemId,
|
|
461919
|
+
"xmlns:ds": CUSTOM_XML_DATASTORE_NAMESPACE2
|
|
461920
|
+
},
|
|
461921
|
+
elements: schemaRefs === undefined ? [] : [
|
|
461922
|
+
{
|
|
461923
|
+
type: "element",
|
|
461924
|
+
name: "ds:schemaRefs",
|
|
461925
|
+
elements: schemaRefs.map((uri) => ({
|
|
461926
|
+
type: "element",
|
|
461927
|
+
name: "ds:schemaRef",
|
|
461928
|
+
attributes: { "ds:uri": uri }
|
|
461929
|
+
}))
|
|
461930
|
+
}
|
|
461931
|
+
]
|
|
461932
|
+
}
|
|
461933
|
+
];
|
|
461934
|
+
return elements[0];
|
|
461935
|
+
}
|
|
461936
|
+
function buildItemRelsRoot2(propsPartFileName) {
|
|
461937
|
+
return {
|
|
461938
|
+
type: "element",
|
|
461939
|
+
name: "Relationships",
|
|
461940
|
+
attributes: {
|
|
461941
|
+
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
|
|
461942
|
+
},
|
|
461943
|
+
elements: [
|
|
461944
|
+
{
|
|
461945
|
+
type: "element",
|
|
461946
|
+
name: "Relationship",
|
|
461947
|
+
attributes: {
|
|
461948
|
+
Id: "rId1",
|
|
461949
|
+
Type: CUSTOM_XML_PROPS_RELATIONSHIP_TYPE4,
|
|
461950
|
+
Target: propsPartFileName
|
|
461951
|
+
}
|
|
461952
|
+
}
|
|
461953
|
+
]
|
|
461954
|
+
};
|
|
461955
|
+
}
|
|
461956
|
+
function resolveTargetPartName2(convertedXml, target) {
|
|
461957
|
+
if (!target)
|
|
461958
|
+
return null;
|
|
461959
|
+
if (typeof target.partName === "string" && target.partName.length > 0) {
|
|
461960
|
+
if (!isCustomXmlStoragePartName2(target.partName))
|
|
461961
|
+
return null;
|
|
461962
|
+
return convertedXml[target.partName] ? target.partName : null;
|
|
461963
|
+
}
|
|
461964
|
+
if (typeof target.id === "string" && target.id.length > 0) {
|
|
461965
|
+
for (const partName of listCustomXmlStoragePartNames2(convertedXml)) {
|
|
461966
|
+
const propsName = findPropsPartFor2(convertedXml, partName);
|
|
461967
|
+
if (!propsName)
|
|
461968
|
+
continue;
|
|
461969
|
+
const parsed = parsePropsPart2(convertedXml[propsName]);
|
|
461970
|
+
if (parsed?.itemId === target.id)
|
|
461971
|
+
return partName;
|
|
461972
|
+
}
|
|
461973
|
+
}
|
|
461974
|
+
return null;
|
|
461975
|
+
}
|
|
461976
|
+
function createCustomXmlPart2(convertedXml, { content: content5, schemaRefs }, converter) {
|
|
461977
|
+
const { root: root4, declaration } = parseContentToRootElement2(content5);
|
|
461978
|
+
const index3 = nextCustomXmlItemIndex2(convertedXml, converter);
|
|
461979
|
+
const partName = partNameFromIndex2(index3);
|
|
461980
|
+
const propsPartName = propsPartNameFromIndex2(index3);
|
|
461981
|
+
const itemRelsPath = `customXml/_rels/item${index3}.xml.rels`;
|
|
461982
|
+
const itemId = `{${v42().toUpperCase()}}`;
|
|
461983
|
+
convertedXml[partName] = createXmlDocument4(root4, declaration);
|
|
461984
|
+
convertedXml[propsPartName] = createXmlDocument4(buildItemPropsRoot2(itemId, schemaRefs));
|
|
461985
|
+
convertedXml[itemRelsPath] = createXmlDocument4(buildItemRelsRoot2(`itemProps${index3}.xml`));
|
|
461986
|
+
const relsRoot = ensureDocumentRelationshipsRoot4(convertedXml);
|
|
461987
|
+
relsRoot.elements.push({
|
|
461988
|
+
type: "element",
|
|
461989
|
+
name: "Relationship",
|
|
461990
|
+
attributes: {
|
|
461991
|
+
Id: getNextRelationshipId4(relsRoot),
|
|
461992
|
+
Type: CUSTOM_XML_DATA_RELATIONSHIP_TYPE2,
|
|
461993
|
+
Target: buildDocumentRelTarget2(partName)
|
|
461994
|
+
}
|
|
461995
|
+
});
|
|
461996
|
+
if (converter?.removedCustomXmlPaths instanceof Set) {
|
|
461997
|
+
converter.removedCustomXmlPaths.delete(partName);
|
|
461998
|
+
converter.removedCustomXmlPaths.delete(propsPartName);
|
|
461999
|
+
converter.removedCustomXmlPaths.delete(itemRelsPath);
|
|
462000
|
+
}
|
|
462001
|
+
return { id: itemId, partName, propsPartName };
|
|
462002
|
+
}
|
|
462003
|
+
function patchCustomXmlPart2(convertedXml, target, { content: content5, schemaRefs }, converter) {
|
|
462004
|
+
const partName = resolveTargetPartName2(convertedXml, target);
|
|
462005
|
+
if (!partName)
|
|
462006
|
+
return null;
|
|
462007
|
+
if (content5 !== undefined) {
|
|
462008
|
+
const { root: root4, declaration } = parseContentToRootElement2(content5);
|
|
462009
|
+
const existingDecl = convertedXml[partName]?.declaration ?? declaration;
|
|
462010
|
+
convertedXml[partName] = createXmlDocument4(root4, existingDecl);
|
|
462011
|
+
}
|
|
462012
|
+
let resolvedId = null;
|
|
462013
|
+
if (schemaRefs !== undefined) {
|
|
462014
|
+
let propsPartName = findPropsPartFor2(convertedXml, partName);
|
|
462015
|
+
if (propsPartName) {
|
|
462016
|
+
resolvedId = parsePropsPart2(convertedXml[propsPartName])?.itemId ?? null;
|
|
462017
|
+
}
|
|
462018
|
+
if (!propsPartName) {
|
|
462019
|
+
const idx = indexFromPartName2(partName);
|
|
462020
|
+
if (idx == null)
|
|
462021
|
+
return null;
|
|
462022
|
+
propsPartName = propsPartNameFromIndex2(idx);
|
|
462023
|
+
const itemRelsPath = `customXml/_rels/item${idx}.xml.rels`;
|
|
462024
|
+
resolvedId = `{${v42().toUpperCase()}}`;
|
|
462025
|
+
convertedXml[itemRelsPath] = createXmlDocument4(buildItemRelsRoot2(`itemProps${idx}.xml`));
|
|
462026
|
+
}
|
|
462027
|
+
if (!resolvedId)
|
|
462028
|
+
resolvedId = `{${v42().toUpperCase()}}`;
|
|
462029
|
+
const existingDecl = convertedXml[propsPartName]?.declaration;
|
|
462030
|
+
convertedXml[propsPartName] = createXmlDocument4(buildItemPropsRoot2(resolvedId, schemaRefs), existingDecl);
|
|
462031
|
+
} else {
|
|
462032
|
+
const propsPartName = findPropsPartFor2(convertedXml, partName);
|
|
462033
|
+
if (propsPartName) {
|
|
462034
|
+
resolvedId = parsePropsPart2(convertedXml[propsPartName])?.itemId ?? null;
|
|
462035
|
+
}
|
|
462036
|
+
}
|
|
462037
|
+
if (converter)
|
|
462038
|
+
invalidateConverterCachesForPath2(converter, partName);
|
|
462039
|
+
return resolvedId ? { partName, id: resolvedId } : { partName };
|
|
462040
|
+
}
|
|
462041
|
+
function removeCustomXmlPart2(convertedXml, target, converter) {
|
|
462042
|
+
const partName = resolveTargetPartName2(convertedXml, target);
|
|
462043
|
+
if (!partName)
|
|
462044
|
+
return false;
|
|
462045
|
+
const index3 = indexFromPartName2(partName);
|
|
462046
|
+
const propsPartName = findPropsPartFor2(convertedXml, partName);
|
|
462047
|
+
const itemRelsPath = index3 == null ? null : `customXml/_rels/item${index3}.xml.rels`;
|
|
462048
|
+
const removedPaths = [partName, propsPartName, itemRelsPath].filter((path3) => typeof path3 === "string" && path3.length > 0);
|
|
462049
|
+
for (const path3 of removedPaths) {
|
|
462050
|
+
delete convertedXml[path3];
|
|
462051
|
+
}
|
|
462052
|
+
const relsRoot = convertedXml["word/_rels/document.xml.rels"]?.elements?.find((el) => getLocalName5(el?.name) === "Relationships");
|
|
462053
|
+
if (relsRoot?.elements?.length) {
|
|
462054
|
+
relsRoot.elements = relsRoot.elements.filter((rel) => {
|
|
462055
|
+
if (rel?.attributes?.Type !== CUSTOM_XML_DATA_RELATIONSHIP_TYPE2)
|
|
462056
|
+
return true;
|
|
462057
|
+
const resolved = resolveOpcTargetPath2(rel?.attributes?.Target, "word");
|
|
462058
|
+
return resolved !== partName;
|
|
462059
|
+
});
|
|
462060
|
+
}
|
|
462061
|
+
if (converter) {
|
|
462062
|
+
if (!(converter.removedCustomXmlPaths instanceof Set)) {
|
|
462063
|
+
converter.removedCustomXmlPaths = new Set;
|
|
462064
|
+
}
|
|
462065
|
+
for (const path3 of removedPaths)
|
|
462066
|
+
converter.removedCustomXmlPaths.add(path3);
|
|
462067
|
+
invalidateConverterCachesForPath2(converter, partName);
|
|
462068
|
+
}
|
|
462069
|
+
return true;
|
|
462070
|
+
}
|
|
462071
|
+
function invalidateConverterCachesForPath2(converter, partName) {
|
|
462072
|
+
if (!converter || typeof partName !== "string")
|
|
462073
|
+
return;
|
|
462074
|
+
const biblio = converter.bibliographyPart;
|
|
462075
|
+
if (biblio && biblio.partPath === partName) {
|
|
462076
|
+
converter.bibliographyPart = {
|
|
462077
|
+
sources: [],
|
|
462078
|
+
partPath: null,
|
|
462079
|
+
itemPropsPath: null,
|
|
462080
|
+
itemRelsPath: null,
|
|
462081
|
+
selectedStyle: null,
|
|
462082
|
+
styleName: null,
|
|
462083
|
+
version: null
|
|
462084
|
+
};
|
|
462085
|
+
}
|
|
462086
|
+
}
|
|
462087
|
+
var xmljs3, CUSTOM_XML_DATA_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE4 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE2 = "http://schemas.openxmlformats.org/officeDocument/2006/customXml";
|
|
462088
|
+
var init_custom_xml_parts = __esm(() => {
|
|
462089
|
+
init_wrapper();
|
|
462090
|
+
init_helpers();
|
|
462091
|
+
init_constants3();
|
|
462092
|
+
xmljs3 = __toESM(require_lib3(), 1);
|
|
462093
|
+
});
|
|
462094
|
+
|
|
462095
|
+
// ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/custom-xml-wrappers.ts
|
|
460582
462096
|
function getConverter19(editor) {
|
|
462097
|
+
return editor.converter ?? null;
|
|
462098
|
+
}
|
|
462099
|
+
function getConvertedXml4(editor) {
|
|
462100
|
+
return getConverter19(editor)?.convertedXml ?? {};
|
|
462101
|
+
}
|
|
462102
|
+
function toSummary2(record3) {
|
|
462103
|
+
const summary = {
|
|
462104
|
+
partName: record3.partName,
|
|
462105
|
+
schemaRefs: record3.schemaRefs
|
|
462106
|
+
};
|
|
462107
|
+
if (record3.id)
|
|
462108
|
+
summary.id = record3.id;
|
|
462109
|
+
if (record3.propsPartName)
|
|
462110
|
+
summary.propsPartName = record3.propsPartName;
|
|
462111
|
+
if (record3.rootNamespace)
|
|
462112
|
+
summary.rootNamespace = record3.rootNamespace;
|
|
462113
|
+
return summary;
|
|
462114
|
+
}
|
|
462115
|
+
function customXmlPartsListWrapper2(editor, query2) {
|
|
462116
|
+
const revision = getRevision2(editor);
|
|
462117
|
+
const all6 = listCustomXmlParts2(getConvertedXml4(editor));
|
|
462118
|
+
let filtered = all6;
|
|
462119
|
+
if (query2?.rootNamespace !== undefined) {
|
|
462120
|
+
filtered = filtered.filter((p3) => p3.rootNamespace === query2.rootNamespace);
|
|
462121
|
+
}
|
|
462122
|
+
if (query2?.schemaRef !== undefined) {
|
|
462123
|
+
filtered = filtered.filter((p3) => p3.schemaRefs.includes(query2.schemaRef));
|
|
462124
|
+
}
|
|
462125
|
+
const allItems = filtered.map((record3) => {
|
|
462126
|
+
const summary = toSummary2(record3);
|
|
462127
|
+
const stableId = summary.id ?? summary.partName;
|
|
462128
|
+
return buildDiscoveryItem2(stableId, buildResolvedHandle2(`customXml:${stableId}`, "ephemeral", "ext:customXmlPart"), summary);
|
|
462129
|
+
});
|
|
462130
|
+
const { total, items: paged } = paginate2(allItems, query2?.offset, query2?.limit);
|
|
462131
|
+
const effectiveLimit = query2?.limit ?? total;
|
|
462132
|
+
return buildDiscoveryResult2({
|
|
462133
|
+
evaluatedRevision: revision,
|
|
462134
|
+
total,
|
|
462135
|
+
items: paged,
|
|
462136
|
+
page: { limit: effectiveLimit, offset: query2?.offset ?? 0, returned: paged.length }
|
|
462137
|
+
});
|
|
462138
|
+
}
|
|
462139
|
+
function customXmlPartsGetWrapper2(editor, input2) {
|
|
462140
|
+
const record3 = readCustomXmlPart2(getConvertedXml4(editor), input2.target);
|
|
462141
|
+
if (!record3)
|
|
462142
|
+
return null;
|
|
462143
|
+
const info = {
|
|
462144
|
+
partName: record3.partName,
|
|
462145
|
+
rootNamespace: record3.rootNamespace ?? undefined,
|
|
462146
|
+
schemaRefs: record3.schemaRefs,
|
|
462147
|
+
content: record3.content
|
|
462148
|
+
};
|
|
462149
|
+
if (record3.id)
|
|
462150
|
+
info.id = record3.id;
|
|
462151
|
+
if (record3.propsPartName)
|
|
462152
|
+
info.propsPartName = record3.propsPartName;
|
|
462153
|
+
return info;
|
|
462154
|
+
}
|
|
462155
|
+
function failure2(code10, message) {
|
|
462156
|
+
return { success: false, failure: { code: code10, message } };
|
|
462157
|
+
}
|
|
462158
|
+
function isWriteFailure2(outcome) {
|
|
462159
|
+
return outcome.ok === false;
|
|
462160
|
+
}
|
|
462161
|
+
function targetNotFound2() {
|
|
462162
|
+
return { ok: false, code: "TARGET_NOT_FOUND", message: "No custom XML part matched the supplied target." };
|
|
462163
|
+
}
|
|
462164
|
+
function safeValidate2(fn2) {
|
|
462165
|
+
try {
|
|
462166
|
+
return { ok: true, payload: fn2() };
|
|
462167
|
+
} catch (e) {
|
|
462168
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
462169
|
+
return { ok: false, code: "INVALID_INPUT", message: msg };
|
|
462170
|
+
}
|
|
462171
|
+
}
|
|
462172
|
+
function customXmlPartsCreateWrapper2(editor, input2, options) {
|
|
462173
|
+
rejectTrackedMode2("customXml.parts.create", options);
|
|
462174
|
+
const outcome = executeOutOfBandMutation2(editor, (dryRun) => {
|
|
462175
|
+
if (dryRun) {
|
|
462176
|
+
const probe2 = safeValidate2(() => createCustomXmlPart2({}, { content: input2.content, schemaRefs: input2.schemaRefs }));
|
|
462177
|
+
if (isWriteFailure2(probe2))
|
|
462178
|
+
return { changed: false, payload: probe2 };
|
|
462179
|
+
return {
|
|
462180
|
+
changed: false,
|
|
462181
|
+
payload: { ok: true, payload: { id: "{DRY-RUN}", partName: "", propsPartName: "" } }
|
|
462182
|
+
};
|
|
462183
|
+
}
|
|
462184
|
+
const probe = safeValidate2(() => createCustomXmlPart2(getConvertedXml4(editor), { content: input2.content, schemaRefs: input2.schemaRefs }, getConverter19(editor)));
|
|
462185
|
+
if (isWriteFailure2(probe))
|
|
462186
|
+
return { changed: false, payload: probe };
|
|
462187
|
+
return { changed: true, payload: { ok: true, payload: probe.payload } };
|
|
462188
|
+
}, { dryRun: options?.dryRun === true, expectedRevision: options?.expectedRevision });
|
|
462189
|
+
if (isWriteFailure2(outcome))
|
|
462190
|
+
return failure2(outcome.code, outcome.message);
|
|
462191
|
+
return {
|
|
462192
|
+
success: true,
|
|
462193
|
+
id: outcome.payload.id,
|
|
462194
|
+
partName: outcome.payload.partName,
|
|
462195
|
+
propsPartName: outcome.payload.propsPartName
|
|
462196
|
+
};
|
|
462197
|
+
}
|
|
462198
|
+
function customXmlPartsPatchWrapper2(editor, input2, options) {
|
|
462199
|
+
rejectTrackedMode2("customXml.parts.patch", options);
|
|
462200
|
+
const outcome = executeOutOfBandMutation2(editor, (dryRun) => {
|
|
462201
|
+
if (dryRun) {
|
|
462202
|
+
const partName2 = resolveTargetPartName2(getConvertedXml4(editor), input2.target);
|
|
462203
|
+
if (!partName2)
|
|
462204
|
+
return { changed: false, payload: targetNotFound2() };
|
|
462205
|
+
if (input2.content !== undefined) {
|
|
462206
|
+
const probe2 = safeValidate2(() => createCustomXmlPart2({}, { content: input2.content, schemaRefs: undefined }));
|
|
462207
|
+
if (isWriteFailure2(probe2))
|
|
462208
|
+
return { changed: false, payload: probe2 };
|
|
462209
|
+
}
|
|
462210
|
+
return { changed: false, payload: { ok: true, payload: { id: null } } };
|
|
462211
|
+
}
|
|
462212
|
+
const partName = resolveTargetPartName2(getConvertedXml4(editor), input2.target);
|
|
462213
|
+
if (!partName)
|
|
462214
|
+
return { changed: false, payload: targetNotFound2() };
|
|
462215
|
+
const probe = safeValidate2(() => patchCustomXmlPart2(getConvertedXml4(editor), input2.target, { content: input2.content, schemaRefs: input2.schemaRefs }, getConverter19(editor)));
|
|
462216
|
+
if (isWriteFailure2(probe))
|
|
462217
|
+
return { changed: false, payload: probe };
|
|
462218
|
+
if (!probe.payload)
|
|
462219
|
+
return { changed: false, payload: targetNotFound2() };
|
|
462220
|
+
return { changed: true, payload: { ok: true, payload: { id: probe.payload.id ?? null } } };
|
|
462221
|
+
}, { dryRun: options?.dryRun === true, expectedRevision: options?.expectedRevision });
|
|
462222
|
+
if (isWriteFailure2(outcome))
|
|
462223
|
+
return failure2(outcome.code, outcome.message);
|
|
462224
|
+
const result = { success: true, target: input2.target };
|
|
462225
|
+
if (outcome.payload.id)
|
|
462226
|
+
result.id = outcome.payload.id;
|
|
462227
|
+
return result;
|
|
462228
|
+
}
|
|
462229
|
+
function customXmlPartsRemoveWrapper2(editor, input2, options) {
|
|
462230
|
+
rejectTrackedMode2("customXml.parts.remove", options);
|
|
462231
|
+
const outcome = executeOutOfBandMutation2(editor, (dryRun) => {
|
|
462232
|
+
if (dryRun) {
|
|
462233
|
+
const partName = resolveTargetPartName2(getConvertedXml4(editor), input2.target);
|
|
462234
|
+
return partName ? { changed: false, payload: { ok: true, payload: true } } : { changed: false, payload: targetNotFound2() };
|
|
462235
|
+
}
|
|
462236
|
+
const ok5 = removeCustomXmlPart2(getConvertedXml4(editor), input2.target, getConverter19(editor));
|
|
462237
|
+
if (!ok5)
|
|
462238
|
+
return { changed: false, payload: targetNotFound2() };
|
|
462239
|
+
return { changed: true, payload: { ok: true, payload: true } };
|
|
462240
|
+
}, { dryRun: options?.dryRun === true, expectedRevision: options?.expectedRevision });
|
|
462241
|
+
if (isWriteFailure2(outcome))
|
|
462242
|
+
return failure2(outcome.code, outcome.message);
|
|
462243
|
+
return { success: true, target: input2.target };
|
|
462244
|
+
}
|
|
462245
|
+
function createCustomXmlPartsAdapter2(editor) {
|
|
462246
|
+
return {
|
|
462247
|
+
list: (query2) => customXmlPartsListWrapper2(editor, query2),
|
|
462248
|
+
get: (input2) => customXmlPartsGetWrapper2(editor, input2),
|
|
462249
|
+
create: (input2, options) => customXmlPartsCreateWrapper2(editor, input2, options),
|
|
462250
|
+
patch: (input2, options) => customXmlPartsPatchWrapper2(editor, input2, options),
|
|
462251
|
+
remove: (input2, options) => customXmlPartsRemoveWrapper2(editor, input2, options)
|
|
462252
|
+
};
|
|
462253
|
+
}
|
|
462254
|
+
var init_custom_xml_wrappers = __esm(() => {
|
|
462255
|
+
init_src();
|
|
462256
|
+
init_adapter_utils();
|
|
462257
|
+
init_revision_tracker();
|
|
462258
|
+
init_mutation_helpers();
|
|
462259
|
+
init_out_of_band_mutation();
|
|
462260
|
+
init_custom_xml_parts();
|
|
462261
|
+
});
|
|
462262
|
+
|
|
462263
|
+
// ../../packages/super-editor/src/editors/v1/document-api-adapters/protection-adapter.ts
|
|
462264
|
+
function getConverter20(editor) {
|
|
460583
462265
|
return editor.converter ?? undefined;
|
|
460584
462266
|
}
|
|
460585
462267
|
function requireConverter3(editor, operationName) {
|
|
460586
|
-
const converter =
|
|
462268
|
+
const converter = getConverter20(editor);
|
|
460587
462269
|
if (!converter) {
|
|
460588
462270
|
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `${operationName} requires an active document converter.`);
|
|
460589
462271
|
}
|
|
@@ -460609,7 +462291,7 @@ function protectionGetAdapter2(editor) {
|
|
|
460609
462291
|
if (stored?.initialized) {
|
|
460610
462292
|
return stored.state;
|
|
460611
462293
|
}
|
|
460612
|
-
const converter =
|
|
462294
|
+
const converter = getConverter20(editor);
|
|
460613
462295
|
const settingsRoot = converter ? readSettingsRoot2(converter) : null;
|
|
460614
462296
|
return parseProtectionState2(settingsRoot);
|
|
460615
462297
|
}
|
|
@@ -461385,7 +463067,7 @@ function footnoteFailure2(code10, message) {
|
|
|
461385
463067
|
function configSuccess2() {
|
|
461386
463068
|
return { success: true };
|
|
461387
463069
|
}
|
|
461388
|
-
function
|
|
463070
|
+
function getConverter21(editor) {
|
|
461389
463071
|
const converter = editor.converter;
|
|
461390
463072
|
if (!converter) {
|
|
461391
463073
|
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "converter not available.");
|
|
@@ -461452,7 +463134,7 @@ function footnotesGetWrapper2(editor, input2) {
|
|
|
461452
463134
|
function footnotesInsertWrapper2(editor, input2, options) {
|
|
461453
463135
|
rejectTrackedMode2("footnotes.insert", options);
|
|
461454
463136
|
checkRevision2(editor, options?.expectedRevision);
|
|
461455
|
-
const converter =
|
|
463137
|
+
const converter = getConverter21(editor);
|
|
461456
463138
|
const notesConfig = getNotesConfig2(input2.type);
|
|
461457
463139
|
const noteId = allocateNextNoteId2(editor, converter, input2.type);
|
|
461458
463140
|
const address2 = { kind: "entity", entityType: "footnote", noteId };
|
|
@@ -461606,7 +463288,7 @@ function footnotesConfigureWrapper2(editor, input2, options) {
|
|
|
461606
463288
|
return configSuccess2();
|
|
461607
463289
|
}
|
|
461608
463290
|
function syncFootnotePropertiesCache2(editor) {
|
|
461609
|
-
const converter =
|
|
463291
|
+
const converter = getConverter21(editor);
|
|
461610
463292
|
if (!converter?.footnoteProperties || converter.footnoteProperties.source !== "settings")
|
|
461611
463293
|
return;
|
|
461612
463294
|
const settingsPart = converter.convertedXml?.["word/settings.xml"];
|
|
@@ -463394,39 +465076,6 @@ var init_citation_resolver = __esm(() => {
|
|
|
463394
465076
|
init_reference_block_node_id();
|
|
463395
465077
|
});
|
|
463396
465078
|
|
|
463397
|
-
// ../../packages/super-editor/src/editors/v1/document-api-adapters/out-of-band-mutation.ts
|
|
463398
|
-
function executeOutOfBandMutation2(editor, mutateFn, options) {
|
|
463399
|
-
if (!options.dryRun) {
|
|
463400
|
-
if (editor.options?.collaborationProvider && editor.options?.ydoc) {
|
|
463401
|
-
try {
|
|
463402
|
-
yUndoPluginKey2.getState(editor.state)?.undoManager?.stopCapturing();
|
|
463403
|
-
} catch {}
|
|
463404
|
-
} else {
|
|
463405
|
-
try {
|
|
463406
|
-
editor.view?.dispatch?.(closeHistory2(editor.state.tr));
|
|
463407
|
-
} catch {}
|
|
463408
|
-
}
|
|
463409
|
-
}
|
|
463410
|
-
checkRevision2(editor, options.expectedRevision);
|
|
463411
|
-
const result = mutateFn(options.dryRun);
|
|
463412
|
-
if (result.changed && !options.dryRun) {
|
|
463413
|
-
const converter = editor.converter;
|
|
463414
|
-
if (converter) {
|
|
463415
|
-
converter.documentModified = true;
|
|
463416
|
-
if (!converter.documentGuid && typeof converter.promoteToGuid === "function") {
|
|
463417
|
-
converter.promoteToGuid();
|
|
463418
|
-
}
|
|
463419
|
-
}
|
|
463420
|
-
incrementRevision2(editor);
|
|
463421
|
-
}
|
|
463422
|
-
return result.payload;
|
|
463423
|
-
}
|
|
463424
|
-
var init_out_of_band_mutation = __esm(() => {
|
|
463425
|
-
init_dist6();
|
|
463426
|
-
init_y_prosemirror();
|
|
463427
|
-
init_revision_tracker();
|
|
463428
|
-
});
|
|
463429
|
-
|
|
463430
465079
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/citation-wrappers.ts
|
|
463431
465080
|
function citationSuccess2(address2) {
|
|
463432
465081
|
return { success: true, citation: address2 };
|
|
@@ -464564,6 +466213,9 @@ function assembleDocumentApiAdapters2(editor) {
|
|
|
464564
466213
|
rename: (input2, options) => bookmarksRenameWrapper2(editor, input2, options),
|
|
464565
466214
|
remove: (input2, options) => bookmarksRemoveWrapper2(editor, input2, options)
|
|
464566
466215
|
},
|
|
466216
|
+
customXml: {
|
|
466217
|
+
parts: createCustomXmlPartsAdapter2(editor)
|
|
466218
|
+
},
|
|
464567
466219
|
footnotes: {
|
|
464568
466220
|
list: (query2) => footnotesListWrapper2(editor, query2),
|
|
464569
466221
|
get: (input2) => footnotesGetWrapper2(editor, input2),
|
|
@@ -464721,6 +466373,7 @@ var init_assemble_adapters = __esm(() => {
|
|
|
464721
466373
|
init_content_controls_wrappers();
|
|
464722
466374
|
init_header_footers_adapter();
|
|
464723
466375
|
init_bookmark_wrappers();
|
|
466376
|
+
init_custom_xml_wrappers();
|
|
464724
466377
|
init_protection_adapter();
|
|
464725
466378
|
init_permission_ranges_adapter();
|
|
464726
466379
|
init_footnote_wrappers();
|