@openclaw/matrix 2026.8.2 → 2026.8.33

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 (107) hide show
  1. package/dist/{account-selection-DA-jfx22.js → .setup/account-selection-DZMazUgX.mjs} +1 -1
  2. package/dist/{accounts-DR1c4xF_.js → .setup/accounts-BJ6ECCac.mjs} +3 -3
  3. package/dist/{approval-handler.runtime-xcVrZw9o.js → .setup/approval-handler.runtime-CdT1wQve.mjs} +6 -6
  4. package/dist/{approval-ids-hmvhDNBj.js → .setup/approval-ids-CU_nMQy9.mjs} +1 -1
  5. package/dist/{approval-reaction-auth-DziFGHSk.js → .setup/approval-reaction-auth-CpxhvOOT.mjs} +2 -2
  6. package/dist/{approval-reactions-1fwEhoK9.js → .setup/approval-reactions-D5eegob9.mjs} +1 -1
  7. package/dist/{channel-D6-ajB_u.js → .setup/channel-Q_N83Wwa.mjs} +17 -17
  8. package/dist/{channel.runtime-BMA0dG2k.js → .setup/channel.runtime-BFXlZFP1.mjs} +6 -6
  9. package/dist/{channel.setup-OIEzCzSs.js → .setup/channel.setup-2A6HBRbA.mjs} +4 -4
  10. package/dist/{cli-B6HF7Hmn.js → .setup/cli-CyuDGiIr.mjs} +15 -15
  11. package/dist/{cli-metadata-Mtzu5-AY.js → .setup/cli-metadata-B_y2Z5Np.mjs} +1 -1
  12. package/dist/{client-B0yMDho1.js → .setup/client-CpHMD-C2.mjs} +3 -3
  13. package/dist/{client-DFsRJEgB.js → .setup/client-DvcYcTSy.mjs} +13 -13
  14. package/dist/{client-bootstrap-DjXCKEtg.js → .setup/client-bootstrap-Cb1tHsT4.mjs} +3 -3
  15. package/dist/{client-support-DLj4vDeu.js → .setup/client-support-Bn9Bk0-H.mjs} +1 -1
  16. package/dist/{config-update-BnX26jCO.js → .setup/config-update-B_4qZ5bV.mjs} +3 -3
  17. package/dist/{credentials-DJj2xs3q.js → .setup/credentials-B2roKThT.mjs} +3 -3
  18. package/dist/{credentials-read-mexhw-Ur.js → .setup/credentials-read-DaemdXHy.mjs} +4 -4
  19. package/dist/{credentials-write.runtime-DQt-kgJq.js → .setup/credentials-write.runtime-D83HEGcL.mjs} +1 -1
  20. package/dist/{crypto-runtime-QvlgyCkj.js → .setup/crypto-runtime-Ch4WOG1y.mjs} +5 -5
  21. package/dist/{device-health-B4-YXtJR.js → .setup/device-health-CWOuIirq.mjs} +1 -1
  22. package/dist/{direct-room-RinHjtqX.js → .setup/direct-room-CKyU8upP.mjs} +1 -1
  23. package/dist/{directory-live-Drh343TW.js → .setup/directory-live-DggLE-28.mjs} +4 -4
  24. package/dist/{doctor-CJE8wO6y.js → .setup/doctor-BLCvdOFo.mjs} +1 -1
  25. package/dist/{draft-stream-DhGHVdO4.js → .setup/draft-stream-DfUFwKfN.mjs} +1 -1
  26. package/dist/{encryption-guidance-BNcZNQZI.js → .setup/encryption-guidance-CvN_NQUJ.mjs} +2 -2
  27. package/dist/{http-client-DOmFvKvB.js → .setup/http-client-Bv6a2OfI.mjs} +1 -1
  28. package/dist/{idb-persistence-D4NGNQxt.js → .setup/idb-persistence-BiscLSq4.mjs} +3 -3
  29. package/dist/{inbound-dedupe-Ch33GU06.js → .setup/inbound-dedupe-BOsuMiaj.mjs} +1 -1
  30. package/dist/{logger-B_71hN6W.js → .setup/logger-B3tfcB-m.mjs} +1 -1
  31. package/dist/{logging-DRjvUOIh.js → .setup/logging-CkohOZwO.mjs} +2 -2
  32. package/dist/{messages-DlMQaC02.js → .setup/messages-C3v-jkaN.mjs} +4 -4
  33. package/dist/{monitor-U2LcVtHt.js → .setup/monitor-CQ6pGvZh.mjs} +26 -26
  34. package/dist/.setup/probe.runtime-ni46ImsO.mjs +2 -0
  35. package/dist/{profile-vmjsmhh4.js → .setup/profile-ClrB3IgR.mjs} +1 -1
  36. package/dist/{profile-update-CsyKA9jI.js → .setup/profile-update-B9Q6Ox2O.mjs} +4 -4
  37. package/dist/{reaction-events-lwNc5I1X.js → .setup/reaction-events-Dtd3W-rj.mjs} +6 -6
  38. package/dist/{resolve-targets-D3Eakgzs.js → .setup/resolve-targets-Bke5jHKS.mjs} +3 -3
  39. package/dist/{resolver.runtime-DJQxR35r.js → .setup/resolver.runtime-BtrbC025.mjs} +1 -1
  40. package/dist/{room-info-DIU67XLP.js → .setup/room-info-B0VNxsF8.mjs} +4 -4
  41. package/dist/.setup/runtime-setter-api-DGMubGUq.mjs +3 -0
  42. package/dist/{sdk-Jl2CgAbJ.js → .setup/sdk-DoObvds0.mjs} +18 -15
  43. package/dist/{secret-contract-CufozuyJ.js → .setup/secret-contract-JlB6VmI3.mjs} +1 -1
  44. package/dist/.setup/secret-contract-api-B-iJoQEv.mjs +3 -0
  45. package/dist/{send-DfS5ciUL.js → .setup/send-SmBzUhD-.mjs} +7 -7
  46. package/dist/{setup-bootstrap-CWoIWudw.js → .setup/setup-bootstrap-CUKhebeX.mjs} +3 -3
  47. package/dist/{setup-core-CZM496H-.js → .setup/setup-core-BnqoLunq.mjs} +7 -7
  48. package/dist/.setup/setup-plugin-api-Dg95tydH.mjs +3 -0
  49. package/dist/{setup-surface-DSZtOsWK.js → .setup/setup-surface-sWwADrZ8.mjs} +12 -12
  50. package/dist/{startup-verification-1Ney1mmI.js → .setup/startup-verification-E46yu4fh.mjs} +2 -2
  51. package/dist/{storage-BVf4uucD.js → .setup/storage-B-nf2ReN.mjs} +4 -4
  52. package/dist/{subagent-hooks-DeICLbU5.js → .setup/subagent-hooks-jFgft_Mr.mjs} +1 -1
  53. package/dist/{sync-cache-state-d-A_OhbU.js → .setup/sync-cache-state-6Hjn1K-v.mjs} +2 -2
  54. package/dist/{thread-binding-api-CzkeLZCU.js → .setup/thread-binding-api-DRMC62cs.mjs} +1 -1
  55. package/dist/{thread-bindings-2HN2AyLu.js → .setup/thread-bindings-_WJ8RYWJ.mjs} +4 -4
  56. package/dist/{tool-actions.runtime-CFZZPG5g.js → .setup/tool-actions.runtime-DLICojA3.mjs} +13 -13
  57. package/dist/{verification-CD7k5vE9.js → .setup/verification-DOT16noD.mjs} +4 -3
  58. package/dist/api.js +8 -8
  59. package/dist/auth-presence.js +1 -1
  60. package/dist/channel-plugin-api.js +1 -1
  61. package/dist/cli-metadata.js +1 -1
  62. package/dist/contract-api.js +2 -2
  63. package/dist/doctor-contract-api.js +9 -9
  64. package/dist/helper-api.js +3 -3
  65. package/dist/index.js +1 -1
  66. package/dist/plugin-entry.handlers.runtime.js +1 -1
  67. package/dist/runtime-api.js +6 -6
  68. package/dist/runtime-setter-api.js +1 -1
  69. package/dist/secret-contract-api.js +1 -1
  70. package/dist/session-binding-contract-api.js +2 -2
  71. package/dist/setup-entry.js +4 -3
  72. package/dist/setup-plugin-api.js +1 -1
  73. package/dist/subagent-hooks-api.js +1 -1
  74. package/dist/thread-binding-api.js +1 -1
  75. package/dist/thread-bindings-runtime.js +1 -1
  76. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +525 -484
  77. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  78. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  79. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  80. package/node_modules/markdown-it/dist/markdown-it.cjs.js +129 -121
  81. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  82. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  83. package/node_modules/markdown-it/dist/markdown-it.mjs +129 -121
  84. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  85. package/node_modules/markdown-it/package.json +1 -2
  86. package/package.json +5 -5
  87. package/dist/probe.runtime-CNo-5_iz.js +0 -2
  88. /package/dist/{account-config-CRsKoMqJ.js → .setup/account-config-CRsKoMqJ.mjs} +0 -0
  89. /package/dist/{backup-health-Dm_YMVFT.js → .setup/backup-health-Dm_YMVFT.mjs} +0 -0
  90. /package/dist/{config-paths-CnREYb1Y.js → .setup/config-paths-CnREYb1Y.mjs} +0 -0
  91. /package/dist/{config-secret-input.runtime-CwsP3--c.js → .setup/config-secret-input.runtime-CwsP3--c.mjs} +0 -0
  92. /package/dist/{credentials-state-B3cuUFwZ.js → .setup/credentials-state-B3cuUFwZ.mjs} +0 -0
  93. /package/dist/{crypto-node.runtime-6Aj_ltHQ.js → .setup/crypto-node.runtime-6Aj_ltHQ.mjs} +0 -0
  94. /package/dist/{deps-mtxF2mHI.js → .setup/deps-mtxF2mHI.mjs} +0 -0
  95. /package/dist/{doctor-contract-HyWFZQVG.js → .setup/doctor-contract-HyWFZQVG.mjs} +0 -0
  96. /package/dist/{env-vars-dGqak9dN.js → .setup/env-vars-dGqak9dN.mjs} +0 -0
  97. /package/dist/{errors-DKVS3_DO.js → .setup/errors-DKVS3_DO.mjs} +0 -0
  98. /package/dist/{event-helpers-XRfAbOIh.js → .setup/event-helpers-XRfAbOIh.mjs} +0 -0
  99. /package/dist/{idb-persistence-lock-B3fZXyF_.js → .setup/idb-persistence-lock-B3fZXyF_.mjs} +0 -0
  100. /package/dist/{reaction-common-DkrQdBSZ.js → .setup/reaction-common-DkrQdBSZ.mjs} +0 -0
  101. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  102. /package/dist/{runtime-6S3DNFNv.js → .setup/runtime-6S3DNFNv.mjs} +0 -0
  103. /package/dist/{runtime-BefyhPWv.js → .setup/runtime-BefyhPWv.mjs} +0 -0
  104. /package/dist/{storage-paths-gUmSydsW.js → .setup/storage-paths-gUmSydsW.mjs} +0 -0
  105. /package/dist/{target-ids-Nwx7cMVE.js → .setup/target-ids-Nwx7cMVE.mjs} +0 -0
  106. /package/dist/{thread-bindings-shared-oNPiyMWY.js → .setup/thread-bindings-shared-oNPiyMWY.mjs} +0 -0
  107. /package/dist/{url-validation-GRHde6lq.js → .setup/url-validation-GRHde6lq.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- /*! markdown-it 15.0.0 https://github.com/markdown-it/markdown-it @license MIT */
1
+ /*! markdown-it 15.0.2 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,8 +1111,27 @@ 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
+ });
1118
+ }
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];
1147
1133
  }
1134
+ blockTokens[j].children = newTokens;
1148
1135
  }
1149
1136
  }
1150
1137
  }
@@ -1195,6 +1182,14 @@ function replace(state) {
1195
1182
  var QUOTE_TEST_RE = /['"]/;
1196
1183
  var QUOTE_RE = /['"]/g;
1197
1184
  var APOSTROPHE = "’";
1185
+ var MAX_OPENERS = 1e3;
1186
+ function truncateStack(stack, heads, length) {
1187
+ while (stack.length > length) {
1188
+ const item = stack.pop();
1189
+ if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
1190
+ else heads.double = item.prevSameQuoteIdx;
1191
+ }
1192
+ }
1198
1193
  function addReplacement(replacements, tokenIdx, pos, ch) {
1199
1194
  if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
1200
1195
  replacements[tokenIdx].push({
@@ -1216,12 +1211,16 @@ function applyReplacements(str, replacements) {
1216
1211
  function process_inlines(tokens, state) {
1217
1212
  let j;
1218
1213
  const stack = [];
1214
+ const heads = {
1215
+ single: -1,
1216
+ double: -1
1217
+ };
1219
1218
  const replacements = {};
1220
1219
  for (let i = 0; i < tokens.length; i++) {
1221
1220
  const token = tokens[i];
1222
1221
  const thisLevel = tokens[i].level;
1223
1222
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
1224
- stack.length = j + 1;
1223
+ truncateStack(stack, heads, j + 1);
1225
1224
  if (token.type !== "text") continue;
1226
1225
  const text = token.content;
1227
1226
  let pos = 0;
@@ -1273,11 +1272,10 @@ function process_inlines(tokens, state) {
1273
1272
  if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1274
1273
  continue;
1275
1274
  }
1276
- if (canClose) for (j = stack.length - 1; j >= 0; j--) {
1277
- let item = stack[j];
1278
- if (stack[j].level < thisLevel) break;
1279
- if (item.single === isSingle && stack[j].level === thisLevel) {
1280
- item = stack[j];
1275
+ if (canClose) {
1276
+ j = isSingle ? heads.single : heads.double;
1277
+ if (j >= 0 && stack[j].level === thisLevel) {
1278
+ const item = stack[j];
1281
1279
  let openQuote;
1282
1280
  let closeQuote;
1283
1281
  if (isSingle) {
@@ -1288,18 +1286,23 @@ function process_inlines(tokens, state) {
1288
1286
  closeQuote = state.md.options.quotes[1];
1289
1287
  }
1290
1288
  addReplacement(replacements, i, t.index, closeQuote);
1291
- addReplacement(replacements, item.token, item.pos, openQuote);
1292
- stack.length = j;
1289
+ addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
1290
+ truncateStack(stack, heads, j);
1293
1291
  continue OUTER;
1294
1292
  }
1295
1293
  }
1296
- if (canOpen) stack.push({
1297
- token: i,
1298
- pos: t.index,
1299
- single: isSingle,
1300
- level: thisLevel
1301
- });
1302
- else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1294
+ if (canOpen) {
1295
+ if (stack.length >= MAX_OPENERS) return;
1296
+ stack.push({
1297
+ tokenIdx: i,
1298
+ contentPos: t.index,
1299
+ isSingleQuote: isSingle,
1300
+ level: thisLevel,
1301
+ prevSameQuoteIdx: isSingle ? heads.single : heads.double
1302
+ });
1303
+ if (isSingle) heads.single = stack.length - 1;
1304
+ else heads.double = stack.length - 1;
1305
+ } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1303
1306
  }
1304
1307
  }
1305
1308
  Object.keys(replacements).forEach(function(tokenIdx) {
@@ -2628,7 +2631,12 @@ function text(state, silent) {
2628
2631
  }
2629
2632
  //#endregion
2630
2633
  //#region src/rules_inline/linkify.ts
2631
- var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
2634
+ function isAsciiAlpha(code) {
2635
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122;
2636
+ }
2637
+ function isSchemeChar(code) {
2638
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 45 || code === 46;
2639
+ }
2632
2640
  function linkify(state, silent) {
2633
2641
  if (!state.md.options.linkify) return false;
2634
2642
  if (state.linkLevel > 0) return false;
@@ -2638,20 +2646,22 @@ function linkify(state, silent) {
2638
2646
  if (state.src.charCodeAt(pos) !== 58) return false;
2639
2647
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
2640
2648
  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));
2649
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
2650
+ let protoStart = pos;
2651
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
2652
+ if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false;
2653
+ const protoLength = pos - protoStart;
2654
+ const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
2645
2655
  if (!link) return false;
2646
2656
  let url = link.url;
2647
- if (url.length <= proto.length) return false;
2657
+ if (url.length <= protoLength) return false;
2648
2658
  let urlEnd = url.length;
2649
2659
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
2650
2660
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
2651
2661
  const fullUrl = state.md.normalizeLink(url);
2652
2662
  if (!state.md.validateLink(fullUrl)) return false;
2653
2663
  if (!silent) {
2654
- state.pending = state.pending.slice(0, -proto.length);
2664
+ state.pending = state.pending.slice(0, -protoLength);
2655
2665
  const token_o = state.push("link_open", "a", 1);
2656
2666
  token_o.attrs = [["href", fullUrl]];
2657
2667
  token_o.markup = "linkify";
@@ -2662,7 +2672,7 @@ function linkify(state, silent) {
2662
2672
  token_c.markup = "linkify";
2663
2673
  token_c.info = "auto";
2664
2674
  }
2665
- state.pos += url.length - proto.length;
2675
+ state.pos += url.length - protoLength;
2666
2676
  return true;
2667
2677
  }
2668
2678
  //#endregion
@@ -2743,40 +2753,51 @@ function escape(state, silent) {
2743
2753
  }
2744
2754
  //#endregion
2745
2755
  //#region src/rules_inline/backticks.ts
2756
+ function buildLastRuns(src) {
2757
+ const lastRuns = {};
2758
+ let pos = 0;
2759
+ while ((pos = src.indexOf("`", pos)) !== -1) {
2760
+ const start = pos;
2761
+ while (src.charCodeAt(++pos) === 96);
2762
+ lastRuns[pos - start] = start;
2763
+ }
2764
+ return lastRuns;
2765
+ }
2746
2766
  function backtick(state, silent) {
2747
- let pos = state.pos;
2748
- if (state.src.charCodeAt(pos) !== 96) return false;
2749
- const start = pos;
2750
- pos++;
2767
+ var _state$backticks$open;
2768
+ const start = state.pos;
2769
+ if (state.src.charCodeAt(start) !== 96) return false;
2751
2770
  const max = state.posMax;
2771
+ let pos = start + 1;
2752
2772
  while (pos < max && state.src.charCodeAt(pos) === 96) pos++;
2753
2773
  const marker = state.src.slice(start, pos);
2754
2774
  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");
2775
+ if (!state.backticksScanned) {
2776
+ state.backticks = buildLastRuns(state.src);
2777
+ state.backticksScanned = true;
2778
+ }
2779
+ if (((_state$backticks$open = state.backticks[openerLength]) !== null && _state$backticks$open !== void 0 ? _state$backticks$open : -1) >= pos) {
2780
+ let matchEnd = pos;
2781
+ let matchStart;
2782
+ while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1 && matchStart < max) {
2783
+ matchEnd = matchStart + 1;
2784
+ while (state.src.charCodeAt(matchEnd) === 96) matchEnd++;
2785
+ if (matchEnd > max) break;
2786
+ if (matchEnd - matchStart === openerLength) {
2787
+ if (!silent) {
2788
+ const token = state.push("code_inline", "code", 0);
2789
+ token.markup = marker;
2790
+ let content = state.src.slice(pos, matchStart).replace(/\n/g, " ");
2791
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
2792
+ token.content = content;
2793
+ }
2794
+ state.pos = matchEnd;
2795
+ return true;
2771
2796
  }
2772
- state.pos = matchEnd;
2773
- return true;
2774
2797
  }
2775
- state.backticks[closerLength] = matchStart;
2776
2798
  }
2777
- state.backticksScanned = true;
2778
2799
  if (!silent) state.pending += marker;
2779
- state.pos += openerLength;
2800
+ state.pos = pos;
2780
2801
  return true;
2781
2802
  }
2782
2803
  //#endregion
@@ -3551,7 +3572,12 @@ var MarkdownIt = class {
3551
3572
  parsed.hostname = punycode.toASCII(parsed.hostname);
3552
3573
  } catch (er) {}
3553
3574
  }
3554
- return mdurl.encode(mdurl.format(parsed));
3575
+ if (parsed.auth) parsed.auth = mdurl.encode(parsed.auth);
3576
+ if (parsed.hostname) parsed.hostname = mdurl.encode(parsed.hostname);
3577
+ if (parsed.pathname) parsed.pathname = mdurl.encode(parsed.pathname);
3578
+ if (parsed.search) parsed.search = mdurl.encode(parsed.search);
3579
+ if (parsed.hash) parsed.hash = mdurl.encode(parsed.hash);
3580
+ return mdurl.format(parsed);
3555
3581
  }
3556
3582
  /**
3557
3583
  * Function used to decode link url to a human-readable format`
@@ -3719,9 +3745,6 @@ var MarkdownIt = class {
3719
3745
  * containing rules with given names. If rule not found, and `ignoreInvalid`
3720
3746
  * not set - throws exception.
3721
3747
  *
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
3748
  * @example
3726
3749
  * ```javascript
3727
3750
  * import MarkdownIt from 'markdown-it'
@@ -3748,9 +3771,6 @@ var MarkdownIt = class {
3748
3771
  }
3749
3772
  /**
3750
3773
  * 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
3774
  */
3755
3775
  disable(list, ignoreInvalid = false) {
3756
3776
  let result = [];
@@ -3796,9 +3816,6 @@ var MarkdownIt = class {
3796
3816
  * metadata like reference info, needed for the renderer. It also can be used to
3797
3817
  * inject data in specific cases. Usually, you will be ok to pass `{}`,
3798
3818
  * and then pass updated object to renderer.
3799
- *
3800
- * @param src Source string.
3801
- * @param env Environment sandbox.
3802
3819
  */
3803
3820
  parse(src, env) {
3804
3821
  if (typeof src !== "string") throw new Error("Input data should be a String");
@@ -3812,9 +3829,6 @@ var MarkdownIt = class {
3812
3829
  * `env` can be used to inject additional metadata (`{}` by default).
3813
3830
  * But you will not need it with high probability. See also comment
3814
3831
  * in {@link MarkdownIt.parse}.
3815
- *
3816
- * @param src Source string.
3817
- * @param env Environment sandbox.
3818
3832
  */
3819
3833
  render(src, env = {}) {
3820
3834
  return this.renderer.render(this.parse(src, env), this.options, env);
@@ -3823,9 +3837,6 @@ var MarkdownIt = class {
3823
3837
  * The same as {@link MarkdownIt.parse} but skip all block rules. It returns
3824
3838
  * the block tokens list with the single `inline` element, containing parsed
3825
3839
  * inline tokens in `children` property. Also updates `env` object.
3826
- *
3827
- * @param src Source string.
3828
- * @param env Environment sandbox.
3829
3840
  */
3830
3841
  parseInline(src, env) {
3831
3842
  const state = new this.core.State(src, this, env);
@@ -3836,9 +3847,6 @@ var MarkdownIt = class {
3836
3847
  /**
3837
3848
  * Similar to {@link MarkdownIt.render} but for single paragraph content.
3838
3849
  * Result will NOT be wrapped into `<p>` tags.
3839
- *
3840
- * @param src Source string.
3841
- * @param env Environment sandbox.
3842
3850
  */
3843
3851
  renderInline(src, env = {}) {
3844
3852
  return this.renderer.render(this.parseInline(src, env), this.options, env);