ai-chat-vue3 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/ai-vue3-lib.es.js +117 -128
- package/dist/ai-vue3-lib.umd.js +26 -26
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/src/App.vue +4 -3
- package/src/components/ChatPanel.vue +17 -0
- package/src/install.js +4 -3
- package/src/main.js +3 -2
- package/src/style.css +1 -2
- package/src/style.min.css +1 -1
- package/src/style.scss +1 -1
package/README.md
ADDED
package/dist/ai-vue3-lib.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (r, e, t) => (
|
|
4
|
-
import { ref as
|
|
1
|
+
var Oe = Object.defineProperty;
|
|
2
|
+
var De = (r, e, t) => e in r ? Oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var b = (r, e, t) => (De(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { ref as D, watch as Ne, openBlock as B, createElementBlock as q, createElementVNode as T, Fragment as te, renderList as Qe, normalizeClass as re, toDisplayString as fe, createCommentVNode as je, withDirectives as He, withKeys as Ge, withModifiers as Ke, vModelText as Ue, nextTick as Fe } from "vue";
|
|
5
5
|
function ie() {
|
|
6
6
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var C = ie();
|
|
9
9
|
function Se(r) {
|
|
10
|
-
|
|
10
|
+
C = r;
|
|
11
11
|
}
|
|
12
12
|
var H = { exec: () => null };
|
|
13
13
|
function d(r, e = "") {
|
|
@@ -17,15 +17,15 @@ function d(r, e = "") {
|
|
|
17
17
|
}, getRegex: () => new RegExp(t, e) };
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var Xe = (() => {
|
|
21
21
|
try {
|
|
22
22
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
23
23
|
} catch {
|
|
24
24
|
return !1;
|
|
25
25
|
}
|
|
26
|
-
})(), w = { 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, listReplaceTabs: /^\t+/, 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, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i") }, We = /^(?:[ \t]*(?:\n|$))+/,
|
|
27
|
-
]`).replace("lheading", ve).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() },
|
|
28
|
-
function
|
|
26
|
+
})(), w = { 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, listReplaceTabs: /^\t+/, 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, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i") }, We = /^(?:[ \t]*(?:\n|$))+/, Ve = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Je = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ae = /(?:[*+-]|\d{1,9}[.)])/, Re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ve = d(Re).replace(/bull/g, ae).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(), et = d(Re).replace(/bull/g, ae).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(), oe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, tt = /^[^\n]+/, ce = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, rt = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ce).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), st = d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ae).getRegex(), J = "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", he = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, nt = 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", he).replace("tag", J).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Te = d(oe).replace("hr", G).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex(), lt = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Te).getRegex(), pe = { blockquote: lt, code: Ve, def: rt, fences: Je, heading: Ye, hr: G, html: nt, lheading: ve, list: st, newline: We, paragraph: Te, table: H, text: tt }, xe = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex(), it = { ...pe, lheading: et, table: xe, paragraph: d(oe).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", xe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex() }, at = { ...pe, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", he).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: H, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(oe).replace("hr", G).replace("heading", ` *#{1,6} *[^
|
|
27
|
+
]`).replace("lheading", ve).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, ot = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ct = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _e = /^( {2,}|\\)\n(?!\s*$)/, ht = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Y = /[\p{P}\p{S}]/u, ue = /[\s\p{P}\p{S}]/u, ze = /[^\s\p{P}\p{S}]/u, pt = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ue).getRegex(), Ae = /(?!~)[\p{P}\p{S}]/u, ut = /(?!~)[\s\p{P}\p{S}]/u, gt = /(?:[^\s\p{P}\p{S}]|~)/u, kt = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Xe ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Le = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, dt = d(Le, "u").replace(/punct/g, Y).getRegex(), ft = d(Le, "u").replace(/punct/g, Ae).getRegex(), Pe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", xt = d(Pe, "gu").replace(/notPunctSpace/g, ze).replace(/punctSpace/g, ue).replace(/punct/g, Y).getRegex(), bt = d(Pe, "gu").replace(/notPunctSpace/g, gt).replace(/punctSpace/g, ut).replace(/punct/g, Ae).getRegex(), mt = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ze).replace(/punctSpace/g, ue).replace(/punct/g, Y).getRegex(), wt = d(/\\(punct)/, "gu").replace(/punct/g, Y).getRegex(), yt = 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(), $t = d(he).replace("(?:-->|$)", "-->").getRegex(), St = 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", $t).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), X = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Rt = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", X).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ie = d(/^!?\[(label)\]\[(ref)\]/).replace("label", X).replace("ref", ce).getRegex(), Ce = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", ce).getRegex(), vt = d("reflink|nolink(?!\\()", "g").replace("reflink", Ie).replace("nolink", Ce).getRegex(), be = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, ge = { _backpedal: H, anyPunctuation: wt, autolink: yt, blockSkip: kt, br: _e, code: ct, del: H, emStrongLDelim: dt, emStrongRDelimAst: xt, emStrongRDelimUnd: mt, escape: ot, link: Rt, nolink: Ce, punctuation: pt, reflink: Ie, reflinkSearch: vt, tag: St, text: ht, url: H }, Tt = { ...ge, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", X).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", X).getRegex() }, se = { ...ge, emStrongRDelimAst: bt, emStrongLDelim: ft, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", be).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", be).getRegex() }, _t = { ...se, br: d(_e).replace("{2,}", "*").getRegex(), text: d(se.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, U = { normal: pe, gfm: it, pedantic: at }, N = { normal: ge, gfm: se, breaks: _t, pedantic: Tt }, zt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, me = (r) => zt[r];
|
|
28
|
+
function _(r, e) {
|
|
29
29
|
if (e) {
|
|
30
30
|
if (w.escapeTest.test(r))
|
|
31
31
|
return r.replace(w.escapeReplace, me);
|
|
@@ -75,7 +75,7 @@ function Q(r, e, t) {
|
|
|
75
75
|
}
|
|
76
76
|
return r.slice(0, n - s);
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function At(r, e) {
|
|
79
79
|
if (r.indexOf(e[1]) === -1)
|
|
80
80
|
return -1;
|
|
81
81
|
let t = 0;
|
|
@@ -94,7 +94,7 @@ function $e(r, e, t, n, s) {
|
|
|
94
94
|
let h = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: a, text: l, tokens: n.inlineTokens(l) };
|
|
95
95
|
return n.state.inLink = !1, h;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Lt(r, e, t) {
|
|
98
98
|
let n = r.match(t.other.indentCodeCompensation);
|
|
99
99
|
if (n === null)
|
|
100
100
|
return e;
|
|
@@ -109,12 +109,12 @@ function Pt(r, e, t) {
|
|
|
109
109
|
}).join(`
|
|
110
110
|
`);
|
|
111
111
|
}
|
|
112
|
-
var
|
|
112
|
+
var W = class {
|
|
113
113
|
constructor(r) {
|
|
114
114
|
b(this, "options");
|
|
115
115
|
b(this, "rules");
|
|
116
116
|
b(this, "lexer");
|
|
117
|
-
this.options = r ||
|
|
117
|
+
this.options = r || C;
|
|
118
118
|
}
|
|
119
119
|
space(r) {
|
|
120
120
|
let e = this.rules.block.newline.exec(r);
|
|
@@ -132,7 +132,7 @@ var V = class {
|
|
|
132
132
|
fences(r) {
|
|
133
133
|
let e = this.rules.block.fences.exec(r);
|
|
134
134
|
if (e) {
|
|
135
|
-
let t = e[0], n =
|
|
135
|
+
let t = e[0], n = Lt(t, e[3] || "", this.rules);
|
|
136
136
|
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: n };
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -212,27 +212,27 @@ ${p}` : p;
|
|
|
212
212
|
break;
|
|
213
213
|
g = e[0], r = r.substring(g.length);
|
|
214
214
|
let c = e[2].split(`
|
|
215
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
215
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (S) => " ".repeat(3 * S.length)), f = r.split(`
|
|
216
216
|
`, 1)[0], k = !c.trim(), m = 0;
|
|
217
217
|
if (this.options.pedantic ? (m = 2, u = c.trimStart()) : k ? m = e[1].length + 1 : (m = e[2].search(this.rules.other.nonSpaceChar), m = m > 4 ? 1 : m, u = c.slice(m), m += e[1].length), k && this.rules.other.blankLine.test(f) && (g += f + `
|
|
218
218
|
`, r = r.substring(f.length + 1), p = !0), !p) {
|
|
219
|
-
let
|
|
219
|
+
let S = this.rules.other.nextBulletRegex(m), P = this.rules.other.hrRegex(m), M = this.rules.other.fencesBeginRegex(m), Z = this.rules.other.headingBeginRegex(m), z = this.rules.other.htmlBeginRegex(m);
|
|
220
220
|
for (; r; ) {
|
|
221
|
-
let
|
|
222
|
-
`, 1)[0],
|
|
223
|
-
if (f =
|
|
221
|
+
let E = r.split(`
|
|
222
|
+
`, 1)[0], $;
|
|
223
|
+
if (f = E, this.options.pedantic ? (f = f.replace(this.rules.other.listReplaceNesting, " "), $ = f) : $ = f.replace(this.rules.other.tabCharGlobal, " "), M.test(f) || Z.test(f) || z.test(f) || S.test(f) || P.test(f))
|
|
224
224
|
break;
|
|
225
|
-
if (
|
|
225
|
+
if ($.search(this.rules.other.nonSpaceChar) >= m || !f.trim())
|
|
226
226
|
u += `
|
|
227
|
-
` +
|
|
227
|
+
` + $.slice(m);
|
|
228
228
|
else {
|
|
229
229
|
if (k || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || M.test(c) || Z.test(c) || P.test(c))
|
|
230
230
|
break;
|
|
231
231
|
u += `
|
|
232
232
|
` + f;
|
|
233
233
|
}
|
|
234
|
-
!k && !f.trim() && (k = !0), g +=
|
|
235
|
-
`, r = r.substring(
|
|
234
|
+
!k && !f.trim() && (k = !0), g += E + `
|
|
235
|
+
`, r = r.substring(E.length + 1), c = $.slice(m);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
a.loose || (h ? a.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (h = !0)), a.items.push({ type: "list_item", raw: g, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), a.raw += g;
|
|
@@ -341,7 +341,7 @@ ${p}` : p;
|
|
|
341
341
|
if ((t.length - i.length) % 2 === 0)
|
|
342
342
|
return;
|
|
343
343
|
} else {
|
|
344
|
-
let i =
|
|
344
|
+
let i = At(e[2], "()");
|
|
345
345
|
if (i === -2)
|
|
346
346
|
return;
|
|
347
347
|
if (i > -1) {
|
|
@@ -444,14 +444,14 @@ ${p}` : p;
|
|
|
444
444
|
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
},
|
|
447
|
+
}, R = class ne {
|
|
448
448
|
constructor(e) {
|
|
449
449
|
b(this, "tokens");
|
|
450
450
|
b(this, "options");
|
|
451
451
|
b(this, "state");
|
|
452
452
|
b(this, "inlineQueue");
|
|
453
453
|
b(this, "tokenizer");
|
|
454
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
454
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || C, 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: !1, inRawBlock: !1, top: !0 };
|
|
455
455
|
let t = { other: w, block: U.normal, inline: N.normal };
|
|
456
456
|
this.options.pedantic ? (t.block = U.pedantic, t.inline = N.pedantic) : this.options.gfm && (t.block = U.gfm, this.options.breaks ? t.inline = N.breaks : t.inline = N.gfm), this.tokenizer.rules = t;
|
|
457
457
|
}
|
|
@@ -639,9 +639,9 @@ ${p}` : p;
|
|
|
639
639
|
}
|
|
640
640
|
let f = e;
|
|
641
641
|
if ((u = this.options.extensions) != null && u.startInline) {
|
|
642
|
-
let k = 1 / 0, m = e.slice(1),
|
|
642
|
+
let k = 1 / 0, m = e.slice(1), S;
|
|
643
643
|
this.options.extensions.startInline.forEach((P) => {
|
|
644
|
-
|
|
644
|
+
S = P.call({ lexer: this }, m), typeof S == "number" && S >= 0 && (k = Math.min(k, S));
|
|
645
645
|
}), k < 1 / 0 && k >= 0 && (f = e.substring(0, k + 1));
|
|
646
646
|
}
|
|
647
647
|
if (c = this.tokenizer.inlineText(f)) {
|
|
@@ -661,11 +661,11 @@ ${p}` : p;
|
|
|
661
661
|
}
|
|
662
662
|
return t;
|
|
663
663
|
}
|
|
664
|
-
},
|
|
664
|
+
}, V = class {
|
|
665
665
|
constructor(r) {
|
|
666
666
|
b(this, "options");
|
|
667
667
|
b(this, "parser");
|
|
668
|
-
this.options = r ||
|
|
668
|
+
this.options = r || C;
|
|
669
669
|
}
|
|
670
670
|
space(r) {
|
|
671
671
|
return "";
|
|
@@ -674,8 +674,8 @@ ${p}` : p;
|
|
|
674
674
|
var i;
|
|
675
675
|
let n = (i = (e || "").match(w.notSpaceStart)) == null ? void 0 : i[0], s = r.replace(w.endingNewline, "") + `
|
|
676
676
|
`;
|
|
677
|
-
return n ? '<pre><code class="language-' +
|
|
678
|
-
` : "<pre><code>" + (t ? s :
|
|
677
|
+
return n ? '<pre><code class="language-' + _(n) + '">' + (t ? s : _(s, !0)) + `</code></pre>
|
|
678
|
+
` : "<pre><code>" + (t ? s : _(s, !0)) + `</code></pre>
|
|
679
679
|
`;
|
|
680
680
|
}
|
|
681
681
|
blockquote({ tokens: r }) {
|
|
@@ -755,7 +755,7 @@ ${r}</tr>
|
|
|
755
755
|
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
756
756
|
}
|
|
757
757
|
codespan({ text: r }) {
|
|
758
|
-
return `<code>${
|
|
758
|
+
return `<code>${_(r, !0)}</code>`;
|
|
759
759
|
}
|
|
760
760
|
br(r) {
|
|
761
761
|
return "<br>";
|
|
@@ -769,19 +769,19 @@ ${r}</tr>
|
|
|
769
769
|
return n;
|
|
770
770
|
r = s;
|
|
771
771
|
let i = '<a href="' + r + '"';
|
|
772
|
-
return e && (i += ' title="' +
|
|
772
|
+
return e && (i += ' title="' + _(e) + '"'), i += ">" + n + "</a>", i;
|
|
773
773
|
}
|
|
774
774
|
image({ href: r, title: e, text: t, tokens: n }) {
|
|
775
775
|
n && (t = this.parser.parseInline(n, this.parser.textRenderer));
|
|
776
776
|
let s = we(r);
|
|
777
777
|
if (s === null)
|
|
778
|
-
return
|
|
778
|
+
return _(t);
|
|
779
779
|
r = s;
|
|
780
780
|
let i = `<img src="${r}" alt="${t}"`;
|
|
781
|
-
return e && (i += ` title="${
|
|
781
|
+
return e && (i += ` title="${_(e)}"`), i += ">", i;
|
|
782
782
|
}
|
|
783
783
|
text(r) {
|
|
784
|
-
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text :
|
|
784
|
+
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : _(r.text);
|
|
785
785
|
}
|
|
786
786
|
}, ke = class {
|
|
787
787
|
strong({ text: r }) {
|
|
@@ -814,12 +814,12 @@ ${r}</tr>
|
|
|
814
814
|
checkbox({ raw: r }) {
|
|
815
815
|
return r;
|
|
816
816
|
}
|
|
817
|
-
},
|
|
817
|
+
}, v = class le {
|
|
818
818
|
constructor(e) {
|
|
819
819
|
b(this, "options");
|
|
820
820
|
b(this, "renderer");
|
|
821
821
|
b(this, "textRenderer");
|
|
822
|
-
this.options = e ||
|
|
822
|
+
this.options = e || C, this.options.renderer = this.options.renderer || new V(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ke();
|
|
823
823
|
}
|
|
824
824
|
static parse(e, t) {
|
|
825
825
|
return new le(t).parse(e);
|
|
@@ -971,7 +971,7 @@ ${r}</tr>
|
|
|
971
971
|
constructor(r) {
|
|
972
972
|
b(this, "options");
|
|
973
973
|
b(this, "block");
|
|
974
|
-
this.options = r ||
|
|
974
|
+
this.options = r || C;
|
|
975
975
|
}
|
|
976
976
|
preprocess(r) {
|
|
977
977
|
return r;
|
|
@@ -986,22 +986,22 @@ ${r}</tr>
|
|
|
986
986
|
return r;
|
|
987
987
|
}
|
|
988
988
|
provideLexer() {
|
|
989
|
-
return this.block ?
|
|
989
|
+
return this.block ? R.lex : R.lexInline;
|
|
990
990
|
}
|
|
991
991
|
provideParser() {
|
|
992
|
-
return this.block ?
|
|
992
|
+
return this.block ? v.parse : v.parseInline;
|
|
993
993
|
}
|
|
994
|
-
}, b(F, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), b(F, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), F),
|
|
994
|
+
}, b(F, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), b(F, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), F), Pt = class {
|
|
995
995
|
constructor(...r) {
|
|
996
996
|
b(this, "defaults", ie());
|
|
997
997
|
b(this, "options", this.setOptions);
|
|
998
998
|
b(this, "parse", this.parseMarkdown(!0));
|
|
999
999
|
b(this, "parseInline", this.parseMarkdown(!1));
|
|
1000
|
-
b(this, "Parser",
|
|
1001
|
-
b(this, "Renderer",
|
|
1000
|
+
b(this, "Parser", v);
|
|
1001
|
+
b(this, "Renderer", V);
|
|
1002
1002
|
b(this, "TextRenderer", ke);
|
|
1003
|
-
b(this, "Lexer",
|
|
1004
|
-
b(this, "Tokenizer",
|
|
1003
|
+
b(this, "Lexer", R);
|
|
1004
|
+
b(this, "Tokenizer", W);
|
|
1005
1005
|
b(this, "Hooks", j);
|
|
1006
1006
|
this.use(...r);
|
|
1007
1007
|
}
|
|
@@ -1056,7 +1056,7 @@ ${r}</tr>
|
|
|
1056
1056
|
}
|
|
1057
1057
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
1058
1058
|
}), n.extensions = e), t.renderer) {
|
|
1059
|
-
let s = this.defaults.renderer || new
|
|
1059
|
+
let s = this.defaults.renderer || new V(this.defaults);
|
|
1060
1060
|
for (let i in t.renderer) {
|
|
1061
1061
|
if (!(i in s))
|
|
1062
1062
|
throw new Error(`renderer '${i}' does not exist`);
|
|
@@ -1071,7 +1071,7 @@ ${r}</tr>
|
|
|
1071
1071
|
n.renderer = s;
|
|
1072
1072
|
}
|
|
1073
1073
|
if (t.tokenizer) {
|
|
1074
|
-
let s = this.defaults.tokenizer || new
|
|
1074
|
+
let s = this.defaults.tokenizer || new W(this.defaults);
|
|
1075
1075
|
for (let i in t.tokenizer) {
|
|
1076
1076
|
if (!(i in s))
|
|
1077
1077
|
throw new Error(`tokenizer '${i}' does not exist`);
|
|
@@ -1127,10 +1127,10 @@ ${r}</tr>
|
|
|
1127
1127
|
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1128
1128
|
}
|
|
1129
1129
|
lexer(r, e) {
|
|
1130
|
-
return
|
|
1130
|
+
return R.lex(r, e ?? this.defaults);
|
|
1131
1131
|
}
|
|
1132
1132
|
parser(r, e) {
|
|
1133
|
-
return
|
|
1133
|
+
return v.parse(r, e ?? this.defaults);
|
|
1134
1134
|
}
|
|
1135
1135
|
parseMarkdown(r) {
|
|
1136
1136
|
return (e, t) => {
|
|
@@ -1143,16 +1143,16 @@ ${r}</tr>
|
|
|
1143
1143
|
return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1144
1144
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = r), s.async)
|
|
1145
1145
|
return (async () => {
|
|
1146
|
-
let a = s.hooks ? await s.hooks.preprocess(e) : e, l = await (s.hooks ? await s.hooks.provideLexer() : r ?
|
|
1146
|
+
let a = s.hooks ? await s.hooks.preprocess(e) : e, l = await (s.hooks ? await s.hooks.provideLexer() : r ? R.lex : R.lexInline)(a, s), h = s.hooks ? await s.hooks.processAllTokens(l) : l;
|
|
1147
1147
|
s.walkTokens && await Promise.all(this.walkTokens(h, s.walkTokens));
|
|
1148
|
-
let o = await (s.hooks ? await s.hooks.provideParser() : r ?
|
|
1148
|
+
let o = await (s.hooks ? await s.hooks.provideParser() : r ? v.parse : v.parseInline)(h, s);
|
|
1149
1149
|
return s.hooks ? await s.hooks.postprocess(o) : o;
|
|
1150
1150
|
})().catch(i);
|
|
1151
1151
|
try {
|
|
1152
1152
|
s.hooks && (e = s.hooks.preprocess(e));
|
|
1153
|
-
let a = (s.hooks ? s.hooks.provideLexer() : r ?
|
|
1153
|
+
let a = (s.hooks ? s.hooks.provideLexer() : r ? R.lex : R.lexInline)(e, s);
|
|
1154
1154
|
s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
|
|
1155
|
-
let l = (s.hooks ? s.hooks.provideParser() : r ?
|
|
1155
|
+
let l = (s.hooks ? s.hooks.provideParser() : r ? v.parse : v.parseInline)(a, s);
|
|
1156
1156
|
return s.hooks && (l = s.hooks.postprocess(l)), l;
|
|
1157
1157
|
} catch (a) {
|
|
1158
1158
|
return i(a);
|
|
@@ -1163,7 +1163,7 @@ ${r}</tr>
|
|
|
1163
1163
|
return (t) => {
|
|
1164
1164
|
if (t.message += `
|
|
1165
1165
|
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1166
|
-
let n = "<p>An error occurred:</p><pre>" +
|
|
1166
|
+
let n = "<p>An error occurred:</p><pre>" + _(t.message + "", !0) + "</pre>";
|
|
1167
1167
|
return e ? Promise.resolve(n) : n;
|
|
1168
1168
|
}
|
|
1169
1169
|
if (e)
|
|
@@ -1171,29 +1171,29 @@ Please report this to https://github.com/markedjs/marked.`, r) {
|
|
|
1171
1171
|
throw t;
|
|
1172
1172
|
};
|
|
1173
1173
|
}
|
|
1174
|
-
},
|
|
1174
|
+
}, I = new Pt();
|
|
1175
1175
|
function x(r, e) {
|
|
1176
|
-
return
|
|
1176
|
+
return I.parse(r, e);
|
|
1177
1177
|
}
|
|
1178
1178
|
x.options = x.setOptions = function(r) {
|
|
1179
|
-
return
|
|
1179
|
+
return I.setOptions(r), x.defaults = I.defaults, Se(x.defaults), x;
|
|
1180
1180
|
};
|
|
1181
1181
|
x.getDefaults = ie;
|
|
1182
|
-
x.defaults =
|
|
1182
|
+
x.defaults = C;
|
|
1183
1183
|
x.use = function(...r) {
|
|
1184
|
-
return
|
|
1184
|
+
return I.use(...r), x.defaults = I.defaults, Se(x.defaults), x;
|
|
1185
1185
|
};
|
|
1186
1186
|
x.walkTokens = function(r, e) {
|
|
1187
|
-
return
|
|
1187
|
+
return I.walkTokens(r, e);
|
|
1188
1188
|
};
|
|
1189
|
-
x.parseInline =
|
|
1190
|
-
x.Parser =
|
|
1191
|
-
x.parser =
|
|
1192
|
-
x.Renderer =
|
|
1189
|
+
x.parseInline = I.parseInline;
|
|
1190
|
+
x.Parser = v;
|
|
1191
|
+
x.parser = v.parse;
|
|
1192
|
+
x.Renderer = V;
|
|
1193
1193
|
x.TextRenderer = ke;
|
|
1194
|
-
x.Lexer =
|
|
1195
|
-
x.lexer =
|
|
1196
|
-
x.Tokenizer =
|
|
1194
|
+
x.Lexer = R;
|
|
1195
|
+
x.lexer = R.lex;
|
|
1196
|
+
x.Tokenizer = W;
|
|
1197
1197
|
x.Hooks = j;
|
|
1198
1198
|
x.parse = x;
|
|
1199
1199
|
x.options;
|
|
@@ -1201,20 +1201,22 @@ x.setOptions;
|
|
|
1201
1201
|
x.use;
|
|
1202
1202
|
x.walkTokens;
|
|
1203
1203
|
x.parseInline;
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1204
|
+
v.parse;
|
|
1205
|
+
R.lex;
|
|
1206
|
+
const It = (r, e) => {
|
|
1207
1207
|
const t = r.__vccOpts || r;
|
|
1208
1208
|
for (const [n, s] of e)
|
|
1209
1209
|
t[n] = s;
|
|
1210
1210
|
return t;
|
|
1211
|
-
},
|
|
1211
|
+
}, Ct = { class: "chat-container" }, Et = { class: "bubble" }, Bt = ["innerHTML"], qt = { class: "bubble" }, Mt = {
|
|
1212
1212
|
key: 0,
|
|
1213
1213
|
class: "loading"
|
|
1214
|
-
},
|
|
1214
|
+
}, Zt = { class: "toolbar" }, Ot = { class: "input" }, Dt = ["disabled", "onKeydown"], Nt = ["disabled"], Qt = "向大模型提问,例:帮我起一个智能助手的名字。", jt = /* @__PURE__ */ Object.assign({
|
|
1215
|
+
name: "chatPanel"
|
|
1216
|
+
}, {
|
|
1215
1217
|
__name: "ChatPanel",
|
|
1216
1218
|
setup(r) {
|
|
1217
|
-
const e =
|
|
1219
|
+
const e = D(""), t = D([]), n = D(!1), s = D(null), i = D("glm-4.6v-flash"), a = {
|
|
1218
1220
|
"mimo-v2-flash": {
|
|
1219
1221
|
model: "mimo-v2-flash",
|
|
1220
1222
|
name: "Mimo V2 Flash",
|
|
@@ -1250,15 +1252,15 @@ const Ct = (r, e) => {
|
|
|
1250
1252
|
};
|
|
1251
1253
|
Ne(t, h, { deep: !0, immediate: !0 });
|
|
1252
1254
|
const o = async (g) => {
|
|
1253
|
-
var u, c, f, k, m,
|
|
1255
|
+
var u, c, f, k, m, S, P, M, Z;
|
|
1254
1256
|
n.value = !0;
|
|
1255
1257
|
try {
|
|
1256
1258
|
let z = {
|
|
1257
1259
|
"Content-Type": "application/json"
|
|
1258
1260
|
};
|
|
1259
|
-
const
|
|
1260
|
-
i.value === "glm-4.6v-flash" || i.value === "doubao-seed-1-8-251215" ? z.Authorization = `Bearer ${
|
|
1261
|
-
const
|
|
1261
|
+
const E = a[i.value].apiKey;
|
|
1262
|
+
i.value === "glm-4.6v-flash" || i.value === "doubao-seed-1-8-251215" ? z.Authorization = `Bearer ${E}` : z["api-key"] = E;
|
|
1263
|
+
const $ = await fetch(a[i.value].apiUrl, {
|
|
1262
1264
|
method: "POST",
|
|
1263
1265
|
headers: z,
|
|
1264
1266
|
body: JSON.stringify({
|
|
@@ -1268,16 +1270,16 @@ const Ct = (r, e) => {
|
|
|
1268
1270
|
// 启用流式响应
|
|
1269
1271
|
})
|
|
1270
1272
|
});
|
|
1271
|
-
if (
|
|
1272
|
-
throw new Error(`LLM 接口响应异常: ${
|
|
1273
|
-
if (
|
|
1274
|
-
const
|
|
1273
|
+
if (!$.ok)
|
|
1274
|
+
throw new Error(`LLM 接口响应异常: ${$.status}`);
|
|
1275
|
+
if ($.body && typeof $.body.getReader == "function") {
|
|
1276
|
+
const y = t.value.length;
|
|
1275
1277
|
t.value.push({
|
|
1276
1278
|
role: "system",
|
|
1277
1279
|
content: ""
|
|
1278
1280
|
});
|
|
1279
|
-
const ee = new TextDecoder(), Ee =
|
|
1280
|
-
let
|
|
1281
|
+
const ee = new TextDecoder(), Ee = $.body.getReader();
|
|
1282
|
+
let O = "";
|
|
1281
1283
|
for (; ; ) {
|
|
1282
1284
|
const { done: Be, value: qe } = await Ee.read();
|
|
1283
1285
|
if (Be)
|
|
@@ -1292,22 +1294,22 @@ const Ct = (r, e) => {
|
|
|
1292
1294
|
break;
|
|
1293
1295
|
try {
|
|
1294
1296
|
const L = JSON.parse(A), de = ((f = (c = (u = L == null ? void 0 : L.choices) == null ? void 0 : u[0]) == null ? void 0 : c.delta) == null ? void 0 : f.content) || "";
|
|
1295
|
-
de && (
|
|
1297
|
+
de && (O += de, t.value[y].content = O, h());
|
|
1296
1298
|
} catch (L) {
|
|
1297
1299
|
console.error("解析流式数据失败:", L);
|
|
1298
1300
|
}
|
|
1299
1301
|
} else if (K)
|
|
1300
1302
|
try {
|
|
1301
|
-
const A = JSON.parse(K), L = ((
|
|
1302
|
-
L && (
|
|
1303
|
+
const A = JSON.parse(K), L = ((S = (m = (k = A == null ? void 0 : A.choices) == null ? void 0 : k[0]) == null ? void 0 : m.delta) == null ? void 0 : S.content) || "";
|
|
1304
|
+
L && (O += L, t.value[y].content = O, h());
|
|
1303
1305
|
} catch (A) {
|
|
1304
1306
|
console.error("解析非SSE流式数据失败:", A);
|
|
1305
1307
|
}
|
|
1306
1308
|
}
|
|
1307
1309
|
}
|
|
1308
|
-
|
|
1310
|
+
O || (t.value[y].content = "(流式响应未返回有效内容)");
|
|
1309
1311
|
} else {
|
|
1310
|
-
const
|
|
1312
|
+
const y = await $.json(), ee = ((Z = (M = (P = y == null ? void 0 : y.choices) == null ? void 0 : P[0]) == null ? void 0 : M.message) == null ? void 0 : Z.content) || (y == null ? void 0 : y.reply) || (y == null ? void 0 : y.message) || "(接口未返回有效内容)";
|
|
1311
1313
|
t.value.push({
|
|
1312
1314
|
role: "system",
|
|
1313
1315
|
content: ee
|
|
@@ -1327,75 +1329,62 @@ const Ct = (r, e) => {
|
|
|
1327
1329
|
const g = e.value.trim();
|
|
1328
1330
|
t.value.push({ role: "user", content: g }), e.value = "", await o(t.value);
|
|
1329
1331
|
};
|
|
1330
|
-
return (g, u) => (
|
|
1331
|
-
|
|
1332
|
+
return (g, u) => (B(), q("section", Ct, [
|
|
1333
|
+
T("div", {
|
|
1332
1334
|
class: "messages",
|
|
1333
1335
|
ref_key: "messageList",
|
|
1334
1336
|
ref: s
|
|
1335
1337
|
}, [
|
|
1336
|
-
(
|
|
1338
|
+
(B(!0), q(te, null, Qe(t.value, (c, f) => (B(), q("div", {
|
|
1337
1339
|
key: f,
|
|
1338
1340
|
class: re(["message", c.role === "user" ? "user-message" : "system-message"])
|
|
1339
1341
|
}, [
|
|
1340
|
-
c.role === "system" ? (
|
|
1341
|
-
|
|
1342
|
+
c.role === "system" ? (B(), q(te, { key: 0 }, [
|
|
1343
|
+
T("div", {
|
|
1342
1344
|
class: re(["avatar", "system"])
|
|
1343
1345
|
}, "AI"),
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
+
T("div", Et, [
|
|
1347
|
+
T("div", {
|
|
1346
1348
|
innerHTML: l(c.content)
|
|
1347
|
-
}, null, 8,
|
|
1349
|
+
}, null, 8, Bt)
|
|
1348
1350
|
])
|
|
1349
|
-
], 64)) : (
|
|
1350
|
-
|
|
1351
|
-
|
|
1351
|
+
], 64)) : (B(), q(te, { key: 1 }, [
|
|
1352
|
+
T("div", qt, fe(c.content), 1),
|
|
1353
|
+
T("div", {
|
|
1352
1354
|
class: re(["avatar", "user"])
|
|
1353
1355
|
}, "我")
|
|
1354
1356
|
], 64))
|
|
1355
1357
|
], 2))), 128)),
|
|
1356
|
-
n.value ? (
|
|
1358
|
+
n.value ? (B(), q("div", Mt, "AI 正在思考...")) : je("", !0)
|
|
1357
1359
|
], 512),
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
He(
|
|
1360
|
+
T("div", Zt, [
|
|
1361
|
+
T("div", Ot, [
|
|
1362
|
+
He(T("textarea", {
|
|
1361
1363
|
"onUpdate:modelValue": u[0] || (u[0] = (c) => e.value = c),
|
|
1362
1364
|
class: "prompt-input",
|
|
1363
|
-
placeholder:
|
|
1365
|
+
placeholder: Qt,
|
|
1364
1366
|
disabled: n.value,
|
|
1365
1367
|
onKeydown: Ge(Ke(p, ["exact", "prevent"]), ["enter"])
|
|
1366
|
-
}, null, 40,
|
|
1368
|
+
}, null, 40, Dt), [
|
|
1367
1369
|
[Ue, e.value]
|
|
1368
1370
|
]),
|
|
1369
|
-
|
|
1371
|
+
T("button", {
|
|
1370
1372
|
class: "send-btn",
|
|
1371
1373
|
disabled: n.value || !e.value.trim(),
|
|
1372
1374
|
onClick: p
|
|
1373
|
-
}, fe(n.value ? "等待中…" : "发送"), 9,
|
|
1375
|
+
}, fe(n.value ? "等待中…" : "发送"), 9, Nt)
|
|
1374
1376
|
])
|
|
1375
1377
|
])
|
|
1376
1378
|
]));
|
|
1377
1379
|
}
|
|
1378
|
-
},
|
|
1379
|
-
__name: "App",
|
|
1380
|
-
setup(r) {
|
|
1381
|
-
return (e, t) => (I(), C("div", Kt, [
|
|
1382
|
-
t[0] || (t[0] = y("div", { class: "card" }, [
|
|
1383
|
-
y("header", { style: { padding: "22px 20px 8px" } }, [
|
|
1384
|
-
y("h1", { class: "title" }, "大模型对话 Demo"),
|
|
1385
|
-
y("p", { class: "subtitle" }, " 早上好,用户806979 ")
|
|
1386
|
-
])
|
|
1387
|
-
], -1)),
|
|
1388
|
-
Xe(Gt)
|
|
1389
|
-
]));
|
|
1390
|
-
}
|
|
1391
|
-
}, Ft = [Ut], Jt = {
|
|
1380
|
+
}), Ht = /* @__PURE__ */ It(jt, [["__scopeId", "data-v-b0f41f88"]]), Gt = [Ht], Xt = {
|
|
1392
1381
|
install(r) {
|
|
1393
|
-
|
|
1394
|
-
r.component(e.name, e);
|
|
1382
|
+
Gt.forEach((e) => {
|
|
1383
|
+
console.log(e.name), r.component(e.name, e);
|
|
1395
1384
|
});
|
|
1396
1385
|
}
|
|
1397
1386
|
};
|
|
1398
1387
|
export {
|
|
1399
|
-
|
|
1400
|
-
|
|
1388
|
+
Ht as ChatPanel,
|
|
1389
|
+
Xt as default
|
|
1401
1390
|
};
|
package/dist/ai-vue3-lib.umd.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",ge).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
1
|
+
var Pt=Object.defineProperty;var Lt=(S,g,A)=>g in S?Pt(S,g,{enumerable:!0,configurable:!0,writable:!0,value:A}):S[g]=A;var m=(S,g,A)=>(Lt(S,typeof g!="symbol"?g+"":g,A),A);(function(S,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(S=typeof globalThis<"u"?globalThis:S||self,g(S.AiVue3Lib={},S.Vue))})(this,function(S,g){var W;"use strict";function A(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var B=A();function pe(r){B=r}var M={exec:()=>null};function f(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(y.caret,"$1"),t=t.replace(n,a),s},getRegex:()=>new RegExp(t,e)};return s}var Ee=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),y={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,listReplaceTabs:/^\t+/,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i")},Pe=/^(?:[ \t]*(?:\n|$))+/,Le=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Be=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,N=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Y=/(?:[*+-]|\d{1,9}[.)])/,ue=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ge=f(ue).replace(/bull/g,Y).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(),Ie=f(ue).replace(/bull/g,Y).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(),ee=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qe=/^[^\n]+/,te=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Me=f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",te).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ne=f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Y).getRegex(),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",re=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ze=f("^ {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",re).replace("tag",H).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ke=f(ee).replace("hr",N).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",H).getRegex(),Oe=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ke).getRegex(),ne={blockquote:Oe,code:Le,def:Me,fences:Be,heading:Ce,hr:N,html:Ze,lheading:ge,list:Ne,newline:Pe,paragraph:ke,table:M,text:qe},de=f("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",N).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",H).getRegex(),De={...ne,lheading:Ie,table:de,paragraph:f(ee).replace("hr",N).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",de).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",H).getRegex()},je={...ne,html:f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",re).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:M,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:f(ee).replace("hr",N).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",ge).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Qe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ve=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fe=/^( {2,}|\\)\n(?!\s*$)/,He=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,G=/[\p{P}\p{S}]/u,se=/[\s\p{P}\p{S}]/u,be=/[^\s\p{P}\p{S}]/u,Ge=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,se).getRegex(),xe=/(?!~)[\p{P}\p{S}]/u,Fe=/(?!~)[\s\p{P}\p{S}]/u,Ke=/(?:[^\s\p{P}\p{S}]|~)/u,Ue=f(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ee?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),me=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Xe=f(me,"u").replace(/punct/g,G).getRegex(),We=f(me,"u").replace(/punct/g,xe).getRegex(),we="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Je=f(we,"gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,se).replace(/punct/g,G).getRegex(),Ye=f(we,"gu").replace(/notPunctSpace/g,Ke).replace(/punctSpace/g,Fe).replace(/punct/g,xe).getRegex(),et=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,be).replace(/punctSpace/g,se).replace(/punct/g,G).getRegex(),tt=f(/\\(punct)/,"gu").replace(/punct/g,G).getRegex(),rt=f(/^<(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(),nt=f(re).replace("(?:-->|$)","-->").getRegex(),st=f("^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",nt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),F=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,lt=f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ye=f(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",te).getRegex(),Se=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",te).getRegex(),it=f("reflink|nolink(?!\\()","g").replace("reflink",ye).replace("nolink",Se).getRegex(),$e=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,le={_backpedal:M,anyPunctuation:tt,autolink:rt,blockSkip:Ue,br:fe,code:Ve,del:M,emStrongLDelim:Xe,emStrongRDelimAst:Je,emStrongRDelimUnd:et,escape:Qe,link:lt,nolink:Se,punctuation:Ge,reflink:ye,reflinkSearch:it,tag:st,text:He,url:M},at={...le,link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",F).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F).getRegex()},ie={...le,emStrongRDelimAst:Ye,emStrongLDelim:We,url:f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$e).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:f(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$e).getRegex()},ot={...ie,br:f(fe).replace("{2,}","*").getRegex(),text:f(ie.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K={normal:ne,gfm:De,pedantic:je},Z={normal:le,gfm:ie,breaks:ot,pedantic:at},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},Re=r=>ct[r];function v(r,e){if(e){if(y.escapeTest.test(r))return r.replace(y.escapeReplace,Re)}else if(y.escapeTestNoEncode.test(r))return r.replace(y.escapeReplaceNoEncode,Re);return r}function Te(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function _e(r,e){var i;let t=r.replace(y.findPipe,(a,l,h)=>{let o=!1,p=l;for(;--p>=0&&h[p]==="\\";)o=!o;return o?"|":" |"}),s=t.split(y.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(y.slashPipe,"|");return s}function O(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let i=r.charAt(s-n-1);if(i===e&&!t)n++;else if(i!==e&&t)n++;else break}return r.slice(0,s-n)}function ht(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function ze(r,e,t,s,n){let i=e.href,a=e.title||null,l=r[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let h={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,h}function pt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
|
|
3
3
|
`).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=n.length?i.slice(n.length):i}).join(`
|
|
4
|
-
`)}var U=class{constructor(r){m(this,"options");m(this,"rules");m(this,"lexer");this.options=r||B}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:
|
|
5
|
-
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=pt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=
|
|
6
|
-
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=
|
|
4
|
+
`)}var U=class{constructor(r){m(this,"options");m(this,"rules");m(this,"lexer");this.options=r||B}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:O(t,`
|
|
5
|
+
`)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=pt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=O(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:O(e[0],`
|
|
6
|
+
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=O(e[0],`
|
|
7
7
|
`).split(`
|
|
8
8
|
`),s="",n="",i=[];for(;t.length>0;){let a=!1,l=[],h;for(h=0;h<t.length;h++)if(this.rules.other.blockquoteStart.test(t[h]))l.push(t[h]),a=!0;else if(!a)l.push(t[h]);else break;t=t.slice(h);let o=l.join(`
|
|
9
|
-
`),
|
|
9
|
+
`),p=o.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
10
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
11
11
|
${o}`:o,n=n?`${n}
|
|
12
|
-
${
|
|
12
|
+
${p}`:p;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=k,t.length===0)break;let u=i.at(-1);if((u==null?void 0:u.type)==="code")break;if((u==null?void 0:u.type)==="blockquote"){let c=u,x=c.raw+`
|
|
13
13
|
`+t.join(`
|
|
14
|
-
`),d=this.blockquote(
|
|
14
|
+
`),d=this.blockquote(x);i[i.length-1]=d,s=s.substring(0,s.length-c.raw.length)+d.raw,n=n.substring(0,n.length-c.text.length)+d.text;break}else if((u==null?void 0:u.type)==="list"){let c=u,x=c.raw+`
|
|
15
15
|
`+t.join(`
|
|
16
|
-
`),d=this.list(
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){var t,s;let e=this.rules.block.list.exec(r);if(e){let n=e[1].trim(),i=n.length>1,a={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let l=this.rules.other.listItemRegex(n),h=!1;for(;r;){let
|
|
18
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,z=>" ".repeat(3*z.length)),
|
|
19
|
-
`,1)[0],d=!c.trim(),w=0;if(this.options.pedantic?(w=2,
|
|
20
|
-
`,r=r.substring(
|
|
21
|
-
`,1)[0],R;if(
|
|
22
|
-
`+R.slice(w);else{if(d||c.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||
|
|
23
|
-
`+
|
|
24
|
-
`,r=r.substring(q.length+1),c=R.slice(w)}}a.loose||(h?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(h=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(
|
|
25
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=
|
|
16
|
+
`),d=this.list(x);i[i.length-1]=d,s=s.substring(0,s.length-u.raw.length)+d.raw,n=n.substring(0,n.length-c.raw.length)+d.raw,t=x.substring(i.at(-1).raw.length).split(`
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){var t,s;let e=this.rules.block.list.exec(r);if(e){let n=e[1].trim(),i=n.length>1,a={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let l=this.rules.other.listItemRegex(n),h=!1;for(;r;){let p=!1,k="",u="";if(!(e=l.exec(r))||this.rules.block.hr.test(r))break;k=e[0],r=r.substring(k.length);let c=e[2].split(`
|
|
18
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,z=>" ".repeat(3*z.length)),x=r.split(`
|
|
19
|
+
`,1)[0],d=!c.trim(),w=0;if(this.options.pedantic?(w=2,u=c.trimStart()):d?w=e[1].length+1:(w=e[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,u=c.slice(w),w+=e[1].length),d&&this.rules.other.blankLine.test(x)&&(k+=x+`
|
|
20
|
+
`,r=r.substring(x.length+1),p=!0),!p){let z=this.rules.other.nextBulletRegex(w),I=this.rules.other.hrRegex(w),j=this.rules.other.fencesBeginRegex(w),Q=this.rules.other.headingBeginRegex(w),E=this.rules.other.htmlBeginRegex(w);for(;r;){let q=r.split(`
|
|
21
|
+
`,1)[0],R;if(x=q,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),R=x):R=x.replace(this.rules.other.tabCharGlobal," "),j.test(x)||Q.test(x)||E.test(x)||z.test(x)||I.test(x))break;if(R.search(this.rules.other.nonSpaceChar)>=w||!x.trim())u+=`
|
|
22
|
+
`+R.slice(w);else{if(d||c.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||j.test(c)||Q.test(c)||I.test(c))break;u+=`
|
|
23
|
+
`+x}!d&&!x.trim()&&(d=!0),k+=q+`
|
|
24
|
+
`,r=r.substring(q.length+1),c=R.slice(w)}}a.loose||(h?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(h=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),a.raw+=k}let o=a.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let p of a.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),((t=p.tokens[0])==null?void 0:t.type)==="text"||((s=p.tokens[0])==null?void 0:s.type)==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}}let k=this.rules.other.listTaskCheckbox.exec(p.raw);if(k){let u={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};p.checked=u.checked,a.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=u.raw+p.tokens[0].raw,p.tokens[0].text=u.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(u)):p.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):p.tokens.unshift(u)}}if(!a.loose){let k=p.tokens.filter(c=>c.type==="space"),u=k.length>0&&k.some(c=>this.rules.other.anyLine.test(c.raw));a.loose=u}}if(a.loose)for(let p of a.items){p.loose=!0;for(let k of p.tokens)k.type==="text"&&(k.type="paragraph")}return a}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:n}}}table(r){var a;let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=_e(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=(a=e[3])!=null&&a.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of n)i.rows.push(_e(l,i.header.length).map((h,o)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:i.align[o]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
26
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=O(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=ht(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],n=i[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),ze(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return ze(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||s[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,a,l=n,h=0,o=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(o.lastIndex=0,e=e.slice(-1*r.length+n);(s=o.exec(e))!=null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&n%3&&!((n+a)%3)){h+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+h);let p=[...s[0]][0].length,k=r.slice(0,n+s.index+p+a);if(Math.min(n,a)%2){let c=k.slice(1,-1);return{type:"em",raw:k,text:c,tokens:this.lexer.inlineTokens(c)}}let u=k.slice(2,-2);return{type:"strong",raw:k,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){let e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){var t;let e;if(e=this.rules.inline.url.exec(r)){let s,n;if(e[2]==="@")s=e[0],n="mailto:"+s;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);s=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},T=class ce{constructor(e){m(this,"tokens");m(this,"options");m(this,"state");m(this,"inlineQueue");m(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new U,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:y,block:K.normal,inline:Z.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=Z.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=Z.breaks:t.inline=Z.gfm),this.tokenizer.rules=t}static get rules(){return{block:K,inline:Z}}static lex(e,t){return new ce(t).lex(e)}static lexInline(e,t){return new ce(t).inlineTokens(e)}lex(e){e=e.replace(y.carriageReturn,`
|
|
27
27
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var n,i,a;for(this.options.pedantic&&(e=e.replace(y.tabCharGlobal," ").replace(y.spaceLine,""));e;){let l;if((i=(n=this.options.extensions)==null?void 0:n.block)!=null&&i.some(o=>(l=o.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let o=t.at(-1);l.raw.length===1&&o!==void 0?o.raw+=`
|
|
28
28
|
`:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
29
29
|
`)?"":`
|
|
@@ -31,15 +31,15 @@ ${u}`:u;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
31
31
|
`+l.text,this.inlineQueue.at(-1).src=o.text):t.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="paragraph"||(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
32
32
|
`)?"":`
|
|
33
33
|
`)+l.raw,o.text+=`
|
|
34
|
-
`+l.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},t.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if((a=this.options.extensions)!=null&&a.startBlock){let o=1/0,
|
|
34
|
+
`+l.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},t.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),t.push(l);continue}let h=e;if((a=this.options.extensions)!=null&&a.startBlock){let o=1/0,p=e.slice(1),k;this.options.extensions.startBlock.forEach(u=>{k=u.call({lexer:this},p),typeof k=="number"&&k>=0&&(o=Math.min(o,k))}),o<1/0&&o>=0&&(h=e.substring(0,o+1))}if(this.state.top&&(l=this.tokenizer.paragraph(h))){let o=t.at(-1);s&&(o==null?void 0:o.type)==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
35
35
|
`)?"":`
|
|
36
36
|
`)+l.raw,o.text+=`
|
|
37
37
|
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(l),s=h.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let o=t.at(-1);(o==null?void 0:o.type)==="text"?(o.raw+=(o.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
39
|
`)+l.raw,o.text+=`
|
|
40
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(l);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var h,o,
|
|
41
|
-
`;return s?'<pre><code class="language-'+
|
|
42
|
-
`:"<pre><code>"+(t?n:
|
|
40
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(l);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var h,o,p,k,u;let s=e,n=null;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)i=n[2]?n[2].length:0,s=s.slice(0,n.index+i)+"["+"a".repeat(n[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=((o=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:o.call({lexer:this},s))??s;let a=!1,l="";for(;e;){a||(l=""),a=!1;let c;if((k=(p=this.options.extensions)==null?void 0:p.inline)!=null&&k.some(d=>(c=d.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let d=t.at(-1);c.type==="text"&&(d==null?void 0:d.type)==="text"?(d.raw+=c.raw,d.text+=c.text):t.push(c);continue}if(c=this.tokenizer.emStrong(e,s,l)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),t.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),t.push(c);continue}let x=e;if((u=this.options.extensions)!=null&&u.startInline){let d=1/0,w=e.slice(1),z;this.options.extensions.startInline.forEach(I=>{z=I.call({lexer:this},w),typeof z=="number"&&z>=0&&(d=Math.min(d,z))}),d<1/0&&d>=0&&(x=e.substring(0,d+1))}if(c=this.tokenizer.inlineText(x)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(l=c.raw.slice(-1)),a=!0;let d=t.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=c.raw,d.text+=c.text):t.push(c);continue}if(e){let d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},X=class{constructor(r){m(this,"options");m(this,"parser");this.options=r||B}space(r){return""}code({text:r,lang:e,escaped:t}){var i;let s=(i=(e||"").match(y.notSpaceStart))==null?void 0:i[0],n=r.replace(y.endingNewline,"")+`
|
|
41
|
+
`;return s?'<pre><code class="language-'+v(s)+'">'+(t?n:v(n,!0))+`</code></pre>
|
|
42
|
+
`:"<pre><code>"+(t?n:v(n,!0))+`</code></pre>
|
|
43
43
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
44
44
|
${this.parser.parse(r)}</blockquote>
|
|
45
45
|
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
@@ -55,6 +55,6 @@ ${this.parser.parse(r)}</blockquote>
|
|
|
55
55
|
`}tablerow({text:r}){return`<tr>
|
|
56
56
|
${r}</tr>
|
|
57
57
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
58
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${
|
|
59
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+
|
|
60
|
-
`);for(const
|
|
58
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${v(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=Te(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+v(e)+'"'),i+=">"+s+"</a>",i}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=Te(r);if(n===null)return v(t);r=n;let i=`<img src="${r}" alt="${t}"`;return e&&(i+=` title="${v(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:v(r.text)}},ae=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},_=class he{constructor(e){m(this,"options");m(this,"renderer");m(this,"textRenderer");this.options=e||B,this.options.renderer=this.options.renderer||new X,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ae}static parse(e,t){return new he(t).parse(e)}static parseInline(e,t){return new he(t).parseInline(e)}parse(e){var s,n;let t="";for(let i=0;i<e.length;i++){let a=e[i];if((n=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&n[a.type]){let h=a,o=this.options.extensions.renderers[h.type].call({parser:this},h);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){t+=o||"";continue}}let l=a;switch(l.type){case"space":{t+=this.renderer.space(l);break}case"hr":{t+=this.renderer.hr(l);break}case"heading":{t+=this.renderer.heading(l);break}case"code":{t+=this.renderer.code(l);break}case"table":{t+=this.renderer.table(l);break}case"blockquote":{t+=this.renderer.blockquote(l);break}case"list":{t+=this.renderer.list(l);break}case"checkbox":{t+=this.renderer.checkbox(l);break}case"html":{t+=this.renderer.html(l);break}case"def":{t+=this.renderer.def(l);break}case"paragraph":{t+=this.renderer.paragraph(l);break}case"text":{t+=this.renderer.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return t}parseInline(e,t=this.renderer){var n,i;let s="";for(let a=0;a<e.length;a++){let l=e[a];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[l.type]){let o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){s+=o||"";continue}}let h=l;switch(h.type){case"escape":{s+=t.text(h);break}case"html":{s+=t.html(h);break}case"link":{s+=t.link(h);break}case"image":{s+=t.image(h);break}case"checkbox":{s+=t.checkbox(h);break}case"strong":{s+=t.strong(h);break}case"em":{s+=t.em(h);break}case"codespan":{s+=t.codespan(h);break}case"br":{s+=t.br(h);break}case"del":{s+=t.del(h);break}case"text":{s+=t.text(h);break}default:{let o='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},D=(W=class{constructor(r){m(this,"options");m(this,"block");this.options=r||B}preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(){return this.block?T.lex:T.lexInline}provideParser(){return this.block?_.parse:_.parseInline}},m(W,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),m(W,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),W),ut=class{constructor(...r){m(this,"defaults",A());m(this,"options",this.setOptions);m(this,"parse",this.parseMarkdown(!0));m(this,"parseInline",this.parseMarkdown(!1));m(this,"Parser",_);m(this,"Renderer",X);m(this,"TextRenderer",ae);m(this,"Lexer",T);m(this,"Tokenizer",U);m(this,"Hooks",D);this.use(...r)}walkTokens(r,e){var s,n;let t=[];for(let i of r)switch(t=t.concat(e.call(this,i)),i.type){case"table":{let a=i;for(let l of a.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of a.rows)for(let h of l)t=t.concat(this.walkTokens(h.tokens,e));break}case"list":{let a=i;t=t.concat(this.walkTokens(a.items,e));break}default:{let a=i;(n=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&n[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let h=a[l].flat(1/0);t=t.concat(this.walkTokens(h,e))}):a.tokens&&(t=t.concat(this.walkTokens(a.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new X(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=t.renderer[a],h=n[a];n[a]=(...o)=>{let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new U(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=t.tokenizer[a],h=n[a];n[a]=(...o)=>{let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new D;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=t.hooks[a],h=n[a];D.passThroughHooks.has(i)?n[a]=o=>{if(this.defaults.async&&D.passThroughHooksRespectAsync.has(i))return(async()=>{let k=await l.call(n,o);return h.call(n,k)})();let p=l.call(n,o);return h.call(n,p)}:n[a]=(...o)=>{if(this.defaults.async)return(async()=>{let k=await l.apply(n,o);return k===!1&&(k=await h.apply(n,o)),k})();let p=l.apply(n,o);return p===!1&&(p=h.apply(n,o)),p}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return T.lex(r,e??this.defaults)}parser(r,e){return _.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(e):e,l=await(n.hooks?await n.hooks.provideLexer():r?T.lex:T.lexInline)(a,n),h=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(h,n.walkTokens));let o=await(n.hooks?await n.hooks.provideParser():r?_.parse:_.parseInline)(h,n);return n.hooks?await n.hooks.postprocess(o):o})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let a=(n.hooks?n.hooks.provideLexer():r?T.lex:T.lexInline)(e,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let l=(n.hooks?n.hooks.provideParser():r?_.parse:_.parseInline)(a,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(r,e){return t=>{if(t.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+v(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},C=new ut;function b(r,e){return C.parse(r,e)}b.options=b.setOptions=function(r){return C.setOptions(r),b.defaults=C.defaults,pe(b.defaults),b},b.getDefaults=A,b.defaults=B,b.use=function(...r){return C.use(...r),b.defaults=C.defaults,pe(b.defaults),b},b.walkTokens=function(r,e){return C.walkTokens(r,e)},b.parseInline=C.parseInline,b.Parser=_,b.parser=_.parse,b.Renderer=X,b.TextRenderer=ae,b.Lexer=T,b.lexer=T.lex,b.Tokenizer=U,b.Hooks=D,b.parse=b,b.options,b.setOptions,b.use,b.walkTokens,b.parseInline,_.parse,T.lex;const Bt="",gt=(r,e)=>{const t=r.__vccOpts||r;for(const[s,n]of e)t[s]=n;return t},kt={class:"chat-container"},dt={class:"bubble"},ft=["innerHTML"],bt={class:"bubble"},xt={key:0,class:"loading"},mt={class:"toolbar"},wt={class:"input"},yt=["disabled","onKeydown"],St=["disabled"],$t="向大模型提问,例:帮我起一个智能助手的名字。",Ae=gt(Object.assign({name:"chatPanel"},{__name:"ChatPanel",setup(r){const e=g.ref(""),t=g.ref([]),s=g.ref(!1),n=g.ref(null),i=g.ref("glm-4.6v-flash"),a={"mimo-v2-flash":{model:"mimo-v2-flash",name:"Mimo V2 Flash",apiKey:"sk-cna17w0o4spxrtgp1ieaaq77u38vifffe3dpjbw1z9alrnif",apiUrl:"https://api.xiaomimimo.com/v1/chat/completions"},"doubao-seed-1-8-251215":{model:"doubao-seed-1-8-251215",name:"Doubao Seed 1.8 251215",apiKey:"e54eb32a-75ba-4190-8a4f-fc05d5d857cb",apiUrl:"https://ark.cn-beijing.volces.com/api/v3/chat/completions"},"glm-4.6v-flash":{model:"glm-4.6v-flash",name:"GLM 4.6v Flash",apiKey:"9f29ea7cbab7437bb3161d9c2adf490f.mPv5XskGyi0SqaMl",apiUrl:"https://open.bigmodel.cn/api/paas/v4/chat/completions"}},l=k=>{try{return b(k||"")}catch(u){return console.error("Markdown解析失败:",u),k||""}},h=()=>{g.nextTick(()=>{const k=n.value;if(k){const u=document.createElement("div");k.appendChild(u),u.scrollIntoView({behavior:"smooth",block:"center"}),k.removeChild(u)}})};g.watch(t,h,{deep:!0,immediate:!0});const o=async k=>{var u,c,x,d,w,z,I,j,Q;s.value=!0;try{let E={"Content-Type":"application/json"};const q=a[i.value].apiKey;i.value==="glm-4.6v-flash"||i.value==="doubao-seed-1-8-251215"?E.Authorization=`Bearer ${q}`:E["api-key"]=q;const R=await fetch(a[i.value].apiUrl,{method:"POST",headers:E,body:JSON.stringify({model:a[i.value].model,messages:k,stream:!0})});if(!R.ok)throw new Error(`LLM 接口响应异常: ${R.status}`);if(R.body&&typeof R.body.getReader=="function"){const $=t.value.length;t.value.push({role:"system",content:""});const oe=new TextDecoder,_t=R.body.getReader();let V="";for(;;){const{done:zt,value:At}=await _t.read();if(zt)break;const vt=oe.decode(At,{stream:!0}).split(`
|
|
60
|
+
`);for(const Et of vt){const J=Et.trim();if(J.startsWith("data:")){const P=J.substring(5).trim();if(P==="[DONE]")break;try{const L=JSON.parse(P),ve=((x=(c=(u=L==null?void 0:L.choices)==null?void 0:u[0])==null?void 0:c.delta)==null?void 0:x.content)||"";ve&&(V+=ve,t.value[$].content=V,h())}catch(L){console.error("解析流式数据失败:",L)}}else if(J)try{const P=JSON.parse(J),L=((z=(w=(d=P==null?void 0:P.choices)==null?void 0:d[0])==null?void 0:w.delta)==null?void 0:z.content)||"";L&&(V+=L,t.value[$].content=V,h())}catch(P){console.error("解析非SSE流式数据失败:",P)}}}V||(t.value[$].content="(流式响应未返回有效内容)")}else{const $=await R.json(),oe=((Q=(j=(I=$==null?void 0:$.choices)==null?void 0:I[0])==null?void 0:j.message)==null?void 0:Q.content)||($==null?void 0:$.reply)||($==null?void 0:$.message)||"(接口未返回有效内容)";t.value.push({role:"system",content:oe})}}catch(E){t.value.push({role:"system",content:`调用模型失败:${E.message||E}`})}finally{s.value=!1}},p=async()=>{if(!e.value.trim()||s.value)return;const k=e.value.trim();t.value.push({role:"user",content:k}),e.value="",await o(t.value)};return(k,u)=>(g.openBlock(),g.createElementBlock("section",kt,[g.createElementVNode("div",{class:"messages",ref_key:"messageList",ref:n},[(g.openBlock(!0),g.createElementBlock(g.Fragment,null,g.renderList(t.value,(c,x)=>(g.openBlock(),g.createElementBlock("div",{key:x,class:g.normalizeClass(["message",c.role==="user"?"user-message":"system-message"])},[c.role==="system"?(g.openBlock(),g.createElementBlock(g.Fragment,{key:0},[g.createElementVNode("div",{class:g.normalizeClass(["avatar","system"])},"AI"),g.createElementVNode("div",dt,[g.createElementVNode("div",{innerHTML:l(c.content)},null,8,ft)])],64)):(g.openBlock(),g.createElementBlock(g.Fragment,{key:1},[g.createElementVNode("div",bt,g.toDisplayString(c.content),1),g.createElementVNode("div",{class:g.normalizeClass(["avatar","user"])},"我")],64))],2))),128)),s.value?(g.openBlock(),g.createElementBlock("div",xt,"AI 正在思考...")):g.createCommentVNode("",!0)],512),g.createElementVNode("div",mt,[g.createElementVNode("div",wt,[g.withDirectives(g.createElementVNode("textarea",{"onUpdate:modelValue":u[0]||(u[0]=c=>e.value=c),class:"prompt-input",placeholder:$t,disabled:s.value,onKeydown:g.withKeys(g.withModifiers(p,["exact","prevent"]),["enter"])},null,40,yt),[[g.vModelText,e.value]]),g.createElementVNode("button",{class:"send-btn",disabled:s.value||!e.value.trim(),onClick:p},g.toDisplayString(s.value?"等待中…":"发送"),9,St)])])]))}}),[["__scopeId","data-v-b0f41f88"]]),Rt=[Ae],Tt={install(r){Rt.forEach(e=>{console.log(e.name),r.component(e.name,e)})}};S.ChatPanel=Ae,S.default=Tt,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";[data-v-
|
|
1
|
+
@charset "UTF-8";.chat-container[data-v-b0f41f88]:before{content:" ";position:fixed;z-index:-10;top:0;left:0;width:100%;height:100%;background-color:#0b1220;background-repeat:repeat-y}[data-v-b0f41f88] h1,[data-v-b0f41f88] h2,[data-v-b0f41f88] h3,[data-v-b0f41f88] h4,[data-v-b0f41f88] h5,[data-v-b0f41f88] h6{color:#d0e0ff;margin:20px 0 8px;font-weight:600}[data-v-b0f41f88] p{margin:8px 0}[data-v-b0f41f88] code{background:rgba(255,255,255,.1);padding:4px 8px;border-radius:4px;font-family:Consolas,Monaco,monospace}[data-v-b0f41f88] pre{background:rgba(0,0,0,.3);border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:12px;overflow-x:auto;margin:8px 0}[data-v-b0f41f88] pre code{background:transparent;padding:0}[data-v-b0f41f88] blockquote{border-left:3px solid rgba(92,161,255,.5);margin:8px 0;padding:0 20px;color:#b0c8f8}[data-v-b0f41f88] ul,[data-v-b0f41f88] ol{margin:8px 0;padding-left:24px}[data-v-b0f41f88] li{margin:4px 0}[data-v-b0f41f88] a{color:#5ca1ff;text-decoration:none}[data-v-b0f41f88] a:hover{text-decoration:underline}.chat-container[data-v-b0f41f88]{display:grid;grid-template-rows:1fr auto;gap:12px;padding:20px}.chat-container .messages[data-v-b0f41f88]{overflow-y:auto;padding-right:6px}.chat-container .messages .message[data-v-b0f41f88]{display:grid;gap:12px;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.04)}.chat-container .messages .message.system-message[data-v-b0f41f88]{grid-template-columns:60px 1fr}.chat-container .messages .message.user-message[data-v-b0f41f88]{grid-template-columns:1fr 60px;justify-items:end}.chat-container .messages .message.user-message .bubble[data-v-b0f41f88]{text-align:right;max-width:906px}.chat-container .messages .message .avatar[data-v-b0f41f88]{height:44px;width:44px;display:grid;place-items:center;border-radius:12px;font-weight:700}.chat-container .messages .message .avatar.user[data-v-b0f41f88]{background:linear-gradient(135deg,#3557ff,#4db8ff);color:#fff}.chat-container .messages .message .avatar.system[data-v-b0f41f88]{background:linear-gradient(135deg,#4ac29a,#2c9b7d);color:#0c221a}.chat-container .messages .message .bubble[data-v-b0f41f88]{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:12px 16px;color:#e9f0ff;white-space:pre-wrap;max-width:906px;box-sizing:border-box}.chat-container .messages .loading[data-v-b0f41f88]{color:#8fb1ff;font-size:14px;display:flex;align-items:center;gap:8px}.chat-container .messages .loading[data-v-b0f41f88]:after{content:"";width:10px;height:10px;border-radius:50%;border:2px solid rgba(143,177,255,.35);border-top-color:#8fb1ff;animation:spin 1s linear infinite}.toolbar[data-v-b0f41f88]{padding:8px;position:fixed;bottom:0;left:50%;transform:translate(-50%);width:100%;min-width:600px;height:88px;background:#0b1220}.toolbar .input[data-v-b0f41f88]{display:flex;gap:8px;align-items:stretch;width:1100px;margin:auto}.toolbar .input .prompt-input[data-v-b0f41f88]{width:100%;flex:1;resize:none;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.05);color:#e9f0ff;padding:12px;border-radius:12px;font-size:15px;outline:none;min-height:64px;transition:border-color .2s ease,box-shadow .2s ease}.toolbar .input .prompt-input[data-v-b0f41f88]:focus{border-color:#5ca1ff;box-shadow:0 0 0 2px #5ca1ff40}.toolbar .send-btn[data-v-b0f41f88]{min-width:110px;border:none;border-radius:12px;font-weight:700;color:#0b1220;background:linear-gradient(135deg,#5ca1ff,#52e5ff);cursor:pointer;transition:transform .15s ease,box-shadow .2s ease}.toolbar .send-btn[data-v-b0f41f88]:disabled{opacity:.5;cursor:not-allowed}.toolbar .send-btn[data-v-b0f41f88]:not(:disabled):hover{transform:translateY(-1px);box-shadow:0 12px 30px #52e5ff4d}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-chat-vue3",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "基于Vue3的AI聊天应用",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/ai-vue3-lib.umd.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"preview": "vite preview"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"ai-chat-vue3": "^0.1.1",
|
|
17
18
|
"marked": "^17.0.1",
|
|
18
19
|
"vue": "^3.4.21"
|
|
19
20
|
},
|
package/src/App.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page">
|
|
3
|
-
<div class="card">
|
|
3
|
+
<!-- <div class="card">
|
|
4
4
|
<header style="padding: 22px 20px 8px">
|
|
5
5
|
<h1 class="title">大模型对话 Demo</h1>
|
|
6
6
|
<p class="subtitle">
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
</header>
|
|
10
10
|
</div>
|
|
11
|
-
<ChatPanel />
|
|
11
|
+
<ChatPanel /> -->
|
|
12
|
+
<chatPanel />
|
|
12
13
|
</div>
|
|
13
14
|
</template>
|
|
14
15
|
|
|
15
16
|
<script setup>
|
|
16
|
-
import ChatPanel from './components/ChatPanel.vue';
|
|
17
|
+
// import ChatPanel from './components/ChatPanel.vue';
|
|
17
18
|
</script>
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
<script setup>
|
|
44
44
|
import { ref, nextTick, watch, onMounted } from 'vue';
|
|
45
45
|
import { marked } from 'marked';
|
|
46
|
+
defineOptions({
|
|
47
|
+
name: 'chatPanel'
|
|
48
|
+
})
|
|
46
49
|
|
|
47
50
|
const placeholder = '向大模型提问,例:帮我起一个智能助手的名字。';
|
|
48
51
|
const input = ref('');
|
|
@@ -231,6 +234,20 @@ const handleSubmit = async () => {
|
|
|
231
234
|
// 导入全局变量
|
|
232
235
|
@import '../assets/_globals';
|
|
233
236
|
|
|
237
|
+
.chat-container::before{
|
|
238
|
+
content: ' ';
|
|
239
|
+
position: fixed;
|
|
240
|
+
z-index: -10;
|
|
241
|
+
top: 0;
|
|
242
|
+
left: 0;
|
|
243
|
+
width: 100%;
|
|
244
|
+
height: 100%;
|
|
245
|
+
background-color: $background-color;
|
|
246
|
+
// background: url("@/static/img/statistics/004.jpg");
|
|
247
|
+
// background-size: 100% 100%;
|
|
248
|
+
background-repeat:repeat-y;
|
|
249
|
+
}
|
|
250
|
+
|
|
234
251
|
/* 为Markdown内容添加基本样式 */
|
|
235
252
|
:deep(h1), :deep(h2), :deep(h3), :deep(h4), :deep(h5), :deep(h6) {
|
|
236
253
|
color: $text-secondary;
|
package/src/install.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ChatPanel from './components/ChatPanel.vue'
|
|
2
2
|
|
|
3
3
|
// 单独导出
|
|
4
|
-
export {
|
|
4
|
+
export { ChatPanel }
|
|
5
5
|
|
|
6
6
|
// 全局注册
|
|
7
|
-
const components = [
|
|
7
|
+
const components = [ChatPanel]
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
install(app) {
|
|
11
11
|
components.forEach(component => {
|
|
12
|
+
console.log(component.name)
|
|
12
13
|
app.component(component.name, component)
|
|
13
14
|
})
|
|
14
15
|
}
|
package/src/main.js
CHANGED
package/src/style.css
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
:root {
|
|
3
3
|
font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
|
4
4
|
color: #f7f7f7;
|
|
5
|
-
background-color: #0b1220;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
* {
|
|
@@ -18,7 +17,7 @@ body {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
.page {
|
|
21
|
-
width:
|
|
20
|
+
width: 1100px;
|
|
22
21
|
margin: 0 auto;
|
|
23
22
|
padding: 32px 0 100px;
|
|
24
23
|
}
|
package/src/style.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{font-family:'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;color:#f7f7f7
|
|
1
|
+
:root{font-family:'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;color:#f7f7f7}*{box-sizing:border-box}body{margin:0}#app{min-height:100vh}.page{width:1100px;margin:0 auto;padding:32px 0 100px}.page .card{background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08);border-radius:14px;box-shadow:0 20px 60px rgba(0,0,0,0.35)}.page .card .title{color:#d0e0ff;font-weight:700;font-size:28px;letter-spacing:0.5px;margin:0 0 8px}.page .card .subtitle{color:#89a5d6;margin:0 0 20px;line-height:1.6}@keyframes spin{to{transform:rotate(360deg)}}.messages{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,0.15) rgba(255,255,255,0.03)}.messages::-webkit-scrollbar{width:6px}.messages::-webkit-scrollbar-track{background:rgba(255,255,255,0.03);border-radius:3px}.messages::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.15);border-radius:3px;transition:background 0.3s ease}.messages::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.25)}
|