@openclaw/matrix 2026.9.1 → 2026.9.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 (57) hide show
  1. package/dist/api.js +4 -4
  2. package/dist/{approval-handler.runtime-B_6ytY5I.js → approval-handler.runtime-BJCD4dLf.js} +3 -3
  3. package/dist/{approval-ids-CfHtZ9d1.js → approval-ids-Bst7HM_o.js} +1 -1
  4. package/dist/{approval-reaction-auth-BpDvJqfy.js → approval-reaction-auth-DhH8QOSe.js} +1 -1
  5. package/dist/{channel-b-jES-oi.js → channel-Bs8VLb6q.js} +6 -6
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/{channel.runtime-BkqjwEDU.js → channel.runtime-CCJRhdH5.js} +2 -2
  8. package/dist/{channel.setup-BY42QaL7.js → channel.setup-DhmDXwPp.js} +6 -3
  9. package/dist/{cli-CtYeU7ol.js → cli-IvDUuiDH.js} +147 -113
  10. package/dist/{cli-metadata-B7MQjR5S.js → cli-metadata-BGryAl2e.js} +1 -1
  11. package/dist/cli-metadata.js +1 -1
  12. package/dist/{client-D2utPQ1E.js → client-oNOlldJI.js} +1 -1
  13. package/dist/contract-api.js +2 -2
  14. package/dist/doctor-contract-api.js +2 -2
  15. package/dist/{draft-stream-DPYdv4fE.js → draft-stream-DglwxWzJ.js} +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/{messages-C1U3b1oN.js → messages-Czn8lNEh.js} +2 -2
  18. package/dist/{monitor-SNnu-0bp.js → monitor-DouG43FJ.js} +35 -38
  19. package/dist/{outbound-CeCEtF_q.js → outbound-Co_tJyE6.js} +1 -1
  20. package/dist/plugin-entry.handlers.runtime.js +1 -1
  21. package/dist/{profile-update-Cd1p8ABr.js → profile-update-CAl8nZNG.js} +1 -1
  22. package/dist/{reaction-events-DveJRUaX.js → reaction-events-C_7G7bvI.js} +3 -3
  23. package/dist/{room-info-DVkKDscD.js → room-info-6viLR3NH.js} +3 -3
  24. package/dist/{send-DG7Bnj7_.js → send-B5XChnvB.js} +5 -9
  25. package/dist/session-binding-contract-api.js +1 -1
  26. package/dist/{setup-bootstrap-Co985F63.js → setup-bootstrap-S_loyUyM.js} +1 -1
  27. package/dist/{setup-core-CEF6exLW.js → setup-core-XkIfQ65J.js} +1 -1
  28. package/dist/setup-plugin-api.js +1 -1
  29. package/dist/{setup-surface-BSlj1vnL.js → setup-surface-B2yZ8KGc.js} +2 -2
  30. package/dist/{thread-bindings-DgxQEB99.js → thread-bindings-BkBnn4te.js} +1 -1
  31. package/dist/{tool-actions.runtime-vbkQgU7D.js → tool-actions.runtime-a5L5xGSP.js} +7 -7
  32. package/dist/{verification-D-iOebn4.js → verification-XJtTc5DI.js} +1 -1
  33. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
  34. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  35. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  36. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  37. package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
  38. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  39. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  40. package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
  41. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  42. package/node_modules/markdown-it/package.json +1 -2
  43. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  44. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  45. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  46. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  47. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  48. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  49. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  50. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  51. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  52. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  53. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  54. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  55. package/node_modules/typebox/package.json +1 -1
  56. package/openclaw.plugin.json +1 -2
  57. package/package.json +6 -6
@@ -43,21 +43,43 @@ interface Delimiter {
43
43
  * @category Main
44
44
  */
45
45
  interface MarkdownItOptions {
46
- /** Enable HTML tags in source. */
46
+ /**
47
+ * Enable HTML tags in source.
48
+ *
49
+ * @defaultValue `false` (`true` for `'commonmark'` preset only)
50
+ */
47
51
  html?: boolean;
48
- /** Use '/' to close single tags (`<br />`). */
52
+ /**
53
+ * Use '/' to close single tags (`<br />`).
54
+ *
55
+ * @defaultValue `false` (`true` for `'commonmark'` preset only)
56
+ */
49
57
  xhtmlOut?: boolean;
50
- /** Convert '\n' in paragraphs into `<br>`. */
58
+ /**
59
+ * Convert '\n' in paragraphs into `<br>`.
60
+ *
61
+ * @defaultValue `false`
62
+ */
51
63
  breaks?: boolean;
52
- /** CSS language prefix for fenced blocks, used by external syntax highlighters. */
64
+ /**
65
+ * CSS language prefix for fenced blocks, used by external syntax highlighters.
66
+ *
67
+ * @defaultValue `'language-'`
68
+ */
53
69
  langPrefix?: string;
54
- /** Autoconvert URL-like text to links. */
70
+ /**
71
+ * Autoconvert URL-like text to links.
72
+ *
73
+ * @defaultValue `false`
74
+ */
55
75
  linkify?: boolean;
56
76
  /**
57
77
  * Enable language-neutral replacements and quotes beautification.
58
78
  *
59
79
  * See the [replacement rules](https://github.com/markdown-it/markdown-it/blob/master/src/rules_core/replacements.ts)
60
80
  * for the full list.
81
+ *
82
+ * @defaultValue `false`
61
83
  */
62
84
  typographer?: boolean;
63
85
  /**
@@ -66,6 +88,8 @@ interface MarkdownItOptions {
66
88
  *
67
89
  * For example, use `'«»„“'` for Russian, `'„“‚‘'` for German, and
68
90
  * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
91
+ *
92
+ * @defaultValue `'“”‘’'`
69
93
  */
70
94
  quotes?: string | string[];
71
95
  /**
@@ -114,9 +138,15 @@ interface MarkdownItOptions {
114
138
  * }
115
139
  * });
116
140
  * ```
141
+ *
142
+ * @defaultValue `null`
117
143
  */
118
144
  highlight?: ((str: string, lang: string, attrs: string) => string) | null;
119
- /** Internal protection against excessive recursion. */
145
+ /**
146
+ * Internal protection against excessive recursion.
147
+ *
148
+ * @defaultValue `100`
149
+ */
120
150
  maxNesting?: number;
121
151
  }
122
152
  declare namespace utils_d_exports {
@@ -376,24 +406,23 @@ type RuleOptions = {
376
406
  * {@link MarkdownIt.use}.
377
407
  */
378
408
  declare class Ruler<Args extends unknown[], Result> {
409
+ /** @internal */
379
410
  __rules__: Array<{
380
411
  name: string;
381
412
  enabled: boolean;
382
413
  fn: (...args: Args) => Result;
383
414
  alt: string[];
384
415
  }>;
416
+ /** @internal */
385
417
  __cache__: Record<string, Array<(...args: Args) => Result>> | null;
418
+ /** @internal */
386
419
  __find__(name: string): number;
420
+ /** @internal */
387
421
  __compile__(): void;
388
422
  /**
389
423
  * Replace rule by name with new function & options. Throws error if name not
390
424
  * found.
391
425
  *
392
- * @param name Rule name to replace.
393
- * @param fn New rule function.
394
- * @param options Rule options. `alt` is an array with names of "alternate"
395
- * chains.
396
- *
397
426
  * @example Replace existing typographer replacement rule with new one
398
427
  * ```javascript
399
428
  * import MarkdownIt from 'markdown-it'
@@ -409,12 +438,6 @@ declare class Ruler<Args extends unknown[], Result> {
409
438
  * Add new rule to chain before one with given name. See also
410
439
  * {@link Ruler.after}, {@link Ruler.push}.
411
440
  *
412
- * @param beforeName New rule will be added before this one.
413
- * @param ruleName Name of added rule.
414
- * @param fn Rule function.
415
- * @param options Rule options. `alt` is an array with names of "alternate"
416
- * chains.
417
- *
418
441
  * @example
419
442
  * ```javascript
420
443
  * import MarkdownIt from 'markdown-it'
@@ -430,12 +453,6 @@ declare class Ruler<Args extends unknown[], Result> {
430
453
  * Add new rule to chain after one with given name. See also
431
454
  * {@link Ruler.before}, {@link Ruler.push}.
432
455
  *
433
- * @param afterName New rule will be added after this one.
434
- * @param ruleName Name of added rule.
435
- * @param fn Rule function.
436
- * @param options Rule options. `alt` is an array with names of "alternate"
437
- * chains.
438
- *
439
456
  * @example
440
457
  * ```javascript
441
458
  * import MarkdownIt from 'markdown-it'
@@ -451,11 +468,6 @@ declare class Ruler<Args extends unknown[], Result> {
451
468
  * Push new rule to the end of chain. See also
452
469
  * {@link Ruler.before}, {@link Ruler.after}.
453
470
  *
454
- * @param ruleName Name of added rule.
455
- * @param fn Rule function.
456
- * @param options Rule options. `alt` is an array with names of "alternate"
457
- * chains.
458
- *
459
471
  * @example
460
472
  * ```javascript
461
473
  * import MarkdownIt from 'markdown-it'
@@ -473,9 +485,7 @@ declare class Ruler<Args extends unknown[], Result> {
473
485
  *
474
486
  * See also {@link Ruler.disable}, {@link Ruler.enableOnly}.
475
487
  *
476
- * @param list List of rule names to enable.
477
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
478
- * @returns List of found rule names (if no exception happened).
488
+ * Returns list of found rule names (if no exception happened).
479
489
  */
480
490
  enable(list: string | string[], ignoreInvalid?: boolean): string[];
481
491
  /**
@@ -483,9 +493,6 @@ declare class Ruler<Args extends unknown[], Result> {
483
493
  * not found - throw Error. Errors can be disabled by second param.
484
494
  *
485
495
  * See also {@link Ruler.disable}, {@link Ruler.enable}.
486
- *
487
- * @param list List of rule names to enable (whitelist).
488
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
489
496
  */
490
497
  enableOnly(list: string | string[], ignoreInvalid?: boolean): void;
491
498
  /**
@@ -494,9 +501,7 @@ declare class Ruler<Args extends unknown[], Result> {
494
501
  *
495
502
  * See also {@link Ruler.enable}, {@link Ruler.enableOnly}.
496
503
  *
497
- * @param list List of rule names to disable.
498
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
499
- * @returns List of found rule names (if no exception happened).
504
+ * Returns list of found rule names (if no exception happened).
500
505
  */
501
506
  disable(list: string | string[], ignoreInvalid?: boolean): string[];
502
507
  /**
@@ -553,37 +558,21 @@ declare class Renderer {
553
558
  /**
554
559
  * Default token renderer. Can be overriden by custom function
555
560
  * in {@link Renderer.rules}.
556
- *
557
- * @param tokens List of tokens.
558
- * @param idx Token index to render.
559
- * @param options Params of parser instance.
560
561
  */
561
562
  renderToken(tokens: Token[], idx: number, options: Required<MarkdownItOptions>): string;
562
563
  /**
563
564
  * The same as {@link Renderer.render}, but for single token of `inline` type.
564
- *
565
- * @param tokens List on block tokens to render.
566
- * @param options Params of parser instance.
567
- * @param env Additional data from parsed input (references, for example).
568
565
  */
569
566
  renderInline(tokens: Token[], options: Required<MarkdownItOptions>, env: Env | undefined): string;
570
567
  /**
571
568
  * Special kludge for image `alt` attributes to conform CommonMark spec.
572
569
  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
573
570
  * instead of simple escaping.
574
- *
575
- * @param tokens List on block tokens to render.
576
- * @param options Params of parser instance.
577
- * @param env Additional data from parsed input (references, for example).
578
571
  */
579
572
  renderInlineAsText(tokens: Token[], options: Required<MarkdownItOptions>, env: Env | undefined): string;
580
573
  /**
581
574
  * Takes token stream and generates HTML. Probably, you will never need to call
582
575
  * this method directly.
583
- *
584
- * @param tokens List on block tokens to render.
585
- * @param options Params of parser instance.
586
- * @param env Additional data from parsed input (references, for example).
587
576
  */
588
577
  render(tokens: Token[], options: Required<MarkdownItOptions>, env?: Env): string;
589
578
  }
@@ -873,9 +862,6 @@ declare class MarkdownIt {
873
862
  * containing rules with given names. If rule not found, and `ignoreInvalid`
874
863
  * not set - throws exception.
875
864
  *
876
- * @param list Rule name or list of rule names to enable.
877
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
878
- *
879
865
  * @example
880
866
  * ```javascript
881
867
  * import MarkdownIt from 'markdown-it'
@@ -888,9 +874,6 @@ declare class MarkdownIt {
888
874
  enable(list: string | string[], ignoreInvalid?: boolean): this;
889
875
  /**
890
876
  * The same as {@link MarkdownIt.enable}, but turn specified rules off.
891
- *
892
- * @param list Rule name or list of rule names to disable.
893
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
894
877
  */
895
878
  disable(list: string | string[], ignoreInvalid?: boolean): this;
896
879
  /**
@@ -919,9 +902,6 @@ declare class MarkdownIt {
919
902
  * metadata like reference info, needed for the renderer. It also can be used to
920
903
  * inject data in specific cases. Usually, you will be ok to pass `{}`,
921
904
  * and then pass updated object to renderer.
922
- *
923
- * @param src Source string.
924
- * @param env Environment sandbox.
925
905
  */
926
906
  parse(src: string, env: Env): Token[];
927
907
  /**
@@ -930,26 +910,17 @@ declare class MarkdownIt {
930
910
  * `env` can be used to inject additional metadata (`{}` by default).
931
911
  * But you will not need it with high probability. See also comment
932
912
  * in {@link MarkdownIt.parse}.
933
- *
934
- * @param src Source string.
935
- * @param env Environment sandbox.
936
913
  */
937
914
  render(src: string, env?: Env): string;
938
915
  /**
939
916
  * The same as {@link MarkdownIt.parse} but skip all block rules. It returns
940
917
  * the block tokens list with the single `inline` element, containing parsed
941
918
  * inline tokens in `children` property. Also updates `env` object.
942
- *
943
- * @param src Source string.
944
- * @param env Environment sandbox.
945
919
  */
946
920
  parseInline(src: string, env: Env): Token[];
947
921
  /**
948
922
  * Similar to {@link MarkdownIt.render} but for single paragraph content.
949
923
  * Result will NOT be wrapped into `<p>` tags.
950
- *
951
- * @param src Source string.
952
- * @param env Environment sandbox.
953
924
  */
954
925
  renderInline(src: string, env?: Env): string;
955
926
  static Token: typeof Token;
@@ -1,4 +1,4 @@
1
- /*! markdown-it 15.0.0 https://github.com/markdown-it/markdown-it @license MIT */
1
+ /*! markdown-it 15.0.1 https://github.com/markdown-it/markdown-it @license MIT */
2
2
  import * as mdurl from "mdurl";
3
3
  import * as ucmicro from "uc.micro";
4
4
  import { decodeHTMLStrict } from "entities";
@@ -587,13 +587,25 @@ var Token = class {
587
587
  */
588
588
  var Ruler = class {
589
589
  constructor() {
590
- _defineProperty(this, "__rules__", []);
591
- _defineProperty(this, "__cache__", null);
590
+ _defineProperty(
591
+ this,
592
+ /** @internal */
593
+ "__rules__",
594
+ []
595
+ );
596
+ _defineProperty(
597
+ this,
598
+ /** @internal */
599
+ "__cache__",
600
+ null
601
+ );
592
602
  }
603
+ /** @internal */
593
604
  __find__(name) {
594
605
  for (let i = 0; i < this.__rules__.length; i++) if (this.__rules__[i].name === name) return i;
595
606
  return -1;
596
607
  }
608
+ /** @internal */
597
609
  __compile__() {
598
610
  const chains = /* @__PURE__ */ new Set();
599
611
  this.__rules__.forEach((rule) => {
@@ -618,11 +630,6 @@ var Ruler = class {
618
630
  * Replace rule by name with new function & options. Throws error if name not
619
631
  * found.
620
632
  *
621
- * @param name Rule name to replace.
622
- * @param fn New rule function.
623
- * @param options Rule options. `alt` is an array with names of "alternate"
624
- * chains.
625
- *
626
633
  * @example Replace existing typographer replacement rule with new one
627
634
  * ```javascript
628
635
  * import MarkdownIt from 'markdown-it'
@@ -644,12 +651,6 @@ var Ruler = class {
644
651
  * Add new rule to chain before one with given name. See also
645
652
  * {@link Ruler.after}, {@link Ruler.push}.
646
653
  *
647
- * @param beforeName New rule will be added before this one.
648
- * @param ruleName Name of added rule.
649
- * @param fn Rule function.
650
- * @param options Rule options. `alt` is an array with names of "alternate"
651
- * chains.
652
- *
653
654
  * @example
654
655
  * ```javascript
655
656
  * import MarkdownIt from 'markdown-it'
@@ -675,12 +676,6 @@ var Ruler = class {
675
676
  * Add new rule to chain after one with given name. See also
676
677
  * {@link Ruler.before}, {@link Ruler.push}.
677
678
  *
678
- * @param afterName New rule will be added after this one.
679
- * @param ruleName Name of added rule.
680
- * @param fn Rule function.
681
- * @param options Rule options. `alt` is an array with names of "alternate"
682
- * chains.
683
- *
684
679
  * @example
685
680
  * ```javascript
686
681
  * import MarkdownIt from 'markdown-it'
@@ -706,11 +701,6 @@ var Ruler = class {
706
701
  * Push new rule to the end of chain. See also
707
702
  * {@link Ruler.before}, {@link Ruler.after}.
708
703
  *
709
- * @param ruleName Name of added rule.
710
- * @param fn Rule function.
711
- * @param options Rule options. `alt` is an array with names of "alternate"
712
- * chains.
713
- *
714
704
  * @example
715
705
  * ```javascript
716
706
  * import MarkdownIt from 'markdown-it'
@@ -736,9 +726,7 @@ var Ruler = class {
736
726
  *
737
727
  * See also {@link Ruler.disable}, {@link Ruler.enableOnly}.
738
728
  *
739
- * @param list List of rule names to enable.
740
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
741
- * @returns List of found rule names (if no exception happened).
729
+ * Returns list of found rule names (if no exception happened).
742
730
  */
743
731
  enable(list, ignoreInvalid = false) {
744
732
  if (!Array.isArray(list)) list = [list];
@@ -760,9 +748,6 @@ var Ruler = class {
760
748
  * not found - throw Error. Errors can be disabled by second param.
761
749
  *
762
750
  * See also {@link Ruler.disable}, {@link Ruler.enable}.
763
- *
764
- * @param list List of rule names to enable (whitelist).
765
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
766
751
  */
767
752
  enableOnly(list, ignoreInvalid = false) {
768
753
  if (!Array.isArray(list)) list = [list];
@@ -777,9 +762,7 @@ var Ruler = class {
777
762
  *
778
763
  * See also {@link Ruler.enable}, {@link Ruler.enableOnly}.
779
764
  *
780
- * @param list List of rule names to disable.
781
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
782
- * @returns List of found rule names (if no exception happened).
765
+ * Returns list of found rule names (if no exception happened).
783
766
  */
784
767
  disable(list, ignoreInvalid = false) {
785
768
  if (!Array.isArray(list)) list = [list];
@@ -919,10 +902,6 @@ var Renderer = class {
919
902
  /**
920
903
  * Default token renderer. Can be overriden by custom function
921
904
  * in {@link Renderer.rules}.
922
- *
923
- * @param tokens List of tokens.
924
- * @param idx Token index to render.
925
- * @param options Params of parser instance.
926
905
  */
927
906
  renderToken(tokens, idx, options) {
928
907
  const token = tokens[idx];
@@ -952,10 +931,6 @@ var Renderer = class {
952
931
  }
953
932
  /**
954
933
  * The same as {@link Renderer.render}, but for single token of `inline` type.
955
- *
956
- * @param tokens List on block tokens to render.
957
- * @param options Params of parser instance.
958
- * @param env Additional data from parsed input (references, for example).
959
934
  */
960
935
  renderInline(tokens, options, env) {
961
936
  let result = "";
@@ -971,10 +946,6 @@ var Renderer = class {
971
946
  * Special kludge for image `alt` attributes to conform CommonMark spec.
972
947
  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
973
948
  * instead of simple escaping.
974
- *
975
- * @param tokens List on block tokens to render.
976
- * @param options Params of parser instance.
977
- * @param env Additional data from parsed input (references, for example).
978
949
  */
979
950
  renderInlineAsText(tokens, options, env) {
980
951
  let result = "";
@@ -998,10 +969,6 @@ var Renderer = class {
998
969
  /**
999
970
  * Takes token stream and generates HTML. Probably, you will never need to call
1000
971
  * this method directly.
1001
- *
1002
- * @param tokens List on block tokens to render.
1003
- * @param options Params of parser instance.
1004
- * @param env Additional data from parsed input (references, for example).
1005
972
  */
1006
973
  render(tokens, options, env) {
1007
974
  let result = "";
@@ -1030,11 +997,11 @@ var StateCore = class {
1030
997
  };
1031
998
  //#endregion
1032
999
  //#region src/rules_core/normalize.ts
1033
- var NEWLINES_RE = /\r\n?|\n/g;
1000
+ var UNNORMALIZED_NEWLINE_RE = /\r\n?/g;
1034
1001
  var NULL_RE = /\0/g;
1035
1002
  function normalize(state) {
1036
1003
  let str;
1037
- str = state.src.replace(NEWLINES_RE, "\n");
1004
+ str = state.src.replace(UNNORMALIZED_NEWLINE_RE, "\n");
1038
1005
  str = str.replace(NULL_RE, "�");
1039
1006
  state.src = str;
1040
1007
  }
@@ -1084,7 +1051,8 @@ function linkify$1(state) {
1084
1051
  if (!state.md.options.linkify) return;
1085
1052
  for (let j = 0, l = blockTokens.length; j < l; j++) {
1086
1053
  if (blockTokens[j].type !== "inline" || !state.md.linkify.test(blockTokens[j].content)) continue;
1087
- let tokens = blockTokens[j].children;
1054
+ const tokens = blockTokens[j].children;
1055
+ const replacements = [];
1088
1056
  let htmlLinkLevel = 0;
1089
1057
  for (let i = tokens.length - 1; i >= 0; i--) {
1090
1058
  const currentToken = tokens[i];
@@ -1143,9 +1111,28 @@ function linkify$1(state) {
1143
1111
  token.level = level;
1144
1112
  nodes.push(token);
1145
1113
  }
1146
- blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
1114
+ replacements.push({
1115
+ index: i,
1116
+ nodes
1117
+ });
1147
1118
  }
1148
1119
  }
1120
+ if (replacements.length > 0) {
1121
+ let newTokensLength = tokens.length;
1122
+ for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
1123
+ const newTokens = new Array(newTokensLength);
1124
+ let replacementIndex = 0;
1125
+ let newTokenIndex = 0;
1126
+ replacements.reverse();
1127
+ for (let i = 0; i < tokens.length; i++) {
1128
+ const replacement = replacements[replacementIndex];
1129
+ if ((replacement === null || replacement === void 0 ? void 0 : replacement.index) === i) {
1130
+ for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
1131
+ replacementIndex++;
1132
+ } else newTokens[newTokenIndex++] = tokens[i];
1133
+ }
1134
+ blockTokens[j].children = newTokens;
1135
+ }
1149
1136
  }
1150
1137
  }
1151
1138
  //#endregion
@@ -2628,7 +2615,12 @@ function text(state, silent) {
2628
2615
  }
2629
2616
  //#endregion
2630
2617
  //#region src/rules_inline/linkify.ts
2631
- var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
2618
+ function isAsciiAlpha(code) {
2619
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122;
2620
+ }
2621
+ function isSchemeChar(code) {
2622
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 45 || code === 46;
2623
+ }
2632
2624
  function linkify(state, silent) {
2633
2625
  if (!state.md.options.linkify) return false;
2634
2626
  if (state.linkLevel > 0) return false;
@@ -2638,20 +2630,22 @@ function linkify(state, silent) {
2638
2630
  if (state.src.charCodeAt(pos) !== 58) return false;
2639
2631
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
2640
2632
  if (state.src.charCodeAt(pos + 2) !== 47) return false;
2641
- const match = state.pending.match(SCHEME_RE);
2642
- if (!match) return false;
2643
- const proto = match[1];
2644
- const link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
2633
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
2634
+ let protoStart = pos;
2635
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
2636
+ if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false;
2637
+ const protoLength = pos - protoStart;
2638
+ const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
2645
2639
  if (!link) return false;
2646
2640
  let url = link.url;
2647
- if (url.length <= proto.length) return false;
2641
+ if (url.length <= protoLength) return false;
2648
2642
  let urlEnd = url.length;
2649
2643
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
2650
2644
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
2651
2645
  const fullUrl = state.md.normalizeLink(url);
2652
2646
  if (!state.md.validateLink(fullUrl)) return false;
2653
2647
  if (!silent) {
2654
- state.pending = state.pending.slice(0, -proto.length);
2648
+ state.pending = state.pending.slice(0, -protoLength);
2655
2649
  const token_o = state.push("link_open", "a", 1);
2656
2650
  token_o.attrs = [["href", fullUrl]];
2657
2651
  token_o.markup = "linkify";
@@ -2662,7 +2656,7 @@ function linkify(state, silent) {
2662
2656
  token_c.markup = "linkify";
2663
2657
  token_c.info = "auto";
2664
2658
  }
2665
- state.pos += url.length - proto.length;
2659
+ state.pos += url.length - protoLength;
2666
2660
  return true;
2667
2661
  }
2668
2662
  //#endregion
@@ -2743,40 +2737,51 @@ function escape(state, silent) {
2743
2737
  }
2744
2738
  //#endregion
2745
2739
  //#region src/rules_inline/backticks.ts
2740
+ function buildLastRuns(src) {
2741
+ const lastRuns = {};
2742
+ let pos = 0;
2743
+ while ((pos = src.indexOf("`", pos)) !== -1) {
2744
+ const start = pos;
2745
+ while (src.charCodeAt(++pos) === 96);
2746
+ lastRuns[pos - start] = start;
2747
+ }
2748
+ return lastRuns;
2749
+ }
2746
2750
  function backtick(state, silent) {
2747
- let pos = state.pos;
2748
- if (state.src.charCodeAt(pos) !== 96) return false;
2749
- const start = pos;
2750
- pos++;
2751
+ var _state$backticks$open;
2752
+ const start = state.pos;
2753
+ if (state.src.charCodeAt(start) !== 96) return false;
2751
2754
  const max = state.posMax;
2755
+ let pos = start + 1;
2752
2756
  while (pos < max && state.src.charCodeAt(pos) === 96) pos++;
2753
2757
  const marker = state.src.slice(start, pos);
2754
2758
  const openerLength = marker.length;
2755
- if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
2756
- if (!silent) state.pending += marker;
2757
- state.pos += openerLength;
2758
- return true;
2759
- }
2760
- let matchEnd = pos;
2761
- let matchStart;
2762
- while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
2763
- matchEnd = matchStart + 1;
2764
- while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96) matchEnd++;
2765
- const closerLength = matchEnd - matchStart;
2766
- if (closerLength === openerLength) {
2767
- if (!silent) {
2768
- const token = state.push("code_inline", "code", 0);
2769
- token.markup = marker;
2770
- token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
2759
+ if (!state.backticksScanned) {
2760
+ state.backticks = buildLastRuns(state.src);
2761
+ state.backticksScanned = true;
2762
+ }
2763
+ if (((_state$backticks$open = state.backticks[openerLength]) !== null && _state$backticks$open !== void 0 ? _state$backticks$open : -1) >= pos) {
2764
+ let matchEnd = pos;
2765
+ let matchStart;
2766
+ while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1 && matchStart < max) {
2767
+ matchEnd = matchStart + 1;
2768
+ while (state.src.charCodeAt(matchEnd) === 96) matchEnd++;
2769
+ if (matchEnd > max) break;
2770
+ if (matchEnd - matchStart === openerLength) {
2771
+ if (!silent) {
2772
+ const token = state.push("code_inline", "code", 0);
2773
+ token.markup = marker;
2774
+ let content = state.src.slice(pos, matchStart).replace(/\n/g, " ");
2775
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
2776
+ token.content = content;
2777
+ }
2778
+ state.pos = matchEnd;
2779
+ return true;
2771
2780
  }
2772
- state.pos = matchEnd;
2773
- return true;
2774
2781
  }
2775
- state.backticks[closerLength] = matchStart;
2776
2782
  }
2777
- state.backticksScanned = true;
2778
2783
  if (!silent) state.pending += marker;
2779
- state.pos += openerLength;
2784
+ state.pos = pos;
2780
2785
  return true;
2781
2786
  }
2782
2787
  //#endregion
@@ -3551,7 +3556,12 @@ var MarkdownIt = class {
3551
3556
  parsed.hostname = punycode.toASCII(parsed.hostname);
3552
3557
  } catch (er) {}
3553
3558
  }
3554
- return mdurl.encode(mdurl.format(parsed));
3559
+ if (parsed.auth) parsed.auth = mdurl.encode(parsed.auth);
3560
+ if (parsed.hostname) parsed.hostname = mdurl.encode(parsed.hostname);
3561
+ if (parsed.pathname) parsed.pathname = mdurl.encode(parsed.pathname);
3562
+ if (parsed.search) parsed.search = mdurl.encode(parsed.search);
3563
+ if (parsed.hash) parsed.hash = mdurl.encode(parsed.hash);
3564
+ return mdurl.format(parsed);
3555
3565
  }
3556
3566
  /**
3557
3567
  * Function used to decode link url to a human-readable format`
@@ -3719,9 +3729,6 @@ var MarkdownIt = class {
3719
3729
  * containing rules with given names. If rule not found, and `ignoreInvalid`
3720
3730
  * not set - throws exception.
3721
3731
  *
3722
- * @param list Rule name or list of rule names to enable.
3723
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
3724
- *
3725
3732
  * @example
3726
3733
  * ```javascript
3727
3734
  * import MarkdownIt from 'markdown-it'
@@ -3748,9 +3755,6 @@ var MarkdownIt = class {
3748
3755
  }
3749
3756
  /**
3750
3757
  * The same as {@link MarkdownIt.enable}, but turn specified rules off.
3751
- *
3752
- * @param list Rule name or list of rule names to disable.
3753
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
3754
3758
  */
3755
3759
  disable(list, ignoreInvalid = false) {
3756
3760
  let result = [];
@@ -3796,9 +3800,6 @@ var MarkdownIt = class {
3796
3800
  * metadata like reference info, needed for the renderer. It also can be used to
3797
3801
  * inject data in specific cases. Usually, you will be ok to pass `{}`,
3798
3802
  * and then pass updated object to renderer.
3799
- *
3800
- * @param src Source string.
3801
- * @param env Environment sandbox.
3802
3803
  */
3803
3804
  parse(src, env) {
3804
3805
  if (typeof src !== "string") throw new Error("Input data should be a String");
@@ -3812,9 +3813,6 @@ var MarkdownIt = class {
3812
3813
  * `env` can be used to inject additional metadata (`{}` by default).
3813
3814
  * But you will not need it with high probability. See also comment
3814
3815
  * in {@link MarkdownIt.parse}.
3815
- *
3816
- * @param src Source string.
3817
- * @param env Environment sandbox.
3818
3816
  */
3819
3817
  render(src, env = {}) {
3820
3818
  return this.renderer.render(this.parse(src, env), this.options, env);
@@ -3823,9 +3821,6 @@ var MarkdownIt = class {
3823
3821
  * The same as {@link MarkdownIt.parse} but skip all block rules. It returns
3824
3822
  * the block tokens list with the single `inline` element, containing parsed
3825
3823
  * inline tokens in `children` property. Also updates `env` object.
3826
- *
3827
- * @param src Source string.
3828
- * @param env Environment sandbox.
3829
3824
  */
3830
3825
  parseInline(src, env) {
3831
3826
  const state = new this.core.State(src, this, env);
@@ -3836,9 +3831,6 @@ var MarkdownIt = class {
3836
3831
  /**
3837
3832
  * Similar to {@link MarkdownIt.render} but for single paragraph content.
3838
3833
  * Result will NOT be wrapped into `<p>` tags.
3839
- *
3840
- * @param src Source string.
3841
- * @param env Environment sandbox.
3842
3834
  */
3843
3835
  renderInline(src, env = {}) {
3844
3836
  return this.renderer.render(this.parseInline(src, env), this.options, env);