@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
  //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1101,13 +1101,25 @@ var Token = class {
1101
1101
  */
1102
1102
  var Ruler = class {
1103
1103
  constructor() {
1104
- _defineProperty(this, "__rules__", []);
1105
- _defineProperty(this, "__cache__", null);
1104
+ _defineProperty(
1105
+ this,
1106
+ /** @internal */
1107
+ "__rules__",
1108
+ []
1109
+ );
1110
+ _defineProperty(
1111
+ this,
1112
+ /** @internal */
1113
+ "__cache__",
1114
+ null
1115
+ );
1106
1116
  }
1117
+ /** @internal */
1107
1118
  __find__(name) {
1108
1119
  for (let i = 0; i < this.__rules__.length; i++) if (this.__rules__[i].name === name) return i;
1109
1120
  return -1;
1110
1121
  }
1122
+ /** @internal */
1111
1123
  __compile__() {
1112
1124
  const chains = /* @__PURE__ */ new Set();
1113
1125
  this.__rules__.forEach((rule) => {
@@ -1132,11 +1144,6 @@ var Ruler = class {
1132
1144
  * Replace rule by name with new function & options. Throws error if name not
1133
1145
  * found.
1134
1146
  *
1135
- * @param name Rule name to replace.
1136
- * @param fn New rule function.
1137
- * @param options Rule options. `alt` is an array with names of "alternate"
1138
- * chains.
1139
- *
1140
1147
  * @example Replace existing typographer replacement rule with new one
1141
1148
  * ```javascript
1142
1149
  * import MarkdownIt from 'markdown-it'
@@ -1158,12 +1165,6 @@ var Ruler = class {
1158
1165
  * Add new rule to chain before one with given name. See also
1159
1166
  * {@link Ruler.after}, {@link Ruler.push}.
1160
1167
  *
1161
- * @param beforeName New rule will be added before this one.
1162
- * @param ruleName Name of added rule.
1163
- * @param fn Rule function.
1164
- * @param options Rule options. `alt` is an array with names of "alternate"
1165
- * chains.
1166
- *
1167
1168
  * @example
1168
1169
  * ```javascript
1169
1170
  * import MarkdownIt from 'markdown-it'
@@ -1189,12 +1190,6 @@ var Ruler = class {
1189
1190
  * Add new rule to chain after one with given name. See also
1190
1191
  * {@link Ruler.before}, {@link Ruler.push}.
1191
1192
  *
1192
- * @param afterName New rule will be added after this one.
1193
- * @param ruleName Name of added rule.
1194
- * @param fn Rule function.
1195
- * @param options Rule options. `alt` is an array with names of "alternate"
1196
- * chains.
1197
- *
1198
1193
  * @example
1199
1194
  * ```javascript
1200
1195
  * import MarkdownIt from 'markdown-it'
@@ -1220,11 +1215,6 @@ var Ruler = class {
1220
1215
  * Push new rule to the end of chain. See also
1221
1216
  * {@link Ruler.before}, {@link Ruler.after}.
1222
1217
  *
1223
- * @param ruleName Name of added rule.
1224
- * @param fn Rule function.
1225
- * @param options Rule options. `alt` is an array with names of "alternate"
1226
- * chains.
1227
- *
1228
1218
  * @example
1229
1219
  * ```javascript
1230
1220
  * import MarkdownIt from 'markdown-it'
@@ -1250,9 +1240,7 @@ var Ruler = class {
1250
1240
  *
1251
1241
  * See also {@link Ruler.disable}, {@link Ruler.enableOnly}.
1252
1242
  *
1253
- * @param list List of rule names to enable.
1254
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
1255
- * @returns List of found rule names (if no exception happened).
1243
+ * Returns list of found rule names (if no exception happened).
1256
1244
  */
1257
1245
  enable(list, ignoreInvalid = false) {
1258
1246
  if (!Array.isArray(list)) list = [list];
@@ -1274,9 +1262,6 @@ var Ruler = class {
1274
1262
  * not found - throw Error. Errors can be disabled by second param.
1275
1263
  *
1276
1264
  * See also {@link Ruler.disable}, {@link Ruler.enable}.
1277
- *
1278
- * @param list List of rule names to enable (whitelist).
1279
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
1280
1265
  */
1281
1266
  enableOnly(list, ignoreInvalid = false) {
1282
1267
  if (!Array.isArray(list)) list = [list];
@@ -1291,9 +1276,7 @@ var Ruler = class {
1291
1276
  *
1292
1277
  * See also {@link Ruler.enable}, {@link Ruler.enableOnly}.
1293
1278
  *
1294
- * @param list List of rule names to disable.
1295
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
1296
- * @returns List of found rule names (if no exception happened).
1279
+ * Returns list of found rule names (if no exception happened).
1297
1280
  */
1298
1281
  disable(list, ignoreInvalid = false) {
1299
1282
  if (!Array.isArray(list)) list = [list];
@@ -1433,10 +1416,6 @@ var Renderer = class {
1433
1416
  /**
1434
1417
  * Default token renderer. Can be overriden by custom function
1435
1418
  * in {@link Renderer.rules}.
1436
- *
1437
- * @param tokens List of tokens.
1438
- * @param idx Token index to render.
1439
- * @param options Params of parser instance.
1440
1419
  */
1441
1420
  renderToken(tokens, idx, options) {
1442
1421
  const token = tokens[idx];
@@ -1466,10 +1445,6 @@ var Renderer = class {
1466
1445
  }
1467
1446
  /**
1468
1447
  * The same as {@link Renderer.render}, but for single token of `inline` type.
1469
- *
1470
- * @param tokens List on block tokens to render.
1471
- * @param options Params of parser instance.
1472
- * @param env Additional data from parsed input (references, for example).
1473
1448
  */
1474
1449
  renderInline(tokens, options, env) {
1475
1450
  let result = "";
@@ -1485,10 +1460,6 @@ var Renderer = class {
1485
1460
  * Special kludge for image `alt` attributes to conform CommonMark spec.
1486
1461
  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
1487
1462
  * instead of simple escaping.
1488
- *
1489
- * @param tokens List on block tokens to render.
1490
- * @param options Params of parser instance.
1491
- * @param env Additional data from parsed input (references, for example).
1492
1463
  */
1493
1464
  renderInlineAsText(tokens, options, env) {
1494
1465
  let result = "";
@@ -1512,10 +1483,6 @@ var Renderer = class {
1512
1483
  /**
1513
1484
  * Takes token stream and generates HTML. Probably, you will never need to call
1514
1485
  * this method directly.
1515
- *
1516
- * @param tokens List on block tokens to render.
1517
- * @param options Params of parser instance.
1518
- * @param env Additional data from parsed input (references, for example).
1519
1486
  */
1520
1487
  render(tokens, options, env) {
1521
1488
  let result = "";
@@ -1544,11 +1511,11 @@ var StateCore = class {
1544
1511
  };
1545
1512
  //#endregion
1546
1513
  //#region src/rules_core/normalize.ts
1547
- var NEWLINES_RE = /\r\n?|\n/g;
1514
+ var UNNORMALIZED_NEWLINE_RE = /\r\n?/g;
1548
1515
  var NULL_RE = /\0/g;
1549
1516
  function normalize(state) {
1550
1517
  let str;
1551
- str = state.src.replace(NEWLINES_RE, "\n");
1518
+ str = state.src.replace(UNNORMALIZED_NEWLINE_RE, "\n");
1552
1519
  str = str.replace(NULL_RE, "�");
1553
1520
  state.src = str;
1554
1521
  }
@@ -1598,7 +1565,8 @@ function linkify$1(state) {
1598
1565
  if (!state.md.options.linkify) return;
1599
1566
  for (let j = 0, l = blockTokens.length; j < l; j++) {
1600
1567
  if (blockTokens[j].type !== "inline" || !state.md.linkify.test(blockTokens[j].content)) continue;
1601
- let tokens = blockTokens[j].children;
1568
+ const tokens = blockTokens[j].children;
1569
+ const replacements = [];
1602
1570
  let htmlLinkLevel = 0;
1603
1571
  for (let i = tokens.length - 1; i >= 0; i--) {
1604
1572
  const currentToken = tokens[i];
@@ -1657,8 +1625,27 @@ function linkify$1(state) {
1657
1625
  token.level = level;
1658
1626
  nodes.push(token);
1659
1627
  }
1660
- blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
1628
+ replacements.push({
1629
+ index: i,
1630
+ nodes
1631
+ });
1632
+ }
1633
+ }
1634
+ if (replacements.length > 0) {
1635
+ let newTokensLength = tokens.length;
1636
+ for (const replacement of replacements) newTokensLength += replacement.nodes.length - 1;
1637
+ const newTokens = new Array(newTokensLength);
1638
+ let replacementIndex = 0;
1639
+ let newTokenIndex = 0;
1640
+ replacements.reverse();
1641
+ for (let i = 0; i < tokens.length; i++) {
1642
+ const replacement = replacements[replacementIndex];
1643
+ if ((replacement === null || replacement === void 0 ? void 0 : replacement.index) === i) {
1644
+ for (const node of replacement.nodes) newTokens[newTokenIndex++] = node;
1645
+ replacementIndex++;
1646
+ } else newTokens[newTokenIndex++] = tokens[i];
1661
1647
  }
1648
+ blockTokens[j].children = newTokens;
1662
1649
  }
1663
1650
  }
1664
1651
  }
@@ -1709,6 +1696,14 @@ function replace(state) {
1709
1696
  var QUOTE_TEST_RE = /['"]/;
1710
1697
  var QUOTE_RE = /['"]/g;
1711
1698
  var APOSTROPHE = "’";
1699
+ var MAX_OPENERS = 1e3;
1700
+ function truncateStack(stack, heads, length) {
1701
+ while (stack.length > length) {
1702
+ const item = stack.pop();
1703
+ if (item.isSingleQuote) heads.single = item.prevSameQuoteIdx;
1704
+ else heads.double = item.prevSameQuoteIdx;
1705
+ }
1706
+ }
1712
1707
  function addReplacement(replacements, tokenIdx, pos, ch) {
1713
1708
  if (!replacements[tokenIdx]) replacements[tokenIdx] = [];
1714
1709
  replacements[tokenIdx].push({
@@ -1730,12 +1725,16 @@ function applyReplacements(str, replacements) {
1730
1725
  function process_inlines(tokens, state) {
1731
1726
  let j;
1732
1727
  const stack = [];
1728
+ const heads = {
1729
+ single: -1,
1730
+ double: -1
1731
+ };
1733
1732
  const replacements = {};
1734
1733
  for (let i = 0; i < tokens.length; i++) {
1735
1734
  const token = tokens[i];
1736
1735
  const thisLevel = tokens[i].level;
1737
1736
  for (j = stack.length - 1; j >= 0; j--) if (stack[j].level <= thisLevel) break;
1738
- stack.length = j + 1;
1737
+ truncateStack(stack, heads, j + 1);
1739
1738
  if (token.type !== "text") continue;
1740
1739
  const text = token.content;
1741
1740
  let pos = 0;
@@ -1787,11 +1786,10 @@ function process_inlines(tokens, state) {
1787
1786
  if (isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1788
1787
  continue;
1789
1788
  }
1790
- if (canClose) for (j = stack.length - 1; j >= 0; j--) {
1791
- let item = stack[j];
1792
- if (stack[j].level < thisLevel) break;
1793
- if (item.single === isSingle && stack[j].level === thisLevel) {
1794
- item = stack[j];
1789
+ if (canClose) {
1790
+ j = isSingle ? heads.single : heads.double;
1791
+ if (j >= 0 && stack[j].level === thisLevel) {
1792
+ const item = stack[j];
1795
1793
  let openQuote;
1796
1794
  let closeQuote;
1797
1795
  if (isSingle) {
@@ -1802,18 +1800,23 @@ function process_inlines(tokens, state) {
1802
1800
  closeQuote = state.md.options.quotes[1];
1803
1801
  }
1804
1802
  addReplacement(replacements, i, t.index, closeQuote);
1805
- addReplacement(replacements, item.token, item.pos, openQuote);
1806
- stack.length = j;
1803
+ addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
1804
+ truncateStack(stack, heads, j);
1807
1805
  continue OUTER;
1808
1806
  }
1809
1807
  }
1810
- if (canOpen) stack.push({
1811
- token: i,
1812
- pos: t.index,
1813
- single: isSingle,
1814
- level: thisLevel
1815
- });
1816
- else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1808
+ if (canOpen) {
1809
+ if (stack.length >= MAX_OPENERS) return;
1810
+ stack.push({
1811
+ tokenIdx: i,
1812
+ contentPos: t.index,
1813
+ isSingleQuote: isSingle,
1814
+ level: thisLevel,
1815
+ prevSameQuoteIdx: isSingle ? heads.single : heads.double
1816
+ });
1817
+ if (isSingle) heads.single = stack.length - 1;
1818
+ else heads.double = stack.length - 1;
1819
+ } else if (canClose && isSingle) addReplacement(replacements, i, t.index, APOSTROPHE);
1817
1820
  }
1818
1821
  }
1819
1822
  Object.keys(replacements).forEach(function(tokenIdx) {
@@ -3142,7 +3145,12 @@ function text(state, silent) {
3142
3145
  }
3143
3146
  //#endregion
3144
3147
  //#region src/rules_inline/linkify.ts
3145
- var SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;
3148
+ function isAsciiAlpha(code) {
3149
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122;
3150
+ }
3151
+ function isSchemeChar(code) {
3152
+ return code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 45 || code === 46;
3153
+ }
3146
3154
  function linkify(state, silent) {
3147
3155
  if (!state.md.options.linkify) return false;
3148
3156
  if (state.linkLevel > 0) return false;
@@ -3152,20 +3160,22 @@ function linkify(state, silent) {
3152
3160
  if (state.src.charCodeAt(pos) !== 58) return false;
3153
3161
  if (state.src.charCodeAt(pos + 1) !== 47) return false;
3154
3162
  if (state.src.charCodeAt(pos + 2) !== 47) return false;
3155
- const match = state.pending.match(SCHEME_RE);
3156
- if (!match) return false;
3157
- const proto = match[1];
3158
- const link = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length));
3163
+ const protoMin = pos - Math.min(10, state.pending.length, pos);
3164
+ let protoStart = pos;
3165
+ while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) protoStart--;
3166
+ if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false;
3167
+ const protoLength = pos - protoStart;
3168
+ const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
3159
3169
  if (!link) return false;
3160
3170
  let url = link.url;
3161
- if (url.length <= proto.length) return false;
3171
+ if (url.length <= protoLength) return false;
3162
3172
  let urlEnd = url.length;
3163
3173
  while (urlEnd > 0 && url.charCodeAt(urlEnd - 1) === 42) urlEnd--;
3164
3174
  if (urlEnd !== url.length) url = url.slice(0, urlEnd);
3165
3175
  const fullUrl = state.md.normalizeLink(url);
3166
3176
  if (!state.md.validateLink(fullUrl)) return false;
3167
3177
  if (!silent) {
3168
- state.pending = state.pending.slice(0, -proto.length);
3178
+ state.pending = state.pending.slice(0, -protoLength);
3169
3179
  const token_o = state.push("link_open", "a", 1);
3170
3180
  token_o.attrs = [["href", fullUrl]];
3171
3181
  token_o.markup = "linkify";
@@ -3176,7 +3186,7 @@ function linkify(state, silent) {
3176
3186
  token_c.markup = "linkify";
3177
3187
  token_c.info = "auto";
3178
3188
  }
3179
- state.pos += url.length - proto.length;
3189
+ state.pos += url.length - protoLength;
3180
3190
  return true;
3181
3191
  }
3182
3192
  //#endregion
@@ -3257,40 +3267,51 @@ function escape(state, silent) {
3257
3267
  }
3258
3268
  //#endregion
3259
3269
  //#region src/rules_inline/backticks.ts
3270
+ function buildLastRuns(src) {
3271
+ const lastRuns = {};
3272
+ let pos = 0;
3273
+ while ((pos = src.indexOf("`", pos)) !== -1) {
3274
+ const start = pos;
3275
+ while (src.charCodeAt(++pos) === 96);
3276
+ lastRuns[pos - start] = start;
3277
+ }
3278
+ return lastRuns;
3279
+ }
3260
3280
  function backtick(state, silent) {
3261
- let pos = state.pos;
3262
- if (state.src.charCodeAt(pos) !== 96) return false;
3263
- const start = pos;
3264
- pos++;
3281
+ var _state$backticks$open;
3282
+ const start = state.pos;
3283
+ if (state.src.charCodeAt(start) !== 96) return false;
3265
3284
  const max = state.posMax;
3285
+ let pos = start + 1;
3266
3286
  while (pos < max && state.src.charCodeAt(pos) === 96) pos++;
3267
3287
  const marker = state.src.slice(start, pos);
3268
3288
  const openerLength = marker.length;
3269
- if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start) {
3270
- if (!silent) state.pending += marker;
3271
- state.pos += openerLength;
3272
- return true;
3273
- }
3274
- let matchEnd = pos;
3275
- let matchStart;
3276
- while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) {
3277
- matchEnd = matchStart + 1;
3278
- while (matchEnd < max && state.src.charCodeAt(matchEnd) === 96) matchEnd++;
3279
- const closerLength = matchEnd - matchStart;
3280
- if (closerLength === openerLength) {
3281
- if (!silent) {
3282
- const token = state.push("code_inline", "code", 0);
3283
- token.markup = marker;
3284
- token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1");
3289
+ if (!state.backticksScanned) {
3290
+ state.backticks = buildLastRuns(state.src);
3291
+ state.backticksScanned = true;
3292
+ }
3293
+ if (((_state$backticks$open = state.backticks[openerLength]) !== null && _state$backticks$open !== void 0 ? _state$backticks$open : -1) >= pos) {
3294
+ let matchEnd = pos;
3295
+ let matchStart;
3296
+ while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1 && matchStart < max) {
3297
+ matchEnd = matchStart + 1;
3298
+ while (state.src.charCodeAt(matchEnd) === 96) matchEnd++;
3299
+ if (matchEnd > max) break;
3300
+ if (matchEnd - matchStart === openerLength) {
3301
+ if (!silent) {
3302
+ const token = state.push("code_inline", "code", 0);
3303
+ token.markup = marker;
3304
+ let content = state.src.slice(pos, matchStart).replace(/\n/g, " ");
3305
+ if (content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
3306
+ token.content = content;
3307
+ }
3308
+ state.pos = matchEnd;
3309
+ return true;
3285
3310
  }
3286
- state.pos = matchEnd;
3287
- return true;
3288
3311
  }
3289
- state.backticks[closerLength] = matchStart;
3290
3312
  }
3291
- state.backticksScanned = true;
3292
3313
  if (!silent) state.pending += marker;
3293
- state.pos += openerLength;
3314
+ state.pos = pos;
3294
3315
  return true;
3295
3316
  }
3296
3317
  //#endregion
@@ -4091,7 +4112,12 @@ var MarkdownIt = class {
4091
4112
  parsed.hostname = punycode_js.default.toASCII(parsed.hostname);
4092
4113
  } catch (er) {}
4093
4114
  }
4094
- return mdurl.encode(mdurl.format(parsed));
4115
+ if (parsed.auth) parsed.auth = mdurl.encode(parsed.auth);
4116
+ if (parsed.hostname) parsed.hostname = mdurl.encode(parsed.hostname);
4117
+ if (parsed.pathname) parsed.pathname = mdurl.encode(parsed.pathname);
4118
+ if (parsed.search) parsed.search = mdurl.encode(parsed.search);
4119
+ if (parsed.hash) parsed.hash = mdurl.encode(parsed.hash);
4120
+ return mdurl.format(parsed);
4095
4121
  }
4096
4122
  /**
4097
4123
  * Function used to decode link url to a human-readable format`
@@ -4259,9 +4285,6 @@ var MarkdownIt = class {
4259
4285
  * containing rules with given names. If rule not found, and `ignoreInvalid`
4260
4286
  * not set - throws exception.
4261
4287
  *
4262
- * @param list Rule name or list of rule names to enable.
4263
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
4264
- *
4265
4288
  * @example
4266
4289
  * ```javascript
4267
4290
  * import MarkdownIt from 'markdown-it'
@@ -4288,9 +4311,6 @@ var MarkdownIt = class {
4288
4311
  }
4289
4312
  /**
4290
4313
  * The same as {@link MarkdownIt.enable}, but turn specified rules off.
4291
- *
4292
- * @param list Rule name or list of rule names to disable.
4293
- * @param ignoreInvalid Set `true` to ignore errors when rule not found.
4294
4314
  */
4295
4315
  disable(list, ignoreInvalid = false) {
4296
4316
  let result = [];
@@ -4336,9 +4356,6 @@ var MarkdownIt = class {
4336
4356
  * metadata like reference info, needed for the renderer. It also can be used to
4337
4357
  * inject data in specific cases. Usually, you will be ok to pass `{}`,
4338
4358
  * and then pass updated object to renderer.
4339
- *
4340
- * @param src Source string.
4341
- * @param env Environment sandbox.
4342
4359
  */
4343
4360
  parse(src, env) {
4344
4361
  if (typeof src !== "string") throw new Error("Input data should be a String");
@@ -4352,9 +4369,6 @@ var MarkdownIt = class {
4352
4369
  * `env` can be used to inject additional metadata (`{}` by default).
4353
4370
  * But you will not need it with high probability. See also comment
4354
4371
  * in {@link MarkdownIt.parse}.
4355
- *
4356
- * @param src Source string.
4357
- * @param env Environment sandbox.
4358
4372
  */
4359
4373
  render(src, env = {}) {
4360
4374
  return this.renderer.render(this.parse(src, env), this.options, env);
@@ -4363,9 +4377,6 @@ var MarkdownIt = class {
4363
4377
  * The same as {@link MarkdownIt.parse} but skip all block rules. It returns
4364
4378
  * the block tokens list with the single `inline` element, containing parsed
4365
4379
  * inline tokens in `children` property. Also updates `env` object.
4366
- *
4367
- * @param src Source string.
4368
- * @param env Environment sandbox.
4369
4380
  */
4370
4381
  parseInline(src, env) {
4371
4382
  const state = new this.core.State(src, this, env);
@@ -4376,9 +4387,6 @@ var MarkdownIt = class {
4376
4387
  /**
4377
4388
  * Similar to {@link MarkdownIt.render} but for single paragraph content.
4378
4389
  * Result will NOT be wrapped into `<p>` tags.
4379
- *
4380
- * @param src Source string.
4381
- * @param env Environment sandbox.
4382
4390
  */
4383
4391
  renderInline(src, env = {}) {
4384
4392
  return this.renderer.render(this.parseInline(src, env), this.options, env);