ConversationQA-C3-2H5EB.js 74 KB

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