@artooi/ag-ui-web-component 0.15.0 → 0.16.0

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.
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ var X_DESTRUCTIVE_KEY = "x-destructive";
11
11
  var X_CONFIRM_KEY = "x-confirm";
12
12
  var X_SUMMARY_KEY = "x-summary";
13
13
  var X_NAVIGATES_KEY = "x-navigates";
14
+ var READ_PAGE_TOOL = "read_page";
14
15
  var MAX_TOOL_ROUNDS = 10;
15
16
  var TOOL_CALL_STATUS = {
16
17
  PENDING: "pending",
@@ -376,14 +377,7 @@ function parseToolCatalog(data) {
376
377
  // src/tools/route_map.ts
377
378
  var PATH_PARAM_RE = /:([A-Za-z_][A-Za-z0-9_]*)/g;
378
379
  function pathParamNames(path) {
379
- const names = [];
380
- for (const match of path.matchAll(PATH_PARAM_RE)) {
381
- const name = match[1];
382
- if (name !== void 0) {
383
- names.push(name);
384
- }
385
- }
386
- return names;
380
+ return [...path.matchAll(PATH_PARAM_RE)].map((match) => match[0].slice(1));
387
381
  }
388
382
  function fillPath(routeId, path, params) {
389
383
  const leftover = { ...params };
@@ -470,6 +464,8 @@ var DEFAULT_UI_STRINGS = {
470
464
  navigating: "Navigating\u2026",
471
465
  historyCompacted: "Earlier turns condensed to fit the context window ({count} removed)",
472
466
  usingSkill: "Using skill {name}",
467
+ runInterrupted: "The previous response didn\u2019t finish \u2014 the page changed before it arrived.",
468
+ pageMoved: "The page changed since you last looked at it. Call read_page to see the current page, then retry.",
473
469
  skillNeeds: "\u201C{title}\u201D needs: {fields}",
474
470
  message: "Message",
475
471
  inputPlaceholder: "Ask anything\u2026",
@@ -1204,15 +1200,15 @@ function _arrayWithHoles(r) {
1204
1200
  function _iterableToArrayLimit(r, l3) {
1205
1201
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1206
1202
  if (null != t) {
1207
- var e, n, i, u, a = [], f = true, o = false;
1203
+ var e, n, i, u, a = [], f2 = true, o = false;
1208
1204
  try {
1209
1205
  if (i = (t = t.call(r)).next, 0 === l3) ;
1210
- else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l3); f = true) ;
1206
+ else for (; !(f2 = (e = i.call(t)).done) && (a.push(e.value), a.length !== l3); f2 = true) ;
1211
1207
  } catch (r2) {
1212
1208
  o = true, n = r2;
1213
1209
  } finally {
1214
1210
  try {
1215
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1211
+ if (!f2 && null != t.return && (u = t.return(), Object(u) !== u)) return;
1216
1212
  } finally {
1217
1213
  if (o) throw n;
1218
1214
  }
@@ -2563,9 +2559,9 @@ function createDOMPurify() {
2563
2559
  const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
2564
2560
  if (inPlace) {
2565
2561
  _neutralizePatchLinkage(dirty);
2566
- const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2567
- if (typeof nn === "string") {
2568
- const tagName = transformCaseFunc(nn);
2562
+ const nn2 = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2563
+ if (typeof nn2 === "string") {
2564
+ const tagName = transformCaseFunc(nn2);
2569
2565
  if (!ALLOWED_TAGS2[tagName] || FORBID_TAGS[tagName]) {
2570
2566
  _neutralizeRoot(dirty);
2571
2567
  throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
@@ -2718,23 +2714,23 @@ function createDOMPurify() {
2718
2714
  }
2719
2715
  var purify = createDOMPurify();
2720
2716
 
2721
- // node_modules/.pnpm/marked@18.0.5/node_modules/marked/lib/marked.esm.js
2722
- function M() {
2717
+ // node_modules/.pnpm/marked@18.0.9/node_modules/marked/lib/marked.esm.js
2718
+ function C() {
2723
2719
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
2724
2720
  }
2725
- var T = M();
2726
- function N(l3) {
2727
- T = l3;
2721
+ var R = C();
2722
+ function j(l3) {
2723
+ R = l3;
2728
2724
  }
2729
- var _ = { exec: () => null };
2730
- function E(l3) {
2725
+ var z = { exec: () => null };
2726
+ function A(l3) {
2731
2727
  let e = [];
2732
2728
  return (t) => {
2733
2729
  let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
2734
2730
  return s || (s = l3(n), e[n] = s), s;
2735
2731
  };
2736
2732
  }
2737
- function d(l3, e = "") {
2733
+ function k(l3, e = "") {
2738
2734
  let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s, r) => {
2739
2735
  let i = typeof r == "string" ? r : r.source;
2740
2736
  return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n;
@@ -2748,78 +2744,87 @@ var Te = ((l3 = "") => {
2748
2744
  return false;
2749
2745
  }
2750
2746
  })();
2751
- var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E((l3) => new RegExp(`^ {0,${l3}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}>`)) };
2747
+ var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: A((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: A((l3) => new RegExp(`^ {0,${l3}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: A((l3) => new RegExp(`^ {0,${l3}}>`)) };
2752
2748
  var Oe = /^(?:[ \t]*(?:\n|$))+/;
2753
2749
  var we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
2754
2750
  var ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
2755
- var B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
2751
+ var q = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
2756
2752
  var Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
2757
- var j = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
2753
+ var U = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
2758
2754
  var oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
2759
- var ae = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
2760
- var Se = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
2761
- var F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
2762
- var $e = /^[^\n]+/;
2763
- var U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
2764
- var Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
2765
- var _e = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
2766
- var H = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
2767
- var K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
2768
- var ze = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
2769
- var le = d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
2770
- var Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex();
2771
- var W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e };
2772
- var se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
2773
- var Ee = { ...W, lheading: Se, table: se, paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex() };
2774
- var Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
2755
+ var ae = k(oe).replace(/bull/g, U).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
2756
+ var Se = k(oe).replace(/bull/g, U).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
2757
+ var K = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
2758
+ var _e = /^[^\n]+/;
2759
+ var W = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
2760
+ var $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", W).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
2761
+ var Le = k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, U).getRegex();
2762
+ var Q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
2763
+ var X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
2764
+ var Me = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", X).replace("tag", Q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
2765
+ var le = (l3) => k(K).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex();
2766
+ var ze = le(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
2767
+ var Ee = le(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
2768
+ var Ce = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ee).getRegex();
2769
+ var J = { blockquote: Ce, code: we, def: $e, fences: ye, heading: Pe, hr: q, html: Me, lheading: ae, list: Le, newline: Oe, paragraph: ze, table: z, text: _e };
2770
+ var se = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex();
2771
+ var Ae = { ...J, lheading: Se, table: se, paragraph: k(K).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Q).getRegex() };
2772
+ var Ie = { ...J, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", X).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: z, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(K).replace("hr", q).replace("heading", ` *#{1,6} *[^
2775
2773
  ]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
2776
- var Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
2777
- var Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
2778
- var ue = /^( {2,}|\\)\n(?!\s*$)/;
2779
- var Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
2780
- var I = /[\p{P}\p{S}]/u;
2781
- var Z = /[\s\p{P}\p{S}]/u;
2782
- var X = /[^\s\p{P}\p{S}]/u;
2783
- var De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex();
2784
- var pe = /(?!~)[\p{P}\p{S}]/u;
2785
- var qe = /(?!~)[\s\p{P}\p{S}]/u;
2786
- var ve = /(?:[^\s\p{P}\p{S}]|~)/u;
2787
- var He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
2774
+ var Be = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
2775
+ var De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
2776
+ var pe = /^( {2,}|\\)\n(?!\s*$)/;
2777
+ var qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
2778
+ var _ = /[\p{P}\p{S}]/u;
2779
+ var I = /[\s\p{P}\p{S}]/u;
2780
+ var v = /[^\s\p{P}\p{S}]/u;
2781
+ var ve = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, I).getRegex();
2782
+ var He = /[\p{Pi}\p{Ps}"']/u;
2783
+ var ue = /(?!~)[\p{P}\p{S}]/u;
2784
+ var Ze = /(?!~)[\s\p{P}\p{S}]/u;
2785
+ var Ge = /(?:[^\s\p{P}\p{S}]|~)/u;
2786
+ var Qe = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
2788
2787
  var ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
2789
- var Ze = d(ce, "u").replace(/punct/g, I).getRegex();
2790
- var Ge = d(ce, "u").replace(/punct/g, pe).getRegex();
2788
+ var Ne = k(ce, "u").replace(/punct/g, _).getRegex();
2789
+ var je = k(ce, "u").replace(/punct/g, ue).getRegex();
2790
+ var Fe = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
2791
+ var Ue = k(Fe, "u").replace(/openQuote/g, He).replace(/punct/g, _).getRegex();
2791
2792
  var he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
2792
- var Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
2793
- var Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex();
2794
- var je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
2795
- var Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex();
2796
- var Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
2797
- var Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex();
2798
- var We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex();
2799
- var Xe = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
2800
- var Je = d(K).replace("(?:-->|$)", "-->").getRegex();
2801
- var Ve = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
2802
- var v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
2803
- var Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
2804
- var ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex();
2805
- var de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex();
2806
- var et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex();
2793
+ var Ke = k(he, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2794
+ var We = k(he, "gu").replace(/notPunctSpace/g, Ge).replace(/punctSpace/g, Ze).replace(/punct/g, ue).getRegex();
2795
+ var Xe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
2796
+ var Je = k(Xe, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2797
+ var Ve = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2798
+ var Ye = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
2799
+ var et = k(Ye, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2800
+ var tt = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _).getRegex();
2801
+ var nt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
2802
+ var rt = k(nt, "gu").replace(/notPunctSpace/g, v).replace(/punctSpace/g, I).replace(/punct/g, _).getRegex();
2803
+ var st = k(/\\(punct)/, "gu").replace(/punct/g, _).getRegex();
2804
+ var it = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
2805
+ var ot = k(X).replace("(?:-->|$)", "-->").getRegex();
2806
+ var at = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ot).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
2807
+ var G = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
2808
+ var lt = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", G).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
2809
+ var de = k(/^!?\[(label)\]\[(ref)\]/).replace("label", G).replace("ref", W).getRegex();
2810
+ var ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", W).getRegex();
2811
+ var pt = k("reflink|nolink(?!\\()", "g").replace("reflink", de).replace("nolink", ke).getRegex();
2807
2812
  var ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
2808
- var J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ };
2809
- var tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() };
2810
- var Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
2811
- var nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
2812
- var D = { normal: W, gfm: Ee, pedantic: Ie };
2813
- var A = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
2814
- var rt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
2815
- var ge = (l3) => rt[l3];
2813
+ var V = { _backpedal: z, anyPunctuation: st, autolink: it, blockSkip: Qe, br: pe, code: De, del: z, delLDelim: z, delRDelim: z, emStrongLDelim: Ne, emStrongRDelimAst: Ke, emStrongRDelimUnd: Ve, escape: Be, link: lt, nolink: ke, punctuation: ve, reflink: de, reflinkSearch: pt, tag: at, text: qe, url: z };
2814
+ var ut = { ...V, emStrongLDelim: Ue, emStrongRDelimAst: Je, emStrongRDelimUnd: et, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", G).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", G).getRegex() };
2815
+ var F = { ...V, emStrongRDelimAst: We, emStrongLDelim: je, delLDelim: tt, delRDelim: rt, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
2816
+ var ct = { ...F, br: k(pe).replace("{2,}", "*").getRegex(), text: k(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
2817
+ var H = { normal: J, gfm: Ae, pedantic: Ie };
2818
+ var B = { normal: V, gfm: F, breaks: ct, pedantic: ut };
2819
+ var ht = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
2820
+ var ge = (l3) => ht[l3];
2816
2821
  function O(l3, e) {
2817
2822
  if (e) {
2818
2823
  if (m.escapeTest.test(l3)) return l3.replace(m.escapeReplace, ge);
2819
2824
  } else if (m.escapeTestNoEncode.test(l3)) return l3.replace(m.escapeReplaceNoEncode, ge);
2820
2825
  return l3;
2821
2826
  }
2822
- function V(l3) {
2827
+ function Y(l3) {
2823
2828
  try {
2824
2829
  l3 = encodeURI(l3).replace(m.percentDecode, "%");
2825
2830
  } catch {
@@ -2827,11 +2832,11 @@ function V(l3) {
2827
2832
  }
2828
2833
  return l3;
2829
2834
  }
2830
- function Y(l3, e) {
2835
+ function ee(l3, e) {
2831
2836
  let t = l3.replace(m.findPipe, (r, i, o) => {
2832
- let u = false, a = i;
2833
- for (; --a >= 0 && o[a] === "\\"; ) u = !u;
2834
- return u ? "|" : " |";
2837
+ let p = false, a = i;
2838
+ for (; --a >= 0 && o[a] === "\\"; ) p = !p;
2839
+ return p ? "|" : " |";
2835
2840
  }), n = t.split(m.splitPipe), s = 0;
2836
2841
  if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
2837
2842
  else for (; n.length < e; ) n.push("");
@@ -2850,7 +2855,7 @@ function $(l3, e, t) {
2850
2855
  }
2851
2856
  return l3.slice(0, n - s);
2852
2857
  }
2853
- function ee(l3) {
2858
+ function te(l3) {
2854
2859
  let e = l3.split(`
2855
2860
  `), t = e.length - 1;
2856
2861
  for (; t >= 0 && m.blankLine.test(e[t]); ) t--;
@@ -2876,10 +2881,10 @@ function me(l3, e = 0) {
2876
2881
  function xe(l3, e, t, n, s) {
2877
2882
  let r = e.href, i = e.title || null, o = l3[1].replace(s.other.outputLinkReplace, "$1");
2878
2883
  n.state.inLink = true;
2879
- let u = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
2880
- return n.state.inLink = false, u;
2884
+ let p = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) };
2885
+ return n.state.inLink = false, p;
2881
2886
  }
2882
- function st(l3, e, t) {
2887
+ function dt(l3, e, t) {
2883
2888
  let n = l3.match(t.other.indentCodeCompensation);
2884
2889
  if (n === null) return e;
2885
2890
  let s = n[1];
@@ -2892,12 +2897,12 @@ function st(l3, e, t) {
2892
2897
  }).join(`
2893
2898
  `);
2894
2899
  }
2895
- var w = class {
2900
+ var y = class {
2896
2901
  options;
2897
2902
  rules;
2898
2903
  lexer;
2899
2904
  constructor(e) {
2900
- this.options = e || T;
2905
+ this.options = e || R;
2901
2906
  }
2902
2907
  space(e) {
2903
2908
  let t = this.rules.block.newline.exec(e);
@@ -2906,14 +2911,14 @@ var w = class {
2906
2911
  code(e) {
2907
2912
  let t = this.rules.block.code.exec(e);
2908
2913
  if (t) {
2909
- let n = this.options.pedantic ? t[0] : ee(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
2914
+ let n = this.options.pedantic ? t[0] : te(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
2910
2915
  return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
2911
2916
  }
2912
2917
  }
2913
2918
  fences(e) {
2914
2919
  let t = this.rules.block.fences.exec(e);
2915
2920
  if (t) {
2916
- let n = t[0], s = st(n, t[3] || "", this.rules);
2921
+ let n = t[0], s = dt(n, t[3] || "", this.rules);
2917
2922
  return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
2918
2923
  }
2919
2924
  }
@@ -2941,32 +2946,33 @@ var w = class {
2941
2946
  `).split(`
2942
2947
  `), s = "", r = "", i = [];
2943
2948
  for (; n.length > 0; ) {
2944
- let o = false, u = [], a;
2945
- for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), o = true;
2946
- else if (!o) u.push(n[a]);
2949
+ let o = false, p = [], a;
2950
+ for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) p.push(n[a]), o = true;
2951
+ else if (!o) p.push(n[a]);
2947
2952
  else break;
2948
2953
  n = n.slice(a);
2949
- let c = u.join(`
2950
- `), p = c.replace(this.rules.other.blockquoteSetextReplace, `
2954
+ let u = p.join(`
2955
+ `), c = u.replace(this.rules.other.blockquoteSetextReplace, `
2951
2956
  $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
2952
2957
  s = s ? `${s}
2953
- ${c}` : c, r = r ? `${r}
2954
- ${p}` : p;
2955
- let k = this.lexer.state.top;
2956
- if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k, n.length === 0) break;
2957
- let h = i.at(-1);
2958
- if (h?.type === "code") break;
2959
- if (h?.type === "blockquote") {
2960
- let R = h, f = R.raw + `
2961
- ` + n.join(`
2962
- `), S = this.blockquote(f);
2963
- i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
2958
+ ${u}` : u, r = r ? `${r}
2959
+ ${c}` : c;
2960
+ let h = this.lexer.state.top;
2961
+ if (this.lexer.state.top = true, this.lexer.blockTokens(c, i, true), this.lexer.state.top = h, n.length === 0) break;
2962
+ let d = i.at(-1);
2963
+ if (d?.type === "code") break;
2964
+ if (d?.type === "blockquote") {
2965
+ let T = d, g = n.join(`
2966
+ `), w = T.raw + `
2967
+ ` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), M = this.blockquote(w);
2968
+ i[i.length - 1] = M, s = `${s}
2969
+ ${g}`, r = r.substring(0, r.length - T.text.length) + M.text;
2964
2970
  break;
2965
- } else if (h?.type === "list") {
2966
- let R = h, f = R.raw + `
2971
+ } else if (d?.type === "list") {
2972
+ let T = d, g = T.raw + `
2967
2973
  ` + n.join(`
2968
- `), S = this.list(f);
2969
- i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
2974
+ `), w = this.list(g);
2975
+ i[i.length - 1] = w, s = s.substring(0, s.length - d.raw.length) + w.raw, r = r.substring(0, r.length - T.raw.length) + w.raw, n = g.substring(i.at(-1).raw.length).split(`
2970
2976
  `);
2971
2977
  continue;
2972
2978
  }
@@ -2981,59 +2987,59 @@ ${p}` : p;
2981
2987
  n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
2982
2988
  let i = this.rules.other.listItemRegex(n), o = false;
2983
2989
  for (; e; ) {
2984
- let a = false, c = "", p = "";
2990
+ let a = false, u = "", c = "";
2985
2991
  if (!(t = i.exec(e)) || this.rules.block.hr.test(e)) break;
2986
- c = t[0], e = e.substring(c.length);
2987
- let k = me(t[2].split(`
2988
- `, 1)[0], t[1].length), h = e.split(`
2989
- `, 1)[0], R = !k.trim(), f = 0;
2990
- if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
2991
- `, e = e.substring(h.length + 1), a = true), !a) {
2992
- let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
2992
+ u = t[0], e = e.substring(u.length);
2993
+ let h = me(t[2].split(`
2994
+ `, 1)[0], t[1].length), d = e.split(`
2995
+ `, 1)[0], T = !h.trim(), g = 0;
2996
+ if (this.options.pedantic ? (g = 2, c = h.trimStart()) : T ? g = t[1].length + 1 : (g = h.search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, c = h.slice(g), g += t[1].length), T && this.rules.other.blankLine.test(d) && (u += d + `
2997
+ `, e = e.substring(d.length + 1), a = true), !a) {
2998
+ let w = this.rules.other.nextBulletRegex(g), M = this.rules.other.hrRegex(g), ne = this.rules.other.fencesBeginRegex(g), re = this.rules.other.headingBeginRegex(g), be = this.rules.other.htmlBeginRegex(g), Re = this.rules.other.blockquoteBeginRegex(g);
2993
2999
  for (; e; ) {
2994
- let G = e.split(`
2995
- `, 1)[0], C;
2996
- if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h)) break;
2997
- if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) p += `
2998
- ` + C.slice(f);
3000
+ let N = e.split(`
3001
+ `, 1)[0], D;
3002
+ if (d = N, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), D = d) : D = d.replace(this.rules.other.tabCharGlobal, " "), ne.test(d) || re.test(d) || be.test(d) || Re.test(d) || w.test(d) || M.test(d)) break;
3003
+ if (D.search(this.rules.other.nonSpaceChar) >= g || !d.trim()) c += `
3004
+ ` + D.slice(g);
2999
3005
  else {
3000
- if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k)) break;
3001
- p += `
3002
- ` + h;
3006
+ if (T || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(h) || re.test(h) || M.test(h)) break;
3007
+ c += `
3008
+ ` + d;
3003
3009
  }
3004
- R = !h.trim(), c += G + `
3005
- `, e = e.substring(G.length + 1), k = C.slice(f);
3010
+ T = !d.trim(), u += N + `
3011
+ `, e = e.substring(N.length + 1), h = D.slice(g);
3006
3012
  }
3007
3013
  }
3008
- r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += c;
3014
+ r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(u) && (o = true)), r.items.push({ type: "list_item", raw: u, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), r.raw += u;
3009
3015
  }
3010
- let u = r.items.at(-1);
3011
- if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
3016
+ let p = r.items.at(-1);
3017
+ if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
3012
3018
  else return;
3013
3019
  r.raw = r.raw.trimEnd();
3014
3020
  for (let a of r.items) {
3015
3021
  this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
3016
- let c = a.tokens[0];
3017
- if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
3018
- a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
3019
- for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
3020
- this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
3022
+ let u = a.tokens[0];
3023
+ if (a.task && (u?.type === "text" || u?.type === "paragraph")) {
3024
+ a.text = a.text.replace(this.rules.other.listReplaceTask, ""), u.raw = u.raw.replace(this.rules.other.listReplaceTask, ""), u.text = u.text.replace(this.rules.other.listReplaceTask, "");
3025
+ for (let h = this.lexer.inlineQueue.length - 1; h >= 0; h--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)) {
3026
+ this.lexer.inlineQueue[h].src = this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask, "");
3021
3027
  break;
3022
3028
  }
3023
- let p = this.rules.other.listTaskCheckbox.exec(a.raw);
3024
- if (p) {
3025
- let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
3026
- a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
3029
+ let c = this.rules.other.listTaskCheckbox.exec(a.raw);
3030
+ if (c) {
3031
+ let h = { type: "checkbox", raw: c[0] + " ", checked: c[0] !== "[ ]" };
3032
+ a.checked = h.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = h.raw + a.tokens[0].raw, a.tokens[0].text = h.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(h)) : a.tokens.unshift({ type: "paragraph", raw: h.raw, text: h.raw, tokens: [h] }) : a.tokens.unshift(h);
3027
3033
  }
3028
3034
  } else a.task && (a.task = false);
3029
3035
  if (!r.loose) {
3030
- let p = a.tokens.filter((h) => h.type === "space"), k = p.length > 0 && p.some((h) => this.rules.other.anyLine.test(h.raw));
3031
- r.loose = k;
3036
+ let c = a.tokens.filter((d) => d.type === "space"), h = c.length > 0 && c.some((d) => this.rules.other.anyLine.test(d.raw));
3037
+ r.loose = h;
3032
3038
  }
3033
3039
  }
3034
3040
  if (r.loose) for (let a of r.items) {
3035
3041
  a.loose = true;
3036
- for (let c of a.tokens) c.type === "text" && (c.type = "paragraph");
3042
+ for (let u of a.tokens) u.type === "text" && (u.type = "paragraph");
3037
3043
  }
3038
3044
  return r;
3039
3045
  }
@@ -3041,7 +3047,7 @@ ${p}` : p;
3041
3047
  html(e) {
3042
3048
  let t = this.rules.block.html.exec(e);
3043
3049
  if (t) {
3044
- let n = ee(t[0]);
3050
+ let n = te(t[0]);
3045
3051
  return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
3046
3052
  }
3047
3053
  }
@@ -3056,13 +3062,13 @@ ${p}` : p;
3056
3062
  table(e) {
3057
3063
  let t = this.rules.block.table.exec(e);
3058
3064
  if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
3059
- let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
3065
+ let n = ee(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
3060
3066
  `) : [], i = { type: "table", raw: $(t[0], `
3061
3067
  `), header: [], align: [], rows: [] };
3062
3068
  if (n.length === s.length) {
3063
3069
  for (let o of s) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
3064
3070
  for (let o = 0; o < n.length; o++) i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
3065
- for (let o of r) i.rows.push(Y(o, i.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i.align[a] })));
3071
+ for (let o of r) i.rows.push(ee(o, i.header.length).map((p, a) => ({ text: p, tokens: this.lexer.inline(p), header: false, align: i.align[a] })));
3066
3072
  return i;
3067
3073
  }
3068
3074
  }
@@ -3106,8 +3112,8 @@ ${p}` : p;
3106
3112
  let i = fe(t[2], "()");
3107
3113
  if (i === -2) return;
3108
3114
  if (i > -1) {
3109
- let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
3110
- t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
3115
+ let p = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
3116
+ t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, p).trim(), t[3] = "";
3111
3117
  }
3112
3118
  }
3113
3119
  let s = t[2], r = "";
@@ -3133,25 +3139,28 @@ ${p}` : p;
3133
3139
  let s = this.rules.inline.emStrongLDelim.exec(e);
3134
3140
  if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
3135
3141
  if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
3136
- let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
3137
- for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null; ) {
3142
+ let i = [...s[0]].length - 1, o, p, a = i, u = 0, c = s[0][0], h = n === c, d = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
3143
+ for (d.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = d.exec(t)) !== null; ) {
3138
3144
  if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue;
3139
- if (u = [...o].length, s[3] || s[4]) {
3140
- a += u;
3141
- continue;
3142
- } else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
3143
- c += u;
3145
+ if (p = [...o].length, s[3] || s[4]) {
3146
+ a += p;
3144
3147
  continue;
3148
+ } else if (s[5] || s[6]) {
3149
+ if (i % 3 && !((i + p) % 3)) {
3150
+ u += p;
3151
+ continue;
3152
+ }
3153
+ if (h) break;
3145
3154
  }
3146
- if (a -= u, a > 0) continue;
3147
- u = Math.min(u, u + a + c);
3148
- let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
3149
- if (Math.min(i, u) % 2) {
3150
- let f = h.slice(1, -1);
3151
- return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
3155
+ if (a -= p, a > 0) continue;
3156
+ p = Math.min(p, p + a + u);
3157
+ let T = [...s[0]][0].length, g = e.slice(0, i + s.index + T + p);
3158
+ if (Math.min(i, p) % 2) {
3159
+ let M = g.slice(1, -1);
3160
+ return { type: "em", raw: g, text: M, tokens: this.lexer.inlineTokens(M) };
3152
3161
  }
3153
- let R = h.slice(2, -2);
3154
- return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
3162
+ let w = g.slice(2, -2);
3163
+ return { type: "strong", raw: g, text: w, tokens: this.lexer.inlineTokens(w) };
3155
3164
  }
3156
3165
  }
3157
3166
  }
@@ -3170,17 +3179,17 @@ ${p}` : p;
3170
3179
  let s = this.rules.inline.delLDelim.exec(e);
3171
3180
  if (!s) return;
3172
3181
  if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
3173
- let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
3174
- for (c.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c.exec(t)) !== null; ) {
3175
- if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i)) continue;
3182
+ let i = [...s[0]].length - 1, o, p, a = i, u = this.rules.inline.delRDelim;
3183
+ for (u.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = u.exec(t)) !== null; ) {
3184
+ if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (p = [...o].length, p !== i)) continue;
3176
3185
  if (s[3] || s[4]) {
3177
- a += u;
3186
+ a += p;
3178
3187
  continue;
3179
3188
  }
3180
- if (a -= u, a > 0) continue;
3181
- u = Math.min(u, u + a);
3182
- let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
3183
- return { type: "del", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
3189
+ if (a -= p, a > 0) continue;
3190
+ p = Math.min(p, p + a);
3191
+ let c = [...s[0]][0].length, h = e.slice(0, i + s.index + c + p), d = h.slice(i, -i);
3192
+ return { type: "del", raw: h, text: d, tokens: this.lexer.inlineTokens(d) };
3184
3193
  }
3185
3194
  }
3186
3195
  }
@@ -3221,12 +3230,12 @@ var x = class l {
3221
3230
  inlineQueue;
3222
3231
  tokenizer;
3223
3232
  constructor(e) {
3224
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
3225
- let t = { other: m, block: D.normal, inline: A.normal };
3226
- this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t;
3233
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || R, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
3234
+ let t = { other: m, block: H.normal, inline: B.normal };
3235
+ this.options.pedantic ? (t.block = H.pedantic, t.inline = B.pedantic) : this.options.gfm && (t.block = H.gfm, this.options.breaks ? t.inline = B.breaks : t.inline = B.gfm), this.tokenizer.rules = t;
3227
3236
  }
3228
3237
  static get rules() {
3229
- return { block: D, inline: A };
3238
+ return { block: H, inline: B };
3230
3239
  }
3231
3240
  static lex(e, t) {
3232
3241
  return new l(t).lex(e);
@@ -3313,9 +3322,9 @@ var x = class l {
3313
3322
  }
3314
3323
  let i = e;
3315
3324
  if (this.options.extensions?.startBlock) {
3316
- let o = 1 / 0, u = e.slice(1), a;
3317
- this.options.extensions.startBlock.forEach((c) => {
3318
- a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
3325
+ let o = 1 / 0, p = e.slice(1), a;
3326
+ this.options.extensions.startBlock.forEach((u) => {
3327
+ a = u.call({ lexer: this }, p), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
3319
3328
  }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
3320
3329
  }
3321
3330
  if (this.state.top && (r = this.tokenizer.paragraph(i))) {
@@ -3347,78 +3356,78 @@ var x = class l {
3347
3356
  }
3348
3357
  inlineTokens(e, t = []) {
3349
3358
  this.tokenizer.lexer = this;
3350
- let n = e, s = null;
3359
+ let n = e;
3351
3360
  if (this.tokens.links) {
3352
- let a = Object.keys(this.tokens.links);
3353
- if (a.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
3354
- }
3355
- for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
3356
- let r;
3357
- for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
3358
- n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
3359
- let i = false, o = "", u = 1 / 0;
3361
+ let o = Object.keys(this.tokens.links);
3362
+ o.length > 0 && (n = n.replace(this.tokenizer.rules.inline.reflinkSearch, (p) => o.includes(p.slice(p.lastIndexOf("[") + 1, -1)) ? "[" + "a".repeat(p.length - 2) + "]" : p));
3363
+ }
3364
+ n = n.replace(this.tokenizer.rules.inline.anyPunctuation, "++"), n = n.replace(this.tokenizer.rules.inline.blockSkip, (o, p, a) => {
3365
+ let u = a ? a.length : 0;
3366
+ return o.slice(0, u) + "[" + "a".repeat(o.length - u - 2) + "]";
3367
+ }), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
3368
+ let s = false, r = "", i = 1 / 0;
3360
3369
  for (; e; ) {
3361
- if (e.length < u) u = e.length;
3370
+ if (e.length < i) i = e.length;
3362
3371
  else {
3363
3372
  this.infiniteLoopError(e.charCodeAt(0));
3364
3373
  break;
3365
3374
  }
3366
- i || (o = ""), i = false;
3367
- let a;
3368
- if (this.options.extensions?.inline?.some((p) => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false)) continue;
3369
- if (a = this.tokenizer.escape(e)) {
3370
- e = e.substring(a.raw.length), t.push(a);
3375
+ s || (r = ""), s = false;
3376
+ let o;
3377
+ if (this.options.extensions?.inline?.some((a) => (o = a.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
3378
+ if (o = this.tokenizer.escape(e)) {
3379
+ e = e.substring(o.raw.length), t.push(o);
3371
3380
  continue;
3372
3381
  }
3373
- if (a = this.tokenizer.tag(e)) {
3374
- e = e.substring(a.raw.length), t.push(a);
3382
+ if (o = this.tokenizer.tag(e)) {
3383
+ e = e.substring(o.raw.length), t.push(o);
3375
3384
  continue;
3376
3385
  }
3377
- if (a = this.tokenizer.link(e)) {
3378
- e = e.substring(a.raw.length), t.push(a);
3386
+ if (o = this.tokenizer.link(e)) {
3387
+ e = e.substring(o.raw.length), t.push(o);
3379
3388
  continue;
3380
3389
  }
3381
- if (a = this.tokenizer.reflink(e, this.tokens.links)) {
3382
- e = e.substring(a.raw.length);
3383
- let p = t.at(-1);
3384
- a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
3390
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
3391
+ e = e.substring(o.raw.length);
3392
+ let a = t.at(-1);
3393
+ o.type === "text" && a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
3385
3394
  continue;
3386
3395
  }
3387
- if (a = this.tokenizer.emStrong(e, n, o)) {
3388
- e = e.substring(a.raw.length), t.push(a);
3396
+ if (o = this.tokenizer.emStrong(e, n, r)) {
3397
+ e = e.substring(o.raw.length), t.push(o);
3389
3398
  continue;
3390
3399
  }
3391
- if (a = this.tokenizer.codespan(e)) {
3392
- e = e.substring(a.raw.length), t.push(a);
3400
+ if (o = this.tokenizer.codespan(e)) {
3401
+ e = e.substring(o.raw.length), t.push(o);
3393
3402
  continue;
3394
3403
  }
3395
- if (a = this.tokenizer.br(e)) {
3396
- e = e.substring(a.raw.length), t.push(a);
3404
+ if (o = this.tokenizer.br(e)) {
3405
+ e = e.substring(o.raw.length), t.push(o);
3397
3406
  continue;
3398
3407
  }
3399
- if (a = this.tokenizer.del(e, n, o)) {
3400
- e = e.substring(a.raw.length), t.push(a);
3408
+ if (o = this.tokenizer.del(e, n, r)) {
3409
+ e = e.substring(o.raw.length), t.push(o);
3401
3410
  continue;
3402
3411
  }
3403
- if (a = this.tokenizer.autolink(e)) {
3404
- e = e.substring(a.raw.length), t.push(a);
3412
+ if (o = this.tokenizer.autolink(e)) {
3413
+ e = e.substring(o.raw.length), t.push(o);
3405
3414
  continue;
3406
3415
  }
3407
- if (!this.state.inLink && (a = this.tokenizer.url(e))) {
3408
- e = e.substring(a.raw.length), t.push(a);
3416
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
3417
+ e = e.substring(o.raw.length), t.push(o);
3409
3418
  continue;
3410
3419
  }
3411
- let c = e;
3420
+ let p = e;
3412
3421
  if (this.options.extensions?.startInline) {
3413
- let p = 1 / 0, k = e.slice(1), h;
3414
- this.options.extensions.startInline.forEach((R) => {
3415
- h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h));
3416
- }), p < 1 / 0 && p >= 0 && (c = e.substring(0, p + 1));
3417
- }
3418
- if (a = this.tokenizer.inlineText(c)) {
3419
- e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
3420
- let p = t.at(-1);
3421
- p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
3422
+ let a = 1 / 0, u = e.slice(1), c;
3423
+ this.options.extensions.startInline.forEach((h) => {
3424
+ c = h.call({ lexer: this }, u), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
3425
+ }), a < 1 / 0 && a >= 0 && (p = e.substring(0, a + 1));
3426
+ }
3427
+ if (o = this.tokenizer.inlineText(p)) {
3428
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), s = true;
3429
+ let a = t.at(-1);
3430
+ a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
3422
3431
  continue;
3423
3432
  }
3424
3433
  if (e) {
@@ -3434,11 +3443,11 @@ var x = class l {
3434
3443
  else throw new Error(t);
3435
3444
  }
3436
3445
  };
3437
- var y = class {
3446
+ var P = class {
3438
3447
  options;
3439
3448
  parser;
3440
3449
  constructor(e) {
3441
- this.options = e || T;
3450
+ this.options = e || R;
3442
3451
  }
3443
3452
  space(e) {
3444
3453
  return "";
@@ -3472,8 +3481,8 @@ ${this.parser.parse(e)}</blockquote>
3472
3481
  list(e) {
3473
3482
  let t = e.ordered, n = e.start, s = "";
3474
3483
  for (let o = 0; o < e.items.length; o++) {
3475
- let u = e.items[o];
3476
- s += this.listitem(u);
3484
+ let p = e.items[o];
3485
+ s += this.listitem(p);
3477
3486
  }
3478
3487
  let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
3479
3488
  return "<" + r + i + `>
@@ -3534,7 +3543,7 @@ ${e}</tr>
3534
3543
  return `<del>${this.parser.parseInline(e)}</del>`;
3535
3544
  }
3536
3545
  link({ href: e, title: t, tokens: n }) {
3537
- let s = this.parser.parseInline(n), r = V(e);
3546
+ let s = this.parser.parseInline(n), r = Y(e);
3538
3547
  if (r === null) return s;
3539
3548
  e = r;
3540
3549
  let i = '<a href="' + e + '"';
@@ -3542,7 +3551,7 @@ ${e}</tr>
3542
3551
  }
3543
3552
  image({ href: e, title: t, text: n, tokens: s }) {
3544
3553
  s && (n = this.parser.parseInline(s, this.parser.textRenderer));
3545
- let r = V(e);
3554
+ let r = Y(e);
3546
3555
  if (r === null) return O(n);
3547
3556
  e = r;
3548
3557
  let i = `<img src="${e}" alt="${O(n)}"`;
@@ -3589,7 +3598,7 @@ var b = class l2 {
3589
3598
  renderer;
3590
3599
  textRenderer;
3591
3600
  constructor(e) {
3592
- this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
3601
+ this.options = e || R, this.options.renderer = this.options.renderer || new P(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
3593
3602
  }
3594
3603
  static parse(e, t) {
3595
3604
  return new l2(t).parse(e);
@@ -3604,7 +3613,7 @@ var b = class l2 {
3604
3613
  let s = e[n];
3605
3614
  if (this.options.extensions?.renderers?.[s.type]) {
3606
3615
  let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
3607
- if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
3616
+ if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(i.type)) {
3608
3617
  t += o || "";
3609
3618
  continue;
3610
3619
  }
@@ -3675,7 +3684,7 @@ var b = class l2 {
3675
3684
  let r = e[s];
3676
3685
  if (this.options.extensions?.renderers?.[r.type]) {
3677
3686
  let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
3678
- if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
3687
+ if (o !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
3679
3688
  n += o || "";
3680
3689
  continue;
3681
3690
  }
@@ -3736,11 +3745,11 @@ var b = class l2 {
3736
3745
  return n;
3737
3746
  }
3738
3747
  };
3739
- var P = class {
3748
+ var S = class {
3740
3749
  options;
3741
3750
  block;
3742
3751
  constructor(e) {
3743
- this.options = e || T;
3752
+ this.options = e || R;
3744
3753
  }
3745
3754
  static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
3746
3755
  static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
@@ -3763,17 +3772,17 @@ var P = class {
3763
3772
  return e ? b.parse : b.parseInline;
3764
3773
  }
3765
3774
  };
3766
- var q = class {
3767
- defaults = M();
3775
+ var Z = class {
3776
+ defaults = C();
3768
3777
  options = this.setOptions;
3769
3778
  parse = this.parseMarkdown(true);
3770
3779
  parseInline = this.parseMarkdown(false);
3771
3780
  Parser = b;
3772
- Renderer = y;
3781
+ Renderer = P;
3773
3782
  TextRenderer = L;
3774
3783
  Lexer = x;
3775
- Tokenizer = w;
3776
- Hooks = P;
3784
+ Tokenizer = y;
3785
+ Hooks = S;
3777
3786
  constructor(...e) {
3778
3787
  this.use(...e);
3779
3788
  }
@@ -3810,8 +3819,8 @@ var q = class {
3810
3819
  if ("renderer" in r) {
3811
3820
  let i = t.renderers[r.name];
3812
3821
  i ? t.renderers[r.name] = function(...o) {
3813
- let u = r.renderer.apply(this, o);
3814
- return u === false && (u = i.apply(this, o)), u;
3822
+ let p = r.renderer.apply(this, o);
3823
+ return p === false && (p = i.apply(this, o)), p;
3815
3824
  } : t.renderers[r.name] = r.renderer;
3816
3825
  }
3817
3826
  if ("tokenizer" in r) {
@@ -3821,51 +3830,51 @@ var q = class {
3821
3830
  }
3822
3831
  "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
3823
3832
  }), s.extensions = t), n.renderer) {
3824
- let r = this.defaults.renderer || new y(this.defaults);
3833
+ let r = this.defaults.renderer || new P(this.defaults);
3825
3834
  for (let i in n.renderer) {
3826
3835
  if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
3827
3836
  if (["options", "parser"].includes(i)) continue;
3828
- let o = i, u = n.renderer[o], a = r[o];
3829
- r[o] = (...c) => {
3830
- let p = u.apply(r, c);
3831
- return p === false && (p = a.apply(r, c)), p || "";
3837
+ let o = i, p = n.renderer[o], a = r[o];
3838
+ r[o] = (...u) => {
3839
+ let c = p.apply(r, u);
3840
+ return c === false && (c = a.apply(r, u)), c || "";
3832
3841
  };
3833
3842
  }
3834
3843
  s.renderer = r;
3835
3844
  }
3836
3845
  if (n.tokenizer) {
3837
- let r = this.defaults.tokenizer || new w(this.defaults);
3846
+ let r = this.defaults.tokenizer || new y(this.defaults);
3838
3847
  for (let i in n.tokenizer) {
3839
3848
  if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
3840
3849
  if (["options", "rules", "lexer"].includes(i)) continue;
3841
- let o = i, u = n.tokenizer[o], a = r[o];
3842
- r[o] = (...c) => {
3843
- let p = u.apply(r, c);
3844
- return p === false && (p = a.apply(r, c)), p;
3850
+ let o = i, p = n.tokenizer[o], a = r[o];
3851
+ r[o] = (...u) => {
3852
+ let c = p.apply(r, u);
3853
+ return c === false && (c = a.apply(r, u)), c;
3845
3854
  };
3846
3855
  }
3847
3856
  s.tokenizer = r;
3848
3857
  }
3849
3858
  if (n.hooks) {
3850
- let r = this.defaults.hooks || new P();
3859
+ let r = this.defaults.hooks || new S();
3851
3860
  for (let i in n.hooks) {
3852
3861
  if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
3853
3862
  if (["options", "block"].includes(i)) continue;
3854
- let o = i, u = n.hooks[o], a = r[o];
3855
- P.passThroughHooks.has(i) ? r[o] = (c) => {
3856
- if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
3857
- let k = await u.call(r, c);
3858
- return a.call(r, k);
3863
+ let o = i, p = n.hooks[o], a = r[o];
3864
+ S.passThroughHooks.has(i) ? r[o] = (u) => {
3865
+ if (this.defaults.async && S.passThroughHooksRespectAsync.has(i)) return (async () => {
3866
+ let h = await p.call(r, u);
3867
+ return a.call(r, h);
3859
3868
  })();
3860
- let p = u.call(r, c);
3861
- return a.call(r, p);
3862
- } : r[o] = (...c) => {
3869
+ let c = p.call(r, u);
3870
+ return a.call(r, c);
3871
+ } : r[o] = (...u) => {
3863
3872
  if (this.defaults.async) return (async () => {
3864
- let k = await u.apply(r, c);
3865
- return k === false && (k = await a.apply(r, c)), k;
3873
+ let h = await p.apply(r, u);
3874
+ return h === false && (h = await a.apply(r, u)), h;
3866
3875
  })();
3867
- let p = u.apply(r, c);
3868
- return p === false && (p = a.apply(r, c)), p;
3876
+ let c = p.apply(r, u);
3877
+ return c === false && (c = a.apply(r, u)), c;
3869
3878
  };
3870
3879
  }
3871
3880
  s.hooks = r;
@@ -3873,8 +3882,8 @@ var q = class {
3873
3882
  if (n.walkTokens) {
3874
3883
  let r = this.defaults.walkTokens, i = n.walkTokens;
3875
3884
  s.walkTokens = function(o) {
3876
- let u = [];
3877
- return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u;
3885
+ let p = [];
3886
+ return p.push(i.call(this, o)), r && (p = p.concat(r.call(this, o))), p;
3878
3887
  };
3879
3888
  }
3880
3889
  this.defaults = { ...this.defaults, ...s };
@@ -3896,19 +3905,19 @@ var q = class {
3896
3905
  if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
3897
3906
  if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
3898
3907
  if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
3899
- let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c;
3900
- i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens));
3901
- let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i);
3902
- return i.hooks ? await i.hooks.postprocess(h) : h;
3908
+ let p = i.hooks ? await i.hooks.preprocess(n) : n, u = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(p, i), c = i.hooks ? await i.hooks.processAllTokens(u) : u;
3909
+ i.walkTokens && await Promise.all(this.walkTokens(c, i.walkTokens));
3910
+ let d = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(c, i);
3911
+ return i.hooks ? await i.hooks.postprocess(d) : d;
3903
3912
  })().catch(o);
3904
3913
  try {
3905
3914
  i.hooks && (n = i.hooks.preprocess(n));
3906
3915
  let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
3907
3916
  i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
3908
- let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
3909
- return i.hooks && (p = i.hooks.postprocess(p)), p;
3910
- } catch (u) {
3911
- return o(u);
3917
+ let c = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
3918
+ return i.hooks && (c = i.hooks.postprocess(c)), c;
3919
+ } catch (p) {
3920
+ return o(p);
3912
3921
  }
3913
3922
  };
3914
3923
  }
@@ -3924,41 +3933,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
3924
3933
  };
3925
3934
  }
3926
3935
  };
3927
- var z = new q();
3928
- function g(l3, e) {
3929
- return z.parse(l3, e);
3936
+ var E = new Z();
3937
+ function f(l3, e) {
3938
+ return E.parse(l3, e);
3930
3939
  }
3931
- g.options = g.setOptions = function(l3) {
3932
- return z.setOptions(l3), g.defaults = z.defaults, N(g.defaults), g;
3940
+ f.options = f.setOptions = function(l3) {
3941
+ return E.setOptions(l3), f.defaults = E.defaults, j(f.defaults), f;
3933
3942
  };
3934
- g.getDefaults = M;
3935
- g.defaults = T;
3936
- g.use = function(...l3) {
3937
- return z.use(...l3), g.defaults = z.defaults, N(g.defaults), g;
3943
+ f.getDefaults = C;
3944
+ f.defaults = R;
3945
+ function kt(...l3) {
3946
+ return E.use(...l3), f.defaults = E.defaults, j(f.defaults), f;
3947
+ }
3948
+ f.use = kt;
3949
+ f.walkTokens = function(l3, e) {
3950
+ return E.walkTokens(l3, e);
3938
3951
  };
3939
- g.walkTokens = function(l3, e) {
3940
- return z.walkTokens(l3, e);
3941
- };
3942
- g.parseInline = z.parseInline;
3943
- g.Parser = b;
3944
- g.parser = b.parse;
3945
- g.Renderer = y;
3946
- g.TextRenderer = L;
3947
- g.Lexer = x;
3948
- g.lexer = x.lex;
3949
- g.Tokenizer = w;
3950
- g.Hooks = P;
3951
- g.parse = g;
3952
- var Ft = g.options;
3953
- var Ut = g.setOptions;
3954
- var Kt = g.use;
3955
- var Wt = g.walkTokens;
3956
- var Xt = g.parseInline;
3957
- var Vt = b.parse;
3958
- var Yt = x.lex;
3952
+ f.parseInline = E.parseInline;
3953
+ f.Parser = b;
3954
+ f.parser = b.parse;
3955
+ f.Renderer = P;
3956
+ f.TextRenderer = L;
3957
+ f.Lexer = x;
3958
+ f.lexer = x.lex;
3959
+ f.Tokenizer = y;
3960
+ f.Hooks = S;
3961
+ f.parse = f;
3962
+ var nn = f.options;
3963
+ var rn = f.setOptions;
3964
+ var sn = f.walkTokens;
3965
+ var on = f.parseInline;
3966
+ var ln = b.parse;
3967
+ var pn = x.lex;
3959
3968
 
3960
3969
  // src/ui/render_markdown.ts
3961
- var parser = new q({ gfm: true, breaks: true });
3970
+ var parser = new Z({ gfm: true, breaks: true });
3962
3971
  var ALLOWED_TAGS = [
3963
3972
  "a",
3964
3973
  "p",
@@ -6780,7 +6789,7 @@ var RemoteConversationStore = class {
6780
6789
  return rows.filter((row) => !this.#dropped.has(row.thread_id)).map((row) => this.#toMeta(row));
6781
6790
  }
6782
6791
  async loadMessages(threadId) {
6783
- const response = await this.#get(this.#url + encodeURIComponent(threadId) + "/");
6792
+ const response = await this.#get(`${this.#url}${encodeURIComponent(threadId)}/`);
6784
6793
  if (response === null || !response.ok) {
6785
6794
  return this.#local.loadMessages(threadId);
6786
6795
  }
@@ -6832,7 +6841,7 @@ var RemoteConversationStore = class {
6832
6841
  async #mutate(threadId, method, body) {
6833
6842
  const headers = this.#headers();
6834
6843
  try {
6835
- await fetch(this.#url + encodeURIComponent(threadId) + "/", {
6844
+ await fetch(`${this.#url}${encodeURIComponent(threadId)}/`, {
6836
6845
  method,
6837
6846
  headers: body === void 0 ? headers : { ...headers, "content-type": "application/json" },
6838
6847
  body: body === void 0 ? null : JSON.stringify(body)
@@ -7200,6 +7209,10 @@ var AgUiChat = class extends HTMLElement {
7200
7209
  // the Send⇄Stop button: `agent.isRunning` is false between frontend-tool
7201
7210
  // rounds, but the user must still be able to stop there.
7202
7211
  #running = false;
7212
+ // The page the current round's context describes, captured when that context
7213
+ // was built. `null` until the first round. Compared in `#executeTool` to
7214
+ // catch a page that moved under a round still in flight.
7215
+ #contextHref = null;
7203
7216
  // Aborting this dismisses (declines) an open confirmation card when the run
7204
7217
  // is cancelled while the card awaits a decision. One controller per card.
7205
7218
  #confirmAbort = null;
@@ -7319,7 +7332,7 @@ var AgUiChat = class extends HTMLElement {
7319
7332
  agent,
7320
7333
  handlers: this.#handlers(),
7321
7334
  getTools: () => this.getTools(),
7322
- getContext: () => this.getContext(),
7335
+ getContext: () => this.#buildContext(),
7323
7336
  executeTool: (call) => this.#executeTool(call),
7324
7337
  resolveInterrupts: (interrupts) => this.#resolveInterrupts(interrupts),
7325
7338
  connectionLostMessage: this.#strings.connectionLost
@@ -7398,7 +7411,7 @@ var AgUiChat = class extends HTMLElement {
7398
7411
  }
7399
7412
  return [
7400
7413
  {
7401
- name: "read_page",
7414
+ name: READ_PAGE_TOOL,
7402
7415
  description: "Read the current page's structure (fields, buttons, route). Call after acting to observe the result within the same turn.",
7403
7416
  parameters: {
7404
7417
  type: "object",
@@ -7939,7 +7952,59 @@ Use the read_attachment tool with an id to read a file's contents.`
7939
7952
  const checkpoint = this.conversationStore.loadCheckpoint(this.#threadId);
7940
7953
  if (checkpoint !== null) {
7941
7954
  await this.#resumeFrom(checkpoint);
7955
+ return;
7956
+ }
7957
+ this.#noticeIfRunUnfinished(messages);
7958
+ }
7959
+ /**
7960
+ * Notice a previous run that never produced a response.
7961
+ *
7962
+ * {@link AgUiClient.send} persists the user's message *before* starting the
7963
+ * run, so a transcript whose last entry is that user message means nothing
7964
+ * ever came back: the page navigated or reloaded mid-run, the tab closed, or
7965
+ * the process died. No extra persistence is needed to detect it — the shape
7966
+ * of the transcript already says so, which is why this needs no
7967
+ * {@link ClientConversationStore} method and no `pagehide` listener (neither
7968
+ * of which fires on a crash or a force-quit anyway).
7969
+ *
7970
+ * The *agent*-initiated reload is not this case: a navigating tool leaves a
7971
+ * checkpoint and resumes, which is why the caller returns early on one before
7972
+ * reaching here.
7973
+ *
7974
+ * Deliberately a notice and never a resume. AG-UI has no
7975
+ * resume-an-aborted-run primitive; re-sending the accumulated messages is
7976
+ * semantically a **new** run, so any server-side tool the agent had already
7977
+ * executed before the interruption would run a second time. Saying plainly
7978
+ * that the answer was lost is the honest option, and the user can re-ask.
7979
+ */
7980
+ /**
7981
+ * Build a round's context, recording which page it describes.
7982
+ *
7983
+ * The AG-UI client re-invokes this at the top of **every** tool round, not
7984
+ * once per `send()`, so the page map the agent sees is already refreshed
7985
+ * between rounds and the href captured here is the page it was shown for
7986
+ * *this* round. {@link #executeTool} compares against it to catch a page that
7987
+ * moved under a round still in flight.
7988
+ */
7989
+ #buildContext() {
7990
+ this.#contextHref = window.location.href;
7991
+ return this.getContext();
7992
+ }
7993
+ /**
7994
+ * Whether the page moved since the current round's context was built.
7995
+ *
7996
+ * `null` means no round has built context yet (nothing to compare), which is
7997
+ * not a move.
7998
+ */
7999
+ #pageMoved() {
8000
+ return this.#contextHref !== null && this.#contextHref !== window.location.href;
8001
+ }
8002
+ #noticeIfRunUnfinished(messages) {
8003
+ const last = messages?.at(-1);
8004
+ if (last === void 0 || last.role !== MESSAGE_ROLE.USER) {
8005
+ return;
7942
8006
  }
8007
+ this.#appendNotice("\u26A0", this.#strings.runInterrupted, "interrupted");
7943
8008
  }
7944
8009
  /**
7945
8010
  * Replay a restored message: text bubbles *and* tool activity. An assistant
@@ -8312,7 +8377,7 @@ Use the read_attachment tool with an id to read a file's contents.`
8312
8377
  agent,
8313
8378
  handlers: this.#handlers(),
8314
8379
  getTools: () => this.getTools(),
8315
- getContext: () => this.getContext(),
8380
+ getContext: () => this.#buildContext(),
8316
8381
  executeTool: (call) => this.#executeTool(call),
8317
8382
  resolveInterrupts: (interrupts) => this.#resolveInterrupts(interrupts),
8318
8383
  onPersist: (messages) => this.conversationStore.saveMessages(this.#threadId, messages),
@@ -8356,6 +8421,12 @@ Use the read_attachment tool with an id to read a file's contents.`
8356
8421
  }
8357
8422
  return null;
8358
8423
  }
8424
+ if (this.getPageMap !== null && call.name !== READ_PAGE_TOOL && !isNavigates(tool.parameters) && this.#pageMoved()) {
8425
+ const message = this.#strings.pageMoved;
8426
+ card.settle(TOOL_CALL_STATUS.ERROR, message);
8427
+ this.#showPending();
8428
+ return { content: `Error: ${message}`, error: message };
8429
+ }
8359
8430
  if (await this.#needsConfirmation(call, tool)) {
8360
8431
  const request = { toolName: call.name, args: call.args };
8361
8432
  const confirmText = tool.parameters[X_CONFIRM_KEY];
@@ -8695,7 +8766,7 @@ function setControlValue(el, value) {
8695
8766
  }
8696
8767
 
8697
8768
  // src/version.ts
8698
- var VERSION = "0.15.0";
8769
+ var VERSION = "0.16.0";
8699
8770
  export {
8700
8771
  AgUiChat,
8701
8772
  AgUiClient,