@superdoc-dev/cli 0.2.0-next.84 → 0.2.0-next.86

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 +2332 -181
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1149,7 +1149,8 @@ var init_operation_definitions = __esm(() => {
1149
1149
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
1150
1150
  }),
1151
1151
  referenceDocPath: `format/${camelToKebab(entry.key)}.mdx`,
1152
- referenceGroup: "format"
1152
+ referenceGroup: "format",
1153
+ skipAsATool: true
1153
1154
  };
1154
1155
  return [operationId, definition];
1155
1156
  }));
@@ -1165,7 +1166,8 @@ var init_operation_definitions = __esm(() => {
1165
1166
  deterministicTargetResolution: false
1166
1167
  }),
1167
1168
  referenceDocPath: "find.mdx",
1168
- referenceGroup: "core"
1169
+ referenceGroup: "core",
1170
+ skipAsATool: true
1169
1171
  },
1170
1172
  getNode: {
1171
1173
  memberPath: "getNode",
@@ -1189,7 +1191,8 @@ var init_operation_definitions = __esm(() => {
1189
1191
  throws: T_NOT_FOUND
1190
1192
  }),
1191
1193
  referenceDocPath: "get-node-by-id.mdx",
1192
- referenceGroup: "core"
1194
+ referenceGroup: "core",
1195
+ essential: true
1193
1196
  },
1194
1197
  getText: {
1195
1198
  memberPath: "getText",
@@ -1198,7 +1201,8 @@ var init_operation_definitions = __esm(() => {
1198
1201
  requiresDocumentContext: true,
1199
1202
  metadata: readOperation(),
1200
1203
  referenceDocPath: "get-text.mdx",
1201
- referenceGroup: "core"
1204
+ referenceGroup: "core",
1205
+ essential: true
1202
1206
  },
1203
1207
  getMarkdown: {
1204
1208
  memberPath: "getMarkdown",
@@ -2473,7 +2477,8 @@ var init_operation_definitions = __esm(() => {
2473
2477
  deterministicTargetResolution: true
2474
2478
  }),
2475
2479
  referenceDocPath: "query/match.mdx",
2476
- referenceGroup: "query"
2480
+ referenceGroup: "query",
2481
+ essential: true
2477
2482
  },
2478
2483
  "mutations.preview": {
2479
2484
  memberPath: "mutations.preview",
@@ -2502,7 +2507,8 @@ var init_operation_definitions = __esm(() => {
2502
2507
  deterministicTargetResolution: true
2503
2508
  }),
2504
2509
  referenceDocPath: "mutations/apply.mdx",
2505
- referenceGroup: "mutations"
2510
+ referenceGroup: "mutations",
2511
+ essential: true
2506
2512
  },
2507
2513
  "capabilities.get": {
2508
2514
  memberPath: "capabilities",
@@ -3323,7 +3329,8 @@ var init_operation_definitions = __esm(() => {
3323
3329
  throws: ["CAPABILITY_UNAVAILABLE"]
3324
3330
  }),
3325
3331
  referenceDocPath: "history/undo.mdx",
3326
- referenceGroup: "history"
3332
+ referenceGroup: "history",
3333
+ essential: true
3327
3334
  },
3328
3335
  "history.redo": {
3329
3336
  memberPath: "history.redo",
@@ -3541,6 +3548,93 @@ var init_operation_definitions = __esm(() => {
3541
3548
  }),
3542
3549
  referenceDocPath: "images/set-z-order.mdx",
3543
3550
  referenceGroup: "images"
3551
+ },
3552
+ "hyperlinks.list": {
3553
+ memberPath: "hyperlinks.list",
3554
+ description: "List all hyperlinks in the document, with optional filtering by href, anchor, or display text.",
3555
+ expectedResult: "Returns a HyperlinksListResult with an array of hyperlink discovery items and pagination metadata.",
3556
+ requiresDocumentContext: true,
3557
+ metadata: readOperation({
3558
+ idempotency: "idempotent"
3559
+ }),
3560
+ referenceDocPath: "hyperlinks/list.mdx",
3561
+ referenceGroup: "hyperlinks"
3562
+ },
3563
+ "hyperlinks.get": {
3564
+ memberPath: "hyperlinks.get",
3565
+ description: "Retrieve details of a specific hyperlink by its inline address.",
3566
+ expectedResult: "Returns a HyperlinkInfo object with the address, destination properties, and display text.",
3567
+ requiresDocumentContext: true,
3568
+ metadata: readOperation({
3569
+ idempotency: "idempotent",
3570
+ throws: ["TARGET_NOT_FOUND", "INVALID_TARGET"]
3571
+ }),
3572
+ referenceDocPath: "hyperlinks/get.mdx",
3573
+ referenceGroup: "hyperlinks"
3574
+ },
3575
+ "hyperlinks.wrap": {
3576
+ memberPath: "hyperlinks.wrap",
3577
+ description: "Wrap an existing text range with a hyperlink.",
3578
+ expectedResult: "Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code on no-op.",
3579
+ requiresDocumentContext: true,
3580
+ metadata: mutationOperation({
3581
+ idempotency: "conditional",
3582
+ supportsDryRun: true,
3583
+ supportsTrackedMode: false,
3584
+ deterministicTargetResolution: true,
3585
+ possibleFailureCodes: ["NO_OP"],
3586
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
3587
+ }),
3588
+ referenceDocPath: "hyperlinks/wrap.mdx",
3589
+ referenceGroup: "hyperlinks"
3590
+ },
3591
+ "hyperlinks.insert": {
3592
+ memberPath: "hyperlinks.insert",
3593
+ description: "Insert new linked text at a target position.",
3594
+ expectedResult: "Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code.",
3595
+ requiresDocumentContext: true,
3596
+ metadata: mutationOperation({
3597
+ idempotency: "non-idempotent",
3598
+ supportsDryRun: true,
3599
+ supportsTrackedMode: false,
3600
+ deterministicTargetResolution: true,
3601
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET"],
3602
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
3603
+ }),
3604
+ referenceDocPath: "hyperlinks/insert.mdx",
3605
+ referenceGroup: "hyperlinks"
3606
+ },
3607
+ "hyperlinks.patch": {
3608
+ memberPath: "hyperlinks.patch",
3609
+ description: "Update hyperlink metadata (destination, tooltip, target, rel) without changing display text.",
3610
+ expectedResult: "Returns a HyperlinkMutationResult with the updated hyperlink address on success, or NO_OP if unchanged.",
3611
+ requiresDocumentContext: true,
3612
+ metadata: mutationOperation({
3613
+ idempotency: "conditional",
3614
+ supportsDryRun: true,
3615
+ supportsTrackedMode: false,
3616
+ deterministicTargetResolution: true,
3617
+ possibleFailureCodes: ["NO_OP"],
3618
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
3619
+ }),
3620
+ referenceDocPath: "hyperlinks/patch.mdx",
3621
+ referenceGroup: "hyperlinks"
3622
+ },
3623
+ "hyperlinks.remove": {
3624
+ memberPath: "hyperlinks.remove",
3625
+ description: "Remove a hyperlink. Mode 'unwrap' preserves display text; 'deleteText' removes the linked content entirely.",
3626
+ expectedResult: "Returns a HyperlinkMutationResult with the removed hyperlink address on success, or a failure code on no-op.",
3627
+ requiresDocumentContext: true,
3628
+ metadata: mutationOperation({
3629
+ idempotency: "conditional",
3630
+ supportsDryRun: true,
3631
+ supportsTrackedMode: false,
3632
+ deterministicTargetResolution: true,
3633
+ possibleFailureCodes: ["NO_OP"],
3634
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
3635
+ }),
3636
+ referenceDocPath: "hyperlinks/remove.mdx",
3637
+ referenceGroup: "hyperlinks"
3544
3638
  }
3545
3639
  };
3546
3640
  OPERATION_IDS = Object.freeze(Object.keys(OPERATION_DEFINITIONS));
@@ -4826,6 +4920,9 @@ function tocEntryMutationResultSchema() {
4826
4920
  oneOf: [tocEntryMutationSuccessSchema, tocEntryMutationFailureSchema]
4827
4921
  };
4828
4922
  }
4923
+ function hyperlinkMutationResultSchema() {
4924
+ return { oneOf: [hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema] };
4925
+ }
4829
4926
  function buildInternalContractSchemas() {
4830
4927
  const operations = { ...operationSchemas };
4831
4928
  for (const operationId of OPERATION_IDS) {
@@ -4845,7 +4942,7 @@ function buildInternalContractSchemas() {
4845
4942
  operations
4846
4943
  };
4847
4944
  }
4848
- 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, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, selectSchema, findInputSchema, findItemDomainSchema, findOutputSchema, 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, insertInputSchema, tableLocatorSchema, _tableScopedRowLocatorSchema, _tableScopedColumnLocatorSchema, mergeRangeLocatorSchema, mixedRowLocatorOneOf, tableCreateLocationSchema, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas, tocMutationFailureCodes, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, operationSchemas;
4945
+ 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, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, selectSchema, findInputSchema, findItemDomainSchema, findOutputSchema, 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, 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, operationSchemas;
4849
4946
  var init_schemas = __esm(() => {
4850
4947
  init_command_catalog();
4851
4948
  init_types2();
@@ -5608,6 +5705,63 @@ var init_schemas = __esm(() => {
5608
5705
  }, ["code", "message"])
5609
5706
  }, ["success", "failure"]);
5610
5707
  tocEntryMutationSuccessSchema = objectSchema({ success: { const: true }, entry: tocEntryAddressSchema() }, ["success", "entry"]);
5708
+ hyperlinkTargetSchema = objectSchema({
5709
+ kind: { const: "inline" },
5710
+ nodeType: { const: "hyperlink" },
5711
+ anchor: ref("InlineAnchor")
5712
+ }, ["kind", "nodeType", "anchor"]);
5713
+ hyperlinkReadPropertiesSchema = objectSchema({
5714
+ href: { type: "string" },
5715
+ anchor: { type: "string" },
5716
+ docLocation: { type: "string" },
5717
+ tooltip: { type: "string" },
5718
+ target: { type: "string" },
5719
+ rel: { type: "string" }
5720
+ });
5721
+ hyperlinkDestinationSchema = objectSchema({
5722
+ href: { type: "string" },
5723
+ anchor: { type: "string" },
5724
+ docLocation: { type: "string" }
5725
+ });
5726
+ hyperlinkSpecSchema = objectSchema({
5727
+ destination: hyperlinkDestinationSchema,
5728
+ tooltip: { type: "string" },
5729
+ target: { type: "string" },
5730
+ rel: { type: "string" }
5731
+ }, ["destination"]);
5732
+ hyperlinkPatchSchema = objectSchema({
5733
+ href: { oneOf: [{ type: "string" }, { type: "null" }] },
5734
+ anchor: { oneOf: [{ type: "string" }, { type: "null" }] },
5735
+ docLocation: { oneOf: [{ type: "string" }, { type: "null" }] },
5736
+ tooltip: { oneOf: [{ type: "string" }, { type: "null" }] },
5737
+ target: { oneOf: [{ type: "string" }, { type: "null" }] },
5738
+ rel: { oneOf: [{ type: "string" }, { type: "null" }] }
5739
+ });
5740
+ hyperlinkDomainSchema = objectSchema({
5741
+ address: hyperlinkTargetSchema,
5742
+ properties: hyperlinkReadPropertiesSchema,
5743
+ text: { type: "string" }
5744
+ }, ["address", "properties"]);
5745
+ hyperlinkMutationSuccessSchema = objectSchema({ success: { const: true }, hyperlink: hyperlinkTargetSchema }, ["success", "hyperlink"]);
5746
+ hyperlinkMutationFailureCodes = [
5747
+ "NO_OP",
5748
+ "INVALID_TARGET",
5749
+ "TARGET_NOT_FOUND",
5750
+ "CAPABILITY_UNAVAILABLE"
5751
+ ];
5752
+ hyperlinkMutationFailureSchema = objectSchema({
5753
+ success: { const: false },
5754
+ failure: objectSchema({
5755
+ code: { enum: [...hyperlinkMutationFailureCodes] },
5756
+ message: { type: "string" },
5757
+ details: { type: "object" }
5758
+ }, ["code", "message"])
5759
+ }, ["success", "failure"]);
5760
+ hyperlinkInfoSchema = objectSchema({
5761
+ address: hyperlinkTargetSchema,
5762
+ properties: hyperlinkReadPropertiesSchema,
5763
+ text: { type: "string" }
5764
+ }, ["address", "properties"]);
5611
5765
  operationSchemas = {
5612
5766
  find: {
5613
5767
  input: findInputSchema,
@@ -6666,42 +6820,148 @@ var init_schemas = __esm(() => {
6666
6820
  return discoveryResultSchema({ oneOf: [textMatchItemSchema, nodeMatchItemSchema] }, queryMatchMetaSchema);
6667
6821
  })()
6668
6822
  },
6669
- "mutations.preview": {
6670
- input: objectSchema({
6671
- expectedRevision: { type: "string" },
6672
- atomic: { const: true },
6673
- changeMode: { enum: ["direct", "tracked"] },
6674
- steps: arraySchema({ type: "object" })
6675
- }, ["atomic", "changeMode", "steps"]),
6676
- output: objectSchema({
6677
- evaluatedRevision: { type: "string" },
6678
- steps: arraySchema({ type: "object" }),
6679
- valid: { type: "boolean" },
6680
- failures: arraySchema({ type: "object" })
6681
- }, ["evaluatedRevision", "steps", "valid"])
6682
- },
6683
- "mutations.apply": {
6684
- input: objectSchema({
6823
+ ...(() => {
6824
+ const selectWhereSchema = objectSchema({
6825
+ by: { const: "select", type: "string" },
6826
+ select: { oneOf: [textSelectorSchema, nodeSelectorSchema] },
6827
+ within: nodeAddressSchema,
6828
+ require: { enum: ["first", "exactlyOne", "all"] }
6829
+ }, ["by", "select", "require"]);
6830
+ const refWhereSchema = objectSchema({
6831
+ by: { const: "ref", type: "string" },
6832
+ ref: { type: "string" },
6833
+ within: nodeAddressSchema
6834
+ }, ["by", "ref"]);
6835
+ const stepWhereSchema = { oneOf: [selectWhereSchema, refWhereSchema] };
6836
+ const insertWhereSchema = objectSchema({
6837
+ by: { const: "select", type: "string" },
6838
+ select: { oneOf: [textSelectorSchema, nodeSelectorSchema] },
6839
+ within: nodeAddressSchema,
6840
+ require: { enum: ["first", "exactlyOne"] }
6841
+ }, ["by", "select", "require"]);
6842
+ const assertWhereSchema = objectSchema({
6843
+ by: { const: "select", type: "string" },
6844
+ select: { oneOf: [textSelectorSchema, nodeSelectorSchema] },
6845
+ within: nodeAddressSchema
6846
+ }, ["by", "select"]);
6847
+ const replacementBlockSchema = objectSchema({ text: { type: "string" } }, ["text"]);
6848
+ const replacementPayloadSchema = {
6849
+ oneOf: [
6850
+ objectSchema({ text: { type: "string" } }, ["text"]),
6851
+ objectSchema({ blocks: arraySchema(replacementBlockSchema) }, ["blocks"])
6852
+ ]
6853
+ };
6854
+ const inlineDirectiveSchema = { enum: [...INLINE_DIRECTIVES] };
6855
+ const setMarksSchema = objectSchema({
6856
+ bold: inlineDirectiveSchema,
6857
+ italic: inlineDirectiveSchema,
6858
+ underline: inlineDirectiveSchema,
6859
+ strike: inlineDirectiveSchema
6860
+ });
6861
+ const inlineStylePolicySchema = objectSchema({
6862
+ mode: { enum: ["preserve", "set", "clear", "merge"], type: "string" },
6863
+ requireUniform: { type: "boolean" },
6864
+ onNonUniform: { enum: ["error", "useLeadingRun", "majority", "union"] },
6865
+ setMarks: setMarksSchema
6866
+ }, ["mode"]);
6867
+ const paragraphStylePolicySchema = objectSchema({
6868
+ mode: { enum: ["preserve", "set", "clear"], type: "string" }
6869
+ }, ["mode"]);
6870
+ const stylePolicySchema = objectSchema({
6871
+ inline: inlineStylePolicySchema,
6872
+ paragraph: paragraphStylePolicySchema
6873
+ }, ["inline"]);
6874
+ const insertStylePolicySchema = objectSchema({
6875
+ inline: objectSchema({
6876
+ mode: { enum: ["inherit", "set", "clear"], type: "string" },
6877
+ setMarks: setMarksSchema
6878
+ }, ["mode"])
6879
+ }, ["inline"]);
6880
+ const textRewriteStepSchema = objectSchema({
6881
+ id: { type: "string" },
6882
+ op: { const: "text.rewrite", type: "string" },
6883
+ where: stepWhereSchema,
6884
+ args: objectSchema({
6885
+ replacement: replacementPayloadSchema,
6886
+ style: stylePolicySchema
6887
+ }, ["replacement"])
6888
+ }, ["id", "op", "where", "args"]);
6889
+ const textInsertStepSchema = objectSchema({
6890
+ id: { type: "string" },
6891
+ op: { const: "text.insert", type: "string" },
6892
+ where: insertWhereSchema,
6893
+ args: objectSchema({
6894
+ position: { enum: ["before", "after"] },
6895
+ content: objectSchema({ text: { type: "string" } }, ["text"]),
6896
+ style: insertStylePolicySchema
6897
+ }, ["position", "content"])
6898
+ }, ["id", "op", "where", "args"]);
6899
+ const textDeleteStepSchema = objectSchema({
6900
+ id: { type: "string" },
6901
+ op: { const: "text.delete", type: "string" },
6902
+ where: stepWhereSchema,
6903
+ args: objectSchema({})
6904
+ }, ["id", "op", "where", "args"]);
6905
+ const formatApplyStepSchema = objectSchema({
6906
+ id: { type: "string" },
6907
+ op: { const: "format.apply", type: "string" },
6908
+ where: stepWhereSchema,
6909
+ args: objectSchema({
6910
+ inline: buildInlineRunPatchSchema()
6911
+ }, ["inline"])
6912
+ }, ["id", "op", "where", "args"]);
6913
+ const assertStepSchema = objectSchema({
6914
+ id: { type: "string" },
6915
+ op: { const: "assert", type: "string" },
6916
+ where: assertWhereSchema,
6917
+ args: objectSchema({
6918
+ expectCount: { type: "number" }
6919
+ }, ["expectCount"])
6920
+ }, ["id", "op", "where", "args"]);
6921
+ const mutationStepSchema = {
6922
+ oneOf: [
6923
+ textRewriteStepSchema,
6924
+ textInsertStepSchema,
6925
+ textDeleteStepSchema,
6926
+ formatApplyStepSchema,
6927
+ assertStepSchema
6928
+ ]
6929
+ };
6930
+ const mutationsInputSchema = objectSchema({
6685
6931
  expectedRevision: { type: "string" },
6686
- atomic: { const: true },
6932
+ atomic: { const: true, type: "boolean" },
6687
6933
  changeMode: { enum: ["direct", "tracked"] },
6688
- steps: arraySchema({ type: "object" })
6689
- }, ["atomic", "changeMode", "steps"]),
6690
- output: objectSchema({
6691
- success: { const: true },
6692
- revision: objectSchema({ before: { type: "string" }, after: { type: "string" } }, ["before", "after"]),
6693
- steps: arraySchema({ type: "object" }),
6694
- trackedChanges: arraySchema({ type: "object" }),
6695
- timing: objectSchema({ totalMs: { type: "number" } }, ["totalMs"])
6696
- }, ["success", "revision", "steps", "timing"]),
6697
- success: objectSchema({
6698
- success: { const: true },
6699
- revision: objectSchema({ before: { type: "string" }, after: { type: "string" } }, ["before", "after"]),
6700
- steps: arraySchema({ type: "object" }),
6701
- timing: objectSchema({ totalMs: { type: "number" } }, ["totalMs"])
6702
- }, ["success", "revision", "steps", "timing"]),
6703
- failure: preApplyFailureResultSchemaFor("mutations.apply")
6704
- },
6934
+ steps: arraySchema(mutationStepSchema)
6935
+ }, ["atomic", "changeMode", "steps"]);
6936
+ return {
6937
+ "mutations.preview": {
6938
+ input: mutationsInputSchema,
6939
+ output: objectSchema({
6940
+ evaluatedRevision: { type: "string" },
6941
+ steps: arraySchema({ type: "object" }),
6942
+ valid: { type: "boolean" },
6943
+ failures: arraySchema({ type: "object" })
6944
+ }, ["evaluatedRevision", "steps", "valid"])
6945
+ },
6946
+ "mutations.apply": {
6947
+ input: mutationsInputSchema,
6948
+ output: objectSchema({
6949
+ success: { const: true },
6950
+ revision: objectSchema({ before: { type: "string" }, after: { type: "string" } }, ["before", "after"]),
6951
+ steps: arraySchema({ type: "object" }),
6952
+ trackedChanges: arraySchema({ type: "object" }),
6953
+ timing: objectSchema({ totalMs: { type: "number" } }, ["totalMs"])
6954
+ }, ["success", "revision", "steps", "timing"]),
6955
+ success: objectSchema({
6956
+ success: { const: true },
6957
+ revision: objectSchema({ before: { type: "string" }, after: { type: "string" } }, ["before", "after"]),
6958
+ steps: arraySchema({ type: "object" }),
6959
+ timing: objectSchema({ totalMs: { type: "number" } }, ["totalMs"])
6960
+ }, ["success", "revision", "steps", "timing"]),
6961
+ failure: preApplyFailureResultSchemaFor("mutations.apply")
6962
+ }
6963
+ };
6964
+ })(),
6705
6965
  "capabilities.get": {
6706
6966
  input: strictEmptyObjectSchema,
6707
6967
  output: capabilitiesOutputSchema
@@ -7652,6 +7912,48 @@ var init_schemas = __esm(() => {
7652
7912
  success: { const: false },
7653
7913
  failure: objectSchema({ code: { type: "string" }, message: { type: "string" } }, ["code", "message"])
7654
7914
  }, ["success", "failure"])
7915
+ },
7916
+ "hyperlinks.list": {
7917
+ input: objectSchema({
7918
+ within: nodeAddressSchema,
7919
+ hrefPattern: { type: "string" },
7920
+ anchor: { type: "string" },
7921
+ textPattern: { type: "string" },
7922
+ limit: { type: "integer" },
7923
+ offset: { type: "integer" }
7924
+ }),
7925
+ output: discoveryResultSchema(hyperlinkDomainSchema)
7926
+ },
7927
+ "hyperlinks.get": {
7928
+ input: objectSchema({ target: hyperlinkTargetSchema }, ["target"]),
7929
+ output: hyperlinkInfoSchema
7930
+ },
7931
+ "hyperlinks.wrap": {
7932
+ input: objectSchema({ target: textAddressSchema, link: hyperlinkSpecSchema }, ["target", "link"]),
7933
+ output: hyperlinkMutationResultSchema(),
7934
+ success: hyperlinkMutationSuccessSchema,
7935
+ failure: hyperlinkMutationFailureSchema
7936
+ },
7937
+ "hyperlinks.insert": {
7938
+ input: objectSchema({ target: textAddressSchema, text: { type: "string" }, link: hyperlinkSpecSchema }, [
7939
+ "text",
7940
+ "link"
7941
+ ]),
7942
+ output: hyperlinkMutationResultSchema(),
7943
+ success: hyperlinkMutationSuccessSchema,
7944
+ failure: hyperlinkMutationFailureSchema
7945
+ },
7946
+ "hyperlinks.patch": {
7947
+ input: objectSchema({ target: hyperlinkTargetSchema, patch: hyperlinkPatchSchema }, ["target", "patch"]),
7948
+ output: hyperlinkMutationResultSchema(),
7949
+ success: hyperlinkMutationSuccessSchema,
7950
+ failure: hyperlinkMutationFailureSchema
7951
+ },
7952
+ "hyperlinks.remove": {
7953
+ input: objectSchema({ target: hyperlinkTargetSchema, mode: { enum: ["unwrap", "deleteText"] } }, ["target"]),
7954
+ output: hyperlinkMutationResultSchema(),
7955
+ success: hyperlinkMutationSuccessSchema,
7956
+ failure: hyperlinkMutationFailureSchema
7655
7957
  }
7656
7958
  };
7657
7959
  });
@@ -7761,6 +8063,11 @@ var init_reference_doc_map = __esm(() => {
7761
8063
  title: "Images",
7762
8064
  description: "Image lifecycle, placement, and wrap configuration.",
7763
8065
  pagePath: "images/index.mdx"
8066
+ },
8067
+ hyperlinks: {
8068
+ title: "Hyperlinks",
8069
+ description: "Hyperlink discovery, creation, and metadata management.",
8070
+ pagePath: "hyperlinks/index.mdx"
7764
8071
  }
7765
8072
  };
7766
8073
  REFERENCE_OPERATION_GROUPS = Object.keys(GROUP_METADATA).map((key) => ({
@@ -8875,7 +9182,13 @@ function buildDispatchTable(api) {
8875
9182
  "images.setWrapDistances": (input, options) => api.images.setWrapDistances(input, options),
8876
9183
  "images.setPosition": (input, options) => api.images.setPosition(input, options),
8877
9184
  "images.setAnchorOptions": (input, options) => api.images.setAnchorOptions(input, options),
8878
- "images.setZOrder": (input, options) => api.images.setZOrder(input, options)
9185
+ "images.setZOrder": (input, options) => api.images.setZOrder(input, options),
9186
+ "hyperlinks.list": (input) => api.hyperlinks.list(input),
9187
+ "hyperlinks.get": (input) => api.hyperlinks.get(input),
9188
+ "hyperlinks.wrap": (input, options) => api.hyperlinks.wrap(input, options),
9189
+ "hyperlinks.insert": (input, options) => api.hyperlinks.insert(input, options),
9190
+ "hyperlinks.patch": (input, options) => api.hyperlinks.patch(input, options),
9191
+ "hyperlinks.remove": (input, options) => api.hyperlinks.remove(input, options)
8879
9192
  };
8880
9193
  }
8881
9194
  var init_invoke = __esm(() => {
@@ -9516,6 +9829,116 @@ var init_toc = __esm(() => {
9516
9829
  init_errors2();
9517
9830
  });
9518
9831
 
9832
+ // ../../packages/document-api/src/hyperlinks/hyperlinks.ts
9833
+ function isHyperlinkTarget(value) {
9834
+ if (!isRecord(value))
9835
+ return false;
9836
+ if (value.kind !== "inline" || value.nodeType !== "hyperlink")
9837
+ return false;
9838
+ const anchor = value.anchor;
9839
+ if (!isRecord(anchor))
9840
+ return false;
9841
+ const start = anchor.start;
9842
+ const end = anchor.end;
9843
+ if (!isRecord(start) || !isRecord(end))
9844
+ return false;
9845
+ return typeof start.blockId === "string" && typeof start.offset === "number" && typeof end.blockId === "string" && typeof end.offset === "number";
9846
+ }
9847
+ function validateHyperlinkTarget(target, operationName) {
9848
+ if (target === undefined || target === null) {
9849
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a target.`);
9850
+ }
9851
+ if (!isHyperlinkTarget(target)) {
9852
+ throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must be a HyperlinkTarget with kind 'inline', nodeType 'hyperlink', and a valid anchor.`, { target });
9853
+ }
9854
+ }
9855
+ function validateDestination(destination, operationName) {
9856
+ if (!isRecord(destination)) {
9857
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a destination object.`);
9858
+ }
9859
+ const hasHref = typeof destination.href === "string" && destination.href.length > 0;
9860
+ const hasAnchor = typeof destination.anchor === "string" && destination.anchor.length > 0;
9861
+ if (!hasHref && !hasAnchor) {
9862
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} destination must have at least one of 'href' or 'anchor'.`);
9863
+ }
9864
+ }
9865
+ function validateHyperlinkSpec(link, operationName) {
9866
+ if (!isRecord(link)) {
9867
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a link specification object.`);
9868
+ }
9869
+ validateDestination(link.destination, operationName);
9870
+ }
9871
+ function validatePatch(patch, operationName) {
9872
+ if (!isRecord(patch)) {
9873
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} requires a patch object.`);
9874
+ }
9875
+ for (const key of Object.keys(patch)) {
9876
+ if (!PATCH_FIELDS.has(key)) {
9877
+ throw new DocumentApiValidationError("INVALID_INPUT", `Unknown field "${key}" on ${operationName} patch. Allowed: ${[...PATCH_FIELDS].join(", ")}.`, { field: key });
9878
+ }
9879
+ }
9880
+ const hasField = Object.keys(patch).some((k) => patch[k] !== undefined);
9881
+ if (!hasField) {
9882
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} patch must set at least one field.`);
9883
+ }
9884
+ for (const key of PATCH_FIELDS) {
9885
+ const val = patch[key];
9886
+ if (val !== undefined && val !== null && typeof val !== "string") {
9887
+ throw new DocumentApiValidationError("INVALID_INPUT", `${operationName} patch.${key} must be a string, null, or omitted.`);
9888
+ }
9889
+ }
9890
+ }
9891
+ function executeHyperlinksList(adapter, query2) {
9892
+ return adapter.list(query2);
9893
+ }
9894
+ function executeHyperlinksGet(adapter, input) {
9895
+ validateHyperlinkTarget(input.target, "hyperlinks.get");
9896
+ return adapter.get(input);
9897
+ }
9898
+ function executeHyperlinksWrap(adapter, input, options) {
9899
+ if (!isTextAddress(input.target)) {
9900
+ throw new DocumentApiValidationError("INVALID_TARGET", "hyperlinks.wrap requires a valid TextAddress target with kind 'text', blockId, and range.");
9901
+ }
9902
+ if (input.target.range.start === input.target.range.end) {
9903
+ throw new DocumentApiValidationError("INVALID_TARGET", "hyperlinks.wrap requires a non-collapsed range (start !== end).");
9904
+ }
9905
+ validateHyperlinkSpec(input.link, "hyperlinks.wrap");
9906
+ return adapter.wrap(input, normalizeMutationOptions(options));
9907
+ }
9908
+ function executeHyperlinksInsert(adapter, input, options) {
9909
+ if (typeof input.text !== "string" || input.text.length === 0) {
9910
+ throw new DocumentApiValidationError("INVALID_INPUT", "hyperlinks.insert requires a non-empty text string.");
9911
+ }
9912
+ if (input.target !== undefined) {
9913
+ if (!isTextAddress(input.target)) {
9914
+ throw new DocumentApiValidationError("INVALID_TARGET", "hyperlinks.insert target (if provided) must be a valid TextAddress with kind 'text', blockId, and range.");
9915
+ }
9916
+ if (input.target.range.start !== input.target.range.end) {
9917
+ throw new DocumentApiValidationError("INVALID_TARGET", "hyperlinks.insert target must be a collapsed range (start === end) indicating the insertion point.");
9918
+ }
9919
+ }
9920
+ validateHyperlinkSpec(input.link, "hyperlinks.insert");
9921
+ return adapter.insert(input, normalizeMutationOptions(options));
9922
+ }
9923
+ function executeHyperlinksPatch(adapter, input, options) {
9924
+ validateHyperlinkTarget(input.target, "hyperlinks.patch");
9925
+ validatePatch(input.patch, "hyperlinks.patch");
9926
+ return adapter.patch(input, normalizeMutationOptions(options));
9927
+ }
9928
+ function executeHyperlinksRemove(adapter, input, options) {
9929
+ validateHyperlinkTarget(input.target, "hyperlinks.remove");
9930
+ if (input.mode !== undefined && input.mode !== "unwrap" && input.mode !== "deleteText") {
9931
+ throw new DocumentApiValidationError("INVALID_INPUT", `hyperlinks.remove mode must be 'unwrap' or 'deleteText', got '${String(input.mode)}'.`);
9932
+ }
9933
+ return adapter.remove(input, normalizeMutationOptions(options));
9934
+ }
9935
+ var PATCH_FIELDS;
9936
+ var init_hyperlinks = __esm(() => {
9937
+ init_errors2();
9938
+ init_validation_primitives();
9939
+ PATCH_FIELDS = new Set(["href", "anchor", "docLocation", "tooltip", "target", "rel"]);
9940
+ });
9941
+
9519
9942
  // ../../packages/document-api/src/lists/lists.types.ts
9520
9943
  var LIST_KINDS, LIST_INSERT_POSITIONS;
9521
9944
  var init_lists_types = __esm(() => {
@@ -10045,6 +10468,26 @@ function createDocumentApi(adapters) {
10045
10468
  return executeTocEditEntry(adapters.toc, input, options);
10046
10469
  }
10047
10470
  },
10471
+ hyperlinks: {
10472
+ list(query2) {
10473
+ return executeHyperlinksList(adapters.hyperlinks, query2);
10474
+ },
10475
+ get(input) {
10476
+ return executeHyperlinksGet(adapters.hyperlinks, input);
10477
+ },
10478
+ wrap(input, options) {
10479
+ return executeHyperlinksWrap(adapters.hyperlinks, input, options);
10480
+ },
10481
+ insert(input, options) {
10482
+ return executeHyperlinksInsert(adapters.hyperlinks, input, options);
10483
+ },
10484
+ patch(input, options) {
10485
+ return executeHyperlinksPatch(adapters.hyperlinks, input, options);
10486
+ },
10487
+ remove(input, options) {
10488
+ return executeHyperlinksRemove(adapters.hyperlinks, input, options);
10489
+ }
10490
+ },
10048
10491
  query: {
10049
10492
  match(input) {
10050
10493
  return adapters.query.match(input);
@@ -10099,6 +10542,7 @@ var init_src = __esm(() => {
10099
10542
  init_sections();
10100
10543
  init_images();
10101
10544
  init_toc();
10545
+ init_hyperlinks();
10102
10546
  init_inline_run_patch();
10103
10547
  init_styles();
10104
10548
  init_paragraphs();
@@ -11323,7 +11767,7 @@ var CLI_ONLY_OPERATION_DEFINITIONS;
11323
11767
  var init_cli_only_operation_definitions = __esm(() => {
11324
11768
  CLI_ONLY_OPERATION_DEFINITIONS = {
11325
11769
  open: {
11326
- category: "lifecycle",
11770
+ category: "session",
11327
11771
  description: "Open a document and create a persistent editing session. Optionally override the document body with contentOverride + overrideType (markdown, html, or text).",
11328
11772
  requiresDocumentContext: false,
11329
11773
  intentName: "open_document",
@@ -11361,7 +11805,7 @@ var init_cli_only_operation_definitions = __esm(() => {
11361
11805
  }
11362
11806
  },
11363
11807
  save: {
11364
- category: "lifecycle",
11808
+ category: "session",
11365
11809
  description: "Save the current session to the original file or a new path.",
11366
11810
  requiresDocumentContext: false,
11367
11811
  intentName: "save_document",
@@ -11400,7 +11844,7 @@ var init_cli_only_operation_definitions = __esm(() => {
11400
11844
  }
11401
11845
  },
11402
11846
  close: {
11403
- category: "lifecycle",
11847
+ category: "session",
11404
11848
  description: "Close the active editing session and clean up resources.",
11405
11849
  requiresDocumentContext: false,
11406
11850
  intentName: "close_document",
@@ -11427,7 +11871,7 @@ var init_cli_only_operation_definitions = __esm(() => {
11427
11871
  }
11428
11872
  },
11429
11873
  status: {
11430
- category: "introspection",
11874
+ category: "session",
11431
11875
  description: "Show the current session status and document metadata.",
11432
11876
  requiresDocumentContext: false,
11433
11877
  intentName: "get_status",
@@ -11451,10 +11895,11 @@ var init_cli_only_operation_definitions = __esm(() => {
11451
11895
  }
11452
11896
  },
11453
11897
  describe: {
11454
- category: "introspection",
11898
+ category: "session",
11455
11899
  description: "List all available CLI operations and contract metadata.",
11456
11900
  requiresDocumentContext: false,
11457
11901
  intentName: "describe_commands",
11902
+ skipAsATool: true,
11458
11903
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
11459
11904
  outputSchema: {
11460
11905
  type: "object",
@@ -11477,11 +11922,12 @@ var init_cli_only_operation_definitions = __esm(() => {
11477
11922
  }
11478
11923
  },
11479
11924
  describeCommand: {
11480
- category: "introspection",
11925
+ category: "session",
11481
11926
  description: "Show detailed metadata for a single CLI operation.",
11482
11927
  requiresDocumentContext: false,
11483
11928
  tokenOverride: ["describe", "command"],
11484
11929
  intentName: "describe_command",
11930
+ skipAsATool: true,
11485
11931
  sdkMetadata: { mutates: false, idempotency: "idempotent", supportsTrackedMode: false, supportsDryRun: false },
11486
11932
  outputSchema: {
11487
11933
  type: "object",
@@ -11626,11 +12072,8 @@ function toDocApiId(cliOpId) {
11626
12072
  function deriveCategoryFromDocApi(docApiId) {
11627
12073
  const group = REFERENCE_GROUP_BY_OP.get(docApiId);
11628
12074
  if (!group)
11629
- return "query";
11630
- if (group === "core" || group === "mutations") {
11631
- return COMMAND_CATALOG[docApiId].mutates ? "mutation" : "query";
11632
- }
11633
- return group;
12075
+ return "core";
12076
+ return REFERENCE_GROUP_TO_CATEGORY[group] ?? "core";
11634
12077
  }
11635
12078
  function cliCategory(cliOpId) {
11636
12079
  const docApiId = toDocApiId(cliOpId);
@@ -11668,7 +12111,7 @@ function cliCommandTokens(cliOpId) {
11668
12111
  return override;
11669
12112
  return stripped.split(".").map(camelToKebab2);
11670
12113
  }
11671
- var CLI_OPERATION_DENYLIST, denySet, CLI_DOC_OPERATIONS, CLI_OPERATION_IDS, REFERENCE_GROUP_BY_OP;
12114
+ var CLI_OPERATION_DENYLIST, denySet, CLI_DOC_OPERATIONS, CLI_OPERATION_IDS, REFERENCE_GROUP_BY_OP, REFERENCE_GROUP_TO_CATEGORY;
11672
12115
  var init_operation_set = __esm(() => {
11673
12116
  init_src();
11674
12117
  init_cli_only_operation_definitions();
@@ -11687,6 +12130,26 @@ var init_operation_set = __esm(() => {
11687
12130
  REFERENCE_GROUP_BY_OP.set(opId, group.key);
11688
12131
  }
11689
12132
  }
12133
+ REFERENCE_GROUP_TO_CATEGORY = {
12134
+ core: "core",
12135
+ mutations: "core",
12136
+ query: "core",
12137
+ blocks: "core",
12138
+ capabilities: "core",
12139
+ format: "format",
12140
+ "format.paragraph": "format",
12141
+ styles: "format",
12142
+ "styles.paragraph": "format",
12143
+ create: "create",
12144
+ tables: "tables",
12145
+ sections: "sections",
12146
+ lists: "lists",
12147
+ comments: "comments",
12148
+ trackChanges: "trackChanges",
12149
+ toc: "toc",
12150
+ images: "images",
12151
+ history: "history"
12152
+ };
11690
12153
  });
11691
12154
 
11692
12155
  // ../../packages/superdoc/dist/chunks/rolldown-runtime-B2q5OVn9.es.js
@@ -32315,7 +32778,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
32315
32778
  emptyOptions2 = {};
32316
32779
  });
32317
32780
 
32318
- // ../../packages/superdoc/dist/chunks/SuperConverter-CejXSSGL.es.js
32781
+ // ../../packages/superdoc/dist/chunks/SuperConverter-C3jSWLmj.es.js
32319
32782
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
32320
32783
  const fieldValue = extension$1.config[field];
32321
32784
  if (typeof fieldValue === "function")
@@ -34104,10 +34567,10 @@ function discoveryItemSchema2(domainProperties, domainRequired = []) {
34104
34567
  ]);
34105
34568
  }
34106
34569
  function possibleFailureCodes2(operationId) {
34107
- return [...COMMAND_CATALOG2[operationId].possibleFailureCodes];
34570
+ return [...COMMAND_CATALOG3[operationId].possibleFailureCodes];
34108
34571
  }
34109
34572
  function preApplyThrowCodes2(operationId) {
34110
- return [...COMMAND_CATALOG2[operationId].throws.preApply];
34573
+ return [...COMMAND_CATALOG3[operationId].throws.preApply];
34111
34574
  }
34112
34575
  function receiptFailureSchemaFor2(operationId) {
34113
34576
  const codes = possibleFailureCodes2(operationId);
@@ -34264,6 +34727,9 @@ function tocEntryInsertionTargetSchema2() {
34264
34727
  function tocEntryMutationResultSchema2() {
34265
34728
  return { oneOf: [tocEntryMutationSuccessSchema2, tocEntryMutationFailureSchema2] };
34266
34729
  }
34730
+ function hyperlinkMutationResultSchema2() {
34731
+ return { oneOf: [hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2] };
34732
+ }
34267
34733
  function step2(opId, domain2, description, options = {}) {
34268
34734
  return {
34269
34735
  opId,
@@ -35087,7 +35553,13 @@ function buildDispatchTable2(api) {
35087
35553
  "images.setWrapDistances": (input, options) => api.images.setWrapDistances(input, options),
35088
35554
  "images.setPosition": (input, options) => api.images.setPosition(input, options),
35089
35555
  "images.setAnchorOptions": (input, options) => api.images.setAnchorOptions(input, options),
35090
- "images.setZOrder": (input, options) => api.images.setZOrder(input, options)
35556
+ "images.setZOrder": (input, options) => api.images.setZOrder(input, options),
35557
+ "hyperlinks.list": (input) => api.hyperlinks.list(input),
35558
+ "hyperlinks.get": (input) => api.hyperlinks.get(input),
35559
+ "hyperlinks.wrap": (input, options) => api.hyperlinks.wrap(input, options),
35560
+ "hyperlinks.insert": (input, options) => api.hyperlinks.insert(input, options),
35561
+ "hyperlinks.patch": (input, options) => api.hyperlinks.patch(input, options),
35562
+ "hyperlinks.remove": (input, options) => api.hyperlinks.remove(input, options)
35091
35563
  };
35092
35564
  }
35093
35565
  function executeHistoryGet2(adapter) {
@@ -35612,6 +36084,91 @@ function executeTocEditEntry2(adapter, input, options) {
35612
36084
  validateTocEntryTarget2(input.target, "toc.editEntry");
35613
36085
  return adapter.editEntry(input, normalizeMutationOptions2(options));
35614
36086
  }
36087
+ function isHyperlinkTarget2(value) {
36088
+ if (!isRecord3(value))
36089
+ return false;
36090
+ if (value.kind !== "inline" || value.nodeType !== "hyperlink")
36091
+ return false;
36092
+ const anchor = value.anchor;
36093
+ if (!isRecord3(anchor))
36094
+ return false;
36095
+ const start = anchor.start;
36096
+ const end = anchor.end;
36097
+ if (!isRecord3(start) || !isRecord3(end))
36098
+ return false;
36099
+ return typeof start.blockId === "string" && typeof start.offset === "number" && typeof end.blockId === "string" && typeof end.offset === "number";
36100
+ }
36101
+ function validateHyperlinkTarget2(target, operationName) {
36102
+ if (target === undefined || target === null)
36103
+ throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} requires a target.`);
36104
+ if (!isHyperlinkTarget2(target))
36105
+ throw new DocumentApiValidationError2("INVALID_TARGET", `${operationName} target must be a HyperlinkTarget with kind 'inline', nodeType 'hyperlink', and a valid anchor.`, { target });
36106
+ }
36107
+ function validateDestination2(destination, operationName) {
36108
+ if (!isRecord3(destination))
36109
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a destination object.`);
36110
+ const hasHref = typeof destination.href === "string" && destination.href.length > 0;
36111
+ const hasAnchor = typeof destination.anchor === "string" && destination.anchor.length > 0;
36112
+ if (!hasHref && !hasAnchor)
36113
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} destination must have at least one of 'href' or 'anchor'.`);
36114
+ }
36115
+ function validateHyperlinkSpec2(link2, operationName) {
36116
+ if (!isRecord3(link2))
36117
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a link specification object.`);
36118
+ validateDestination2(link2.destination, operationName);
36119
+ }
36120
+ function validatePatch2(patch, operationName) {
36121
+ if (!isRecord3(patch))
36122
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} requires a patch object.`);
36123
+ for (const key of Object.keys(patch))
36124
+ if (!PATCH_FIELDS2.has(key))
36125
+ throw new DocumentApiValidationError2("INVALID_INPUT", `Unknown field "${key}" on ${operationName} patch. Allowed: ${[...PATCH_FIELDS2].join(", ")}.`, { field: key });
36126
+ if (!Object.keys(patch).some((k) => patch[k] !== undefined))
36127
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} patch must set at least one field.`);
36128
+ for (const key of PATCH_FIELDS2) {
36129
+ const val = patch[key];
36130
+ if (val !== undefined && val !== null && typeof val !== "string")
36131
+ throw new DocumentApiValidationError2("INVALID_INPUT", `${operationName} patch.${key} must be a string, null, or omitted.`);
36132
+ }
36133
+ }
36134
+ function executeHyperlinksList2(adapter, query2) {
36135
+ return adapter.list(query2);
36136
+ }
36137
+ function executeHyperlinksGet2(adapter, input) {
36138
+ validateHyperlinkTarget2(input.target, "hyperlinks.get");
36139
+ return adapter.get(input);
36140
+ }
36141
+ function executeHyperlinksWrap2(adapter, input, options) {
36142
+ if (!isTextAddress2(input.target))
36143
+ throw new DocumentApiValidationError2("INVALID_TARGET", "hyperlinks.wrap requires a valid TextAddress target with kind 'text', blockId, and range.");
36144
+ if (input.target.range.start === input.target.range.end)
36145
+ throw new DocumentApiValidationError2("INVALID_TARGET", "hyperlinks.wrap requires a non-collapsed range (start !== end).");
36146
+ validateHyperlinkSpec2(input.link, "hyperlinks.wrap");
36147
+ return adapter.wrap(input, normalizeMutationOptions2(options));
36148
+ }
36149
+ function executeHyperlinksInsert2(adapter, input, options) {
36150
+ if (typeof input.text !== "string" || input.text.length === 0)
36151
+ throw new DocumentApiValidationError2("INVALID_INPUT", "hyperlinks.insert requires a non-empty text string.");
36152
+ if (input.target !== undefined) {
36153
+ if (!isTextAddress2(input.target))
36154
+ throw new DocumentApiValidationError2("INVALID_TARGET", "hyperlinks.insert target (if provided) must be a valid TextAddress with kind 'text', blockId, and range.");
36155
+ if (input.target.range.start !== input.target.range.end)
36156
+ throw new DocumentApiValidationError2("INVALID_TARGET", "hyperlinks.insert target must be a collapsed range (start === end) indicating the insertion point.");
36157
+ }
36158
+ validateHyperlinkSpec2(input.link, "hyperlinks.insert");
36159
+ return adapter.insert(input, normalizeMutationOptions2(options));
36160
+ }
36161
+ function executeHyperlinksPatch2(adapter, input, options) {
36162
+ validateHyperlinkTarget2(input.target, "hyperlinks.patch");
36163
+ validatePatch2(input.patch, "hyperlinks.patch");
36164
+ return adapter.patch(input, normalizeMutationOptions2(options));
36165
+ }
36166
+ function executeHyperlinksRemove2(adapter, input, options) {
36167
+ validateHyperlinkTarget2(input.target, "hyperlinks.remove");
36168
+ if (input.mode !== undefined && input.mode !== "unwrap" && input.mode !== "deleteText")
36169
+ throw new DocumentApiValidationError2("INVALID_INPUT", `hyperlinks.remove mode must be 'unwrap' or 'deleteText', got '${String(input.mode)}'.`);
36170
+ return adapter.remove(input, normalizeMutationOptions2(options));
36171
+ }
35615
36172
  function buildFormatInlineAliasApi2(adapter) {
35616
36173
  return Object.fromEntries(INLINE_PROPERTY_REGISTRY2.map((entry) => {
35617
36174
  const key = entry.key;
@@ -36135,6 +36692,26 @@ function createDocumentApi2(adapters) {
36135
36692
  return executeTocEditEntry2(adapters.toc, input, options);
36136
36693
  }
36137
36694
  },
36695
+ hyperlinks: {
36696
+ list(query2) {
36697
+ return executeHyperlinksList2(adapters.hyperlinks, query2);
36698
+ },
36699
+ get(input) {
36700
+ return executeHyperlinksGet2(adapters.hyperlinks, input);
36701
+ },
36702
+ wrap(input, options) {
36703
+ return executeHyperlinksWrap2(adapters.hyperlinks, input, options);
36704
+ },
36705
+ insert(input, options) {
36706
+ return executeHyperlinksInsert2(adapters.hyperlinks, input, options);
36707
+ },
36708
+ patch(input, options) {
36709
+ return executeHyperlinksPatch2(adapters.hyperlinks, input, options);
36710
+ },
36711
+ remove(input, options) {
36712
+ return executeHyperlinksRemove2(adapters.hyperlinks, input, options);
36713
+ }
36714
+ },
36138
36715
  query: { match(input) {
36139
36716
  return adapters.query.match(input);
36140
36717
  } },
@@ -52323,7 +52900,7 @@ var isRegExp = (value) => {
52323
52900
  tracked: false,
52324
52901
  carrier: runAttributeCarrier2(runPropertyKey ?? key),
52325
52902
  schema
52326
- }), 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, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_NOT_FOUND_COMMAND_TRACKED2, T_IMAGE_COMMAND2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS2, OPERATION_DEFINITIONS2, OPERATION_IDS2, COMMAND_CATALOG2, 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_REGISTRY3, 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, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, nodeSummarySchema2, nodeInfoSchema2, matchContextSchema2, unknownNodeDiagnosticSchema2, textSelectorSchema2, nodeSelectorSchema2, findItemDomainSchema2, 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, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, INSERT_INPUT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, REPLACE_INPUT_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TABLE_LOCATOR_OPS2, ROW_LOCATOR_OPS2, COLUMN_LOCATOR_OPS2, MERGE_RANGE_LOCATOR_OPS2, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS2, HEADER_FOOTER_VARIANTS2, 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, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$208) => ({
52903
+ }), 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, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_NOT_FOUND_COMMAND_TRACKED2, T_IMAGE_COMMAND2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, 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_REGISTRY3, 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, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, nodeSummarySchema2, nodeInfoSchema2, matchContextSchema2, unknownNodeDiagnosticSchema2, textSelectorSchema2, nodeSelectorSchema2, findItemDomainSchema2, 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, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, INSERT_INPUT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, REPLACE_INPUT_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TABLE_LOCATOR_OPS2, ROW_LOCATOR_OPS2, COLUMN_LOCATOR_OPS2, MERGE_RANGE_LOCATOR_OPS2, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS2, HEADER_FOOTER_VARIANTS2, 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, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$208) => ({
52327
52904
  handlerName,
52328
52905
  handler: (params) => {
52329
52906
  const { nodes } = params;
@@ -63712,7 +64289,7 @@ var isRegExp = (value) => {
63712
64289
  state.kern = kernNode.attributes["w:val"];
63713
64290
  }
63714
64291
  }, SuperConverter;
63715
- var init_SuperConverter_CejXSSGL_es = __esm(() => {
64292
+ var init_SuperConverter_C3jSWLmj_es = __esm(() => {
63716
64293
  init_rolldown_runtime_B2q5OVn9_es();
63717
64294
  init_jszip_ChlR43oI_es();
63718
64295
  init_xml_js_DLE8mr0n_es();
@@ -66513,7 +67090,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
66513
67090
  ]
66514
67091
  }),
66515
67092
  referenceDocPath: `format/${camelToKebab3(entry.key)}.mdx`,
66516
- referenceGroup: "format"
67093
+ referenceGroup: "format",
67094
+ skipAsATool: true
66517
67095
  }];
66518
67096
  }));
66519
67097
  OPERATION_DEFINITIONS2 = {
@@ -66528,7 +67106,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
66528
67106
  deterministicTargetResolution: false
66529
67107
  }),
66530
67108
  referenceDocPath: "find.mdx",
66531
- referenceGroup: "core"
67109
+ referenceGroup: "core",
67110
+ skipAsATool: true
66532
67111
  },
66533
67112
  getNode: {
66534
67113
  memberPath: "getNode",
@@ -66552,7 +67131,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
66552
67131
  throws: T_NOT_FOUND2
66553
67132
  }),
66554
67133
  referenceDocPath: "get-node-by-id.mdx",
66555
- referenceGroup: "core"
67134
+ referenceGroup: "core",
67135
+ essential: true
66556
67136
  },
66557
67137
  getText: {
66558
67138
  memberPath: "getText",
@@ -66561,7 +67141,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
66561
67141
  requiresDocumentContext: true,
66562
67142
  metadata: readOperation2(),
66563
67143
  referenceDocPath: "get-text.mdx",
66564
- referenceGroup: "core"
67144
+ referenceGroup: "core",
67145
+ essential: true
66565
67146
  },
66566
67147
  getMarkdown: {
66567
67148
  memberPath: "getMarkdown",
@@ -68023,7 +68604,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
68023
68604
  deterministicTargetResolution: true
68024
68605
  }),
68025
68606
  referenceDocPath: "query/match.mdx",
68026
- referenceGroup: "query"
68607
+ referenceGroup: "query",
68608
+ essential: true
68027
68609
  },
68028
68610
  "mutations.preview": {
68029
68611
  memberPath: "mutations.preview",
@@ -68052,7 +68634,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
68052
68634
  deterministicTargetResolution: true
68053
68635
  }),
68054
68636
  referenceDocPath: "mutations/apply.mdx",
68055
- referenceGroup: "mutations"
68637
+ referenceGroup: "mutations",
68638
+ essential: true
68056
68639
  },
68057
68640
  "capabilities.get": {
68058
68641
  memberPath: "capabilities",
@@ -68907,7 +69490,8 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
68907
69490
  throws: ["CAPABILITY_UNAVAILABLE"]
68908
69491
  }),
68909
69492
  referenceDocPath: "history/undo.mdx",
68910
- referenceGroup: "history"
69493
+ referenceGroup: "history",
69494
+ essential: true
68911
69495
  },
68912
69496
  "history.redo": {
68913
69497
  memberPath: "history.redo",
@@ -69128,13 +69712,114 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
69128
69712
  }),
69129
69713
  referenceDocPath: "images/set-z-order.mdx",
69130
69714
  referenceGroup: "images"
69715
+ },
69716
+ "hyperlinks.list": {
69717
+ memberPath: "hyperlinks.list",
69718
+ description: "List all hyperlinks in the document, with optional filtering by href, anchor, or display text.",
69719
+ expectedResult: "Returns a HyperlinksListResult with an array of hyperlink discovery items and pagination metadata.",
69720
+ requiresDocumentContext: true,
69721
+ metadata: readOperation2({ idempotency: "idempotent" }),
69722
+ referenceDocPath: "hyperlinks/list.mdx",
69723
+ referenceGroup: "hyperlinks"
69724
+ },
69725
+ "hyperlinks.get": {
69726
+ memberPath: "hyperlinks.get",
69727
+ description: "Retrieve details of a specific hyperlink by its inline address.",
69728
+ expectedResult: "Returns a HyperlinkInfo object with the address, destination properties, and display text.",
69729
+ requiresDocumentContext: true,
69730
+ metadata: readOperation2({
69731
+ idempotency: "idempotent",
69732
+ throws: ["TARGET_NOT_FOUND", "INVALID_TARGET"]
69733
+ }),
69734
+ referenceDocPath: "hyperlinks/get.mdx",
69735
+ referenceGroup: "hyperlinks"
69736
+ },
69737
+ "hyperlinks.wrap": {
69738
+ memberPath: "hyperlinks.wrap",
69739
+ description: "Wrap an existing text range with a hyperlink.",
69740
+ expectedResult: "Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code on no-op.",
69741
+ requiresDocumentContext: true,
69742
+ metadata: mutationOperation2({
69743
+ idempotency: "conditional",
69744
+ supportsDryRun: true,
69745
+ supportsTrackedMode: false,
69746
+ deterministicTargetResolution: true,
69747
+ possibleFailureCodes: ["NO_OP"],
69748
+ throws: [
69749
+ ...T_NOT_FOUND_CAPABLE2,
69750
+ "INVALID_TARGET",
69751
+ "INVALID_INPUT"
69752
+ ]
69753
+ }),
69754
+ referenceDocPath: "hyperlinks/wrap.mdx",
69755
+ referenceGroup: "hyperlinks"
69756
+ },
69757
+ "hyperlinks.insert": {
69758
+ memberPath: "hyperlinks.insert",
69759
+ description: "Insert new linked text at a target position.",
69760
+ expectedResult: "Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code.",
69761
+ requiresDocumentContext: true,
69762
+ metadata: mutationOperation2({
69763
+ idempotency: "non-idempotent",
69764
+ supportsDryRun: true,
69765
+ supportsTrackedMode: false,
69766
+ deterministicTargetResolution: true,
69767
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET"],
69768
+ throws: [
69769
+ ...T_NOT_FOUND_CAPABLE2,
69770
+ "INVALID_TARGET",
69771
+ "INVALID_INPUT"
69772
+ ]
69773
+ }),
69774
+ referenceDocPath: "hyperlinks/insert.mdx",
69775
+ referenceGroup: "hyperlinks"
69776
+ },
69777
+ "hyperlinks.patch": {
69778
+ memberPath: "hyperlinks.patch",
69779
+ description: "Update hyperlink metadata (destination, tooltip, target, rel) without changing display text.",
69780
+ expectedResult: "Returns a HyperlinkMutationResult with the updated hyperlink address on success, or NO_OP if unchanged.",
69781
+ requiresDocumentContext: true,
69782
+ metadata: mutationOperation2({
69783
+ idempotency: "conditional",
69784
+ supportsDryRun: true,
69785
+ supportsTrackedMode: false,
69786
+ deterministicTargetResolution: true,
69787
+ possibleFailureCodes: ["NO_OP"],
69788
+ throws: [
69789
+ ...T_NOT_FOUND_CAPABLE2,
69790
+ "INVALID_TARGET",
69791
+ "INVALID_INPUT"
69792
+ ]
69793
+ }),
69794
+ referenceDocPath: "hyperlinks/patch.mdx",
69795
+ referenceGroup: "hyperlinks"
69796
+ },
69797
+ "hyperlinks.remove": {
69798
+ memberPath: "hyperlinks.remove",
69799
+ description: "Remove a hyperlink. Mode 'unwrap' preserves display text; 'deleteText' removes the linked content entirely.",
69800
+ expectedResult: "Returns a HyperlinkMutationResult with the removed hyperlink address on success, or a failure code on no-op.",
69801
+ requiresDocumentContext: true,
69802
+ metadata: mutationOperation2({
69803
+ idempotency: "conditional",
69804
+ supportsDryRun: true,
69805
+ supportsTrackedMode: false,
69806
+ deterministicTargetResolution: true,
69807
+ possibleFailureCodes: ["NO_OP"],
69808
+ throws: [
69809
+ ...T_NOT_FOUND_CAPABLE2,
69810
+ "INVALID_TARGET",
69811
+ "INVALID_INPUT"
69812
+ ]
69813
+ }),
69814
+ referenceDocPath: "hyperlinks/remove.mdx",
69815
+ referenceGroup: "hyperlinks"
69131
69816
  }
69132
69817
  };
69133
69818
  OPERATION_IDS2 = Object.freeze(Object.keys(OPERATION_DEFINITIONS2));
69134
69819
  Object.freeze(OPERATION_IDS2.filter((id) => !id.includes(".")));
69135
69820
  Object.freeze(OPERATION_IDS2.filter((id) => id.includes(".")));
69136
- COMMAND_CATALOG2 = projectFromDefinitions2((_id, entry) => entry.metadata);
69137
- OPERATION_IDS2.filter((operationId) => COMMAND_CATALOG2[operationId].mutates);
69821
+ COMMAND_CATALOG3 = projectFromDefinitions2((_id, entry) => entry.metadata);
69822
+ OPERATION_IDS2.filter((operationId) => COMMAND_CATALOG3[operationId].mutates);
69138
69823
  projectFromDefinitions2((_id, entry) => entry.description);
69139
69824
  projectFromDefinitions2((_id, entry) => entry.requiresDocumentContext);
69140
69825
  projectFromDefinitions2((_id, entry) => entry.expectedResult);
@@ -70926,6 +71611,68 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
70926
71611
  success: { const: true },
70927
71612
  entry: tocEntryAddressSchema2()
70928
71613
  }, ["success", "entry"]);
71614
+ hyperlinkTargetSchema2 = objectSchema2({
71615
+ kind: { const: "inline" },
71616
+ nodeType: { const: "hyperlink" },
71617
+ anchor: ref2("InlineAnchor")
71618
+ }, [
71619
+ "kind",
71620
+ "nodeType",
71621
+ "anchor"
71622
+ ]);
71623
+ hyperlinkReadPropertiesSchema2 = objectSchema2({
71624
+ href: { type: "string" },
71625
+ anchor: { type: "string" },
71626
+ docLocation: { type: "string" },
71627
+ tooltip: { type: "string" },
71628
+ target: { type: "string" },
71629
+ rel: { type: "string" }
71630
+ });
71631
+ hyperlinkSpecSchema2 = objectSchema2({
71632
+ destination: objectSchema2({
71633
+ href: { type: "string" },
71634
+ anchor: { type: "string" },
71635
+ docLocation: { type: "string" }
71636
+ }),
71637
+ tooltip: { type: "string" },
71638
+ target: { type: "string" },
71639
+ rel: { type: "string" }
71640
+ }, ["destination"]);
71641
+ hyperlinkPatchSchema2 = objectSchema2({
71642
+ href: { oneOf: [{ type: "string" }, { type: "null" }] },
71643
+ anchor: { oneOf: [{ type: "string" }, { type: "null" }] },
71644
+ docLocation: { oneOf: [{ type: "string" }, { type: "null" }] },
71645
+ tooltip: { oneOf: [{ type: "string" }, { type: "null" }] },
71646
+ target: { oneOf: [{ type: "string" }, { type: "null" }] },
71647
+ rel: { oneOf: [{ type: "string" }, { type: "null" }] }
71648
+ });
71649
+ hyperlinkDomainSchema2 = objectSchema2({
71650
+ address: hyperlinkTargetSchema2,
71651
+ properties: hyperlinkReadPropertiesSchema2,
71652
+ text: { type: "string" }
71653
+ }, ["address", "properties"]);
71654
+ hyperlinkMutationSuccessSchema2 = objectSchema2({
71655
+ success: { const: true },
71656
+ hyperlink: hyperlinkTargetSchema2
71657
+ }, ["success", "hyperlink"]);
71658
+ hyperlinkMutationFailureSchema2 = objectSchema2({
71659
+ success: { const: false },
71660
+ failure: objectSchema2({
71661
+ code: { enum: [...[
71662
+ "NO_OP",
71663
+ "INVALID_TARGET",
71664
+ "TARGET_NOT_FOUND",
71665
+ "CAPABILITY_UNAVAILABLE"
71666
+ ]] },
71667
+ message: { type: "string" },
71668
+ details: { type: "object" }
71669
+ }, ["code", "message"])
71670
+ }, ["success", "failure"]);
71671
+ objectSchema2({
71672
+ address: hyperlinkTargetSchema2,
71673
+ properties: hyperlinkReadPropertiesSchema2,
71674
+ text: { type: "string" }
71675
+ }, ["address", "properties"]);
70929
71676
  objectSchema2({
70930
71677
  nodeId: { type: "string" },
70931
71678
  nodeType: { enum: [...blockNodeTypeValues2] }
@@ -71687,61 +72434,241 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
71687
72434
  ]);
71688
72435
  const queryMatchMetaSchema = objectSchema2({ effectiveResolved: { type: "boolean" } }, ["effectiveResolved"]);
71689
72436
  return discoveryResultSchema2({ oneOf: [textMatchItemSchema, nodeMatchItemSchema] }, queryMatchMetaSchema);
71690
- })(), objectSchema2({
71691
- expectedRevision: { type: "string" },
71692
- atomic: { const: true },
71693
- changeMode: { enum: ["direct", "tracked"] },
71694
- steps: arraySchema2({ type: "object" })
71695
- }, [
71696
- "atomic",
71697
- "changeMode",
71698
- "steps"
71699
- ]), objectSchema2({
71700
- evaluatedRevision: { type: "string" },
71701
- steps: arraySchema2({ type: "object" }),
71702
- valid: { type: "boolean" },
71703
- failures: arraySchema2({ type: "object" })
71704
- }, [
71705
- "evaluatedRevision",
71706
- "steps",
71707
- "valid"
71708
- ]), objectSchema2({
71709
- expectedRevision: { type: "string" },
71710
- atomic: { const: true },
71711
- changeMode: { enum: ["direct", "tracked"] },
71712
- steps: arraySchema2({ type: "object" })
71713
- }, [
71714
- "atomic",
71715
- "changeMode",
71716
- "steps"
71717
- ]), objectSchema2({
71718
- success: { const: true },
71719
- revision: objectSchema2({
71720
- before: { type: "string" },
71721
- after: { type: "string" }
71722
- }, ["before", "after"]),
71723
- steps: arraySchema2({ type: "object" }),
71724
- trackedChanges: arraySchema2({ type: "object" }),
71725
- timing: objectSchema2({ totalMs: { type: "number" } }, ["totalMs"])
71726
- }, [
71727
- "success",
71728
- "revision",
71729
- "steps",
71730
- "timing"
71731
- ]), objectSchema2({
71732
- success: { const: true },
71733
- revision: objectSchema2({
71734
- before: { type: "string" },
71735
- after: { type: "string" }
71736
- }, ["before", "after"]),
71737
- steps: arraySchema2({ type: "object" }),
71738
- timing: objectSchema2({ totalMs: { type: "number" } }, ["totalMs"])
71739
- }, [
71740
- "success",
71741
- "revision",
71742
- "steps",
71743
- "timing"
71744
- ]), preApplyFailureResultSchemaFor2("mutations.apply"), objectSchema2({
72437
+ })(), { ...(() => {
72438
+ const stepWhereSchema = { oneOf: [objectSchema2({
72439
+ by: {
72440
+ const: "select",
72441
+ type: "string"
72442
+ },
72443
+ select: { oneOf: [textSelectorSchema2, nodeSelectorSchema2] },
72444
+ within: nodeAddressSchema2,
72445
+ require: { enum: [
72446
+ "first",
72447
+ "exactlyOne",
72448
+ "all"
72449
+ ] }
72450
+ }, [
72451
+ "by",
72452
+ "select",
72453
+ "require"
72454
+ ]), objectSchema2({
72455
+ by: {
72456
+ const: "ref",
72457
+ type: "string"
72458
+ },
72459
+ ref: { type: "string" },
72460
+ within: nodeAddressSchema2
72461
+ }, ["by", "ref"])] };
72462
+ const insertWhereSchema = objectSchema2({
72463
+ by: {
72464
+ const: "select",
72465
+ type: "string"
72466
+ },
72467
+ select: { oneOf: [textSelectorSchema2, nodeSelectorSchema2] },
72468
+ within: nodeAddressSchema2,
72469
+ require: { enum: ["first", "exactlyOne"] }
72470
+ }, [
72471
+ "by",
72472
+ "select",
72473
+ "require"
72474
+ ]);
72475
+ const assertWhereSchema = objectSchema2({
72476
+ by: {
72477
+ const: "select",
72478
+ type: "string"
72479
+ },
72480
+ select: { oneOf: [textSelectorSchema2, nodeSelectorSchema2] },
72481
+ within: nodeAddressSchema2
72482
+ }, ["by", "select"]);
72483
+ const replacementBlockSchema = objectSchema2({ text: { type: "string" } }, ["text"]);
72484
+ const replacementPayloadSchema = { oneOf: [objectSchema2({ text: { type: "string" } }, ["text"]), objectSchema2({ blocks: arraySchema2(replacementBlockSchema) }, ["blocks"])] };
72485
+ const inlineDirectiveSchema = { enum: [...INLINE_DIRECTIVES2] };
72486
+ const setMarksSchema = objectSchema2({
72487
+ bold: inlineDirectiveSchema,
72488
+ italic: inlineDirectiveSchema,
72489
+ underline: inlineDirectiveSchema,
72490
+ strike: inlineDirectiveSchema
72491
+ });
72492
+ const stylePolicySchema = objectSchema2({
72493
+ inline: objectSchema2({
72494
+ mode: {
72495
+ enum: [
72496
+ "preserve",
72497
+ "set",
72498
+ "clear",
72499
+ "merge"
72500
+ ],
72501
+ type: "string"
72502
+ },
72503
+ requireUniform: { type: "boolean" },
72504
+ onNonUniform: { enum: [
72505
+ "error",
72506
+ "useLeadingRun",
72507
+ "majority",
72508
+ "union"
72509
+ ] },
72510
+ setMarks: setMarksSchema
72511
+ }, ["mode"]),
72512
+ paragraph: objectSchema2({ mode: {
72513
+ enum: [
72514
+ "preserve",
72515
+ "set",
72516
+ "clear"
72517
+ ],
72518
+ type: "string"
72519
+ } }, ["mode"])
72520
+ }, ["inline"]);
72521
+ const insertStylePolicySchema = objectSchema2({ inline: objectSchema2({
72522
+ mode: {
72523
+ enum: [
72524
+ "inherit",
72525
+ "set",
72526
+ "clear"
72527
+ ],
72528
+ type: "string"
72529
+ },
72530
+ setMarks: setMarksSchema
72531
+ }, ["mode"]) }, ["inline"]);
72532
+ const mutationsInputSchema = objectSchema2({
72533
+ expectedRevision: { type: "string" },
72534
+ atomic: {
72535
+ const: true,
72536
+ type: "boolean"
72537
+ },
72538
+ changeMode: { enum: ["direct", "tracked"] },
72539
+ steps: arraySchema2({ oneOf: [
72540
+ objectSchema2({
72541
+ id: { type: "string" },
72542
+ op: {
72543
+ const: "text.rewrite",
72544
+ type: "string"
72545
+ },
72546
+ where: stepWhereSchema,
72547
+ args: objectSchema2({
72548
+ replacement: replacementPayloadSchema,
72549
+ style: stylePolicySchema
72550
+ }, ["replacement"])
72551
+ }, [
72552
+ "id",
72553
+ "op",
72554
+ "where",
72555
+ "args"
72556
+ ]),
72557
+ objectSchema2({
72558
+ id: { type: "string" },
72559
+ op: {
72560
+ const: "text.insert",
72561
+ type: "string"
72562
+ },
72563
+ where: insertWhereSchema,
72564
+ args: objectSchema2({
72565
+ position: { enum: ["before", "after"] },
72566
+ content: objectSchema2({ text: { type: "string" } }, ["text"]),
72567
+ style: insertStylePolicySchema
72568
+ }, ["position", "content"])
72569
+ }, [
72570
+ "id",
72571
+ "op",
72572
+ "where",
72573
+ "args"
72574
+ ]),
72575
+ objectSchema2({
72576
+ id: { type: "string" },
72577
+ op: {
72578
+ const: "text.delete",
72579
+ type: "string"
72580
+ },
72581
+ where: stepWhereSchema,
72582
+ args: objectSchema2({})
72583
+ }, [
72584
+ "id",
72585
+ "op",
72586
+ "where",
72587
+ "args"
72588
+ ]),
72589
+ objectSchema2({
72590
+ id: { type: "string" },
72591
+ op: {
72592
+ const: "format.apply",
72593
+ type: "string"
72594
+ },
72595
+ where: stepWhereSchema,
72596
+ args: objectSchema2({ inline: buildInlineRunPatchSchema2() }, ["inline"])
72597
+ }, [
72598
+ "id",
72599
+ "op",
72600
+ "where",
72601
+ "args"
72602
+ ]),
72603
+ objectSchema2({
72604
+ id: { type: "string" },
72605
+ op: {
72606
+ const: "assert",
72607
+ type: "string"
72608
+ },
72609
+ where: assertWhereSchema,
72610
+ args: objectSchema2({ expectCount: { type: "number" } }, ["expectCount"])
72611
+ }, [
72612
+ "id",
72613
+ "op",
72614
+ "where",
72615
+ "args"
72616
+ ])
72617
+ ] })
72618
+ }, [
72619
+ "atomic",
72620
+ "changeMode",
72621
+ "steps"
72622
+ ]);
72623
+ return {
72624
+ "mutations.preview": {
72625
+ input: mutationsInputSchema,
72626
+ output: objectSchema2({
72627
+ evaluatedRevision: { type: "string" },
72628
+ steps: arraySchema2({ type: "object" }),
72629
+ valid: { type: "boolean" },
72630
+ failures: arraySchema2({ type: "object" })
72631
+ }, [
72632
+ "evaluatedRevision",
72633
+ "steps",
72634
+ "valid"
72635
+ ])
72636
+ },
72637
+ "mutations.apply": {
72638
+ input: mutationsInputSchema,
72639
+ output: objectSchema2({
72640
+ success: { const: true },
72641
+ revision: objectSchema2({
72642
+ before: { type: "string" },
72643
+ after: { type: "string" }
72644
+ }, ["before", "after"]),
72645
+ steps: arraySchema2({ type: "object" }),
72646
+ trackedChanges: arraySchema2({ type: "object" }),
72647
+ timing: objectSchema2({ totalMs: { type: "number" } }, ["totalMs"])
72648
+ }, [
72649
+ "success",
72650
+ "revision",
72651
+ "steps",
72652
+ "timing"
72653
+ ]),
72654
+ success: objectSchema2({
72655
+ success: { const: true },
72656
+ revision: objectSchema2({
72657
+ before: { type: "string" },
72658
+ after: { type: "string" }
72659
+ }, ["before", "after"]),
72660
+ steps: arraySchema2({ type: "object" }),
72661
+ timing: objectSchema2({ totalMs: { type: "number" } }, ["totalMs"])
72662
+ }, [
72663
+ "success",
72664
+ "revision",
72665
+ "steps",
72666
+ "timing"
72667
+ ]),
72668
+ failure: preApplyFailureResultSchemaFor2("mutations.apply")
72669
+ }
72670
+ };
72671
+ })() }, objectSchema2({
71745
72672
  rows: {
71746
72673
  type: "integer",
71747
72674
  minimum: 1
@@ -72689,7 +73616,27 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
72689
73616
  code: { type: "string" },
72690
73617
  message: { type: "string" }
72691
73618
  }, ["code", "message"])
72692
- }, ["success", "failure"]);
73619
+ }, ["success", "failure"]), objectSchema2({
73620
+ within: nodeAddressSchema2,
73621
+ hrefPattern: { type: "string" },
73622
+ anchor: { type: "string" },
73623
+ textPattern: { type: "string" },
73624
+ limit: { type: "integer" },
73625
+ offset: { type: "integer" }
73626
+ }), discoveryResultSchema2(hyperlinkDomainSchema2), objectSchema2({ target: hyperlinkTargetSchema2 }, ["target"]), objectSchema2({
73627
+ target: textAddressSchema2,
73628
+ link: hyperlinkSpecSchema2
73629
+ }, ["target", "link"]), hyperlinkMutationResultSchema2(), objectSchema2({
73630
+ target: textAddressSchema2,
73631
+ text: { type: "string" },
73632
+ link: hyperlinkSpecSchema2
73633
+ }, ["text", "link"]), hyperlinkMutationResultSchema2(), objectSchema2({
73634
+ target: hyperlinkTargetSchema2,
73635
+ patch: hyperlinkPatchSchema2
73636
+ }, ["target", "patch"]), hyperlinkMutationResultSchema2(), objectSchema2({
73637
+ target: hyperlinkTargetSchema2,
73638
+ mode: { enum: ["unwrap", "deleteText"] }
73639
+ }, ["target"]), hyperlinkMutationResultSchema2();
72693
73640
  projectFromDefinitions2((_id, entry) => entry.memberPath);
72694
73641
  [...new Set(OPERATION_IDS2.map((id) => OPERATION_DEFINITIONS2[id].memberPath))];
72695
73642
  projectFromDefinitions2((_id, entry) => entry.referenceDocPath);
@@ -72783,6 +73730,11 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
72783
73730
  title: "Images",
72784
73731
  description: "Image lifecycle, placement, and wrap configuration.",
72785
73732
  pagePath: "images/index.mdx"
73733
+ },
73734
+ hyperlinks: {
73735
+ title: "Hyperlinks",
73736
+ description: "Hyperlink discovery, creation, and metadata management.",
73737
+ pagePath: "hyperlinks/index.mdx"
72786
73738
  }
72787
73739
  };
72788
73740
  Object.keys(GROUP_METADATA2).map((key) => ({
@@ -72991,6 +73943,14 @@ var init_SuperConverter_CejXSSGL_es = __esm(() => {
72991
73943
  "pt",
72992
73944
  "twip"
72993
73945
  ]);
73946
+ PATCH_FIELDS2 = new Set([
73947
+ "href",
73948
+ "anchor",
73949
+ "docLocation",
73950
+ "tooltip",
73951
+ "target",
73952
+ "rel"
73953
+ ]);
72994
73954
  _buffers = /* @__PURE__ */ new Map;
72995
73955
  translator$35 = NodeTranslator.from(createStrictTogglePropertyHandler("w:b", "bold"));
72996
73956
  translator$39 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bCs", "boldCs"));
@@ -119798,9 +120758,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
119798
120758
  init_remark_gfm_z_sDF4ss_es();
119799
120759
  });
119800
120760
 
119801
- // ../../packages/superdoc/dist/chunks/src-D8ccu-r8.es.js
119802
- var exports_src_D8ccu_r8_es = {};
119803
- __export(exports_src_D8ccu_r8_es, {
120761
+ // ../../packages/superdoc/dist/chunks/src-nq0HTKfv.es.js
120762
+ var exports_src_nq0HTKfv_es = {};
120763
+ __export(exports_src_nq0HTKfv_es, {
119804
120764
  zt: () => defineMark,
119805
120765
  z: () => cM,
119806
120766
  yt: () => removeAwarenessStates,
@@ -129030,7 +129990,7 @@ function isCommandBackedAvailability(operationId) {
129030
129990
  function buildOperationCapabilities(editor) {
129031
129991
  const operations = {};
129032
129992
  for (const operationId of OPERATION_IDS2) {
129033
- const metadata = COMMAND_CATALOG2[operationId];
129993
+ const metadata = COMMAND_CATALOG3[operationId];
129034
129994
  const available = isOperationAvailable(editor, operationId);
129035
129995
  const tracked = available && metadata.supportsTrackedMode && hasTrackedModeCapability(editor, operationId);
129036
129996
  const dryRun = metadata.supportsDryRun && available;
@@ -133677,7 +134637,7 @@ function listItemProjectionToInfo(projection, listId) {
133677
134637
  text: projection.text
133678
134638
  };
133679
134639
  }
133680
- function matchesListQuery(projection, query2) {
134640
+ function matchesListQuery$1(projection, query2) {
133681
134641
  if (!query2)
133682
134642
  return true;
133683
134643
  if (query2.kind && projection.kind !== query2.kind)
@@ -133724,7 +134684,7 @@ function listListItems(editor, query2) {
133724
134684
  let total = 0;
133725
134685
  const items = [];
133726
134686
  for (const projection of projections) {
133727
- if (!matchesListQuery(projection, query2))
134687
+ if (!matchesListQuery$1(projection, query2))
133728
134688
  continue;
133729
134689
  const currentIndex = total;
133730
134690
  total += 1;
@@ -141079,7 +142039,7 @@ function dispatchEditorTransaction(editor, tr) {
141079
142039
  }
141080
142040
  throw new Error("No transaction dispatcher available.");
141081
142041
  }
141082
- function receiptApplied$1(receipt2) {
142042
+ function receiptApplied$2(receipt2) {
141083
142043
  return receipt2.steps[0]?.effect === "changed";
141084
142044
  }
141085
142045
  function isTocContentUnchanged(existingNode, newContent) {
@@ -141174,7 +142134,7 @@ function tocConfigureWrapper(editor, input2, options) {
141174
142134
  const shouldRefreshContent = !isTocContentUnchanged(resolved.node, nextContent);
141175
142135
  const command$1 = editor.commands?.setTableOfContentsInstructionById;
141176
142136
  const commandNodeId = resolved.commandNodeId ?? resolved.nodeId;
141177
- if (!receiptApplied$1(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
142137
+ if (!receiptApplied$2(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
141178
142138
  sdBlockId: commandNodeId,
141179
142139
  instruction,
141180
142140
  ...shouldRefreshContent ? { content: nextContent } : {},
@@ -141217,7 +142177,7 @@ function tocUpdateAll(editor, input2, options) {
141217
142177
  if (options?.dryRun)
141218
142178
  return tocSuccess(resolved.nodeId);
141219
142179
  const command$1 = editor.commands?.replaceTableOfContentsContentById;
141220
- return receiptApplied$1(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
142180
+ return receiptApplied$2(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
141221
142181
  sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
141222
142182
  content: content3
141223
142183
  }, options?.expectedRevision) : runTocAction(editor, () => {
@@ -141260,7 +142220,7 @@ function tocUpdatePageNumbers(editor, input2, options) {
141260
142220
  if (options?.dryRun)
141261
142221
  return tocSuccess(resolved.nodeId);
141262
142222
  const command$1 = editor.commands?.replaceTableOfContentsContentById;
141263
- return receiptApplied$1(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
142223
+ return receiptApplied$2(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
141264
142224
  sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
141265
142225
  content: updatedContent
141266
142226
  }, options?.expectedRevision) : runTocAction(editor, () => {
@@ -141327,7 +142287,7 @@ function tocRemoveWrapper(editor, input2, options) {
141327
142287
  if (options?.dryRun)
141328
142288
  return tocSuccess(resolved.nodeId);
141329
142289
  const command$1 = editor.commands?.deleteTableOfContentsById;
141330
- return receiptApplied$1(typeof command$1 === "function" ? runTocCommand(editor, command$1, { sdBlockId: resolved.commandNodeId ?? resolved.nodeId }, options?.expectedRevision) : runTocAction(editor, () => {
142290
+ return receiptApplied$2(typeof command$1 === "function" ? runTocCommand(editor, command$1, { sdBlockId: resolved.commandNodeId ?? resolved.nodeId }, options?.expectedRevision) : runTocAction(editor, () => {
141331
142291
  try {
141332
142292
  const { tr } = editor.state;
141333
142293
  tr.delete(resolved.pos, resolved.pos + resolved.node.nodeSize);
@@ -141358,7 +142318,7 @@ function createTableOfContentsWrapper(editor, input2, options) {
141358
142318
  toc: buildTocAddress("(dry-run)")
141359
142319
  };
141360
142320
  const command$1 = editor.commands?.insertTableOfContentsAt;
141361
- if (!receiptApplied$1(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
142321
+ if (!receiptApplied$2(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
141362
142322
  pos,
141363
142323
  instruction,
141364
142324
  sdBlockId,
@@ -141553,7 +142513,7 @@ function runEntryCommand(editor, command$1, args$1, expectedRevision) {
141553
142513
  const executeCommand = toEntryEditorCommand(command$1);
141554
142514
  return runEntryAction(editor, () => executeCommand(args$1), expectedRevision);
141555
142515
  }
141556
- function receiptApplied(receipt2) {
142516
+ function receiptApplied$1(receipt2) {
141557
142517
  return receipt2.steps[0]?.effect === "changed";
141558
142518
  }
141559
142519
  function tocListEntriesWrapper(editor, query2) {
@@ -141600,7 +142560,7 @@ function tocMarkEntryWrapper(editor, input2, options) {
141600
142560
  const pos = (input2.target.position ?? "end") === "start" ? paragraph2.pos + 1 : paragraph2.pos + paragraph2.node.nodeSize - 1;
141601
142561
  if (options?.dryRun)
141602
142562
  return entrySuccess("(dry-run)");
141603
- if (!receiptApplied(runEntryCommand(editor, command$1, {
142563
+ if (!receiptApplied$1(runEntryCommand(editor, command$1, {
141604
142564
  pos,
141605
142565
  instruction
141606
142566
  }, options?.expectedRevision)))
@@ -141622,7 +142582,7 @@ function tocUnmarkEntryWrapper(editor, input2, options) {
141622
142582
  const resolved = resolveTcEntryTarget(editor.state.doc, input2.target);
141623
142583
  if (options?.dryRun)
141624
142584
  return entrySuccess(resolved.nodeId);
141625
- return receiptApplied(runEntryCommand(editor, command$1, { pos: resolved.pos }, options?.expectedRevision)) ? entrySuccess(resolved.nodeId) : entryFailure("NO_OP", "TC entry removal produced no change.");
142585
+ return receiptApplied$1(runEntryCommand(editor, command$1, { pos: resolved.pos }, options?.expectedRevision)) ? entrySuccess(resolved.nodeId) : entryFailure("NO_OP", "TC entry removal produced no change.");
141626
142586
  }
141627
142587
  function tocEditEntryWrapper(editor, input2, options) {
141628
142588
  rejectTrackedMode("toc.editEntry", options);
@@ -141635,7 +142595,7 @@ function tocEditEntryWrapper(editor, input2, options) {
141635
142595
  return entryFailure("NO_OP", "Edit patch produced no change.");
141636
142596
  if (options?.dryRun)
141637
142597
  return entrySuccess(resolved.nodeId);
141638
- if (!receiptApplied(runEntryCommand(editor, command$1, {
142598
+ if (!receiptApplied$1(runEntryCommand(editor, command$1, {
141639
142599
  pos: resolved.pos,
141640
142600
  instruction: serializeTcInstruction(patched)
141641
142601
  }, options?.expectedRevision)))
@@ -142305,6 +143265,497 @@ function imagesSetZOrderWrapper(editor, input2, options) {
142305
143265
  return buildNoOpResult("Set z-order produced no change.");
142306
143266
  return buildSuccessResult(findImageById(editor, input2.imageId));
142307
143267
  }
143268
+ function getLinkMarkType(editor) {
143269
+ const markType = editor.schema.marks.link;
143270
+ if (!markType)
143271
+ throw new Error("Link mark type is not defined in the editor schema.");
143272
+ return markType;
143273
+ }
143274
+ function dispatchTransaction(editor, tr) {
143275
+ editor.dispatch(tr);
143276
+ }
143277
+ function dispatchIfChanged(editor, tr) {
143278
+ if (!tr.docChanged)
143279
+ return false;
143280
+ dispatchTransaction(editor, tr);
143281
+ return true;
143282
+ }
143283
+ function createRelationshipId(editor, href) {
143284
+ if (editor.options.mode !== "docx")
143285
+ return null;
143286
+ try {
143287
+ return insertNewRelationship(href, "hyperlink", editor);
143288
+ } catch {
143289
+ return null;
143290
+ }
143291
+ }
143292
+ function sanitizeHrefOrThrow(href) {
143293
+ const result = sanitizeHref(href);
143294
+ if (!result)
143295
+ throw Object.assign(/* @__PURE__ */ new Error(`Blocked or invalid href: "${href}"`), { code: "INVALID_INPUT" });
143296
+ return result.href;
143297
+ }
143298
+ function buildMarkAttrs(editor, spec) {
143299
+ const attrs = {};
143300
+ if (spec.href) {
143301
+ attrs.href = sanitizeHrefOrThrow(spec.href);
143302
+ attrs.rId = createRelationshipId(editor, attrs.href);
143303
+ }
143304
+ if (spec.anchor) {
143305
+ attrs.anchor = spec.anchor;
143306
+ if (!spec.href)
143307
+ attrs.href = `#${spec.anchor}`;
143308
+ }
143309
+ if (spec.docLocation)
143310
+ attrs.docLocation = spec.docLocation;
143311
+ if (spec.tooltip)
143312
+ attrs.tooltip = spec.tooltip;
143313
+ if (spec.target)
143314
+ attrs.target = spec.target;
143315
+ if (spec.rel)
143316
+ attrs.rel = spec.rel;
143317
+ return attrs;
143318
+ }
143319
+ function wrapWithLink(editor, from$12, to, spec) {
143320
+ const linkMarkType = getLinkMarkType(editor);
143321
+ const attrs = buildMarkAttrs(editor, spec);
143322
+ const tr = editor.state.tr;
143323
+ tr.addMark(from$12, to, linkMarkType.create(attrs));
143324
+ applyDirectMutationMeta(tr);
143325
+ dispatchTransaction(editor, tr);
143326
+ return true;
143327
+ }
143328
+ function insertLinkedText(editor, pos, text5, spec) {
143329
+ const linkMarkType = getLinkMarkType(editor);
143330
+ const attrs = buildMarkAttrs(editor, spec);
143331
+ const tr = editor.state.tr;
143332
+ const mark2 = linkMarkType.create(attrs);
143333
+ tr.insertText(text5, pos);
143334
+ tr.addMark(pos, pos + text5.length, mark2);
143335
+ applyDirectMutationMeta(tr);
143336
+ dispatchTransaction(editor, tr);
143337
+ return true;
143338
+ }
143339
+ function patchLinkMark(editor, from$12, to, existingMark, patch3) {
143340
+ const linkMarkType = getLinkMarkType(editor);
143341
+ const merged = { ...existingMark.attrs };
143342
+ for (const [key$1, value] of Object.entries(patch3)) {
143343
+ if (value === undefined)
143344
+ continue;
143345
+ if (value === null)
143346
+ merged[key$1] = null;
143347
+ else
143348
+ merged[key$1] = value;
143349
+ }
143350
+ if (typeof patch3.href === "string") {
143351
+ merged.href = sanitizeHrefOrThrow(patch3.href);
143352
+ merged.rId = createRelationshipId(editor, merged.href);
143353
+ }
143354
+ if (patch3.href === null && typeof merged.anchor === "string") {
143355
+ merged.href = `#${merged.anchor}`;
143356
+ merged.rId = null;
143357
+ }
143358
+ if (typeof patch3.anchor === "string" && patch3.href === undefined) {
143359
+ const currentHref = merged.href;
143360
+ if (typeof currentHref === "string" && currentHref.startsWith("#"))
143361
+ merged.href = `#${patch3.anchor}`;
143362
+ }
143363
+ if (patch3.anchor === null && typeof merged.href === "string" && !merged.href.startsWith("#"))
143364
+ merged.anchor = null;
143365
+ const tr = editor.state.tr;
143366
+ tr.removeMark(from$12, to, existingMark);
143367
+ tr.addMark(from$12, to, linkMarkType.create(merged));
143368
+ applyDirectMutationMeta(tr);
143369
+ return dispatchIfChanged(editor, tr);
143370
+ }
143371
+ function unwrapLink(editor, from$12, to) {
143372
+ const linkMarkType = getLinkMarkType(editor);
143373
+ const tr = editor.state.tr;
143374
+ tr.removeMark(from$12, to, linkMarkType);
143375
+ applyDirectMutationMeta(tr);
143376
+ return dispatchIfChanged(editor, tr);
143377
+ }
143378
+ function deleteLinkedText(editor, from$12, to) {
143379
+ const tr = editor.state.tr;
143380
+ tr.delete(from$12, to);
143381
+ applyDirectMutationMeta(tr);
143382
+ dispatchTransaction(editor, tr);
143383
+ return true;
143384
+ }
143385
+ function normalizeReadProperties(attrs) {
143386
+ const rawHref = typeof attrs.href === "string" ? attrs.href : undefined;
143387
+ const rawAnchor = typeof attrs.anchor === "string" ? attrs.anchor : undefined;
143388
+ const rawDocLocation = typeof attrs.docLocation === "string" ? attrs.docLocation : undefined;
143389
+ const rawTooltip = typeof attrs.tooltip === "string" ? attrs.tooltip : undefined;
143390
+ const rawTarget = typeof attrs.target === "string" ? attrs.target : undefined;
143391
+ const rawRel = typeof attrs.rel === "string" ? attrs.rel : undefined;
143392
+ const props = {};
143393
+ let effectiveAnchor = rawAnchor;
143394
+ let effectiveHref = rawHref;
143395
+ if (rawHref && rawHref.startsWith("#")) {
143396
+ const fragment = rawHref.slice(1);
143397
+ if (!rawAnchor) {
143398
+ effectiveAnchor = fragment;
143399
+ effectiveHref = undefined;
143400
+ } else if (rawAnchor === fragment)
143401
+ effectiveHref = undefined;
143402
+ }
143403
+ if (effectiveHref)
143404
+ props.href = effectiveHref;
143405
+ if (effectiveAnchor)
143406
+ props.anchor = effectiveAnchor;
143407
+ if (rawDocLocation)
143408
+ props.docLocation = rawDocLocation;
143409
+ if (rawTooltip)
143410
+ props.tooltip = rawTooltip;
143411
+ if (rawTarget)
143412
+ props.target = rawTarget;
143413
+ if (rawRel)
143414
+ props.rel = rawRel;
143415
+ return props;
143416
+ }
143417
+ function candidateToTarget(candidate) {
143418
+ return {
143419
+ kind: "inline",
143420
+ nodeType: "hyperlink",
143421
+ anchor: candidate.anchor
143422
+ };
143423
+ }
143424
+ function candidateToReadProperties(candidate) {
143425
+ return normalizeReadProperties(candidate.mark?.attrs ?? candidate.attrs ?? {});
143426
+ }
143427
+ function extractDisplayText(editor, candidate) {
143428
+ const doc$2 = editor.state.doc;
143429
+ try {
143430
+ return doc$2.textBetween(candidate.pos, candidate.end, "");
143431
+ } catch {
143432
+ return;
143433
+ }
143434
+ }
143435
+ function candidateToDomain(editor, candidate) {
143436
+ return {
143437
+ address: candidateToTarget(candidate),
143438
+ properties: candidateToReadProperties(candidate),
143439
+ text: extractDisplayText(editor, candidate)
143440
+ };
143441
+ }
143442
+ function encodeInlineRef(anchor) {
143443
+ return `${anchor.start.blockId}:${anchor.start.offset}:${anchor.end.offset}`;
143444
+ }
143445
+ function isInsideTocBlock(editor, pos) {
143446
+ const resolved = editor.state.doc.resolve(pos);
143447
+ for (let depth = resolved.depth;depth > 0; depth--)
143448
+ if (resolved.node(depth).type.name === "tableOfContents")
143449
+ return true;
143450
+ return false;
143451
+ }
143452
+ function rejectIfInsideToc(editor, pos, operationName) {
143453
+ if (isInsideTocBlock(editor, pos))
143454
+ throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: target is inside a TOC block. TOC content is managed by toc.* operations.`);
143455
+ }
143456
+ function findHyperlinkCandidates(editor) {
143457
+ return findInlineByType(buildInlineIndex(editor, getBlockIndex(editor)), "hyperlink");
143458
+ }
143459
+ function resolveHyperlinkCandidate(editor, target) {
143460
+ const candidate = findInlineByAnchor(buildInlineIndex(editor, getBlockIndex(editor)), target);
143461
+ if (!candidate)
143462
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Hyperlink target not found in document.", { target });
143463
+ return candidate;
143464
+ }
143465
+ function resolveCandidateTextRange(editor, candidate, operationName) {
143466
+ const start$1 = candidate.anchor.start;
143467
+ const end$1 = candidate.anchor.end;
143468
+ if (start$1.blockId !== end$1.blockId)
143469
+ throw new DocumentApiAdapterError("INVALID_TARGET", `${operationName}: hyperlink anchor spans multiple blocks.`, { anchor: candidate.anchor });
143470
+ const resolved = resolveTextTarget(editor, {
143471
+ kind: "text",
143472
+ blockId: start$1.blockId,
143473
+ range: {
143474
+ start: start$1.offset,
143475
+ end: end$1.offset
143476
+ }
143477
+ });
143478
+ if (!resolved)
143479
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `${operationName}: hyperlink text range could not be resolved.`, { anchor: candidate.anchor });
143480
+ return resolved;
143481
+ }
143482
+ function hyperlinkSuccess(target) {
143483
+ return {
143484
+ success: true,
143485
+ hyperlink: target
143486
+ };
143487
+ }
143488
+ function hyperlinkFailure(code$1, message) {
143489
+ return {
143490
+ success: false,
143491
+ failure: {
143492
+ code: code$1,
143493
+ message
143494
+ }
143495
+ };
143496
+ }
143497
+ function receiptApplied(receipt2) {
143498
+ return receipt2.steps[0]?.effect === "changed";
143499
+ }
143500
+ function matchesListQuery(candidate, query2, editor) {
143501
+ if (!query2)
143502
+ return true;
143503
+ const props = candidateToReadProperties(candidate);
143504
+ if (query2.hrefPattern && (!props.href || !props.href.includes(query2.hrefPattern)))
143505
+ return false;
143506
+ if (query2.anchor && props.anchor !== query2.anchor)
143507
+ return false;
143508
+ if (query2.textPattern) {
143509
+ const text5 = extractDisplayText(editor, candidate);
143510
+ if (!text5 || !text5.includes(query2.textPattern))
143511
+ return false;
143512
+ }
143513
+ return true;
143514
+ }
143515
+ function hyperlinksListWrapper(editor, query2) {
143516
+ const revision = getRevision(editor);
143517
+ let candidates = findHyperlinkCandidates(editor);
143518
+ if (query2?.within) {
143519
+ const withinResult = resolveWithinScope(getBlockIndex(editor), { within: query2.within }, []);
143520
+ if (!withinResult.ok)
143521
+ candidates = [];
143522
+ else
143523
+ candidates = scopeByRange(candidates, withinResult.range);
143524
+ }
143525
+ const { total, items: paged } = paginate(candidates.filter((c$3) => matchesListQuery(c$3, query2, editor)).map((candidate) => {
143526
+ const domain2 = candidateToDomain(editor, candidate);
143527
+ const ref$1 = encodeInlineRef(candidate.anchor);
143528
+ return buildDiscoveryItem2(ref$1, buildResolvedHandle2(ref$1, "ephemeral", "node"), domain2);
143529
+ }), query2?.offset, query2?.limit);
143530
+ return buildDiscoveryResult2({
143531
+ evaluatedRevision: revision,
143532
+ total,
143533
+ items: paged,
143534
+ page: {
143535
+ limit: query2?.limit ?? total,
143536
+ offset: query2?.offset ?? 0,
143537
+ returned: paged.length
143538
+ }
143539
+ });
143540
+ }
143541
+ function hyperlinksGetWrapper(editor, input2) {
143542
+ const candidate = resolveHyperlinkCandidate(editor, input2.target);
143543
+ return {
143544
+ address: candidateToTarget(candidate),
143545
+ properties: candidateToReadProperties(candidate),
143546
+ text: extractDisplayText(editor, candidate)
143547
+ };
143548
+ }
143549
+ function specFromInput(link2) {
143550
+ return {
143551
+ href: link2.destination.href,
143552
+ anchor: link2.destination.anchor,
143553
+ docLocation: link2.destination.docLocation,
143554
+ tooltip: link2.tooltip,
143555
+ target: link2.target,
143556
+ rel: link2.rel
143557
+ };
143558
+ }
143559
+ function hyperlinksWrapWrapper(editor, input2, options) {
143560
+ rejectTrackedMode("hyperlinks.wrap", options);
143561
+ const resolved = resolveTextTarget(editor, input2.target);
143562
+ if (!resolved)
143563
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "hyperlinks.wrap: text target block not found.", { target: input2.target });
143564
+ rejectIfInsideToc(editor, resolved.from, "hyperlinks.wrap");
143565
+ const overlapping = findInlineByType(buildInlineIndex(editor, getBlockIndex(editor)), "hyperlink").filter((c$3) => c$3.pos < resolved.to && c$3.end > resolved.from);
143566
+ if (overlapping.length > 1)
143567
+ throw new DocumentApiAdapterError("INVALID_TARGET", "hyperlinks.wrap: target range spans multiple existing links.");
143568
+ if (overlapping.length === 1) {
143569
+ const existing = overlapping[0];
143570
+ if (existing.pos === resolved.from && existing.end === resolved.to) {
143571
+ const existingProps = candidateToReadProperties(existing);
143572
+ const spec$1 = specFromInput(input2.link);
143573
+ if (existingProps.href === spec$1.href && existingProps.anchor === spec$1.anchor)
143574
+ return hyperlinkFailure("NO_OP", "Text range is already linked with the same destination.");
143575
+ } else
143576
+ throw new DocumentApiAdapterError("INVALID_TARGET", "hyperlinks.wrap: target range partially overlaps an existing link. Remove the existing link first.");
143577
+ }
143578
+ if (input2.link.destination.href)
143579
+ sanitizeHrefOrThrow(input2.link.destination.href);
143580
+ if (options?.dryRun)
143581
+ return hyperlinkSuccess({
143582
+ kind: "inline",
143583
+ nodeType: "hyperlink",
143584
+ anchor: {
143585
+ start: {
143586
+ blockId: input2.target.blockId,
143587
+ offset: input2.target.range.start
143588
+ },
143589
+ end: {
143590
+ blockId: input2.target.blockId,
143591
+ offset: input2.target.range.end
143592
+ }
143593
+ }
143594
+ });
143595
+ const spec = specFromInput(input2.link);
143596
+ if (!receiptApplied(executeDomainCommand(editor, () => {
143597
+ const result = wrapWithLink(editor, resolved.from, resolved.to, spec);
143598
+ if (result)
143599
+ clearIndexCache(editor);
143600
+ return result;
143601
+ }, { expectedRevision: options?.expectedRevision })))
143602
+ return hyperlinkFailure("NO_OP", "Wrap operation produced no change.");
143603
+ const postCandidate = findHyperlinkAtRange(editor, resolved.from, resolved.to);
143604
+ return hyperlinkSuccess(postCandidate ? candidateToTarget(postCandidate) : {
143605
+ kind: "inline",
143606
+ nodeType: "hyperlink",
143607
+ anchor: {
143608
+ start: {
143609
+ blockId: input2.target.blockId,
143610
+ offset: input2.target.range.start
143611
+ },
143612
+ end: {
143613
+ blockId: input2.target.blockId,
143614
+ offset: input2.target.range.end
143615
+ }
143616
+ }
143617
+ });
143618
+ }
143619
+ function hyperlinksInsertWrapper(editor, input2, options) {
143620
+ rejectTrackedMode("hyperlinks.insert", options);
143621
+ let insertPos;
143622
+ let blockId;
143623
+ let offset$1;
143624
+ let structuralEnd = false;
143625
+ if (input2.target) {
143626
+ const resolved = resolveTextTarget(editor, input2.target);
143627
+ if (!resolved)
143628
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "hyperlinks.insert: text target block not found.", { target: input2.target });
143629
+ rejectIfInsideToc(editor, resolved.from, "hyperlinks.insert");
143630
+ insertPos = resolved.from;
143631
+ blockId = input2.target.blockId;
143632
+ offset$1 = input2.target.range.start;
143633
+ } else {
143634
+ const fallback = resolveDefaultInsertTarget(editor);
143635
+ if (!fallback)
143636
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "hyperlinks.insert: document has no content to insert into.");
143637
+ if (fallback.kind === "text-block") {
143638
+ insertPos = fallback.range.from;
143639
+ blockId = fallback.target.blockId;
143640
+ offset$1 = fallback.target.range.start;
143641
+ } else {
143642
+ insertPos = fallback.insertPos;
143643
+ blockId = "";
143644
+ offset$1 = 0;
143645
+ structuralEnd = true;
143646
+ }
143647
+ }
143648
+ if (input2.link.destination.href)
143649
+ sanitizeHrefOrThrow(input2.link.destination.href);
143650
+ if (options?.dryRun)
143651
+ return hyperlinkSuccess({
143652
+ kind: "inline",
143653
+ nodeType: "hyperlink",
143654
+ anchor: {
143655
+ start: {
143656
+ blockId,
143657
+ offset: offset$1
143658
+ },
143659
+ end: {
143660
+ blockId,
143661
+ offset: offset$1 + input2.text.length
143662
+ }
143663
+ }
143664
+ });
143665
+ const spec = specFromInput(input2.link);
143666
+ if (!receiptApplied(executeDomainCommand(editor, () => {
143667
+ if (structuralEnd) {
143668
+ insertParagraphAtEnd(editor, insertPos, input2.text);
143669
+ clearIndexCache(editor);
143670
+ const textStart = insertPos + 1;
143671
+ const result$1 = wrapWithLink(editor, textStart, textStart + input2.text.length, spec);
143672
+ if (result$1)
143673
+ clearIndexCache(editor);
143674
+ return result$1;
143675
+ }
143676
+ const result = insertLinkedText(editor, insertPos, input2.text, spec);
143677
+ if (result)
143678
+ clearIndexCache(editor);
143679
+ return result;
143680
+ }, { expectedRevision: options?.expectedRevision })))
143681
+ return hyperlinkFailure("NO_OP", "Insert operation produced no change.");
143682
+ const searchFrom = structuralEnd ? insertPos + 1 : insertPos;
143683
+ const postCandidate = findHyperlinkAtRange(editor, searchFrom, searchFrom + input2.text.length);
143684
+ return hyperlinkSuccess(postCandidate ? candidateToTarget(postCandidate) : {
143685
+ kind: "inline",
143686
+ nodeType: "hyperlink",
143687
+ anchor: {
143688
+ start: {
143689
+ blockId,
143690
+ offset: offset$1
143691
+ },
143692
+ end: {
143693
+ blockId,
143694
+ offset: offset$1 + input2.text.length
143695
+ }
143696
+ }
143697
+ });
143698
+ }
143699
+ function hyperlinksPatchWrapper(editor, input2, options) {
143700
+ rejectTrackedMode("hyperlinks.patch", options);
143701
+ const candidate = resolveHyperlinkCandidate(editor, input2.target);
143702
+ const resolvedRange = resolveCandidateTextRange(editor, candidate, "hyperlinks.patch");
143703
+ rejectIfInsideToc(editor, resolvedRange.from, "hyperlinks.patch");
143704
+ const existingMark = candidate.mark;
143705
+ if (!existingMark)
143706
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "hyperlinks.patch: resolved candidate has no mark.");
143707
+ const oldAttrs = existingMark.attrs;
143708
+ const mergedHref = input2.patch.href === undefined ? oldAttrs.href : input2.patch.href;
143709
+ const mergedAnchor = input2.patch.anchor === undefined ? oldAttrs.anchor : input2.patch.anchor;
143710
+ const hasHref = typeof mergedHref === "string" && mergedHref.length > 0;
143711
+ const hasAnchor = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
143712
+ if (!hasHref && !hasAnchor)
143713
+ throw new DocumentApiAdapterError("INVALID_INPUT", "hyperlinks.patch: resulting destination must have at least one of href or anchor.");
143714
+ if (typeof input2.patch.href === "string")
143715
+ sanitizeHrefOrThrow(input2.patch.href);
143716
+ const currentProps = candidateToReadProperties(candidate);
143717
+ if (Object.entries(input2.patch).every(([key$1, value]) => {
143718
+ if (value === undefined)
143719
+ return true;
143720
+ if (value === null)
143721
+ return currentProps[key$1] === undefined;
143722
+ return currentProps[key$1] === value;
143723
+ }))
143724
+ return hyperlinkFailure("NO_OP", "Patch produces no change — all values already match.");
143725
+ if (options?.dryRun)
143726
+ return hyperlinkSuccess(candidateToTarget(candidate));
143727
+ if (!receiptApplied(executeDomainCommand(editor, () => {
143728
+ const result = patchLinkMark(editor, resolvedRange.from, resolvedRange.to, existingMark, input2.patch);
143729
+ if (result)
143730
+ clearIndexCache(editor);
143731
+ return result;
143732
+ }, { expectedRevision: options?.expectedRevision })))
143733
+ return hyperlinkFailure("NO_OP", "Patch operation produced no change.");
143734
+ const postCandidate = findHyperlinkAtRange(editor, resolvedRange.from, resolvedRange.to);
143735
+ return hyperlinkSuccess(postCandidate ? candidateToTarget(postCandidate) : candidateToTarget(candidate));
143736
+ }
143737
+ function hyperlinksRemoveWrapper(editor, input2, options) {
143738
+ rejectTrackedMode("hyperlinks.remove", options);
143739
+ const candidate = resolveHyperlinkCandidate(editor, input2.target);
143740
+ const resolvedRange = resolveCandidateTextRange(editor, candidate, "hyperlinks.remove");
143741
+ rejectIfInsideToc(editor, resolvedRange.from, "hyperlinks.remove");
143742
+ const mode = input2.mode ?? "unwrap";
143743
+ const targetAddress = candidateToTarget(candidate);
143744
+ if (options?.dryRun)
143745
+ return hyperlinkSuccess(targetAddress);
143746
+ if (!receiptApplied(executeDomainCommand(editor, () => {
143747
+ const result = mode === "unwrap" ? unwrapLink(editor, resolvedRange.from, resolvedRange.to) : deleteLinkedText(editor, resolvedRange.from, resolvedRange.to);
143748
+ if (result)
143749
+ clearIndexCache(editor);
143750
+ return result;
143751
+ }, { expectedRevision: options?.expectedRevision })))
143752
+ return hyperlinkFailure("NO_OP", `Remove (${mode}) operation produced no change.`);
143753
+ return hyperlinkSuccess(targetAddress);
143754
+ }
143755
+ function findHyperlinkAtRange(editor, from$12, to) {
143756
+ const hyperlinks = findInlineByType(buildInlineIndex(editor, getBlockIndex(editor)), "hyperlink");
143757
+ return hyperlinks.find((c$3) => c$3.pos >= from$12 - 1 && c$3.pos <= from$12 + 1 && c$3.end >= to - 1 && c$3.end <= to + 1) ?? hyperlinks.find((c$3) => c$3.pos <= from$12 && c$3.end >= to);
143758
+ }
142308
143759
  function assembleDocumentApiAdapters(editor) {
142309
143760
  registerBuiltInExecutors();
142310
143761
  initRevision(editor);
@@ -142487,6 +143938,14 @@ function assembleDocumentApiAdapters(editor) {
142487
143938
  setAnchorOptions: (input2, options) => imagesSetAnchorOptionsWrapper(editor, input2, options),
142488
143939
  setZOrder: (input2, options) => imagesSetZOrderWrapper(editor, input2, options)
142489
143940
  },
143941
+ hyperlinks: {
143942
+ list: (query2) => hyperlinksListWrapper(editor, query2),
143943
+ get: (input2) => hyperlinksGetWrapper(editor, input2),
143944
+ wrap: (input2, options) => hyperlinksWrapWrapper(editor, input2, options),
143945
+ insert: (input2, options) => hyperlinksInsertWrapper(editor, input2, options),
143946
+ patch: (input2, options) => hyperlinksPatchWrapper(editor, input2, options),
143947
+ remove: (input2, options) => hyperlinksRemoveWrapper(editor, input2, options)
143948
+ },
142490
143949
  query: { match: (input2) => queryMatchAdapter(editor, input2) },
142491
143950
  mutations: {
142492
143951
  preview: (input2) => previewPlan(editor, input2),
@@ -172261,15 +173720,15 @@ var Node$13 = class Node$14 {
172261
173720
  return false;
172262
173721
  if ($from.parent.type.name !== "run")
172263
173722
  return false;
172264
- let dispatchTransaction = null;
173723
+ let dispatchTransaction$1 = null;
172265
173724
  if (view?.dispatch)
172266
- dispatchTransaction = view.dispatch.bind(view);
173725
+ dispatchTransaction$1 = view.dispatch.bind(view);
172267
173726
  else if (editor?.dispatch)
172268
- dispatchTransaction = editor.dispatch.bind(editor);
172269
- if (!dispatchTransaction)
173727
+ dispatchTransaction$1 = editor.dispatch.bind(editor);
173728
+ if (!dispatchTransaction$1)
172270
173729
  return false;
172271
173730
  const handled = splitBlockPatch(state, (transaction) => {
172272
- dispatchTransaction(transaction);
173731
+ dispatchTransaction$1(transaction);
172273
173732
  }, editor);
172274
173733
  if (handled)
172275
173734
  tr.setMeta("preventDispatch", true);
@@ -176921,11 +178380,11 @@ var Node$13 = class Node$14 {
176921
178380
  this.eventListenerCleanups = [];
176922
178381
  this.resizeTimeoutId = null;
176923
178382
  }
176924
- attach({ element: element3, state, editorProps = {}, dispatchTransaction, handleClick: handleClick$1 }) {
178383
+ attach({ element: element3, state, editorProps = {}, dispatchTransaction: dispatchTransaction$1, handleClick: handleClick$1 }) {
176925
178384
  this.view?.destroy();
176926
178385
  this.view = new EditorView(element3, {
176927
178386
  ...editorProps && typeof editorProps === "object" ? editorProps : {},
176928
- dispatchTransaction,
178387
+ dispatchTransaction: dispatchTransaction$1,
176929
178388
  state,
176930
178389
  handleClick: handleClick$1
176931
178390
  });
@@ -195789,9 +197248,9 @@ var Node$13 = class Node$14 {
195789
197248
  trackedChanges: context.trackedChanges ?? []
195790
197249
  });
195791
197250
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
195792
- var init_src_D8ccu_r8_es = __esm(() => {
197251
+ var init_src_nq0HTKfv_es = __esm(() => {
195793
197252
  init_rolldown_runtime_B2q5OVn9_es();
195794
- init_SuperConverter_CejXSSGL_es();
197253
+ init_SuperConverter_C3jSWLmj_es();
195795
197254
  init_jszip_ChlR43oI_es();
195796
197255
  init_uuid_qzgm05fK_es();
195797
197256
  init_constants_CMPtQbp7_es();
@@ -196806,9 +198265,9 @@ var init_src_D8ccu_r8_es = __esm(() => {
196806
198265
  cssChecked = /* @__PURE__ */ new WeakMap;
196807
198266
  isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
196808
198267
  EditorView.prototype.dispatch = function(tr) {
196809
- let dispatchTransaction = this._props.dispatchTransaction;
196810
- if (dispatchTransaction)
196811
- dispatchTransaction.call(this, tr);
198268
+ let dispatchTransaction$1 = this._props.dispatchTransaction;
198269
+ if (dispatchTransaction$1)
198270
+ dispatchTransaction$1.call(this, tr);
196812
198271
  else
196813
198272
  this.updateState(this.state.apply(tr));
196814
198273
  };
@@ -204565,7 +206024,7 @@ function print() { __p += __j.call(arguments, '') }
204565
206024
  RELATIONSHIP_ID_PATTERN = /^rId(\d+)$/;
204566
206025
  HEADER_FILE_PATTERN = /^word\/header(\d+)\.xml$/;
204567
206026
  FOOTER_FILE_PATTERN = /^word\/footer(\d+)\.xml$/;
204568
- HISTORY_UNSAFE_OPS = OPERATION_IDS2.filter((id2) => COMMAND_CATALOG2[id2].historyUnsafe === true);
206027
+ HISTORY_UNSAFE_OPS = OPERATION_IDS2.filter((id2) => COMMAND_CATALOG3[id2].historyUnsafe === true);
204569
206028
  SWITCH_PATTERN = /\\([a-z])(?:\s*(?:"([^"]*)"|([^\s\\]+)))?/gi;
204570
206029
  TAB_LEADER_MAP = {
204571
206030
  dot: "dot",
@@ -227473,8 +228932,8 @@ function print() { __p += __j.call(arguments, '') }
227473
228932
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
227474
228933
  };
227475
228934
  stubFalse_default = stubFalse;
227476
- freeExports$2 = typeof exports_src_D8ccu_r8_es == "object" && exports_src_D8ccu_r8_es && !exports_src_D8ccu_r8_es.nodeType && exports_src_D8ccu_r8_es;
227477
- freeModule$2 = freeExports$2 && typeof module_src_D8ccu_r8_es == "object" && module_src_D8ccu_r8_es && !module_src_D8ccu_r8_es.nodeType && module_src_D8ccu_r8_es;
228935
+ freeExports$2 = typeof exports_src_nq0HTKfv_es == "object" && exports_src_nq0HTKfv_es && !exports_src_nq0HTKfv_es.nodeType && exports_src_nq0HTKfv_es;
228936
+ freeModule$2 = freeExports$2 && typeof module_src_nq0HTKfv_es == "object" && module_src_nq0HTKfv_es && !module_src_nq0HTKfv_es.nodeType && module_src_nq0HTKfv_es;
227478
228937
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
227479
228938
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
227480
228939
  typedArrayTags = {};
@@ -227482,8 +228941,8 @@ function print() { __p += __j.call(arguments, '') }
227482
228941
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
227483
228942
  _baseIsTypedArray_default = baseIsTypedArray;
227484
228943
  _baseUnary_default = baseUnary;
227485
- freeExports$1 = typeof exports_src_D8ccu_r8_es == "object" && exports_src_D8ccu_r8_es && !exports_src_D8ccu_r8_es.nodeType && exports_src_D8ccu_r8_es;
227486
- freeModule$1 = freeExports$1 && typeof module_src_D8ccu_r8_es == "object" && module_src_D8ccu_r8_es && !module_src_D8ccu_r8_es.nodeType && module_src_D8ccu_r8_es;
228944
+ freeExports$1 = typeof exports_src_nq0HTKfv_es == "object" && exports_src_nq0HTKfv_es && !exports_src_nq0HTKfv_es.nodeType && exports_src_nq0HTKfv_es;
228945
+ freeModule$1 = freeExports$1 && typeof module_src_nq0HTKfv_es == "object" && module_src_nq0HTKfv_es && !module_src_nq0HTKfv_es.nodeType && module_src_nq0HTKfv_es;
227487
228946
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
227488
228947
  _nodeUtil_default = function() {
227489
228948
  try {
@@ -227588,8 +229047,8 @@ function print() { __p += __j.call(arguments, '') }
227588
229047
  Stack.prototype.has = _stackHas_default;
227589
229048
  Stack.prototype.set = _stackSet_default;
227590
229049
  _Stack_default = Stack;
227591
- freeExports = typeof exports_src_D8ccu_r8_es == "object" && exports_src_D8ccu_r8_es && !exports_src_D8ccu_r8_es.nodeType && exports_src_D8ccu_r8_es;
227592
- freeModule = freeExports && typeof module_src_D8ccu_r8_es == "object" && module_src_D8ccu_r8_es && !module_src_D8ccu_r8_es.nodeType && module_src_D8ccu_r8_es;
229050
+ freeExports = typeof exports_src_nq0HTKfv_es == "object" && exports_src_nq0HTKfv_es && !exports_src_nq0HTKfv_es.nodeType && exports_src_nq0HTKfv_es;
229051
+ freeModule = freeExports && typeof module_src_nq0HTKfv_es == "object" && module_src_nq0HTKfv_es && !module_src_nq0HTKfv_es.nodeType && module_src_nq0HTKfv_es;
227593
229052
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
227594
229053
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
227595
229054
  _cloneBuffer_default = cloneBuffer;
@@ -235669,8 +237128,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
235669
237128
 
235670
237129
  // ../../packages/superdoc/dist/super-editor.es.js
235671
237130
  var init_super_editor_es = __esm(() => {
235672
- init_src_D8ccu_r8_es();
235673
- init_SuperConverter_CejXSSGL_es();
237131
+ init_src_nq0HTKfv_es();
237132
+ init_SuperConverter_C3jSWLmj_es();
235674
237133
  init_jszip_ChlR43oI_es();
235675
237134
  init_xml_js_DLE8mr0n_es();
235676
237135
  init_constants_CMPtQbp7_es();
@@ -255153,7 +256612,152 @@ var init_CommandService = () => {};
255153
256612
  // ../../packages/super-editor/src/core/helpers/getHTMLFromFragment.js
255154
256613
  var init_getHTMLFromFragment = () => {};
255155
256614
  // ../../shared/url-validation/index.js
255156
- var init_url_validation = () => {};
256615
+ function toProtocolSet2(values2) {
256616
+ const result = new Set;
256617
+ if (!values2)
256618
+ return result;
256619
+ values2.forEach((value) => {
256620
+ if (typeof value === "string" && value.trim()) {
256621
+ result.add(value.trim().toLowerCase());
256622
+ }
256623
+ });
256624
+ return result;
256625
+ }
256626
+ function buildAllowedProtocols2(config2 = {}) {
256627
+ const allowed = config2.allowedProtocols?.length ? toProtocolSet2(config2.allowedProtocols) : new Set(DEFAULT_ALLOWED_PROTOCOLS2);
256628
+ const optional = toProtocolSet2(config2.optionalProtocols);
256629
+ if (optional.size > 0) {
256630
+ optional.forEach((protocol) => {
256631
+ if (OPTIONAL_PROTOCOLS2.includes(protocol)) {
256632
+ allowed.add(protocol);
256633
+ }
256634
+ });
256635
+ }
256636
+ return allowed;
256637
+ }
256638
+ function normalizeBlocklist2(values2) {
256639
+ const hosts = new Set;
256640
+ const urls = new Set;
256641
+ if (!values2) {
256642
+ return { hosts, urls };
256643
+ }
256644
+ values2.forEach((entry) => {
256645
+ if (!entry || typeof entry !== "string")
256646
+ return;
256647
+ const trimmed = entry.trim().toLowerCase();
256648
+ if (!trimmed)
256649
+ return;
256650
+ if (trimmed.includes("://")) {
256651
+ urls.add(trimmed);
256652
+ } else {
256653
+ hosts.add(trimmed);
256654
+ }
256655
+ });
256656
+ return { hosts, urls };
256657
+ }
256658
+ function parseAnchorLink2(trimmed) {
256659
+ if (!trimmed.startsWith("#"))
256660
+ return null;
256661
+ const anchor = trimmed.slice(1);
256662
+ if (!anchor || !ANCHOR_NAME_PATTERN2.test(anchor)) {
256663
+ return null;
256664
+ }
256665
+ return { href: `#${anchor}`, protocol: null, isExternal: false };
256666
+ }
256667
+ function isProtocolAllowed2(scheme, allowedProtocols, blockedProtocols) {
256668
+ if (blockedProtocols.includes(scheme)) {
256669
+ return false;
256670
+ }
256671
+ return allowedProtocols.has(scheme);
256672
+ }
256673
+ function isBlockedByRedirectList2(normalizedHref, parsed, blocklist) {
256674
+ const { hosts, urls } = blocklist;
256675
+ const hostname2 = parsed.hostname ? parsed.hostname.toLowerCase() : "";
256676
+ if (hosts.size > 0 && hostname2 && hosts.has(hostname2)) {
256677
+ return true;
256678
+ }
256679
+ if (urls.size > 0) {
256680
+ const hrefLower = normalizedHref.toLowerCase();
256681
+ for (const blockedUrl of urls) {
256682
+ if (hrefLower.startsWith(blockedUrl)) {
256683
+ return true;
256684
+ }
256685
+ }
256686
+ }
256687
+ return false;
256688
+ }
256689
+ function sanitizeHref2(raw, config2 = {}) {
256690
+ if (typeof raw !== "string")
256691
+ return null;
256692
+ const trimmed = raw.trim();
256693
+ if (!trimmed)
256694
+ return null;
256695
+ const maxLength = typeof config2.maxLength === "number" ? config2.maxLength : DEFAULT_MAX_LENGTH2;
256696
+ if (trimmed.length > maxLength) {
256697
+ return null;
256698
+ }
256699
+ const anchorResult = parseAnchorLink2(trimmed);
256700
+ if (anchorResult !== null) {
256701
+ return anchorResult;
256702
+ }
256703
+ if (trimmed.startsWith("/") || trimmed.startsWith(".") || trimmed.startsWith("//") || /^www\./i.test(trimmed)) {
256704
+ return null;
256705
+ }
256706
+ const schemeMatch = trimmed.match(/^([a-z0-9+.-]+):/i);
256707
+ if (!schemeMatch) {
256708
+ return null;
256709
+ }
256710
+ const scheme = schemeMatch[1].toLowerCase();
256711
+ const allowedProtocols = buildAllowedProtocols2(config2);
256712
+ const blockedProtocols = BLOCKED_PROTOCOLS2.concat(config2.blockedProtocols ?? []).map((p4) => p4.toLowerCase());
256713
+ if (!isProtocolAllowed2(scheme, allowedProtocols, blockedProtocols)) {
256714
+ return null;
256715
+ }
256716
+ const hostStartIndex = trimmed.indexOf("://") + 3;
256717
+ let hostEndIndex = trimmed.indexOf("/", hostStartIndex);
256718
+ if (hostEndIndex === -1) {
256719
+ hostEndIndex = trimmed.indexOf("?", hostStartIndex);
256720
+ }
256721
+ if (hostEndIndex === -1) {
256722
+ hostEndIndex = trimmed.indexOf("#", hostStartIndex);
256723
+ }
256724
+ if (hostEndIndex === -1) {
256725
+ hostEndIndex = trimmed.length;
256726
+ }
256727
+ const rawHostname = trimmed.slice(hostStartIndex, hostEndIndex).toLowerCase();
256728
+ if (rawHostname && /[^\x00-\x7F]/.test(rawHostname)) {
256729
+ if (true) {
256730
+ console.warn(`[URL Validation] Potential homograph attack detected in hostname: ${rawHostname.slice(0, 50)}`);
256731
+ }
256732
+ }
256733
+ const queryStartIndex = trimmed.indexOf("?");
256734
+ if (queryStartIndex !== -1) {
256735
+ const queryString = trimmed.slice(queryStartIndex);
256736
+ if (/[<>"']/.test(queryString)) {
256737
+ return null;
256738
+ }
256739
+ }
256740
+ let parsed;
256741
+ try {
256742
+ parsed = new URL(trimmed);
256743
+ } catch {
256744
+ return null;
256745
+ }
256746
+ const normalizedHref = trimmed;
256747
+ const blocklist = normalizeBlocklist2(config2.redirectBlocklist);
256748
+ if (isBlockedByRedirectList2(normalizedHref, parsed, blocklist)) {
256749
+ return null;
256750
+ }
256751
+ const isExternal = scheme === "http" || scheme === "https";
256752
+ return { href: normalizedHref, protocol: scheme, isExternal };
256753
+ }
256754
+ var DEFAULT_ALLOWED_PROTOCOLS2, OPTIONAL_PROTOCOLS2, BLOCKED_PROTOCOLS2, DEFAULT_MAX_LENGTH2 = 2048, ANCHOR_NAME_PATTERN2;
256755
+ var init_url_validation = __esm(() => {
256756
+ DEFAULT_ALLOWED_PROTOCOLS2 = ["http", "https", "mailto", "tel", "sms"];
256757
+ OPTIONAL_PROTOCOLS2 = ["ftp", "sftp", "irc"];
256758
+ BLOCKED_PROTOCOLS2 = ["javascript", "data", "vbscript", "file", "ssh", "ws", "wss"];
256759
+ ANCHOR_NAME_PATTERN2 = /^[A-Za-z0-9._-]+$/;
256760
+ });
255157
256761
 
255158
256762
  // ../../packages/super-editor/src/core/super-converter/docx-helpers/docx-constants.js
255159
256763
  var RELATIONSHIP_TYPES2;
@@ -312904,6 +314508,545 @@ var init_images_wrappers = __esm(() => {
312904
314508
  WRAP_TYPES_SUPPORTING_DISTANCES2 = new Set(["Square", "Tight", "Through", "TopAndBottom"]);
312905
314509
  });
312906
314510
 
314511
+ // ../../packages/super-editor/src/document-api-adapters/helpers/hyperlink-mutation-helper.ts
314512
+ function getLinkMarkType2(editor) {
314513
+ const markType = editor.schema.marks.link;
314514
+ if (!markType) {
314515
+ throw new Error("Link mark type is not defined in the editor schema.");
314516
+ }
314517
+ return markType;
314518
+ }
314519
+ function dispatchTransaction2(editor, tr) {
314520
+ editor.dispatch(tr);
314521
+ }
314522
+ function dispatchIfChanged2(editor, tr) {
314523
+ if (!tr.docChanged)
314524
+ return false;
314525
+ dispatchTransaction2(editor, tr);
314526
+ return true;
314527
+ }
314528
+ function createRelationshipId2(editor, href) {
314529
+ if (editor.options.mode !== "docx")
314530
+ return null;
314531
+ try {
314532
+ return insertNewRelationship2(href, "hyperlink", editor);
314533
+ } catch {
314534
+ return null;
314535
+ }
314536
+ }
314537
+ function sanitizeHrefOrThrow2(href) {
314538
+ const result = sanitizeHref2(href);
314539
+ if (!result) {
314540
+ throw Object.assign(new Error(`Blocked or invalid href: "${href}"`), { code: "INVALID_INPUT" });
314541
+ }
314542
+ return result.href;
314543
+ }
314544
+ function buildMarkAttrs2(editor, spec) {
314545
+ const attrs = {};
314546
+ if (spec.href) {
314547
+ attrs.href = sanitizeHrefOrThrow2(spec.href);
314548
+ attrs.rId = createRelationshipId2(editor, attrs.href);
314549
+ }
314550
+ if (spec.anchor) {
314551
+ attrs.anchor = spec.anchor;
314552
+ if (!spec.href) {
314553
+ attrs.href = `#${spec.anchor}`;
314554
+ }
314555
+ }
314556
+ if (spec.docLocation)
314557
+ attrs.docLocation = spec.docLocation;
314558
+ if (spec.tooltip)
314559
+ attrs.tooltip = spec.tooltip;
314560
+ if (spec.target)
314561
+ attrs.target = spec.target;
314562
+ if (spec.rel)
314563
+ attrs.rel = spec.rel;
314564
+ return attrs;
314565
+ }
314566
+ function wrapWithLink2(editor, from4, to, spec) {
314567
+ const linkMarkType = getLinkMarkType2(editor);
314568
+ const attrs = buildMarkAttrs2(editor, spec);
314569
+ const tr = editor.state.tr;
314570
+ tr.addMark(from4, to, linkMarkType.create(attrs));
314571
+ applyDirectMutationMeta2(tr);
314572
+ dispatchTransaction2(editor, tr);
314573
+ return true;
314574
+ }
314575
+ function insertLinkedText2(editor, pos, text9, spec) {
314576
+ const linkMarkType = getLinkMarkType2(editor);
314577
+ const attrs = buildMarkAttrs2(editor, spec);
314578
+ const tr = editor.state.tr;
314579
+ const mark2 = linkMarkType.create(attrs);
314580
+ tr.insertText(text9, pos);
314581
+ tr.addMark(pos, pos + text9.length, mark2);
314582
+ applyDirectMutationMeta2(tr);
314583
+ dispatchTransaction2(editor, tr);
314584
+ return true;
314585
+ }
314586
+ function patchLinkMark2(editor, from4, to, existingMark, patch3) {
314587
+ const linkMarkType = getLinkMarkType2(editor);
314588
+ const oldAttrs = existingMark.attrs;
314589
+ const merged = { ...oldAttrs };
314590
+ for (const [key3, value] of Object.entries(patch3)) {
314591
+ if (value === undefined)
314592
+ continue;
314593
+ if (value === null) {
314594
+ merged[key3] = null;
314595
+ } else {
314596
+ merged[key3] = value;
314597
+ }
314598
+ }
314599
+ if (typeof patch3.href === "string") {
314600
+ merged.href = sanitizeHrefOrThrow2(patch3.href);
314601
+ merged.rId = createRelationshipId2(editor, merged.href);
314602
+ }
314603
+ if (patch3.href === null && typeof merged.anchor === "string") {
314604
+ merged.href = `#${merged.anchor}`;
314605
+ merged.rId = null;
314606
+ }
314607
+ if (typeof patch3.anchor === "string" && patch3.href === undefined) {
314608
+ const currentHref = merged.href;
314609
+ if (typeof currentHref === "string" && currentHref.startsWith("#")) {
314610
+ merged.href = `#${patch3.anchor}`;
314611
+ }
314612
+ }
314613
+ if (patch3.anchor === null && typeof merged.href === "string" && !merged.href.startsWith("#")) {
314614
+ merged.anchor = null;
314615
+ }
314616
+ const tr = editor.state.tr;
314617
+ tr.removeMark(from4, to, existingMark);
314618
+ tr.addMark(from4, to, linkMarkType.create(merged));
314619
+ applyDirectMutationMeta2(tr);
314620
+ return dispatchIfChanged2(editor, tr);
314621
+ }
314622
+ function unwrapLink2(editor, from4, to) {
314623
+ const linkMarkType = getLinkMarkType2(editor);
314624
+ const tr = editor.state.tr;
314625
+ tr.removeMark(from4, to, linkMarkType);
314626
+ applyDirectMutationMeta2(tr);
314627
+ return dispatchIfChanged2(editor, tr);
314628
+ }
314629
+ function deleteLinkedText2(editor, from4, to) {
314630
+ const tr = editor.state.tr;
314631
+ tr.delete(from4, to);
314632
+ applyDirectMutationMeta2(tr);
314633
+ dispatchTransaction2(editor, tr);
314634
+ return true;
314635
+ }
314636
+ var init_hyperlink_mutation_helper = __esm(() => {
314637
+ init_document_rels();
314638
+ init_url_validation();
314639
+ });
314640
+
314641
+ // ../../packages/super-editor/src/document-api-adapters/plan-engine/hyperlinks-wrappers.ts
314642
+ function normalizeReadProperties2(attrs) {
314643
+ const rawHref = typeof attrs.href === "string" ? attrs.href : undefined;
314644
+ const rawAnchor = typeof attrs.anchor === "string" ? attrs.anchor : undefined;
314645
+ const rawDocLocation = typeof attrs.docLocation === "string" ? attrs.docLocation : undefined;
314646
+ const rawTooltip = typeof attrs.tooltip === "string" ? attrs.tooltip : undefined;
314647
+ const rawTarget = typeof attrs.target === "string" ? attrs.target : undefined;
314648
+ const rawRel = typeof attrs.rel === "string" ? attrs.rel : undefined;
314649
+ const props = {};
314650
+ let effectiveAnchor = rawAnchor;
314651
+ let effectiveHref = rawHref;
314652
+ if (rawHref && rawHref.startsWith("#")) {
314653
+ const fragment = rawHref.slice(1);
314654
+ if (!rawAnchor) {
314655
+ effectiveAnchor = fragment;
314656
+ effectiveHref = undefined;
314657
+ } else if (rawAnchor === fragment) {
314658
+ effectiveHref = undefined;
314659
+ }
314660
+ }
314661
+ if (effectiveHref)
314662
+ props.href = effectiveHref;
314663
+ if (effectiveAnchor)
314664
+ props.anchor = effectiveAnchor;
314665
+ if (rawDocLocation)
314666
+ props.docLocation = rawDocLocation;
314667
+ if (rawTooltip)
314668
+ props.tooltip = rawTooltip;
314669
+ if (rawTarget)
314670
+ props.target = rawTarget;
314671
+ if (rawRel)
314672
+ props.rel = rawRel;
314673
+ return props;
314674
+ }
314675
+ function candidateToTarget2(candidate) {
314676
+ return {
314677
+ kind: "inline",
314678
+ nodeType: "hyperlink",
314679
+ anchor: candidate.anchor
314680
+ };
314681
+ }
314682
+ function candidateToReadProperties2(candidate) {
314683
+ const attrs = candidate.mark?.attrs ?? candidate.attrs ?? {};
314684
+ return normalizeReadProperties2(attrs);
314685
+ }
314686
+ function extractDisplayText2(editor, candidate) {
314687
+ const doc4 = editor.state.doc;
314688
+ try {
314689
+ return doc4.textBetween(candidate.pos, candidate.end, "");
314690
+ } catch {
314691
+ return;
314692
+ }
314693
+ }
314694
+ function candidateToDomain2(editor, candidate) {
314695
+ return {
314696
+ address: candidateToTarget2(candidate),
314697
+ properties: candidateToReadProperties2(candidate),
314698
+ text: extractDisplayText2(editor, candidate)
314699
+ };
314700
+ }
314701
+ function encodeInlineRef2(anchor) {
314702
+ return `${anchor.start.blockId}:${anchor.start.offset}:${anchor.end.offset}`;
314703
+ }
314704
+ function isInsideTocBlock2(editor, pos) {
314705
+ const resolved = editor.state.doc.resolve(pos);
314706
+ for (let depth = resolved.depth;depth > 0; depth--) {
314707
+ const node4 = resolved.node(depth);
314708
+ if (node4.type.name === "tableOfContents")
314709
+ return true;
314710
+ }
314711
+ return false;
314712
+ }
314713
+ function rejectIfInsideToc2(editor, pos, operationName) {
314714
+ if (isInsideTocBlock2(editor, pos)) {
314715
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `${operationName}: target is inside a TOC block. TOC content is managed by toc.* operations.`);
314716
+ }
314717
+ }
314718
+ function findHyperlinkCandidates2(editor) {
314719
+ const blockIndex = getBlockIndex2(editor);
314720
+ const inlineIndex = buildInlineIndex2(editor, blockIndex);
314721
+ return findInlineByType2(inlineIndex, "hyperlink");
314722
+ }
314723
+ function resolveHyperlinkCandidate2(editor, target) {
314724
+ const blockIndex = getBlockIndex2(editor);
314725
+ const inlineIndex = buildInlineIndex2(editor, blockIndex);
314726
+ const candidate = findInlineByAnchor2(inlineIndex, target);
314727
+ if (!candidate) {
314728
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "Hyperlink target not found in document.", { target });
314729
+ }
314730
+ return candidate;
314731
+ }
314732
+ function resolveCandidateTextRange2(editor, candidate, operationName) {
314733
+ const start2 = candidate.anchor.start;
314734
+ const end = candidate.anchor.end;
314735
+ if (start2.blockId !== end.blockId) {
314736
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `${operationName}: hyperlink anchor spans multiple blocks.`, {
314737
+ anchor: candidate.anchor
314738
+ });
314739
+ }
314740
+ const resolved = resolveTextTarget2(editor, {
314741
+ kind: "text",
314742
+ blockId: start2.blockId,
314743
+ range: { start: start2.offset, end: end.offset }
314744
+ });
314745
+ if (!resolved) {
314746
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", `${operationName}: hyperlink text range could not be resolved.`, {
314747
+ anchor: candidate.anchor
314748
+ });
314749
+ }
314750
+ return resolved;
314751
+ }
314752
+ function hyperlinkSuccess2(target) {
314753
+ return { success: true, hyperlink: target };
314754
+ }
314755
+ function hyperlinkFailure2(code10, message) {
314756
+ return { success: false, failure: { code: code10, message } };
314757
+ }
314758
+ function receiptApplied4(receipt2) {
314759
+ return receipt2.steps[0]?.effect === "changed";
314760
+ }
314761
+ function matchesListQuery3(candidate, query2, editor) {
314762
+ if (!query2)
314763
+ return true;
314764
+ const props = candidateToReadProperties2(candidate);
314765
+ if (query2.hrefPattern && (!props.href || !props.href.includes(query2.hrefPattern))) {
314766
+ return false;
314767
+ }
314768
+ if (query2.anchor && props.anchor !== query2.anchor) {
314769
+ return false;
314770
+ }
314771
+ if (query2.textPattern) {
314772
+ const text9 = extractDisplayText2(editor, candidate);
314773
+ if (!text9 || !text9.includes(query2.textPattern))
314774
+ return false;
314775
+ }
314776
+ return true;
314777
+ }
314778
+ function hyperlinksListWrapper2(editor, query2) {
314779
+ const revision = getRevision2(editor);
314780
+ let candidates = findHyperlinkCandidates2(editor);
314781
+ if (query2?.within) {
314782
+ const blockIndex = getBlockIndex2(editor);
314783
+ const diagnostics = [];
314784
+ const withinResult = resolveWithinScope2(blockIndex, { within: query2.within }, diagnostics);
314785
+ if (!withinResult.ok) {
314786
+ candidates = [];
314787
+ } else {
314788
+ candidates = scopeByRange2(candidates, withinResult.range);
314789
+ }
314790
+ }
314791
+ const filtered = candidates.filter((c2) => matchesListQuery3(c2, query2, editor));
314792
+ const allItems = filtered.map((candidate) => {
314793
+ const domain3 = candidateToDomain2(editor, candidate);
314794
+ const ref4 = encodeInlineRef2(candidate.anchor);
314795
+ const handle4 = buildResolvedHandle(ref4, "ephemeral", "node");
314796
+ return buildDiscoveryItem(ref4, handle4, domain3);
314797
+ });
314798
+ const { total, items: paged } = paginate2(allItems, query2?.offset, query2?.limit);
314799
+ const effectiveLimit = query2?.limit ?? total;
314800
+ return buildDiscoveryResult({
314801
+ evaluatedRevision: revision,
314802
+ total,
314803
+ items: paged,
314804
+ page: { limit: effectiveLimit, offset: query2?.offset ?? 0, returned: paged.length }
314805
+ });
314806
+ }
314807
+ function hyperlinksGetWrapper2(editor, input2) {
314808
+ const candidate = resolveHyperlinkCandidate2(editor, input2.target);
314809
+ return {
314810
+ address: candidateToTarget2(candidate),
314811
+ properties: candidateToReadProperties2(candidate),
314812
+ text: extractDisplayText2(editor, candidate)
314813
+ };
314814
+ }
314815
+ function specFromInput2(link3) {
314816
+ return {
314817
+ href: link3.destination.href,
314818
+ anchor: link3.destination.anchor,
314819
+ docLocation: link3.destination.docLocation,
314820
+ tooltip: link3.tooltip,
314821
+ target: link3.target,
314822
+ rel: link3.rel
314823
+ };
314824
+ }
314825
+ function hyperlinksWrapWrapper2(editor, input2, options) {
314826
+ rejectTrackedMode2("hyperlinks.wrap", options);
314827
+ const resolved = resolveTextTarget2(editor, input2.target);
314828
+ if (!resolved) {
314829
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "hyperlinks.wrap: text target block not found.", {
314830
+ target: input2.target
314831
+ });
314832
+ }
314833
+ rejectIfInsideToc2(editor, resolved.from, "hyperlinks.wrap");
314834
+ const blockIndex = getBlockIndex2(editor);
314835
+ const inlineIndex = buildInlineIndex2(editor, blockIndex);
314836
+ const hyperlinks = findInlineByType2(inlineIndex, "hyperlink");
314837
+ const overlapping = hyperlinks.filter((c2) => c2.pos < resolved.to && c2.end > resolved.from);
314838
+ if (overlapping.length > 1) {
314839
+ throw new DocumentApiAdapterError3("INVALID_TARGET", "hyperlinks.wrap: target range spans multiple existing links.");
314840
+ }
314841
+ if (overlapping.length === 1) {
314842
+ const existing = overlapping[0];
314843
+ if (existing.pos === resolved.from && existing.end === resolved.to) {
314844
+ const existingProps = candidateToReadProperties2(existing);
314845
+ const spec2 = specFromInput2(input2.link);
314846
+ if (existingProps.href === spec2.href && existingProps.anchor === spec2.anchor) {
314847
+ return hyperlinkFailure2("NO_OP", "Text range is already linked with the same destination.");
314848
+ }
314849
+ } else {
314850
+ throw new DocumentApiAdapterError3("INVALID_TARGET", "hyperlinks.wrap: target range partially overlaps an existing link. Remove the existing link first.");
314851
+ }
314852
+ }
314853
+ if (input2.link.destination.href) {
314854
+ sanitizeHrefOrThrow2(input2.link.destination.href);
314855
+ }
314856
+ if (options?.dryRun) {
314857
+ const dryTarget = {
314858
+ kind: "inline",
314859
+ nodeType: "hyperlink",
314860
+ anchor: {
314861
+ start: { blockId: input2.target.blockId, offset: input2.target.range.start },
314862
+ end: { blockId: input2.target.blockId, offset: input2.target.range.end }
314863
+ }
314864
+ };
314865
+ return hyperlinkSuccess2(dryTarget);
314866
+ }
314867
+ const spec = specFromInput2(input2.link);
314868
+ const receipt2 = executeDomainCommand2(editor, () => {
314869
+ const result = wrapWithLink2(editor, resolved.from, resolved.to, spec);
314870
+ if (result)
314871
+ clearIndexCache2(editor);
314872
+ return result;
314873
+ }, { expectedRevision: options?.expectedRevision });
314874
+ if (!receiptApplied4(receipt2)) {
314875
+ return hyperlinkFailure2("NO_OP", "Wrap operation produced no change.");
314876
+ }
314877
+ const postCandidate = findHyperlinkAtRange2(editor, resolved.from, resolved.to);
314878
+ return hyperlinkSuccess2(postCandidate ? candidateToTarget2(postCandidate) : {
314879
+ kind: "inline",
314880
+ nodeType: "hyperlink",
314881
+ anchor: {
314882
+ start: { blockId: input2.target.blockId, offset: input2.target.range.start },
314883
+ end: { blockId: input2.target.blockId, offset: input2.target.range.end }
314884
+ }
314885
+ });
314886
+ }
314887
+ function hyperlinksInsertWrapper2(editor, input2, options) {
314888
+ rejectTrackedMode2("hyperlinks.insert", options);
314889
+ let insertPos;
314890
+ let blockId;
314891
+ let offset2;
314892
+ let structuralEnd = false;
314893
+ if (input2.target) {
314894
+ const resolved = resolveTextTarget2(editor, input2.target);
314895
+ if (!resolved) {
314896
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "hyperlinks.insert: text target block not found.", {
314897
+ target: input2.target
314898
+ });
314899
+ }
314900
+ rejectIfInsideToc2(editor, resolved.from, "hyperlinks.insert");
314901
+ insertPos = resolved.from;
314902
+ blockId = input2.target.blockId;
314903
+ offset2 = input2.target.range.start;
314904
+ } else {
314905
+ const fallback = resolveDefaultInsertTarget2(editor);
314906
+ if (!fallback) {
314907
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "hyperlinks.insert: document has no content to insert into.");
314908
+ }
314909
+ if (fallback.kind === "text-block") {
314910
+ insertPos = fallback.range.from;
314911
+ blockId = fallback.target.blockId;
314912
+ offset2 = fallback.target.range.start;
314913
+ } else {
314914
+ insertPos = fallback.insertPos;
314915
+ blockId = "";
314916
+ offset2 = 0;
314917
+ structuralEnd = true;
314918
+ }
314919
+ }
314920
+ if (input2.link.destination.href) {
314921
+ sanitizeHrefOrThrow2(input2.link.destination.href);
314922
+ }
314923
+ if (options?.dryRun) {
314924
+ const dryTarget = {
314925
+ kind: "inline",
314926
+ nodeType: "hyperlink",
314927
+ anchor: {
314928
+ start: { blockId, offset: offset2 },
314929
+ end: { blockId, offset: offset2 + input2.text.length }
314930
+ }
314931
+ };
314932
+ return hyperlinkSuccess2(dryTarget);
314933
+ }
314934
+ const spec = specFromInput2(input2.link);
314935
+ const receipt2 = executeDomainCommand2(editor, () => {
314936
+ if (structuralEnd) {
314937
+ insertParagraphAtEnd2(editor, insertPos, input2.text);
314938
+ clearIndexCache2(editor);
314939
+ const textStart = insertPos + 1;
314940
+ const result2 = wrapWithLink2(editor, textStart, textStart + input2.text.length, spec);
314941
+ if (result2)
314942
+ clearIndexCache2(editor);
314943
+ return result2;
314944
+ }
314945
+ const result = insertLinkedText2(editor, insertPos, input2.text, spec);
314946
+ if (result)
314947
+ clearIndexCache2(editor);
314948
+ return result;
314949
+ }, { expectedRevision: options?.expectedRevision });
314950
+ if (!receiptApplied4(receipt2)) {
314951
+ return hyperlinkFailure2("NO_OP", "Insert operation produced no change.");
314952
+ }
314953
+ const searchFrom = structuralEnd ? insertPos + 1 : insertPos;
314954
+ const searchTo = searchFrom + input2.text.length;
314955
+ const postCandidate = findHyperlinkAtRange2(editor, searchFrom, searchTo);
314956
+ return hyperlinkSuccess2(postCandidate ? candidateToTarget2(postCandidate) : {
314957
+ kind: "inline",
314958
+ nodeType: "hyperlink",
314959
+ anchor: {
314960
+ start: { blockId, offset: offset2 },
314961
+ end: { blockId, offset: offset2 + input2.text.length }
314962
+ }
314963
+ });
314964
+ }
314965
+ function hyperlinksPatchWrapper2(editor, input2, options) {
314966
+ rejectTrackedMode2("hyperlinks.patch", options);
314967
+ const candidate = resolveHyperlinkCandidate2(editor, input2.target);
314968
+ const resolvedRange = resolveCandidateTextRange2(editor, candidate, "hyperlinks.patch");
314969
+ rejectIfInsideToc2(editor, resolvedRange.from, "hyperlinks.patch");
314970
+ const existingMark = candidate.mark;
314971
+ if (!existingMark) {
314972
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "hyperlinks.patch: resolved candidate has no mark.");
314973
+ }
314974
+ const oldAttrs = existingMark.attrs;
314975
+ const mergedHref = input2.patch.href === undefined ? oldAttrs.href : input2.patch.href;
314976
+ const mergedAnchor = input2.patch.anchor === undefined ? oldAttrs.anchor : input2.patch.anchor;
314977
+ const hasHref = typeof mergedHref === "string" && mergedHref.length > 0;
314978
+ const hasAnchor = typeof mergedAnchor === "string" && mergedAnchor.length > 0;
314979
+ if (!hasHref && !hasAnchor) {
314980
+ throw new DocumentApiAdapterError3("INVALID_INPUT", "hyperlinks.patch: resulting destination must have at least one of href or anchor.");
314981
+ }
314982
+ if (typeof input2.patch.href === "string") {
314983
+ sanitizeHrefOrThrow2(input2.patch.href);
314984
+ }
314985
+ const currentProps = candidateToReadProperties2(candidate);
314986
+ const isNoop = Object.entries(input2.patch).every(([key3, value]) => {
314987
+ if (value === undefined)
314988
+ return true;
314989
+ if (value === null)
314990
+ return currentProps[key3] === undefined;
314991
+ return currentProps[key3] === value;
314992
+ });
314993
+ if (isNoop) {
314994
+ return hyperlinkFailure2("NO_OP", "Patch produces no change — all values already match.");
314995
+ }
314996
+ if (options?.dryRun) {
314997
+ return hyperlinkSuccess2(candidateToTarget2(candidate));
314998
+ }
314999
+ const receipt2 = executeDomainCommand2(editor, () => {
315000
+ const result = patchLinkMark2(editor, resolvedRange.from, resolvedRange.to, existingMark, input2.patch);
315001
+ if (result)
315002
+ clearIndexCache2(editor);
315003
+ return result;
315004
+ }, { expectedRevision: options?.expectedRevision });
315005
+ if (!receiptApplied4(receipt2)) {
315006
+ return hyperlinkFailure2("NO_OP", "Patch operation produced no change.");
315007
+ }
315008
+ const postCandidate = findHyperlinkAtRange2(editor, resolvedRange.from, resolvedRange.to);
315009
+ return hyperlinkSuccess2(postCandidate ? candidateToTarget2(postCandidate) : candidateToTarget2(candidate));
315010
+ }
315011
+ function hyperlinksRemoveWrapper2(editor, input2, options) {
315012
+ rejectTrackedMode2("hyperlinks.remove", options);
315013
+ const candidate = resolveHyperlinkCandidate2(editor, input2.target);
315014
+ const resolvedRange = resolveCandidateTextRange2(editor, candidate, "hyperlinks.remove");
315015
+ rejectIfInsideToc2(editor, resolvedRange.from, "hyperlinks.remove");
315016
+ const mode = input2.mode ?? "unwrap";
315017
+ const targetAddress = candidateToTarget2(candidate);
315018
+ if (options?.dryRun) {
315019
+ return hyperlinkSuccess2(targetAddress);
315020
+ }
315021
+ const receipt2 = executeDomainCommand2(editor, () => {
315022
+ const result = mode === "unwrap" ? unwrapLink2(editor, resolvedRange.from, resolvedRange.to) : deleteLinkedText2(editor, resolvedRange.from, resolvedRange.to);
315023
+ if (result)
315024
+ clearIndexCache2(editor);
315025
+ return result;
315026
+ }, { expectedRevision: options?.expectedRevision });
315027
+ if (!receiptApplied4(receipt2)) {
315028
+ return hyperlinkFailure2("NO_OP", `Remove (${mode}) operation produced no change.`);
315029
+ }
315030
+ return hyperlinkSuccess2(targetAddress);
315031
+ }
315032
+ function findHyperlinkAtRange2(editor, from4, to) {
315033
+ const blockIndex = getBlockIndex2(editor);
315034
+ const inlineIndex = buildInlineIndex2(editor, blockIndex);
315035
+ const hyperlinks = findInlineByType2(inlineIndex, "hyperlink");
315036
+ return hyperlinks.find((c2) => c2.pos >= from4 - 1 && c2.pos <= from4 + 1 && c2.end >= to - 1 && c2.end <= to + 1) ?? hyperlinks.find((c2) => c2.pos <= from4 && c2.end >= to);
315037
+ }
315038
+ var init_hyperlinks_wrappers = __esm(() => {
315039
+ init_src();
315040
+ init_index_cache();
315041
+ init_inline_address_resolver();
315042
+ init_adapter_utils();
315043
+ init_revision_tracker();
315044
+ init_plan_wrappers();
315045
+ init_mutation_helpers();
315046
+ init_errors3();
315047
+ init_hyperlink_mutation_helper();
315048
+ });
315049
+
312907
315050
  // ../../packages/super-editor/src/document-api-adapters/assemble-adapters.ts
312908
315051
  function assembleDocumentApiAdapters2(editor) {
312909
315052
  registerBuiltInExecutors2();
@@ -313105,6 +315248,14 @@ function assembleDocumentApiAdapters2(editor) {
313105
315248
  setAnchorOptions: (input2, options) => imagesSetAnchorOptionsWrapper2(editor, input2, options),
313106
315249
  setZOrder: (input2, options) => imagesSetZOrderWrapper2(editor, input2, options)
313107
315250
  },
315251
+ hyperlinks: {
315252
+ list: (query2) => hyperlinksListWrapper2(editor, query2),
315253
+ get: (input2) => hyperlinksGetWrapper2(editor, input2),
315254
+ wrap: (input2, options) => hyperlinksWrapWrapper2(editor, input2, options),
315255
+ insert: (input2, options) => hyperlinksInsertWrapper2(editor, input2, options),
315256
+ patch: (input2, options) => hyperlinksPatchWrapper2(editor, input2, options),
315257
+ remove: (input2, options) => hyperlinksRemoveWrapper2(editor, input2, options)
315258
+ },
313108
315259
  query: {
313109
315260
  match: (input2) => queryMatchAdapter2(editor, input2)
313110
315261
  },
@@ -313143,6 +315294,7 @@ var init_assemble_adapters = __esm(() => {
313143
315294
  init_toc_wrappers();
313144
315295
  init_toc_entry_wrappers();
313145
315296
  init_images_wrappers();
315297
+ init_hyperlinks_wrappers();
313146
315298
  });
313147
315299
 
313148
315300
  // ../../packages/super-editor/src/document-api-adapters/index.ts
@@ -368748,17 +370900,18 @@ function buildHelpText() {
368748
370900
  categories.set(spec.category, list8);
368749
370901
  }
368750
370902
  const categoryOrder = [
368751
- "query",
368752
- "mutation",
370903
+ "core",
368753
370904
  "format",
368754
370905
  "create",
368755
- "blocks",
370906
+ "tables",
370907
+ "sections",
368756
370908
  "lists",
368757
370909
  "comments",
368758
370910
  "trackChanges",
368759
- "lifecycle",
368760
- "session",
368761
- "introspection"
370911
+ "toc",
370912
+ "images",
370913
+ "history",
370914
+ "session"
368762
370915
  ];
368763
370916
  for (const category of categoryOrder) {
368764
370917
  const specs = categories.get(category);
@@ -369080,8 +371233,7 @@ var init_operation_params = __esm(() => {
369080
371233
  kind: "flag",
369081
371234
  flag: "change-mode",
369082
371235
  type: "string",
369083
- schema: { oneOf: [{ const: "direct" }, { const: "tracked" }] },
369084
- agentVisible: false
371236
+ schema: { enum: ["direct", "tracked"] }
369085
371237
  };
369086
371238
  EXPECTED_REVISION_PARAM = {
369087
371239
  name: "expectedRevision",
@@ -369102,7 +371254,7 @@ var init_operation_params = __esm(() => {
369102
371254
  flag: "user-email",
369103
371255
  type: "string"
369104
371256
  };
369105
- AGENT_HIDDEN_PARAM_NAMES = new Set(["out", "expectedRevision", "changeMode", "dryRun"]);
371257
+ AGENT_HIDDEN_PARAM_NAMES = new Set(["out", "expectedRevision", "dryRun"]);
369106
371258
  OPERATION_CONSTRAINTS = {
369107
371259
  "doc.find": {
369108
371260
  requiresOneOf: [["type", "query"]],
@@ -369139,14 +371291,7 @@ var init_operation_params = __esm(() => {
369139
371291
  address: { flag: "address-json" }
369140
371292
  }
369141
371293
  };
369142
- PARAM_SCHEMA_OVERRIDES = {
369143
- "doc.mutations.preview": {
369144
- steps: { type: "json" }
369145
- },
369146
- "doc.mutations.apply": {
369147
- steps: { type: "json" }
369148
- }
369149
- };
371294
+ PARAM_SCHEMA_OVERRIDES = {};
369150
371295
  PARAM_EXCLUSIONS = {
369151
371296
  "doc.find": new Set(["select"])
369152
371297
  };
@@ -369947,6 +372092,12 @@ function validateValueAgainstTypeSpec(value2, schema, path3) {
369947
372092
  }
369948
372093
  if (schema.type === "json")
369949
372094
  return;
372095
+ if (schema.enum) {
372096
+ if (!schema.enum.includes(value2)) {
372097
+ throw new CliError("VALIDATION_ERROR", `${path3} must be one of: ${schema.enum.join(", ")}.`);
372098
+ }
372099
+ return;
372100
+ }
369950
372101
  if (schema.type === "string") {
369951
372102
  if (typeof value2 !== "string")
369952
372103
  throw new CliError("VALIDATION_ERROR", `${path3} must be a string.`);