@openclaw/ai 2026.10.2 → 2026.10.5-beta.2

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 (108) hide show
  1. package/README.md +6 -0
  2. package/dist/{anthropic-C4qygbtf.mjs → anthropic-BalhAzs-.mjs} +33 -63
  3. package/dist/{anthropic-payload-policy-DD7vzpxE.d.mts → anthropic-payload-policy-DGblkHL5.d.mts} +19 -19
  4. package/dist/{anthropic-stream-reducer-CWyWE21W.mjs → anthropic-stream-reducer-DkKeXXx4.mjs} +215 -297
  5. package/dist/{api-registry-B3rC2qu3.d.mts → api-registry-BhXXYdRA.d.mts} +2 -2
  6. package/dist/assistant-message-events-CHMJgbhs.mjs +18 -0
  7. package/dist/{assistant-output-D5762GPH.mjs → assistant-output-BuhRpLeD.mjs} +2 -2
  8. package/dist/{assistant-text-phase-DVZOxbuR.mjs → assistant-text-phase-Bn1hbvK9.mjs} +7 -6
  9. package/dist/{azure-openai-responses-DO-Fv8ha.mjs → azure-openai-responses-DfT9Ndd8.mjs} +8 -9
  10. package/dist/{credential-redaction-BKv49aiv.d.mts → credential-redaction-BHxruEH6.d.mts} +3 -1
  11. package/dist/{diagnostics-Caj-4RBA.mjs → diagnostics-tQasYct1.mjs} +10 -3
  12. package/dist/diagnostics.d.mts +7 -7
  13. package/dist/diagnostics.mjs +3 -3
  14. package/dist/{env-api-keys-CyX4VKGO.mjs → env-api-keys-CrxwdylR.mjs} +24 -35
  15. package/dist/event-stream-6UNs-AhN.d.mts +1 -0
  16. package/dist/{event-stream-DrRM_90c.d.mts → event-stream-BcqWLo_u.d.mts} +1 -1
  17. package/dist/{event-stream-C5AbCAaZ.mjs → event-stream-X2gmsUWv.mjs} +5 -8
  18. package/dist/event-stream.d.mts +2 -2
  19. package/dist/event-stream.mjs +1 -1
  20. package/dist/{google-interactions-DNXzPPwQ.mjs → google-interactions-9SSqsJg9.mjs} +52 -84
  21. package/dist/{google-messages-l7wgIF5I.mjs → google-messages-DsB7fmoQ.mjs} +26 -35
  22. package/dist/google-provider-stream-CcEI2-MC.mjs +58 -0
  23. package/dist/google-sYI2wnY6.mjs +20 -0
  24. package/dist/{google-shared-V8jogVPq.mjs → google-shared-zGR0QUyS.mjs} +6 -15
  25. package/dist/google-vertex-Dw_abY1w.mjs +40 -0
  26. package/dist/{host-u3o8XiAp.mjs → host-Bf3NjYNj.mjs} +3 -2
  27. package/dist/{host-DiPhRjrc.d.mts → host-CTDz7LXD.d.mts} +6 -3
  28. package/dist/{host-policy-BwhNNGQR.mjs → host-policy-BzZluO6_.mjs} +1 -1
  29. package/dist/{index-D27wAoOr.d.mts → index-BYDvopUB.d.mts} +8 -7
  30. package/dist/index.d.mts +7 -7
  31. package/dist/index.mjs +7 -6
  32. package/dist/internal/anthropic.d.mts +5 -5
  33. package/dist/internal/anthropic.mjs +4 -4
  34. package/dist/internal/openai-completions-compat.d.mts +1 -1
  35. package/dist/internal/openai-completions-compat.mjs +1 -1
  36. package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
  37. package/dist/internal/openai-responses-payload-policy.mjs +2 -3
  38. package/dist/internal/openai.d.mts +9 -9
  39. package/dist/internal/openai.mjs +9 -11
  40. package/dist/internal/runtime.d.mts +31 -13
  41. package/dist/internal/runtime.mjs +10 -13
  42. package/dist/internal/shared.d.mts +5 -5
  43. package/dist/internal/shared.mjs +6 -7
  44. package/dist/internal/tool-schema.mjs +2 -2
  45. package/dist/{llm-request-activity-D8f_oxHj.mjs → llm-request-activity-CfMuh5cC.mjs} +2 -2
  46. package/dist/{mistral-cnoBDSIg.mjs → mistral-dCDCR5ur.mjs} +71 -146
  47. package/dist/{model-transport-url-C5f59L3Y.d.mts → model-transport-url-BrsjjdjR.d.mts} +5 -1
  48. package/dist/{number-coercion-V8-BhME4.mjs → number-coercion-C3hztWoY.mjs} +5 -4
  49. package/dist/{openai-chatgpt-responses-CHdn8YJ_.mjs → openai-chatgpt-responses-V4iP0dv5.mjs} +118 -194
  50. package/dist/{openai-completions-BZfHIaZ7.mjs → openai-completions-BY-kr5IS.mjs} +7 -6
  51. package/dist/{openai-completions-compat-GMN8A0fm.mjs → openai-completions-compat-CYX18uDk.mjs} +10 -6
  52. package/dist/{openai-completions-compat-BgPg1BRs.d.mts → openai-completions-compat-i-nLZxFy.d.mts} +10 -11
  53. package/dist/{openai-completions-transport-CuoQfnKV.mjs → openai-completions-transport-v38m71Oq.mjs} +1449 -294
  54. package/dist/{openai-prompt-cache-CFviG_D4.d.mts → openai-prompt-cache-DIPMrMFy.d.mts} +2 -2
  55. package/dist/{openai-prompt-cache-BK6E2g4Q.mjs → openai-prompt-cache-r93BJhjm.mjs} +1 -1
  56. package/dist/{openai-responses-BhAZFsL9.mjs → openai-responses-D5oiAUOG.mjs} +9 -10
  57. package/dist/{openai-responses-compaction-replay-BBNo098-.d.mts → openai-responses-compaction-replay-B2FE4Nw8.d.mts} +4 -4
  58. package/dist/{openai-responses-contracts-D5yVZBp-.d.mts → openai-responses-contracts-DKqMJ1Ct.d.mts} +9 -4
  59. package/dist/{openai-responses-contracts-BKu8O7l4.mjs → openai-responses-contracts-DlKMMTxK.mjs} +26 -6
  60. package/dist/{openai-responses-compaction-window-tA4QkU0o.mjs → openai-responses-endpoint-CinGh4VZ.mjs} +17 -7
  61. package/dist/{openai-responses-payload-policy-s1apQlZZ.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +2 -4
  62. package/dist/{openai-responses-prompt-observer-internal-CefUzh8M.mjs → openai-responses-request-lifecycle-NSIJo9jY.mjs} +39 -4
  63. package/dist/{openai-responses-shared-CKNmC3vC.mjs → openai-responses-shared-D-aDYAkJ.mjs} +1037 -328
  64. package/dist/{openai-responses-terminal-usage-CempLedn.d.mts → openai-responses-terminal-usage-BygjiAdi.d.mts} +2 -2
  65. package/dist/{openai-tool-schema-BIrI0mrA.mjs → openai-tool-schema-DDPXsvJP.mjs} +220 -400
  66. package/dist/{positive-integer-CwLi8LUL.mjs → positive-integer-CqWjqSi9.mjs} +1 -1
  67. package/dist/{provider-error-DQBE1bUQ.mjs → provider-error-CF9GWCs2.mjs} +5 -3
  68. package/dist/{provider-options-CkieKvNJ.d.mts → provider-options-CVrXZBtA.d.mts} +6 -10
  69. package/dist/{provider-transport-turn-state-BX6TfCyW.mjs → provider-transport-turn-state-BOpxgm-J.mjs} +2 -2
  70. package/dist/{provider-types-v3bmqsfg.d.mts → provider-types-CHtRx0dI.d.mts} +3 -3
  71. package/dist/provider-types.d.mts +6 -6
  72. package/dist/providers.d.mts +2 -2
  73. package/dist/providers.mjs +12 -12
  74. package/dist/{reasoning-tag-text-partitioner-Ju9VpUGl.mjs → reasoning-tag-text-partitioner-CpOy9-IQ.mjs} +374 -235
  75. package/dist/{required-api-key-D4kn3252.mjs → required-api-key-CFJvcFy_.mjs} +1 -1
  76. package/dist/{simple-options-7QuSKriJ.mjs → simple-options-BAu4B54D.mjs} +9 -11
  77. package/dist/{src-VWy9E7DZ.mjs → src-C44MKrW5.mjs} +20 -9
  78. package/dist/{stream-DFaRxi2D.mjs → stream-Dd8DwRFL.mjs} +12 -21
  79. package/dist/{stream-first-event-timeout-D9ZmL_s9.mjs → stream-first-event-timeout-Dc42hKv6.mjs} +8 -21
  80. package/dist/{streaming-byte-guard-CC-HMn_u.mjs → streaming-byte-guard-DBXr1XYn.mjs} +16 -1
  81. package/dist/{string-normalization-PN10hf6d.mjs → string-normalization-I3ux50s9.mjs} +1 -1
  82. package/dist/{text-signature-D_vRrx-z.mjs → text-signature-Drb4Erb8.mjs} +32 -5
  83. package/dist/{tool-schema-json-projection-Ct8SeBeJ.mjs → tool-schema-json-projection-B8sG1I9v.mjs} +29 -23
  84. package/dist/{transport-stream-shared-DW-7-qLR.d.mts → transport-stream-shared-BmpzDtdQ.d.mts} +4 -4
  85. package/dist/{transport-stream-shared-CCR7hSW0.mjs → transport-stream-shared-CWGOuLcA.mjs} +8 -16
  86. package/dist/transports.d.mts +34 -23
  87. package/dist/transports.mjs +76 -1235
  88. package/dist/{types-DvzmWW8J.d.mts → types-Bd2T86VJ.d.mts} +5 -23
  89. package/dist/types-Kdfw_04V.d.mts +1 -0
  90. package/dist/types.d.mts +6 -6
  91. package/dist/types.mjs +5 -4
  92. package/dist/{validation-B3lQt_VE.d.mts → validation-DdGB1yy3.d.mts} +1 -1
  93. package/dist/{validation-DbqlIfDn.mjs → validation-ZX_sPVV0.mjs} +3 -9
  94. package/dist/validation.d.mts +1 -1
  95. package/dist/validation.mjs +1 -1
  96. package/package.json +4 -9
  97. package/dist/env-api-keys-BR0MUYYD.d.mts +0 -17
  98. package/dist/event-stream-DqDQWqiy.d.mts +0 -1
  99. package/dist/google-B2g_Xn4d.mjs +0 -54
  100. package/dist/google-vertex-_khoip47.mjs +0 -88
  101. package/dist/internal/env-api-keys.d.mts +0 -2
  102. package/dist/internal/env-api-keys.mjs +0 -2
  103. package/dist/openai-responses-endpoint-TV0y50fb.mjs +0 -11
  104. package/dist/openai-responses-request-lifecycle-Fsag-IGZ.mjs +0 -36
  105. package/dist/openai-transport-params-D7JMUPjf.mjs +0 -735
  106. package/dist/openai-web-search-tools-Cfu0uLyN.mjs +0 -14
  107. package/dist/provider-replay-context-CO_Eplnc.mjs +0 -25
  108. package/dist/types-UlNana-2.d.mts +0 -1
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./provider-error-DQBE1bUQ.mjs";
2
+ import "./provider-error-CF9GWCs2.mjs";
3
3
  import { t as expectDefined } from "./expect-lbe3Hgrh.mjs";
4
4
  //#region node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
5
5
  /**
@@ -2648,7 +2648,7 @@ function regexCheck(regex) {
2648
2648
  }
2649
2649
  }
2650
2650
  //#endregion
2651
- //#region node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.js
2651
+ //#region node_modules/.pnpm/micromark-factory-space@2.1.0/node_modules/micromark-factory-space/index.js
2652
2652
  /**
2653
2653
  * @import {Effects, State, TokenType} from 'micromark-util-types'
2654
2654
  */
@@ -2678,14 +2678,14 @@ function regexCheck(regex) {
2678
2678
  * @param {State} ok
2679
2679
  * State switched to when successful.
2680
2680
  * @param {TokenType} type
2681
- * Type (`' \t'`).
2681
+ * Type of the whole whitespace.
2682
2682
  * @param {number | undefined} [max=Infinity]
2683
2683
  * Max (exclusive).
2684
2684
  * @returns {State}
2685
2685
  * Start state.
2686
2686
  */
2687
2687
  function factorySpace(effects, ok, type, max) {
2688
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
2688
+ const limit = max ? max - 1 : Infinity;
2689
2689
  let size = 0;
2690
2690
  return start;
2691
2691
  /** @type {State} */
@@ -2706,8 +2706,56 @@ function factorySpace(effects, ok, type, max) {
2706
2706
  return ok(code);
2707
2707
  }
2708
2708
  }
2709
+ /**
2710
+ * Parse spaces and tabs, with a required minimum and maximum, matching
2711
+ * `markdown-rs`’s `space_or_tab_min_max`.
2712
+ *
2713
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
2714
+ * `min` spaces or tabs are found.
2715
+ *
2716
+ * @param {Effects} effects
2717
+ * Context.
2718
+ * @param {State} ok
2719
+ * State switched to when successful.
2720
+ * @param {State} nok
2721
+ * State switched to when unsuccessful.
2722
+ * @param {TokenType} type
2723
+ * Type of the whole whitespace.
2724
+ * @param {number} min
2725
+ * Minimum allowed characters (inclusive).
2726
+ * @param {number} max
2727
+ * Maximum allowed characters (inclusive).
2728
+ * @returns {State}
2729
+ * Start state.
2730
+ */
2731
+ function factorySpaceMinMax(effects, ok, nok, type, min, max) {
2732
+ let size = 0;
2733
+ return start;
2734
+ /** @type {State} */
2735
+ function start(code) {
2736
+ if (max > 0 && markdownSpace(code)) {
2737
+ effects.enter(type);
2738
+ return prefix(code);
2739
+ }
2740
+ return after(code);
2741
+ }
2742
+ /** @type {State} */
2743
+ function prefix(code) {
2744
+ if (markdownSpace(code) && size < max) {
2745
+ effects.consume(code);
2746
+ size++;
2747
+ return prefix;
2748
+ }
2749
+ effects.exit(type);
2750
+ return after(code);
2751
+ }
2752
+ /** @type {State} */
2753
+ function after(code) {
2754
+ return size >= min ? ok(code) : nok(code);
2755
+ }
2756
+ }
2709
2757
  //#endregion
2710
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/initialize/content.js
2758
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/initialize/content.js
2711
2759
  /**
2712
2760
  * @import {
2713
2761
  * InitialConstruct,
@@ -2774,7 +2822,153 @@ function initializeContent(effects) {
2774
2822
  }
2775
2823
  }
2776
2824
  //#endregion
2777
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/initialize/document.js
2825
+ //#region node_modules/.pnpm/micromark-util-edit-map@1.0.0/node_modules/micromark-util-edit-map/index.js
2826
+ /**
2827
+ * @import {Event} from 'micromark-util-types'
2828
+ */
2829
+ /**
2830
+ * @typedef {[number, number, Array<Event>]} Change
2831
+ * @typedef {[number, number, number]} Jump
2832
+ */
2833
+ /**
2834
+ * Tracks a bunch of edits.
2835
+ *
2836
+ * Port of `edit_map.rs` from `markdown-rs`:
2837
+ * <https://github.com/wooorm/markdown-rs/blob/1506572f/src/util/edit_map.rs>.
2838
+ *
2839
+ * Deal with several changes in events, batching them together.
2840
+ *
2841
+ * Preferably, changes should be kept to a minimum.
2842
+ * Sometimes, it’s needed to change the list of events, because parsing can be
2843
+ * messy, and it helps to expose a cleaner interface of events to the compiler
2844
+ * and other users.
2845
+ * It can also help to merge many adjacent similar events.
2846
+ * And, in other cases, it’s needed to parse subcontent: pass some events
2847
+ * through another tokenizer and inject the result.
2848
+ */
2849
+ var EditMap$1 = class {
2850
+ /**
2851
+ * Create a new edit map.
2852
+ *
2853
+ * @returns
2854
+ * New instance.
2855
+ */
2856
+ constructor() {
2857
+ /**
2858
+ * Changes by index, so `add` does not need to scan `map` (which is
2859
+ * quadratic for documents with many edits at different places).
2860
+ *
2861
+ * @type {Map<number, Change>}
2862
+ */
2863
+ this.index = /* @__PURE__ */ new Map();
2864
+ /**
2865
+ * Record of changes.
2866
+ *
2867
+ * @type {Array<Change>}
2868
+ */
2869
+ this.map = [];
2870
+ }
2871
+ /**
2872
+ * Create an edit: a remove and/or add at a certain place.
2873
+ *
2874
+ * @param {number} index
2875
+ * Index at which to apply the edit.
2876
+ * @param {number} remove
2877
+ * Count of items to remove at the index.
2878
+ * @param {Array<Event>} add
2879
+ * Items to add at the index.
2880
+ * @returns {undefined}
2881
+ * Nothing.
2882
+ */
2883
+ add(index, remove, add) {
2884
+ addImplementation$1(this, index, remove, add, false);
2885
+ }
2886
+ /**
2887
+ * Create an edit: but insert `add` before existing additions, instead of
2888
+ * after them.
2889
+ *
2890
+ * @param {number} index
2891
+ * Index at which to apply the edit.
2892
+ * @param {number} remove
2893
+ * Count of items to remove at the index.
2894
+ * @param {Array<Event>} add
2895
+ * Items to add at the index.
2896
+ * @returns {undefined}
2897
+ * Nothing.
2898
+ */
2899
+ addBefore(index, remove, add) {
2900
+ addImplementation$1(this, index, remove, add, true);
2901
+ }
2902
+ /**
2903
+ * Done, change the events.
2904
+ *
2905
+ * @param {Array<Event>} events
2906
+ * List of events to apply the edits to.
2907
+ * @returns {undefined}
2908
+ * Nothing.
2909
+ */
2910
+ consume(events) {
2911
+ this.map.sort(function(a, b) {
2912
+ return a[0] - b[0];
2913
+ });
2914
+ if (this.map.length === 0) return;
2915
+ let index = this.map.length;
2916
+ /** @type {Array<Array<Event>>} */
2917
+ const vecs = [];
2918
+ while (index > 0) {
2919
+ index -= 1;
2920
+ vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
2921
+ events.length = this.map[index][0];
2922
+ }
2923
+ vecs.push(events.slice());
2924
+ events.length = 0;
2925
+ let slice = vecs.pop();
2926
+ while (slice) {
2927
+ for (const element of slice) events.push(element);
2928
+ slice = vecs.pop();
2929
+ }
2930
+ this.map.length = 0;
2931
+ this.index.clear();
2932
+ }
2933
+ };
2934
+ /**
2935
+ * Create an edit.
2936
+ *
2937
+ * @param {EditMap} editMap
2938
+ * Edit map to apply to.
2939
+ * @param {number} at
2940
+ * Index at which to apply the edit.
2941
+ * @param {number} remove
2942
+ * Count of items to remove at the index.
2943
+ * @param {Array<Event>} add
2944
+ * Items to add at the index.
2945
+ * @param {boolean} before
2946
+ * Insert `add` before existing additions at `at`, instead of after them.
2947
+ * @returns {undefined}
2948
+ * Nothing.
2949
+ */
2950
+ function addImplementation$1(editMap, at, remove, add, before) {
2951
+ if (remove === 0 && add.length === 0) return;
2952
+ const existing = editMap.index.get(at);
2953
+ if (existing) {
2954
+ existing[1] += remove;
2955
+ if (before) {
2956
+ add.push(...existing[2]);
2957
+ existing[2] = add;
2958
+ } else existing[2].push(...add);
2959
+ return;
2960
+ }
2961
+ /** @type {Change} */
2962
+ const change = [
2963
+ at,
2964
+ remove,
2965
+ add
2966
+ ];
2967
+ editMap.map.push(change);
2968
+ editMap.index.set(at, change);
2969
+ }
2970
+ //#endregion
2971
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/initialize/document.js
2778
2972
  /**
2779
2973
  * @import {
2780
2974
  * Construct,
@@ -2843,8 +3037,10 @@ function initializeDocument(effects) {
2843
3037
  self.events[index][1].end = { ...point };
2844
3038
  index++;
2845
3039
  }
2846
- splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
2847
- self.events.length = index;
3040
+ const editMap = new EditMap$1();
3041
+ editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
3042
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
3043
+ editMap.consume(self.events);
2848
3044
  return checkNewContainers(code);
2849
3045
  }
2850
3046
  return start(code);
@@ -2954,8 +3150,10 @@ function initializeDocument(effects) {
2954
3150
  self.events[index][1].end = { ...point };
2955
3151
  index++;
2956
3152
  }
2957
- splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
2958
- self.events.length = index;
3153
+ const editMap = new EditMap$1();
3154
+ editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
3155
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
3156
+ editMap.consume(self.events);
2959
3157
  }
2960
3158
  }
2961
3159
  /**
@@ -3043,7 +3241,7 @@ function resolveAll(constructs, events, context) {
3043
3241
  return events;
3044
3242
  }
3045
3243
  //#endregion
3046
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/attention.js
3244
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/attention.js
3047
3245
  /**
3048
3246
  * @import {
3049
3247
  * Code,
@@ -3070,47 +3268,33 @@ const attention = {
3070
3268
  */
3071
3269
  function resolveAllAttention(events, context) {
3072
3270
  let index = -1;
3073
- /** @type {number} */
3074
- let open;
3075
- /** @type {Token} */
3076
- let group;
3077
- /** @type {Token} */
3078
- let text;
3079
- /** @type {Token} */
3080
- let openingSequence;
3081
- /** @type {Token} */
3082
- let closingSequence;
3083
- /** @type {number} */
3084
- let use;
3085
3271
  /** @type {Array<Event>} */
3086
3272
  let nextEvents;
3087
- /** @type {number} */
3088
- let offset;
3089
3273
  while (++index < events.length) if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
3090
- open = index;
3274
+ let open = index;
3091
3275
  while (open--) if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
3092
3276
  if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) continue;
3093
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
3277
+ const use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
3094
3278
  const start = { ...events[open][1].end };
3095
3279
  const end = { ...events[index][1].start };
3096
3280
  movePoint(start, -use);
3097
3281
  movePoint(end, use);
3098
- openingSequence = {
3282
+ const openingSequence = {
3099
3283
  type: use > 1 ? "strongSequence" : "emphasisSequence",
3100
3284
  start,
3101
3285
  end: { ...events[open][1].end }
3102
3286
  };
3103
- closingSequence = {
3287
+ const closingSequence = {
3104
3288
  type: use > 1 ? "strongSequence" : "emphasisSequence",
3105
3289
  start: { ...events[index][1].start },
3106
3290
  end
3107
3291
  };
3108
- text = {
3292
+ const text = {
3109
3293
  type: use > 1 ? "strongText" : "emphasisText",
3110
3294
  start: { ...events[open][1].end },
3111
3295
  end: { ...events[index][1].start }
3112
3296
  };
3113
- group = {
3297
+ const group = {
3114
3298
  type: use > 1 ? "strong" : "emphasis",
3115
3299
  start: { ...openingSequence.start },
3116
3300
  end: { ...closingSequence.end }
@@ -3172,6 +3356,8 @@ function resolveAllAttention(events, context) {
3172
3356
  context
3173
3357
  ]
3174
3358
  ]);
3359
+ /** @type {number} */
3360
+ let offset = 0;
3175
3361
  if (events[index][1].end.offset - events[index][1].start.offset) {
3176
3362
  offset = 2;
3177
3363
  nextEvents = push(nextEvents, [[
@@ -3183,7 +3369,7 @@ function resolveAllAttention(events, context) {
3183
3369
  events[index][1],
3184
3370
  context
3185
3371
  ]]);
3186
- } else offset = 0;
3372
+ }
3187
3373
  splice(events, open - 1, index - open + 3, nextEvents);
3188
3374
  index = open + nextEvents.length - offset - 2;
3189
3375
  break;
@@ -3237,8 +3423,8 @@ function tokenizeAttention(effects, ok) {
3237
3423
  }
3238
3424
  const token = effects.exit("attentionSequence");
3239
3425
  const after = classifyCharacter(code);
3240
- const open = !after || after === 2 && before || attentionMarkers.includes(code);
3241
- const close = !before || before === 2 && after || attentionMarkers.includes(previous);
3426
+ const open = !after || after === 2 && before || attentionMarkers.includes(code) && code !== 42 && code !== 95;
3427
+ const close = !before || before === 2 && after || attentionMarkers.includes(previous) && previous !== 42 && previous !== 95;
3242
3428
  token._open = Boolean(marker === 42 ? open : open && (before || !close));
3243
3429
  token._close = Boolean(marker === 42 ? close : close && (after || !open));
3244
3430
  return ok(code);
@@ -3263,7 +3449,7 @@ function movePoint(point, offset) {
3263
3449
  point._bufferIndex += offset;
3264
3450
  }
3265
3451
  //#endregion
3266
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/autolink.js
3452
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/autolink.js
3267
3453
  /**
3268
3454
  * @import {
3269
3455
  * Construct,
@@ -3474,7 +3660,7 @@ function tokenizeAutolink(effects, ok, nok) {
3474
3660
  }
3475
3661
  }
3476
3662
  //#endregion
3477
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.js
3663
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/blank-line.js
3478
3664
  /**
3479
3665
  * @import {
3480
3666
  * Construct,
@@ -3531,7 +3717,7 @@ function tokenizeBlankLine(effects, ok, nok) {
3531
3717
  }
3532
3718
  }
3533
3719
  //#endregion
3534
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/block-quote.js
3720
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/block-quote.js
3535
3721
  /**
3536
3722
  * @import {
3537
3723
  * Construct,
@@ -3658,7 +3844,7 @@ function exit$1(effects) {
3658
3844
  effects.exit("blockQuote");
3659
3845
  }
3660
3846
  //#endregion
3661
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-escape.js
3847
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/character-escape.js
3662
3848
  /**
3663
3849
  * @import {
3664
3850
  * Construct,
@@ -3718,7 +3904,7 @@ function tokenizeCharacterEscape(effects, ok, nok) {
3718
3904
  }
3719
3905
  }
3720
3906
  //#endregion
3721
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/character-reference.js
3907
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/character-reference.js
3722
3908
  /**
3723
3909
  * @import {
3724
3910
  * Code,
@@ -3856,7 +4042,55 @@ function tokenizeCharacterReference(effects, ok, nok) {
3856
4042
  }
3857
4043
  }
3858
4044
  //#endregion
3859
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-fenced.js
4045
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
4046
+ /** @type {Construct} */
4047
+ const nonLazyContinuation = {
4048
+ partial: true,
4049
+ tokenize: tokenizeNonLazyContinuation
4050
+ };
4051
+ /**
4052
+ * @this {TokenizeContext}
4053
+ * Context.
4054
+ * @type {Tokenizer}
4055
+ */
4056
+ function tokenizeNonLazyContinuation(effects, ok, nok) {
4057
+ const self = this;
4058
+ return start;
4059
+ /**
4060
+ * At eol, before continuation.
4061
+ *
4062
+ * ```markdown
4063
+ * > | * ```js
4064
+ * ^
4065
+ * | b
4066
+ * ```
4067
+ *
4068
+ * @type {State}
4069
+ */
4070
+ function start(code) {
4071
+ if (code === null) return nok(code);
4072
+ effects.enter("lineEnding");
4073
+ effects.consume(code);
4074
+ effects.exit("lineEnding");
4075
+ return after;
4076
+ }
4077
+ /**
4078
+ * A continuation.
4079
+ *
4080
+ * ```markdown
4081
+ * | * ```js
4082
+ * > | b
4083
+ * ^
4084
+ * ```
4085
+ *
4086
+ * @type {State}
4087
+ */
4088
+ function after(code) {
4089
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
4090
+ }
4091
+ }
4092
+ //#endregion
4093
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/code-fenced.js
3860
4094
  /**
3861
4095
  * @import {
3862
4096
  * Code,
@@ -3867,11 +4101,6 @@ function tokenizeCharacterReference(effects, ok, nok) {
3867
4101
  * } from 'micromark-util-types'
3868
4102
  */
3869
4103
  /** @type {Construct} */
3870
- const nonLazyContinuation = {
3871
- partial: true,
3872
- tokenize: tokenizeNonLazyContinuation
3873
- };
3874
- /** @type {Construct} */
3875
4104
  const codeFenced = {
3876
4105
  concrete: true,
3877
4106
  name: "codeFenced",
@@ -4241,37 +4470,8 @@ function tokenizeCodeFenced(effects, ok, nok) {
4241
4470
  }
4242
4471
  }
4243
4472
  }
4244
- /**
4245
- * @this {TokenizeContext}
4246
- * Context.
4247
- * @type {Tokenizer}
4248
- */
4249
- function tokenizeNonLazyContinuation(effects, ok, nok) {
4250
- const self = this;
4251
- return start;
4252
- /**
4253
- *
4254
- *
4255
- * @type {State}
4256
- */
4257
- function start(code) {
4258
- if (code === null) return nok(code);
4259
- effects.enter("lineEnding");
4260
- effects.consume(code);
4261
- effects.exit("lineEnding");
4262
- return lineStart;
4263
- }
4264
- /**
4265
- *
4266
- *
4267
- * @type {State}
4268
- */
4269
- function lineStart(code) {
4270
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
4271
- }
4272
- }
4273
4473
  //#endregion
4274
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-indented.js
4474
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/code-indented.js
4275
4475
  /**
4276
4476
  * @import {
4277
4477
  * Construct,
@@ -4296,7 +4496,6 @@ const furtherStart = {
4296
4496
  * @type {Tokenizer}
4297
4497
  */
4298
4498
  function tokenizeCodeIndented(effects, ok, nok) {
4299
- const self = this;
4300
4499
  return start;
4301
4500
  /**
4302
4501
  * Start of code (indented).
@@ -4314,21 +4513,7 @@ function tokenizeCodeIndented(effects, ok, nok) {
4314
4513
  */
4315
4514
  function start(code) {
4316
4515
  effects.enter("codeIndented");
4317
- return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
4318
- }
4319
- /**
4320
- * At start, after 1 or 4 spaces.
4321
- *
4322
- * ```markdown
4323
- * > | aaa
4324
- * ^
4325
- * ```
4326
- *
4327
- * @type {State}
4328
- */
4329
- function afterPrefix(code) {
4330
- const tail = self.events[self.events.length - 1];
4331
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);
4516
+ return factorySpaceMinMax(effects, atBreak, nok, "linePrefix", 4, 4)(code);
4332
4517
  }
4333
4518
  /**
4334
4519
  * At a break.
@@ -4397,25 +4582,28 @@ function tokenizeFurtherStart(effects, ok, nok) {
4397
4582
  effects.exit("lineEnding");
4398
4583
  return furtherStart;
4399
4584
  }
4400
- return factorySpace(effects, afterPrefix, "linePrefix", 5)(code);
4585
+ return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, "linePrefix", 4, 4)(code);
4401
4586
  }
4402
4587
  /**
4403
- * At start, after 1 or 4 spaces.
4588
+ * After not enough of a prefix.
4589
+ *
4590
+ * A following line ending is another (potentially blank) line to try,
4591
+ * anything else means this isn’t a continuation.
4404
4592
  *
4405
4593
  * ```markdown
4406
4594
  * > | aaa
4407
- * ^
4595
+ *
4596
+ * | bbb
4408
4597
  * ```
4409
4598
  *
4410
4599
  * @type {State}
4411
4600
  */
4412
- function afterPrefix(code) {
4413
- const tail = self.events[self.events.length - 1];
4414
- return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
4601
+ function onNotEnoughPrefix(code) {
4602
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code);
4415
4603
  }
4416
4604
  }
4417
4605
  //#endregion
4418
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/code-text.js
4606
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/code-text.js
4419
4607
  /**
4420
4608
  * @import {
4421
4609
  * Construct,
@@ -4985,7 +5173,7 @@ function subcontent(events, eventIndex) {
4985
5173
  return gaps;
4986
5174
  }
4987
5175
  //#endregion
4988
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/content.js
5176
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/content.js
4989
5177
  /**
4990
5178
  * @import {
4991
5179
  * Construct,
@@ -5621,7 +5809,7 @@ function factoryWhitespace(effects, ok) {
5621
5809
  }
5622
5810
  }
5623
5811
  //#endregion
5624
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/definition.js
5812
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/definition.js
5625
5813
  /**
5626
5814
  * @import {
5627
5815
  * Construct,
@@ -5836,7 +6024,7 @@ function tokenizeTitleBefore(effects, ok, nok) {
5836
6024
  }
5837
6025
  }
5838
6026
  //#endregion
5839
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
6027
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
5840
6028
  /**
5841
6029
  * @import {
5842
6030
  * Construct,
@@ -5893,7 +6081,7 @@ function tokenizeHardBreakEscape(effects, ok, nok) {
5893
6081
  }
5894
6082
  }
5895
6083
  //#endregion
5896
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/heading-atx.js
6084
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/heading-atx.js
5897
6085
  /**
5898
6086
  * @import {
5899
6087
  * Construct,
@@ -5914,20 +6102,16 @@ const headingAtx = {
5914
6102
  function resolveHeadingAtx(events, context) {
5915
6103
  let contentEnd = events.length - 2;
5916
6104
  let contentStart = 3;
5917
- /** @type {Token} */
5918
- let content;
5919
- /** @type {Token} */
5920
- let text;
5921
6105
  if (events[contentStart][1].type === "whitespace") contentStart += 2;
5922
6106
  if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") contentEnd -= 2;
5923
6107
  if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
5924
6108
  if (contentEnd > contentStart) {
5925
- content = {
6109
+ const content = {
5926
6110
  type: "atxHeadingText",
5927
6111
  start: events[contentStart][1].start,
5928
6112
  end: events[contentEnd][1].end
5929
6113
  };
5930
- text = {
6114
+ const text = {
5931
6115
  type: "chunkText",
5932
6116
  start: events[contentStart][1].start,
5933
6117
  end: events[contentEnd][1].end,
@@ -6177,7 +6361,7 @@ const htmlRawNames = [
6177
6361
  "textarea"
6178
6362
  ];
6179
6363
  //#endregion
6180
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-flow.js
6364
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/html-flow.js
6181
6365
  /**
6182
6366
  * @import {
6183
6367
  * Code,
@@ -6200,10 +6384,6 @@ const blankLineBefore = {
6200
6384
  partial: true,
6201
6385
  tokenize: tokenizeBlankLineBefore
6202
6386
  };
6203
- const nonLazyContinuationStart = {
6204
- partial: true,
6205
- tokenize: tokenizeNonLazyContinuationStart
6206
- };
6207
6387
  /** @type {Resolver} */
6208
6388
  function resolveToHtmlFlow(events) {
6209
6389
  let index = events.length;
@@ -6706,7 +6886,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
6706
6886
  * @type {State}
6707
6887
  */
6708
6888
  function continuationStart(code) {
6709
- return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
6889
+ return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
6710
6890
  }
6711
6891
  /**
6712
6892
  * In continuation, at eol, before non-lazy content.
@@ -6886,49 +7066,6 @@ function tokenizeHtmlFlow(effects, ok, nok) {
6886
7066
  * Context.
6887
7067
  * @type {Tokenizer}
6888
7068
  */
6889
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
6890
- const self = this;
6891
- return start;
6892
- /**
6893
- * At eol, before continuation.
6894
- *
6895
- * ```markdown
6896
- * > | * ```js
6897
- * ^
6898
- * | b
6899
- * ```
6900
- *
6901
- * @type {State}
6902
- */
6903
- function start(code) {
6904
- if (markdownLineEnding(code)) {
6905
- effects.enter("lineEnding");
6906
- effects.consume(code);
6907
- effects.exit("lineEnding");
6908
- return after;
6909
- }
6910
- return nok(code);
6911
- }
6912
- /**
6913
- * A continuation.
6914
- *
6915
- * ```markdown
6916
- * | * ```js
6917
- * > | b
6918
- * ^
6919
- * ```
6920
- *
6921
- * @type {State}
6922
- */
6923
- function after(code) {
6924
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
6925
- }
6926
- }
6927
- /**
6928
- * @this {TokenizeContext}
6929
- * Context.
6930
- * @type {Tokenizer}
6931
- */
6932
7069
  function tokenizeBlankLineBefore(effects, ok, nok) {
6933
7070
  return start;
6934
7071
  /**
@@ -6950,7 +7087,7 @@ function tokenizeBlankLineBefore(effects, ok, nok) {
6950
7087
  }
6951
7088
  }
6952
7089
  //#endregion
6953
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/html-text.js
7090
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/html-text.js
6954
7091
  /**
6955
7092
  * @import {
6956
7093
  * Code,
@@ -7564,7 +7701,7 @@ function tokenizeHtmlText(effects, ok, nok) {
7564
7701
  }
7565
7702
  }
7566
7703
  //#endregion
7567
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-end.js
7704
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/label-end.js
7568
7705
  /**
7569
7706
  * @import {
7570
7707
  * Construct,
@@ -7610,8 +7747,6 @@ function resolveAllLabelEnd(events) {
7610
7747
  function resolveToLabelEnd(events, context) {
7611
7748
  let index = events.length;
7612
7749
  let offset = 0;
7613
- /** @type {Token} */
7614
- let token;
7615
7750
  /** @type {number | undefined} */
7616
7751
  let open;
7617
7752
  /** @type {number | undefined} */
@@ -7619,7 +7754,7 @@ function resolveToLabelEnd(events, context) {
7619
7754
  /** @type {Array<Event>} */
7620
7755
  let media;
7621
7756
  while (index--) {
7622
- token = events[index][1];
7757
+ const token = events[index][1];
7623
7758
  if (open) {
7624
7759
  if (token.type === "link" || token.type === "labelLink" && token._inactive) break;
7625
7760
  if (events[index][0] === "enter" && token.type === "labelLink") token._inactive = true;
@@ -7694,14 +7829,14 @@ function resolveToLabelEnd(events, context) {
7694
7829
  */
7695
7830
  function tokenizeLabelEnd(effects, ok, nok) {
7696
7831
  const self = this;
7697
- let index = self.events.length;
7832
+ const labelStarts = self._labelStarts;
7698
7833
  /** @type {Token} */
7699
7834
  let labelStart;
7700
7835
  /** @type {boolean} */
7701
7836
  let defined;
7702
- while (index--) if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) {
7703
- labelStart = self.events[index][1];
7704
- break;
7837
+ if (labelStarts) {
7838
+ while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) labelStarts.pop();
7839
+ labelStart = labelStarts[labelStarts.length - 1];
7705
7840
  }
7706
7841
  return start;
7707
7842
  /**
@@ -7788,6 +7923,7 @@ function tokenizeLabelEnd(effects, ok, nok) {
7788
7923
  * @type {State}
7789
7924
  */
7790
7925
  function labelEndOk(code) {
7926
+ labelStarts.pop();
7791
7927
  return ok(code);
7792
7928
  }
7793
7929
  /**
@@ -8034,11 +8170,12 @@ function tokenizeReferenceCollapsed(effects, ok, nok) {
8034
8170
  }
8035
8171
  }
8036
8172
  //#endregion
8037
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-image.js
8173
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/label-start-image.js
8038
8174
  /**
8039
8175
  * @import {
8040
8176
  * Construct,
8041
8177
  * State,
8178
+ * Token,
8042
8179
  * TokenizeContext,
8043
8180
  * Tokenizer
8044
8181
  * } from 'micromark-util-types'
@@ -8056,6 +8193,8 @@ const labelStartImage = {
8056
8193
  */
8057
8194
  function tokenizeLabelStartImage(effects, ok, nok) {
8058
8195
  const self = this;
8196
+ /** @type {Token} */
8197
+ let labelImage;
8059
8198
  return start;
8060
8199
  /**
8061
8200
  * Start of label (image) start.
@@ -8089,7 +8228,7 @@ function tokenizeLabelStartImage(effects, ok, nok) {
8089
8228
  effects.enter("labelMarker");
8090
8229
  effects.consume(code);
8091
8230
  effects.exit("labelMarker");
8092
- effects.exit("labelImage");
8231
+ labelImage = effects.exit("labelImage");
8093
8232
  return after;
8094
8233
  }
8095
8234
  return nok(code);
@@ -8122,16 +8261,20 @@ function tokenizeLabelStartImage(effects, ok, nok) {
8122
8261
  * @type {State}
8123
8262
  */
8124
8263
  function after(code) {
8125
- /* c8 ignore next 3 */
8126
- return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
8264
+ /* c8 ignore next 6 */
8265
+ if (code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
8266
+ self._labelStarts = self._labelStarts || [];
8267
+ self._labelStarts.push(labelImage);
8268
+ return ok(code);
8127
8269
  }
8128
8270
  }
8129
8271
  //#endregion
8130
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/label-start-link.js
8272
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/label-start-link.js
8131
8273
  /**
8132
8274
  * @import {
8133
8275
  * Construct,
8134
8276
  * State,
8277
+ * Token,
8135
8278
  * TokenizeContext,
8136
8279
  * Tokenizer
8137
8280
  * } from 'micromark-util-types'
@@ -8149,6 +8292,8 @@ const labelStartLink = {
8149
8292
  */
8150
8293
  function tokenizeLabelStartLink(effects, ok, nok) {
8151
8294
  const self = this;
8295
+ /** @type {Token} */
8296
+ let labelLink;
8152
8297
  return start;
8153
8298
  /**
8154
8299
  * Start of label (link) start.
@@ -8165,17 +8310,20 @@ function tokenizeLabelStartLink(effects, ok, nok) {
8165
8310
  effects.enter("labelMarker");
8166
8311
  effects.consume(code);
8167
8312
  effects.exit("labelMarker");
8168
- effects.exit("labelLink");
8313
+ labelLink = effects.exit("labelLink");
8169
8314
  return after;
8170
8315
  }
8171
8316
  /** @type {State} */
8172
8317
  function after(code) {
8173
- /* c8 ignore next 3 */
8174
- return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
8318
+ /* c8 ignore next 6 */
8319
+ if (code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
8320
+ self._labelStarts = self._labelStarts || [];
8321
+ self._labelStarts.push(labelLink);
8322
+ return ok(code);
8175
8323
  }
8176
8324
  }
8177
8325
  //#endregion
8178
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/line-ending.js
8326
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/line-ending.js
8179
8327
  /**
8180
8328
  * @import {
8181
8329
  * Construct,
@@ -8205,7 +8353,7 @@ function tokenizeLineEnding(effects, ok) {
8205
8353
  }
8206
8354
  }
8207
8355
  //#endregion
8208
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/thematic-break.js
8356
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/thematic-break.js
8209
8357
  /**
8210
8358
  * @import {
8211
8359
  * Code,
@@ -8300,7 +8448,7 @@ function tokenizeThematicBreak(effects, ok, nok) {
8300
8448
  }
8301
8449
  }
8302
8450
  //#endregion
8303
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/list.js
8451
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/list.js
8304
8452
  /**
8305
8453
  * @import {
8306
8454
  * Code,
@@ -8472,7 +8620,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
8472
8620
  }
8473
8621
  }
8474
8622
  //#endregion
8475
- //#region node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/setext-underline.js
8623
+ //#region node_modules/.pnpm/micromark-core-commonmark@2.0.4/node_modules/micromark-core-commonmark/lib/setext-underline.js
8476
8624
  /**
8477
8625
  * @import {
8478
8626
  * Code,
@@ -8491,6 +8639,7 @@ const setextUnderline = {
8491
8639
  };
8492
8640
  /** @type {Resolver} */
8493
8641
  function resolveToSetextUnderline(events, context) {
8642
+ const editMap = new EditMap$1();
8494
8643
  let index = events.length;
8495
8644
  /** @type {number | undefined} */
8496
8645
  let content;
@@ -8505,7 +8654,7 @@ function resolveToSetextUnderline(events, context) {
8505
8654
  }
8506
8655
  if (events[index][1].type === "paragraph") text = index;
8507
8656
  } else {
8508
- if (events[index][1].type === "content") events.splice(index, 1);
8657
+ if (events[index][1].type === "content") editMap.add(index, 1, []);
8509
8658
  if (!definition && events[index][1].type === "definition") definition = index;
8510
8659
  }
8511
8660
  const heading = {
@@ -8515,23 +8664,24 @@ function resolveToSetextUnderline(events, context) {
8515
8664
  };
8516
8665
  events[text][1].type = "setextHeadingText";
8517
8666
  if (definition) {
8518
- events.splice(text, 0, [
8667
+ editMap.add(text, 0, [[
8519
8668
  "enter",
8520
8669
  heading,
8521
8670
  context
8522
- ]);
8523
- events.splice(definition + 1, 0, [
8671
+ ]]);
8672
+ editMap.add(definition + 1, 0, [[
8524
8673
  "exit",
8525
8674
  events[content][1],
8526
8675
  context
8527
- ]);
8676
+ ]]);
8528
8677
  events[content][1].end = { ...events[definition][1].end };
8529
8678
  } else events[content][1] = heading;
8530
- events.push([
8679
+ editMap.add(events.length, 0, [[
8531
8680
  "exit",
8532
8681
  heading,
8533
8682
  context
8534
- ]);
8683
+ ]]);
8684
+ editMap.consume(events);
8535
8685
  return events;
8536
8686
  }
8537
8687
  /**
@@ -8624,7 +8774,7 @@ function tokenizeSetextUnderline(effects, ok, nok) {
8624
8774
  }
8625
8775
  }
8626
8776
  //#endregion
8627
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/initialize/flow.js
8777
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/initialize/flow.js
8628
8778
  /**
8629
8779
  * @import {
8630
8780
  * InitialConstruct,
@@ -8671,7 +8821,7 @@ function initializeFlow(effects) {
8671
8821
  }
8672
8822
  }
8673
8823
  //#endregion
8674
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/initialize/text.js
8824
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/initialize/text.js
8675
8825
  /**
8676
8826
  * @import {
8677
8827
  * Code,
@@ -8788,6 +8938,7 @@ function createResolver(extraResolver) {
8788
8938
  * @type {Resolver}
8789
8939
  */
8790
8940
  function resolveAllLineSuffixes(events, context) {
8941
+ const editMap = new EditMap$1();
8791
8942
  let eventIndex = 0;
8792
8943
  while (++eventIndex <= events.length) if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") {
8793
8944
  const data = events[eventIndex - 1][1];
@@ -8830,25 +8981,23 @@ function resolveAllLineSuffixes(events, context) {
8830
8981
  };
8831
8982
  data.end = { ...token.start };
8832
8983
  if (data.start.offset === data.end.offset) Object.assign(data, token);
8833
- else {
8834
- events.splice(eventIndex, 0, [
8835
- "enter",
8836
- token,
8837
- context
8838
- ], [
8839
- "exit",
8840
- token,
8841
- context
8842
- ]);
8843
- eventIndex += 2;
8844
- }
8984
+ else editMap.add(eventIndex, 0, [[
8985
+ "enter",
8986
+ token,
8987
+ context
8988
+ ], [
8989
+ "exit",
8990
+ token,
8991
+ context
8992
+ ]]);
8845
8993
  }
8846
8994
  eventIndex++;
8847
8995
  }
8996
+ editMap.consume(events);
8848
8997
  return events;
8849
8998
  }
8850
8999
  //#endregion
8851
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/constructs.js
9000
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/constructs.js
8852
9001
  /**
8853
9002
  * @import {Extension} from 'micromark-util-types'
8854
9003
  */
@@ -8926,7 +9075,7 @@ const attentionMarkers = { null: [42, 95] };
8926
9075
  /** @satisfies {Extension['disable']} */
8927
9076
  const disable = { null: [] };
8928
9077
  //#endregion
8929
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/create-tokenizer.js
9078
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/create-tokenizer.js
8930
9079
  /**
8931
9080
  * @import {
8932
9081
  * Chunk,
@@ -9082,12 +9231,10 @@ function createTokenizer(parser, initialize, from) {
9082
9231
  * Nothing.
9083
9232
  */
9084
9233
  function main() {
9085
- /** @type {number} */
9086
- let chunkIndex;
9087
9234
  while (point._index < chunks.length) {
9088
9235
  const chunk = chunks[point._index];
9089
9236
  if (typeof chunk === "string") {
9090
- chunkIndex = point._index;
9237
+ const chunkIndex = point._index;
9091
9238
  if (point._bufferIndex < 0) point._bufferIndex = 0;
9092
9239
  while (point._index === chunkIndex && point._bufferIndex < chunk.length) go(chunk.charCodeAt(point._bufferIndex));
9093
9240
  } else go(chunk);
@@ -9395,7 +9542,7 @@ function serializeChunks(chunks, expandTabs) {
9395
9542
  return result.join("");
9396
9543
  }
9397
9544
  //#endregion
9398
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/parse.js
9545
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/parse.js
9399
9546
  /**
9400
9547
  * @import {
9401
9548
  * Create,
@@ -9439,7 +9586,7 @@ function parse(options) {
9439
9586
  }
9440
9587
  }
9441
9588
  //#endregion
9442
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/postprocess.js
9589
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/postprocess.js
9443
9590
  /**
9444
9591
  * @import {Event} from 'micromark-util-types'
9445
9592
  */
@@ -9454,7 +9601,7 @@ function postprocess(events) {
9454
9601
  return events;
9455
9602
  }
9456
9603
  //#endregion
9457
- //#region node_modules/.pnpm/micromark@4.0.2_supports-color@10.2.2/node_modules/micromark/lib/preprocess.js
9604
+ //#region node_modules/.pnpm/micromark@4.0.3_supports-color@10.2.2/node_modules/micromark/lib/preprocess.js
9458
9605
  /**
9459
9606
  * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'
9460
9607
  */
@@ -9485,20 +9632,10 @@ function preprocess() {
9485
9632
  return preprocessor;
9486
9633
  /** @type {Preprocessor} */
9487
9634
  function preprocessor(value, encoding, end) {
9635
+ value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
9488
9636
  /** @type {Array<Chunk>} */
9489
9637
  const chunks = [];
9490
- /** @type {RegExpMatchArray | null} */
9491
- let match;
9492
- /** @type {number} */
9493
- let next;
9494
- /** @type {number} */
9495
- let startPosition;
9496
- /** @type {number} */
9497
- let endPosition;
9498
- /** @type {Code} */
9499
- let code;
9500
- value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || void 0).decode(value));
9501
- startPosition = 0;
9638
+ let startPosition = 0;
9502
9639
  buffer = "";
9503
9640
  if (start) {
9504
9641
  if (value.charCodeAt(0) === 65279) startPosition++;
@@ -9506,9 +9643,9 @@ function preprocess() {
9506
9643
  }
9507
9644
  while (startPosition < value.length) {
9508
9645
  search.lastIndex = startPosition;
9509
- match = search.exec(value);
9510
- endPosition = match && match.index !== void 0 ? match.index : value.length;
9511
- code = value.charCodeAt(endPosition);
9646
+ const match = search.exec(value);
9647
+ const endPosition = match && match.index !== void 0 ? match.index : value.length;
9648
+ const code = value.charCodeAt(endPosition);
9512
9649
  if (!match) {
9513
9650
  buffer = value.slice(startPosition);
9514
9651
  break;
@@ -9530,11 +9667,12 @@ function preprocess() {
9530
9667
  chunks.push(65533);
9531
9668
  column++;
9532
9669
  break;
9533
- case 9:
9534
- next = Math.ceil(column / 4) * 4;
9670
+ case 9: {
9671
+ const next = Math.ceil(column / 4) * 4;
9535
9672
  chunks.push(-2);
9536
9673
  while (column++ < next) chunks.push(-1);
9537
9674
  break;
9675
+ }
9538
9676
  case 10:
9539
9677
  chunks.push(-4);
9540
9678
  column = 1;
@@ -12002,7 +12140,7 @@ function reduceReasoningText(text, codeSpans, state, options) {
12002
12140
  if (options.final && state.depth > 0 && state.pending) {
12003
12141
  const pending = state.pending;
12004
12142
  if (!pending.containsPrivate) {
12005
- if (options.mode === "static-preserve" || options.mode === "static-strict" && !pending.visibleBefore && !pending.protectedClose || options.mode === "visible" && !pending.protectedClose) emit("text", options.mode === "visible" && pending.visibleBefore ? pending.openTag + pending.content : pending.content);
12143
+ if ((options.mode === "static-preserve" || options.mode === "static-strict" && !pending.visibleBefore && !pending.protectedClose || options.mode === "visible" && !pending.protectedClose) && options.recoverUnclosed !== false) emit("text", options.mode === "visible" && pending.visibleBefore ? pending.openTag + pending.content : pending.content);
12006
12144
  else emit("thinking", pending.content);
12007
12145
  }
12008
12146
  state.depth = 0;
@@ -12181,7 +12319,7 @@ function createReasoningTagTextPartitioner() {
12181
12319
  reduceSafePrefix(special, safeLimit, limit, output);
12182
12320
  }
12183
12321
  };
12184
- const processBlock = (end, final, output, parsedCodeSpans, parsedRetainStart) => {
12322
+ const processBlock = (end, final, output, parsedCodeSpans, parsedRetainStart, recoverUnclosed = true) => {
12185
12323
  const previousBlockStart = blockStart;
12186
12324
  let blockCodeSpans = parsedCodeSpans;
12187
12325
  let blockRetainStart = parsedRetainStart;
@@ -12189,30 +12327,31 @@ function createReasoningTagTextPartitioner() {
12189
12327
  if (!final || reduction.depth === 0) return;
12190
12328
  merge(output, reduceReasoningText("", [], reduction, {
12191
12329
  final: true,
12330
+ recoverUnclosed,
12192
12331
  mode: strictMode ? "hide" : "visible",
12193
12332
  scope: "all"
12194
12333
  }));
12195
12334
  };
12196
12335
  if (end <= blockStart) {
12197
12336
  finalizePending();
12198
- return true;
12337
+ return;
12199
12338
  }
12200
12339
  if (end <= emitted) {
12201
12340
  finalizePending();
12202
12341
  blockStart = end;
12203
12342
  fastPathCheckedThrough = Math.max(fastPathCheckedThrough, end);
12204
- return true;
12343
+ return;
12205
12344
  }
12206
12345
  emitSafePrefix(end, output);
12207
12346
  if (holdStart !== void 0 && holdStart < end) {
12208
12347
  const held = source.slice(holdStart, end);
12209
12348
  if (!final) {
12210
- if (pendingTagProbe && !pendingTagProbe.resolved) return false;
12349
+ if (pendingTagProbe && !pendingTagProbe.resolved) return;
12211
12350
  pendingTagProbe = void 0;
12212
12351
  const pendingStart = scanReasoningTags(held, false).pendingStart;
12213
12352
  if (pendingStart !== void 0) {
12214
12353
  startPendingTagProbe(holdStart + pendingStart, end);
12215
- return false;
12354
+ return;
12216
12355
  }
12217
12356
  }
12218
12357
  const block = source.slice(0, end);
@@ -12224,6 +12363,7 @@ function createReasoningTagTextPartitioner() {
12224
12363
  }
12225
12364
  merge(output, reduceReasoningText(block, blockCodeSpans, reduction, {
12226
12365
  final,
12366
+ recoverUnclosed,
12227
12367
  mode: strictMode ? "hide" : "visible",
12228
12368
  scope: "all",
12229
12369
  start
@@ -12250,9 +12390,8 @@ function createReasoningTagTextPartitioner() {
12250
12390
  fastPathCheckedThrough = end;
12251
12391
  fastPathCodeSafe = !final && !crossedLineBoundary && emitted === source.length && !blockCodeSpans?.some(([, spanEnd]) => spanEnd === source.length);
12252
12392
  if (!final && reduction.depth === 0 && emitted === source.length && endedBlankBlock && !MARKDOWN_CONTAINER_LINE_RE.test(source.slice(blockRetainStart ?? 0)) && !blockCodeSpans?.some(([, spanEnd]) => spanEnd === source.length)) compactCommittedSource(blockRetainStart ?? 0);
12253
- return true;
12254
12393
  };
12255
- const consume = (appended, strict, final) => {
12394
+ const consume = (appended, strict, final, recoverUnclosed = true) => {
12256
12395
  strictMode ||= strict;
12257
12396
  const previousEndedBlankBlock = endedBlankBlock;
12258
12397
  source += appended;
@@ -12274,7 +12413,7 @@ function createReasoningTagTextPartitioner() {
12274
12413
  heldBacktickStart = void 0;
12275
12414
  }
12276
12415
  const output = [];
12277
- if (final) processBlock(source.length, true, output);
12416
+ if (final) processBlock(source.length, true, output, void 0, void 0, recoverUnclosed);
12278
12417
  else {
12279
12418
  emitSafePrefix(source.length, output, appended);
12280
12419
  if (!strictMode && holdStart !== void 0 && holdStart < source.length) {
@@ -12353,8 +12492,8 @@ function createReasoningTagTextPartitioner() {
12353
12492
  pushVisible(chunk) {
12354
12493
  return consume(chunk, false, false);
12355
12494
  },
12356
- flush() {
12357
- return consume("", strictMode, true);
12495
+ flush(options) {
12496
+ return consume("", strictMode, true, options?.recoverUnclosed);
12358
12497
  },
12359
12498
  hasPending() {
12360
12499
  return holdStart !== void 0 && holdStart < source.length || reduction.depth > 0 || emitted < source.length;