ConversationQA-gROR70Ms.js 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. var vt=Object.defineProperty;var St=(c,e,t)=>e in c?vt(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;var I=(c,e,t)=>St(c,typeof e!="symbol"?e+"":e,t);import{_ as P,o as v,d as E,e as C,t as qe,c as te,f as D,h as W,l as $t,m as Z,g as j,w as Y,n as At,p as nt,M as st,k as _e,F as Te,q as Re,s as fe,r as F,v as Be,x as Ct,y as ze,z as Le,A as Tt,B as Rt,u as It,C as Et,i as qt}from"./index-vTnP0OgV.js";import{L as Bt}from"./LayoutExperience-O5bzWS3_.js";import{C as zt}from"./ContentContainer-DCK__-8i.js";import{C as Lt}from"./ChatAsideMenu-B_yAlHQs.js";import{u as ot}from"./use-all-agents-BDeXus9K.js";import{j as it,a as He}from"./icon-map-WRw1Tr5g.js";import{g as rt,a as me}from"./get-icon-4-dialog-DrrNyWJ9.js";import"./Header-C0GFKl5-.js";import"./Header.vue_vue_type_style_index_0_scoped_0b4b82f2_lang-CmyFc8-Z.js";import"./use-current-user-DMmm-WrO.js";/* empty css */import"./intelligent-frame8-D_OmWET8.js";const Dt={},Pt={class:"dialog-aside-left"};function Ft(c,e){return v(),E("div",Pt,e[0]||(e[0]=[C("div",null,null,-1)]))}const Mt=P(Dt,[["render",Ft],["__scopeId","data-v-c656b8f9"]]),Ot={class:"dialog-header"},jt={__name:"DialogHeader",props:{agent_info:Object},setup(c){return(e,t)=>(v(),E("div",Ot,[C("div",null,qe(c.agent_info.agent.name),1)]))}},Nt=P(jt,[["__scopeId","data-v-54c912dd"]]),Ut={class:"dialog-welcome-content"},Ht={__name:"DialogWelcome",props:{agent_info:Object},setup(c){return(e,t)=>(v(),E("div",Ut,t[0]||(t[0]=[C("div",null,null,-1)])))}},Qt=P(Ht,[["__scopeId","data-v-f217c60a"]]),Wt={class:"dialog-item-select question-select"},Zt={__name:"BtnSelectItem",props:{is_selected:Boolean},emits:["change"],setup(c,{emit:e}){return(t,n)=>(v(),E("div",Wt))}},at=P(Zt,[["__scopeId","data-v-b88b55f4"]]),Vt={class:"dialog-chat-answer-content"},Gt={key:0},Jt=["innerHTML"],Xt={__name:"DialogContent",props:{type:String,content:String,is_loading:Boolean},setup(c){return(e,t)=>{const n=te("a-spin");return v(),E("div",Vt,[c.is_loading?(v(),E("div",Gt,[D(n)])):W("",!0),c.is_loading?W("",!0):(v(),E("div",{key:1,innerHTML:c.content},null,8,Jt)),$t(e.$slots,"default",{},void 0,!0)])}}},lt=P(Xt,[["__scopeId","data-v-f4c95850"]]),Kt={class:"dialog-item dialog-question"},Yt={class:"dialog-main question-main"},en={class:"dialog-content question-content"},tn={class:"dialog-icon question-icon"},nn=["src"],sn={__name:"DialogQuestion",props:{show_select:!0,question:Object},emits:["select"],setup(c,{emit:e}){const t=c,n=Z(()=>t.show_select===!0),a=e,o=()=>{a("select")};return(l,s)=>(v(),E("div",Kt,[n.value?(v(),j(at,{key:0,onChange:o})):W("",!0),C("div",Yt,[C("div",en,[C("div",null,[D(lt,{content:c.question.content,class:"question-content-core-text"},null,8,["content"])])]),C("div",tn,[C("img",{src:c.question.client_custom_icon},null,8,nn)])])]))}},on=P(sn,[["__scopeId","data-v-6f3c947e"]]),rn={class:"dialog-actions-container"},an={class:"dialog-action-part dialog-action-left"},ln={__name:"DialogActions",emits:["copy","retry","share"],setup(c,{emit:e}){const t=e,n=()=>{t("copy")};return(a,o)=>{const l=te("icon-copy"),s=te("a-tooltip");return v(),E("div",rn,[C("div",an,[D(s,{content:"复制",position:"right"},{default:Y(()=>[C("div",{class:"action-btn-item",onClick:n},[D(l,{size:"22"})])]),_:1})]),o[0]||(o[0]=C("div",{class:"dialog-action-part dialog-action-right"},[C("div",{class:"action-btn-item"})],-1))])}}},cn=P(ln,[["__scopeId","data-v-8542f408"]]),un={__name:"BtnStopChat",emits:["stop"],setup(c,{emit:e}){const t=e,n=()=>{t("stop")};return(a,o)=>(v(),E("div",{class:"btn-chat-stop-generate",onClick:n},"停止生成"))}},pn=P(un,[["__scopeId","data-v-65272300"]]);function De(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let se=De();function ct(c){se=c}const ae={exec:()=>null};function R(c,e=""){let t=typeof c=="string"?c:c.source;const n={replace:(a,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(U.caret,"$1"),t=t.replace(a,l),n},getRegex:()=>new RegExp(t,e)};return n}const U={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]\] /,listReplaceTask:/^\[[ 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:c=>new RegExp(`^( {0,3}${c})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}#`),htmlBeginRegex:c=>new RegExp(`^ {0,${Math.min(3,c-1)}}<(?:[a-z].*>|!--)`,"i")},fn=/^(?:[ \t]*(?:\n|$))+/,hn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,dn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ce=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ut=/(?:[*+-]|\d{1,9}[.)])/,pt=R(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ut).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/).getRegex(),Pe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,_n=/^[^\n]+/,Fe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,mn=R(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),kn=R(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ut).getRegex(),ke="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",Me=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,yn=R("^ {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",Me).replace("tag",ke).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ft=R(Pe).replace("hr",ce).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",ke).getRegex(),bn=R(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ft).getRegex(),Oe={blockquote:bn,code:hn,def:mn,fences:dn,heading:gn,hr:ce,html:yn,lheading:pt,list:kn,newline:fn,paragraph:ft,table:ae,text:_n},Qe=R("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ce).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",ke).getRegex(),xn={...Oe,table:Qe,paragraph:R(Pe).replace("hr",ce).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qe).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",ke).getRegex()},wn={...Oe,html:R(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Me).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:ae,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:R(Pe).replace("hr",ce).replace("heading",` *#{1,6} *[^
  2. ]`).replace("lheading",pt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ht=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,dt=/^( {2,}|\\)\n(?!\s*$)/,Sn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ye=/[\p{P}\p{S}]/u,je=/[\s\p{P}\p{S}]/u,gt=/[^\s\p{P}\p{S}]/u,$n=R(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,je).getRegex(),An=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Cn=R(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,ye).getRegex(),Tn=R("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,gt).replace(/punctSpace/g,je).replace(/punct/g,ye).getRegex(),Rn=R("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gt).replace(/punctSpace/g,je).replace(/punct/g,ye).getRegex(),In=R(/\\(punct)/,"gu").replace(/punct/g,ye).getRegex(),En=R(/^<(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(),qn=R(Me).replace("(?:-->|$)","-->").getRegex(),Bn=R("^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",qn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),he=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zn=R(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",he).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_t=R(/^!?\[(label)\]\[(ref)\]/).replace("label",he).replace("ref",Fe).getRegex(),mt=R(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fe).getRegex(),Ln=R("reflink|nolink(?!\\()","g").replace("reflink",_t).replace("nolink",mt).getRegex(),Ne={_backpedal:ae,anyPunctuation:In,autolink:En,blockSkip:An,br:dt,code:vn,del:ae,emStrongLDelim:Cn,emStrongRDelimAst:Tn,emStrongRDelimUnd:Rn,escape:ht,link:zn,nolink:mt,punctuation:$n,reflink:_t,reflinkSearch:Ln,tag:Bn,text:Sn,url:ae},Dn={...Ne,link:R(/^!?\[(label)\]\((.*?)\)/).replace("label",he).getRegex(),reflink:R(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he).getRegex()},Ie={...Ne,escape:R(ht).replace("])","~|])").getRegex(),url:R(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Pn={...Ie,br:R(dt).replace("{2,}","*").getRegex(),text:R(Ie.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},pe={normal:Oe,gfm:xn,pedantic:wn},ie={normal:Ne,gfm:Ie,breaks:Pn,pedantic:Dn},Fn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=c=>Fn[c];function K(c,e){if(e){if(U.escapeTest.test(c))return c.replace(U.escapeReplace,We)}else if(U.escapeTestNoEncode.test(c))return c.replace(U.escapeReplaceNoEncode,We);return c}function Ze(c){try{c=encodeURI(c).replace(U.percentDecode,"%")}catch{return null}return c}function Ve(c,e){var o;const t=c.replace(U.findPipe,(l,s,f)=>{let i=!1,r=s;for(;--r>=0&&f[r]==="\\";)i=!i;return i?"|":" |"}),n=t.split(U.splitPipe);let a=0;if(n[0].trim()||n.shift(),n.length>0&&!((o=n.at(-1))!=null&&o.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;a<n.length;a++)n[a]=n[a].trim().replace(U.slashPipe,"|");return n}function re(c,e,t){const n=c.length;if(n===0)return"";let a=0;for(;a<n;){const o=c.charAt(n-a-1);if(o===e&&!t)a++;else if(o!==e&&t)a++;else break}return c.slice(0,n-a)}function Mn(c,e){if(c.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<c.length;n++)if(c[n]==="\\")n++;else if(c[n]===e[0])t++;else if(c[n]===e[1]&&(t--,t<0))return n;return-1}function Ge(c,e,t,n,a){const o=e.href,l=e.title||null,s=c[1].replace(a.other.outputLinkReplace,"$1");if(c[0].charAt(0)!=="!"){n.state.inLink=!0;const f={type:"link",raw:t,href:o,title:l,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,f}return{type:"image",raw:t,href:o,title:l,text:s}}function On(c,e,t){const n=c.match(t.other.indentCodeCompensation);if(n===null)return e;const a=n[1];return e.split(`
  3. `).map(o=>{const l=o.match(t.other.beginningSpace);if(l===null)return o;const[s]=l;return s.length>=a.length?o.slice(a.length):o}).join(`
  4. `)}class de{constructor(e){I(this,"options");I(this,"rules");I(this,"lexer");this.options=e||se}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:re(n,`
  5. `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],a=On(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:a}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const a=re(n,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(n=a.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:re(t[0],`
  6. `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=re(t[0],`
  7. `).split(`
  8. `),a="",o="";const l=[];for(;n.length>0;){let s=!1;const f=[];let i;for(i=0;i<n.length;i++)if(this.rules.other.blockquoteStart.test(n[i]))f.push(n[i]),s=!0;else if(!s)f.push(n[i]);else break;n=n.slice(i);const r=f.join(`
  9. `),u=r.replace(this.rules.other.blockquoteSetextReplace,`
  10. $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
  11. ${r}`:r,o=o?`${o}
  12. ${u}`:u;const p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,l,!0),this.lexer.state.top=p,n.length===0)break;const h=l.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const d=h,g=d.raw+`
  13. `+n.join(`
  14. `),_=this.blockquote(g);l[l.length-1]=_,a=a.substring(0,a.length-d.raw.length)+_.raw,o=o.substring(0,o.length-d.text.length)+_.text;break}else if((h==null?void 0:h.type)==="list"){const d=h,g=d.raw+`
  15. `+n.join(`
  16. `),_=this.list(g);l[l.length-1]=_,a=a.substring(0,a.length-h.raw.length)+_.raw,o=o.substring(0,o.length-d.raw.length)+_.raw,n=g.substring(l.at(-1).raw.length).split(`
  17. `);continue}}return{type:"blockquote",raw:a,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const a=n.length>1,o={type:"list",raw:"",ordered:a,start:a?+n.slice(0,-1):"",loose:!1,items:[]};n=a?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=a?n:"[*+-]");const l=this.rules.other.listItemRegex(n);let s=!1;for(;e;){let i=!1,r="",u="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let p=t[2].split(`
  18. `,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),h=e.split(`
  19. `,1)[0],d=!p.trim(),g=0;if(this.options.pedantic?(g=2,u=p.trimStart()):d?g=t[1].length+1:(g=t[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=p.slice(g),g+=t[1].length),d&&this.rules.other.blankLine.test(h)&&(r+=h+`
  20. `,e=e.substring(h.length+1),i=!0),!i){const $=this.rules.other.nextBulletRegex(g),B=this.rules.other.hrRegex(g),z=this.rules.other.fencesBeginRegex(g),S=this.rules.other.headingBeginRegex(g),L=this.rules.other.htmlBeginRegex(g);for(;e;){const H=e.split(`
  21. `,1)[0];let M;if(h=H,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),M=h):M=h.replace(this.rules.other.tabCharGlobal," "),z.test(h)||S.test(h)||L.test(h)||$.test(h)||B.test(h))break;if(M.search(this.rules.other.nonSpaceChar)>=g||!h.trim())u+=`
  22. `+M.slice(g);else{if(d||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(p)||S.test(p)||B.test(p))break;u+=`
  23. `+h}!d&&!h.trim()&&(d=!0),r+=H+`
  24. `,e=e.substring(H.length+1),p=M.slice(g)}}o.loose||(s?o.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let _=null,y;this.options.gfm&&(_=this.rules.other.listIsTask.exec(u),_&&(y=_[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:r,task:!!_,checked:y,loose:!1,text:u,tokens:[]}),o.raw+=r}const f=o.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let i=0;i<o.items.length;i++)if(this.lexer.state.top=!1,o.items[i].tokens=this.lexer.blockTokens(o.items[i].text,[]),!o.loose){const r=o.items[i].tokens.filter(p=>p.type==="space"),u=r.length>0&&r.some(p=>this.rules.other.anyLine.test(p.raw));o.loose=u}if(o.loose)for(let i=0;i<o.items.length;i++)o.items[i].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:a,title:o}}}table(e){var s;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=Ve(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(s=t[3])!=null&&s.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
  25. `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===a.length){for(const f of a)this.rules.other.tableAlignRight.test(f)?l.align.push("right"):this.rules.other.tableAlignCenter.test(f)?l.align.push("center"):this.rules.other.tableAlignLeft.test(f)?l.align.push("left"):l.align.push(null);for(let f=0;f<n.length;f++)l.header.push({text:n[f],tokens:this.lexer.inline(n[f]),header:!0,align:l.align[f]});for(const f of o)l.rows.push(Ve(f,l.header.length).map((i,r)=>({text:i,tokens:this.lexer.inline(i),header:!1,align:l.align[r]})));return l}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
  26. `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const l=re(n.slice(0,-1),"\\");if((n.length-l.length)%2===0)return}else{const l=Mn(t[2],"()");if(l>-1){const f=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,f).trim(),t[3]=""}}let a=t[2],o="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?a=a.slice(1):a=a.slice(1,-1)),Ge(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const a=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[a.toLowerCase()];if(!o){const l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return Ge(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!a||a[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(a[1]||a[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const l=[...a[0]].length-1;let s,f,i=l,r=0;const u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+l);(a=u.exec(t))!=null;){if(s=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!s)continue;if(f=[...s].length,a[3]||a[4]){i+=f;continue}else if((a[5]||a[6])&&l%3&&!((l+f)%3)){r+=f;continue}if(i-=f,i>0)continue;f=Math.min(f,f+i+r);const p=[...a[0]][0].length,h=e.slice(0,l+a.index+p+f);if(Math.min(l,f)%2){const g=h.slice(1,-1);return{type:"em",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}const d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return a&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,a;return t[2]==="@"?(n=t[1],a="mailto:"+n):(n=t[1],a=n),{type:"link",raw:t[0],text:n,href:a,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let a,o;if(t[2]==="@")a=t[0],o="mailto:"+a;else{let l;do l=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(l!==t[0]);a=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:a,href:o,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}}class V{constructor(e){I(this,"tokens");I(this,"options");I(this,"state");I(this,"tokenizer");I(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||se,this.options.tokenizer=this.options.tokenizer||new de,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:U,block:pe.normal,inline:ie.normal};this.options.pedantic?(t.block=pe.pedantic,t.inline=ie.pedantic):this.options.gfm&&(t.block=pe.gfm,this.options.breaks?t.inline=ie.breaks:t.inline=ie.gfm),this.tokenizer.rules=t}static get rules(){return{block:pe,inline:ie}}static lex(e,t){return new V(t).lex(e)}static lexInline(e,t){return new V(t).inlineTokens(e)}lex(e){e=e.replace(U.carriageReturn,`
  27. `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var a,o,l;for(this.options.pedantic&&(e=e.replace(U.tabCharGlobal," ").replace(U.spaceLine,""));e;){let s;if((o=(a=this.options.extensions)==null?void 0:a.block)!=null&&o.some(i=>(s=i.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);const i=t.at(-1);s.raw.length===1&&i!==void 0?i.raw+=`
  28. `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);const i=t.at(-1);(i==null?void 0:i.type)==="paragraph"||(i==null?void 0:i.type)==="text"?(i.raw+=`
  29. `+s.raw,i.text+=`
  30. `+s.text,this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);const i=t.at(-1);(i==null?void 0:i.type)==="paragraph"||(i==null?void 0:i.type)==="text"?(i.raw+=`
  31. `+s.raw,i.text+=`
  32. `+s.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let f=e;if((l=this.options.extensions)!=null&&l.startBlock){let i=1/0;const r=e.slice(1);let u;this.options.extensions.startBlock.forEach(p=>{u=p.call({lexer:this},r),typeof u=="number"&&u>=0&&(i=Math.min(i,u))}),i<1/0&&i>=0&&(f=e.substring(0,i+1))}if(this.state.top&&(s=this.tokenizer.paragraph(f))){const i=t.at(-1);n&&(i==null?void 0:i.type)==="paragraph"?(i.raw+=`
  33. `+s.raw,i.text+=`
  34. `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s),n=f.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);const i=t.at(-1);(i==null?void 0:i.type)==="text"?(i.raw+=`
  35. `+s.raw,i.text+=`
  36. `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(s);continue}if(e){const i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var s,f,i;let n=e,a=null;if(this.tokens.links){const r=Object.keys(this.tokens.links);if(r.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)r.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,a.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o=!1,l="";for(;e;){o||(l=""),o=!1;let r;if((f=(s=this.options.extensions)==null?void 0:s.inline)!=null&&f.some(p=>(r=p.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);const p=t.at(-1);r.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=r.raw,p.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,l)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let u=e;if((i=this.options.extensions)!=null&&i.startInline){let p=1/0;const h=e.slice(1);let d;this.options.extensions.startInline.forEach(g=>{d=g.call({lexer:this},h),typeof d=="number"&&d>=0&&(p=Math.min(p,d))}),p<1/0&&p>=0&&(u=e.substring(0,p+1))}if(r=this.tokenizer.inlineText(u)){e=e.substring(r.raw.length),r.raw.slice(-1)!=="_"&&(l=r.raw.slice(-1)),o=!0;const p=t.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=r.raw,p.text+=r.text):t.push(r);continue}if(e){const p="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return t}}class ge{constructor(e){I(this,"options");I(this,"parser");this.options=e||se}space(e){return""}code({text:e,lang:t,escaped:n}){var l;const a=(l=(t||"").match(U.notSpaceStart))==null?void 0:l[0],o=e.replace(U.endingNewline,"")+`
  37. `;return a?'<pre><code class="language-'+K(a)+'">'+(n?o:K(o,!0))+`</code></pre>
  38. `:"<pre><code>"+(n?o:K(o,!0))+`</code></pre>
  39. `}blockquote({tokens:e}){return`<blockquote>
  40. ${this.parser.parse(e)}</blockquote>
  41. `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
  42. `}hr(e){return`<hr>
  43. `}list(e){const t=e.ordered,n=e.start;let a="";for(let s=0;s<e.items.length;s++){const f=e.items[s];a+=this.listitem(f)}const o=t?"ol":"ul",l=t&&n!==1?' start="'+n+'"':"";return"<"+o+l+`>
  44. `+a+"</"+o+`>
  45. `}listitem(e){var n;let t="";if(e.task){const a=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=a+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=a+" "+K(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):t+=a+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
  46. `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
  47. `}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let a="";for(let o=0;o<e.rows.length;o++){const l=e.rows[o];n="";for(let s=0;s<l.length;s++)n+=this.tablecell(l[s]);a+=this.tablerow({text:n})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
  48. <thead>
  49. `+t+`</thead>
  50. `+a+`</table>
  51. `}tablerow({text:e}){return`<tr>
  52. ${e}</tr>
  53. `}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
  54. `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const a=this.parser.parseInline(n),o=Ze(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+K(t)+'"'),l+=">"+a+"</a>",l}image({href:e,title:t,text:n}){const a=Ze(e);if(a===null)return K(n);e=a;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${K(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:K(e.text)}}class Ue{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class G{constructor(e){I(this,"options");I(this,"renderer");I(this,"textRenderer");this.options=e||se,this.options.renderer=this.options.renderer||new ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ue}static parse(e,t){return new G(t).parse(e)}static parseInline(e,t){return new G(t).parseInline(e)}parse(e,t=!0){var a,o;let n="";for(let l=0;l<e.length;l++){const s=e[l];if((o=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&o[s.type]){const i=s,r=this.options.extensions.renderers[i.type].call({parser:this},i);if(r!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){n+=r||"";continue}}const f=s;switch(f.type){case"space":{n+=this.renderer.space(f);continue}case"hr":{n+=this.renderer.hr(f);continue}case"heading":{n+=this.renderer.heading(f);continue}case"code":{n+=this.renderer.code(f);continue}case"table":{n+=this.renderer.table(f);continue}case"blockquote":{n+=this.renderer.blockquote(f);continue}case"list":{n+=this.renderer.list(f);continue}case"html":{n+=this.renderer.html(f);continue}case"paragraph":{n+=this.renderer.paragraph(f);continue}case"text":{let i=f,r=this.renderer.text(i);for(;l+1<e.length&&e[l+1].type==="text";)i=e[++l],r+=`
  55. `+this.renderer.text(i);t?n+=this.renderer.paragraph({type:"paragraph",raw:r,text:r,tokens:[{type:"text",raw:r,text:r,escaped:!0}]}):n+=r;continue}default:{const i='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(e,t=this.renderer){var a,o;let n="";for(let l=0;l<e.length;l++){const s=e[l];if((o=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&o[s.type]){const i=this.options.extensions.renderers[s.type].call({parser:this},s);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=i||"";continue}}const f=s;switch(f.type){case"escape":{n+=t.text(f);break}case"html":{n+=t.html(f);break}case"link":{n+=t.link(f);break}case"image":{n+=t.image(f);break}case"strong":{n+=t.strong(f);break}case"em":{n+=t.em(f);break}case"codespan":{n+=t.codespan(f);break}case"br":{n+=t.br(f);break}case"del":{n+=t.del(f);break}case"text":{n+=t.text(f);break}default:{const i='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}}class le{constructor(e){I(this,"options");I(this,"block");this.options=e||se}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?V.lex:V.lexInline}provideParser(){return this.block?G.parse:G.parseInline}}I(le,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class kt{constructor(...e){I(this,"defaults",De());I(this,"options",this.setOptions);I(this,"parse",this.parseMarkdown(!0));I(this,"parseInline",this.parseMarkdown(!1));I(this,"Parser",G);I(this,"Renderer",ge);I(this,"TextRenderer",Ue);I(this,"Lexer",V);I(this,"Tokenizer",de);I(this,"Hooks",le);this.use(...e)}walkTokens(e,t){var a,o;let n=[];for(const l of e)switch(n=n.concat(t.call(this,l)),l.type){case"table":{const s=l;for(const f of s.header)n=n.concat(this.walkTokens(f.tokens,t));for(const f of s.rows)for(const i of f)n=n.concat(this.walkTokens(i.tokens,t));break}case"list":{const s=l;n=n.concat(this.walkTokens(s.items,t));break}default:{const s=l;(o=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&o[s.type]?this.defaults.extensions.childTokens[s.type].forEach(f=>{const i=s[f].flat(1/0);n=n.concat(this.walkTokens(i,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const a={...n};if(a.async=this.defaults.async||a.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const l=t.renderers[o.name];l?t.renderers[o.name]=function(...s){let f=o.renderer.apply(this,s);return f===!1&&(f=l.apply(this,s)),f}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),a.extensions=t),n.renderer){const o=this.defaults.renderer||new ge(this.defaults);for(const l in n.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const s=l,f=n.renderer[s],i=o[s];o[s]=(...r)=>{let u=f.apply(o,r);return u===!1&&(u=i.apply(o,r)),u||""}}a.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new de(this.defaults);for(const l in n.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const s=l,f=n.tokenizer[s],i=o[s];o[s]=(...r)=>{let u=f.apply(o,r);return u===!1&&(u=i.apply(o,r)),u}}a.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new le;for(const l in n.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const s=l,f=n.hooks[s],i=o[s];le.passThroughHooks.has(l)?o[s]=r=>{if(this.defaults.async)return Promise.resolve(f.call(o,r)).then(p=>i.call(o,p));const u=f.call(o,r);return i.call(o,u)}:o[s]=(...r)=>{let u=f.apply(o,r);return u===!1&&(u=i.apply(o,r)),u}}a.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,l=n.walkTokens;a.walkTokens=function(s){let f=[];return f.push(l.call(this,s)),o&&(f=f.concat(o.call(this,s))),f}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return V.lex(e,t??this.defaults)}parser(e,t){return G.parse(e,t??this.defaults)}parseMarkdown(e){return(n,a)=>{const o={...a},l={...this.defaults,...o},s=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&o.async===!1)return s(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 n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const f=l.hooks?l.hooks.provideLexer():e?V.lex:V.lexInline,i=l.hooks?l.hooks.provideParser():e?G.parse:G.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(n):n).then(r=>f(r,l)).then(r=>l.hooks?l.hooks.processAllTokens(r):r).then(r=>l.walkTokens?Promise.all(this.walkTokens(r,l.walkTokens)).then(()=>r):r).then(r=>i(r,l)).then(r=>l.hooks?l.hooks.postprocess(r):r).catch(s);try{l.hooks&&(n=l.hooks.preprocess(n));let r=f(n,l);l.hooks&&(r=l.hooks.processAllTokens(r)),l.walkTokens&&this.walkTokens(r,l.walkTokens);let u=i(r,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(r){return s(r)}}}onError(e,t){return n=>{if(n.message+=`
  56. Please report this to https://github.com/markedjs/marked.`,e){const a="<p>An error occurred:</p><pre>"+K(n.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(n);throw n}}}const ne=new kt;function T(c,e){return ne.parse(c,e)}T.options=T.setOptions=function(c){return ne.setOptions(c),T.defaults=ne.defaults,ct(T.defaults),T};T.getDefaults=De;T.defaults=se;T.use=function(...c){return ne.use(...c),T.defaults=ne.defaults,ct(T.defaults),T};T.walkTokens=function(c,e){return ne.walkTokens(c,e)};T.parseInline=ne.parseInline;T.Parser=G;T.parser=G.parse;T.Renderer=ge;T.TextRenderer=Ue;T.Lexer=V;T.lexer=V.lex;T.Tokenizer=de;T.Hooks=le;T.parse=T;T.options;T.setOptions;T.use;T.walkTokens;T.parseInline;G.parse;V.lex;const jn=new kt,Nn="refference-flag",Un=c=>c.replace(/##\d\$\$/g,' <span class="circle"></span>');function Hn(c){if(!c)return"";let e=Un(c);c.indexOf("![]")<0;let n=jn.parse(e).replace("<a href=",'<a target="_blank" href=');const a=/<span class="circle" data-list-index="\d"><\/span>/g;let o=0;return n.replaceAll(a,function(s,f,i,r){let u=s.replace("></span>",`data-flag-index="${o}"></span>`);return u=u.replace('class="circle"',`class="refflag-refflag-refflag ${Nn}"`),o++,u})}var yt={exports:{}};/*!
  57. * clipboard.js v2.0.11
  58. * https://clipboardjs.com/
  59. *
  60. * Licensed MIT © Zeno Rocha
  61. */(function(c,e){(function(n,a){c.exports=a()})(At,function(){return function(){var t={686:function(o,l,s){s.d(l,{default:function(){return J}});var f=s(279),i=s.n(f),r=s(370),u=s.n(r),p=s(817),h=s.n(p);function d(x){try{return document.execCommand(x)}catch{return!1}}var g=function(k){var m=h()(k);return d("cut"),m},_=g;function y(x){var k=document.documentElement.getAttribute("dir")==="rtl",m=document.createElement("textarea");m.style.fontSize="12pt",m.style.border="0",m.style.padding="0",m.style.margin="0",m.style.position="absolute",m.style[k?"right":"left"]="-9999px";var w=window.pageYOffset||document.documentElement.scrollTop;return m.style.top="".concat(w,"px"),m.setAttribute("readonly",""),m.value=x,m}var $=function(k,m){var w=y(k);m.container.appendChild(w);var b=h()(w);return d("copy"),w.remove(),b},B=function(k){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},w="";return typeof k=="string"?w=$(k,m):k instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(k==null?void 0:k.type)?w=$(k.value,m):(w=h()(k),d("copy")),w},z=B;function S(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?S=function(m){return typeof m}:S=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},S(x)}var L=function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=k.action,w=m===void 0?"copy":m,b=k.container,A=k.target,X=k.text;if(w!=="copy"&&w!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(A!==void 0)if(A&&S(A)==="object"&&A.nodeType===1){if(w==="copy"&&A.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(w==="cut"&&(A.hasAttribute("readonly")||A.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(X)return z(X,{container:b});if(A)return w==="cut"?_(A):z(A,{container:b})},H=L;function M(x){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?M=function(m){return typeof m}:M=function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},M(x)}function xe(x,k){if(!(x instanceof k))throw new TypeError("Cannot call a class as a function")}function we(x,k){for(var m=0;m<k.length;m++){var w=k[m];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(x,w.key,w)}}function ve(x,k,m){return k&&we(x.prototype,k),m&&we(x,m),x}function Se(x,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(k&&k.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),k&&oe(x,k)}function oe(x,k){return oe=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},oe(x,k)}function $e(x){var k=N();return function(){var w=Q(x),b;if(k){var A=Q(this).constructor;b=Reflect.construct(w,arguments,A)}else b=w.apply(this,arguments);return Ae(this,b)}}function Ae(x,k){return k&&(M(k)==="object"||typeof k=="function")?k:q(x)}function q(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function N(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Q(x){return Q=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},Q(x)}function O(x,k){var m="data-clipboard-".concat(x);if(k.hasAttribute(m))return k.getAttribute(m)}var ee=function(x){Se(m,x);var k=$e(m);function m(w,b){var A;return xe(this,m),A=k.call(this),A.resolveOptions(b),A.listenClick(w),A}return ve(m,[{key:"resolveOptions",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof b.action=="function"?b.action:this.defaultAction,this.target=typeof b.target=="function"?b.target:this.defaultTarget,this.text=typeof b.text=="function"?b.text:this.defaultText,this.container=M(b.container)==="object"?b.container:document.body}},{key:"listenClick",value:function(b){var A=this;this.listener=u()(b,"click",function(X){return A.onClick(X)})}},{key:"onClick",value:function(b){var A=b.delegateTarget||b.currentTarget,X=this.action(A)||"copy",ue=H({action:X,container:this.container,target:this.target(A),text:this.text(A)});this.emit(ue?"success":"error",{action:X,text:ue,trigger:A,clearSelection:function(){A&&A.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(b){return O("action",b)}},{key:"defaultTarget",value:function(b){var A=O("target",b);if(A)return document.querySelector(A)}},{key:"defaultText",value:function(b){return O("text",b)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(b){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return z(b,A)}},{key:"cut",value:function(b){return _(b)}},{key:"isSupported",value:function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],A=typeof b=="string"?[b]:b,X=!!document.queryCommandSupported;return A.forEach(function(ue){X=X&&!!document.queryCommandSupported(ue)}),X}}]),m}(i()),J=ee},828:function(o){var l=9;if(typeof Element<"u"&&!Element.prototype.matches){var s=Element.prototype;s.matches=s.matchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector||s.webkitMatchesSelector}function f(i,r){for(;i&&i.nodeType!==l;){if(typeof i.matches=="function"&&i.matches(r))return i;i=i.parentNode}}o.exports=f},438:function(o,l,s){var f=s(828);function i(p,h,d,g,_){var y=u.apply(this,arguments);return p.addEventListener(d,y,_),{destroy:function(){p.removeEventListener(d,y,_)}}}function r(p,h,d,g,_){return typeof p.addEventListener=="function"?i.apply(null,arguments):typeof d=="function"?i.bind(null,document).apply(null,arguments):(typeof p=="string"&&(p=document.querySelectorAll(p)),Array.prototype.map.call(p,function(y){return i(y,h,d,g,_)}))}function u(p,h,d,g){return function(_){_.delegateTarget=f(_.target,h),_.delegateTarget&&g.call(p,_)}}o.exports=r},879:function(o,l){l.node=function(s){return s!==void 0&&s instanceof HTMLElement&&s.nodeType===1},l.nodeList=function(s){var f=Object.prototype.toString.call(s);return s!==void 0&&(f==="[object NodeList]"||f==="[object HTMLCollection]")&&"length"in s&&(s.length===0||l.node(s[0]))},l.string=function(s){return typeof s=="string"||s instanceof String},l.fn=function(s){var f=Object.prototype.toString.call(s);return f==="[object Function]"}},370:function(o,l,s){var f=s(879),i=s(438);function r(d,g,_){if(!d&&!g&&!_)throw new Error("Missing required arguments");if(!f.string(g))throw new TypeError("Second argument must be a String");if(!f.fn(_))throw new TypeError("Third argument must be a Function");if(f.node(d))return u(d,g,_);if(f.nodeList(d))return p(d,g,_);if(f.string(d))return h(d,g,_);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function u(d,g,_){return d.addEventListener(g,_),{destroy:function(){d.removeEventListener(g,_)}}}function p(d,g,_){return Array.prototype.forEach.call(d,function(y){y.addEventListener(g,_)}),{destroy:function(){Array.prototype.forEach.call(d,function(y){y.removeEventListener(g,_)})}}}function h(d,g,_){return i(document.body,d,g,_)}o.exports=r},817:function(o){function l(s){var f;if(s.nodeName==="SELECT")s.focus(),f=s.value;else if(s.nodeName==="INPUT"||s.nodeName==="TEXTAREA"){var i=s.hasAttribute("readonly");i||s.setAttribute("readonly",""),s.select(),s.setSelectionRange(0,s.value.length),i||s.removeAttribute("readonly"),f=s.value}else{s.hasAttribute("contenteditable")&&s.focus();var r=window.getSelection(),u=document.createRange();u.selectNodeContents(s),r.removeAllRanges(),r.addRange(u),f=r.toString()}return f}o.exports=l},279:function(o){function l(){}l.prototype={on:function(s,f,i){var r=this.e||(this.e={});return(r[s]||(r[s]=[])).push({fn:f,ctx:i}),this},once:function(s,f,i){var r=this;function u(){r.off(s,u),f.apply(i,arguments)}return u._=f,this.on(s,u,i)},emit:function(s){var f=[].slice.call(arguments,1),i=((this.e||(this.e={}))[s]||[]).slice(),r=0,u=i.length;for(r;r<u;r++)i[r].fn.apply(i[r].ctx,f);return this},off:function(s,f){var i=this.e||(this.e={}),r=i[s],u=[];if(r&&f)for(var p=0,h=r.length;p<h;p++)r[p].fn!==f&&r[p].fn._!==f&&u.push(r[p]);return u.length?i[s]=u:delete i[s],this}},o.exports=l,o.exports.TinyEmitter=l}},n={};function a(o){if(n[o])return n[o].exports;var l=n[o]={exports:{}};return t[o](l,l.exports,a),l.exports}return function(){a.n=function(o){var l=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(l,{a:l}),l}}(),function(){a.d=function(o,l){for(var s in l)a.o(l,s)&&!a.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:l[s]})}}(),function(){a.o=function(o,l){return Object.prototype.hasOwnProperty.call(o,l)}}(),a(686)}().default})})(yt);var Qn=yt.exports;const Wn=nt(Qn);function Zn(c){Wn.copy(c)}const Vn={class:"dialog-item dialog-anwser"},Gn={class:"dialog-main answer-main"},Jn={class:"dialog-icon answer-icon"},Xn=["src"],Kn={class:"dialog-content answer-content"},Yn={__name:"DialogAnswer",props:{show_select:!0,answer:Object},emits:["stop","retry","select"],setup(c,{emit:e}){const t=c,n=e,a=Z(()=>t.show_select===!0),o=Z(()=>t.answer.client_custom_chat_status),l=Z(()=>o.value===0),s=Z(()=>{const h=t.answer.content;return Hn(h)}),f=()=>{n("select")},i=()=>{n("stop")},r=()=>{Zn(s.value),st.success("已复制")},u=()=>{},p=()=>{n("retry")};return(h,d)=>(v(),E("div",Vn,[a.value?(v(),j(at,{key:0,onChange:f})):W("",!0),C("div",Gn,[C("div",Jn,[C("img",{src:c.answer.client_custom_icon},null,8,Xn)]),C("div",Kn,[C("div",null,[D(lt,{content:s.value,is_loading:l.value},{default:Y(()=>[o.value===2?(v(),j(cn,{key:0,class:"answer-actions-btns",onCopy:r,onShare:u,onRetry:p})):W("",!0)]),_:1},8,["content","is_loading"]),o.value===1?(v(),j(pn,{key:0,onStop:i})):W("",!0)])])])]))}},es=P(Yn,[["__scopeId","data-v-a30c5be3"]]),ts={class:"dialog-item-container"},ns={__name:"DialogItem",props:{dialog:Object},emits:["stop","retry","select"],setup(c,{emit:e}){const t=c,n=e,a=Z(()=>t.dialog.client_custom_item_type),o=Z(()=>({content:t.dialog.question,client_custom_icon:t.dialog.client_custom_icon})),l=Z(()=>{const r=t.dialog,u={};return r.answer&&(u.content=r.answer),u.client_custom_chat_status=r.client_custom_chat_status,u.client_custom_icon=r.client_custom_icon,u}),s=()=>{n("stop")},f=()=>{n("retry")},i=()=>{n("select")};return(r,u)=>(v(),E("div",ts,[a.value==="q"?(v(),j(on,{key:0,question:o.value,onSelect:i},null,8,["question"])):W("",!0),a.value==="a"?(v(),j(es,{key:1,answer:l.value,onStop:s,onRetry:f,onSelect:i},null,8,["answer"])):W("",!0)]))}},ss=P(ns,[["__scopeId","data-v-824ca041"]]),os={class:"dialog-suggestion"},is={__name:"DialogSuggestion",props:{suggestion:Object},setup(c){return(e,t)=>(v(),E("div",os,t[0]||(t[0]=[C("div",null,"对话推荐项,当一轮对话结束后,可能有其他推荐的内容项目,在对话结束处进行展示。",-1)])))}},rs=P(is,[["__scopeId","data-v-c9a060e3"]]);function as(c){const{proxy:e}=_e();return t=>{e.$refs[c].scrollTop(t)}}const ls={class:"dialog-list"},cs={__name:"DialogList",props:{height:Number,agent_id:String,list:Array,suggestion:Array},setup(c,{expose:e}){const t=c,n=as("scroll_container"),a=Z(()=>({height:t.height+"px",overflow:"auto"})),o=l=>{};return e({scroll2Bottom:()=>{n(1e6)}}),(l,s)=>{const f=te("a-scrollbar");return v(),j(f,{type:"track",style:fe(a.value),ref:"scroll_container"},{default:Y(()=>[C("div",ls,[(v(!0),E(Te,null,Re(c.list,(i,r)=>(v(),j(ss,{dialog:i,index:r,key:i.client_custom_unique_id,onSelect:u=>o(i)},null,8,["dialog","index","onSelect"]))),128)),c.suggestion.length!==0?(v(),j(rs,{key:0,suggestion:c.suggestion},null,8,["suggestion"])):W("",!0)])]),_:1},8,["style"])}}},us=P(cs,[["__scopeId","data-v-1ac57521"]]),ps="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAL0SURBVHgB7Vc7ctswEF19ipRKqVER5gbUrw5dpop9AtsnSG4g+QSJTiDmBJFPEKbWZ+gb0I2kLiyVGX3ylsEyCC1KICVNGr4ZDgEQu3j7wQIkKlCgQIGLomQyybZti/Ij9H0/pJxIJQhSTqVS6XETT41Og7/b7Qbb7dYD2SCLYGkPMQvEhmg6dH4E5XL5Zjwe+6YC/xBU5L6jaXEfVoelUomt/0E5AXkL8u/4rY1dTSYTz0he77Tbbfbcnep6m83mPmtI0tDpdPog2lPdELrfmuRmRRqcc3D/F25DUTCbzZrL5TJ3cicxn8+9RqPBDnHwvIIXfy0WC++YXFkaCO2ttJHMV3QBIKx9vDxug+BHE5mq1rbV2zcJqyo97HWLDACjXdaL6DyCnIOhGnTYvBhlJPhMh4lJ+XEoA6rVqodXAHKBNna0fJW1tuTbz7TJrVarp3a5Q2cGexOb9DY5rnvQVwtf47mnPeRgfV8bGqA/ghcCMsBqtRIHfJCx9Xod8FsRizZot9t90utkTJBrneQGBK6n0+mINOuEHO9w5NPNsdzZB8lb0SO5jvZr6I/CDd3fMK8pJSgOMT6wBWLlUD9/EdbP2ry85GrqhLLU0IN8Q0njtQeqa2Hj3cm3mCAzhiUiVJNJrJj+5txjTnIOUkHPXR+kXH0OCneflIPgzTgN9ByMLEF4LUwIEeK+6JfvMMBTC9q6Vw+AjbP4DVnREaVIciI7CGvLPrD2EmSA2CdKgVYidK9mAd9o+mlHHL49I3J0kOAexMpgfU0b88gMfOF4wo51jx0AIPcmuaYJwUAaWIjLgavy8KzHob7D6U/Ji1A+JqjC4amug1uJQxcAvBcXaUTqazxuIgzPPWjCwxN/AV5APwTUTcqN1zZVkrjPMVyUBrY0oPxw1C3KkQHobOqlzJhgCsmzgW/v/DuQvGlXMuiILp31ep1vO7YcTWeChxLzHqF9cQhk8qAOHOo2lPL/hk35wJsvhI7RKb+lBQoUKFDgP+M3zC1vWE7HoR8AAAAASUVORK5CYII=",fs={class:"dialog-input-actions"},hs={class:"dialog-input-action-left"},ds={class:"dialog-input-action-right"},gs={__name:"InputActions",props:{disabled:{type:Boolean,default:!1,required:!1},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1}},emits:["fileUpload","questionDefine","voiceRecognize","submit"],setup(c,{emit:e}){const t=e,n=()=>{t("fileUpload")},a=()=>{t("submit")};return(o,l)=>{const s=te("a-tooltip");return v(),E("div",fs,[C("div",hs,[D(s,{content:"文件上传",position:"top"},{default:Y(()=>[c.enable_file_upload?(v(),E("div",{key:0,class:"action-left-item-btn",onClick:n},l[0]||(l[0]=[C("img",{src:ps},null,-1)]))):W("",!0)]),_:1})]),C("div",ds,[D(s,{content:"请输入您的问题",position:"top"},{default:Y(()=>[C("div",{class:"action-right-item-btn submit-input-btn",onClick:a},"发送")]),_:1})])])}}},_s=P(gs,[["__scopeId","data-v-4c099028"]]),ms={class:"file-item-doc-preview"},ks={__name:"FileItemDocPreview",props:{file:Object},setup(c){return console.log(c.file,"文档内容"),(t,n)=>(v(),E("div",ms,[C("div",null,qe(c.file.name),1)]))}},ys=P(ks,[["__scopeId","data-v-85c455c3"]]),bs={__name:"FileItemImagePreview",props:{file:Object},setup(c){return(e,t)=>(v(),E("div",null,[C("div",null,qe(c.file.name),1)]))}},xs=c=>c==="jpg"||c==="png"||c==="jpeg"||c==="gif";function Je(c){const e=c.split("."),t=e[e.length-1];return xs(t)}const ws={class:"file-upload-preview-area"},vs={class:"file-doc-preview-container"},Ss={class:"file-image-preview-container"},$s={__name:"FileUploadPreview",props:{file_list:Array},setup(c){const e=c,t=Z(()=>{const a=[];return e.file_list.forEach((o,l)=>{const s=o.file.name;Je(s)&&a.push(o)}),a}),n=Z(()=>{const a=[];return e.file_list.forEach((o,l)=>{const s=o.file.name;Je(s)||a.push(o)}),a});return(a,o)=>(v(),E("div",ws,[C("div",vs,[(v(!0),E(Te,null,Re(n.value,(l,s)=>(v(),j(ys,{key:l.id+l.index,file:l.file},null,8,["file"]))),128))]),C("div",Ss,[(v(!0),E(Te,null,Re(t.value,(l,s)=>(v(),j(bs,{key:l.id+l.index,file:l.file},null,8,["file"]))),128))])]))}},As=P($s,[["__scopeId","data-v-4f79cc00"]]);function Cs(c){const e=[];let t=0;return{select(n){const a=Date.now(),o=document.createElement("input");o.type="file",o.id=`9d75142a66eb4e23b7d403efe4584915-${a}-${t}`,o.setAttribute("multiple",!0),o.setAttribute("style","display: none;"),document.body.appendChild(o),t=t+1,o.click(),o.onchange=l=>{typeof n=="function"&&n(l)},e.push(o)},remove(){e.forEach(n=>{document.body.removeChild(n)})}}}const Ts={class:"dialog-input-area-container"},Rs={class:"textarea-container"},Is={__name:"DialogInput",props:{disabled:{type:Boolean,default:!1,required:!1},agent_info:{type:Object},agent_config:{type:Object},enable_file_upload:{type:Boolean,default:!0,required:!1},enable_frequent_question:{type:Boolean,default:!0,required:!1},enable_voice_recognition:{type:Boolean,default:!1,required:!1},file_upload_type:{type:String,default:"*",required:!1},file_upload_limit:{type:Number,default:0,required:!1},text_placeholder:{type:String},text_limit:{type:Number,default:0,required:!1},show_text_count:{type:Boolean,default:!1,required:!1}},emits:["submit"],setup(c,{expose:e,emit:t}){const n=c,a=F(""),o=F([]),l=t,{select:s,remove:f}=Cs(),i=()=>{if(n.disabled)return;const y=[];o.value.forEach($=>{y.push($.file)}),l("submit",{text:a.value,files:y})},r=()=>{a.value="",o.value=[]},u=()=>{s(y=>{const $=y.target.files,B=y.target.id,z=$.length;if(z===1&&o.value.push({type:1,id:B,index:0,file:$[0]}),z>1)for(let S=0;S<z;S++){const L=$[S],H=S;o.value.push({type:2,id:B,index:H,file:L})}})},p=()=>{},h=()=>{},d=()=>{a.value=a.value.replace(/\n/,"")},g=(y,$)=>{n.disabled||(a.value=y)},_=y=>{if(n.disabled){y.keyCode===13&&d();return}y.keyCode===13&&(y.ctrlKey||(d(),i()))};return Be(()=>{f()}),e({clear:r}),(y,$)=>{const B=te("a-textarea");return v(),E("div",null,[C("div",Ts,[C("div",Rs,[D(B,{class:"textarea-input",placeholder:"输入文本内容","model-value":a.value,"allow-clear":"","auto-size":{minRows:1,maxRows:4},onInput:g,onKeyup:_},null,8,["model-value"])]),D(_s,{disabled:c.disabled,enable_file_upload:c.enable_file_upload,enable_frequent_question:c.enable_frequent_question,enable_voice_recognition:c.enable_voice_recognition,file_upload_type:c.file_upload_type,file_upload_limit:c.file_upload_limit,onFileUpload:u,onQuestionDefine:p,onVoiceRecognize:h,onSubmit:i},null,8,["disabled","enable_file_upload","enable_frequent_question","enable_voice_recognition","file_upload_type","file_upload_limit"]),D(As,{file_list:o.value},null,8,["file_list"])])])}}},Es=P(Is,[["__scopeId","data-v-d85483d3"]]),qs={},Bs={class:"dialog-footer"};function zs(c,e){return v(),E("div",Bs,e[0]||(e[0]=[C("div",null,"内容由 AI 大模型生成,请仔细甄别",-1)]))}const Ls=P(qs,[["render",zs],["__scopeId","data-v-a73a920d"]]),Ds={},Ps={class:"dialog-aside-right"};function Fs(c,e){return v(),E("div",Ps,e[0]||(e[0]=[C("div",null,null,-1)]))}const Ms=P(Ds,[["render",Fs],["__scopeId","data-v-dea2ba14"]]),Xe={"9d75142a-66eb-4e23-b7d4-03efe4584915":{text_limit:250,file_upload:!0,file_accept:".jpg,.png",file_limit:1,file_message:"支持上传 .png, .jpg,大小不超过10M"}};function Os(c){return c&&c in Xe?Xe[c]:null}function js(c,e,t){const n=location.host,a=Ct.get();return c==="report"?`ws://${n}/api/${c}/ws/${e}/${t}?token=${a}`:c==="chat"?`ws://${n}/api/${c}/ws/${e}/${t}?token=${a}`:c==="excel"?`ws://${n}/api/document/ws/excel`:`ws://${n}/api/chat/ws/${e}/${t}?token=${a}`}function Ce(c){return typeof c=="function"?c:Function.prototype}function Ns(c){let e=[];const t=Ce(c.onMessage),n=Ce(c.onClose),a=Ce(c.onError);F(-1);function o(r,u,p){const h=js(p,r,u),d=new WebSocket(h);return d.onopen=function(g){e.forEach(_=>{d.send(_)}),e=[]},d.onclose=function(g){n(g)},d.onerror=function(g){a(g)},d.onmessage=g=>{t(g)},d}let l=null,s=null,f=null,i=null;return{initWSConnection(r,u,p){return l=r,s=u,f=p,i===null&&(i=o(l,s,f)),i},sendWSMessage(r){i===null&&(i=o(l,s,f)),i.readyState===0&&e.push(r),i.readyState===1&&i.send(r),i.readyState===2&&console.log("web socket正在关闭"),i.readyState===3&&(e.push(r),i=o(l,s,f))},getWSInstance(){return i},closeWSConnect(){i!==null&&i.close()}}}const Us=(c,e,t)=>ze.post(`/api/files/upload/${c}?chat_id=${e}`,t,{headers:{"Content-Type":"multipart/form-data"}}),Hs=c=>ze.get(`/api/agent/get-chat-id/${c}`),Qs=(c,e)=>ze.get(`/api/agent/${c}/${e}/session_log`);function Ws(c){const e=new FormData;return c.forEach(t=>{e.append("file",t)}),e}function Zs(c,e){return it({message:c})}var bt={exports:{}},xt={exports:{}};(function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,n){return t<<n|t>>>32-n},rotr:function(t,n){return t<<32-n|t>>>n},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var n=0;n<t.length;n++)t[n]=e.endian(t[n]);return t},randomBytes:function(t){for(var n=[];t>0;t--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(t){for(var n=[],a=0,o=0;a<t.length;a++,o+=8)n[o>>>5]|=t[a]<<24-o%32;return n},wordsToBytes:function(t){for(var n=[],a=0;a<t.length*32;a+=8)n.push(t[a>>>5]>>>24-a%32&255);return n},bytesToHex:function(t){for(var n=[],a=0;a<t.length;a++)n.push((t[a]>>>4).toString(16)),n.push((t[a]&15).toString(16));return n.join("")},hexToBytes:function(t){for(var n=[],a=0;a<t.length;a+=2)n.push(parseInt(t.substr(a,2),16));return n},bytesToBase64:function(t){for(var n=[],a=0;a<t.length;a+=3)for(var o=t[a]<<16|t[a+1]<<8|t[a+2],l=0;l<4;l++)a*8+l*6<=t.length*8?n.push(c.charAt(o>>>6*(3-l)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],a=0,o=0;a<t.length;o=++a%4)o!=0&&n.push((c.indexOf(t.charAt(a-1))&Math.pow(2,-2*o+8)-1)<<o*2|c.indexOf(t.charAt(a))>>>6-o*2);return n}};xt.exports=e})();var Vs=xt.exports,Ee={utf8:{stringToBytes:function(c){return Ee.bin.stringToBytes(unescape(encodeURIComponent(c)))},bytesToString:function(c){return decodeURIComponent(escape(Ee.bin.bytesToString(c)))}},bin:{stringToBytes:function(c){for(var e=[],t=0;t<c.length;t++)e.push(c.charCodeAt(t)&255);return e},bytesToString:function(c){for(var e=[],t=0;t<c.length;t++)e.push(String.fromCharCode(c[t]));return e.join("")}}},Ke=Ee;/*!
  62. * Determine if an object is a Buffer
  63. *
  64. * @author Feross Aboukhadijeh <https://feross.org>
  65. * @license MIT
  66. */var Gs=function(c){return c!=null&&(wt(c)||Js(c)||!!c._isBuffer)};function wt(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function Js(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&wt(c.slice(0,0))}(function(){var c=Vs,e=Ke.utf8,t=Gs,n=Ke.bin,a=function(o,l){o.constructor==String?l&&l.encoding==="binary"?o=n.stringToBytes(o):o=e.stringToBytes(o):t(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var s=c.bytesToWords(o),f=o.length*8,i=1732584193,r=-271733879,u=-1732584194,p=271733878,h=0;h<s.length;h++)s[h]=(s[h]<<8|s[h]>>>24)&16711935|(s[h]<<24|s[h]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var d=a._ff,g=a._gg,_=a._hh,y=a._ii,h=0;h<s.length;h+=16){var $=i,B=r,z=u,S=p;i=d(i,r,u,p,s[h+0],7,-680876936),p=d(p,i,r,u,s[h+1],12,-389564586),u=d(u,p,i,r,s[h+2],17,606105819),r=d(r,u,p,i,s[h+3],22,-1044525330),i=d(i,r,u,p,s[h+4],7,-176418897),p=d(p,i,r,u,s[h+5],12,1200080426),u=d(u,p,i,r,s[h+6],17,-1473231341),r=d(r,u,p,i,s[h+7],22,-45705983),i=d(i,r,u,p,s[h+8],7,1770035416),p=d(p,i,r,u,s[h+9],12,-1958414417),u=d(u,p,i,r,s[h+10],17,-42063),r=d(r,u,p,i,s[h+11],22,-1990404162),i=d(i,r,u,p,s[h+12],7,1804603682),p=d(p,i,r,u,s[h+13],12,-40341101),u=d(u,p,i,r,s[h+14],17,-1502002290),r=d(r,u,p,i,s[h+15],22,1236535329),i=g(i,r,u,p,s[h+1],5,-165796510),p=g(p,i,r,u,s[h+6],9,-1069501632),u=g(u,p,i,r,s[h+11],14,643717713),r=g(r,u,p,i,s[h+0],20,-373897302),i=g(i,r,u,p,s[h+5],5,-701558691),p=g(p,i,r,u,s[h+10],9,38016083),u=g(u,p,i,r,s[h+15],14,-660478335),r=g(r,u,p,i,s[h+4],20,-405537848),i=g(i,r,u,p,s[h+9],5,568446438),p=g(p,i,r,u,s[h+14],9,-1019803690),u=g(u,p,i,r,s[h+3],14,-187363961),r=g(r,u,p,i,s[h+8],20,1163531501),i=g(i,r,u,p,s[h+13],5,-1444681467),p=g(p,i,r,u,s[h+2],9,-51403784),u=g(u,p,i,r,s[h+7],14,1735328473),r=g(r,u,p,i,s[h+12],20,-1926607734),i=_(i,r,u,p,s[h+5],4,-378558),p=_(p,i,r,u,s[h+8],11,-2022574463),u=_(u,p,i,r,s[h+11],16,1839030562),r=_(r,u,p,i,s[h+14],23,-35309556),i=_(i,r,u,p,s[h+1],4,-1530992060),p=_(p,i,r,u,s[h+4],11,1272893353),u=_(u,p,i,r,s[h+7],16,-155497632),r=_(r,u,p,i,s[h+10],23,-1094730640),i=_(i,r,u,p,s[h+13],4,681279174),p=_(p,i,r,u,s[h+0],11,-358537222),u=_(u,p,i,r,s[h+3],16,-722521979),r=_(r,u,p,i,s[h+6],23,76029189),i=_(i,r,u,p,s[h+9],4,-640364487),p=_(p,i,r,u,s[h+12],11,-421815835),u=_(u,p,i,r,s[h+15],16,530742520),r=_(r,u,p,i,s[h+2],23,-995338651),i=y(i,r,u,p,s[h+0],6,-198630844),p=y(p,i,r,u,s[h+7],10,1126891415),u=y(u,p,i,r,s[h+14],15,-1416354905),r=y(r,u,p,i,s[h+5],21,-57434055),i=y(i,r,u,p,s[h+12],6,1700485571),p=y(p,i,r,u,s[h+3],10,-1894986606),u=y(u,p,i,r,s[h+10],15,-1051523),r=y(r,u,p,i,s[h+1],21,-2054922799),i=y(i,r,u,p,s[h+8],6,1873313359),p=y(p,i,r,u,s[h+15],10,-30611744),u=y(u,p,i,r,s[h+6],15,-1560198380),r=y(r,u,p,i,s[h+13],21,1309151649),i=y(i,r,u,p,s[h+4],6,-145523070),p=y(p,i,r,u,s[h+11],10,-1120210379),u=y(u,p,i,r,s[h+2],15,718787259),r=y(r,u,p,i,s[h+9],21,-343485551),i=i+$>>>0,r=r+B>>>0,u=u+z>>>0,p=p+S>>>0}return c.endian([i,r,u,p])};a._ff=function(o,l,s,f,i,r,u){var p=o+(l&s|~l&f)+(i>>>0)+u;return(p<<r|p>>>32-r)+l},a._gg=function(o,l,s,f,i,r,u){var p=o+(l&f|s&~f)+(i>>>0)+u;return(p<<r|p>>>32-r)+l},a._hh=function(o,l,s,f,i,r,u){var p=o+(l^s^f)+(i>>>0)+u;return(p<<r|p>>>32-r)+l},a._ii=function(o,l,s,f,i,r,u){var p=o+(s^(l|~f))+(i>>>0)+u;return(p<<r|p>>>32-r)+l},a._blocksize=16,a._digestsize=16,bt.exports=function(o,l){if(o==null)throw new Error("Illegal argument "+o);var s=c.wordsToBytes(a(o,l));return l&&l.asBytes?s:l&&l.asString?n.bytesToString(s):c.bytesToHex(s)}})();var Xs=bt.exports;const Ks=nt(Xs);function be(c){return c?Ks(c):Date.now()+""}function Ys(c,e){var n;return(n=e==null?void 0:e.agent)!=null&&n.icon,{client_custom_chat_type:0,client_custom_item_type:"q",client_custom_chat_status:2,client_custom_icon:rt(),client_custom_unique_id:be(c.question),question:c.question}}function eo(c,e){return{client_custom_chat_type:0,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:me(e),client_custom_unique_id:be(c.answer),answer:c.answer}}function to(c,e){const t=[];return c.forEach(n=>{const a=Ys(n,e),o=eo(n,e);t.push(a),t.push(o)}),t}function no(c,e,t){const n=Date.now(),a=rt();return{client_custom_item_type:"q",client_custom_create_time:n,client_custom_unique_id:be(c+n),client_custom_icon:a,question:c}}function so(c){return{client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:0,client_custom_icon:me(c),client_custom_unique_id:"loading_"+Date.now(),question:"",answer:""}}function oo(c,e){return{client_custom_chat_type:1,client_custom_item_type:"a",client_custom_chat_status:2,client_custom_icon:me(c),client_custom_unique_id:"exception_"+Date.now(),question:"",answer:e.message}}const io=c=>`<pre><code class="hljs language-python">
  67. ${c}</code></pre>`,ro=c=>`<pre><code class="hljs language-sql">
  68. ${c}</code></pre>`;function ao(c,e,t){const n=He(c),a=He(it(e)),o=me(t),l=n.type,s=n.message;n.reference,n.step_message;const f=n.files,i=n.message_files,r=n.download_url,u=n.file_url,p=n.file_name,h=n.image_url,d=n.excel_url,g=n.excel_name,_=n.code,y=n.sql,$={client_custom_chat_type:2,client_custom_item_type:"a",client_custom_chat_status:1,client_custom_icon:o,question:n.question};for(let S in a)S==="client_custom_chat_type"||S==="client_custom_chat_status"||($[S]=a[S]);let B=0,z="";if(l==="message"){if(B=1,$.answer=s,h){const S=window.location.port?`:${window.location.port}`:"",L=`http://${window.location.hostname}${S}${h}`;$.image_url=L}if(d&&g){const S=window.location.port?`:${window.location.port}`:"",L={file_type:"excel",file_url:`http://${window.location.hostname}${S}${d}`,file_name:`${g}.xlsx`||"点击下载"};$.file=L}if(u&&p){const S=window.location.port?`:${window.location.port}`:"",L={file_type:"word",file_url:`http://${window.location.hostname}${S}${u}`,file_name:`${p}.docx`||"点击下载"};$.file=L}if(_){const S=io(_);$.code=S}if(y){const S=ro(y);$.sql=S}if(r){const S=decodeURIComponent(r).split("/"),L=S[S.length-1],H={file_type:"word",file_url:r,file_name:`${L}.docx`||"点击下载"};$.file=H}}if(l==="stream"&&(B=1,e&&e.answer?$.answer=e.answer+s:$.answer=s,f)){const L=f[0].file_name.split("."),H=L[L.length-1],M={file_name:f[0].file_name,file_url:f[0].file_url};H==="xlsx"&&(M.file_type="excel"),H==="docx"&&(M.file_type="word"),$.file=M}return l==="system"&&(B=1),l==="close"&&(B=2,$.client_custom_chat_status=2,$.client_custom_chat_type=1,i&&Array.isArray(i)&&i.forEach((S,L)=>{}),s&&($.answer=s)),l==="error"&&(B=3,$.client_custom_chat_status=2,$.client_custom_chat_type=1,$.answer=s),$.client_custom_unique_id=be($.answer),{status:B,message:z,data:$}}function lo(c){const e=F(0),t=F(0),{proxy:n}=_e(),a=()=>{const o=n.$refs[c];e.value=o.offsetHeight,t.value=o.offsetWidth};return Le(()=>{a(),window.addEventListener("resize",a)}),Be(()=>{window.removeEventListener("resize",a)}),{height:e,width:t}}function co(c){const{proxy:e}=_e();return()=>{const t=e.$refs[c];t&&t.clear&&typeof t.clear=="function"&&t.clear()}}function uo(c){const{proxy:e}=_e();return t=>{const n=e.$refs[c];n&&n.scroll2Bottom&&typeof n.scroll2Bottom=="function"&&n.scroll2Bottom(t)}}const po={class:"conversation-chat-container"},fo={class:"conversation-chat-left"},ho={class:"conversation-chat-main",ref:"chat_main"},go={class:"conversation-chat-content"},_o={class:"conversation-chat-right"},Ye=30,et=30,tt=100,mo={__name:"ConversationChatContainer",props:{agent_id:String,session_id:String,chat_type:String},setup(c){const e=c,t=ot(),n=F({agent:{},config:{}}),{width:a,height:o}=lo("chat_main"),l=co("dialog_input"),s=uo("list_scroller"),f=()=>{Tt(()=>{s()})},i=Z(()=>o.value-Ye-et-tt-20),r=F([]),u=F([]),p=F([]);F(0);const h=F(null),d=F({}),g=Z(()=>[].concat(r.value,u.value)),_=F(!0),y=q=>{},$=q=>{},B=q=>{st.error({content:q,position:"top"})},z=F(!1),S=q=>{const N=oo(n.value,q);u.value.pop(),u.value.push(N),z.value=!1,f()},L=async q=>{const N=q.text,Q=q.files;if(!N){B("请输入文字");return}const O=no(N,Q,n.value);d.value=O,u.value.push(d.value);const ee=so(n.value);u.value.push(ee),_.value=!1,l(),p.value=[],d.value=null,z.value=!0,f();const J=e.agent_id;if(h.value===null)try{const m=await Hs(J);if(m.code/1===200){const w=m.data;h.value=w.chat_id}else{S({message:`code: ${m.code} message: ${m.msg}`});return}}catch(m){console.log("err-nfsdnakiuwirea7",m),S({message:m.message});return}let x=null;if(Q.length!==0){const m=Ws(Q),w=h.value;try{const b=await Us(J,w,m);if(b.code/1===200){const A=b.data;Array.isArray(A)?x=A:x=[A]}else{S({message:`code: ${b.code}
  69. message: ${b.msg}`});return}}catch(b){console.log("err-fhskafhakfjslkfjl",b),S({message:b.message});return}}const k=Zs(N);Se(h.value,k)},H={onMessage:oe,onError:$e,onClose:Ae},{initWSConnection:M,sendWSMessage:xe,getWSInstance:we,closeWSConnect:ve}=Ns(H);function Se(q,N){M(e.agent_id,q,e.chat_type),xe(N)}function oe(q){const N=q.data,Q=u.value[u.value.length-1],O=ao(N,Q,n.value),ee=O.status,J=()=>{const x=O.data;u.value.pop(),u.value.push(x),f()};if(ee===1&&J(),ee===2){J();const x=O.suggest;x&&(p.value=x),z.value=!1}ee===3&&(J(),z.value=!1)}function $e(q){console.log("socket-error-8jfdksagjsfdjaklnfsdajkl",q),S({message:q.message})}function Ae(q){}return Le(()=>{const q=e.agent_id,N=e.session_id,Q=t.getInfo(q);if(Q){const O=Os(q);O?n.value={config:O,agent:Q}:n.value={config:{},agent:Q}}N&&Qs(q,N).then(O=>{if(O.code/1===200){const ee=O.data,J=to(ee,n.value);J.length!==0&&(_.value=!1,f()),r.value=J}}).catch(O=>{console.log(O)})}),Be(()=>{ve()}),(q,N)=>(v(),E("div",po,[C("div",fo,[D(Mt)]),C("div",ho,[D(Nt,{class:"conversation-chat-header",agent_info:n.value,style:fe({height:Ye+"px"})},null,8,["agent_info","style"]),C("div",go,[_.value?(v(),j(Qt,{key:0,class:"conversation-chat-area",agent_info:n.value},null,8,["agent_info"])):W("",!0),_.value?W("",!0):(v(),j(us,{key:1,ref:"list_scroller",class:"conversation-chat-area",height:i.value,agent_id:c.agent_id,list:g.value,suggestion:p.value,onShare:y,onSubmit:$},null,8,["height","agent_id","list","suggestion"])),D(Es,{ref:"dialog_input",class:"conversation-chat-input",style:fe({height:tt+"px"}),agent_info:n.value.agent,agent_config:n.value.config,disabled:z.value,onSubmit:L},null,8,["style","agent_info","agent_config","disabled"])]),D(Ls,{class:"conversation-chat-footer",style:fe({height:et+"px"})},null,8,["style"])],512),C("div",_o,[D(Ms)])]))}},ko=P(mo,[["__scopeId","data-v-d0d987c9"]]),Bo={__name:"ConversationQA",setup(c){const e=Rt(),t=It(),n=ot(),a=F(""),o=F(""),l=F(1),s=F(""),f=()=>{t.back()};async function i(r){if(!r)return!1;const u=n.getList();return u.length===0?!0:!!u.find(h=>h.id===r)}return Le(async()=>{const r=e.query,u=r.agent,p=r.session;if(u){if(!await i(u)){l.value=3,s.value="非法操作:参数异常";return}a.value=u,o.value=p,l.value=2,s.value="success"}else{const h=Et("DEFAULT_CHAT_AGENT_ID");a.value=h,l.value=2,s.value="success"}}),(r,u)=>{const p=te("a-button"),h=te("a-space"),d=te("a-result");return v(),j(Bt,null,{default:Y(()=>[D(zt,null,{default:Y(()=>[D(Lt),l.value===2?(v(),j(ko,{key:0,agent_id:a.value,session_id:o.value},null,8,["agent_id","session_id"])):W("",!0),l.value===3?(v(),j(d,{key:1,status:"error",title:s.value},{extra:Y(()=>[D(h,null,{default:Y(()=>[D(p,{type:"primary",onClick:f},{default:Y(()=>u[0]||(u[0]=[qt("返回")])),_:1})]),_:1})]),_:1},8,["title"])):W("",!0)]),_:1})]),_:1})}}};export{Bo as default};