ai-chat-vue3 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-vue3-lib.es.js +1401 -0
- package/dist/ai-vue3-lib.umd.js +60 -0
- package/dist/style.css +1 -0
- package/index.html +13 -0
- package/package.json +25 -0
- package/src/App.vue +17 -0
- package/src/assets/_globals.scss +43 -0
- package/src/components/ChatPanel.vue +432 -0
- package/src/install.js +15 -0
- package/src/main.js +7 -0
- package/src/style.css +78 -0
- package/src/style.min.css +1 -0
- package/src/style.scss +81 -0
- package/vite.config.js +26 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var Bt=Object.defineProperty;var It=($,p,A)=>p in $?Bt($,p,{enumerable:!0,configurable:!0,writable:!0,value:A}):$[p]=A;var m=($,p,A)=>(It($,typeof p!="symbol"?p+"":p,A),A);(function($,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],p):($=typeof globalThis<"u"?globalThis:$||self,p($.AiVue3Lib={},$.Vue))})(this,function($,p){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 ve=(()=>{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")},Le=/^(?:[ \t]*(?:\n|$))+/,Pe=/^((?: {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+|$)/,Ie=/^ {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(),Ce=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(),De=f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ke).getRegex(),ne={blockquote:De,code:Pe,def:Me,fences:Be,heading:Ie,hr:N,html:Ze,lheading:ge,list:Ne,newline:Le,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(),Oe={...ne,lheading:Ce,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()},Ve={...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()},je=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Qe=/^(`+)([^`]|[^`][\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,xe=/[^\s\p{P}\p{S}]/u,Ge=f(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,se).getRegex(),be=/(?!~)[\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-",ve?"(?<!`)()":"(^^|[^`])").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,be).getRegex(),we="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Je=f(we,"gu").replace(/notPunctSpace/g,xe).replace(/punctSpace/g,se).replace(/punct/g,G).getRegex(),Ye=f(we,"gu").replace(/notPunctSpace/g,Ke).replace(/punctSpace/g,Fe).replace(/punct/g,be).getRegex(),et=f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,xe).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(),$e=f(/^!?\[(ref)\](?:\[\])?/).replace("ref",te).getRegex(),it=f("reflink|nolink(?!\\()","g").replace("reflink",ye).replace("nolink",$e).getRegex(),Se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,le={_backpedal:M,anyPunctuation:tt,autolink:rt,blockSkip:Ue,br:fe,code:Qe,del:M,emStrongLDelim:Xe,emStrongRDelimAst:Je,emStrongRDelimUnd:et,escape:je,link:lt,nolink:$e,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",Se).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",Se).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:Oe,pedantic:Ve},Z={normal:le,gfm:ie,breaks:ot,pedantic:at},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},Re=r=>ct[r];function E(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 _e(r){try{r=encodeURI(r).replace(y.percentDecode,"%")}catch{return null}return r}function Te(r,e){var i;let t=r.replace(y.findPipe,(a,l,h)=>{let o=!1,u=l;for(;--u>=0&&h[u]==="\\";)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 D(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
|
+
`).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:D(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=D(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:D(e[0],`
|
|
6
|
+
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=D(e[0],`
|
|
7
|
+
`).split(`
|
|
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
|
+
`),u=o.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
11
|
+
${o}`:o,n=n?`${n}
|
|
12
|
+
${u}`:u;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=k,t.length===0)break;let g=i.at(-1);if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){let c=g,b=c.raw+`
|
|
13
|
+
`+t.join(`
|
|
14
|
+
`),d=this.blockquote(b);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((g==null?void 0:g.type)==="list"){let c=g,b=c.raw+`
|
|
15
|
+
`+t.join(`
|
|
16
|
+
`),d=this.list(b);i[i.length-1]=d,s=s.substring(0,s.length-g.raw.length)+d.raw,n=n.substring(0,n.length-c.raw.length)+d.raw,t=b.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 u=!1,k="",g="";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)),b=r.split(`
|
|
19
|
+
`,1)[0],d=!c.trim(),w=0;if(this.options.pedantic?(w=2,g=c.trimStart()):d?w=e[1].length+1:(w=e[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=c.slice(w),w+=e[1].length),d&&this.rules.other.blankLine.test(b)&&(k+=b+`
|
|
20
|
+
`,r=r.substring(b.length+1),u=!0),!u){let z=this.rules.other.nextBulletRegex(w),C=this.rules.other.hrRegex(w),V=this.rules.other.fencesBeginRegex(w),j=this.rules.other.headingBeginRegex(w),v=this.rules.other.htmlBeginRegex(w);for(;r;){let q=r.split(`
|
|
21
|
+
`,1)[0],R;if(b=q,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),R=b):R=b.replace(this.rules.other.tabCharGlobal," "),V.test(b)||j.test(b)||v.test(b)||z.test(b)||C.test(b))break;if(R.search(this.rules.other.nonSpaceChar)>=w||!b.trim())g+=`
|
|
22
|
+
`+R.slice(w);else{if(d||c.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(c)||j.test(c)||C.test(c))break;g+=`
|
|
23
|
+
`+b}!d&&!b.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(g),loose:!1,text:g,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 u of a.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((t=u.tokens[0])==null?void 0:t.type)==="text"||((s=u.tokens[0])==null?void 0:s.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let k=this.rules.other.listTaskCheckbox.exec(u.raw);if(k){let g={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};u.checked=g.checked,a.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=g.raw+u.tokens[0].raw,u.tokens[0].text=g.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(g)):u.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):u.tokens.unshift(g)}}if(!a.loose){let k=u.tokens.filter(c=>c.type==="space"),g=k.length>0&&k.some(c=>this.rules.other.anyLine.test(c.raw));a.loose=g}}if(a.loose)for(let u of a.items){u.loose=!0;for(let k of u.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=Te(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(Te(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=D(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 u=[...s[0]][0].length,k=r.slice(0,n+s.index+u+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 g=k.slice(2,-2);return{type:"strong",raw:k,text:g,tokens:this.lexer.inlineTokens(g)}}}}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}}}},_=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
|
+
`),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
|
+
`: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
|
+
`)?"":`
|
|
30
|
+
`)+l.raw,o.text+=`
|
|
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
|
+
`)?"":`
|
|
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,u=e.slice(1),k;this.options.extensions.startBlock.forEach(g=>{k=g.call({lexer:this},u),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
|
+
`)?"":`
|
|
36
|
+
`)+l.raw,o.text+=`
|
|
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
|
+
`)?"":`
|
|
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,u,k,g;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=(u=this.options.extensions)==null?void 0:u.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 b=e;if((g=this.options.extensions)!=null&&g.startInline){let d=1/0,w=e.slice(1),z;this.options.extensions.startInline.forEach(C=>{z=C.call({lexer:this},w),typeof z=="number"&&z>=0&&(d=Math.min(d,z))}),d<1/0&&d>=0&&(b=e.substring(0,d+1))}if(c=this.tokenizer.inlineText(b)){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-'+E(s)+'">'+(t?n:E(n,!0))+`</code></pre>
|
|
42
|
+
`:"<pre><code>"+(t?n:E(n,!0))+`</code></pre>
|
|
43
|
+
`}blockquote({tokens:r}){return`<blockquote>
|
|
44
|
+
${this.parser.parse(r)}</blockquote>
|
|
45
|
+
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
46
|
+
`}hr(r){return`<hr>
|
|
47
|
+
`}list(r){let e=r.ordered,t=r.start,s="";for(let a=0;a<r.items.length;a++){let l=r.items[a];s+=this.listitem(l)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
|
|
48
|
+
`+s+"</"+n+`>
|
|
49
|
+
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
|
|
50
|
+
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
51
|
+
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
52
|
+
<thead>
|
|
53
|
+
`+e+`</thead>
|
|
54
|
+
`+s+`</table>
|
|
55
|
+
`}tablerow({text:r}){return`<tr>
|
|
56
|
+
${r}</tr>
|
|
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>${E(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=_e(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+E(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=_e(r);if(n===null)return E(t);r=n;let i=`<img src="${r}" alt="${t}"`;return e&&(i+=` title="${E(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:E(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}},T=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}},O=(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?_.lex:_.lexInline}provideParser(){return this.block?T.parse:T.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",T);m(this,"Renderer",X);m(this,"TextRenderer",ae);m(this,"Lexer",_);m(this,"Tokenizer",U);m(this,"Hooks",O);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 u=l.apply(n,o);return u===!1&&(u=h.apply(n,o)),u||""}}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 u=l.apply(n,o);return u===!1&&(u=h.apply(n,o)),u}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new O;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];O.passThroughHooks.has(i)?n[a]=o=>{if(this.defaults.async&&O.passThroughHooksRespectAsync.has(i))return(async()=>{let k=await l.call(n,o);return h.call(n,k)})();let u=l.call(n,o);return h.call(n,u)}: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 u=l.apply(n,o);return u===!1&&(u=h.apply(n,o)),u}}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 _.lex(r,e??this.defaults)}parser(r,e){return T.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?_.lex:_.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?T.parse:T.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?_.lex:_.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?T.parse:T.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>"+E(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},I=new ut;function x(r,e){return I.parse(r,e)}x.options=x.setOptions=function(r){return I.setOptions(r),x.defaults=I.defaults,pe(x.defaults),x},x.getDefaults=A,x.defaults=B,x.use=function(...r){return I.use(...r),x.defaults=I.defaults,pe(x.defaults),x},x.walkTokens=function(r,e){return I.walkTokens(r,e)},x.parseInline=I.parseInline,x.Parser=T,x.parser=T.parse,x.Renderer=X,x.TextRenderer=ae,x.Lexer=_,x.lexer=_.lex,x.Tokenizer=U,x.Hooks=O,x.parse=x,x.options,x.setOptions,x.use,x.walkTokens,x.parseInline,T.parse,_.lex;const Ct="",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"],xt={class:"bubble"},bt={key:0,class:"loading"},mt={class:"toolbar"},wt={class:"input"},yt=["disabled","onKeydown"],$t=["disabled"],St="向大模型提问,例:帮我起一个智能助手的名字。",Rt=gt({__name:"ChatPanel",setup(r){const e=p.ref(""),t=p.ref([]),s=p.ref(!1),n=p.ref(null),i=p.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 x(k||"")}catch(g){return console.error("Markdown解析失败:",g),k||""}},h=()=>{p.nextTick(()=>{const k=n.value;if(k){const g=document.createElement("div");k.appendChild(g),g.scrollIntoView({behavior:"smooth",block:"center"}),k.removeChild(g)}})};p.watch(t,h,{deep:!0,immediate:!0});const o=async k=>{var g,c,b,d,w,z,C,V,j;s.value=!0;try{let v={"Content-Type":"application/json"};const q=a[i.value].apiKey;i.value==="glm-4.6v-flash"||i.value==="doubao-seed-1-8-251215"?v.Authorization=`Bearer ${q}`:v["api-key"]=q;const R=await fetch(a[i.value].apiUrl,{method:"POST",headers:v,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 S=t.value.length;t.value.push({role:"system",content:""});const oe=new TextDecoder,At=R.body.getReader();let Q="";for(;;){const{done:Et,value:vt}=await At.read();if(Et)break;const Lt=oe.decode(vt,{stream:!0}).split(`
|
|
60
|
+
`);for(const Pt of Lt){const J=Pt.trim();if(J.startsWith("data:")){const L=J.substring(5).trim();if(L==="[DONE]")break;try{const P=JSON.parse(L),Ee=((b=(c=(g=P==null?void 0:P.choices)==null?void 0:g[0])==null?void 0:c.delta)==null?void 0:b.content)||"";Ee&&(Q+=Ee,t.value[S].content=Q,h())}catch(P){console.error("解析流式数据失败:",P)}}else if(J)try{const L=JSON.parse(J),P=((z=(w=(d=L==null?void 0:L.choices)==null?void 0:d[0])==null?void 0:w.delta)==null?void 0:z.content)||"";P&&(Q+=P,t.value[S].content=Q,h())}catch(L){console.error("解析非SSE流式数据失败:",L)}}}Q||(t.value[S].content="(流式响应未返回有效内容)")}else{const S=await R.json(),oe=((j=(V=(C=S==null?void 0:S.choices)==null?void 0:C[0])==null?void 0:V.message)==null?void 0:j.content)||(S==null?void 0:S.reply)||(S==null?void 0:S.message)||"(接口未返回有效内容)";t.value.push({role:"system",content:oe})}}catch(v){t.value.push({role:"system",content:`调用模型失败:${v.message||v}`})}finally{s.value=!1}},u=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,g)=>(p.openBlock(),p.createElementBlock("section",kt,[p.createElementVNode("div",{class:"messages",ref_key:"messageList",ref:n},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(t.value,(c,b)=>(p.openBlock(),p.createElementBlock("div",{key:b,class:p.normalizeClass(["message",c.role==="user"?"user-message":"system-message"])},[c.role==="system"?(p.openBlock(),p.createElementBlock(p.Fragment,{key:0},[p.createElementVNode("div",{class:p.normalizeClass(["avatar","system"])},"AI"),p.createElementVNode("div",dt,[p.createElementVNode("div",{innerHTML:l(c.content)},null,8,ft)])],64)):(p.openBlock(),p.createElementBlock(p.Fragment,{key:1},[p.createElementVNode("div",xt,p.toDisplayString(c.content),1),p.createElementVNode("div",{class:p.normalizeClass(["avatar","user"])},"我")],64))],2))),128)),s.value?(p.openBlock(),p.createElementBlock("div",bt,"AI 正在思考...")):p.createCommentVNode("",!0)],512),p.createElementVNode("div",mt,[p.createElementVNode("div",wt,[p.withDirectives(p.createElementVNode("textarea",{"onUpdate:modelValue":g[0]||(g[0]=c=>e.value=c),class:"prompt-input",placeholder:St,disabled:s.value,onKeydown:p.withKeys(p.withModifiers(u,["exact","prevent"]),["enter"])},null,40,yt),[[p.vModelText,e.value]]),p.createElementVNode("button",{class:"send-btn",disabled:s.value||!e.value.trim(),onClick:u},p.toDisplayString(s.value?"等待中…":"发送"),9,$t)])])]))}},[["__scopeId","data-v-ecd3c21e"]]),_t={class:"page"},Ae={__name:"App",setup(r){return(e,t)=>(p.openBlock(),p.createElementBlock("div",_t,[t[0]||(t[0]=p.createElementVNode("div",{class:"card"},[p.createElementVNode("header",{style:{padding:"22px 20px 8px"}},[p.createElementVNode("h1",{class:"title"},"大模型对话 Demo"),p.createElementVNode("p",{class:"subtitle"}," 早上好,用户806979 ")])],-1)),p.createVNode(Rt)]))}},Tt=[Ae],zt={install(r){Tt.forEach(e=>{r.component(e.name,e)})}};$.appMain=Ae,$.default=zt,Object.defineProperties($,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";[data-v-ecd3c21e] h1,[data-v-ecd3c21e] h2,[data-v-ecd3c21e] h3,[data-v-ecd3c21e] h4,[data-v-ecd3c21e] h5,[data-v-ecd3c21e] h6{color:#d0e0ff;margin:20px 0 8px;font-weight:600}[data-v-ecd3c21e] p{margin:8px 0}[data-v-ecd3c21e] code{background:rgba(255,255,255,.1);padding:4px 8px;border-radius:4px;font-family:Consolas,Monaco,monospace}[data-v-ecd3c21e] 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-ecd3c21e] pre code{background:transparent;padding:0}[data-v-ecd3c21e] blockquote{border-left:3px solid rgba(92,161,255,.5);margin:8px 0;padding:0 20px;color:#b0c8f8}[data-v-ecd3c21e] ul,[data-v-ecd3c21e] ol{margin:8px 0;padding-left:24px}[data-v-ecd3c21e] li{margin:4px 0}[data-v-ecd3c21e] a{color:#5ca1ff;text-decoration:none}[data-v-ecd3c21e] a:hover{text-decoration:underline}.chat-container[data-v-ecd3c21e]{display:grid;grid-template-rows:1fr auto;gap:12px;padding:20px}.chat-container .messages[data-v-ecd3c21e]{overflow-y:auto;padding-right:6px}.chat-container .messages .message[data-v-ecd3c21e]{display:grid;gap:12px;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.04)}.chat-container .messages .message.system-message[data-v-ecd3c21e]{grid-template-columns:60px 1fr}.chat-container .messages .message.user-message[data-v-ecd3c21e]{grid-template-columns:1fr 60px;justify-items:end}.chat-container .messages .message.user-message .bubble[data-v-ecd3c21e]{text-align:right;max-width:906px}.chat-container .messages .message .avatar[data-v-ecd3c21e]{height:44px;width:44px;display:grid;place-items:center;border-radius:12px;font-weight:700}.chat-container .messages .message .avatar.user[data-v-ecd3c21e]{background:linear-gradient(135deg,#3557ff,#4db8ff);color:#fff}.chat-container .messages .message .avatar.system[data-v-ecd3c21e]{background:linear-gradient(135deg,#4ac29a,#2c9b7d);color:#0c221a}.chat-container .messages .message .bubble[data-v-ecd3c21e]{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-ecd3c21e]{color:#8fb1ff;font-size:14px;display:flex;align-items:center;gap:8px}.chat-container .messages .loading[data-v-ecd3c21e]: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-ecd3c21e]{padding:8px;position:fixed;bottom:0;left:50%;transform:translate(-50%);width:100%;min-width:600px;height:88px;background:#0b1220}.toolbar .input[data-v-ecd3c21e]{display:flex;gap:8px;align-items:stretch;width:1100px;margin:auto}.toolbar .input .prompt-input[data-v-ecd3c21e]{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-ecd3c21e]:focus{border-color:#5ca1ff;box-shadow:0 0 0 2px #5ca1ff40}.toolbar .send-btn[data-v-ecd3c21e]{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-ecd3c21e]:disabled{opacity:.5;cursor:not-allowed}.toolbar .send-btn[data-v-ecd3c21e]:not(:disabled):hover{transform:translateY(-1px);box-shadow:0 12px 30px #52e5ff4d}
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>大模型对话 Demo</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.js"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
13
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-chat-vue3",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "基于Vue3的AI聊天应用",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/ai-vue3-lib.umd.js",
|
|
7
|
+
"module": "dist/ai-vue3-lib.es.js",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"preview": "vite preview"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"marked": "^17.0.1",
|
|
18
|
+
"vue": "^3.4.21"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
22
|
+
"sass": "^1.97.1",
|
|
23
|
+
"vite": "^4.5.3"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/App.vue
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="page">
|
|
3
|
+
<div class="card">
|
|
4
|
+
<header style="padding: 22px 20px 8px">
|
|
5
|
+
<h1 class="title">大模型对话 Demo</h1>
|
|
6
|
+
<p class="subtitle">
|
|
7
|
+
早上好,用户806979
|
|
8
|
+
</p>
|
|
9
|
+
</header>
|
|
10
|
+
</div>
|
|
11
|
+
<ChatPanel />
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import ChatPanel from './components/ChatPanel.vue';
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// 全局SCSS变量定义
|
|
2
|
+
|
|
3
|
+
// 主题色彩
|
|
4
|
+
$primary-color: #5ca1ff;
|
|
5
|
+
$secondary-color: #4ac29a;
|
|
6
|
+
$accent-color: #52e5ff;
|
|
7
|
+
|
|
8
|
+
// 背景相关
|
|
9
|
+
$background-color: #0b1220;
|
|
10
|
+
$background-gradient: radial-gradient(circle at 20% 20%, #14233d, #0b1220 60%),
|
|
11
|
+
radial-gradient(circle at 80% 10%, #1f2f4f, #0b1220 40%),
|
|
12
|
+
#0b1220;
|
|
13
|
+
|
|
14
|
+
// 文本颜色
|
|
15
|
+
$text-primary: #f7f7f7;
|
|
16
|
+
$text-secondary: #d0e0ff;
|
|
17
|
+
$text-tertiary: #89a5d6;
|
|
18
|
+
$text-message: #e9f0ff;
|
|
19
|
+
$text-link: #5ca1ff;
|
|
20
|
+
|
|
21
|
+
// 透明度白色
|
|
22
|
+
$white-trans-05: rgba(255, 255, 255, 0.05);
|
|
23
|
+
$white-trans-08: rgba(255, 255, 255, 0.08);
|
|
24
|
+
$white-trans-15: rgba(255, 255, 255, 0.15);
|
|
25
|
+
|
|
26
|
+
// 尺寸相关
|
|
27
|
+
$message-width: 1100px;
|
|
28
|
+
$border-radius: 14px;
|
|
29
|
+
$border-radius-small: 12px;
|
|
30
|
+
$border-radius-round: 50%;
|
|
31
|
+
|
|
32
|
+
// 阴影
|
|
33
|
+
$shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
34
|
+
$shadow-md: 0 12px 30px rgba(82, 229, 255, 0.3);
|
|
35
|
+
$shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.35);
|
|
36
|
+
|
|
37
|
+
// 间距
|
|
38
|
+
$spacing-xs: 4px;
|
|
39
|
+
$spacing-sm: 8px;
|
|
40
|
+
$spacing-md: 12px;
|
|
41
|
+
$spacing-lg: 16px;
|
|
42
|
+
$spacing-xl: 20px;
|
|
43
|
+
$spacing-xxl: 32px;
|