@superdoc-dev/cli 0.3.0-next.27 → 0.3.0-next.29

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.
Files changed (2) hide show
  1. package/dist/index.js +2595 -822
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -2218,15 +2218,15 @@ var init_operation_definitions = __esm(() => {
2218
2218
  },
2219
2219
  "lists.create": {
2220
2220
  memberPath: "lists.create",
2221
- description: "Create a new list from one or more paragraphs, or convert existing paragraphs into a new list.",
2221
+ description: 'Create a new list from one or more paragraphs. Supports optional preset or style for new sequences. When sequence.mode is "continuePrevious", preset and style are not allowed — the new items inherit formatting from the previous sequence.',
2222
2222
  expectedResult: "Returns a ListsCreateResult with the new listId and the first item address.",
2223
2223
  requiresDocumentContext: true,
2224
2224
  metadata: mutationOperation({
2225
2225
  idempotency: "non-idempotent",
2226
2226
  supportsDryRun: true,
2227
2227
  supportsTrackedMode: false,
2228
- possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE"],
2229
- throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2228
+ possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE", "INVALID_INPUT", "NO_COMPATIBLE_PREVIOUS"],
2229
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2230
2230
  }),
2231
2231
  referenceDocPath: "lists/create.mdx",
2232
2232
  referenceGroup: "lists",
@@ -2437,7 +2437,7 @@ var init_operation_definitions = __esm(() => {
2437
2437
  },
2438
2438
  "lists.applyTemplate": {
2439
2439
  memberPath: "lists.applyTemplate",
2440
- description: "Apply a captured ListTemplate to the target list, optionally filtered to specific levels.",
2440
+ description: "Advanced alias for lists.applyStyle. Apply a captured ListTemplate to the target list (abstract-scoped, no clone-on-write).",
2441
2441
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
2442
2442
  requiresDocumentContext: true,
2443
2443
  metadata: mutationOperation({
@@ -2484,7 +2484,7 @@ var init_operation_definitions = __esm(() => {
2484
2484
  },
2485
2485
  "lists.captureTemplate": {
2486
2486
  memberPath: "lists.captureTemplate",
2487
- description: "Capture the formatting of a list as a reusable ListTemplate.",
2487
+ description: "Advanced alias for lists.getStyle. Capture list formatting from the abstract definition only (does not merge lvlOverride formatting).",
2488
2488
  expectedResult: "Returns a ListsCaptureTemplateResult containing the captured template.",
2489
2489
  requiresDocumentContext: true,
2490
2490
  metadata: readOperation({
@@ -2497,7 +2497,7 @@ var init_operation_definitions = __esm(() => {
2497
2497
  },
2498
2498
  "lists.setLevelNumbering": {
2499
2499
  memberPath: "lists.setLevelNumbering",
2500
- description: "Set the numbering format, pattern, and optional start value for a specific list level.",
2500
+ description: "Advanced alias for lists.setLevelNumberStyle/setLevelText/setLevelStart. Set format, pattern, and start in one call (abstract-scoped, no clone-on-write).",
2501
2501
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the level already matches.",
2502
2502
  requiresDocumentContext: true,
2503
2503
  metadata: mutationOperation({
@@ -2622,6 +2622,109 @@ var init_operation_definitions = __esm(() => {
2622
2622
  referenceDocPath: "lists/clear-level-overrides.mdx",
2623
2623
  referenceGroup: "lists"
2624
2624
  },
2625
+ "lists.getStyle": {
2626
+ memberPath: "lists.getStyle",
2627
+ description: "Read the effective reusable style of a list, including instance-level overrides. Returns a ListStyle that can be applied to other lists via lists.applyStyle.",
2628
+ expectedResult: "Returns a ListsGetStyleResult containing the captured style.",
2629
+ requiresDocumentContext: true,
2630
+ metadata: readOperation({
2631
+ idempotency: "idempotent",
2632
+ throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT"],
2633
+ possibleFailureCodes: ["INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE"]
2634
+ }),
2635
+ referenceDocPath: "lists/get-style.mdx",
2636
+ referenceGroup: "lists"
2637
+ },
2638
+ "lists.applyStyle": {
2639
+ memberPath: "lists.applyStyle",
2640
+ description: "Apply a reusable list style to the target list. Sequence-local: if the abstract definition is shared with other lists, it is cloned first to avoid affecting them.",
2641
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
2642
+ requiresDocumentContext: true,
2643
+ metadata: mutationOperation({
2644
+ idempotency: "conditional",
2645
+ supportsDryRun: true,
2646
+ supportsTrackedMode: false,
2647
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE"],
2648
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2649
+ }),
2650
+ referenceDocPath: "lists/apply-style.mdx",
2651
+ referenceGroup: "lists"
2652
+ },
2653
+ "lists.restartAt": {
2654
+ memberPath: "lists.restartAt",
2655
+ description: "Restart numbering at the target list item with a specific value. If the item is mid-sequence, it is separated first.",
2656
+ expectedResult: "Returns a ListsMutateItemResult receipt.",
2657
+ requiresDocumentContext: true,
2658
+ metadata: mutationOperation({
2659
+ idempotency: "non-idempotent",
2660
+ supportsDryRun: true,
2661
+ supportsTrackedMode: false,
2662
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT"],
2663
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2664
+ }),
2665
+ referenceDocPath: "lists/restart-at.mdx",
2666
+ referenceGroup: "lists"
2667
+ },
2668
+ "lists.setLevelNumberStyle": {
2669
+ memberPath: "lists.setLevelNumberStyle",
2670
+ description: 'Set the numbering style (e.g. decimal, lowerLetter, upperRoman) for a specific list level. Rejects "bullet" — use setLevelBullet instead. Sequence-local: clones shared definitions.',
2671
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2672
+ requiresDocumentContext: true,
2673
+ metadata: mutationOperation({
2674
+ idempotency: "conditional",
2675
+ supportsDryRun: true,
2676
+ supportsTrackedMode: false,
2677
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2678
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2679
+ }),
2680
+ referenceDocPath: "lists/set-level-number-style.mdx",
2681
+ referenceGroup: "lists"
2682
+ },
2683
+ "lists.setLevelText": {
2684
+ memberPath: "lists.setLevelText",
2685
+ description: 'Set the level text pattern (e.g. "%1.", "(%1)") for a specific list level. Uses OOXML level-placeholder syntax. Sequence-local: clones shared definitions.',
2686
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2687
+ requiresDocumentContext: true,
2688
+ metadata: mutationOperation({
2689
+ idempotency: "conditional",
2690
+ supportsDryRun: true,
2691
+ supportsTrackedMode: false,
2692
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2693
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2694
+ }),
2695
+ referenceDocPath: "lists/set-level-text.mdx",
2696
+ referenceGroup: "lists"
2697
+ },
2698
+ "lists.setLevelStart": {
2699
+ memberPath: "lists.setLevelStart",
2700
+ description: "Set the start value for a specific list level. Rejects bullet levels and non-positive values. Sequence-local: clones shared definitions.",
2701
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2702
+ requiresDocumentContext: true,
2703
+ metadata: mutationOperation({
2704
+ idempotency: "conditional",
2705
+ supportsDryRun: true,
2706
+ supportsTrackedMode: false,
2707
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2708
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2709
+ }),
2710
+ referenceDocPath: "lists/set-level-start.mdx",
2711
+ referenceGroup: "lists"
2712
+ },
2713
+ "lists.setLevelLayout": {
2714
+ memberPath: "lists.setLevelLayout",
2715
+ description: "Set the layout properties (alignment, indentation, trailing character, tab stop) for a specific list level. Accepts partial updates — omitted fields are left unchanged. Sequence-local: clones shared definitions.",
2716
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all values already match.",
2717
+ requiresDocumentContext: true,
2718
+ metadata: mutationOperation({
2719
+ idempotency: "conditional",
2720
+ supportsDryRun: true,
2721
+ supportsTrackedMode: false,
2722
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2723
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2724
+ }),
2725
+ referenceDocPath: "lists/set-level-layout.mdx",
2726
+ referenceGroup: "lists"
2727
+ },
2625
2728
  "comments.create": {
2626
2729
  memberPath: "comments.create",
2627
2730
  description: "Create a new comment thread (or reply when parentCommentId is given).",
@@ -7224,6 +7327,23 @@ function createSectionBreakResultSchemaFor(operationId) {
7224
7327
  oneOf: [createSectionBreakSuccessSchema, createSectionBreakFailureSchemaFor(operationId)]
7225
7328
  };
7226
7329
  }
7330
+ function rowOperationInputSchema(extraProperties, required = []) {
7331
+ return {
7332
+ oneOf: [
7333
+ objectSchema({ target: tableRowAddressSchema, ...extraProperties }, ["target", ...required]),
7334
+ objectSchema({
7335
+ target: tableAddressSchema,
7336
+ rowIndex: { type: "integer", minimum: 0 },
7337
+ ...extraProperties
7338
+ }, ["target", "rowIndex", ...required]),
7339
+ objectSchema({
7340
+ nodeId: { type: "string" },
7341
+ rowIndex: { type: "integer", minimum: 0 },
7342
+ ...extraProperties
7343
+ }, ["nodeId", "rowIndex", ...required])
7344
+ ]
7345
+ };
7346
+ }
7227
7347
  function supportsImplicitTrueValue(operationId) {
7228
7348
  const key = operationId.slice("format.".length);
7229
7349
  const entry = INLINE_PROPERTY_REGISTRY.find((candidate) => candidate.key === key);
@@ -7610,7 +7730,7 @@ function buildInternalContractSchemas() {
7610
7730
  operations
7611
7731
  };
7612
7732
  }
7613
- var nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, knownTargetKindValues, SHARED_DEFS, rangeSchema, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, inlineNodeAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, targetLocatorSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentInfoSchema, listKindSchema, listInsertPositionSchema, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, capabilitiesOutputSchema, strictEmptyObjectSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, insertInputSchema, tableLocatorSchema, _tableScopedRowLocatorSchema, _tableScopedColumnLocatorSchema, mergeRangeLocatorSchema, mixedRowLocatorOneOf, tableCreateLocationSchema, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas, tocMutationFailureCodes, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkDestinationSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema, hyperlinkInfoSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, 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, diffApplyResultSchema, operationSchemas;
7733
+ var nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, knownTargetKindValues, SHARED_DEFS, rangeSchema, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, inlineNodeAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, targetLocatorSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentInfoSchema, listKindSchema, listInsertPositionSchema, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, capabilitiesOutputSchema, strictEmptyObjectSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, insertInputSchema, tableLocatorSchema, cellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas, tocMutationFailureCodes, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkDestinationSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema, hyperlinkInfoSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, 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, diffApplyResultSchema, operationSchemas;
7614
7734
  var init_schemas = __esm(() => {
7615
7735
  init_command_catalog();
7616
7736
  init_types2();
@@ -7707,6 +7827,31 @@ var init_schemas = __esm(() => {
7707
7827
  nodeType: { enum: [...deletableBlockNodeTypeValues] },
7708
7828
  nodeId: { type: "string" }
7709
7829
  }, ["kind", "nodeType", "nodeId"]),
7830
+ TableAddress: objectSchema({
7831
+ kind: { const: "block" },
7832
+ nodeType: { const: "table" },
7833
+ nodeId: { type: "string" }
7834
+ }, ["kind", "nodeType", "nodeId"]),
7835
+ TableRowAddress: objectSchema({
7836
+ kind: { const: "block" },
7837
+ nodeType: { const: "tableRow" },
7838
+ nodeId: { type: "string" }
7839
+ }, ["kind", "nodeType", "nodeId"]),
7840
+ TableCellAddress: objectSchema({
7841
+ kind: { const: "block" },
7842
+ nodeType: { const: "tableCell" },
7843
+ nodeId: { type: "string" }
7844
+ }, ["kind", "nodeType", "nodeId"]),
7845
+ TableOrRowAddress: objectSchema({
7846
+ kind: { const: "block" },
7847
+ nodeType: { enum: ["table", "tableRow"] },
7848
+ nodeId: { type: "string" }
7849
+ }, ["kind", "nodeType", "nodeId"]),
7850
+ TableOrCellAddress: objectSchema({
7851
+ kind: { const: "block" },
7852
+ nodeType: { enum: ["table", "tableCell"] },
7853
+ nodeId: { type: "string" }
7854
+ }, ["kind", "nodeType", "nodeId"]),
7710
7855
  ParagraphAddress: objectSchema({
7711
7856
  kind: { const: "block" },
7712
7857
  nodeType: { const: "paragraph" },
@@ -7844,6 +7989,10 @@ var init_schemas = __esm(() => {
7844
7989
  textTargetSchema = ref("TextTarget");
7845
7990
  blockNodeAddressSchema = ref("BlockNodeAddress");
7846
7991
  deletableBlockNodeAddressSchema = ref("DeletableBlockNodeAddress");
7992
+ tableAddressSchema = ref("TableAddress");
7993
+ tableRowAddressSchema = ref("TableRowAddress");
7994
+ tableCellAddressSchema = ref("TableCellAddress");
7995
+ tableOrCellAddressSchema = ref("TableOrCellAddress");
7847
7996
  paragraphAddressSchema = ref("ParagraphAddress");
7848
7997
  headingAddressSchema = ref("HeadingAddress");
7849
7998
  listItemAddressSchema = ref("ListItemAddress");
@@ -8328,31 +8477,29 @@ var init_schemas = __esm(() => {
8328
8477
  };
8329
8478
  tableLocatorSchema = {
8330
8479
  ...objectSchema({
8331
- target: blockNodeAddressSchema,
8480
+ target: tableAddressSchema,
8332
8481
  nodeId: { type: "string" }
8333
8482
  }),
8334
8483
  oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
8335
8484
  };
8336
- _tableScopedRowLocatorSchema = {
8485
+ cellLocatorSchema = {
8337
8486
  ...objectSchema({
8338
- tableTarget: blockNodeAddressSchema,
8339
- tableNodeId: { type: "string" },
8340
- rowIndex: { type: "integer", minimum: 0 }
8487
+ target: tableCellAddressSchema,
8488
+ nodeId: { type: "string" }
8341
8489
  }),
8342
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
8490
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
8343
8491
  };
8344
- _tableScopedColumnLocatorSchema = {
8492
+ tableOrCellLocatorSchema = {
8345
8493
  ...objectSchema({
8346
- tableTarget: blockNodeAddressSchema,
8347
- tableNodeId: { type: "string" },
8348
- columnIndex: { type: "integer", minimum: 0 }
8349
- }, ["columnIndex"]),
8350
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
8494
+ target: tableOrCellAddressSchema,
8495
+ nodeId: { type: "string" }
8496
+ }),
8497
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
8351
8498
  };
8352
8499
  mergeRangeLocatorSchema = {
8353
8500
  ...objectSchema({
8354
- tableTarget: blockNodeAddressSchema,
8355
- tableNodeId: { type: "string" },
8501
+ target: tableAddressSchema,
8502
+ nodeId: { type: "string" },
8356
8503
  start: objectSchema({ rowIndex: { type: "integer", minimum: 0 }, columnIndex: { type: "integer", minimum: 0 } }, [
8357
8504
  "rowIndex",
8358
8505
  "columnIndex"
@@ -8362,14 +8509,8 @@ var init_schemas = __esm(() => {
8362
8509
  "columnIndex"
8363
8510
  ])
8364
8511
  }, ["start", "end"]),
8365
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
8512
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
8366
8513
  };
8367
- mixedRowLocatorOneOf = [
8368
- { required: ["target"] },
8369
- { required: ["nodeId"] },
8370
- { required: ["tableTarget", "rowIndex"] },
8371
- { required: ["tableNodeId", "rowIndex"] }
8372
- ];
8373
8514
  tableCreateLocationSchema = {
8374
8515
  oneOf: [
8375
8516
  objectSchema({ kind: { const: "documentStart" } }, ["kind"]),
@@ -8382,12 +8523,12 @@ var init_schemas = __esm(() => {
8382
8523
  };
8383
8524
  tableMutationSuccessSchema = objectSchema({
8384
8525
  success: { const: true },
8385
- table: blockNodeAddressSchema,
8526
+ table: tableAddressSchema,
8386
8527
  trackedChangeRefs: arraySchema(entityAddressSchema)
8387
8528
  }, ["success"]);
8388
8529
  createTableSuccessSchema = objectSchema({
8389
8530
  success: { const: true },
8390
- table: blockNodeAddressSchema,
8531
+ table: tableAddressSchema,
8391
8532
  trackedChangeRefs: arraySchema(entityAddressSchema)
8392
8533
  }, ["success", "table"]);
8393
8534
  tableMutationFailureCodes = ["NO_OP", "INVALID_TARGET", "TARGET_NOT_FOUND", "CAPABILITY_UNAVAILABLE"];
@@ -9477,13 +9618,65 @@ var init_schemas = __esm(() => {
9477
9618
  at: ref("BlockAddress"),
9478
9619
  target: ref("BlockAddressOrRange"),
9479
9620
  kind: listKindSchema,
9480
- level: { type: "integer", minimum: 0, maximum: 8 }
9621
+ level: { type: "integer", minimum: 0, maximum: 8 },
9622
+ preset: {
9623
+ enum: [
9624
+ "decimal",
9625
+ "decimalParenthesis",
9626
+ "lowerLetter",
9627
+ "upperLetter",
9628
+ "lowerRoman",
9629
+ "upperRoman",
9630
+ "disc",
9631
+ "circle",
9632
+ "square",
9633
+ "dash"
9634
+ ]
9635
+ },
9636
+ style: objectSchema({
9637
+ version: { const: 1 },
9638
+ levels: arraySchema(objectSchema({
9639
+ level: { type: "integer", minimum: 0, maximum: 8 },
9640
+ numFmt: { type: "string" },
9641
+ lvlText: { type: "string" },
9642
+ start: { type: "integer" },
9643
+ alignment: { enum: ["left", "center", "right"] },
9644
+ indents: objectSchema({
9645
+ left: { type: "integer" },
9646
+ hanging: { type: "integer" },
9647
+ firstLine: { type: "integer" }
9648
+ }),
9649
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
9650
+ markerFont: { type: "string" },
9651
+ pictureBulletId: { type: "integer" },
9652
+ tabStopAt: { type: ["integer", "null"] }
9653
+ }, ["level"]))
9654
+ }, ["version", "levels"]),
9655
+ sequence: {
9656
+ oneOf: [
9657
+ objectSchema({ mode: { const: "new" }, startAt: { type: "integer", minimum: 1 } }, ["mode"]),
9658
+ objectSchema({ mode: { const: "continuePrevious" } }, ["mode"])
9659
+ ]
9660
+ }
9481
9661
  },
9482
- required: ["mode", "kind"],
9662
+ required: ["mode"],
9483
9663
  additionalProperties: false,
9484
- if: { properties: { mode: { const: "empty" } } },
9485
- then: { required: ["mode", "kind", "at"] },
9486
- else: { required: ["mode", "kind", "target"] }
9664
+ allOf: [
9665
+ {
9666
+ if: { properties: { mode: { const: "empty" } } },
9667
+ then: { required: ["mode", "at"] },
9668
+ else: { required: ["mode", "target"] }
9669
+ },
9670
+ {
9671
+ if: {
9672
+ properties: { sequence: { properties: { mode: { const: "continuePrevious" } }, required: ["mode"] } },
9673
+ required: ["sequence"]
9674
+ },
9675
+ then: {
9676
+ not: { anyOf: [{ required: ["preset"] }, { required: ["style"] }] }
9677
+ }
9678
+ }
9679
+ ]
9487
9680
  },
9488
9681
  output: {
9489
9682
  oneOf: [
@@ -9831,6 +10024,124 @@ var init_schemas = __esm(() => {
9831
10024
  success: listsMutateItemSuccessSchema,
9832
10025
  failure: listsFailureSchemaFor("lists.clearLevelOverrides")
9833
10026
  },
10027
+ "lists.getStyle": (() => {
10028
+ const listLevelTemplateSchema = objectSchema({
10029
+ level: { type: "integer", minimum: 0, maximum: 8 },
10030
+ numFmt: { type: "string" },
10031
+ lvlText: { type: "string" },
10032
+ start: { type: "integer" },
10033
+ alignment: { enum: ["left", "center", "right"] },
10034
+ indents: objectSchema({
10035
+ left: { type: "integer" },
10036
+ hanging: { type: "integer" },
10037
+ firstLine: { type: "integer" }
10038
+ }),
10039
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
10040
+ markerFont: { type: "string" },
10041
+ pictureBulletId: { type: "integer" },
10042
+ tabStopAt: { type: ["integer", "null"] }
10043
+ }, ["level"]);
10044
+ const styleSchema = objectSchema({
10045
+ version: { const: 1 },
10046
+ levels: arraySchema(listLevelTemplateSchema)
10047
+ }, ["version", "levels"]);
10048
+ const successSchema = objectSchema({
10049
+ success: { const: true },
10050
+ style: styleSchema
10051
+ }, ["success", "style"]);
10052
+ return {
10053
+ input: objectSchema({
10054
+ target: listItemAddressSchema,
10055
+ levels: arraySchema({ type: "integer", minimum: 0, maximum: 8 })
10056
+ }, ["target"]),
10057
+ output: { oneOf: [successSchema, listsFailureSchemaFor("lists.getStyle")] },
10058
+ success: successSchema,
10059
+ failure: listsFailureSchemaFor("lists.getStyle")
10060
+ };
10061
+ })(),
10062
+ "lists.applyStyle": {
10063
+ input: objectSchema({
10064
+ target: listItemAddressSchema,
10065
+ style: objectSchema({
10066
+ version: { const: 1 },
10067
+ levels: arraySchema(objectSchema({
10068
+ level: { type: "integer", minimum: 0, maximum: 8 },
10069
+ numFmt: { type: "string" },
10070
+ lvlText: { type: "string" },
10071
+ start: { type: "integer" },
10072
+ alignment: { enum: ["left", "center", "right"] },
10073
+ indents: objectSchema({
10074
+ left: { type: "integer" },
10075
+ hanging: { type: "integer" },
10076
+ firstLine: { type: "integer" }
10077
+ }),
10078
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
10079
+ markerFont: { type: "string" },
10080
+ pictureBulletId: { type: "integer" },
10081
+ tabStopAt: { type: ["integer", "null"] }
10082
+ }, ["level"]))
10083
+ }, ["version", "levels"]),
10084
+ levels: arraySchema({ type: "integer", minimum: 0, maximum: 8 })
10085
+ }, ["target", "style"]),
10086
+ output: listsMutateItemResultSchemaFor("lists.applyStyle"),
10087
+ success: listsMutateItemSuccessSchema,
10088
+ failure: listsFailureSchemaFor("lists.applyStyle")
10089
+ },
10090
+ "lists.restartAt": {
10091
+ input: objectSchema({
10092
+ target: listItemAddressSchema,
10093
+ startAt: { type: "integer", minimum: 1 }
10094
+ }, ["target", "startAt"]),
10095
+ output: listsMutateItemResultSchemaFor("lists.restartAt"),
10096
+ success: listsMutateItemSuccessSchema,
10097
+ failure: listsFailureSchemaFor("lists.restartAt")
10098
+ },
10099
+ "lists.setLevelNumberStyle": {
10100
+ input: objectSchema({
10101
+ target: listItemAddressSchema,
10102
+ level: { type: "integer", minimum: 0, maximum: 8 },
10103
+ numberStyle: { type: "string" }
10104
+ }, ["target", "level", "numberStyle"]),
10105
+ output: listsMutateItemResultSchemaFor("lists.setLevelNumberStyle"),
10106
+ success: listsMutateItemSuccessSchema,
10107
+ failure: listsFailureSchemaFor("lists.setLevelNumberStyle")
10108
+ },
10109
+ "lists.setLevelText": {
10110
+ input: objectSchema({
10111
+ target: listItemAddressSchema,
10112
+ level: { type: "integer", minimum: 0, maximum: 8 },
10113
+ text: { type: "string" }
10114
+ }, ["target", "level", "text"]),
10115
+ output: listsMutateItemResultSchemaFor("lists.setLevelText"),
10116
+ success: listsMutateItemSuccessSchema,
10117
+ failure: listsFailureSchemaFor("lists.setLevelText")
10118
+ },
10119
+ "lists.setLevelStart": {
10120
+ input: objectSchema({
10121
+ target: listItemAddressSchema,
10122
+ level: { type: "integer", minimum: 0, maximum: 8 },
10123
+ startAt: { type: "integer", minimum: 1 }
10124
+ }, ["target", "level", "startAt"]),
10125
+ output: listsMutateItemResultSchemaFor("lists.setLevelStart"),
10126
+ success: listsMutateItemSuccessSchema,
10127
+ failure: listsFailureSchemaFor("lists.setLevelStart")
10128
+ },
10129
+ "lists.setLevelLayout": {
10130
+ input: objectSchema({
10131
+ target: listItemAddressSchema,
10132
+ level: { type: "integer", minimum: 0, maximum: 8 },
10133
+ layout: objectSchema({
10134
+ alignment: { enum: ["left", "center", "right"] },
10135
+ alignedAt: { type: "integer" },
10136
+ textIndentAt: { type: "integer" },
10137
+ followCharacter: { enum: ["tab", "space", "nothing"] },
10138
+ tabStopAt: { type: ["integer", "null"] }
10139
+ })
10140
+ }, ["target", "level", "layout"]),
10141
+ output: listsMutateItemResultSchemaFor("lists.setLevelLayout"),
10142
+ success: listsMutateItemSuccessSchema,
10143
+ failure: listsFailureSchemaFor("lists.setLevelLayout")
10144
+ },
9834
10145
  "comments.create": {
9835
10146
  input: objectSchema({
9836
10147
  text: { type: "string" },
@@ -10169,7 +10480,7 @@ var init_schemas = __esm(() => {
10169
10480
  "tables.move": {
10170
10481
  input: {
10171
10482
  ...objectSchema({
10172
- target: blockNodeAddressSchema,
10483
+ target: tableAddressSchema,
10173
10484
  nodeId: { type: "string" },
10174
10485
  destination: tableCreateLocationSchema
10175
10486
  }, ["destination"]),
@@ -10182,7 +10493,7 @@ var init_schemas = __esm(() => {
10182
10493
  "tables.split": {
10183
10494
  input: {
10184
10495
  ...objectSchema({
10185
- target: blockNodeAddressSchema,
10496
+ target: tableAddressSchema,
10186
10497
  nodeId: { type: "string" },
10187
10498
  atRowIndex: { type: "integer", minimum: 1 }
10188
10499
  }, ["atRowIndex"]),
@@ -10195,7 +10506,7 @@ var init_schemas = __esm(() => {
10195
10506
  "tables.convertToText": {
10196
10507
  input: {
10197
10508
  ...objectSchema({
10198
- target: blockNodeAddressSchema,
10509
+ target: tableAddressSchema,
10199
10510
  nodeId: { type: "string" },
10200
10511
  delimiter: { enum: ["tab", "comma", "paragraph"] }
10201
10512
  }),
@@ -10208,7 +10519,7 @@ var init_schemas = __esm(() => {
10208
10519
  "tables.setLayout": {
10209
10520
  input: {
10210
10521
  ...objectSchema({
10211
- target: blockNodeAddressSchema,
10522
+ target: tableAddressSchema,
10212
10523
  nodeId: { type: "string" },
10213
10524
  preferredWidth: { type: "number" },
10214
10525
  alignment: { enum: ["left", "center", "right"] },
@@ -10223,50 +10534,25 @@ var init_schemas = __esm(() => {
10223
10534
  failure: tableMutationFailureSchema
10224
10535
  },
10225
10536
  "tables.insertRow": {
10226
- input: {
10227
- ...objectSchema({
10228
- target: blockNodeAddressSchema,
10229
- nodeId: { type: "string" },
10230
- tableTarget: blockNodeAddressSchema,
10231
- tableNodeId: { type: "string" },
10232
- rowIndex: { type: "integer", minimum: 0 },
10233
- position: { enum: ["above", "below"] },
10234
- count: { type: "integer", minimum: 1 }
10235
- }, ["position"]),
10236
- oneOf: mixedRowLocatorOneOf
10237
- },
10537
+ input: rowOperationInputSchema({
10538
+ position: { enum: ["above", "below"] },
10539
+ count: { type: "integer", minimum: 1 }
10540
+ }, ["position"]),
10238
10541
  output: tableMutationResultSchema,
10239
10542
  success: tableMutationSuccessSchema,
10240
10543
  failure: tableMutationFailureSchema
10241
10544
  },
10242
10545
  "tables.deleteRow": {
10243
- input: {
10244
- ...objectSchema({
10245
- target: blockNodeAddressSchema,
10246
- nodeId: { type: "string" },
10247
- tableTarget: blockNodeAddressSchema,
10248
- tableNodeId: { type: "string" },
10249
- rowIndex: { type: "integer", minimum: 0 }
10250
- }),
10251
- oneOf: mixedRowLocatorOneOf
10252
- },
10546
+ input: rowOperationInputSchema({}),
10253
10547
  output: tableMutationResultSchema,
10254
10548
  success: tableMutationSuccessSchema,
10255
10549
  failure: tableMutationFailureSchema
10256
10550
  },
10257
10551
  "tables.setRowHeight": {
10258
- input: {
10259
- ...objectSchema({
10260
- target: blockNodeAddressSchema,
10261
- nodeId: { type: "string" },
10262
- tableTarget: blockNodeAddressSchema,
10263
- tableNodeId: { type: "string" },
10264
- rowIndex: { type: "integer", minimum: 0 },
10265
- heightPt: { type: "number", exclusiveMinimum: 0 },
10266
- rule: { enum: ["atLeast", "exact", "auto"] }
10267
- }, ["heightPt", "rule"]),
10268
- oneOf: mixedRowLocatorOneOf
10269
- },
10552
+ input: rowOperationInputSchema({
10553
+ heightPt: { type: "number", exclusiveMinimum: 0 },
10554
+ rule: { enum: ["atLeast", "exact", "auto"] }
10555
+ }, ["heightPt", "rule"]),
10270
10556
  output: tableMutationResultSchema,
10271
10557
  success: tableMutationSuccessSchema,
10272
10558
  failure: tableMutationFailureSchema
@@ -10278,18 +10564,10 @@ var init_schemas = __esm(() => {
10278
10564
  failure: tableMutationFailureSchema
10279
10565
  },
10280
10566
  "tables.setRowOptions": {
10281
- input: {
10282
- ...objectSchema({
10283
- target: blockNodeAddressSchema,
10284
- nodeId: { type: "string" },
10285
- tableTarget: blockNodeAddressSchema,
10286
- tableNodeId: { type: "string" },
10287
- rowIndex: { type: "integer", minimum: 0 },
10288
- allowBreakAcrossPages: { type: "boolean" },
10289
- repeatHeader: { type: "boolean" }
10290
- }),
10291
- oneOf: mixedRowLocatorOneOf
10292
- },
10567
+ input: rowOperationInputSchema({
10568
+ allowBreakAcrossPages: { type: "boolean" },
10569
+ repeatHeader: { type: "boolean" }
10570
+ }),
10293
10571
  output: tableMutationResultSchema,
10294
10572
  success: tableMutationSuccessSchema,
10295
10573
  failure: tableMutationFailureSchema
@@ -10297,13 +10575,13 @@ var init_schemas = __esm(() => {
10297
10575
  "tables.insertColumn": {
10298
10576
  input: {
10299
10577
  ...objectSchema({
10300
- tableTarget: blockNodeAddressSchema,
10301
- tableNodeId: { type: "string" },
10578
+ target: tableAddressSchema,
10579
+ nodeId: { type: "string" },
10302
10580
  columnIndex: { type: "integer", minimum: 0 },
10303
10581
  position: { enum: ["left", "right"] },
10304
10582
  count: { type: "integer", minimum: 1 }
10305
10583
  }, ["columnIndex", "position"]),
10306
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
10584
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
10307
10585
  },
10308
10586
  output: tableMutationResultSchema,
10309
10587
  success: tableMutationSuccessSchema,
@@ -10312,11 +10590,11 @@ var init_schemas = __esm(() => {
10312
10590
  "tables.deleteColumn": {
10313
10591
  input: {
10314
10592
  ...objectSchema({
10315
- tableTarget: blockNodeAddressSchema,
10316
- tableNodeId: { type: "string" },
10593
+ target: tableAddressSchema,
10594
+ nodeId: { type: "string" },
10317
10595
  columnIndex: { type: "integer", minimum: 0 }
10318
10596
  }, ["columnIndex"]),
10319
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
10597
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
10320
10598
  },
10321
10599
  output: tableMutationResultSchema,
10322
10600
  success: tableMutationSuccessSchema,
@@ -10325,12 +10603,12 @@ var init_schemas = __esm(() => {
10325
10603
  "tables.setColumnWidth": {
10326
10604
  input: {
10327
10605
  ...objectSchema({
10328
- tableTarget: blockNodeAddressSchema,
10329
- tableNodeId: { type: "string" },
10606
+ target: tableAddressSchema,
10607
+ nodeId: { type: "string" },
10330
10608
  columnIndex: { type: "integer", minimum: 0 },
10331
10609
  widthPt: { type: "number", exclusiveMinimum: 0 }
10332
10610
  }, ["columnIndex", "widthPt"]),
10333
- oneOf: [{ required: ["tableTarget"] }, { required: ["tableNodeId"] }]
10611
+ oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
10334
10612
  },
10335
10613
  output: tableMutationResultSchema,
10336
10614
  success: tableMutationSuccessSchema,
@@ -10339,7 +10617,7 @@ var init_schemas = __esm(() => {
10339
10617
  "tables.distributeColumns": {
10340
10618
  input: {
10341
10619
  ...objectSchema({
10342
- target: blockNodeAddressSchema,
10620
+ target: tableAddressSchema,
10343
10621
  nodeId: { type: "string" },
10344
10622
  columnRange: objectSchema({ start: { type: "integer", minimum: 0 }, end: { type: "integer", minimum: 0 } }, [
10345
10623
  "start",
@@ -10355,7 +10633,7 @@ var init_schemas = __esm(() => {
10355
10633
  "tables.insertCell": {
10356
10634
  input: {
10357
10635
  ...objectSchema({
10358
- target: blockNodeAddressSchema,
10636
+ target: tableCellAddressSchema,
10359
10637
  nodeId: { type: "string" },
10360
10638
  mode: { enum: ["shiftRight", "shiftDown"] }
10361
10639
  }, ["mode"]),
@@ -10368,7 +10646,7 @@ var init_schemas = __esm(() => {
10368
10646
  "tables.deleteCell": {
10369
10647
  input: {
10370
10648
  ...objectSchema({
10371
- target: blockNodeAddressSchema,
10649
+ target: tableCellAddressSchema,
10372
10650
  nodeId: { type: "string" },
10373
10651
  mode: { enum: ["shiftLeft", "shiftUp"] }
10374
10652
  }, ["mode"]),
@@ -10385,7 +10663,7 @@ var init_schemas = __esm(() => {
10385
10663
  failure: tableMutationFailureSchema
10386
10664
  },
10387
10665
  "tables.unmergeCells": {
10388
- input: tableLocatorSchema,
10666
+ input: cellLocatorSchema,
10389
10667
  output: tableMutationResultSchema,
10390
10668
  success: tableMutationSuccessSchema,
10391
10669
  failure: tableMutationFailureSchema
@@ -10393,7 +10671,7 @@ var init_schemas = __esm(() => {
10393
10671
  "tables.splitCell": {
10394
10672
  input: {
10395
10673
  ...objectSchema({
10396
- target: blockNodeAddressSchema,
10674
+ target: tableCellAddressSchema,
10397
10675
  nodeId: { type: "string" },
10398
10676
  rows: { type: "integer", minimum: 1 },
10399
10677
  columns: { type: "integer", minimum: 1 }
@@ -10407,7 +10685,7 @@ var init_schemas = __esm(() => {
10407
10685
  "tables.setCellProperties": {
10408
10686
  input: {
10409
10687
  ...objectSchema({
10410
- target: blockNodeAddressSchema,
10688
+ target: tableCellAddressSchema,
10411
10689
  nodeId: { type: "string" },
10412
10690
  preferredWidthPt: { type: "number" },
10413
10691
  verticalAlign: { enum: ["top", "center", "bottom"] },
@@ -10423,7 +10701,7 @@ var init_schemas = __esm(() => {
10423
10701
  "tables.sort": {
10424
10702
  input: {
10425
10703
  ...objectSchema({
10426
- target: blockNodeAddressSchema,
10704
+ target: tableAddressSchema,
10427
10705
  nodeId: { type: "string" },
10428
10706
  keys: arraySchema(objectSchema({
10429
10707
  columnIndex: { type: "integer", minimum: 0 },
@@ -10440,7 +10718,7 @@ var init_schemas = __esm(() => {
10440
10718
  "tables.setAltText": {
10441
10719
  input: {
10442
10720
  ...objectSchema({
10443
- target: blockNodeAddressSchema,
10721
+ target: tableAddressSchema,
10444
10722
  nodeId: { type: "string" },
10445
10723
  title: { type: "string" },
10446
10724
  description: { type: "string" }
@@ -10454,7 +10732,7 @@ var init_schemas = __esm(() => {
10454
10732
  "tables.setStyle": {
10455
10733
  input: {
10456
10734
  ...objectSchema({
10457
- target: blockNodeAddressSchema,
10735
+ target: tableAddressSchema,
10458
10736
  nodeId: { type: "string" },
10459
10737
  styleId: { type: "string" }
10460
10738
  }, ["styleId"]),
@@ -10473,7 +10751,7 @@ var init_schemas = __esm(() => {
10473
10751
  "tables.setStyleOption": {
10474
10752
  input: {
10475
10753
  ...objectSchema({
10476
- target: blockNodeAddressSchema,
10754
+ target: tableAddressSchema,
10477
10755
  nodeId: { type: "string" },
10478
10756
  flag: { enum: ["headerRow", "totalRow", "firstColumn", "lastColumn", "bandedRows", "bandedColumns"] },
10479
10757
  enabled: { type: "boolean" }
@@ -10487,7 +10765,7 @@ var init_schemas = __esm(() => {
10487
10765
  "tables.setBorder": {
10488
10766
  input: {
10489
10767
  ...objectSchema({
10490
- target: blockNodeAddressSchema,
10768
+ target: tableOrCellAddressSchema,
10491
10769
  nodeId: { type: "string" },
10492
10770
  edge: { enum: ["top", "bottom", "left", "right", "insideH", "insideV", "diagonalDown", "diagonalUp"] },
10493
10771
  lineStyle: { type: "string" },
@@ -10503,7 +10781,7 @@ var init_schemas = __esm(() => {
10503
10781
  "tables.clearBorder": {
10504
10782
  input: {
10505
10783
  ...objectSchema({
10506
- target: blockNodeAddressSchema,
10784
+ target: tableOrCellAddressSchema,
10507
10785
  nodeId: { type: "string" },
10508
10786
  edge: { enum: ["top", "bottom", "left", "right", "insideH", "insideV", "diagonalDown", "diagonalUp"] }
10509
10787
  }, ["edge"]),
@@ -10516,7 +10794,7 @@ var init_schemas = __esm(() => {
10516
10794
  "tables.applyBorderPreset": {
10517
10795
  input: {
10518
10796
  ...objectSchema({
10519
- target: blockNodeAddressSchema,
10797
+ target: tableAddressSchema,
10520
10798
  nodeId: { type: "string" },
10521
10799
  preset: { enum: ["box", "all", "none", "grid", "custom"] }
10522
10800
  }, ["preset"]),
@@ -10529,7 +10807,7 @@ var init_schemas = __esm(() => {
10529
10807
  "tables.setShading": {
10530
10808
  input: {
10531
10809
  ...objectSchema({
10532
- target: blockNodeAddressSchema,
10810
+ target: tableOrCellAddressSchema,
10533
10811
  nodeId: { type: "string" },
10534
10812
  color: { type: "string", pattern: "^([0-9A-Fa-f]{6}|auto)$" }
10535
10813
  }, ["color"]),
@@ -10540,7 +10818,7 @@ var init_schemas = __esm(() => {
10540
10818
  failure: tableMutationFailureSchema
10541
10819
  },
10542
10820
  "tables.clearShading": {
10543
- input: tableLocatorSchema,
10821
+ input: tableOrCellLocatorSchema,
10544
10822
  output: tableMutationResultSchema,
10545
10823
  success: tableMutationSuccessSchema,
10546
10824
  failure: tableMutationFailureSchema
@@ -10548,7 +10826,7 @@ var init_schemas = __esm(() => {
10548
10826
  "tables.setTablePadding": {
10549
10827
  input: {
10550
10828
  ...objectSchema({
10551
- target: blockNodeAddressSchema,
10829
+ target: tableAddressSchema,
10552
10830
  nodeId: { type: "string" },
10553
10831
  topPt: { type: "number", minimum: 0 },
10554
10832
  rightPt: { type: "number", minimum: 0 },
@@ -10564,7 +10842,7 @@ var init_schemas = __esm(() => {
10564
10842
  "tables.setCellPadding": {
10565
10843
  input: {
10566
10844
  ...objectSchema({
10567
- target: blockNodeAddressSchema,
10845
+ target: tableCellAddressSchema,
10568
10846
  nodeId: { type: "string" },
10569
10847
  topPt: { type: "number", minimum: 0 },
10570
10848
  rightPt: { type: "number", minimum: 0 },
@@ -10580,7 +10858,7 @@ var init_schemas = __esm(() => {
10580
10858
  "tables.setCellSpacing": {
10581
10859
  input: {
10582
10860
  ...objectSchema({
10583
- target: blockNodeAddressSchema,
10861
+ target: tableAddressSchema,
10584
10862
  nodeId: { type: "string" },
10585
10863
  spacingPt: { type: "number", minimum: 0 }
10586
10864
  }, ["spacingPt"]),
@@ -10600,7 +10878,7 @@ var init_schemas = __esm(() => {
10600
10878
  input: tableLocatorSchema,
10601
10879
  output: objectSchema({
10602
10880
  nodeId: { type: "string" },
10603
- address: blockNodeAddressSchema,
10881
+ address: tableAddressSchema,
10604
10882
  rows: { type: "integer", minimum: 0 },
10605
10883
  columns: { type: "integer", minimum: 0 }
10606
10884
  }, ["nodeId", "address", "rows", "columns"])
@@ -10608,7 +10886,7 @@ var init_schemas = __esm(() => {
10608
10886
  "tables.getCells": {
10609
10887
  input: {
10610
10888
  ...objectSchema({
10611
- target: blockNodeAddressSchema,
10889
+ target: tableAddressSchema,
10612
10890
  nodeId: { type: "string" },
10613
10891
  rowIndex: { type: "integer", minimum: 0 },
10614
10892
  columnIndex: { type: "integer", minimum: 0 }
@@ -10616,7 +10894,8 @@ var init_schemas = __esm(() => {
10616
10894
  oneOf: [{ required: ["target"] }, { required: ["nodeId"] }]
10617
10895
  },
10618
10896
  output: objectSchema({
10619
- tableNodeId: { type: "string" },
10897
+ nodeId: { type: "string" },
10898
+ address: tableAddressSchema,
10620
10899
  cells: {
10621
10900
  type: "array",
10622
10901
  items: objectSchema({
@@ -10627,12 +10906,13 @@ var init_schemas = __esm(() => {
10627
10906
  rowspan: { type: "integer", minimum: 1 }
10628
10907
  }, ["nodeId", "rowIndex", "columnIndex", "colspan", "rowspan"])
10629
10908
  }
10630
- }, ["tableNodeId", "cells"])
10909
+ }, ["nodeId", "address", "cells"])
10631
10910
  },
10632
10911
  "tables.getProperties": {
10633
10912
  input: tableLocatorSchema,
10634
10913
  output: objectSchema({
10635
10914
  nodeId: { type: "string" },
10915
+ address: tableAddressSchema,
10636
10916
  styleId: { type: "string" },
10637
10917
  alignment: { enum: ["left", "center", "right"] },
10638
10918
  direction: { enum: ["ltr", "rtl"] },
@@ -10646,7 +10926,7 @@ var init_schemas = __esm(() => {
10646
10926
  bandedRows: { type: "boolean" },
10647
10927
  bandedColumns: { type: "boolean" }
10648
10928
  })
10649
- }, ["nodeId"])
10929
+ }, ["nodeId", "address"])
10650
10930
  },
10651
10931
  "tables.getStyles": {
10652
10932
  input: strictEmptyObjectSchema,
@@ -13212,6 +13492,34 @@ function executeListsSetType(adapter, input, options) {
13212
13492
  validateListTarget(input, "lists.setType");
13213
13493
  return adapter.setType(input, normalizeMutationOptions(options));
13214
13494
  }
13495
+ function executeListsGetStyle(adapter, input) {
13496
+ validateListTarget(input, "lists.getStyle");
13497
+ return adapter.getStyle(input);
13498
+ }
13499
+ function executeListsApplyStyle(adapter, input, options) {
13500
+ validateListTarget(input, "lists.applyStyle");
13501
+ return adapter.applyStyle(input, normalizeMutationOptions(options));
13502
+ }
13503
+ function executeListsRestartAt(adapter, input, options) {
13504
+ validateListTarget(input, "lists.restartAt");
13505
+ return adapter.restartAt(input, normalizeMutationOptions(options));
13506
+ }
13507
+ function executeListsSetLevelNumberStyle(adapter, input, options) {
13508
+ validateListTarget(input, "lists.setLevelNumberStyle");
13509
+ return adapter.setLevelNumberStyle(input, normalizeMutationOptions(options));
13510
+ }
13511
+ function executeListsSetLevelText(adapter, input, options) {
13512
+ validateListTarget(input, "lists.setLevelText");
13513
+ return adapter.setLevelText(input, normalizeMutationOptions(options));
13514
+ }
13515
+ function executeListsSetLevelStart(adapter, input, options) {
13516
+ validateListTarget(input, "lists.setLevelStart");
13517
+ return adapter.setLevelStart(input, normalizeMutationOptions(options));
13518
+ }
13519
+ function executeListsSetLevelLayout(adapter, input, options) {
13520
+ validateListTarget(input, "lists.setLevelLayout");
13521
+ return adapter.setLevelLayout(input, normalizeMutationOptions(options));
13522
+ }
13215
13523
  var init_lists = __esm(() => {
13216
13524
  init_errors2();
13217
13525
  });
@@ -13673,6 +13981,13 @@ function buildDispatchTable(api) {
13673
13981
  "lists.setLevelTrailingCharacter": (input, options) => api.lists.setLevelTrailingCharacter(input, options),
13674
13982
  "lists.setLevelMarkerFont": (input, options) => api.lists.setLevelMarkerFont(input, options),
13675
13983
  "lists.clearLevelOverrides": (input, options) => api.lists.clearLevelOverrides(input, options),
13984
+ "lists.getStyle": (input) => api.lists.getStyle(input),
13985
+ "lists.applyStyle": (input, options) => api.lists.applyStyle(input, options),
13986
+ "lists.restartAt": (input, options) => api.lists.restartAt(input, options),
13987
+ "lists.setLevelNumberStyle": (input, options) => api.lists.setLevelNumberStyle(input, options),
13988
+ "lists.setLevelText": (input, options) => api.lists.setLevelText(input, options),
13989
+ "lists.setLevelStart": (input, options) => api.lists.setLevelStart(input, options),
13990
+ "lists.setLevelLayout": (input, options) => api.lists.setLevelLayout(input, options),
13676
13991
  "sections.list": (input) => api.sections.list(input),
13677
13992
  "sections.get": (input) => api.sections.get(input),
13678
13993
  "sections.setBreakType": (input, options) => api.sections.setBreakType(input, options),
@@ -14010,6 +14325,9 @@ var init_diff = __esm(() => {
14010
14325
  });
14011
14326
 
14012
14327
  // ../../packages/document-api/src/tables/tables.ts
14328
+ function isObjectRecord(value) {
14329
+ return typeof value === "object" && value !== null && !Array.isArray(value);
14330
+ }
14013
14331
  function validateTableLocator(input, operationName) {
14014
14332
  const hasTarget = input.target !== undefined;
14015
14333
  const hasNodeId = input.nodeId !== undefined;
@@ -14026,31 +14344,21 @@ function validateTableLocator(input, operationName) {
14026
14344
  });
14027
14345
  }
14028
14346
  }
14029
- function validateTableScopedLocator(input, operationName) {
14030
- const hasTarget = input.tableTarget !== undefined;
14031
- const hasNodeId = input.tableNodeId !== undefined;
14032
- if (hasTarget && hasNodeId) {
14033
- throw new DocumentApiValidationError("INVALID_TARGET", `Cannot combine tableTarget with tableNodeId on ${operationName} request. Use exactly one locator mode.`, { fields: ["tableTarget", "tableNodeId"] });
14034
- }
14035
- if (!hasTarget && !hasNodeId) {
14036
- throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a table target. Provide either tableTarget or tableNodeId.`);
14347
+ function validateRowLocator(input, operationName) {
14348
+ validateTableLocator(input, operationName);
14349
+ if (input.nodeId != null) {
14350
+ if (input.rowIndex == null) {
14351
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName}: rowIndex is required when using nodeId for row operations. ` + `Use target to address a row directly, or pass nodeId + rowIndex to address a row within a table.`);
14352
+ }
14353
+ return;
14037
14354
  }
14038
- if (hasNodeId && typeof input.tableNodeId !== "string") {
14039
- throw new DocumentApiValidationError("INVALID_TARGET", `tableNodeId must be a string, got ${typeof input.tableNodeId}.`, { field: "tableNodeId", value: input.tableNodeId });
14355
+ if (!isObjectRecord(input.target) || input.target.kind !== "block")
14356
+ return;
14357
+ if (input.target.nodeType === "table" && input.rowIndex == null) {
14358
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName}: rowIndex is required when target is a table.`);
14040
14359
  }
14041
- }
14042
- function validateRowLocator(input, operationName) {
14043
- const hasDirect = input.target !== undefined || input.nodeId !== undefined;
14044
- const hasTableScoped = input.tableTarget !== undefined || input.tableNodeId !== undefined;
14045
- if (hasDirect && hasTableScoped) {
14046
- throw new DocumentApiValidationError("INVALID_TARGET", `Cannot combine direct row locator (target/nodeId) with table-scoped locator (tableTarget/tableNodeId) on ${operationName} request.`);
14047
- }
14048
- if (hasDirect) {
14049
- validateTableLocator(input, operationName);
14050
- } else if (hasTableScoped) {
14051
- validateTableScopedLocator(input, operationName);
14052
- } else {
14053
- throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a row target. Provide target, nodeId, or tableTarget/tableNodeId + rowIndex.`);
14360
+ if (input.target.nodeType === "tableRow" && input.rowIndex != null) {
14361
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName}: rowIndex must not be provided when target is a row node. ` + `Either pass a table target with rowIndex, or pass a row target without rowIndex.`);
14054
14362
  }
14055
14363
  }
14056
14364
  function executeTableLocatorOp(operationName, adapter, input, options) {
@@ -14061,14 +14369,6 @@ function executeRowLocatorOp(operationName, adapter, input, options) {
14061
14369
  validateRowLocator(input, operationName);
14062
14370
  return adapter(input, normalizeMutationOptions(options));
14063
14371
  }
14064
- function executeColumnLocatorOp(operationName, adapter, input, options) {
14065
- validateTableScopedLocator(input, operationName);
14066
- return adapter(input, normalizeMutationOptions(options));
14067
- }
14068
- function executeMergeRangeLocatorOp(operationName, adapter, input, options) {
14069
- validateTableScopedLocator(input, operationName);
14070
- return adapter(input, normalizeMutationOptions(options));
14071
- }
14072
14372
  function executeDocumentLevelTableOp(adapter, input, options) {
14073
14373
  return adapter(input, normalizeMutationOptions(options));
14074
14374
  }
@@ -15944,6 +16244,27 @@ function createDocumentApi(adapters) {
15944
16244
  },
15945
16245
  setType(input, options) {
15946
16246
  return executeListsSetType(adapters.lists, input, options);
16247
+ },
16248
+ getStyle(input) {
16249
+ return executeListsGetStyle(adapters.lists, input);
16250
+ },
16251
+ applyStyle(input, options) {
16252
+ return executeListsApplyStyle(adapters.lists, input, options);
16253
+ },
16254
+ restartAt(input, options) {
16255
+ return executeListsRestartAt(adapters.lists, input, options);
16256
+ },
16257
+ setLevelNumberStyle(input, options) {
16258
+ return executeListsSetLevelNumberStyle(adapters.lists, input, options);
16259
+ },
16260
+ setLevelText(input, options) {
16261
+ return executeListsSetLevelText(adapters.lists, input, options);
16262
+ },
16263
+ setLevelStart(input, options) {
16264
+ return executeListsSetLevelStart(adapters.lists, input, options);
16265
+ },
16266
+ setLevelLayout(input, options) {
16267
+ return executeListsSetLevelLayout(adapters.lists, input, options);
15947
16268
  }
15948
16269
  },
15949
16270
  sections: {
@@ -16040,13 +16361,13 @@ function createDocumentApi(adapters) {
16040
16361
  return executeRowLocatorOp("tables.setRowOptions", adapters.tables.setRowOptions.bind(adapters.tables), input, options);
16041
16362
  },
16042
16363
  insertColumn(input, options) {
16043
- return executeColumnLocatorOp("tables.insertColumn", adapters.tables.insertColumn.bind(adapters.tables), input, options);
16364
+ return executeTableLocatorOp("tables.insertColumn", adapters.tables.insertColumn.bind(adapters.tables), input, options);
16044
16365
  },
16045
16366
  deleteColumn(input, options) {
16046
- return executeColumnLocatorOp("tables.deleteColumn", adapters.tables.deleteColumn.bind(adapters.tables), input, options);
16367
+ return executeTableLocatorOp("tables.deleteColumn", adapters.tables.deleteColumn.bind(adapters.tables), input, options);
16047
16368
  },
16048
16369
  setColumnWidth(input, options) {
16049
- return executeColumnLocatorOp("tables.setColumnWidth", adapters.tables.setColumnWidth.bind(adapters.tables), input, options);
16370
+ return executeTableLocatorOp("tables.setColumnWidth", adapters.tables.setColumnWidth.bind(adapters.tables), input, options);
16050
16371
  },
16051
16372
  distributeColumns(input, options) {
16052
16373
  return executeTableLocatorOp("tables.distributeColumns", adapters.tables.distributeColumns.bind(adapters.tables), input, options);
@@ -16058,7 +16379,7 @@ function createDocumentApi(adapters) {
16058
16379
  return executeTableLocatorOp("tables.deleteCell", adapters.tables.deleteCell.bind(adapters.tables), input, options);
16059
16380
  },
16060
16381
  mergeCells(input, options) {
16061
- return executeMergeRangeLocatorOp("tables.mergeCells", adapters.tables.mergeCells.bind(adapters.tables), input, options);
16382
+ return executeTableLocatorOp("tables.mergeCells", adapters.tables.mergeCells.bind(adapters.tables), input, options);
16062
16383
  },
16063
16384
  unmergeCells(input, options) {
16064
16385
  return executeTableLocatorOp("tables.unmergeCells", adapters.tables.unmergeCells.bind(adapters.tables), input, options);
@@ -39004,7 +39325,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
39004
39325
  emptyOptions2 = {};
39005
39326
  });
39006
39327
 
39007
- // ../../packages/superdoc/dist/chunks/SuperConverter-BcBeadrv.es.js
39328
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DAceeh2o.es.js
39008
39329
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
39009
39330
  const fieldValue = extension$1.config[field];
39010
39331
  if (typeof fieldValue === "function")
@@ -40894,6 +41215,38 @@ function createSectionBreakFailureSchemaFor2(operationId) {
40894
41215
  function createSectionBreakResultSchemaFor2(operationId) {
40895
41216
  return { oneOf: [createSectionBreakSuccessSchema2, createSectionBreakFailureSchemaFor2(operationId)] };
40896
41217
  }
41218
+ function rowOperationInputSchema2(extraProperties, required = []) {
41219
+ return { oneOf: [
41220
+ objectSchema2({
41221
+ target: tableRowAddressSchema2,
41222
+ ...extraProperties
41223
+ }, ["target", ...required]),
41224
+ objectSchema2({
41225
+ target: tableAddressSchema2,
41226
+ rowIndex: {
41227
+ type: "integer",
41228
+ minimum: 0
41229
+ },
41230
+ ...extraProperties
41231
+ }, [
41232
+ "target",
41233
+ "rowIndex",
41234
+ ...required
41235
+ ]),
41236
+ objectSchema2({
41237
+ nodeId: { type: "string" },
41238
+ rowIndex: {
41239
+ type: "integer",
41240
+ minimum: 0
41241
+ },
41242
+ ...extraProperties
41243
+ }, [
41244
+ "nodeId",
41245
+ "rowIndex",
41246
+ ...required
41247
+ ])
41248
+ ] };
41249
+ }
40897
41250
  function supportsImplicitTrueValue2(operationId) {
40898
41251
  const key = operationId.slice(7);
40899
41252
  const entry = INLINE_PROPERTY_REGISTRY2.find((candidate) => candidate.key === key);
@@ -42390,6 +42743,34 @@ function executeListsSetType2(adapter, input, options) {
42390
42743
  validateListTarget2(input, "lists.setType");
42391
42744
  return adapter.setType(input, normalizeMutationOptions2(options));
42392
42745
  }
42746
+ function executeListsGetStyle2(adapter, input) {
42747
+ validateListTarget2(input, "lists.getStyle");
42748
+ return adapter.getStyle(input);
42749
+ }
42750
+ function executeListsApplyStyle2(adapter, input, options) {
42751
+ validateListTarget2(input, "lists.applyStyle");
42752
+ return adapter.applyStyle(input, normalizeMutationOptions2(options));
42753
+ }
42754
+ function executeListsRestartAt2(adapter, input, options) {
42755
+ validateListTarget2(input, "lists.restartAt");
42756
+ return adapter.restartAt(input, normalizeMutationOptions2(options));
42757
+ }
42758
+ function executeListsSetLevelNumberStyle2(adapter, input, options) {
42759
+ validateListTarget2(input, "lists.setLevelNumberStyle");
42760
+ return adapter.setLevelNumberStyle(input, normalizeMutationOptions2(options));
42761
+ }
42762
+ function executeListsSetLevelText2(adapter, input, options) {
42763
+ validateListTarget2(input, "lists.setLevelText");
42764
+ return adapter.setLevelText(input, normalizeMutationOptions2(options));
42765
+ }
42766
+ function executeListsSetLevelStart2(adapter, input, options) {
42767
+ validateListTarget2(input, "lists.setLevelStart");
42768
+ return adapter.setLevelStart(input, normalizeMutationOptions2(options));
42769
+ }
42770
+ function executeListsSetLevelLayout2(adapter, input, options) {
42771
+ validateListTarget2(input, "lists.setLevelLayout");
42772
+ return adapter.setLevelLayout(input, normalizeMutationOptions2(options));
42773
+ }
42393
42774
  function isStructuralReplaceInput2(input) {
42394
42775
  return "content" in input && input.content !== undefined;
42395
42776
  }
@@ -42760,6 +43141,13 @@ function buildDispatchTable2(api) {
42760
43141
  "lists.setLevelTrailingCharacter": (input, options) => api.lists.setLevelTrailingCharacter(input, options),
42761
43142
  "lists.setLevelMarkerFont": (input, options) => api.lists.setLevelMarkerFont(input, options),
42762
43143
  "lists.clearLevelOverrides": (input, options) => api.lists.clearLevelOverrides(input, options),
43144
+ "lists.getStyle": (input) => api.lists.getStyle(input),
43145
+ "lists.applyStyle": (input, options) => api.lists.applyStyle(input, options),
43146
+ "lists.restartAt": (input, options) => api.lists.restartAt(input, options),
43147
+ "lists.setLevelNumberStyle": (input, options) => api.lists.setLevelNumberStyle(input, options),
43148
+ "lists.setLevelText": (input, options) => api.lists.setLevelText(input, options),
43149
+ "lists.setLevelStart": (input, options) => api.lists.setLevelStart(input, options),
43150
+ "lists.setLevelLayout": (input, options) => api.lists.setLevelLayout(input, options),
42763
43151
  "sections.list": (input) => api.sections.list(input),
42764
43152
  "sections.get": (input) => api.sections.get(input),
42765
43153
  "sections.setBreakType": (input, options) => api.sections.setBreakType(input, options),
@@ -43070,6 +43458,9 @@ function executeDiffApply2(adapter, input, options) {
43070
43458
  validateDiffPayloadWrapper2(input?.diff);
43071
43459
  return adapter.apply(input, options);
43072
43460
  }
43461
+ function isObjectRecord2(value) {
43462
+ return typeof value === "object" && value !== null && !Array.isArray(value);
43463
+ }
43073
43464
  function validateTableLocator2(input, operationName) {
43074
43465
  const hasTarget = input.target !== undefined;
43075
43466
  const hasNodeId = input.nodeId !== undefined;
@@ -43083,30 +43474,19 @@ function validateTableLocator2(input, operationName) {
43083
43474
  value: input.nodeId
43084
43475
  });
43085
43476
  }
43086
- function validateTableScopedLocator2(input, operationName) {
43087
- const hasTarget = input.tableTarget !== undefined;
43088
- const hasNodeId = input.tableNodeId !== undefined;
43089
- if (hasTarget && hasNodeId)
43090
- throw new DocumentApiValidationError2("INVALID_TARGET", `Cannot combine tableTarget with tableNodeId on ${operationName} request. Use exactly one locator mode.`, { fields: ["tableTarget", "tableNodeId"] });
43091
- if (!hasTarget && !hasNodeId)
43092
- throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a table target. Provide either tableTarget or tableNodeId.`);
43093
- if (hasNodeId && typeof input.tableNodeId !== "string")
43094
- throw new DocumentApiValidationError2("INVALID_TARGET", `tableNodeId must be a string, got ${typeof input.tableNodeId}.`, {
43095
- field: "tableNodeId",
43096
- value: input.tableNodeId
43097
- });
43098
- }
43099
43477
  function validateRowLocator2(input, operationName) {
43100
- const hasDirect = input.target !== undefined || input.nodeId !== undefined;
43101
- const hasTableScoped = input.tableTarget !== undefined || input.tableNodeId !== undefined;
43102
- if (hasDirect && hasTableScoped)
43103
- throw new DocumentApiValidationError2("INVALID_TARGET", `Cannot combine direct row locator (target/nodeId) with table-scoped locator (tableTarget/tableNodeId) on ${operationName} request.`);
43104
- if (hasDirect)
43105
- validateTableLocator2(input, operationName);
43106
- else if (hasTableScoped)
43107
- validateTableScopedLocator2(input, operationName);
43108
- else
43109
- throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a row target. Provide target, nodeId, or tableTarget/tableNodeId + rowIndex.`);
43478
+ validateTableLocator2(input, operationName);
43479
+ if (input.nodeId != null) {
43480
+ if (input.rowIndex == null)
43481
+ throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName}: rowIndex is required when using nodeId for row operations. Use target to address a row directly, or pass nodeId + rowIndex to address a row within a table.`);
43482
+ return;
43483
+ }
43484
+ if (!isObjectRecord2(input.target) || input.target.kind !== "block")
43485
+ return;
43486
+ if (input.target.nodeType === "table" && input.rowIndex == null)
43487
+ throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName}: rowIndex is required when target is a table.`);
43488
+ if (input.target.nodeType === "tableRow" && input.rowIndex != null)
43489
+ throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName}: rowIndex must not be provided when target is a row node. Either pass a table target with rowIndex, or pass a row target without rowIndex.`);
43110
43490
  }
43111
43491
  function executeTableLocatorOp2(operationName, adapter, input, options) {
43112
43492
  validateTableLocator2(input, operationName);
@@ -43116,14 +43496,6 @@ function executeRowLocatorOp2(operationName, adapter, input, options) {
43116
43496
  validateRowLocator2(input, operationName);
43117
43497
  return adapter(input, normalizeMutationOptions2(options));
43118
43498
  }
43119
- function executeColumnLocatorOp2(operationName, adapter, input, options) {
43120
- validateTableScopedLocator2(input, operationName);
43121
- return adapter(input, normalizeMutationOptions2(options));
43122
- }
43123
- function executeMergeRangeLocatorOp2(operationName, adapter, input, options) {
43124
- validateTableScopedLocator2(input, operationName);
43125
- return adapter(input, normalizeMutationOptions2(options));
43126
- }
43127
43499
  function executeDocumentLevelTableOp2(adapter, input, options) {
43128
43500
  return adapter(input, normalizeMutationOptions2(options));
43129
43501
  }
@@ -44775,6 +45147,27 @@ function createDocumentApi2(adapters) {
44775
45147
  },
44776
45148
  setType(input, options) {
44777
45149
  return executeListsSetType2(adapters.lists, input, options);
45150
+ },
45151
+ getStyle(input) {
45152
+ return executeListsGetStyle2(adapters.lists, input);
45153
+ },
45154
+ applyStyle(input, options) {
45155
+ return executeListsApplyStyle2(adapters.lists, input, options);
45156
+ },
45157
+ restartAt(input, options) {
45158
+ return executeListsRestartAt2(adapters.lists, input, options);
45159
+ },
45160
+ setLevelNumberStyle(input, options) {
45161
+ return executeListsSetLevelNumberStyle2(adapters.lists, input, options);
45162
+ },
45163
+ setLevelText(input, options) {
45164
+ return executeListsSetLevelText2(adapters.lists, input, options);
45165
+ },
45166
+ setLevelStart(input, options) {
45167
+ return executeListsSetLevelStart2(adapters.lists, input, options);
45168
+ },
45169
+ setLevelLayout(input, options) {
45170
+ return executeListsSetLevelLayout2(adapters.lists, input, options);
44778
45171
  }
44779
45172
  },
44780
45173
  sections: {
@@ -44871,13 +45264,13 @@ function createDocumentApi2(adapters) {
44871
45264
  return executeRowLocatorOp2("tables.setRowOptions", adapters.tables.setRowOptions.bind(adapters.tables), input, options);
44872
45265
  },
44873
45266
  insertColumn(input, options) {
44874
- return executeColumnLocatorOp2("tables.insertColumn", adapters.tables.insertColumn.bind(adapters.tables), input, options);
45267
+ return executeTableLocatorOp2("tables.insertColumn", adapters.tables.insertColumn.bind(adapters.tables), input, options);
44875
45268
  },
44876
45269
  deleteColumn(input, options) {
44877
- return executeColumnLocatorOp2("tables.deleteColumn", adapters.tables.deleteColumn.bind(adapters.tables), input, options);
45270
+ return executeTableLocatorOp2("tables.deleteColumn", adapters.tables.deleteColumn.bind(adapters.tables), input, options);
44878
45271
  },
44879
45272
  setColumnWidth(input, options) {
44880
- return executeColumnLocatorOp2("tables.setColumnWidth", adapters.tables.setColumnWidth.bind(adapters.tables), input, options);
45273
+ return executeTableLocatorOp2("tables.setColumnWidth", adapters.tables.setColumnWidth.bind(adapters.tables), input, options);
44881
45274
  },
44882
45275
  distributeColumns(input, options) {
44883
45276
  return executeTableLocatorOp2("tables.distributeColumns", adapters.tables.distributeColumns.bind(adapters.tables), input, options);
@@ -44889,7 +45282,7 @@ function createDocumentApi2(adapters) {
44889
45282
  return executeTableLocatorOp2("tables.deleteCell", adapters.tables.deleteCell.bind(adapters.tables), input, options);
44890
45283
  },
44891
45284
  mergeCells(input, options) {
44892
- return executeMergeRangeLocatorOp2("tables.mergeCells", adapters.tables.mergeCells.bind(adapters.tables), input, options);
45285
+ return executeTableLocatorOp2("tables.mergeCells", adapters.tables.mergeCells.bind(adapters.tables), input, options);
44893
45286
  },
44894
45287
  unmergeCells(input, options) {
44895
45288
  return executeTableLocatorOp2("tables.unmergeCells", adapters.tables.unmergeCells.bind(adapters.tables), input, options);
@@ -55577,6 +55970,16 @@ function getParagraphRunContext($pos, editor) {
55577
55970
  break;
55578
55971
  }
55579
55972
  }
55973
+ if (runProperties == null) {
55974
+ const nodeBefore = $pos.nodeBefore;
55975
+ if (nodeBefore?.type.name === "run")
55976
+ runProperties = normalizeRunProperties(nodeBefore.attrs?.runProperties);
55977
+ else {
55978
+ const nodeAfter = $pos.nodeAfter;
55979
+ if (nodeAfter?.type.name === "run")
55980
+ runProperties = normalizeRunProperties(nodeAfter.attrs?.runProperties);
55981
+ }
55982
+ }
55580
55983
  if (!paragraphNode)
55581
55984
  return null;
55582
55985
  const paragraphAttrs = paragraphNode.attrs || {};
@@ -68561,7 +68964,7 @@ var isRegExp = (value) => {
68561
68964
  tracked: false,
68562
68965
  carrier: runAttributeCarrier2(runPropertyKey ?? key),
68563
68966
  schema
68564
- }), INLINE_PROPERTY_REGISTRY2, INLINE_PROPERTY_KEY_SET2, INLINE_PROPERTY_BY_KEY2, UNDERLINE_OBJECT_ALLOWED_KEYS2, SHADING_ALLOWED_KEYS2, BORDER_ALLOWED_KEYS2, FIT_TEXT_ALLOWED_KEYS2, LANG_ALLOWED_KEYS2, RFONTS_ALLOWED_KEYS2, EAST_ASIAN_LAYOUT_ALLOWED_KEYS2, STYLISTIC_SET_ALLOWED_KEYS2, VERT_ALIGN_VALUES2, PROPERTY_VALIDATOR_MAP2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_IMAGE_COMMAND2, T_CC_READ2, T_CC_MUTATION2, T_CC_TYPED2, T_CC_TYPED_READ2, T_CC_RAW2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, T_HEADER_FOOTER_MUTATION2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS2, OPERATION_DEFINITIONS2, OPERATION_IDS2, COMMAND_CATALOG3, PARAGRAPH_ALIGNMENTS2, TAB_STOP_ALIGNMENTS2, TAB_STOP_LEADERS2, BORDER_SIDES2, CLEAR_BORDER_SIDES2, LINE_RULES2, PARAGRAPH_BLOCK_TYPES2, SET_STYLE_KEYS2, CLEAR_STYLE_KEYS2, RESET_DIRECT_FORMATTING_KEYS2, SET_ALIGNMENT_KEYS2, CLEAR_ALIGNMENT_KEYS2, SET_INDENTATION_KEYS2, CLEAR_INDENTATION_KEYS2, SET_SPACING_KEYS2, CLEAR_SPACING_KEYS2, SET_KEEP_OPTIONS_KEYS2, SET_OUTLINE_LEVEL_KEYS2, SET_FLOW_OPTIONS_KEYS2, SET_TAB_STOP_KEYS2, CLEAR_TAB_STOP_KEYS2, CLEAR_ALL_TAB_STOPS_KEYS2, SET_BORDER_KEYS2, CLEAR_BORDER_KEYS2, SET_SHADING_KEYS2, CLEAR_SHADING_KEYS2, ST_ON_OFF_ON_VALUES2, ST_ON_OFF_OFF_VALUES2, ST_UNDERLINE_VALUES2, ST_UNDERLINE_VALUE_SET2, ST_VERTICAL_ALIGN_RUN2, ST_EM2, ST_TEXT_ALIGNMENT2, ST_TEXT_DIRECTION2, ST_TEXTBOX_TIGHT_WRAP2, ST_TEXT_TRANSFORM2, ST_JUSTIFICATION2, FONT_FAMILY_SCHEMA2, COLOR_SCHEMA2, SPACING_SCHEMA2, INDENT_SCHEMA2, UNDERLINE_SCHEMA2, BORDER_PROPERTIES_SCHEMA2, SHADING_SCHEMA2, LANG_SCHEMA2, EAST_ASIAN_LAYOUT_SCHEMA2, FIT_TEXT_SCHEMA2, NUMBERING_PROPERTIES_SCHEMA2, FRAME_PR_SCHEMA2, PARAGRAPH_BORDERS_SCHEMA2, TAB_STOP_SCHEMA2, PROPERTY_REGISTRY2, ALLOWED_KEYS_BY_CHANNEL2, PROPERTY_INDEX2, EXCLUDED_KEYS2, INPUT_ALLOWED_KEYS2, TARGET_ALLOWED_KEYS2, OPTIONS_ALLOWED_KEYS2, VALID_CHANNELS2, Z_ORDER_RELATIVE_HEIGHT_MAX2 = 4294967295, nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, rangeSchema2, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, listKindSchema2, listInsertPositionSchema2, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, 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, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES2, VALID_EDGE_NODE_TYPES2, VALID_DOCUMENT_EDGES2, VALID_REF_BOUNDARIES2, VALID_ANCHOR_KINDS2, RESOLVE_RANGE_ALLOWED_KEYS2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, VALID_BEHAVIORS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, LEGACY_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, TEXT_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, VALID_BLOCK_NODE_TYPES2, SNAPSHOT_VERSION2 = "sd-diff-snapshot/v1", PAYLOAD_VERSION2 = "sd-diff-payload/v1", HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS3, HEADER_FOOTER_VARIANTS3, LINE_NUMBER_RESTARTS2, PAGE_NUMBER_FORMATS2, PAGE_BORDER_DISPLAYS2, PAGE_BORDER_OFFSET_FROM_VALUES2, PAGE_BORDER_Z_ORDER_VALUES2, VALID_WRAP_TYPES2, VALID_WRAP_SIDES2, VALID_IMAGE_SIZE_UNITS2, PATCH_FIELDS2, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$215) => ({
68967
+ }), INLINE_PROPERTY_REGISTRY2, INLINE_PROPERTY_KEY_SET2, INLINE_PROPERTY_BY_KEY2, UNDERLINE_OBJECT_ALLOWED_KEYS2, SHADING_ALLOWED_KEYS2, BORDER_ALLOWED_KEYS2, FIT_TEXT_ALLOWED_KEYS2, LANG_ALLOWED_KEYS2, RFONTS_ALLOWED_KEYS2, EAST_ASIAN_LAYOUT_ALLOWED_KEYS2, STYLISTIC_SET_ALLOWED_KEYS2, VERT_ALIGN_VALUES2, PROPERTY_VALIDATOR_MAP2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_IMAGE_COMMAND2, T_CC_READ2, T_CC_MUTATION2, T_CC_TYPED2, T_CC_TYPED_READ2, T_CC_RAW2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, T_HEADER_FOOTER_MUTATION2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS2, OPERATION_DEFINITIONS2, OPERATION_IDS2, COMMAND_CATALOG3, PARAGRAPH_ALIGNMENTS2, TAB_STOP_ALIGNMENTS2, TAB_STOP_LEADERS2, BORDER_SIDES2, CLEAR_BORDER_SIDES2, LINE_RULES2, PARAGRAPH_BLOCK_TYPES2, SET_STYLE_KEYS2, CLEAR_STYLE_KEYS2, RESET_DIRECT_FORMATTING_KEYS2, SET_ALIGNMENT_KEYS2, CLEAR_ALIGNMENT_KEYS2, SET_INDENTATION_KEYS2, CLEAR_INDENTATION_KEYS2, SET_SPACING_KEYS2, CLEAR_SPACING_KEYS2, SET_KEEP_OPTIONS_KEYS2, SET_OUTLINE_LEVEL_KEYS2, SET_FLOW_OPTIONS_KEYS2, SET_TAB_STOP_KEYS2, CLEAR_TAB_STOP_KEYS2, CLEAR_ALL_TAB_STOPS_KEYS2, SET_BORDER_KEYS2, CLEAR_BORDER_KEYS2, SET_SHADING_KEYS2, CLEAR_SHADING_KEYS2, ST_ON_OFF_ON_VALUES2, ST_ON_OFF_OFF_VALUES2, ST_UNDERLINE_VALUES2, ST_UNDERLINE_VALUE_SET2, ST_VERTICAL_ALIGN_RUN2, ST_EM2, ST_TEXT_ALIGNMENT2, ST_TEXT_DIRECTION2, ST_TEXTBOX_TIGHT_WRAP2, ST_TEXT_TRANSFORM2, ST_JUSTIFICATION2, FONT_FAMILY_SCHEMA2, COLOR_SCHEMA2, SPACING_SCHEMA2, INDENT_SCHEMA2, UNDERLINE_SCHEMA2, BORDER_PROPERTIES_SCHEMA2, SHADING_SCHEMA2, LANG_SCHEMA2, EAST_ASIAN_LAYOUT_SCHEMA2, FIT_TEXT_SCHEMA2, NUMBERING_PROPERTIES_SCHEMA2, FRAME_PR_SCHEMA2, PARAGRAPH_BORDERS_SCHEMA2, TAB_STOP_SCHEMA2, PROPERTY_REGISTRY2, ALLOWED_KEYS_BY_CHANNEL2, PROPERTY_INDEX2, EXCLUDED_KEYS2, INPUT_ALLOWED_KEYS2, TARGET_ALLOWED_KEYS2, OPTIONS_ALLOWED_KEYS2, VALID_CHANNELS2, Z_ORDER_RELATIVE_HEIGHT_MAX2 = 4294967295, nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, rangeSchema2, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, listKindSchema2, listInsertPositionSchema2, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, 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, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES2, VALID_EDGE_NODE_TYPES2, VALID_DOCUMENT_EDGES2, VALID_REF_BOUNDARIES2, VALID_ANCHOR_KINDS2, RESOLVE_RANGE_ALLOWED_KEYS2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, VALID_BEHAVIORS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, LEGACY_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, TEXT_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, VALID_BLOCK_NODE_TYPES2, SNAPSHOT_VERSION2 = "sd-diff-snapshot/v1", PAYLOAD_VERSION2 = "sd-diff-payload/v1", HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS3, HEADER_FOOTER_VARIANTS3, LINE_NUMBER_RESTARTS2, PAGE_NUMBER_FORMATS2, PAGE_BORDER_DISPLAYS2, PAGE_BORDER_OFFSET_FROM_VALUES2, PAGE_BORDER_Z_ORDER_VALUES2, VALID_WRAP_TYPES2, VALID_WRAP_SIDES2, VALID_IMAGE_SIZE_UNITS2, PATCH_FIELDS2, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$215) => ({
68565
68968
  handlerName,
68566
68969
  handler: (params) => {
68567
68970
  const { nodes } = params;
@@ -82488,7 +82891,7 @@ var isRegExp = (value) => {
82488
82891
  state.kern = kernNode.attributes["w:val"];
82489
82892
  }
82490
82893
  }, SuperConverter;
82491
- var init_SuperConverter_BcBeadrv_es = __esm(() => {
82894
+ var init_SuperConverter_DAceeh2o_es = __esm(() => {
82492
82895
  init_rolldown_runtime_B2q5OVn9_es();
82493
82896
  init_jszip_ChlR43oI_es();
82494
82897
  init_xml_js_BtmJ6bNs_es();
@@ -86540,15 +86943,24 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86540
86943
  },
86541
86944
  "lists.create": {
86542
86945
  memberPath: "lists.create",
86543
- description: "Create a new list from one or more paragraphs, or convert existing paragraphs into a new list.",
86946
+ description: 'Create a new list from one or more paragraphs. Supports optional preset or style for new sequences. When sequence.mode is "continuePrevious", preset and style are not allowed — the new items inherit formatting from the previous sequence.',
86544
86947
  expectedResult: "Returns a ListsCreateResult with the new listId and the first item address.",
86545
86948
  requiresDocumentContext: true,
86546
86949
  metadata: mutationOperation2({
86547
86950
  idempotency: "non-idempotent",
86548
86951
  supportsDryRun: true,
86549
86952
  supportsTrackedMode: false,
86550
- possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE"],
86551
- throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
86953
+ possibleFailureCodes: [
86954
+ "INVALID_TARGET",
86955
+ "LEVEL_OUT_OF_RANGE",
86956
+ "INVALID_INPUT",
86957
+ "NO_COMPATIBLE_PREVIOUS"
86958
+ ],
86959
+ throws: [
86960
+ ...T_NOT_FOUND_CAPABLE2,
86961
+ "INVALID_TARGET",
86962
+ "INVALID_INPUT"
86963
+ ]
86552
86964
  }),
86553
86965
  referenceDocPath: "lists/create.mdx",
86554
86966
  referenceGroup: "lists",
@@ -86783,7 +87195,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86783
87195
  },
86784
87196
  "lists.applyTemplate": {
86785
87197
  memberPath: "lists.applyTemplate",
86786
- description: "Apply a captured ListTemplate to the target list, optionally filtered to specific levels.",
87198
+ description: "Advanced alias for lists.applyStyle. Apply a captured ListTemplate to the target list (abstract-scoped, no clone-on-write).",
86787
87199
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
86788
87200
  requiresDocumentContext: true,
86789
87201
  metadata: mutationOperation2({
@@ -86856,7 +87268,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86856
87268
  },
86857
87269
  "lists.captureTemplate": {
86858
87270
  memberPath: "lists.captureTemplate",
86859
- description: "Capture the formatting of a list as a reusable ListTemplate.",
87271
+ description: "Advanced alias for lists.getStyle. Capture list formatting from the abstract definition only (does not merge lvlOverride formatting).",
86860
87272
  expectedResult: "Returns a ListsCaptureTemplateResult containing the captured template.",
86861
87273
  requiresDocumentContext: true,
86862
87274
  metadata: readOperation2({
@@ -86877,7 +87289,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86877
87289
  },
86878
87290
  "lists.setLevelNumbering": {
86879
87291
  memberPath: "lists.setLevelNumbering",
86880
- description: "Set the numbering format, pattern, and optional start value for a specific list level.",
87292
+ description: "Advanced alias for lists.setLevelNumberStyle/setLevelText/setLevelStart. Set format, pattern, and start in one call (abstract-scoped, no clone-on-write).",
86881
87293
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the level already matches.",
86882
87294
  requiresDocumentContext: true,
86883
87295
  metadata: mutationOperation2({
@@ -87045,6 +87457,170 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
87045
87457
  referenceDocPath: "lists/clear-level-overrides.mdx",
87046
87458
  referenceGroup: "lists"
87047
87459
  },
87460
+ "lists.getStyle": {
87461
+ memberPath: "lists.getStyle",
87462
+ description: "Read the effective reusable style of a list, including instance-level overrides. Returns a ListStyle that can be applied to other lists via lists.applyStyle.",
87463
+ expectedResult: "Returns a ListsGetStyleResult containing the captured style.",
87464
+ requiresDocumentContext: true,
87465
+ metadata: readOperation2({
87466
+ idempotency: "idempotent",
87467
+ throws: [
87468
+ "TARGET_NOT_FOUND",
87469
+ "INVALID_TARGET",
87470
+ "INVALID_INPUT"
87471
+ ],
87472
+ possibleFailureCodes: [
87473
+ "INVALID_TARGET",
87474
+ "INVALID_INPUT",
87475
+ "LEVEL_OUT_OF_RANGE"
87476
+ ]
87477
+ }),
87478
+ referenceDocPath: "lists/get-style.mdx",
87479
+ referenceGroup: "lists"
87480
+ },
87481
+ "lists.applyStyle": {
87482
+ memberPath: "lists.applyStyle",
87483
+ description: "Apply a reusable list style to the target list. Sequence-local: if the abstract definition is shared with other lists, it is cloned first to avoid affecting them.",
87484
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
87485
+ requiresDocumentContext: true,
87486
+ metadata: mutationOperation2({
87487
+ idempotency: "conditional",
87488
+ supportsDryRun: true,
87489
+ supportsTrackedMode: false,
87490
+ possibleFailureCodes: [
87491
+ "NO_OP",
87492
+ "INVALID_TARGET",
87493
+ "INVALID_INPUT",
87494
+ "LEVEL_OUT_OF_RANGE"
87495
+ ],
87496
+ throws: [
87497
+ ...T_NOT_FOUND_CAPABLE2,
87498
+ "INVALID_TARGET",
87499
+ "INVALID_INPUT"
87500
+ ]
87501
+ }),
87502
+ referenceDocPath: "lists/apply-style.mdx",
87503
+ referenceGroup: "lists"
87504
+ },
87505
+ "lists.restartAt": {
87506
+ memberPath: "lists.restartAt",
87507
+ description: "Restart numbering at the target list item with a specific value. If the item is mid-sequence, it is separated first.",
87508
+ expectedResult: "Returns a ListsMutateItemResult receipt.",
87509
+ requiresDocumentContext: true,
87510
+ metadata: mutationOperation2({
87511
+ idempotency: "non-idempotent",
87512
+ supportsDryRun: true,
87513
+ supportsTrackedMode: false,
87514
+ possibleFailureCodes: [
87515
+ "NO_OP",
87516
+ "INVALID_TARGET",
87517
+ "INVALID_INPUT"
87518
+ ],
87519
+ throws: [
87520
+ ...T_NOT_FOUND_CAPABLE2,
87521
+ "INVALID_TARGET",
87522
+ "INVALID_INPUT"
87523
+ ]
87524
+ }),
87525
+ referenceDocPath: "lists/restart-at.mdx",
87526
+ referenceGroup: "lists"
87527
+ },
87528
+ "lists.setLevelNumberStyle": {
87529
+ memberPath: "lists.setLevelNumberStyle",
87530
+ description: 'Set the numbering style (e.g. decimal, lowerLetter, upperRoman) for a specific list level. Rejects "bullet" — use setLevelBullet instead. Sequence-local: clones shared definitions.',
87531
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87532
+ requiresDocumentContext: true,
87533
+ metadata: mutationOperation2({
87534
+ idempotency: "conditional",
87535
+ supportsDryRun: true,
87536
+ supportsTrackedMode: false,
87537
+ possibleFailureCodes: [
87538
+ "NO_OP",
87539
+ "INVALID_TARGET",
87540
+ "INVALID_INPUT",
87541
+ "LEVEL_OUT_OF_RANGE",
87542
+ "LEVEL_NOT_FOUND"
87543
+ ],
87544
+ throws: [
87545
+ ...T_NOT_FOUND_CAPABLE2,
87546
+ "INVALID_TARGET",
87547
+ "INVALID_INPUT"
87548
+ ]
87549
+ }),
87550
+ referenceDocPath: "lists/set-level-number-style.mdx",
87551
+ referenceGroup: "lists"
87552
+ },
87553
+ "lists.setLevelText": {
87554
+ memberPath: "lists.setLevelText",
87555
+ description: 'Set the level text pattern (e.g. "%1.", "(%1)") for a specific list level. Uses OOXML level-placeholder syntax. Sequence-local: clones shared definitions.',
87556
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87557
+ requiresDocumentContext: true,
87558
+ metadata: mutationOperation2({
87559
+ idempotency: "conditional",
87560
+ supportsDryRun: true,
87561
+ supportsTrackedMode: false,
87562
+ possibleFailureCodes: [
87563
+ "NO_OP",
87564
+ "INVALID_TARGET",
87565
+ "INVALID_INPUT",
87566
+ "LEVEL_OUT_OF_RANGE",
87567
+ "LEVEL_NOT_FOUND"
87568
+ ],
87569
+ throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
87570
+ }),
87571
+ referenceDocPath: "lists/set-level-text.mdx",
87572
+ referenceGroup: "lists"
87573
+ },
87574
+ "lists.setLevelStart": {
87575
+ memberPath: "lists.setLevelStart",
87576
+ description: "Set the start value for a specific list level. Rejects bullet levels and non-positive values. Sequence-local: clones shared definitions.",
87577
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87578
+ requiresDocumentContext: true,
87579
+ metadata: mutationOperation2({
87580
+ idempotency: "conditional",
87581
+ supportsDryRun: true,
87582
+ supportsTrackedMode: false,
87583
+ possibleFailureCodes: [
87584
+ "NO_OP",
87585
+ "INVALID_TARGET",
87586
+ "INVALID_INPUT",
87587
+ "LEVEL_OUT_OF_RANGE",
87588
+ "LEVEL_NOT_FOUND"
87589
+ ],
87590
+ throws: [
87591
+ ...T_NOT_FOUND_CAPABLE2,
87592
+ "INVALID_TARGET",
87593
+ "INVALID_INPUT"
87594
+ ]
87595
+ }),
87596
+ referenceDocPath: "lists/set-level-start.mdx",
87597
+ referenceGroup: "lists"
87598
+ },
87599
+ "lists.setLevelLayout": {
87600
+ memberPath: "lists.setLevelLayout",
87601
+ description: "Set the layout properties (alignment, indentation, trailing character, tab stop) for a specific list level. Accepts partial updates — omitted fields are left unchanged. Sequence-local: clones shared definitions.",
87602
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all values already match.",
87603
+ requiresDocumentContext: true,
87604
+ metadata: mutationOperation2({
87605
+ idempotency: "conditional",
87606
+ supportsDryRun: true,
87607
+ supportsTrackedMode: false,
87608
+ possibleFailureCodes: [
87609
+ "NO_OP",
87610
+ "INVALID_TARGET",
87611
+ "INVALID_INPUT",
87612
+ "LEVEL_OUT_OF_RANGE",
87613
+ "LEVEL_NOT_FOUND"
87614
+ ],
87615
+ throws: [
87616
+ ...T_NOT_FOUND_CAPABLE2,
87617
+ "INVALID_TARGET",
87618
+ "INVALID_INPUT"
87619
+ ]
87620
+ }),
87621
+ referenceDocPath: "lists/set-level-layout.mdx",
87622
+ referenceGroup: "lists"
87623
+ },
87048
87624
  "comments.create": {
87049
87625
  memberPath: "comments.create",
87050
87626
  description: "Create a new comment thread (or reply when parentCommentId is given).",
@@ -91313,6 +91889,46 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
91313
91889
  "kind",
91314
91890
  "nodeType",
91315
91891
  "nodeId"
91892
+ ]), objectSchema2({
91893
+ kind: { const: "block" },
91894
+ nodeType: { const: "table" },
91895
+ nodeId: { type: "string" }
91896
+ }, [
91897
+ "kind",
91898
+ "nodeType",
91899
+ "nodeId"
91900
+ ]), objectSchema2({
91901
+ kind: { const: "block" },
91902
+ nodeType: { const: "tableRow" },
91903
+ nodeId: { type: "string" }
91904
+ }, [
91905
+ "kind",
91906
+ "nodeType",
91907
+ "nodeId"
91908
+ ]), objectSchema2({
91909
+ kind: { const: "block" },
91910
+ nodeType: { const: "tableCell" },
91911
+ nodeId: { type: "string" }
91912
+ }, [
91913
+ "kind",
91914
+ "nodeType",
91915
+ "nodeId"
91916
+ ]), objectSchema2({
91917
+ kind: { const: "block" },
91918
+ nodeType: { enum: ["table", "tableRow"] },
91919
+ nodeId: { type: "string" }
91920
+ }, [
91921
+ "kind",
91922
+ "nodeType",
91923
+ "nodeId"
91924
+ ]), objectSchema2({
91925
+ kind: { const: "block" },
91926
+ nodeType: { enum: ["table", "tableCell"] },
91927
+ nodeId: { type: "string" }
91928
+ }, [
91929
+ "kind",
91930
+ "nodeType",
91931
+ "nodeId"
91316
91932
  ]), objectSchema2({
91317
91933
  kind: { const: "block" },
91318
91934
  nodeType: { const: "paragraph" },
@@ -91497,6 +92113,10 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
91497
92113
  textTargetSchema2 = ref2("TextTarget");
91498
92114
  blockNodeAddressSchema2 = ref2("BlockNodeAddress");
91499
92115
  deletableBlockNodeAddressSchema2 = ref2("DeletableBlockNodeAddress");
92116
+ tableAddressSchema2 = ref2("TableAddress");
92117
+ tableRowAddressSchema2 = ref2("TableRowAddress");
92118
+ tableCellAddressSchema2 = ref2("TableCellAddress");
92119
+ tableOrCellAddressSchema2 = ref2("TableOrCellAddress");
91500
92120
  paragraphAddressSchema2 = ref2("ParagraphAddress");
91501
92121
  headingAddressSchema2 = ref2("HeadingAddress");
91502
92122
  listItemAddressSchema2 = ref2("ListItemAddress");
@@ -92156,28 +92776,20 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
92156
92776
  nestingPolicy: nestingPolicySchema2
92157
92777
  }, ["content"]);
92158
92778
  ({ ...objectSchema2({
92159
- target: blockNodeAddressSchema2,
92779
+ target: tableAddressSchema2,
92160
92780
  nodeId: { type: "string" }
92161
92781
  }) });
92162
92782
  ({ ...objectSchema2({
92163
- tableTarget: blockNodeAddressSchema2,
92164
- tableNodeId: { type: "string" },
92165
- rowIndex: {
92166
- type: "integer",
92167
- minimum: 0
92168
- }
92783
+ target: tableCellAddressSchema2,
92784
+ nodeId: { type: "string" }
92169
92785
  }) });
92170
92786
  ({ ...objectSchema2({
92171
- tableTarget: blockNodeAddressSchema2,
92172
- tableNodeId: { type: "string" },
92173
- columnIndex: {
92174
- type: "integer",
92175
- minimum: 0
92176
- }
92177
- }, ["columnIndex"]) });
92787
+ target: tableOrCellAddressSchema2,
92788
+ nodeId: { type: "string" }
92789
+ }) });
92178
92790
  ({ ...objectSchema2({
92179
- tableTarget: blockNodeAddressSchema2,
92180
- tableNodeId: { type: "string" },
92791
+ target: tableAddressSchema2,
92792
+ nodeId: { type: "string" },
92181
92793
  start: objectSchema2({
92182
92794
  rowIndex: {
92183
92795
  type: "integer",
@@ -92221,12 +92833,12 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
92221
92833
  ] };
92222
92834
  objectSchema2({
92223
92835
  success: { const: true },
92224
- table: blockNodeAddressSchema2,
92836
+ table: tableAddressSchema2,
92225
92837
  trackedChangeRefs: arraySchema2(entityAddressSchema2)
92226
92838
  }, ["success"]);
92227
92839
  objectSchema2({
92228
92840
  success: { const: true },
92229
- table: blockNodeAddressSchema2,
92841
+ table: tableAddressSchema2,
92230
92842
  trackedChangeRefs: arraySchema2(entityAddressSchema2)
92231
92843
  }, ["success", "table"]);
92232
92844
  objectSchema2({
@@ -93318,6 +93930,42 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
93318
93930
  position: listInsertPositionSchema2,
93319
93931
  text: { type: "string" }
93320
93932
  }, ["target", "position"]), listsInsertResultSchemaFor2("lists.insert"), listsFailureSchemaFor2("lists.insert"), ref2("BlockAddress"), ref2("BlockAddressOrRange"), objectSchema2({
93933
+ version: { const: 1 },
93934
+ levels: arraySchema2(objectSchema2({
93935
+ level: {
93936
+ type: "integer",
93937
+ minimum: 0,
93938
+ maximum: 8
93939
+ },
93940
+ numFmt: { type: "string" },
93941
+ lvlText: { type: "string" },
93942
+ start: { type: "integer" },
93943
+ alignment: { enum: [
93944
+ "left",
93945
+ "center",
93946
+ "right"
93947
+ ] },
93948
+ indents: objectSchema2({
93949
+ left: { type: "integer" },
93950
+ hanging: { type: "integer" },
93951
+ firstLine: { type: "integer" }
93952
+ }),
93953
+ trailingCharacter: { enum: [
93954
+ "tab",
93955
+ "space",
93956
+ "nothing"
93957
+ ] },
93958
+ markerFont: { type: "string" },
93959
+ pictureBulletId: { type: "integer" },
93960
+ tabStopAt: { type: ["integer", "null"] }
93961
+ }, ["level"]))
93962
+ }, ["version", "levels"]), objectSchema2({
93963
+ mode: { const: "new" },
93964
+ startAt: {
93965
+ type: "integer",
93966
+ minimum: 1
93967
+ }
93968
+ }, ["mode"]), objectSchema2({ mode: { const: "continuePrevious" } }, ["mode"]), objectSchema2({
93321
93969
  success: { const: true },
93322
93970
  listId: { type: "string" },
93323
93971
  item: listItemAddressSchema2
@@ -93623,7 +94271,164 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
93623
94271
  minimum: 0,
93624
94272
  maximum: 8
93625
94273
  }
93626
- }, ["target", "level"]), listsMutateItemResultSchemaFor2("lists.clearLevelOverrides"), listsFailureSchemaFor2("lists.clearLevelOverrides"), objectSchema2({
94274
+ }, ["target", "level"]), listsMutateItemResultSchemaFor2("lists.clearLevelOverrides"), listsFailureSchemaFor2("lists.clearLevelOverrides"), (() => {
94275
+ const successSchema = objectSchema2({
94276
+ success: { const: true },
94277
+ style: objectSchema2({
94278
+ version: { const: 1 },
94279
+ levels: arraySchema2(objectSchema2({
94280
+ level: {
94281
+ type: "integer",
94282
+ minimum: 0,
94283
+ maximum: 8
94284
+ },
94285
+ numFmt: { type: "string" },
94286
+ lvlText: { type: "string" },
94287
+ start: { type: "integer" },
94288
+ alignment: { enum: [
94289
+ "left",
94290
+ "center",
94291
+ "right"
94292
+ ] },
94293
+ indents: objectSchema2({
94294
+ left: { type: "integer" },
94295
+ hanging: { type: "integer" },
94296
+ firstLine: { type: "integer" }
94297
+ }),
94298
+ trailingCharacter: { enum: [
94299
+ "tab",
94300
+ "space",
94301
+ "nothing"
94302
+ ] },
94303
+ markerFont: { type: "string" },
94304
+ pictureBulletId: { type: "integer" },
94305
+ tabStopAt: { type: ["integer", "null"] }
94306
+ }, ["level"]))
94307
+ }, ["version", "levels"])
94308
+ }, ["success", "style"]);
94309
+ return {
94310
+ input: objectSchema2({
94311
+ target: listItemAddressSchema2,
94312
+ levels: arraySchema2({
94313
+ type: "integer",
94314
+ minimum: 0,
94315
+ maximum: 8
94316
+ })
94317
+ }, ["target"]),
94318
+ output: { oneOf: [successSchema, listsFailureSchemaFor2("lists.getStyle")] },
94319
+ success: successSchema,
94320
+ failure: listsFailureSchemaFor2("lists.getStyle")
94321
+ };
94322
+ })(), objectSchema2({
94323
+ target: listItemAddressSchema2,
94324
+ style: objectSchema2({
94325
+ version: { const: 1 },
94326
+ levels: arraySchema2(objectSchema2({
94327
+ level: {
94328
+ type: "integer",
94329
+ minimum: 0,
94330
+ maximum: 8
94331
+ },
94332
+ numFmt: { type: "string" },
94333
+ lvlText: { type: "string" },
94334
+ start: { type: "integer" },
94335
+ alignment: { enum: [
94336
+ "left",
94337
+ "center",
94338
+ "right"
94339
+ ] },
94340
+ indents: objectSchema2({
94341
+ left: { type: "integer" },
94342
+ hanging: { type: "integer" },
94343
+ firstLine: { type: "integer" }
94344
+ }),
94345
+ trailingCharacter: { enum: [
94346
+ "tab",
94347
+ "space",
94348
+ "nothing"
94349
+ ] },
94350
+ markerFont: { type: "string" },
94351
+ pictureBulletId: { type: "integer" },
94352
+ tabStopAt: { type: ["integer", "null"] }
94353
+ }, ["level"]))
94354
+ }, ["version", "levels"]),
94355
+ levels: arraySchema2({
94356
+ type: "integer",
94357
+ minimum: 0,
94358
+ maximum: 8
94359
+ })
94360
+ }, ["target", "style"]), listsMutateItemResultSchemaFor2("lists.applyStyle"), listsFailureSchemaFor2("lists.applyStyle"), objectSchema2({
94361
+ target: listItemAddressSchema2,
94362
+ startAt: {
94363
+ type: "integer",
94364
+ minimum: 1
94365
+ }
94366
+ }, ["target", "startAt"]), listsMutateItemResultSchemaFor2("lists.restartAt"), listsFailureSchemaFor2("lists.restartAt"), objectSchema2({
94367
+ target: listItemAddressSchema2,
94368
+ level: {
94369
+ type: "integer",
94370
+ minimum: 0,
94371
+ maximum: 8
94372
+ },
94373
+ numberStyle: { type: "string" }
94374
+ }, [
94375
+ "target",
94376
+ "level",
94377
+ "numberStyle"
94378
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelNumberStyle"), listsFailureSchemaFor2("lists.setLevelNumberStyle"), objectSchema2({
94379
+ target: listItemAddressSchema2,
94380
+ level: {
94381
+ type: "integer",
94382
+ minimum: 0,
94383
+ maximum: 8
94384
+ },
94385
+ text: { type: "string" }
94386
+ }, [
94387
+ "target",
94388
+ "level",
94389
+ "text"
94390
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelText"), listsFailureSchemaFor2("lists.setLevelText"), objectSchema2({
94391
+ target: listItemAddressSchema2,
94392
+ level: {
94393
+ type: "integer",
94394
+ minimum: 0,
94395
+ maximum: 8
94396
+ },
94397
+ startAt: {
94398
+ type: "integer",
94399
+ minimum: 1
94400
+ }
94401
+ }, [
94402
+ "target",
94403
+ "level",
94404
+ "startAt"
94405
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelStart"), listsFailureSchemaFor2("lists.setLevelStart"), objectSchema2({
94406
+ target: listItemAddressSchema2,
94407
+ level: {
94408
+ type: "integer",
94409
+ minimum: 0,
94410
+ maximum: 8
94411
+ },
94412
+ layout: objectSchema2({
94413
+ alignment: { enum: [
94414
+ "left",
94415
+ "center",
94416
+ "right"
94417
+ ] },
94418
+ alignedAt: { type: "integer" },
94419
+ textIndentAt: { type: "integer" },
94420
+ followCharacter: { enum: [
94421
+ "tab",
94422
+ "space",
94423
+ "nothing"
94424
+ ] },
94425
+ tabStopAt: { type: ["integer", "null"] }
94426
+ })
94427
+ }, [
94428
+ "target",
94429
+ "level",
94430
+ "layout"
94431
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelLayout"), listsFailureSchemaFor2("lists.setLevelLayout"), objectSchema2({
93627
94432
  text: { type: "string" },
93628
94433
  target: textAddressSchema2,
93629
94434
  parentCommentId: { type: "string" }
@@ -94037,18 +94842,18 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94037
94842
  },
94038
94843
  inferColumns: { type: "boolean" }
94039
94844
  }) }, { ...objectSchema2({
94040
- target: blockNodeAddressSchema2,
94845
+ target: tableAddressSchema2,
94041
94846
  nodeId: { type: "string" },
94042
94847
  destination: tableCreateLocationSchema2
94043
94848
  }, ["destination"]) }, { ...objectSchema2({
94044
- target: blockNodeAddressSchema2,
94849
+ target: tableAddressSchema2,
94045
94850
  nodeId: { type: "string" },
94046
94851
  atRowIndex: {
94047
94852
  type: "integer",
94048
94853
  minimum: 1
94049
94854
  }
94050
94855
  }, ["atRowIndex"]) }, { ...objectSchema2({
94051
- target: blockNodeAddressSchema2,
94856
+ target: tableAddressSchema2,
94052
94857
  nodeId: { type: "string" },
94053
94858
  delimiter: { enum: [
94054
94859
  "tab",
@@ -94056,7 +94861,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94056
94861
  "paragraph"
94057
94862
  ] }
94058
94863
  }) }, { ...objectSchema2({
94059
- target: blockNodeAddressSchema2,
94864
+ target: tableAddressSchema2,
94060
94865
  nodeId: { type: "string" },
94061
94866
  preferredWidth: { type: "number" },
94062
94867
  alignment: { enum: [
@@ -94071,38 +94876,13 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94071
94876
  "fitWindow"
94072
94877
  ] },
94073
94878
  tableDirection: { enum: ["ltr", "rtl"] }
94074
- }) }, { ...objectSchema2({
94075
- target: blockNodeAddressSchema2,
94076
- nodeId: { type: "string" },
94077
- tableTarget: blockNodeAddressSchema2,
94078
- tableNodeId: { type: "string" },
94079
- rowIndex: {
94080
- type: "integer",
94081
- minimum: 0
94082
- },
94879
+ }) }, rowOperationInputSchema2({
94083
94880
  position: { enum: ["above", "below"] },
94084
94881
  count: {
94085
94882
  type: "integer",
94086
94883
  minimum: 1
94087
94884
  }
94088
- }, ["position"]) }, { ...objectSchema2({
94089
- target: blockNodeAddressSchema2,
94090
- nodeId: { type: "string" },
94091
- tableTarget: blockNodeAddressSchema2,
94092
- tableNodeId: { type: "string" },
94093
- rowIndex: {
94094
- type: "integer",
94095
- minimum: 0
94096
- }
94097
- }) }, { ...objectSchema2({
94098
- target: blockNodeAddressSchema2,
94099
- nodeId: { type: "string" },
94100
- tableTarget: blockNodeAddressSchema2,
94101
- tableNodeId: { type: "string" },
94102
- rowIndex: {
94103
- type: "integer",
94104
- minimum: 0
94105
- },
94885
+ }, ["position"]), rowOperationInputSchema2({}), rowOperationInputSchema2({
94106
94886
  heightPt: {
94107
94887
  type: "number",
94108
94888
  exclusiveMinimum: 0
@@ -94112,20 +94892,12 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94112
94892
  "exact",
94113
94893
  "auto"
94114
94894
  ] }
94115
- }, ["heightPt", "rule"]) }, { ...objectSchema2({
94116
- target: blockNodeAddressSchema2,
94117
- nodeId: { type: "string" },
94118
- tableTarget: blockNodeAddressSchema2,
94119
- tableNodeId: { type: "string" },
94120
- rowIndex: {
94121
- type: "integer",
94122
- minimum: 0
94123
- },
94895
+ }, ["heightPt", "rule"]), rowOperationInputSchema2({
94124
94896
  allowBreakAcrossPages: { type: "boolean" },
94125
94897
  repeatHeader: { type: "boolean" }
94126
- }) }, { ...objectSchema2({
94127
- tableTarget: blockNodeAddressSchema2,
94128
- tableNodeId: { type: "string" },
94898
+ }), { ...objectSchema2({
94899
+ target: tableAddressSchema2,
94900
+ nodeId: { type: "string" },
94129
94901
  columnIndex: {
94130
94902
  type: "integer",
94131
94903
  minimum: 0
@@ -94136,15 +94908,15 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94136
94908
  minimum: 1
94137
94909
  }
94138
94910
  }, ["columnIndex", "position"]) }, { ...objectSchema2({
94139
- tableTarget: blockNodeAddressSchema2,
94140
- tableNodeId: { type: "string" },
94911
+ target: tableAddressSchema2,
94912
+ nodeId: { type: "string" },
94141
94913
  columnIndex: {
94142
94914
  type: "integer",
94143
94915
  minimum: 0
94144
94916
  }
94145
94917
  }, ["columnIndex"]) }, { ...objectSchema2({
94146
- tableTarget: blockNodeAddressSchema2,
94147
- tableNodeId: { type: "string" },
94918
+ target: tableAddressSchema2,
94919
+ nodeId: { type: "string" },
94148
94920
  columnIndex: {
94149
94921
  type: "integer",
94150
94922
  minimum: 0
@@ -94154,7 +94926,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94154
94926
  exclusiveMinimum: 0
94155
94927
  }
94156
94928
  }, ["columnIndex", "widthPt"]) }, { ...objectSchema2({
94157
- target: blockNodeAddressSchema2,
94929
+ target: tableAddressSchema2,
94158
94930
  nodeId: { type: "string" },
94159
94931
  columnRange: objectSchema2({
94160
94932
  start: {
@@ -94167,15 +94939,15 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94167
94939
  }
94168
94940
  }, ["start", "end"])
94169
94941
  }) }, { ...objectSchema2({
94170
- target: blockNodeAddressSchema2,
94942
+ target: tableCellAddressSchema2,
94171
94943
  nodeId: { type: "string" },
94172
94944
  mode: { enum: ["shiftRight", "shiftDown"] }
94173
94945
  }, ["mode"]) }, { ...objectSchema2({
94174
- target: blockNodeAddressSchema2,
94946
+ target: tableCellAddressSchema2,
94175
94947
  nodeId: { type: "string" },
94176
94948
  mode: { enum: ["shiftLeft", "shiftUp"] }
94177
94949
  }, ["mode"]) }, { ...objectSchema2({
94178
- target: blockNodeAddressSchema2,
94950
+ target: tableCellAddressSchema2,
94179
94951
  nodeId: { type: "string" },
94180
94952
  rows: {
94181
94953
  type: "integer",
@@ -94186,7 +94958,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94186
94958
  minimum: 1
94187
94959
  }
94188
94960
  }, ["rows", "columns"]) }, { ...objectSchema2({
94189
- target: blockNodeAddressSchema2,
94961
+ target: tableCellAddressSchema2,
94190
94962
  nodeId: { type: "string" },
94191
94963
  preferredWidthPt: { type: "number" },
94192
94964
  verticalAlign: { enum: [
@@ -94197,7 +94969,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94197
94969
  wrapText: { type: "boolean" },
94198
94970
  fitText: { type: "boolean" }
94199
94971
  }) }, { ...objectSchema2({
94200
- target: blockNodeAddressSchema2,
94972
+ target: tableAddressSchema2,
94201
94973
  nodeId: { type: "string" },
94202
94974
  keys: arraySchema2(objectSchema2({
94203
94975
  columnIndex: {
@@ -94216,16 +94988,16 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94216
94988
  "type"
94217
94989
  ]))
94218
94990
  }, ["keys"]) }, { ...objectSchema2({
94219
- target: blockNodeAddressSchema2,
94991
+ target: tableAddressSchema2,
94220
94992
  nodeId: { type: "string" },
94221
94993
  title: { type: "string" },
94222
94994
  description: { type: "string" }
94223
94995
  }) }, { ...objectSchema2({
94224
- target: blockNodeAddressSchema2,
94996
+ target: tableAddressSchema2,
94225
94997
  nodeId: { type: "string" },
94226
94998
  styleId: { type: "string" }
94227
94999
  }, ["styleId"]) }, { ...objectSchema2({
94228
- target: blockNodeAddressSchema2,
95000
+ target: tableAddressSchema2,
94229
95001
  nodeId: { type: "string" },
94230
95002
  flag: { enum: [
94231
95003
  "headerRow",
@@ -94237,7 +95009,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94237
95009
  ] },
94238
95010
  enabled: { type: "boolean" }
94239
95011
  }, ["flag", "enabled"]) }, { ...objectSchema2({
94240
- target: blockNodeAddressSchema2,
95012
+ target: tableOrCellAddressSchema2,
94241
95013
  nodeId: { type: "string" },
94242
95014
  edge: { enum: [
94243
95015
  "top",
@@ -94264,7 +95036,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94264
95036
  "lineWeightPt",
94265
95037
  "color"
94266
95038
  ]) }, { ...objectSchema2({
94267
- target: blockNodeAddressSchema2,
95039
+ target: tableOrCellAddressSchema2,
94268
95040
  nodeId: { type: "string" },
94269
95041
  edge: { enum: [
94270
95042
  "top",
@@ -94277,7 +95049,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94277
95049
  "diagonalUp"
94278
95050
  ] }
94279
95051
  }, ["edge"]) }, { ...objectSchema2({
94280
- target: blockNodeAddressSchema2,
95052
+ target: tableAddressSchema2,
94281
95053
  nodeId: { type: "string" },
94282
95054
  preset: { enum: [
94283
95055
  "box",
@@ -94287,14 +95059,14 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94287
95059
  "custom"
94288
95060
  ] }
94289
95061
  }, ["preset"]) }, { ...objectSchema2({
94290
- target: blockNodeAddressSchema2,
95062
+ target: tableOrCellAddressSchema2,
94291
95063
  nodeId: { type: "string" },
94292
95064
  color: {
94293
95065
  type: "string",
94294
95066
  pattern: "^([0-9A-Fa-f]{6}|auto)$"
94295
95067
  }
94296
95068
  }, ["color"]) }, { ...objectSchema2({
94297
- target: blockNodeAddressSchema2,
95069
+ target: tableAddressSchema2,
94298
95070
  nodeId: { type: "string" },
94299
95071
  topPt: {
94300
95072
  type: "number",
@@ -94318,7 +95090,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94318
95090
  "bottomPt",
94319
95091
  "leftPt"
94320
95092
  ]) }, { ...objectSchema2({
94321
- target: blockNodeAddressSchema2,
95093
+ target: tableCellAddressSchema2,
94322
95094
  nodeId: { type: "string" },
94323
95095
  topPt: {
94324
95096
  type: "number",
@@ -94342,7 +95114,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94342
95114
  "bottomPt",
94343
95115
  "leftPt"
94344
95116
  ]) }, { ...objectSchema2({
94345
- target: blockNodeAddressSchema2,
95117
+ target: tableAddressSchema2,
94346
95118
  nodeId: { type: "string" },
94347
95119
  spacingPt: {
94348
95120
  type: "number",
@@ -94350,7 +95122,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94350
95122
  }
94351
95123
  }, ["spacingPt"]) }, objectSchema2({
94352
95124
  nodeId: { type: "string" },
94353
- address: blockNodeAddressSchema2,
95125
+ address: tableAddressSchema2,
94354
95126
  rows: {
94355
95127
  type: "integer",
94356
95128
  minimum: 0
@@ -94365,7 +95137,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94365
95137
  "rows",
94366
95138
  "columns"
94367
95139
  ]), { ...objectSchema2({
94368
- target: blockNodeAddressSchema2,
95140
+ target: tableAddressSchema2,
94369
95141
  nodeId: { type: "string" },
94370
95142
  rowIndex: {
94371
95143
  type: "integer",
@@ -94376,7 +95148,8 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94376
95148
  minimum: 0
94377
95149
  }
94378
95150
  }) }, objectSchema2({
94379
- tableNodeId: { type: "string" },
95151
+ nodeId: { type: "string" },
95152
+ address: tableAddressSchema2,
94380
95153
  cells: {
94381
95154
  type: "array",
94382
95155
  items: objectSchema2({
@@ -94405,8 +95178,13 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94405
95178
  "rowspan"
94406
95179
  ])
94407
95180
  }
94408
- }, ["tableNodeId", "cells"]), objectSchema2({
95181
+ }, [
95182
+ "nodeId",
95183
+ "address",
95184
+ "cells"
95185
+ ]), objectSchema2({
94409
95186
  nodeId: { type: "string" },
95187
+ address: tableAddressSchema2,
94410
95188
  styleId: { type: "string" },
94411
95189
  alignment: { enum: [
94412
95190
  "left",
@@ -94428,7 +95206,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
94428
95206
  bandedRows: { type: "boolean" },
94429
95207
  bandedColumns: { type: "boolean" }
94430
95208
  })
94431
- }, ["nodeId"]), objectSchema2({
95209
+ }, ["nodeId", "address"]), objectSchema2({
94432
95210
  explicitDefaultStyleId: { type: ["string", "null"] },
94433
95211
  effectiveDefaultStyleId: { type: ["string", "null"] },
94434
95212
  effectiveDefaultSource: { type: "string" },
@@ -144352,7 +145130,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
144352
145130
  init_remark_gfm_z_sDF4ss_es();
144353
145131
  });
144354
145132
 
144355
- // ../../packages/superdoc/dist/chunks/src-B0uLvfdR.es.js
145133
+ // ../../packages/superdoc/dist/chunks/src-CZJm5ZTP.es.js
144356
145134
  function deleteProps(obj, propOrProps) {
144357
145135
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
144358
145136
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -144437,6 +145215,90 @@ function getSuperdocVersion() {
144437
145215
  return "unknown";
144438
145216
  }
144439
145217
  }
145218
+ function getPreservedSelection(state) {
145219
+ return CustomSelectionPluginKey.getState(state)?.preservedSelection ?? null;
145220
+ }
145221
+ function createSelectionTrackingBookmark(selection) {
145222
+ if (selection instanceof TextSelection2 && !selection.empty)
145223
+ return new InclusiveTextSelectionBookmark(selection.anchor, selection.head);
145224
+ return selection.getBookmark();
145225
+ }
145226
+ function createSelectionHandlePlugin() {
145227
+ return new Plugin({
145228
+ key: SelectionHandlePluginKey,
145229
+ state: {
145230
+ init() {
145231
+ return { entries: /* @__PURE__ */ new Map };
145232
+ },
145233
+ apply(tr, prev) {
145234
+ const meta2 = tr.getMeta(SelectionHandlePluginKey);
145235
+ let entries = prev.entries;
145236
+ if (tr.docChanged && entries.size > 0) {
145237
+ const next2 = /* @__PURE__ */ new Map;
145238
+ for (const [id2, entry] of entries)
145239
+ next2.set(id2, {
145240
+ ...entry,
145241
+ bookmark: entry.bookmark.map(tr.mapping)
145242
+ });
145243
+ entries = next2;
145244
+ }
145245
+ if (meta2?.action === "capture") {
145246
+ if (entries === prev.entries)
145247
+ entries = new Map(entries);
145248
+ entries.set(meta2.entry.id, meta2.entry);
145249
+ } else if (meta2?.action === "release") {
145250
+ if (entries.has(meta2.id)) {
145251
+ if (entries === prev.entries)
145252
+ entries = new Map(entries);
145253
+ entries.delete(meta2.id);
145254
+ }
145255
+ }
145256
+ return entries === prev.entries ? prev : { entries };
145257
+ }
145258
+ }
145259
+ });
145260
+ }
145261
+ function captureSelectionHandle(owner, selection, surface) {
145262
+ const id2 = nextHandleId++;
145263
+ const bookmark = createSelectionTrackingBookmark(selection);
145264
+ const wasNonEmpty = !selection.empty;
145265
+ const entry = {
145266
+ id: id2,
145267
+ bookmark,
145268
+ wasNonEmpty
145269
+ };
145270
+ const tr = owner.state.tr.setMeta(SelectionHandlePluginKey, {
145271
+ action: "capture",
145272
+ entry
145273
+ });
145274
+ owner.dispatch(tr);
145275
+ return {
145276
+ id: id2,
145277
+ surface,
145278
+ wasNonEmpty,
145279
+ _owner: owner
145280
+ };
145281
+ }
145282
+ function resolveHandleToSelection(handle3) {
145283
+ const { state } = handle3._owner;
145284
+ const pluginState = SelectionHandlePluginKey.getState(state);
145285
+ if (!pluginState)
145286
+ return null;
145287
+ const entry = pluginState.entries.get(handle3.id);
145288
+ if (!entry)
145289
+ return null;
145290
+ const resolved = entry.bookmark.resolve(state.doc);
145291
+ if (entry.wasNonEmpty && resolved.empty)
145292
+ return null;
145293
+ return resolved;
145294
+ }
145295
+ function releaseSelectionHandle(handle3) {
145296
+ const { state, dispatch } = handle3._owner;
145297
+ dispatch(state.tr.setMeta(SelectionHandlePluginKey, {
145298
+ action: "release",
145299
+ id: handle3.id
145300
+ }));
145301
+ }
144440
145302
  function getFocusMeta(tr) {
144441
145303
  return tr.getMeta(CustomSelectionPluginKey);
144442
145304
  }
@@ -144449,14 +145311,13 @@ function getFocusState(state) {
144449
145311
  function mapPreservedSelection(selection, tr) {
144450
145312
  if (!selection || !tr.docChanged)
144451
145313
  return selection;
144452
- if (typeof selection.from !== "number" || typeof selection.to !== "number")
144453
- return null;
144454
- const from$1 = tr.mapping.map(selection.from, -1);
144455
- const to = tr.mapping.map(selection.to, 1);
144456
- if (from$1 >= to)
145314
+ if (typeof selection.getBookmark !== "function")
144457
145315
  return null;
144458
145316
  try {
144459
- return TextSelection2.create(tr.doc, from$1, to);
145317
+ const resolved = createSelectionTrackingBookmark(selection).map(tr.mapping).resolve(tr.doc);
145318
+ if (!selection.empty && resolved.empty)
145319
+ return null;
145320
+ return resolved;
144460
145321
  } catch {
144461
145322
  return null;
144462
145323
  }
@@ -154693,7 +155554,7 @@ function validateInsertionContext(editor, index2, step3, stepIndex, anchorBlockI
154693
155554
  function isV3Ref(payload) {
154694
155555
  return typeof payload === "object" && payload !== null && "v" in payload && payload.v === 3;
154695
155556
  }
154696
- function resolveAbsoluteRange(editor, candidate, from$1, to, stepId) {
155557
+ function resolveAbsoluteRange$1(editor, candidate, from$1, to, stepId) {
154697
155558
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
154698
155559
  start: from$1,
154699
155560
  end: to
@@ -154781,7 +155642,7 @@ function coalesceBlockRanges(stepId, blockId, ranges) {
154781
155642
  };
154782
155643
  }
154783
155644
  function buildRangeTarget(editor, step3, addr, candidate) {
154784
- const abs$1 = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step3.id);
155645
+ const abs$1 = resolveAbsoluteRange$1(editor, candidate, addr.from, addr.to, step3.id);
154785
155646
  const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to) : undefined;
154786
155647
  return {
154787
155648
  kind: "range",
@@ -154806,7 +155667,7 @@ function buildSpanTarget(editor, index2, step3, segments, matchId) {
154806
155667
  const candidate = index2.candidates.find((c) => c.nodeId === seg.blockId);
154807
155668
  if (!candidate)
154808
155669
  throw planError("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step3.id);
154809
- const abs$1 = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step3.id);
155670
+ const abs$1 = resolveAbsoluteRange$1(editor, candidate, seg.from, seg.to, step3.id);
154810
155671
  compiledSegments.push({
154811
155672
  blockId: seg.blockId,
154812
155673
  from: seg.from,
@@ -160360,6 +161221,745 @@ function blocksDeleteRangeWrapper(editor, input2, options) {
160360
161221
  dryRun: false
160361
161222
  };
160362
161223
  }
161224
+ function findLevelElement(abstract, ilvl) {
161225
+ const ilvlStr = String(ilvl);
161226
+ return abstract.elements?.find((el) => el.name === "w:lvl" && el.attributes?.["w:ilvl"] === ilvlStr);
161227
+ }
161228
+ function readChildAttr(parent, elementName) {
161229
+ return parent.elements?.find((el) => el.name === elementName)?.attributes?.["w:val"];
161230
+ }
161231
+ function setChildAttr(parent, elementName, value) {
161232
+ if (!parent.elements)
161233
+ parent.elements = [];
161234
+ const existing = parent.elements.find((el) => el.name === elementName);
161235
+ if (existing) {
161236
+ if (existing.attributes?.["w:val"] === value)
161237
+ return false;
161238
+ if (!existing.attributes)
161239
+ existing.attributes = {};
161240
+ existing.attributes["w:val"] = value;
161241
+ return true;
161242
+ }
161243
+ parent.elements.push({
161244
+ type: "element",
161245
+ name: elementName,
161246
+ attributes: { "w:val": value }
161247
+ });
161248
+ return true;
161249
+ }
161250
+ function findOrCreateChild(parent, elementName) {
161251
+ if (!parent.elements)
161252
+ parent.elements = [];
161253
+ let child = parent.elements.find((el) => el.name === elementName);
161254
+ if (!child) {
161255
+ child = {
161256
+ type: "element",
161257
+ name: elementName,
161258
+ elements: []
161259
+ };
161260
+ parent.elements.push(child);
161261
+ }
161262
+ if (!child.elements)
161263
+ child.elements = [];
161264
+ return child;
161265
+ }
161266
+ function resolveAbstractLevel(editor, abstractNumId, ilvl) {
161267
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161268
+ if (!abstract)
161269
+ return null;
161270
+ const lvlEl = findLevelElement(abstract, ilvl);
161271
+ if (!lvlEl)
161272
+ return null;
161273
+ return {
161274
+ abstract,
161275
+ lvlEl
161276
+ };
161277
+ }
161278
+ function hasLevel(editor, abstractNumId, ilvl) {
161279
+ return resolveAbstractLevel(editor, abstractNumId, ilvl) != null;
161280
+ }
161281
+ function readLevelProperties(lvlEl, ilvl) {
161282
+ const props = { level: ilvl };
161283
+ const numFmt = readChildAttr(lvlEl, "w:numFmt");
161284
+ if (numFmt != null)
161285
+ props.numFmt = numFmt;
161286
+ const lvlText = readChildAttr(lvlEl, "w:lvlText");
161287
+ if (lvlText != null)
161288
+ props.lvlText = lvlText;
161289
+ const startVal = readChildAttr(lvlEl, "w:start");
161290
+ if (startVal != null)
161291
+ props.start = Number(startVal);
161292
+ const alignment$1 = readChildAttr(lvlEl, "w:lvlJc");
161293
+ if (alignment$1 != null)
161294
+ props.alignment = alignment$1;
161295
+ const suff = readChildAttr(lvlEl, "w:suff");
161296
+ if (suff != null)
161297
+ props.trailingCharacter = suff;
161298
+ const picBulletId = readChildAttr(lvlEl, "w:lvlPicBulletId");
161299
+ if (picBulletId != null)
161300
+ props.pictureBulletId = Number(picBulletId);
161301
+ const pPr = lvlEl.elements?.find((el) => el.name === "w:pPr");
161302
+ const ind = pPr?.elements?.find((el) => el.name === "w:ind");
161303
+ if (ind?.attributes) {
161304
+ const indents = {};
161305
+ if (ind.attributes["w:left"] != null)
161306
+ indents.left = Number(ind.attributes["w:left"]);
161307
+ if (ind.attributes["w:hanging"] != null)
161308
+ indents.hanging = Number(ind.attributes["w:hanging"]);
161309
+ if (ind.attributes["w:firstLine"] != null)
161310
+ indents.firstLine = Number(ind.attributes["w:firstLine"]);
161311
+ if (Object.keys(indents).length > 0)
161312
+ props.indents = indents;
161313
+ }
161314
+ const tabStopVal = readLevelTabStop(pPr);
161315
+ if (tabStopVal != null)
161316
+ props.tabStopAt = tabStopVal;
161317
+ const rFonts = lvlEl.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rFonts");
161318
+ if (rFonts?.attributes?.["w:ascii"])
161319
+ props.markerFont = rFonts.attributes["w:ascii"];
161320
+ return props;
161321
+ }
161322
+ function readLevelTabStop(pPr) {
161323
+ if (!pPr?.elements)
161324
+ return;
161325
+ const tabs = pPr.elements.find((el) => el.name === "w:tabs");
161326
+ if (!tabs?.elements)
161327
+ return;
161328
+ const tab = tabs.elements.find((el) => el.name === "w:tab");
161329
+ if (!tab?.attributes?.["w:pos"])
161330
+ return;
161331
+ return Number(tab.attributes["w:pos"]);
161332
+ }
161333
+ function mutateLevelTabStop(lvlEl, value) {
161334
+ const pPr = findOrCreateChild(lvlEl, "w:pPr");
161335
+ if (value === null) {
161336
+ const tabsIdx = pPr.elements.findIndex((el) => el.name === "w:tabs");
161337
+ if (tabsIdx === -1)
161338
+ return false;
161339
+ pPr.elements.splice(tabsIdx, 1);
161340
+ return true;
161341
+ }
161342
+ const tabs = findOrCreateChild(pPr, "w:tabs");
161343
+ const existing = tabs.elements.find((el) => el.name === "w:tab");
161344
+ const posStr = String(value);
161345
+ if (existing) {
161346
+ if (existing.attributes?.["w:pos"] === posStr && existing.attributes?.["w:val"] === "num")
161347
+ return false;
161348
+ existing.attributes = {
161349
+ ...existing.attributes,
161350
+ "w:val": "num",
161351
+ "w:pos": posStr
161352
+ };
161353
+ return true;
161354
+ }
161355
+ tabs.elements.push({
161356
+ type: "element",
161357
+ name: "w:tab",
161358
+ attributes: {
161359
+ "w:val": "num",
161360
+ "w:pos": posStr
161361
+ }
161362
+ });
161363
+ return true;
161364
+ }
161365
+ function setLevelTabStop(editor, abstractNumId, ilvl, value) {
161366
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161367
+ if (!resolved)
161368
+ return false;
161369
+ return mutateLevelTabStop(resolved.lvlEl, value);
161370
+ }
161371
+ function clearPictureBulletId(lvlEl) {
161372
+ if (!lvlEl.elements)
161373
+ return false;
161374
+ const idx = lvlEl.elements.findIndex((el) => el.name === "w:lvlPicBulletId");
161375
+ if (idx === -1)
161376
+ return false;
161377
+ lvlEl.elements.splice(idx, 1);
161378
+ return true;
161379
+ }
161380
+ function mutateLevelNumberStyle(lvlEl, numFmt) {
161381
+ let changed = setChildAttr(lvlEl, "w:numFmt", numFmt);
161382
+ changed = clearPictureBulletId(lvlEl) || changed;
161383
+ return changed;
161384
+ }
161385
+ function setLevelNumberStyle(editor, abstractNumId, ilvl, numFmt) {
161386
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161387
+ if (!resolved)
161388
+ return false;
161389
+ return mutateLevelNumberStyle(resolved.lvlEl, numFmt);
161390
+ }
161391
+ function setLevelText(editor, abstractNumId, ilvl, text5) {
161392
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161393
+ if (!resolved)
161394
+ return false;
161395
+ return setChildAttr(resolved.lvlEl, "w:lvlText", text5);
161396
+ }
161397
+ function setLevelStart(editor, abstractNumId, ilvl, start$1) {
161398
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161399
+ if (!resolved)
161400
+ return false;
161401
+ return setChildAttr(resolved.lvlEl, "w:start", String(start$1));
161402
+ }
161403
+ function applyLevelPropertiesToElement(lvlEl, entry) {
161404
+ let changed = false;
161405
+ if (entry.numFmt != null || entry.lvlText != null) {
161406
+ const fmtParams = {};
161407
+ if (entry.numFmt != null)
161408
+ fmtParams.numFmt = entry.numFmt;
161409
+ if (entry.lvlText != null)
161410
+ fmtParams.lvlText = entry.lvlText;
161411
+ if (entry.start != null)
161412
+ fmtParams.start = entry.start;
161413
+ if (fmtParams.numFmt != null && fmtParams.lvlText != null)
161414
+ changed = mutateLevelNumberingFormat(lvlEl, fmtParams) || changed;
161415
+ else {
161416
+ if (fmtParams.numFmt != null)
161417
+ changed = setChildAttr(lvlEl, "w:numFmt", fmtParams.numFmt) || changed;
161418
+ if (fmtParams.lvlText != null)
161419
+ changed = setChildAttr(lvlEl, "w:lvlText", fmtParams.lvlText) || changed;
161420
+ if (fmtParams.start != null)
161421
+ changed = setChildAttr(lvlEl, "w:start", String(fmtParams.start)) || changed;
161422
+ }
161423
+ } else if (entry.start != null)
161424
+ changed = setChildAttr(lvlEl, "w:start", String(entry.start)) || changed;
161425
+ if (entry.alignment != null)
161426
+ changed = mutateLevelAlignment(lvlEl, entry.alignment) || changed;
161427
+ if (entry.indents != null)
161428
+ changed = mutateLevelIndents(lvlEl, entry.indents) || changed;
161429
+ if (entry.trailingCharacter != null)
161430
+ changed = mutateLevelTrailingCharacter(lvlEl, entry.trailingCharacter) || changed;
161431
+ if (entry.markerFont != null)
161432
+ changed = mutateLevelMarkerFont(lvlEl, entry.markerFont) || changed;
161433
+ if (entry.pictureBulletId != null)
161434
+ changed = mutateLevelPictureBulletId(lvlEl, entry.pictureBulletId) || changed;
161435
+ if (entry.tabStopAt !== undefined)
161436
+ changed = mutateLevelTabStop(lvlEl, entry.tabStopAt) || changed;
161437
+ return changed;
161438
+ }
161439
+ function mutateLevelNumberingFormat(lvlEl, { numFmt, lvlText, start: start$1 }) {
161440
+ let changed = false;
161441
+ changed = setChildAttr(lvlEl, "w:numFmt", numFmt) || changed;
161442
+ changed = setChildAttr(lvlEl, "w:lvlText", lvlText) || changed;
161443
+ if (start$1 != null)
161444
+ changed = setChildAttr(lvlEl, "w:start", String(start$1)) || changed;
161445
+ return changed;
161446
+ }
161447
+ function mutateLevelBulletMarker(lvlEl, markerText) {
161448
+ let changed = false;
161449
+ changed = setChildAttr(lvlEl, "w:numFmt", "bullet") || changed;
161450
+ changed = setChildAttr(lvlEl, "w:lvlText", markerText) || changed;
161451
+ return changed;
161452
+ }
161453
+ function mutateLevelPictureBulletId(lvlEl, pictureBulletId) {
161454
+ return setChildAttr(lvlEl, "w:lvlPicBulletId", String(pictureBulletId));
161455
+ }
161456
+ function mutateLevelAlignment(lvlEl, alignment$1) {
161457
+ return setChildAttr(lvlEl, "w:lvlJc", alignment$1);
161458
+ }
161459
+ function mutateLevelIndents(lvlEl, indents) {
161460
+ const ind = findOrCreateChild(findOrCreateChild(lvlEl, "w:pPr"), "w:ind");
161461
+ if (!ind.attributes)
161462
+ ind.attributes = {};
161463
+ let changed = false;
161464
+ if (indents.left != null) {
161465
+ const newVal = String(indents.left);
161466
+ if (ind.attributes["w:left"] !== newVal) {
161467
+ ind.attributes["w:left"] = newVal;
161468
+ changed = true;
161469
+ }
161470
+ }
161471
+ if (indents.hanging != null) {
161472
+ const newVal = String(indents.hanging);
161473
+ if (ind.attributes["w:hanging"] !== newVal) {
161474
+ ind.attributes["w:hanging"] = newVal;
161475
+ changed = true;
161476
+ }
161477
+ if (ind.attributes["w:firstLine"] != null) {
161478
+ delete ind.attributes["w:firstLine"];
161479
+ changed = true;
161480
+ }
161481
+ }
161482
+ if (indents.firstLine != null) {
161483
+ const newVal = String(indents.firstLine);
161484
+ if (ind.attributes["w:firstLine"] !== newVal) {
161485
+ ind.attributes["w:firstLine"] = newVal;
161486
+ changed = true;
161487
+ }
161488
+ if (ind.attributes["w:hanging"] != null) {
161489
+ delete ind.attributes["w:hanging"];
161490
+ changed = true;
161491
+ }
161492
+ }
161493
+ return changed;
161494
+ }
161495
+ function mutateLevelTrailingCharacter(lvlEl, trailingCharacter) {
161496
+ return setChildAttr(lvlEl, "w:suff", trailingCharacter);
161497
+ }
161498
+ function mutateLevelMarkerFont(lvlEl, fontFamily) {
161499
+ const rPr = findOrCreateChild(lvlEl, "w:rPr");
161500
+ const rFonts = rPr.elements.find((el) => el.name === "w:rFonts");
161501
+ if (rFonts) {
161502
+ const attrs = rFonts.attributes || {};
161503
+ if (attrs["w:ascii"] === fontFamily && attrs["w:hAnsi"] === fontFamily && attrs["w:eastAsia"] === fontFamily && attrs["w:cs"] === fontFamily)
161504
+ return false;
161505
+ rFonts.attributes = {
161506
+ ...rFonts.attributes,
161507
+ "w:ascii": fontFamily,
161508
+ "w:hAnsi": fontFamily,
161509
+ "w:eastAsia": fontFamily,
161510
+ "w:cs": fontFamily
161511
+ };
161512
+ return true;
161513
+ }
161514
+ rPr.elements.push({
161515
+ type: "element",
161516
+ name: "w:rFonts",
161517
+ attributes: {
161518
+ "w:ascii": fontFamily,
161519
+ "w:hAnsi": fontFamily,
161520
+ "w:eastAsia": fontFamily,
161521
+ "w:cs": fontFamily
161522
+ }
161523
+ });
161524
+ return true;
161525
+ }
161526
+ function setLevelNumberingFormat(editor, abstractNumId, ilvl, params$1) {
161527
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161528
+ if (!resolved)
161529
+ return false;
161530
+ return mutateLevelNumberingFormat(resolved.lvlEl, params$1);
161531
+ }
161532
+ function setLevelBulletMarker(editor, abstractNumId, ilvl, markerText) {
161533
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161534
+ if (!resolved)
161535
+ return false;
161536
+ return mutateLevelBulletMarker(resolved.lvlEl, markerText);
161537
+ }
161538
+ function setLevelPictureBulletId(editor, abstractNumId, ilvl, pictureBulletId) {
161539
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161540
+ if (!resolved)
161541
+ return false;
161542
+ return mutateLevelPictureBulletId(resolved.lvlEl, pictureBulletId);
161543
+ }
161544
+ function setLevelAlignment(editor, abstractNumId, ilvl, alignment$1) {
161545
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161546
+ if (!resolved)
161547
+ return false;
161548
+ return mutateLevelAlignment(resolved.lvlEl, alignment$1);
161549
+ }
161550
+ function setLevelIndents(editor, abstractNumId, ilvl, indents) {
161551
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161552
+ if (!resolved)
161553
+ return false;
161554
+ return mutateLevelIndents(resolved.lvlEl, indents);
161555
+ }
161556
+ function setLevelTrailingCharacter(editor, abstractNumId, ilvl, trailingCharacter) {
161557
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161558
+ if (!resolved)
161559
+ return false;
161560
+ return mutateLevelTrailingCharacter(resolved.lvlEl, trailingCharacter);
161561
+ }
161562
+ function setLevelMarkerFont(editor, abstractNumId, ilvl, fontFamily) {
161563
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161564
+ if (!resolved)
161565
+ return false;
161566
+ return mutateLevelMarkerFont(resolved.lvlEl, fontFamily);
161567
+ }
161568
+ function hasLevelOverride$1(editor, numId, ilvl) {
161569
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161570
+ if (!numDef?.elements)
161571
+ return false;
161572
+ const ilvlStr = String(ilvl);
161573
+ return numDef.elements.some((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161574
+ }
161575
+ function clearLevelOverride(editor, numId, ilvl) {
161576
+ if (!hasLevelOverride$1(editor, numId, ilvl))
161577
+ return false;
161578
+ removeLvlOverride(editor.converter.numbering, numId, ilvl);
161579
+ return true;
161580
+ }
161581
+ function materializeLevelFormattingOverride(editor, abstractNumId, numId, ilvl) {
161582
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161583
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161584
+ if (!resolved || !numDef?.elements)
161585
+ return false;
161586
+ const ilvlStr = String(ilvl);
161587
+ const overrideIndex = numDef.elements.findIndex((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161588
+ if (overrideIndex === -1)
161589
+ return false;
161590
+ const overrideEl = numDef.elements[overrideIndex];
161591
+ if (!overrideEl?.elements)
161592
+ return false;
161593
+ const lvlIndex = overrideEl.elements.findIndex((el) => el.name === "w:lvl");
161594
+ if (lvlIndex === -1)
161595
+ return false;
161596
+ const lvlEl = overrideEl.elements[lvlIndex];
161597
+ const props = readLevelProperties(lvlEl, ilvl);
161598
+ const abstractChanged = applyLevelPropertiesToElement(resolved.lvlEl, props);
161599
+ const lvlRestartElements = lvlEl.elements?.filter((el) => el.name === "w:lvlRestart").map((el) => deepCloneElement(el)) ?? [];
161600
+ overrideEl.elements.splice(lvlIndex, 1);
161601
+ if (lvlRestartElements.length > 0)
161602
+ overrideEl.elements.push({
161603
+ type: "element",
161604
+ name: "w:lvl",
161605
+ attributes: { "w:ilvl": ilvlStr },
161606
+ elements: lvlRestartElements
161607
+ });
161608
+ let overrideChanged = true;
161609
+ if (overrideEl.elements.length === 0)
161610
+ numDef.elements.splice(overrideIndex, 1);
161611
+ return abstractChanged || overrideChanged;
161612
+ }
161613
+ function captureTemplate(editor, abstractNumId, levels) {
161614
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161615
+ if (!abstract?.elements)
161616
+ return null;
161617
+ const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161618
+ const captured = [];
161619
+ for (const lvlEl of lvlElements) {
161620
+ const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161621
+ if (levels && !levels.includes(ilvl))
161622
+ continue;
161623
+ captured.push(readLevelProperties(lvlEl, ilvl));
161624
+ }
161625
+ captured.sort((a2, b$1) => a2.level - b$1.level);
161626
+ return {
161627
+ version: 1,
161628
+ levels: captured
161629
+ };
161630
+ }
161631
+ function applyTemplateToAbstract(editor, abstractNumId, template, levels) {
161632
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161633
+ if (!abstract?.elements)
161634
+ return {
161635
+ changed: false,
161636
+ error: "ABSTRACT_NOT_FOUND"
161637
+ };
161638
+ const templateByLevel = /* @__PURE__ */ new Map;
161639
+ for (const entry of template.levels)
161640
+ templateByLevel.set(entry.level, entry);
161641
+ const targetLevels = levels ?? template.levels.map((l) => l.level);
161642
+ for (const ilvl of targetLevels)
161643
+ if (!templateByLevel.has(ilvl))
161644
+ return {
161645
+ changed: false,
161646
+ error: "LEVEL_NOT_IN_TEMPLATE"
161647
+ };
161648
+ for (const ilvl of targetLevels)
161649
+ if (!findLevelElement(abstract, ilvl))
161650
+ return {
161651
+ changed: false,
161652
+ error: "LEVEL_NOT_IN_ABSTRACT"
161653
+ };
161654
+ let anyChanged = false;
161655
+ for (const ilvl of targetLevels) {
161656
+ const entry = templateByLevel.get(ilvl);
161657
+ anyChanged = applyLevelPropertiesToElement(findLevelElement(abstract, ilvl), entry) || anyChanged;
161658
+ }
161659
+ return { changed: anyChanged };
161660
+ }
161661
+ function buildOrderedPresetTemplate(config2) {
161662
+ const levels = [];
161663
+ for (let ilvl = 0;ilvl <= 8; ilvl++)
161664
+ levels.push({
161665
+ level: ilvl,
161666
+ numFmt: config2.numFmt,
161667
+ lvlText: `%${ilvl + 1}${config2.lvlTextSuffix}`,
161668
+ start: 1,
161669
+ alignment: "left",
161670
+ indents: {
161671
+ left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161672
+ hanging: HANGING_INDENT_TWIPS
161673
+ }
161674
+ });
161675
+ return {
161676
+ version: 1,
161677
+ levels
161678
+ };
161679
+ }
161680
+ function buildBulletPresetTemplate(config2) {
161681
+ const levels = [];
161682
+ for (let ilvl = 0;ilvl <= 8; ilvl++)
161683
+ levels.push({
161684
+ level: ilvl,
161685
+ numFmt: "bullet",
161686
+ lvlText: config2.markerText,
161687
+ start: 1,
161688
+ alignment: "left",
161689
+ markerFont: config2.fontFamily,
161690
+ indents: {
161691
+ left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161692
+ hanging: HANGING_INDENT_TWIPS
161693
+ }
161694
+ });
161695
+ return {
161696
+ version: 1,
161697
+ levels
161698
+ };
161699
+ }
161700
+ function getPresetTemplate(presetId) {
161701
+ return PRESET_TEMPLATES[presetId];
161702
+ }
161703
+ function mutateLevelLayout(lvlEl, layout) {
161704
+ let changed = false;
161705
+ if (layout.alignment != null)
161706
+ changed = mutateLevelAlignment(lvlEl, layout.alignment) || changed;
161707
+ if (layout.followCharacter != null)
161708
+ changed = mutateLevelTrailingCharacter(lvlEl, layout.followCharacter) || changed;
161709
+ if (layout.tabStopAt !== undefined)
161710
+ changed = mutateLevelTabStop(lvlEl, layout.tabStopAt) || changed;
161711
+ const hasAlignedAt = layout.alignedAt != null;
161712
+ const hasTextIndentAt = layout.textIndentAt != null;
161713
+ if (hasAlignedAt || hasTextIndentAt) {
161714
+ const ind = lvlEl.elements?.find((el) => el.name === "w:pPr")?.elements?.find((el) => el.name === "w:ind");
161715
+ const existingLeft = ind?.attributes?.["w:left"] != null ? Number(ind.attributes["w:left"]) : undefined;
161716
+ const existingHanging = ind?.attributes?.["w:hanging"] != null ? Number(ind.attributes["w:hanging"]) : undefined;
161717
+ const existingFirstLine = ind?.attributes?.["w:firstLine"] != null ? Number(ind.attributes["w:firstLine"]) : undefined;
161718
+ let existingAlignedAt;
161719
+ if (existingLeft != null)
161720
+ if (existingHanging != null)
161721
+ existingAlignedAt = existingLeft - existingHanging;
161722
+ else if (existingFirstLine != null)
161723
+ existingAlignedAt = existingLeft + existingFirstLine;
161724
+ else
161725
+ existingAlignedAt = existingLeft;
161726
+ let newLeft, newHanging;
161727
+ if (hasAlignedAt && hasTextIndentAt) {
161728
+ newLeft = layout.textIndentAt;
161729
+ newHanging = layout.textIndentAt - layout.alignedAt;
161730
+ } else if (hasTextIndentAt) {
161731
+ newLeft = layout.textIndentAt;
161732
+ newHanging = existingAlignedAt != null ? layout.textIndentAt - existingAlignedAt : 0;
161733
+ } else if (hasAlignedAt) {
161734
+ if (existingLeft == null)
161735
+ return {
161736
+ changed,
161737
+ error: "INVALID_INPUT"
161738
+ };
161739
+ newLeft = existingLeft;
161740
+ newHanging = existingLeft - layout.alignedAt;
161741
+ }
161742
+ if (newLeft != null)
161743
+ changed = mutateLevelIndents(lvlEl, {
161744
+ left: newLeft,
161745
+ hanging: newHanging ?? 0
161746
+ }) || changed;
161747
+ }
161748
+ return { changed };
161749
+ }
161750
+ function setLevelLayout(editor, abstractNumId, ilvl, layout) {
161751
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161752
+ if (!resolved)
161753
+ return { changed: false };
161754
+ return mutateLevelLayout(resolved.lvlEl, layout);
161755
+ }
161756
+ function captureEffectiveStyle(editor, abstractNumId, numId, levels) {
161757
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161758
+ if (!abstract?.elements)
161759
+ return null;
161760
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161761
+ const overridesByLevel = buildOverrideMap(numDef);
161762
+ const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161763
+ const captured = [];
161764
+ for (const lvlEl of lvlElements) {
161765
+ const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161766
+ if (levels && !levels.includes(ilvl))
161767
+ continue;
161768
+ const baseProps = readLevelProperties(lvlEl, ilvl);
161769
+ const overrideLvl = overridesByLevel.get(ilvl);
161770
+ if (overrideLvl)
161771
+ mergeOverrideProps(baseProps, readLevelProperties(overrideLvl, ilvl));
161772
+ captured.push(baseProps);
161773
+ }
161774
+ captured.sort((a2, b$1) => a2.level - b$1.level);
161775
+ return {
161776
+ version: 1,
161777
+ levels: captured
161778
+ };
161779
+ }
161780
+ function buildOverrideMap(numDef) {
161781
+ const map$12 = /* @__PURE__ */ new Map;
161782
+ if (!numDef?.elements)
161783
+ return map$12;
161784
+ for (const el of numDef.elements) {
161785
+ if (el.name !== "w:lvlOverride")
161786
+ continue;
161787
+ const ilvl = Number(el.attributes?.["w:ilvl"]);
161788
+ const lvlChild = el.elements?.find((c) => c.name === "w:lvl");
161789
+ if (lvlChild)
161790
+ map$12.set(ilvl, lvlChild);
161791
+ }
161792
+ return map$12;
161793
+ }
161794
+ function mergeOverrideProps(base5, override) {
161795
+ if (override.numFmt != null)
161796
+ base5.numFmt = override.numFmt;
161797
+ if (override.lvlText != null)
161798
+ base5.lvlText = override.lvlText;
161799
+ if (override.start != null)
161800
+ base5.start = override.start;
161801
+ if (override.alignment != null)
161802
+ base5.alignment = override.alignment;
161803
+ if (override.indents != null)
161804
+ base5.indents = {
161805
+ ...base5.indents,
161806
+ ...override.indents
161807
+ };
161808
+ if (override.trailingCharacter != null)
161809
+ base5.trailingCharacter = override.trailingCharacter;
161810
+ if (override.markerFont != null)
161811
+ base5.markerFont = override.markerFont;
161812
+ if (override.pictureBulletId != null)
161813
+ base5.pictureBulletId = override.pictureBulletId;
161814
+ if (override.tabStopAt != null)
161815
+ base5.tabStopAt = override.tabStopAt;
161816
+ }
161817
+ function isAbstractShared(editor, abstractNumId, numId) {
161818
+ const definitions = editor.converter.numbering?.definitions;
161819
+ if (!definitions)
161820
+ return false;
161821
+ for (const [defNumId, numDef] of Object.entries(definitions)) {
161822
+ if (Number(defNumId) === numId)
161823
+ continue;
161824
+ if (!numDef?.elements)
161825
+ continue;
161826
+ const absEl = numDef.elements.find((el) => el.name === "w:abstractNumId");
161827
+ if (absEl && Number(absEl.attributes?.["w:val"]) === abstractNumId)
161828
+ return true;
161829
+ }
161830
+ return false;
161831
+ }
161832
+ function deepCloneElement(element3) {
161833
+ const clone = { ...element3 };
161834
+ if (element3.attributes)
161835
+ clone.attributes = { ...element3.attributes };
161836
+ if (element3.elements)
161837
+ clone.elements = element3.elements.map((child) => deepCloneElement(child));
161838
+ return clone;
161839
+ }
161840
+ function cloneAbstractDefinition(editor, originalAbstractNumId) {
161841
+ const numbering = editor.converter.numbering;
161842
+ const existingAbstractIds = Object.keys(numbering.abstracts).map(Number);
161843
+ const newAbstractNumId = existingAbstractIds.length > 0 ? Math.max(...existingAbstractIds) + 1 : 0;
161844
+ const original = numbering.abstracts[originalAbstractNumId];
161845
+ if (!original)
161846
+ throw new Error(`cloneAbstractDefinition: abstract ${originalAbstractNumId} not found.`);
161847
+ const cloned = deepCloneElement(original);
161848
+ cloned.attributes = {
161849
+ ...cloned.attributes,
161850
+ "w:abstractNumId": String(newAbstractNumId)
161851
+ };
161852
+ numbering.abstracts[newAbstractNumId] = cloned;
161853
+ return { newAbstractNumId };
161854
+ }
161855
+ function cloneAbstractIntoNum(editor, originalAbstractNumId, numId) {
161856
+ const numbering = editor.converter.numbering;
161857
+ const { newAbstractNumId } = cloneAbstractDefinition(editor, originalAbstractNumId);
161858
+ const numDef = numbering.definitions[numId];
161859
+ if (!numDef)
161860
+ throw new Error(`cloneAbstractIntoNum: num ${numId} not found.`);
161861
+ if (!numDef.elements)
161862
+ numDef.elements = [];
161863
+ const abstractNumIdEl = numDef.elements.find((el) => el.name === "w:abstractNumId");
161864
+ if (abstractNumIdEl)
161865
+ abstractNumIdEl.attributes = {
161866
+ ...abstractNumIdEl.attributes || {},
161867
+ "w:val": String(newAbstractNumId)
161868
+ };
161869
+ else
161870
+ numDef.elements.unshift({
161871
+ type: "element",
161872
+ name: "w:abstractNumId",
161873
+ attributes: { "w:val": String(newAbstractNumId) }
161874
+ });
161875
+ return { newAbstractNumId };
161876
+ }
161877
+ function copySequenceStateOverrides(editor, fromNumId, toNumId, levels) {
161878
+ if (fromNumId === toNumId)
161879
+ return false;
161880
+ const sourceNumDef = editor.converter.numbering?.definitions?.[fromNumId];
161881
+ const targetNumDef = editor.converter.numbering?.definitions?.[toNumId];
161882
+ if (!sourceNumDef?.elements || !targetNumDef)
161883
+ return false;
161884
+ if (!targetNumDef.elements)
161885
+ targetNumDef.elements = [];
161886
+ const levelSet = levels ? new Set(levels.map((level) => String(level))) : null;
161887
+ let changed = false;
161888
+ for (const sourceEl of sourceNumDef.elements) {
161889
+ if (sourceEl.name !== "w:lvlOverride")
161890
+ continue;
161891
+ const ilvl = sourceEl.attributes?.["w:ilvl"];
161892
+ if (ilvl == null)
161893
+ continue;
161894
+ if (levelSet && !levelSet.has(ilvl))
161895
+ continue;
161896
+ const nextElements = [];
161897
+ for (const child of sourceEl.elements ?? []) {
161898
+ if (child.name === "w:startOverride") {
161899
+ nextElements.push(deepCloneElement(child));
161900
+ continue;
161901
+ }
161902
+ if (child.name === "w:lvl") {
161903
+ const lvlRestartElements = child.elements?.filter((lvlChild) => lvlChild.name === "w:lvlRestart").map((lvlChild) => deepCloneElement(lvlChild)) ?? [];
161904
+ if (lvlRestartElements.length > 0)
161905
+ nextElements.push({
161906
+ type: "element",
161907
+ name: "w:lvl",
161908
+ attributes: {
161909
+ ...child.attributes || {},
161910
+ "w:ilvl": child.attributes?.["w:ilvl"] ?? ilvl
161911
+ },
161912
+ elements: lvlRestartElements
161913
+ });
161914
+ }
161915
+ }
161916
+ if (nextElements.length === 0)
161917
+ continue;
161918
+ const targetIndex = targetNumDef.elements.findIndex((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvl);
161919
+ const nextOverride = {
161920
+ type: "element",
161921
+ name: "w:lvlOverride",
161922
+ attributes: {
161923
+ ...sourceEl.attributes || {},
161924
+ "w:ilvl": ilvl
161925
+ },
161926
+ elements: nextElements
161927
+ };
161928
+ if (targetIndex === -1)
161929
+ targetNumDef.elements.push(nextOverride);
161930
+ else
161931
+ targetNumDef.elements[targetIndex] = nextOverride;
161932
+ changed = true;
161933
+ }
161934
+ return changed;
161935
+ }
161936
+ function cloneAbstractAndNum(editor, originalAbstractNumId, originalNumId) {
161937
+ const numbering = editor.converter.numbering;
161938
+ const { newAbstractNumId } = cloneAbstractDefinition(editor, originalAbstractNumId);
161939
+ const existingNumIds = Object.keys(numbering.definitions).map(Number);
161940
+ const newNumId = existingNumIds.length > 0 ? Math.max(...existingNumIds) + 1 : 1;
161941
+ const originalNumDef = numbering.definitions[originalNumId];
161942
+ const newElements = [{
161943
+ type: "element",
161944
+ name: "w:abstractNumId",
161945
+ attributes: { "w:val": String(newAbstractNumId) }
161946
+ }];
161947
+ if (originalNumDef?.elements) {
161948
+ for (const el of originalNumDef.elements)
161949
+ if (el.name === "w:lvlOverride")
161950
+ newElements.push(deepCloneElement(el));
161951
+ }
161952
+ numbering.definitions[newNumId] = {
161953
+ type: "element",
161954
+ name: "w:num",
161955
+ attributes: { "w:numId": String(newNumId) },
161956
+ elements: newElements
161957
+ };
161958
+ return {
161959
+ newAbstractNumId,
161960
+ newNumId
161961
+ };
161962
+ }
160363
161963
  function toListsFailure$1(code7, message, details) {
160364
161964
  return {
160365
161965
  success: false,
@@ -160381,6 +161981,9 @@ function dispatchEditorTransaction$2(editor, tr) {
160381
161981
  }
160382
161982
  throw new DocumentApiAdapterError("INTERNAL_ERROR", "Cannot apply list mutation because no transaction dispatcher is available.", { reason: "missing_dispatch" });
160383
161983
  }
161984
+ function getConverterNumbering$1(editor) {
161985
+ return editor.converter.numbering;
161986
+ }
160384
161987
  function executeDomainCommandWithRollback(editor, handler2, options) {
160385
161988
  let receipt2;
160386
161989
  compoundMutation({
@@ -160420,7 +162023,7 @@ function resolveInsertedListItem(editor, sdBlockId) {
160420
162023
  function withListTarget(editor, input2) {
160421
162024
  return resolveListItem(editor, input2.target);
160422
162025
  }
160423
- function hasLevelOverride$1(editor, numId, level) {
162026
+ function hasLevelOverride(editor, numId, level) {
160424
162027
  const definition3 = editor.converter?.numbering?.definitions?.[numId];
160425
162028
  const ilvl = String(level);
160426
162029
  return definition3?.elements?.some((element3) => element3.name === "w:lvlOverride" && element3.attributes?.["w:ilvl"] === ilvl) ?? false;
@@ -160570,6 +162173,33 @@ function listsOutdentWrapper(editor, input2, options) {
160570
162173
  return toListsFailure$1("NO_OP", "List item is already at level 0.", { target: input2.target });
160571
162174
  return executeSetLevel(editor, target, currentLevel - 1, options);
160572
162175
  }
162176
+ function resolveCreateKind(input2) {
162177
+ const raw = input2;
162178
+ if (raw.style != null && raw.preset != null)
162179
+ return { failure: toListsFailure$1("INVALID_INPUT", "Cannot provide both style and preset.", {}) };
162180
+ if (raw.preset != null) {
162181
+ const presetKind = PRESET_KIND_MAP[raw.preset];
162182
+ if (!presetKind)
162183
+ return { failure: toListsFailure$1("INVALID_INPUT", `Unknown preset: ${raw.preset}.`, { preset: raw.preset }) };
162184
+ if (raw.kind != null && raw.kind !== presetKind)
162185
+ return { failure: toListsFailure$1("INVALID_INPUT", `Preset kind (${presetKind}) conflicts with provided kind (${raw.kind}).`, {
162186
+ preset: raw.preset,
162187
+ kind: raw.kind
162188
+ }) };
162189
+ return { kind: presetKind };
162190
+ }
162191
+ if (raw.style != null) {
162192
+ if (raw.kind == null)
162193
+ return { failure: toListsFailure$1("INVALID_INPUT", "kind is required when style is provided.", {}) };
162194
+ return { kind: raw.kind };
162195
+ }
162196
+ if (raw.kind == null)
162197
+ return { failure: toListsFailure$1("INVALID_INPUT", "kind is required when neither preset nor style is provided.", {}) };
162198
+ return { kind: raw.kind };
162199
+ }
162200
+ function isListKind(value) {
162201
+ return value === "ordered" || value === "bullet";
162202
+ }
160573
162203
  function listsCreateWrapper(editor, input2, options) {
160574
162204
  rejectTrackedMode("lists.create", options);
160575
162205
  const raw = input2;
@@ -160580,53 +162210,24 @@ function listsCreateWrapper(editor, input2, options) {
160580
162210
  const level = input2.level ?? 0;
160581
162211
  if (level < 0 || level > 8)
160582
162212
  return toListsFailure$1("LEVEL_OUT_OF_RANGE", "Level must be between 0 and 8.", { level });
160583
- const listType = input2.kind === "ordered" ? "orderedList" : "bulletList";
160584
- if (input2.mode === "empty") {
160585
- const block = resolveBlock(editor, input2.at.nodeId);
160586
- if (block.nodeType === "listItem")
160587
- return toListsFailure$1("INVALID_TARGET", "Target paragraph is already a list item.", { target: input2.at });
160588
- if (options?.dryRun)
160589
- return {
160590
- success: true,
160591
- listId: "(dry-run)",
160592
- item: {
160593
- kind: "block",
160594
- nodeType: "listItem",
160595
- nodeId: "(dry-run)"
160596
- }
160597
- };
160598
- let numId$1;
160599
- if (executeDomainCommandWithRollback(editor, () => {
160600
- numId$1 = ListHelpers.getNewListId(editor);
160601
- ListHelpers.generateNewListDefinition({
160602
- numId: numId$1,
160603
- listType,
160604
- editor
160605
- });
160606
- const { tr } = editor.state;
160607
- updateNumberingProperties({
160608
- numId: numId$1,
160609
- ilvl: level
160610
- }, block.node, block.pos, editor, tr);
160611
- dispatchEditorTransaction$2(editor, tr);
160612
- clearIndexCache(editor);
160613
- return true;
160614
- }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
160615
- return toListsFailure$1("INVALID_TARGET", "List creation could not be applied.", { mode: input2.mode });
160616
- return {
160617
- success: true,
160618
- listId: `${numId$1}:${block.nodeId}`,
160619
- item: {
160620
- kind: "block",
160621
- nodeType: "listItem",
160622
- nodeId: block.nodeId
160623
- }
160624
- };
160625
- }
160626
- const targets = isBlockRange(input2.target) ? resolveBlocksInRange(editor, input2.target.from.nodeId, input2.target.to.nodeId) : [resolveBlock(editor, input2.target.nodeId)];
160627
- if (targets.length === 0)
160628
- return toListsFailure$1("INVALID_TARGET", "No paragraphs found in the specified range.", { target: input2.target });
160629
- const alreadyListItem = targets.find((t) => t.nodeType === "listItem");
162213
+ let styleTemplate;
162214
+ if (raw.style != null) {
162215
+ styleTemplate = raw.style;
162216
+ if (styleTemplate.version !== 1)
162217
+ return toListsFailure$1("INVALID_INPUT", "Unsupported style version.", { version: styleTemplate.version });
162218
+ } else if (raw.preset != null) {
162219
+ styleTemplate = LevelFormattingHelpers.getPresetTemplate(raw.preset);
162220
+ if (!styleTemplate)
162221
+ return toListsFailure$1("INVALID_INPUT", `Unknown preset: ${raw.preset}.`, { preset: raw.preset });
162222
+ }
162223
+ let blocks2;
162224
+ if (input2.mode === "empty")
162225
+ blocks2 = [resolveBlock(editor, input2.at.nodeId)];
162226
+ else
162227
+ blocks2 = isBlockRange(input2.target) ? resolveBlocksInRange(editor, input2.target.from.nodeId, input2.target.to.nodeId) : [resolveBlock(editor, input2.target.nodeId)];
162228
+ if (blocks2.length === 0)
162229
+ return toListsFailure$1("INVALID_TARGET", "No paragraphs found in the specified range.", {});
162230
+ const alreadyListItem = blocks2.find((t) => t.nodeType === "listItem");
160630
162231
  if (alreadyListItem)
160631
162232
  return toListsFailure$1("INVALID_TARGET", "One or more target paragraphs are already list items.", { nodeId: alreadyListItem.nodeId });
160632
162233
  if (options?.dryRun)
@@ -160636,35 +162237,92 @@ function listsCreateWrapper(editor, input2, options) {
160636
162237
  item: {
160637
162238
  kind: "block",
160638
162239
  nodeType: "listItem",
160639
- nodeId: targets[0].nodeId
160640
- }
160641
- };
162240
+ nodeId: blocks2[0].nodeId
162241
+ }
162242
+ };
162243
+ const sequenceInput = raw.sequence ?? { mode: "new" };
162244
+ const requestedKind = raw.kind;
162245
+ if (requestedKind != null && !isListKind(requestedKind))
162246
+ return toListsFailure$1("INVALID_INPUT", `Unknown list kind: ${String(requestedKind)}.`, { kind: requestedKind });
162247
+ let kind;
162248
+ let listType;
162249
+ if (sequenceInput.mode !== "continuePrevious") {
162250
+ const kindResult = resolveCreateKind(input2);
162251
+ if ("failure" in kindResult)
162252
+ return kindResult.failure;
162253
+ kind = kindResult.kind;
162254
+ listType = kind === "ordered" ? "orderedList" : "bulletList";
162255
+ } else
162256
+ kind = requestedKind;
162257
+ let continuePreviousNumId;
162258
+ if (sequenceInput.mode === "continuePrevious") {
162259
+ if (styleTemplate)
162260
+ return toListsFailure$1("INVALID_INPUT", 'preset/style cannot be combined with sequence.mode "continuePrevious". The new items inherit formatting from the previous sequence.', {});
162261
+ const allItems = getAllListItemProjections(editor);
162262
+ const firstBlockPos = blocks2[0].pos;
162263
+ for (let i4 = allItems.length - 1;i4 >= 0; i4--) {
162264
+ const item = allItems[i4];
162265
+ if (item.candidate.pos >= firstBlockPos)
162266
+ continue;
162267
+ if (item.numId == null)
162268
+ continue;
162269
+ if (kind != null && item.kind !== kind)
162270
+ continue;
162271
+ continuePreviousNumId = item.numId;
162272
+ break;
162273
+ }
162274
+ if (continuePreviousNumId == null)
162275
+ return toListsFailure$1("NO_COMPATIBLE_PREVIOUS", "No compatible previous list sequence found.", {});
162276
+ }
160642
162277
  let numId;
160643
162278
  if (executeDomainCommandWithRollback(editor, () => {
160644
- numId = ListHelpers.getNewListId(editor);
160645
- ListHelpers.generateNewListDefinition({
160646
- numId,
160647
- listType,
160648
- editor
160649
- });
160650
- const { tr } = editor.state;
160651
- for (const block of targets)
160652
- updateNumberingProperties({
162279
+ if (sequenceInput.mode === "continuePrevious") {
162280
+ numId = continuePreviousNumId;
162281
+ const { tr } = editor.state;
162282
+ for (const block of blocks2)
162283
+ updateNumberingProperties({
162284
+ numId,
162285
+ ilvl: level
162286
+ }, block.node, block.pos, editor, tr);
162287
+ dispatchEditorTransaction$2(editor, tr);
162288
+ clearIndexCache(editor);
162289
+ } else {
162290
+ numId = ListHelpers.getNewListId(editor);
162291
+ ListHelpers.generateNewListDefinition({
160653
162292
  numId,
160654
- ilvl: level
160655
- }, block.node, block.pos, editor, tr);
160656
- dispatchEditorTransaction$2(editor, tr);
160657
- clearIndexCache(editor);
162293
+ listType,
162294
+ editor
162295
+ });
162296
+ if (styleTemplate) {
162297
+ const abstractNumId = getAbstractNumId(editor, numId);
162298
+ if (abstractNumId != null) {
162299
+ LevelFormattingHelpers.applyTemplateToAbstract(editor, abstractNumId, styleTemplate, undefined);
162300
+ const numberingPart = getPart(editor, "word/numbering.xml");
162301
+ if (numberingPart)
162302
+ syncNumberingToXmlTree(numberingPart, getConverterNumbering$1(editor));
162303
+ }
162304
+ }
162305
+ const { tr } = editor.state;
162306
+ for (const block of blocks2)
162307
+ updateNumberingProperties({
162308
+ numId,
162309
+ ilvl: level
162310
+ }, block.node, block.pos, editor, tr);
162311
+ dispatchEditorTransaction$2(editor, tr);
162312
+ clearIndexCache(editor);
162313
+ if (sequenceInput.startAt != null)
162314
+ ListHelpers.setLvlOverride(editor, numId, level, { startOverride: sequenceInput.startAt });
162315
+ }
160658
162316
  return true;
160659
162317
  }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
160660
162318
  return toListsFailure$1("INVALID_TARGET", "List creation could not be applied.", { mode: input2.mode });
160661
162319
  return {
160662
162320
  success: true,
160663
- listId: `${numId}:${targets[0].nodeId}`,
162321
+ listId: `${numId}:${blocks2[0].nodeId}`,
160664
162322
  item: {
160665
162323
  kind: "block",
160666
162324
  nodeType: "listItem",
160667
- nodeId: targets[0].nodeId
162325
+ nodeId: blocks2[0].nodeId
160668
162326
  }
160669
162327
  };
160670
162328
  }
@@ -160848,7 +162506,7 @@ function listsSetValueWrapper(editor, input2, options) {
160848
162506
  item: target.address
160849
162507
  };
160850
162508
  if (input2.value === null) {
160851
- if (!hasLevelOverride$1(editor, target.numId, level))
162509
+ if (!hasLevelOverride(editor, target.numId, level))
160852
162510
  return toListsFailure$1("NO_OP", "No startOverride to remove.", { target: input2.target });
160853
162511
  if (executeDomainCommandWithRollback(editor, () => {
160854
162512
  ListHelpers.removeLvlOverride(editor, target.numId, level);
@@ -161001,362 +162659,6 @@ function listsConvertToTextWrapper(editor, input2, options) {
161001
162659
  }
161002
162660
  };
161003
162661
  }
161004
- function findLevelElement(abstract, ilvl) {
161005
- const ilvlStr = String(ilvl);
161006
- return abstract.elements?.find((el) => el.name === "w:lvl" && el.attributes?.["w:ilvl"] === ilvlStr);
161007
- }
161008
- function readChildAttr(parent, elementName) {
161009
- return parent.elements?.find((el) => el.name === elementName)?.attributes?.["w:val"];
161010
- }
161011
- function setChildAttr(parent, elementName, value) {
161012
- if (!parent.elements)
161013
- parent.elements = [];
161014
- const existing = parent.elements.find((el) => el.name === elementName);
161015
- if (existing) {
161016
- if (existing.attributes?.["w:val"] === value)
161017
- return false;
161018
- if (!existing.attributes)
161019
- existing.attributes = {};
161020
- existing.attributes["w:val"] = value;
161021
- return true;
161022
- }
161023
- parent.elements.push({
161024
- type: "element",
161025
- name: elementName,
161026
- attributes: { "w:val": value }
161027
- });
161028
- return true;
161029
- }
161030
- function findOrCreateChild(parent, elementName) {
161031
- if (!parent.elements)
161032
- parent.elements = [];
161033
- let child = parent.elements.find((el) => el.name === elementName);
161034
- if (!child) {
161035
- child = {
161036
- type: "element",
161037
- name: elementName,
161038
- elements: []
161039
- };
161040
- parent.elements.push(child);
161041
- }
161042
- if (!child.elements)
161043
- child.elements = [];
161044
- return child;
161045
- }
161046
- function resolveAbstractLevel(editor, abstractNumId, ilvl) {
161047
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161048
- if (!abstract)
161049
- return null;
161050
- const lvlEl = findLevelElement(abstract, ilvl);
161051
- if (!lvlEl)
161052
- return null;
161053
- return {
161054
- abstract,
161055
- lvlEl
161056
- };
161057
- }
161058
- function hasLevel(editor, abstractNumId, ilvl) {
161059
- return resolveAbstractLevel(editor, abstractNumId, ilvl) != null;
161060
- }
161061
- function readLevelProperties(lvlEl, ilvl) {
161062
- const props = { level: ilvl };
161063
- const numFmt = readChildAttr(lvlEl, "w:numFmt");
161064
- if (numFmt != null)
161065
- props.numFmt = numFmt;
161066
- const lvlText = readChildAttr(lvlEl, "w:lvlText");
161067
- if (lvlText != null)
161068
- props.lvlText = lvlText;
161069
- const startVal = readChildAttr(lvlEl, "w:start");
161070
- if (startVal != null)
161071
- props.start = Number(startVal);
161072
- const alignment$1 = readChildAttr(lvlEl, "w:lvlJc");
161073
- if (alignment$1 != null)
161074
- props.alignment = alignment$1;
161075
- const suff = readChildAttr(lvlEl, "w:suff");
161076
- if (suff != null)
161077
- props.trailingCharacter = suff;
161078
- const picBulletId = readChildAttr(lvlEl, "w:lvlPicBulletId");
161079
- if (picBulletId != null)
161080
- props.pictureBulletId = Number(picBulletId);
161081
- const ind = lvlEl.elements?.find((el) => el.name === "w:pPr")?.elements?.find((el) => el.name === "w:ind");
161082
- if (ind?.attributes) {
161083
- const indents = {};
161084
- if (ind.attributes["w:left"] != null)
161085
- indents.left = Number(ind.attributes["w:left"]);
161086
- if (ind.attributes["w:hanging"] != null)
161087
- indents.hanging = Number(ind.attributes["w:hanging"]);
161088
- if (ind.attributes["w:firstLine"] != null)
161089
- indents.firstLine = Number(ind.attributes["w:firstLine"]);
161090
- if (Object.keys(indents).length > 0)
161091
- props.indents = indents;
161092
- }
161093
- const rFonts = lvlEl.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rFonts");
161094
- if (rFonts?.attributes?.["w:ascii"])
161095
- props.markerFont = rFonts.attributes["w:ascii"];
161096
- return props;
161097
- }
161098
- function mutateLevelNumberingFormat(lvlEl, { numFmt, lvlText, start: start$1 }) {
161099
- let changed = false;
161100
- changed = setChildAttr(lvlEl, "w:numFmt", numFmt) || changed;
161101
- changed = setChildAttr(lvlEl, "w:lvlText", lvlText) || changed;
161102
- if (start$1 != null)
161103
- changed = setChildAttr(lvlEl, "w:start", String(start$1)) || changed;
161104
- return changed;
161105
- }
161106
- function mutateLevelBulletMarker(lvlEl, markerText) {
161107
- let changed = false;
161108
- changed = setChildAttr(lvlEl, "w:numFmt", "bullet") || changed;
161109
- changed = setChildAttr(lvlEl, "w:lvlText", markerText) || changed;
161110
- return changed;
161111
- }
161112
- function mutateLevelPictureBulletId(lvlEl, pictureBulletId) {
161113
- return setChildAttr(lvlEl, "w:lvlPicBulletId", String(pictureBulletId));
161114
- }
161115
- function mutateLevelAlignment(lvlEl, alignment$1) {
161116
- return setChildAttr(lvlEl, "w:lvlJc", alignment$1);
161117
- }
161118
- function mutateLevelIndents(lvlEl, indents) {
161119
- const ind = findOrCreateChild(findOrCreateChild(lvlEl, "w:pPr"), "w:ind");
161120
- if (!ind.attributes)
161121
- ind.attributes = {};
161122
- let changed = false;
161123
- if (indents.left != null) {
161124
- const newVal = String(indents.left);
161125
- if (ind.attributes["w:left"] !== newVal) {
161126
- ind.attributes["w:left"] = newVal;
161127
- changed = true;
161128
- }
161129
- }
161130
- if (indents.hanging != null) {
161131
- const newVal = String(indents.hanging);
161132
- if (ind.attributes["w:hanging"] !== newVal) {
161133
- ind.attributes["w:hanging"] = newVal;
161134
- changed = true;
161135
- }
161136
- if (ind.attributes["w:firstLine"] != null) {
161137
- delete ind.attributes["w:firstLine"];
161138
- changed = true;
161139
- }
161140
- }
161141
- if (indents.firstLine != null) {
161142
- const newVal = String(indents.firstLine);
161143
- if (ind.attributes["w:firstLine"] !== newVal) {
161144
- ind.attributes["w:firstLine"] = newVal;
161145
- changed = true;
161146
- }
161147
- if (ind.attributes["w:hanging"] != null) {
161148
- delete ind.attributes["w:hanging"];
161149
- changed = true;
161150
- }
161151
- }
161152
- return changed;
161153
- }
161154
- function mutateLevelTrailingCharacter(lvlEl, trailingCharacter) {
161155
- return setChildAttr(lvlEl, "w:suff", trailingCharacter);
161156
- }
161157
- function mutateLevelMarkerFont(lvlEl, fontFamily) {
161158
- const rPr = findOrCreateChild(lvlEl, "w:rPr");
161159
- const rFonts = rPr.elements.find((el) => el.name === "w:rFonts");
161160
- if (rFonts) {
161161
- const attrs = rFonts.attributes || {};
161162
- if (attrs["w:ascii"] === fontFamily && attrs["w:hAnsi"] === fontFamily && attrs["w:eastAsia"] === fontFamily && attrs["w:cs"] === fontFamily)
161163
- return false;
161164
- rFonts.attributes = {
161165
- ...rFonts.attributes,
161166
- "w:ascii": fontFamily,
161167
- "w:hAnsi": fontFamily,
161168
- "w:eastAsia": fontFamily,
161169
- "w:cs": fontFamily
161170
- };
161171
- return true;
161172
- }
161173
- rPr.elements.push({
161174
- type: "element",
161175
- name: "w:rFonts",
161176
- attributes: {
161177
- "w:ascii": fontFamily,
161178
- "w:hAnsi": fontFamily,
161179
- "w:eastAsia": fontFamily,
161180
- "w:cs": fontFamily
161181
- }
161182
- });
161183
- return true;
161184
- }
161185
- function setLevelNumberingFormat(editor, abstractNumId, ilvl, params$1) {
161186
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161187
- if (!resolved)
161188
- return false;
161189
- return mutateLevelNumberingFormat(resolved.lvlEl, params$1);
161190
- }
161191
- function setLevelBulletMarker(editor, abstractNumId, ilvl, markerText) {
161192
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161193
- if (!resolved)
161194
- return false;
161195
- return mutateLevelBulletMarker(resolved.lvlEl, markerText);
161196
- }
161197
- function setLevelPictureBulletId(editor, abstractNumId, ilvl, pictureBulletId) {
161198
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161199
- if (!resolved)
161200
- return false;
161201
- return mutateLevelPictureBulletId(resolved.lvlEl, pictureBulletId);
161202
- }
161203
- function setLevelAlignment(editor, abstractNumId, ilvl, alignment$1) {
161204
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161205
- if (!resolved)
161206
- return false;
161207
- return mutateLevelAlignment(resolved.lvlEl, alignment$1);
161208
- }
161209
- function setLevelIndents(editor, abstractNumId, ilvl, indents) {
161210
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161211
- if (!resolved)
161212
- return false;
161213
- return mutateLevelIndents(resolved.lvlEl, indents);
161214
- }
161215
- function setLevelTrailingCharacter(editor, abstractNumId, ilvl, trailingCharacter) {
161216
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161217
- if (!resolved)
161218
- return false;
161219
- return mutateLevelTrailingCharacter(resolved.lvlEl, trailingCharacter);
161220
- }
161221
- function setLevelMarkerFont(editor, abstractNumId, ilvl, fontFamily) {
161222
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161223
- if (!resolved)
161224
- return false;
161225
- return mutateLevelMarkerFont(resolved.lvlEl, fontFamily);
161226
- }
161227
- function hasLevelOverride(editor, numId, ilvl) {
161228
- const numDef = editor.converter.numbering?.definitions?.[numId];
161229
- if (!numDef?.elements)
161230
- return false;
161231
- const ilvlStr = String(ilvl);
161232
- return numDef.elements.some((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161233
- }
161234
- function clearLevelOverride(editor, numId, ilvl) {
161235
- if (!hasLevelOverride(editor, numId, ilvl))
161236
- return false;
161237
- removeLvlOverride(editor.converter.numbering, numId, ilvl);
161238
- return true;
161239
- }
161240
- function captureTemplate(editor, abstractNumId, levels) {
161241
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161242
- if (!abstract?.elements)
161243
- return null;
161244
- const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161245
- const captured = [];
161246
- for (const lvlEl of lvlElements) {
161247
- const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161248
- if (levels && !levels.includes(ilvl))
161249
- continue;
161250
- captured.push(readLevelProperties(lvlEl, ilvl));
161251
- }
161252
- captured.sort((a2, b$1) => a2.level - b$1.level);
161253
- return {
161254
- version: 1,
161255
- levels: captured
161256
- };
161257
- }
161258
- function applyTemplateToAbstract(editor, abstractNumId, template, levels) {
161259
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161260
- if (!abstract?.elements)
161261
- return {
161262
- changed: false,
161263
- error: "ABSTRACT_NOT_FOUND"
161264
- };
161265
- const templateByLevel = /* @__PURE__ */ new Map;
161266
- for (const entry of template.levels)
161267
- templateByLevel.set(entry.level, entry);
161268
- const targetLevels = levels ?? template.levels.map((l) => l.level);
161269
- for (const ilvl of targetLevels)
161270
- if (!templateByLevel.has(ilvl))
161271
- return {
161272
- changed: false,
161273
- error: "LEVEL_NOT_IN_TEMPLATE"
161274
- };
161275
- for (const ilvl of targetLevels)
161276
- if (!findLevelElement(abstract, ilvl))
161277
- return {
161278
- changed: false,
161279
- error: "LEVEL_NOT_IN_ABSTRACT"
161280
- };
161281
- let anyChanged = false;
161282
- for (const ilvl of targetLevels) {
161283
- const entry = templateByLevel.get(ilvl);
161284
- const lvlEl = findLevelElement(abstract, ilvl);
161285
- if (entry.numFmt != null || entry.lvlText != null) {
161286
- const fmtParams = {};
161287
- if (entry.numFmt != null)
161288
- fmtParams.numFmt = entry.numFmt;
161289
- if (entry.lvlText != null)
161290
- fmtParams.lvlText = entry.lvlText;
161291
- if (entry.start != null)
161292
- fmtParams.start = entry.start;
161293
- if (fmtParams.numFmt != null && fmtParams.lvlText != null)
161294
- anyChanged = mutateLevelNumberingFormat(lvlEl, fmtParams) || anyChanged;
161295
- else {
161296
- if (fmtParams.numFmt != null)
161297
- anyChanged = setChildAttr(lvlEl, "w:numFmt", fmtParams.numFmt) || anyChanged;
161298
- if (fmtParams.lvlText != null)
161299
- anyChanged = setChildAttr(lvlEl, "w:lvlText", fmtParams.lvlText) || anyChanged;
161300
- if (fmtParams.start != null)
161301
- anyChanged = setChildAttr(lvlEl, "w:start", String(fmtParams.start)) || anyChanged;
161302
- }
161303
- } else if (entry.start != null)
161304
- anyChanged = setChildAttr(lvlEl, "w:start", String(entry.start)) || anyChanged;
161305
- if (entry.alignment != null)
161306
- anyChanged = mutateLevelAlignment(lvlEl, entry.alignment) || anyChanged;
161307
- if (entry.indents != null)
161308
- anyChanged = mutateLevelIndents(lvlEl, entry.indents) || anyChanged;
161309
- if (entry.trailingCharacter != null)
161310
- anyChanged = mutateLevelTrailingCharacter(lvlEl, entry.trailingCharacter) || anyChanged;
161311
- if (entry.markerFont != null)
161312
- anyChanged = mutateLevelMarkerFont(lvlEl, entry.markerFont) || anyChanged;
161313
- if (entry.pictureBulletId != null)
161314
- anyChanged = mutateLevelPictureBulletId(lvlEl, entry.pictureBulletId) || anyChanged;
161315
- }
161316
- return { changed: anyChanged };
161317
- }
161318
- function buildOrderedPresetTemplate(config2) {
161319
- const levels = [];
161320
- for (let ilvl = 0;ilvl <= 8; ilvl++)
161321
- levels.push({
161322
- level: ilvl,
161323
- numFmt: config2.numFmt,
161324
- lvlText: `%${ilvl + 1}${config2.lvlTextSuffix}`,
161325
- start: 1,
161326
- alignment: "left",
161327
- indents: {
161328
- left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161329
- hanging: HANGING_INDENT_TWIPS
161330
- }
161331
- });
161332
- return {
161333
- version: 1,
161334
- levels
161335
- };
161336
- }
161337
- function buildBulletPresetTemplate(config2) {
161338
- const levels = [];
161339
- for (let ilvl = 0;ilvl <= 8; ilvl++)
161340
- levels.push({
161341
- level: ilvl,
161342
- numFmt: "bullet",
161343
- lvlText: config2.markerText,
161344
- start: 1,
161345
- alignment: "left",
161346
- markerFont: config2.fontFamily,
161347
- indents: {
161348
- left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161349
- hanging: HANGING_INDENT_TWIPS
161350
- }
161351
- });
161352
- return {
161353
- version: 1,
161354
- levels
161355
- };
161356
- }
161357
- function getPresetTemplate(presetId) {
161358
- return PRESET_TEMPLATES[presetId];
161359
- }
161360
162662
  function toListsFailure(code7, message, details) {
161361
162663
  return {
161362
162664
  success: false,
@@ -161386,13 +162688,13 @@ function validateLevelsArray(levels) {
161386
162688
  for (const lvl of levels)
161387
162689
  if (lvl < 0 || lvl > 8)
161388
162690
  return toListsFailure("LEVEL_OUT_OF_RANGE", "Each level must be between 0 and 8.", { level: lvl });
161389
- if (new Set(levels).size !== levels.length)
161390
- return toListsFailure("INVALID_INPUT", "levels must contain unique values.", { levels });
161391
- for (let i4 = 1;i4 < levels.length; i4++)
161392
- if (levels[i4] <= levels[i4 - 1])
161393
- return toListsFailure("INVALID_INPUT", "levels must be sorted in ascending order.", { levels });
161394
162691
  return null;
161395
162692
  }
162693
+ function normalizeLevels(levels) {
162694
+ if (!levels)
162695
+ return;
162696
+ return [...new Set(levels)].sort((a2, b$1) => a2 - b$1);
162697
+ }
161396
162698
  function preflightTemplateLevels(template, levels, target) {
161397
162699
  const templateLevelSet = new Set(template.levels.map((l) => l.level));
161398
162700
  const targetLevels = levels ?? template.levels.map((l) => l.level);
@@ -161751,6 +163053,303 @@ function listsSetLevelTrailingCharacterWrapper(editor, input2, options) {
161751
163053
  function listsSetLevelMarkerFontWrapper(editor, input2, options) {
161752
163054
  return executeSingleLevelMutation(editor, "lists.setLevelMarkerFont", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelMarkerFont(editor, abstractNumId, ilvl, input2.fontFamily));
161753
163055
  }
163056
+ function ensureSequenceLocalAbstract(editor, target, targetAbstractNumId, targetNumId) {
163057
+ if (!LevelFormattingHelpers.isAbstractShared(editor, targetAbstractNumId, targetNumId))
163058
+ return {
163059
+ abstractNumId: targetAbstractNumId,
163060
+ numId: targetNumId,
163061
+ sourceNumId: targetNumId,
163062
+ pendingRebind: null
163063
+ };
163064
+ const sequence = getContiguousSequence(editor, target);
163065
+ const sequenceNodeIds = new Set(sequence.map((item) => item.address.nodeId));
163066
+ const allItemsWithNumId = getAllListItemProjections(editor).filter((item) => item.numId === targetNumId);
163067
+ if (allItemsWithNumId.length === sequence.length && allItemsWithNumId.every((item) => sequenceNodeIds.has(item.address.nodeId))) {
163068
+ const { newAbstractNumId: newAbstractNumId$1 } = LevelFormattingHelpers.cloneAbstractIntoNum(editor, targetAbstractNumId, targetNumId);
163069
+ return {
163070
+ abstractNumId: newAbstractNumId$1,
163071
+ numId: targetNumId,
163072
+ sourceNumId: targetNumId,
163073
+ pendingRebind: null
163074
+ };
163075
+ }
163076
+ const { newAbstractNumId, newNumId } = LevelFormattingHelpers.cloneAbstractAndNum(editor, targetAbstractNumId, targetNumId);
163077
+ return {
163078
+ abstractNumId: newAbstractNumId,
163079
+ numId: newNumId,
163080
+ sourceNumId: targetNumId,
163081
+ pendingRebind: sequence
163082
+ };
163083
+ }
163084
+ function applyPendingRebind(editor, tr, local) {
163085
+ if (!local.pendingRebind)
163086
+ return;
163087
+ for (const item of local.pendingRebind)
163088
+ updateNumberingProperties({
163089
+ numId: local.numId,
163090
+ ilvl: item.level ?? 0
163091
+ }, item.candidate.node, item.candidate.pos, editor, tr);
163092
+ }
163093
+ function executeSequenceLocalLevelMutation(editor, operationId, target, level, options, mutate) {
163094
+ rejectTrackedMode(operationId, options);
163095
+ const levelError = validateLevel(level);
163096
+ if (levelError)
163097
+ return levelError;
163098
+ const targetResult = resolveTargetAbstract(editor, target);
163099
+ if (!targetResult.ok)
163100
+ return targetResult.failure;
163101
+ if (!LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, level))
163102
+ return toListsFailure("LEVEL_NOT_FOUND", `Level ${level} does not exist in the abstract definition.`, {
163103
+ target,
163104
+ level
163105
+ });
163106
+ if (options?.dryRun)
163107
+ return {
163108
+ success: true,
163109
+ item: targetResult.resolved.address
163110
+ };
163111
+ let noOp = false;
163112
+ const compound = compoundMutation({
163113
+ editor,
163114
+ source: operationId,
163115
+ affectedParts: [NUMBERING_PART],
163116
+ execute() {
163117
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, target), targetResult.abstractNumId, targetResult.numId);
163118
+ if (!mutatePart({
163119
+ editor,
163120
+ partId: NUMBERING_PART,
163121
+ operation: "mutate",
163122
+ source: operationId,
163123
+ expectedRevision: options?.expectedRevision,
163124
+ mutate({ part }) {
163125
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, level);
163126
+ if (!mutate(local.abstractNumId, level))
163127
+ return false;
163128
+ LevelFormattingHelpers.copySequenceStateOverrides(editor, local.sourceNumId, local.numId, [level]);
163129
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163130
+ return true;
163131
+ }
163132
+ }).changed) {
163133
+ noOp = true;
163134
+ return false;
163135
+ }
163136
+ const { tr } = editor.state;
163137
+ applyPendingRebind(editor, tr, local);
163138
+ dispatchEditorTransaction$1(editor, tr);
163139
+ if (local.pendingRebind)
163140
+ clearIndexCache(editor);
163141
+ return true;
163142
+ }
163143
+ });
163144
+ if (noOp)
163145
+ return toListsFailure("NO_OP", `${operationId}: values already match.`, { target });
163146
+ if (!compound.success)
163147
+ return toListsFailure("NO_OP", `${operationId}: mutation failed.`, { target });
163148
+ return {
163149
+ success: true,
163150
+ item: targetResult.resolved.address
163151
+ };
163152
+ }
163153
+ function listsGetStyleWrapper(editor, input2) {
163154
+ const levelsError = validateLevelsArray(input2.levels);
163155
+ if (levelsError)
163156
+ return levelsError;
163157
+ const normalized = normalizeLevels(input2.levels);
163158
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163159
+ if (!targetResult.ok)
163160
+ return targetResult.failure;
163161
+ const style2 = LevelFormattingHelpers.captureEffectiveStyle(editor, targetResult.abstractNumId, targetResult.numId, normalized);
163162
+ if (!style2)
163163
+ return toListsFailure("INVALID_TARGET", "Could not capture style from target.", { target: input2.target });
163164
+ return {
163165
+ success: true,
163166
+ style: style2
163167
+ };
163168
+ }
163169
+ function listsApplyStyleWrapper(editor, input2, options) {
163170
+ rejectTrackedMode("lists.applyStyle", options);
163171
+ if (input2.style.version !== 1)
163172
+ return toListsFailure("INVALID_INPUT", "Unsupported style version.", { version: input2.style.version });
163173
+ const levelsError = validateLevelsArray(input2.levels);
163174
+ if (levelsError)
163175
+ return levelsError;
163176
+ const normalized = normalizeLevels(input2.levels);
163177
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163178
+ if (!targetResult.ok)
163179
+ return targetResult.failure;
163180
+ const preflightError = preflightTemplateLevels(input2.style, normalized, input2.target);
163181
+ if (preflightError)
163182
+ return preflightError;
163183
+ if (options?.dryRun)
163184
+ return {
163185
+ success: true,
163186
+ item: targetResult.resolved.address
163187
+ };
163188
+ let applyError;
163189
+ let noOp = false;
163190
+ const compound = compoundMutation({
163191
+ editor,
163192
+ source: "lists.applyStyle",
163193
+ affectedParts: [NUMBERING_PART],
163194
+ execute() {
163195
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, input2.target), targetResult.abstractNumId, targetResult.numId);
163196
+ const result = mutatePart({
163197
+ editor,
163198
+ partId: NUMBERING_PART,
163199
+ operation: "mutate",
163200
+ source: "lists.applyStyle",
163201
+ expectedRevision: options?.expectedRevision,
163202
+ mutate({ part }) {
163203
+ const affectedLevels = normalized ?? input2.style.levels.map((l) => l.level);
163204
+ for (const ilvl of affectedLevels)
163205
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, ilvl);
163206
+ const applyResult = LevelFormattingHelpers.applyTemplateToAbstract(editor, local.abstractNumId, input2.style, normalized);
163207
+ if (applyResult.error) {
163208
+ applyError = applyResult.error;
163209
+ return false;
163210
+ }
163211
+ if (!applyResult.changed)
163212
+ return false;
163213
+ LevelFormattingHelpers.copySequenceStateOverrides(editor, local.sourceNumId, local.numId, affectedLevels);
163214
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163215
+ return true;
163216
+ }
163217
+ });
163218
+ if (applyError || !result.changed) {
163219
+ noOp = !applyError;
163220
+ return false;
163221
+ }
163222
+ const { tr } = editor.state;
163223
+ applyPendingRebind(editor, tr, local);
163224
+ dispatchEditorTransaction$1(editor, tr);
163225
+ if (local.pendingRebind)
163226
+ clearIndexCache(editor);
163227
+ return true;
163228
+ }
163229
+ });
163230
+ if (applyError)
163231
+ return toApplyTemplateError(applyError, input2.target);
163232
+ if (noOp)
163233
+ return toListsFailure("NO_OP", "All style levels already match.", { target: input2.target });
163234
+ if (!compound.success)
163235
+ return toListsFailure("NO_OP", "Style application failed.", { target: input2.target });
163236
+ return {
163237
+ success: true,
163238
+ item: targetResult.resolved.address
163239
+ };
163240
+ }
163241
+ function registerSetValueDelegate(fn) {
163242
+ _setValueDelegate = fn;
163243
+ }
163244
+ function listsRestartAtWrapper(editor, input2, options) {
163245
+ rejectTrackedMode("lists.restartAt", options);
163246
+ if (input2.startAt < 1 || !Number.isInteger(input2.startAt))
163247
+ return toListsFailure("INVALID_INPUT", "startAt must be a positive integer (>= 1).", { startAt: input2.startAt });
163248
+ const resolved = resolveListItem(editor, input2.target);
163249
+ if (resolved.numId == null)
163250
+ return toListsFailure("INVALID_TARGET", "Target must have numbering metadata.", { target: input2.target });
163251
+ if (resolved.kind === "bullet")
163252
+ return toListsFailure("INVALID_INPUT", "Cannot restart numbering on a bullet list.", { target: input2.target });
163253
+ if (!_setValueDelegate)
163254
+ return toListsFailure("INVALID_INPUT", "restartAt: internal delegate not registered.", { target: input2.target });
163255
+ return _setValueDelegate(editor, {
163256
+ target: input2.target,
163257
+ value: input2.startAt
163258
+ }, options);
163259
+ }
163260
+ function listsSetLevelNumberStyleWrapper(editor, input2, options) {
163261
+ if (input2.numberStyle === "bullet")
163262
+ return toListsFailure("INVALID_INPUT", "Use setLevelBullet or setLevelPictureBullet to set bullet format.", { numberStyle: input2.numberStyle });
163263
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelNumberStyle", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelNumberStyle(editor, abstractNumId, ilvl, input2.numberStyle));
163264
+ }
163265
+ function listsSetLevelTextWrapper(editor, input2, options) {
163266
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelText", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelText(editor, abstractNumId, ilvl, input2.text));
163267
+ }
163268
+ function listsSetLevelStartWrapper(editor, input2, options) {
163269
+ if (input2.startAt < 1 || !Number.isInteger(input2.startAt))
163270
+ return toListsFailure("INVALID_INPUT", "startAt must be a positive integer (>= 1).", { startAt: input2.startAt });
163271
+ if (!validateLevel(input2.level)) {
163272
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163273
+ if (targetResult.ok && LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, input2.level)) {
163274
+ const abstracts = getConverterNumbering(editor).abstracts;
163275
+ const lvlEl = LevelFormattingHelpers.findLevelElement(abstracts[targetResult.abstractNumId], input2.level);
163276
+ if (LevelFormattingHelpers.readLevelProperties(lvlEl, input2.level).numFmt === "bullet")
163277
+ return toListsFailure("INVALID_INPUT", "Cannot set start value on a bullet level.", {
163278
+ target: input2.target,
163279
+ level: input2.level
163280
+ });
163281
+ }
163282
+ }
163283
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelStart", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelStart(editor, abstractNumId, ilvl, input2.startAt));
163284
+ }
163285
+ function listsSetLevelLayoutWrapper(editor, input2, options) {
163286
+ rejectTrackedMode("lists.setLevelLayout", options);
163287
+ const levelError = validateLevel(input2.level);
163288
+ if (levelError)
163289
+ return levelError;
163290
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163291
+ if (!targetResult.ok)
163292
+ return targetResult.failure;
163293
+ if (!LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, input2.level))
163294
+ return toListsFailure("LEVEL_NOT_FOUND", `Level ${input2.level} does not exist in the abstract definition.`, {
163295
+ target: input2.target,
163296
+ level: input2.level
163297
+ });
163298
+ if (options?.dryRun)
163299
+ return {
163300
+ success: true,
163301
+ item: targetResult.resolved.address
163302
+ };
163303
+ let noOp = false;
163304
+ let layoutError;
163305
+ const compound = compoundMutation({
163306
+ editor,
163307
+ source: "lists.setLevelLayout",
163308
+ affectedParts: [NUMBERING_PART],
163309
+ execute() {
163310
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, input2.target), targetResult.abstractNumId, targetResult.numId);
163311
+ const result = mutatePart({
163312
+ editor,
163313
+ partId: NUMBERING_PART,
163314
+ operation: "mutate",
163315
+ source: "lists.setLevelLayout",
163316
+ expectedRevision: options?.expectedRevision,
163317
+ mutate({ part }) {
163318
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, input2.level);
163319
+ const layoutResult = LevelFormattingHelpers.setLevelLayout(editor, local.abstractNumId, input2.level, input2.layout);
163320
+ if (layoutResult.error) {
163321
+ layoutError = layoutResult.error;
163322
+ return false;
163323
+ }
163324
+ if (!layoutResult.changed)
163325
+ return false;
163326
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163327
+ return true;
163328
+ }
163329
+ });
163330
+ if (layoutError || !result.changed) {
163331
+ noOp = !layoutError;
163332
+ return false;
163333
+ }
163334
+ const { tr } = editor.state;
163335
+ applyPendingRebind(editor, tr, local);
163336
+ dispatchEditorTransaction$1(editor, tr);
163337
+ if (local.pendingRebind)
163338
+ clearIndexCache(editor);
163339
+ return true;
163340
+ }
163341
+ });
163342
+ if (layoutError)
163343
+ return toListsFailure("INVALID_INPUT", `Layout mutation failed: ${layoutError}.`, { target: input2.target });
163344
+ if (noOp)
163345
+ return toListsFailure("NO_OP", "lists.setLevelLayout: values already match.", { target: input2.target });
163346
+ if (!compound.success)
163347
+ return toListsFailure("NO_OP", "lists.setLevelLayout: mutation failed.", { target: input2.target });
163348
+ return {
163349
+ success: true,
163350
+ item: targetResult.resolved.address
163351
+ };
163352
+ }
161754
163353
  function listsClearLevelOverridesWrapper(editor, input2, options) {
161755
163354
  rejectTrackedMode("lists.clearLevelOverrides", options);
161756
163355
  const levelError = validateLevel(input2.level);
@@ -161926,7 +163525,7 @@ function resolveAnchor(editor, anchor, revision, index2) {
161926
163525
  }
161927
163526
  }
161928
163527
  function isEdgeNodeType(nodeType) {
161929
- return EDGE_NODE_TYPES.has(nodeType);
163528
+ return EDGE_NODE_TYPES$1.has(nodeType);
161930
163529
  }
161931
163530
  function computeTextOffset(editor, blockContentStart, absPos) {
161932
163531
  if (absPos <= blockContentStart)
@@ -162102,15 +163701,13 @@ function rangeContainsOnlyTextBlocks(index2, absFrom, absTo) {
162102
163701
  }
162103
163702
  return true;
162104
163703
  }
162105
- function resolveRange(editor, input2) {
163704
+ function resolveAbsoluteRange(editor, input2) {
162106
163705
  const revision = getRevision(editor);
162107
163706
  if (input2.expectedRevision !== undefined)
162108
163707
  checkRevision(editor, input2.expectedRevision);
162109
163708
  const index2 = getBlockIndex(editor);
162110
- const rawFrom = resolveAnchor(editor, input2.start, revision, index2);
162111
- const rawTo = resolveAnchor(editor, input2.end, revision, index2);
162112
- const absFrom = Math.min(rawFrom, rawTo);
162113
- const absTo = Math.max(rawFrom, rawTo);
163709
+ const absFrom = Math.min(input2.absFrom, input2.absTo);
163710
+ const absTo = Math.max(input2.absFrom, input2.absTo);
162114
163711
  const target = buildSelectionTarget(editor, index2, absFrom, absTo);
162115
163712
  const coversFullTarget = target.start.kind === "text" && target.end.kind === "text" && rangeContainsOnlyTextBlocks(index2, absFrom, absTo);
162116
163713
  return {
@@ -162124,7 +163721,17 @@ function resolveRange(editor, input2) {
162124
163721
  preview: buildPreview(editor, index2, absFrom, absTo)
162125
163722
  };
162126
163723
  }
162127
- function resolveTableLocator(editor, locator, operationName) {
163724
+ function resolveRange(editor, input2) {
163725
+ const revision = getRevision(editor);
163726
+ if (input2.expectedRevision !== undefined)
163727
+ checkRevision(editor, input2.expectedRevision);
163728
+ const index2 = getBlockIndex(editor);
163729
+ return resolveAbsoluteRange(editor, {
163730
+ absFrom: resolveAnchor(editor, input2.start, revision, index2),
163731
+ absTo: resolveAnchor(editor, input2.end, revision, index2)
163732
+ });
163733
+ }
163734
+ function resolveLocatorToCandidate(editor, locator, operationName) {
162128
163735
  const hasTarget = locator.target != null;
162129
163736
  const hasNodeId = locator.nodeId != null;
162130
163737
  if (hasTarget && hasNodeId)
@@ -162132,13 +163739,13 @@ function resolveTableLocator(editor, locator, operationName) {
162132
163739
  if (!hasTarget && !hasNodeId)
162133
163740
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: requires either target or nodeId.`, { fields: ["target", "nodeId"] });
162134
163741
  const index2 = getBlockIndex(editor);
162135
- let candidate;
162136
- if (hasTarget)
162137
- candidate = findBlockById(index2, locator.target);
162138
- else
162139
- candidate = findBlockByNodeIdOnly(index2, locator.nodeId);
163742
+ const candidate = hasTarget ? findBlockById(index2, locator.target) : findBlockByNodeIdOnly(index2, locator.nodeId);
162140
163743
  if (!candidate)
162141
- throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: table target was not found.`, { target: hasTarget ? locator.target : locator.nodeId });
163744
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: target was not found.`, { target: hasTarget ? locator.target : locator.nodeId });
163745
+ return candidate;
163746
+ }
163747
+ function resolveTableLocator(editor, locator, operationName) {
163748
+ const candidate = resolveLocatorToCandidate(editor, locator, operationName);
162142
163749
  if (candidate.nodeType !== "table")
162143
163750
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: target resolved to "${candidate.nodeType}", expected "table".`, {
162144
163751
  actualNodeType: candidate.nodeType,
@@ -162169,18 +163776,11 @@ function findLastCandidate(candidates, predicate) {
162169
163776
  }
162170
163777
  }
162171
163778
  function resolveRowLocator(editor, input2, operationName) {
162172
- const hasDirectTarget = input2.target != null || input2.nodeId != null;
162173
- const hasTableScope = input2.tableTarget != null || input2.tableNodeId != null;
162174
- if (hasDirectTarget && hasTableScope)
162175
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: cannot combine direct row locator (target/nodeId) with table-scoped locator (tableTarget/tableNodeId).`);
162176
- if (hasDirectTarget) {
162177
- const index2 = getBlockIndex(editor);
162178
- const candidate = input2.target != null ? findBlockById(index2, input2.target) : findBlockByNodeIdOnly(index2, input2.nodeId);
162179
- if (!candidate)
162180
- throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: row target was not found.`);
162181
- if (candidate.nodeType !== "tableRow")
162182
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: target resolved to "${candidate.nodeType}", expected "tableRow".`);
162183
- const tableCandidate = findParentTable(index2, candidate);
163779
+ const candidate = resolveLocatorToCandidate(editor, input2, operationName);
163780
+ if (candidate.nodeType === "tableRow") {
163781
+ if (input2.rowIndex != null)
163782
+ throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: rowIndex must not be provided when target is a row node. Either pass a table nodeId with rowIndex, or pass a row nodeId without rowIndex.`);
163783
+ const tableCandidate = findParentTable(getBlockIndex(editor), candidate);
162184
163784
  if (!tableCandidate)
162185
163785
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: parent table for row was not found.`);
162186
163786
  const rowIdx = getRowIndex(tableCandidate, candidate.pos);
@@ -162194,16 +163794,17 @@ function resolveRowLocator(editor, input2, operationName) {
162194
163794
  rowIndex: rowIdx
162195
163795
  };
162196
163796
  }
162197
- if (!hasTableScope)
162198
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: requires either a row target/nodeId or tableTarget/tableNodeId + rowIndex.`);
162199
- const tableLocator = {};
162200
- if (input2.tableTarget != null)
162201
- tableLocator.target = input2.tableTarget;
162202
- if (input2.tableNodeId != null)
162203
- tableLocator.nodeId = input2.tableNodeId;
162204
- const table2 = resolveTableLocator(editor, tableLocator, operationName);
163797
+ if (candidate.nodeType !== "table")
163798
+ throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: target resolved to "${candidate.nodeType}", expected "table" or "tableRow".`, {
163799
+ actualNodeType: candidate.nodeType,
163800
+ nodeId: candidate.nodeId
163801
+ });
163802
+ const table2 = {
163803
+ candidate,
163804
+ address: toBlockAddress(candidate)
163805
+ };
162205
163806
  if (input2.rowIndex == null)
162206
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: rowIndex is required when using table-scoped locator.`);
163807
+ throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: rowIndex is required when target is a table.`);
162207
163808
  const rowCount = table2.candidate.node.childCount;
162208
163809
  if (input2.rowIndex < 0 || input2.rowIndex >= rowCount)
162209
163810
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: rowIndex ${input2.rowIndex} is out of range (table has ${rowCount} rows).`);
@@ -162231,26 +163832,13 @@ function getRowIndex(tableCandidate, rowPos) {
162231
163832
  return 0;
162232
163833
  }
162233
163834
  function resolveCellLocator(editor, locator, operationName) {
162234
- const hasTarget = locator.target != null;
162235
- const hasNodeId = locator.nodeId != null;
162236
- if (hasTarget && hasNodeId)
162237
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: cannot combine target and nodeId. Use exactly one locator mode.`);
162238
- if (!hasTarget && !hasNodeId)
162239
- throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: requires either target or nodeId.`);
162240
- const index2 = getBlockIndex(editor);
162241
- let candidate;
162242
- if (hasTarget)
162243
- candidate = findBlockById(index2, locator.target);
162244
- else
162245
- candidate = findBlockByNodeIdOnly(index2, locator.nodeId);
162246
- if (!candidate)
162247
- throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: cell target was not found.`, { target: hasTarget ? locator.target : locator.nodeId });
163835
+ const candidate = resolveLocatorToCandidate(editor, locator, operationName);
162248
163836
  if (candidate.nodeType !== "tableCell")
162249
163837
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: target resolved to "${candidate.nodeType}", expected "tableCell".`, {
162250
163838
  actualNodeType: candidate.nodeType,
162251
163839
  nodeId: candidate.nodeId
162252
163840
  });
162253
- const tableCandidate = findLastCandidate(index2.candidates, (c) => c.nodeType === "table" && c.pos < candidate.pos && c.end >= candidate.end);
163841
+ const tableCandidate = findLastCandidate(getBlockIndex(editor).candidates, (c) => c.nodeType === "table" && c.pos < candidate.pos && c.end >= candidate.end);
162254
163842
  if (!tableCandidate)
162255
163843
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: parent table for cell was not found.`);
162256
163844
  const map$12 = TableMap.get(tableCandidate.node);
@@ -162270,12 +163858,7 @@ function resolveCellLocator(editor, locator, operationName) {
162270
163858
  };
162271
163859
  }
162272
163860
  function resolveMergeRangeLocator(editor, input2, operationName) {
162273
- const tableLocator = {};
162274
- if (input2.tableTarget != null)
162275
- tableLocator.target = input2.tableTarget;
162276
- if (input2.tableNodeId != null)
162277
- tableLocator.nodeId = input2.tableNodeId;
162278
- const table2 = resolveTableLocator(editor, tableLocator, operationName);
163861
+ const table2 = resolveTableLocator(editor, input2, operationName);
162279
163862
  const map$12 = TableMap.get(table2.candidate.node);
162280
163863
  const startRow = Math.min(input2.start.rowIndex, input2.end.rowIndex);
162281
163864
  const endRow = Math.max(input2.start.rowIndex, input2.end.rowIndex);
@@ -162292,12 +163875,7 @@ function resolveMergeRangeLocator(editor, input2, operationName) {
162292
163875
  };
162293
163876
  }
162294
163877
  function resolveColumnLocator(editor, input2, operationName) {
162295
- const tableLocator = {};
162296
- if (input2.tableTarget != null)
162297
- tableLocator.target = input2.tableTarget;
162298
- if (input2.tableNodeId != null)
162299
- tableLocator.nodeId = input2.tableNodeId;
162300
- const table2 = resolveTableLocator(editor, tableLocator, operationName);
163878
+ const table2 = resolveTableLocator(editor, input2, operationName);
162301
163879
  const columnCount = getTableColumnCount(table2.candidate.node);
162302
163880
  if (input2.columnIndex < 0 || input2.columnIndex >= columnCount)
162303
163881
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: columnIndex ${input2.columnIndex} is out of range (table has ${columnCount} columns).`);
@@ -162984,7 +164562,7 @@ function tablesDeleteAdapter(editor, input2, options) {
162984
164562
  ensureTrackedCapability(editor, { operation: "tables.delete" });
162985
164563
  const { candidate } = resolveTableLocator(editor, input2, "tables.delete");
162986
164564
  if (options?.dryRun)
162987
- return buildTableSuccess(toBlockAddress(candidate));
164565
+ return buildTableSuccess();
162988
164566
  try {
162989
164567
  const tr = editor.state.tr;
162990
164568
  tr.delete(candidate.pos, candidate.end);
@@ -163038,7 +164616,7 @@ function tablesMoveAdapter(editor, input2, options) {
163038
164616
  rejectTrackedMode("tables.move", options);
163039
164617
  const { candidate, address: address2 } = resolveTableLocator(editor, input2, "tables.move");
163040
164618
  if (options?.dryRun)
163041
- return buildTableSuccess(toBlockAddress(candidate));
164619
+ return buildTableSuccess(address2);
163042
164620
  try {
163043
164621
  const tr = editor.state.tr;
163044
164622
  const tableSlice = candidate.node;
@@ -163564,7 +165142,7 @@ function tablesConvertFromTextAdapter(editor, input2, options) {
163564
165142
  if (!candidate)
163565
165143
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "tables.convertFromText: target was not found.");
163566
165144
  if (options?.dryRun)
163567
- return buildTableSuccess(toBlockAddress(candidate));
165145
+ return buildTableSuccess();
163568
165146
  try {
163569
165147
  const tr = editor.state.tr;
163570
165148
  const schema = editor.state.schema;
@@ -164270,7 +165848,16 @@ function resolveTableOrCellTarget(editor, locator, operationName) {
164270
165848
  throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: requires either target or nodeId.`);
164271
165849
  if (!candidate)
164272
165850
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: target was not found.`);
164273
- const scope = candidate.nodeType === "table" ? "table" : candidate.nodeType === "tableCell" ? "cell" : "invalid";
165851
+ if (candidate.nodeType === "tableCell") {
165852
+ const resolvedCell = resolveCellLocator(editor, locator, operationName);
165853
+ return {
165854
+ node: candidate.node,
165855
+ pos: candidate.pos,
165856
+ address: resolvedCell.table.address,
165857
+ scope: "cell"
165858
+ };
165859
+ }
165860
+ const scope = candidate.nodeType === "table" ? "table" : "invalid";
164274
165861
  return {
164275
165862
  node: candidate.node,
164276
165863
  pos: candidate.pos,
@@ -164873,14 +166460,18 @@ function tablesGetCellsAdapter(editor, input2) {
164873
166460
  }
164874
166461
  cells.sort((a2, b$1) => a2.rowIndex - b$1.rowIndex || a2.columnIndex - b$1.columnIndex);
164875
166462
  return {
164876
- tableNodeId: resolved.candidate.nodeId,
166463
+ nodeId: resolved.candidate.nodeId,
166464
+ address: resolved.address,
164877
166465
  cells
164878
166466
  };
164879
166467
  }
164880
166468
  function tablesGetPropertiesAdapter(editor, input2) {
164881
166469
  const resolved = resolveTableLocator(editor, input2, "tables.getProperties");
164882
166470
  const tp = asRecord2(resolved.candidate.node.attrs?.tableProperties) ?? {};
164883
- const result = { nodeId: resolved.candidate.nodeId };
166471
+ const result = {
166472
+ nodeId: resolved.candidate.nodeId,
166473
+ address: resolved.address
166474
+ };
164884
166475
  if (tp.tableStyleId != null)
164885
166476
  result.styleId = String(tp.tableStyleId);
164886
166477
  const alignment$1 = mapJustificationToTableAlignment(tp.justification);
@@ -165155,18 +166746,16 @@ function ensureFormatStepCapabilities(ctx$1, step3) {
165155
166746
  throw planError(trackedIssue.code, trackedIssue.message, step3.id, trackedIssue.details);
165156
166747
  }
165157
166748
  function buildTableInput(op, blockId, args$1) {
165158
- const { target: _target, nodeId: _n, tableTarget: _tableTarget, tableNodeId: _t$1, ...safeArgs } = args$1;
165159
- if (TABLE_SCOPED_OPS.has(op)) {
165160
- if (ROW_OPS.has(op) && safeArgs.rowIndex == null)
165161
- return {
165162
- ...safeArgs,
165163
- nodeId: blockId
165164
- };
166749
+ const { target: _target, nodeId: _n, ...safeArgs } = args$1;
166750
+ if (ROW_TARGETED_TABLE_OPS.has(op) && safeArgs.rowIndex == null)
165165
166751
  return {
165166
166752
  ...safeArgs,
165167
- tableNodeId: blockId
166753
+ target: {
166754
+ kind: "block",
166755
+ nodeType: "tableRow",
166756
+ nodeId: blockId
166757
+ }
165168
166758
  };
165169
- }
165170
166759
  return {
165171
166760
  ...safeArgs,
165172
166761
  nodeId: blockId
@@ -176574,6 +178163,7 @@ function assembleDocumentApiAdapters(editor) {
176574
178163
  registerPartDescriptor(relsPartDescriptor);
176575
178164
  registerPartDescriptor(numberingPartDescriptor);
176576
178165
  const ccAdapter = createContentControlsAdapter(editor);
178166
+ registerSetValueDelegate((ed, input2, options) => listsSetValueWrapper(ed, input2, options));
176577
178167
  return {
176578
178168
  get: { get: (input2) => getAdapter(editor, input2) },
176579
178169
  find: { find: (input2) => sdFindAdapter(editor, input2) },
@@ -176668,7 +178258,14 @@ function assembleDocumentApiAdapters(editor) {
176668
178258
  setLevelTrailingCharacter: (input2, options) => listsSetLevelTrailingCharacterWrapper(editor, input2, options),
176669
178259
  setLevelMarkerFont: (input2, options) => listsSetLevelMarkerFontWrapper(editor, input2, options),
176670
178260
  clearLevelOverrides: (input2, options) => listsClearLevelOverridesWrapper(editor, input2, options),
176671
- setType: (input2, options) => listsSetTypeWrapper(editor, input2, options)
178261
+ setType: (input2, options) => listsSetTypeWrapper(editor, input2, options),
178262
+ getStyle: (input2) => listsGetStyleWrapper(editor, input2),
178263
+ applyStyle: (input2, options) => listsApplyStyleWrapper(editor, input2, options),
178264
+ restartAt: (input2, options) => listsRestartAtWrapper(editor, input2, options),
178265
+ setLevelNumberStyle: (input2, options) => listsSetLevelNumberStyleWrapper(editor, input2, options),
178266
+ setLevelText: (input2, options) => listsSetLevelTextWrapper(editor, input2, options),
178267
+ setLevelStart: (input2, options) => listsSetLevelStartWrapper(editor, input2, options),
178268
+ setLevelLayout: (input2, options) => listsSetLevelLayoutWrapper(editor, input2, options)
176672
178269
  },
176673
178270
  sections: {
176674
178271
  list: (query2) => sectionsListAdapter(editor, query2),
@@ -176901,6 +178498,59 @@ function assembleDocumentApiAdapters(editor) {
176901
178498
  function getDocumentApiAdapters(editor) {
176902
178499
  return assembleDocumentApiAdapters(editor);
176903
178500
  }
178501
+ function selectCurrentPmSelection(editor) {
178502
+ return editor.state.selection;
178503
+ }
178504
+ function selectEffectivePmSelection(editor) {
178505
+ const liveSelection = editor.state.selection;
178506
+ if (!liveSelection.empty)
178507
+ return liveSelection;
178508
+ const preserved = getPreservedSelection(editor.state);
178509
+ if (preserved && !preserved.empty)
178510
+ return preserved;
178511
+ return liveSelection;
178512
+ }
178513
+ function classifyNodeSelection(editor, selection) {
178514
+ const node3 = selection.node;
178515
+ const mappedType = mapBlockNodeType(node3);
178516
+ if (mappedType && EDGE_NODE_TYPES.has(mappedType))
178517
+ return "block-edge";
178518
+ if (node3.isLeaf && node3.isInline) {
178519
+ if (editor.state.doc.resolve(selection.from).parent.inlineContent)
178520
+ return "inline-leaf";
178521
+ }
178522
+ return "reject";
178523
+ }
178524
+ function extractAbsoluteRange(editor, selection) {
178525
+ if ("$anchorCell" in selection)
178526
+ throw new DocumentApiAdapterError("INVALID_CONTEXT", "CellSelection cannot be converted to SelectionTarget. Use table-specific APIs for rectangular table selections.", { selectionType: selection.constructor.name });
178527
+ if (selection instanceof NodeSelection) {
178528
+ if (classifyNodeSelection(editor, selection) === "reject") {
178529
+ const displayType = mapBlockNodeType(selection.node) ?? selection.node.type.name;
178530
+ throw new DocumentApiAdapterError("INVALID_CONTEXT", `NodeSelection for node type "${displayType}" cannot be converted to SelectionTarget.`, {
178531
+ nodeType: displayType,
178532
+ pmNodeType: selection.node.type.name
178533
+ });
178534
+ }
178535
+ }
178536
+ return {
178537
+ absFrom: selection.from,
178538
+ absTo: selection.to
178539
+ };
178540
+ }
178541
+ function resolvePmSelectionToRange(editor, selection) {
178542
+ const { absFrom, absTo } = extractAbsoluteRange(editor, selection);
178543
+ return resolveAbsoluteRange(editor, {
178544
+ absFrom,
178545
+ absTo
178546
+ });
178547
+ }
178548
+ function resolveCurrentEditorSelectionRange(editor) {
178549
+ return resolvePmSelectionToRange(editor, selectCurrentPmSelection(editor));
178550
+ }
178551
+ function resolveEffectiveEditorSelectionRange(editor) {
178552
+ return resolvePmSelectionToRange(editor, selectEffectivePmSelection(editor));
178553
+ }
176904
178554
  function initPartsRuntime(editor) {
176905
178555
  registerPartDescriptor(stylesPartDescriptor);
176906
178556
  registerPartDescriptor(settingsPartDescriptor);
@@ -200586,7 +202236,19 @@ var Node$13 = class Node$14 {
200586
202236
  static create(config2) {
200587
202237
  return new Extension2(config2);
200588
202238
  }
200589
- }, isKeyboardInvocation = (event) => {
202239
+ }, CustomSelectionPluginKey, InclusiveTextSelectionBookmark = class InclusiveTextSelectionBookmark2 {
202240
+ constructor(anchor, head) {
202241
+ this.anchor = anchor;
202242
+ this.head = head;
202243
+ }
202244
+ map(mapping) {
202245
+ const isForward = this.anchor <= this.head;
202246
+ return new InclusiveTextSelectionBookmark2(mapping.map(this.anchor, isForward ? -1 : 1), mapping.map(this.head, isForward ? 1 : -1));
202247
+ }
202248
+ resolve(doc$12) {
202249
+ return TextSelection2.between(doc$12.resolve(this.anchor), doc$12.resolve(this.head));
202250
+ }
202251
+ }, nextHandleId = 1, SelectionHandlePluginKey, isKeyboardInvocation = (event) => {
200590
202252
  return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === undefined) && event.clientX === 0 && event.clientY === 0;
200591
202253
  }, prefersNativeMenu = (event) => {
200592
202254
  if (!event)
@@ -200599,7 +202261,7 @@ var Node$13 = class Node$14 {
200599
202261
  }, DEFAULT_SELECTION_STATE, normalizeSelectionState = (state = {}) => ({
200600
202262
  ...DEFAULT_SELECTION_STATE,
200601
202263
  ...state
200602
- }), CustomSelectionPluginKey, handleClickOutside = (event, editor) => {
202264
+ }), handleClickOutside = (event, editor) => {
200603
202265
  const editorElem = editor?.options?.element;
200604
202266
  if (!editorElem)
200605
202267
  return;
@@ -202848,7 +204510,7 @@ var Node$13 = class Node$14 {
202848
204510
  view.dispatch(tr);
202849
204511
  event.preventDefault();
202850
204512
  return true;
202851
- }, NAVIGATION_KEYS, Editable, EditorFocus, PositionTrackerExtension, global3, browser2, process3, cachedSetTimeout2, cachedClearTimeout2, queue3, draining2 = false, currentQueue2, queueIndex2 = -1, browserExports2, process$1$1, EventEmitter$1 = class {
204513
+ }, NAVIGATION_KEYS, Editable, EditorFocus, PositionTrackerExtension, SelectionHandleExtension, global3, browser2, process3, cachedSetTimeout2, cachedClearTimeout2, queue3, draining2 = false, currentQueue2, queueIndex2 = -1, browserExports2, process$1$1, EventEmitter$1 = class {
202852
204514
  #events = /* @__PURE__ */ new Map;
202853
204515
  on(name, fn) {
202854
204516
  const callbacks = this.#events.get(name);
@@ -206083,7 +207745,7 @@ var Node$13 = class Node$14 {
206083
207745
  return;
206084
207746
  const candidate = run2.pmEnd;
206085
207747
  return typeof candidate === "number" ? candidate : undefined;
206086
- }, engines_exports, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, CSS_NAMED_COLORS, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, DERIVED_ID_LENGTH = 24, groupedCache, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, EMPTY_RESOLUTION, CONTAINER_NODE_TYPES, VALID_EDGE_NODE_TYPES3, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, TEXT_STYLE_CHARACTER_STYLE_ATTR = "styleId", DIRECT_FORMATTING_MARK_NAMES, ALIGNMENT_TO_JUSTIFICATION, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES, DOCX_HEX_ID_LENGTH = 8, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_OPS, TABLE_SCOPED_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, setNestedValue = (target, path2, value) => {
207748
+ }, engines_exports, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, CSS_NAMED_COLORS, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, DERIVED_ID_LENGTH = 24, groupedCache, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, EMPTY_RESOLUTION, CONTAINER_NODE_TYPES, VALID_EDGE_NODE_TYPES3, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, TEXT_STYLE_CHARACTER_STYLE_ATTR = "styleId", DIRECT_FORMATTING_MARK_NAMES, ALIGNMENT_TO_JUSTIFICATION, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, DOCX_HEX_ID_LENGTH = 8, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, setNestedValue = (target, path2, value) => {
206087
207749
  if (!path2.includes(".")) {
206088
207750
  target[path2] = value;
206089
207751
  return;
@@ -206696,7 +208358,7 @@ var Node$13 = class Node$14 {
206696
208358
  candidate = String(parseInt(hex, 16));
206697
208359
  } while (!candidate || existingIds.has(candidate));
206698
208360
  return candidate;
206699
- }, 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_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, SPECIAL_NOTE_TYPES, FOOTNOTES_PART_ID = "word/footnotes.xml", ENDNOTES_PART_ID = "word/endnotes.xml", FOOTNOTES_CONFIG, ENDNOTES_CONFIG, NOTES_XMLNS, footnotesPartDescriptor, endnotesPartDescriptor, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_TYPES, TOA_LEADER_REVERSE_MAP, 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.20.0", PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
208361
+ }, 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_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, SPECIAL_NOTE_TYPES, FOOTNOTES_PART_ID = "word/footnotes.xml", ENDNOTES_PART_ID = "word/endnotes.xml", FOOTNOTES_CONFIG, ENDNOTES_CONFIG, NOTES_XMLNS, footnotesPartDescriptor, endnotesPartDescriptor, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_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.20.0", PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
206700
208362
  constructor(config2) {
206701
208363
  this.search = config2.search;
206702
208364
  this.caseSensitive = !!config2.caseSensitive;
@@ -218756,6 +220418,7 @@ var Node$13 = class Node$14 {
218756
220418
  mediaFiles: editor.storage.image.media,
218757
220419
  fonts: editor.options.fonts,
218758
220420
  isHeaderOrFooter: true,
220421
+ headerFooterType: type,
218759
220422
  isHeadless: editor.options.isHeadless,
218760
220423
  pagination: false,
218761
220424
  annotations: true,
@@ -225108,9 +226771,9 @@ var Node$13 = class Node$14 {
225108
226771
  return false;
225109
226772
  return Boolean(checker(attrs));
225110
226773
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
225111
- var init_src_B0uLvfdR_es = __esm(() => {
226774
+ var init_src_CZJm5ZTP_es = __esm(() => {
225112
226775
  init_rolldown_runtime_B2q5OVn9_es();
225113
- init_SuperConverter_BcBeadrv_es();
226776
+ init_SuperConverter_DAceeh2o_es();
225114
226777
  init_jszip_ChlR43oI_es();
225115
226778
  init_uuid_qzgm05fK_es();
225116
226779
  init_constants_ep1_Gwqi_es();
@@ -225662,13 +227325,14 @@ ${err.toString()}`);
225662
227325
  }
225663
227326
  }
225664
227327
  };
227328
+ CustomSelectionPluginKey = new PluginKey("CustomSelection");
227329
+ SelectionHandlePluginKey = new PluginKey("selectionHandle");
225665
227330
  DEFAULT_SELECTION_STATE = Object.freeze({
225666
227331
  focused: false,
225667
227332
  preservedSelection: null,
225668
227333
  showVisualSelection: false,
225669
227334
  skipFocusReset: false
225670
227335
  });
225671
- CustomSelectionPluginKey = new PluginKey("CustomSelection");
225672
227336
  CustomSelection = Extension.create({
225673
227337
  name: "customSelection",
225674
227338
  addPmPlugins() {
@@ -226214,6 +227878,12 @@ ${err.toString()}`);
226214
227878
  this.storage.tracker = null;
226215
227879
  }
226216
227880
  });
227881
+ SelectionHandleExtension = Extension.create({
227882
+ name: "selectionHandle",
227883
+ addPmPlugins() {
227884
+ return [createSelectionHandlePlugin()];
227885
+ }
227886
+ });
226217
227887
  global3 = globalThis || self;
226218
227888
  browser2 = { exports: {} };
226219
227889
  process3 = browser2.exports = {};
@@ -233087,18 +234757,41 @@ function print() { __p += __j.call(arguments, '') }
233087
234757
  setLevelIndents,
233088
234758
  setLevelTrailingCharacter,
233089
234759
  setLevelMarkerFont,
233090
- hasLevelOverride,
234760
+ setLevelTabStop,
234761
+ setLevelNumberStyle,
234762
+ setLevelText,
234763
+ setLevelStart,
234764
+ setLevelLayout,
234765
+ hasLevelOverride: hasLevelOverride$1,
233091
234766
  clearLevelOverride,
234767
+ materializeLevelFormattingOverride,
233092
234768
  captureTemplate,
233093
234769
  applyTemplateToAbstract,
234770
+ captureEffectiveStyle,
234771
+ isAbstractShared,
234772
+ cloneAbstractIntoNum,
234773
+ cloneAbstractAndNum,
234774
+ copySequenceStateOverrides,
233094
234775
  getPresetTemplate,
233095
234776
  PRESET_TEMPLATES
233096
234777
  };
234778
+ PRESET_KIND_MAP = {
234779
+ decimal: "ordered",
234780
+ decimalParenthesis: "ordered",
234781
+ lowerLetter: "ordered",
234782
+ upperLetter: "ordered",
234783
+ lowerRoman: "ordered",
234784
+ upperRoman: "ordered",
234785
+ disc: "bullet",
234786
+ circle: "bullet",
234787
+ square: "bullet",
234788
+ dash: "bullet"
234789
+ };
233097
234790
  DEFAULT_PRESET_FOR_KIND = {
233098
234791
  ordered: "decimal",
233099
234792
  bullet: "disc"
233100
234793
  };
233101
- EDGE_NODE_TYPES = new Set(SELECTION_EDGE_NODE_TYPES2);
234794
+ EDGE_NODE_TYPES$1 = new Set(SELECTION_EDGE_NODE_TYPES2);
233102
234795
  POINTS_TO_PIXELS = 96 / 72;
233103
234796
  PIXELS_TO_TWIPS = 1440 / 96;
233104
234797
  TABLE_ADAPTER_DISPATCH = {
@@ -233139,22 +234832,12 @@ function print() { __p += __j.call(arguments, '') }
233139
234832
  "tables.setCellSpacing": (e, i4, o) => tablesSetCellSpacingAdapter(e, i4, o),
233140
234833
  "tables.clearCellSpacing": (e, i4, o) => tablesClearCellSpacingAdapter(e, i4, o)
233141
234834
  };
233142
- ROW_OPS = new Set([
234835
+ ROW_TARGETED_TABLE_OPS = new Set([
233143
234836
  "tables.insertRow",
233144
234837
  "tables.deleteRow",
233145
234838
  "tables.setRowHeight",
233146
234839
  "tables.setRowOptions"
233147
234840
  ]);
233148
- TABLE_SCOPED_OPS = new Set([
233149
- "tables.insertRow",
233150
- "tables.deleteRow",
233151
- "tables.setRowHeight",
233152
- "tables.setRowOptions",
233153
- "tables.insertColumn",
233154
- "tables.deleteColumn",
233155
- "tables.setColumnWidth",
233156
- "tables.mergeCells"
233157
- ]);
233158
234841
  stylesPartDescriptor = {
233159
234842
  id: STYLES_PART_ID,
233160
234843
  ensurePart(editor) {
@@ -233496,6 +235179,7 @@ function print() { __p += __j.call(arguments, '') }
233496
235179
  "-": "hyphen",
233497
235180
  _: "underscore"
233498
235181
  };
235182
+ EDGE_NODE_TYPES = new Set(SELECTION_EDGE_NODE_TYPES2);
233499
235183
  contentTypesPartDescriptor = {
233500
235184
  id: CONTENT_TYPES_PART_ID,
233501
235185
  ensurePart() {
@@ -234040,6 +235724,39 @@ function print() { __p += __j.call(arguments, '') }
234040
235724
  this.#documentApi = createDocumentApi2(getDocumentApiAdapters(this));
234041
235725
  return this.#documentApi;
234042
235726
  }
235727
+ #getDefaultSelectionHandleSurface() {
235728
+ const explicitType = this.options.headerFooterType;
235729
+ return explicitType === "header" || explicitType === "footer" ? explicitType : "body";
235730
+ }
235731
+ captureCurrentSelectionHandle(surface) {
235732
+ this.#assertState("ready", "saving");
235733
+ const selection = selectCurrentPmSelection(this);
235734
+ return captureSelectionHandle(this, selection, surface ?? this.#getDefaultSelectionHandleSurface());
235735
+ }
235736
+ captureEffectiveSelectionHandle(surface) {
235737
+ this.#assertState("ready", "saving");
235738
+ const selection = selectEffectivePmSelection(this);
235739
+ return captureSelectionHandle(this, selection, surface ?? this.#getDefaultSelectionHandleSurface());
235740
+ }
235741
+ resolveSelectionHandle(handle3) {
235742
+ this.#assertState("ready", "saving");
235743
+ const selection = resolveHandleToSelection(handle3);
235744
+ if (!selection)
235745
+ return null;
235746
+ return resolvePmSelectionToRange(handle3._owner, selection);
235747
+ }
235748
+ releaseSelectionHandle(handle3) {
235749
+ this.#assertState("ready", "saving");
235750
+ releaseSelectionHandle(handle3);
235751
+ }
235752
+ getCurrentSelectionRange() {
235753
+ this.#assertState("ready", "saving");
235754
+ return resolveCurrentEditorSelectionRange(this);
235755
+ }
235756
+ getEffectiveSelectionRange() {
235757
+ this.#assertState("ready", "saving");
235758
+ return resolveEffectiveEditorSelectionRange(this);
235759
+ }
234043
235760
  get helpers() {
234044
235761
  return this.extensionService.helpers;
234045
235762
  }
@@ -234268,7 +235985,8 @@ function print() { __p += __j.call(arguments, '') }
234268
235985
  Commands,
234269
235986
  EditorFocus,
234270
235987
  Keymap,
234271
- PositionTrackerExtension
235988
+ PositionTrackerExtension,
235989
+ SelectionHandleExtension
234272
235990
  ];
234273
235991
  const externalExtensions = this.options.externalExtensions || [];
234274
235992
  const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension2) => {
@@ -243455,6 +245173,61 @@ function print() { __p += __j.call(arguments, '') }
243455
245173
  return this.#editor;
243456
245174
  return activeHfEditor;
243457
245175
  }
245176
+ #resolveActiveSurface() {
245177
+ const mode = this.#headerFooterSession?.session?.mode ?? "body";
245178
+ if (mode === "header")
245179
+ return "header";
245180
+ if (mode === "footer")
245181
+ return "footer";
245182
+ return "body";
245183
+ }
245184
+ captureCurrentSelectionHandle() {
245185
+ const surface = this.#resolveActiveSurface();
245186
+ return this.getActiveEditor().captureCurrentSelectionHandle(surface);
245187
+ }
245188
+ captureEffectiveSelectionHandle() {
245189
+ const surface = this.#resolveActiveSurface();
245190
+ return this.getActiveEditor().captureEffectiveSelectionHandle(surface);
245191
+ }
245192
+ resolveSelectionHandle(handle3) {
245193
+ const ownerEditor = handle3._owner;
245194
+ const range = ownerEditor.resolveSelectionHandle(handle3);
245195
+ if (!range)
245196
+ return null;
245197
+ return {
245198
+ editor: ownerEditor,
245199
+ doc: ownerEditor.doc,
245200
+ surface: handle3.surface,
245201
+ range
245202
+ };
245203
+ }
245204
+ releaseSelectionHandle(handle3) {
245205
+ handle3._owner.releaseSelectionHandle(handle3);
245206
+ }
245207
+ getCurrentSelectionRange() {
245208
+ return this.getActiveEditor().getCurrentSelectionRange();
245209
+ }
245210
+ getEffectiveSelectionRange() {
245211
+ return this.getActiveEditor().getEffectiveSelectionRange();
245212
+ }
245213
+ getCurrentSelectionContext() {
245214
+ const activeEditor = this.getActiveEditor();
245215
+ return {
245216
+ editor: activeEditor,
245217
+ doc: activeEditor.doc,
245218
+ surface: this.#resolveActiveSurface(),
245219
+ range: activeEditor.getCurrentSelectionRange()
245220
+ };
245221
+ }
245222
+ getEffectiveSelectionContext() {
245223
+ const activeEditor = this.getActiveEditor();
245224
+ return {
245225
+ editor: activeEditor,
245226
+ doc: activeEditor.doc,
245227
+ surface: this.#resolveActiveSurface(),
245228
+ range: activeEditor.getEffectiveSelectionRange()
245229
+ };
245230
+ }
243458
245231
  undo() {
243459
245232
  const editor = this.getActiveEditor();
243460
245233
  if (editor?.commands?.undo)
@@ -258207,8 +259980,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
258207
259980
 
258208
259981
  // ../../packages/superdoc/dist/super-editor.es.js
258209
259982
  var init_super_editor_es = __esm(() => {
258210
- init_src_B0uLvfdR_es();
258211
- init_SuperConverter_BcBeadrv_es();
259983
+ init_src_CZJm5ZTP_es();
259984
+ init_SuperConverter_DAceeh2o_es();
258212
259985
  init_jszip_ChlR43oI_es();
258213
259986
  init_xml_js_BtmJ6bNs_es();
258214
259987
  init_constants_ep1_Gwqi_es();