rt-chat-messages 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-messages.es.js +630 -618
- package/dist/chat-messages.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(D,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("a2ui-vue"),require("markdown-it"),require("@vscode/markdown-it-katex"),require("mermaid")):typeof define=="function"&&define.amd?define(["exports","vue","a2ui-vue","markdown-it","@vscode/markdown-it-katex","mermaid"],e):(D=typeof globalThis<"u"?globalThis:D||self,e(D.ChatMessages={},D.Vue,D.A2UIVue,D.markdownit,D.markdownItKatex,D.mermaid))})(this,(function(D,e,ie,$e,Ie,be){"use strict";const ze={class:"cm-dialog__body"},Le=e.defineComponent({__name:"Dialog",props:{visible:{type:Boolean,default:!1},width:{default:"50%"},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},appendToBody:{type:Boolean,default:!0}},emits:["update:visible","close"],setup(l,{emit:h}){const w=l,y=h,m=e.ref(!1);e.onMounted(()=>{m.value=!0});const M=e.computed(()=>w.fullscreen?{width:"100%",height:"100%",margin:0}:{width:w.width}),B=()=>{y("update:visible",!1),y("close")},S=()=>{w.closeOnClickModal&&B()};return(v,A)=>m.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:"body"},[l.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["cm-dialog-overlay",{"is-fullscreen":l.fullscreen}]),onClick:e.withModifiers(S,["self"])},[e.createElementVNode("div",{class:"cm-dialog",style:e.normalizeStyle(M.value),role:"dialog","aria-modal":"true"},[e.createElementVNode("div",ze,[e.renderSlot(v.$slots,"default",{},void 0,!0)]),l.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cm-dialog__close",onClick:B},[...A[0]||(A[0]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})],-1)])])):e.createCommentVNode("",!0)],4)],2)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}),ce=(l,h)=>{const w=l.__vccOpts||l;for(const[y,m]of h)w[y]=m;return w},Ce=ce(Le,[["__scopeId","data-v-efdf0259"]]),Te=["disabled"],Ue={key:0,class:"cm-icon-loading"},P=ce(e.defineComponent({__name:"Button",props:{type:{default:"default"},size:{default:"default"},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(l,{emit:h}){const w=l,y=h,m=M=>{w.disabled||w.loading||y("click",M)};return(M,B)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["cm-button",[`cm-button--${l.type}`,`cm-button--${l.size}`,{"is-circle":l.circle,"is-disabled":l.disabled,"is-loading":l.loading}]]),disabled:l.disabled||l.loading,onClick:m},[l.loading?(e.openBlock(),e.createElementBlock("span",Ue,[...B[0]||(B[0]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"})],-1)])])):e.renderSlot(M.$slots,"default",{key:1},void 0,!0)],10,Te))}}),[["__scopeId","data-v-bab126c7"]]),O=(l,h)=>e.defineComponent({name:l,render(){return e.h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor",style:"vertical-align: middle"},[e.h("path",{d:h})])}}),me=O("Close","M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"),Ve=O("ZoomIn","M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm268.48-154.56a32 32 0 0 0-32 32v90.496h-90.56a32 32 0 0 0 0 64h90.56v90.56a32 32 0 0 0 64 0v-90.496h90.496a32 32 0 0 0 0-64H373.632v-90.56a32 32 0 0 0-32-32z"),Ne=O("ZoomOut","M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm145.92-58.56a32 32 0 0 0 0 64h245.12a32 32 0 0 0 0-64H219.072z"),De=O("Document","M854.6 288.7c0.4 0 0.7 0 1 0v431.5c0 17.6-14.4 32-32 32H200.4c-17.6 0-32-14.4-32-32l0-575.2c0-17.6 14.4-32 32-32h391.5c0 0.3 0 0.7 0 1l0 142.1c0 17.6 14.4 32.1 32 32.1h142.6c0-0.4 0-0.7 0-1.1L854.6 288.7zM790.2 220.2L668 97.9v122.3h122.2zM240 448h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h384a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64z"),_e=O("Download","M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2 0.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"),He=O("VideoPlay","M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-48-247.616L668.608 512 464 375.616v272.768zm10.656-340.32a32 32 0 0 1 32 32V673.92a32 32 0 0 1-50.208 26.24l-236.8-161.92a32 32 0 0 1 0-52.48l236.8-161.92a32 32 0 0 1 18.208-5.632z"),Pe=O("VideoPause","M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-96-544a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm192 0a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32z"),Re=O("ArrowLeft","M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"),Fe=O("ArrowRight","M340.864 149.312a29.12 29.12 0 0 0-41.728 0 30.592 30.592 0 0 0 0 42.752L611.072 511.936 299.136 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L672.448 534.272a32 32 0 0 0 0-44.672L340.864 149.312z"),xe=O("Spinner","M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"),ve=O("Check","M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"),Oe=O("ChevronUp","M854.6 642.5l-320-320c-12.5-12.5-32.8-12.5-45.3 0l-320 320c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L512 390.6l297.4 297.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3z"),We=O("ChevronDown","M854.6 381.5l-320 320c-12.5 12.5-32.8 12.5-45.3 0l-320-320c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L512 633.4l297.4-297.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3z"),je=["src","alt"],Ye={class:"preview-controls"},qe={class:"cm-button-group"},Xe={key:0,class:"mobile-close-hint"},Ze=["innerHTML"],Ke={class:"preview-controls"},Je={class:"cm-button-group"},Ge={key:0,class:"mobile-close-hint"},Me=ce(e.defineComponent({__name:"MarkdownMessage",props:{content:{},isStreaming:{type:Boolean,default:!1}},setup(l){const h=l,w=e.ref(),y=e.ref(),m=e.ref(!1),M=e.ref(""),B=e.ref(""),S=e.ref(!1),v=e.ref(""),A=e.ref(!1),k=e.ref(1),z=e.ref({x:0,y:0}),V=e.ref(!1),I=e.ref({x:0,y:0}),E=e.ref(1),T=e.ref({x:0,y:0}),C=e.ref(!1),re=e.ref({x:0,y:0}),N=e.ref(""),J=e.ref(new Map),te=e.ref(!1);let le=0;be.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"});const ue=o=>{const r=o.renderer.rules.fence;o.renderer.rules.fence=(c,p,d,t,n)=>{const a=c[p],s=a.content.trim();return(a.info?a.info.trim():"")==="mermaid"?(le++,`<div class="mermaid-container"><pre class="mermaid" data-mermaid-id="${`mermaid-${Date.now()}-${le}`}">${s}</pre></div>`):r(c,p,d,t,n)}},H=new $e({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,quotes:`""''`,highlight:function(o,r){return r&&r.trim()?`<pre class="hljs language-${r}"><code>${(p=>p.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"))(o)}</code></pre>`:`<pre class="hljs"><code>${o}</code></pre>`}}),Y=H.renderer.rules.image||function(o,r,c,p,d){return d.renderToken(o,r,c)};H.renderer.rules.image=function(o,r,c,p,d){const t=o[r],n=t.attrIndex("src");if(n>=0){const a=t.attrs[n][1],u="img-"+(_=>{let $=0;for(let U=0;U<_.length;U++){const se=_.charCodeAt(U);$=($<<5)-$+se,$=$&$}return Math.abs($).toString(36)})(a);t.attrSet("id",u),t.attrSet("data-image-id",u),t.attrSet("key",u),t.attrSet("loading","eager"),t.attrSet("decoding","async"),t.attrSet("fetchpriority","high"),t.attrSet("data-src",a),t.attrSet("data-cached","true")}return Y(o,r,c,p,d)},H.use(Ie,{throwOnError:!1,errorColor:"#cc0000"}),H.use(ue);const R=o=>{const r=o.match(/```[\w]*\n/g),c=o.match(/\n```/g),p=(r==null?void 0:r.length)||0,d=(c==null?void 0:c.length)||0;return p>d&&(o+="\n```"),o},x=o=>{if(!o)return"";o=o.replace(/;;\s*$/g,""),o=o.replace(/;;\s*$/g,"");const r=/^```(?:markdown|md)\s*\n([\s\S]*?)\n```$/,c=o.match(r);if(c)o=c[1];else{const p=/^```\s*\n([\s\S]*?)\n```$/,d=o.match(p);if(d){const t=d[1];(/^#{1,6}\s/.test(t)||/^\*{1,2}[^*]+\*{1,2}/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/!\[.*?\]\(.*?\)/.test(t)||/\[.*?\]\(.*?\)/.test(t)||/^\|.+\|/.test(t)||/^\|[\s-:]+\|/m.test(t))&&(o=t)}}if(h.isStreaming){const p=/^```(?:markdown|md)?\s*\n/;if(p.test(o)){const t=o.replace(p,"");(/^#{1,6}\s/.test(t)||/^\|.+\|/.test(t)||/^\|[\s-:]+\|/m.test(t)||/!\[.*?\]\(.*?\)/.test(t)||/\[.*?\]\(.*?\)/.test(t))&&(o=o.replace(p,""))}if(/^```(?:markdown|md)?\s*\n/.test(h.content)){const t=/\n```\s*$/;t.test(o)&&(o=o.replace(t,""))}}return o=o.replace(/```(?:markdown|md)\s*\n([\s\S]*?)\n```/g,(p,d)=>d),h.isStreaming&&(o=R(o)),o},q=o=>{if(!o.includes("<img"))return o;const r=/<img[^>]*?src="([^"]*)"[^>]*?>/g;let c,p=o;const d=[];for(;(c=r.exec(o))!==null;){const t=c[0],n=c[1];if(J.value.has(n)){const a=J.value.get(n);t!==a&&d.push({original:t,cached:a})}else J.value.set(n,t)}for(const{original:t,cached:n}of d)p=p.replace(t,n);return p},fe=o=>{if(!y.value)return;const r=y.value,c=new Map;if(h.isStreaming&&r.children.length>0&&r.querySelectorAll("img[data-image-id]").forEach(p=>{const d=p.getAttribute("data-image-id");d&&c.set(d,p)}),r.innerHTML=o,!h.isStreaming){e.nextTick(()=>{Ee(),g()});return}c.size>0&&r.querySelectorAll("img[data-image-id]").forEach(p=>{const d=p.getAttribute("data-image-id");if(d&&c.has(d)){const t=c.get(d);p.parentNode&&t!==p&&p.parentNode.replaceChild(t,p)}})},W=()=>{try{if(!h.content){N.value="",y.value&&(y.value.innerHTML=""),h.isStreaming||J.value.clear();return}if(document.hidden&&h.isStreaming){te.value=!0;return}const o=x(h.content);let r=H.render(o);h.isStreaming&&r.includes("<img")&&(r=q(r)),r!==N.value&&(N.value=r,fe(r)),h.isStreaming||J.value.clear()}catch(o){console.error("Markdown rendering error:",o),y.value&&(y.value.innerHTML=`<pre style="white-space: pre-wrap; word-wrap: break-word;">${h.content}</pre>`)}};e.watch(()=>h.content,W),e.watch(()=>h.isStreaming,(o,r)=>{r&&!o&&e.nextTick(()=>{W()})});const j=()=>{!document.hidden&&te.value&&(te.value=!1,e.nextTick(()=>{W()}))};document.addEventListener("visibilitychange",j),e.onUnmounted(()=>{document.removeEventListener("visibilitychange",j)});const i=()=>{A.value=window.innerWidth<768},f=o=>{let r=o;return r=r.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1"),[/([A-Za-z0-9_]+)\[([^\]]*[\u4e00-\u9fa5]+[^\]]*)\]/g,/([A-Za-z0-9_]+)\(([^)]*[\u4e00-\u9fa5]+[^)]*)\)/g,/([A-Za-z0-9_]+)\{([^}]*[\u4e00-\u9fa5]+[^}]*)\}/g].forEach(p=>{r=r.replace(p,(d,t,n)=>{if(n.startsWith('"')&&n.endsWith('"'))return d;let a=n.replace(/^["']+|["']+$/g,"").replace(/["]/g,'\\"');return d.includes("[")?`${t}["${a}"]`:d.includes("(")?`${t}("${a}")`:d.includes("{")?`${t}{"${a}"}`:d})}),r},g=async()=>{var r,c;if(h.isStreaming||(await e.nextTick(),!w.value))return;const o=w.value.querySelectorAll(".mermaid");if(o.length!==0)for(const p of Array.from(o)){const d=p;let t=(r=d.textContent)==null?void 0:r.trim();if(t&&d.getAttribute("data-processed")!=="true")try{d.setAttribute("data-processed","true"),t=f(t);const n=d.getAttribute("data-mermaid-id")||`mermaid-${Date.now()}-${Math.random()}`,{svg:a}=await be.render(n,t),s=d.parentElement;if(s){const u=document.createElement("div");u.className="mermaid-svg",u.innerHTML=a,u.setAttribute("data-mermaid-svg","true"),u.style.cursor="pointer",u.title="Click to zoom",u.addEventListener("click",_=>{_.preventDefault(),_.stopPropagation(),v.value=a,E.value=1,T.value={x:0,y:0},S.value=!0}),s.replaceChild(u,d)}}catch(n){console.error("Mermaid render failure:",n);const a=document.createElement("div");a.className="mermaid-error",a.textContent=`Mermaid render error: ${n}`,(c=d.parentElement)==null||c.replaceChild(a,d)}}},b=o=>{o.preventDefault(),o.stopPropagation();const r=o.target;M.value=r.src,B.value=r.alt||"Image Preview",k.value=1,z.value={x:0,y:0},m.value=!0},L=()=>{k.value<=1&&(z.value={x:0,y:0})},ne=()=>{k.value=Math.min(k.value+1,10),L()},ae=()=>{k.value=Math.max(k.value-1,.5),L()},G=()=>{k.value=1,z.value={x:0,y:0}},pe=()=>{k.value<=1&&(m.value=!1)},X=o=>{o.preventDefault();const r=o.deltaY>0?-.5:.5,c=Math.max(.5,Math.min(10,k.value+r));k.value=c,L()},Z=o=>{var t;if(k.value<=1)return;o.preventDefault(),V.value=!0,I.value={x:o.clientX-z.value.x,y:o.clientY-z.value.y};const r=o.target,c=(t=r.parentElement)==null?void 0:t.getBoundingClientRect(),p=n=>{if(!V.value||!c)return;let a=n.clientX-I.value.x,s=n.clientY-I.value.y;const u=r.offsetWidth,_=r.offsetHeight,$=u*k.value,U=_*k.value,se=.3,Se=c.width*(1-se-.5)-$/2,he=$/2-c.width*(1-se-.5),ye=c.height*(1-se-.5)-U/2,de=U/2-c.height*(1-se-.5);$>c.width?a=Math.max(Se,Math.min(he,a)):a=0,U>c.height?s=Math.max(ye,Math.min(de,s)):s=0,z.value={x:a,y:s}},d=()=>{V.value=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",d)},K=o=>{var s;if(o.touches.length!==1)return;const r=o.touches[0],c=r.clientX,p=r.clientY;if(k.value<=1)return;V.value=!0,I.value={x:c-z.value.x,y:p-z.value.y};const d=o.target,t=(s=d.parentElement)==null?void 0:s.getBoundingClientRect(),n=u=>{if(!V.value||u.touches.length!==1||!t)return;const _=u.touches[0];let $=_.clientX-I.value.x,U=_.clientY-I.value.y;const se=d.offsetWidth,Se=d.offsetHeight,he=se*k.value,ye=Se*k.value,de=.3,on=t.width*(1-de-.5)-he/2,sn=he/2-t.width*(1-de-.5),rn=t.height*(1-de-.5)-ye/2,ln=ye/2-t.height*(1-de-.5);he>t.width?$=Math.max(on,Math.min(sn,$)):$=0,ye>t.height?U=Math.max(rn,Math.min(ln,U)):U=0,z.value={x:$,y:U}},a=()=>{V.value=!1,document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a)};document.addEventListener("touchmove",n,{passive:!1}),document.addEventListener("touchend",a)},F=()=>{E.value=Math.min(E.value+1,10)},ge=()=>{E.value=Math.max(E.value-1,.5)},Q=()=>{E.value=1,T.value={x:0,y:0}},oe=o=>{o.preventDefault();const r=o.deltaY>0?-.5:.5;E.value=Math.max(.5,Math.min(10,E.value+r))},we=o=>{var t,n;if(E.value<=1)return;o.preventDefault(),C.value=!0,re.value={x:o.clientX-T.value.x,y:o.clientY-T.value.y};const c=(n=(t=o.target.closest(".mermaid-preview-content"))==null?void 0:t.parentElement)==null?void 0:n.getBoundingClientRect(),p=a=>{if(!C.value||!c)return;let s=a.clientX-re.value.x,u=a.clientY-re.value.y;T.value={x:s,y:u}},d=()=>{C.value=!1,document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",p),document.addEventListener("mouseup",d)},ee=o=>{},Ee=()=>{h.isStreaming||e.nextTick(()=>{if(!w.value)return;w.value.querySelectorAll(".markdown-content img").forEach(r=>{const c=r;c.getAttribute("data-processed")!=="true"&&(c.setAttribute("data-processed","true"),c.style.cursor="pointer",c.addEventListener("click",b))})})};return e.onMounted(()=>{i(),window.addEventListener("resize",i),W(),Ee(),g()}),e.onUnmounted(()=>{w.value&&w.value.querySelectorAll(".markdown-content img").forEach(r=>{r.removeEventListener("click",b)})}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:"markdown-message",ref_key:"markdownContainer",ref:w},[e.createElementVNode("div",{ref_key:"markdownContent",ref:y,class:"markdown-content"},null,512),e.createVNode(Ce,{visible:m.value,"onUpdate:visible":r[2]||(r[2]=c=>m.value=c),width:A.value?"95vw":"80vw",fullscreen:A.value,class:"image-preview-dialog","close-on-click-modal":!1,"append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"image-preview-container",onClick:r[1]||(r[1]=e.withModifiers(c=>m.value=!1,["self"]))},[e.createElementVNode("img",{src:M.value,alt:B.value,class:"preview-image",style:e.normalizeStyle({transform:`translate(${z.value.x}px, ${z.value.y}px) scale(${k.value})`}),onWheel:e.withModifiers(X,["prevent"]),onDblclick:G,onMousedown:Z,onTouchstart:e.withModifiers(K,["prevent"]),onClick:pe},null,44,je),e.createElementVNode("div",Ye,[e.createElementVNode("div",qe,[e.createVNode(P,{size:"small",onClick:ae,disabled:k.value<=.5},{default:e.withCtx(()=>[e.createVNode(e.unref(Ne))]),_:1},8,["disabled"]),e.createVNode(P,{size:"small",onClick:G},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Math.round(k.value*100))+"% ",1)]),_:1}),e.createVNode(P,{size:"small",onClick:ne,disabled:k.value>=10},{default:e.withCtx(()=>[e.createVNode(e.unref(Ve))]),_:1},8,["disabled"])]),e.createVNode(P,{size:"small",onClick:r[0]||(r[0]=c=>m.value=!1),type:"danger"},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})]),A.value?(e.openBlock(),e.createElementBlock("div",Xe,"双击重置 · 轻触关闭")):e.createCommentVNode("",!0)])]),_:1},8,["visible","width","fullscreen"]),e.createVNode(Ce,{visible:S.value,"onUpdate:visible":r[5]||(r[5]=c=>S.value=c),width:A.value?"95vw":"90vw",fullscreen:A.value,class:"mermaid-preview-dialog","close-on-click-modal":!1,"append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"mermaid-preview-container",onClick:r[4]||(r[4]=e.withModifiers(c=>S.value=!1,["self"]))},[e.createElementVNode("div",{class:"mermaid-preview-content",innerHTML:v.value,style:e.normalizeStyle({transform:`translate(${T.value.x}px, ${T.value.y}px) scale(${E.value})`}),onWheel:e.withModifiers(oe,["prevent"]),onDblclick:Q,onMousedown:we,onTouchstart:e.withModifiers(ee,["prevent"])},null,44,Ze),e.createElementVNode("div",Ke,[e.createElementVNode("div",Je,[e.createVNode(P,{size:"small",onClick:ge,disabled:E.value<=.5},{default:e.withCtx(()=>[e.createVNode(e.unref(Ne))]),_:1},8,["disabled"]),e.createVNode(P,{size:"small",onClick:Q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Math.round(E.value*100))+"% ",1)]),_:1}),e.createVNode(P,{size:"small",onClick:F,disabled:E.value>=10},{default:e.withCtx(()=>[e.createVNode(e.unref(Ve))]),_:1},8,["disabled"])]),e.createVNode(P,{size:"small",onClick:r[3]||(r[3]=c=>S.value=!1),type:"danger"},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})]),A.value?(e.openBlock(),e.createElementBlock("div",Ge,"双击重置 · 轻触关闭")):e.createCommentVNode("",!0)])]),_:1},8,["visible","width","fullscreen"])],512))}}),[["__scopeId","data-v-c6385dde"]]),Qe={key:0,class:"text-content"},et={key:1,class:"images-content"},tt=["onClick"],nt=["src","alt","onError"],at={key:0,class:"more-images"},ot={key:2,class:"files-content"},st=["onClick"],rt={class:"file-icon-wrapper-small"},lt=["title"],it={class:"file-name"},ct={class:"file-type"},dt={class:"file-actions"},mt={key:3,class:"audio-content"},ut={class:"audio-player"},ft={class:"audio-info"},pt={class:"audio-progress"},gt={class:"progress-bar"},ht={class:"audio-time"},yt={class:"image-preview-container"},kt=["src"],wt={key:0,class:"image-nav"},Et={class:"image-counter"},ke=ce(e.defineComponent({__name:"MultimodalMessage",props:{message:{},isUser:{type:Boolean,default:!1},isStreaming:{type:Boolean,default:!1},apiBaseUrl:{default:""},onDownload:{}},setup(l){const h=l,w=e.computed(()=>{try{return h.message.metadata?JSON.parse(h.message.metadata):{}}catch{return{}}}),y=e.computed(()=>w.value.imageUrls||[]),m=e.computed(()=>w.value.audioUrl),M=e.ref(new Set),B=e.computed(()=>w.value.fileUrls||[]),S=e.computed(()=>B.value),v=e.computed(()=>h.message.attachments&&h.message.attachments.length>0?h.message.attachments:w.value.attachments&&Array.isArray(w.value.attachments)?w.value.attachments:[]),A=e.computed(()=>{const i=[];return v.value&&v.value.length>0?v.value.forEach(f=>{var b,L;((b=f.type)==null?void 0:b.startsWith("image/"))||((L=f.name)==null?void 0:L.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)$/i))||i.push({url:f.url||f.download_url||f.file_url||"",name:f.original_name||f.name||"Unknown File",type:Y(f.original_name||f.name||"Unknown File")})}):S.value&&S.value.length>0&&S.value.forEach(f=>{i.push({url:f,name:H(f),type:Y(f)})}),i}),k=e.ref(!1),z=e.ref(""),V=e.ref(0),I=e.ref(!1),E=e.ref(!1),T=e.ref(0),C=e.ref(0),re=e.computed(()=>C.value>0?T.value/C.value*100:0);let N=null;const J=(i,f)=>{z.value=i,V.value=f,k.value=!0},te=()=>{V.value>0&&(V.value--,z.value=y.value[V.value])},le=()=>{V.value<y.value.length-1&&(V.value++,z.value=y.value[V.value])},ue=(i,f)=>{console.error("Image load failed:",f);const g=i.target;g.style.display="none"},H=i=>{if(!i)return"Unknown File";if(!i.includes("/"))return decodeURIComponent(i)||"Unknown File";try{const f=i.lastIndexOf("/"),g=f>=0?i.substring(f+1):i;return decodeURIComponent(g)||"Unknown File"}catch{return"Unknown File"}},Y=i=>{var b;return((b=H(i).split(".").pop())==null?void 0:b.toUpperCase())||"FILE"},R=(i,f)=>{q(i,f)},x=i=>!i||i.startsWith("http://")||i.startsWith("https://")||i.startsWith("blob:")?i:(h.apiBaseUrl?h.apiBaseUrl.replace(/\/$/,""):"")+(i.startsWith("/")?i:"/"+i),q=async(i,f)=>{try{const g=x(i);if(console.log("正在下载文件...",g),h.onDownload&&(M.value=new Set([...M.value,i]),await h.onDownload(i,f)!==!1)){const F=new Set(M.value);F.delete(i),M.value=F;return}M.value=new Set([...M.value,i]);const b=localStorage.getItem("token"),L={};if(b&&(L.Authorization=b.startsWith("Bearer ")?b:`Bearer ${b}`),typeof window<"u"&&typeof window.plus<"u"){const K=window.plus,F=K.downloader.createDownload(g,{method:"GET",filename:"_downloads/"+(f||H(i))},(ge,Q)=>{const oe=new Set(M.value);oe.delete(i),M.value=oe,Q===200||Q===206?K.runtime.openFile(ge.filename):console.error("App 环境原生下载失败, status:",Q)});L.Authorization&&F.setRequestHeader("Authorization",L.Authorization),F.start();return}const ne=await fetch(g,{headers:L});if(!ne.ok)throw new Error(`下载失败: ${ne.status}`);let ae=f;const G=ne.headers.get("Content-Disposition");if(G){const K=G.match(/filename\*=UTF-8''(.+)/i);if(K)ae=decodeURIComponent(K[1]);else{const F=G.match(/filename="?([^";\n]+)"?/i);F&&(ae=F[1])}}const pe=await ne.blob(),X=URL.createObjectURL(pe),Z=document.createElement("a");Z.href=X,Z.download=ae||f||H(i),document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL(X)}catch(g){console.error("下载文件失败:",g)}finally{const g=new Set(M.value);g.delete(i),M.value=g}},fe=async()=>{if(m.value)try{N||(N=new Audio,N.src=x(m.value),N.addEventListener("loadedmetadata",()=>{C.value=(N==null?void 0:N.duration)||0}),N.addEventListener("timeupdate",()=>{T.value=(N==null?void 0:N.currentTime)||0}),N.addEventListener("ended",()=>{I.value=!1,T.value=0}),N.addEventListener("error",i=>{console.error("Audio playback error:",i),E.value=!1,I.value=!1})),I.value?(N.pause(),I.value=!1):(E.value=!0,await N.play(),I.value=!0,E.value=!1)}catch(i){console.error("Audio playback failed:",i),E.value=!1,I.value=!1}},W=i=>{const f=Math.floor(i/60),g=Math.floor(i%60);return`${f}:${g.toString().padStart(2,"0")}`},j=i=>{k.value&&(i.key==="ArrowLeft"?te():i.key==="ArrowRight"?le():i.key==="Escape"&&(k.value=!1))};return e.watch(k,i=>{i?document.addEventListener("keydown",j):document.removeEventListener("keydown",j)}),e.onUnmounted(()=>{N&&(N.pause(),N=null),document.removeEventListener("keydown",j)}),(i,f)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["multimodal-message",{"is-user":l.isUser,"is-assistant":!l.isUser}])},[l.message.content?(e.openBlock(),e.createElementBlock("div",Qe,[e.createVNode(Me,{content:l.message.content,"is-streaming":l.isStreaming},null,8,["content","is-streaming"])])):e.createCommentVNode("",!0),y.value&&y.value.length>0?(e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",{class:e.normalizeClass(["images-grid",`grid-${Math.min(y.value.length,4)}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value.slice(0,4),(g,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"image-item",onClick:L=>J(g,b)},[e.createElementVNode("img",{src:g,alt:`图片 ${b+1}`,onError:L=>ue(L,g),loading:"lazy"},null,40,nt),b===3&&y.value.length>4?(e.openBlock(),e.createElementBlock("div",at," +"+e.toDisplayString(y.value.length-4),1)):e.createCommentVNode("",!0)],8,tt))),128))],2)])):e.createCommentVNode("",!0),A.value&&A.value.length>0?(e.openBlock(),e.createElementBlock("div",ot,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,(g,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"file-item",onClick:L=>R(g.url,g.name)},[e.createElementVNode("div",rt,[e.createVNode(e.unref(De),{class:"file-icon"})]),e.createElementVNode("div",{class:"file-info",title:g.name},[e.createElementVNode("span",it,e.toDisplayString(g.name),1),e.createElementVNode("span",ct,e.toDisplayString(g.type),1)],8,lt),e.createElementVNode("div",dt,[e.createVNode(P,{size:"small",type:"text",disabled:M.value.has(g.url),onClick:e.withModifiers(L=>q(g.url,g.name),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(_e),{class:e.normalizeClass({"icon-spin":M.value.has(g.url)})},null,8,["class"])]),_:2},1032,["disabled","onClick"])])],8,st))),128))])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ut,[e.createVNode(P,{onClick:fe,loading:E.value,circle:"",size:"small",class:"play-btn"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(I.value?e.unref(Pe):e.unref(He))))]),_:1},8,["loading"]),e.createElementVNode("div",ft,[e.createElementVNode("div",pt,[e.createElementVNode("div",gt,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:re.value+"%"})},null,4)])]),e.createElementVNode("div",ht,[e.createElementVNode("span",null,e.toDisplayString(W(T.value)),1),f[4]||(f[4]=e.createElementVNode("span",null,"/",-1)),e.createElementVNode("span",null,e.toDisplayString(W(C.value)),1)])]),e.createVNode(P,{onClick:f[0]||(f[0]=g=>q(m.value)),size:"small",type:"text",class:"download-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(_e))]),_:1})])])):e.createCommentVNode("",!0),e.createVNode(Ce,{visible:k.value,"onUpdate:visible":f[3]||(f[3]=g=>k.value=g),width:"90%","show-close":!1,"append-to-body":"",class:"image-preview-dialog-wrapper"},{default:e.withCtx(()=>[e.createElementVNode("div",yt,[e.createElementVNode("img",{src:z.value,alt:"预览图片",class:"preview-image",onClick:f[1]||(f[1]=g=>k.value=!1)},null,8,kt),y.value&&y.value.length>1?(e.openBlock(),e.createElementBlock("div",wt,[e.createVNode(P,{onClick:te,disabled:V.value===0,circle:"",class:"nav-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re))]),_:1},8,["disabled"]),e.createElementVNode("span",Et,e.toDisplayString(V.value+1)+" / "+e.toDisplayString(y.value.length),1),e.createVNode(P,{onClick:le,disabled:V.value===y.value.length-1,circle:"",class:"nav-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe))]),_:1},8,["disabled"])])):e.createCommentVNode("",!0),e.createVNode(P,{onClick:f[2]||(f[2]=g=>k.value=!1),class:"close-btn",circle:""},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})])]),_:1},8,["visible"])],2))}}),[["__scopeId","data-v-96cd8b34"]]),Ct=["aria-expanded"],Mt={class:"steps-indicator"},Bt={key:0,class:"icon-running"},St={key:1,class:"icon-error"},bt={key:2,class:"icon-completed"},Vt={class:"steps-copy"},Nt={class:"steps-summary"},_t={class:"steps-meta"},xt={class:"steps-count"},vt={class:"icon-chevron"},At={class:"steps-progress","aria-hidden":"true"},$t={class:"steps-list"},It={class:"step-rail","aria-hidden":"true"},zt={class:"step-icon"},Lt={key:3,class:"icon-dot"},Tt={class:"step-name"},Ut={class:"step-status"},Be=ce(e.defineComponent({__name:"AgentSteps",props:{steps:{}},emits:["resize"],setup(l,{emit:h}){const w=l,y=e.ref(!0),m=h,M=()=>{y.value=!y.value,e.nextTick(()=>{requestAnimationFrame(()=>m("resize"))})},B=e.computed(()=>w.steps.some(E=>E.status==="running")),S=e.computed(()=>w.steps.some(E=>E.status==="error")),v=e.computed(()=>w.steps.filter(E=>E.status==="completed").length),A=e.computed(()=>w.steps.length===0?0:Math.round(v.value/w.steps.length*100)),k=e.computed(()=>({width:`${A.value}%`})),z=e.computed(()=>B.value?"智能处理流程":S.value?"需要关注":"全部步骤已同步"),V=e.computed(()=>{const E=w.steps.find(T=>T.status==="running");return E?`正在处理 ${E.displayName}`:S.value?"处理遇到问题":v.value===w.steps.length?"处理完成":`已完成 ${v.value}/${w.steps.length} 个步骤`}),I=E=>E==="running"?"进行中":E==="error"?"异常":"完成";return(E,T)=>l.steps.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["agent-steps",{"is-running":B.value,"is-error":S.value,"is-collapsed":!y.value}])},[e.createElementVNode("button",{type:"button",class:"steps-header","aria-expanded":y.value,onClick:M},[e.createElementVNode("span",Mt,[B.value?(e.openBlock(),e.createElementBlock("span",Bt,[e.createVNode(e.unref(xe))])):S.value?(e.openBlock(),e.createElementBlock("span",St,[e.createVNode(e.unref(me))])):(e.openBlock(),e.createElementBlock("span",bt,[e.createVNode(e.unref(ve))]))]),e.createElementVNode("span",Vt,[e.createElementVNode("span",Nt,e.toDisplayString(V.value),1),e.createElementVNode("span",_t,e.toDisplayString(z.value),1)]),e.createElementVNode("span",xt,e.toDisplayString(v.value)+"/"+e.toDisplayString(l.steps.length),1),e.createElementVNode("span",vt,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value?e.unref(Oe):e.unref(We))))])],8,Ct),e.createElementVNode("div",At,[e.createElementVNode("span",{style:e.normalizeStyle(k.value)},null,4)]),e.withDirectives(e.createElementVNode("div",$t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.steps,C=>(e.openBlock(),e.createElementBlock("div",{key:C.name,class:e.normalizeClass(["step-item",{"is-running":C.status==="running","is-completed":C.status==="completed","is-error":C.status==="error"}])},[e.createElementVNode("span",It,[e.createElementVNode("span",zt,[C.status==="running"?(e.openBlock(),e.createBlock(e.unref(xe),{key:0,class:"icon-spin"})):C.status==="completed"?(e.openBlock(),e.createBlock(e.unref(ve),{key:1})):C.status==="error"?(e.openBlock(),e.createBlock(e.unref(me),{key:2})):(e.openBlock(),e.createElementBlock("span",Lt))])]),e.createElementVNode("span",Tt,e.toDisplayString(C.displayName),1),e.createElementVNode("span",Ut,e.toDisplayString(I(C.status)),1)],2))),128))],512),[[e.vShow,y.value]])],2)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-5030f19a"]]),Dt={class:"chat-message-list-root"},Ht={key:0,class:"bg-grid"},Pt={key:0,class:"welcome-screen"},Rt={class:"welcome-content"},Ft={class:"welcome-logo"},Ot=["src"],Wt={key:1,class:"default-logo"},jt={class:"welcome-title"},Yt={key:1,class:"messages-container"},qt={key:0,class:"user-message-wrapper"},Xt={class:"message-bubble user-bubble"},Zt={key:0,class:"message-actions user-actions"},Kt=["onClick"],Jt={key:1,class:"message-content assistant-content"},Gt={key:2,class:"a2ui-card-skeleton","aria-hidden":"true"},Qt={key:1,class:"message-actions"},en=["onClick"],tn={key:0,class:"message-row message-assistant"},nn={key:0,class:"loading-ring",viewBox:"0 0 36 36"},Ae=ce(e.defineComponent({__name:"ChatMessageList",props:{messages:{default:()=>[]},isStreaming:{type:Boolean,default:!1},isTyping:{type:Boolean,default:!1},showWelcome:{type:Boolean,default:!0},appName:{default:"AI助手"},appLogo:{},agentSteps:{},showAgentSteps:{type:Boolean,default:!0},autoScroll:{type:Boolean,default:!0},contentPaddingTop:{default:"80px"},contentPaddingBottom:{default:"140px"},showBackground:{type:Boolean,default:!0},apiBaseUrl:{default:""},enableA2UI:{type:Boolean,default:!0},autoProvideA2UI:{type:Boolean,default:!0},a2uiCatalog:{},hideA2UIRawContent:{type:Boolean,default:!0},showA2UISkeleton:{type:Boolean,default:!0},a2uiActionHandler:{}},emits:["copy","scroll","scroll-bottom","a2ui-action","a2ui-error"],setup(l,{expose:h,emit:w}){const y=new WeakMap,m=l,M=w,B=e.ref(null),S=e.ref(!1),v=e.ref(!0),A=e.ref({}),k=e.ref({});(()=>{var a;if(!m.autoProvideA2UI)return;if(!m.a2uiCatalog)try{ie.useA2UIConfig();return}catch{}const t=(a=e.getCurrentInstance())==null?void 0:a.appContext.app,n=m.a2uiCatalog||ie.DEFAULT_CATALOG;!t||y.get(t)===n||(ie.provideA2UI({app:t,catalog:n,theme:ie.defaultTheme}),y.set(t,n))})();const V=ie.useMessageProcessor(),I=()=>{if(!B.value)return!0;const{scrollTop:t,scrollHeight:n,clientHeight:a}=B.value;return n-t-a<50},E=()=>{v.value=I()},T=t=>{var a,s;return!t||typeof t!="object"||t.version!=="v0.9"||[t.createSurface,t.updateComponents,t.updateDataModel,t.deleteSurface].filter(Boolean).length!==1?!1:t.createSurface?re(t.createSurface):t.updateComponents?ue(t.updateComponents):t.updateDataModel?typeof((a=C(t.updateDataModel))==null?void 0:a.surfaceId)=="string":t.deleteSurface?typeof((s=C(t.deleteSurface))==null?void 0:s.surfaceId)=="string":!1},C=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:null,re=t=>{const n=C(t);if(!n)return!1;const a=Object.keys(n);return typeof n.surfaceId=="string"&&typeof n.catalogId=="string"&&a.every(s=>s==="surfaceId"||s==="catalogId")},N=t=>Array.isArray(t)?t.every(n=>{const a=C(n);return!!(a&&typeof a.label=="string"&&typeof a.value=="string")}):!1,J=t=>Array.isArray(t)&&t.every(n=>typeof n=="string"),te=t=>Array.isArray(t)?t.every(n=>{const a=C(n);return!!(a&&typeof a.label=="string"&&typeof a.value=="string")}):!1,le=t=>{const n=C(t);return!(!n||typeof n.id!="string"||typeof n.component!="string"||Object.prototype.hasOwnProperty.call(n,"props")||Object.prototype.hasOwnProperty.call(n,"componentType")||Object.prototype.hasOwnProperty.call(n,"component_type")||n.facts!==void 0&&!N(n.facts)||n.tags!==void 0&&!J(n.tags)||["policyOptions","audienceOptions","detailOptions"].some(s=>n[s]!==void 0&&!te(n[s])))},ue=t=>{const n=C(t);return!n||typeof n.surfaceId!="string"||!Array.isArray(n.components)||n.components.length===0?!1:n.components.every(le)},H=t=>{const n=t.trim();if(!n)return null;const a=n.match(/^```(?:json|a2ui|agui|ag-ui)?\s*([\s\S]*?)\s*```$/i),s=a?a[1].trim():n;if(!s.startsWith("{")&&!s.startsWith("["))return null;try{return JSON.parse(s)}catch{return null}},Y=t=>{if(typeof t!="string")return null;const n=t.trim().toLowerCase();return n==="text_only"||n==="text-only"||n==="text"?"text_only":n==="ui_only"||n==="ui-only"||n==="ui"?"ui_only":n==="text_and_ui"||n==="text-and-ui"||n==="text+ui"||n==="both"?"text_and_ui":null},R=t=>{const n=Y(t);if(n)return n;if(typeof t=="string"){const s=H(t);return s?R(s):null}if(Array.isArray(t)){for(const s of t){const u=R(s);if(u)return u}return null}const a=C(t);return a&&(Y(a.displayMode)||Y(a.display_mode)||Y(a.a2uiDisplayMode)||Y(a.a2ui_display_mode)||R(a.metadata)||R(a.payload)||R(a.data))||null},x=t=>{if(!t)return[];if(typeof t=="string"){const u=H(t);return u?x(u):Array.from(t.matchAll(/```(?:agui|ag-ui|a2ui|json)\s*\n([\s\S]*?)\n```/gi)).flatMap(_=>{const $=H(_[1]);return $?x($):[]})}if(Array.isArray(t)){const u=t.map(_=>C(_)).filter(_=>!!_);return u.length===t.length&&u.every(T)?u:q(t)}if(typeof t!="object")return[];const n=t;if(T(n))return[n];const a=q(n);if(a.length>0)return a;const s=g(n);return s.length>0?s:[]},q=t=>{if(!t)return[];if(typeof t=="string"){const a=H(t);return a?q(a):[]}if(typeof t!="object")return[];if(Array.isArray(t))return t.map(s=>C(s)).filter(s=>!!s).flatMap(W);const n=t;return n.protocol==="ag-ui"?q(n.aguiEvents||n.agui_events):fe(n)?W(n):[]},fe=t=>{const n=String(t.type||"").toUpperCase();return n?n==="STATE_SNAPSHOT"?j(t.state).length>0:n==="STATE_DELTA"?j(t.delta).length>0:!0:!1},W=t=>{const n=String(t.type||"").toUpperCase();if(n==="STATE_SNAPSHOT"){const a=j(t.state);return a.length>0?a:f(t)}if(n==="STATE_DELTA"){const a=j(t.delta);return a.length>0?a:f(t)}return[]},j=t=>{const n=C(t);return n?[...x(n.a2uiMessages),...x(n.a2ui_messages),...x(n.a2ui)]:[]},i=t=>{const n=C(t);return n?W(n):[]},f=t=>[...i(t.rawEvent),...i(t.raw_event)],g=t=>{const n=[t.value,t.metadata,t.payload,t.data,t.a2uiMessages,t.a2ui_messages,t.a2ui,t.aguiEvents,t.agui_events,t.agui];for(const a of n){if(a===void 0||a===t)continue;const s=x(a);if(s.length>0)return s}return[]},b=t=>[...x(t.a2ui),...x(t.a2uiMessage),...x(t.a2uiMessages),...x(t.a2ui_message),...x(t.a2ui_messages),...x(t.agui),...x(t.aguiEvents),...x(t.agui_events),...x(t.metadata),...x(t.content)],L=t=>R(t.displayMode)||R(t.display_mode)||R(t.a2uiDisplayMode)||R(t.a2ui_display_mode)||R(t.metadata)||null,ne=t=>{var n,a,s,u;return((n=t==null?void 0:t.createSurface)==null?void 0:n.surfaceId)||((a=t==null?void 0:t.updateComponents)==null?void 0:a.surfaceId)||((s=t==null?void 0:t.updateDataModel)==null?void 0:s.surfaceId)||((u=t==null?void 0:t.deleteSurface)==null?void 0:u.surfaceId)||null},ae=(t,n)=>String(t.id||`index-${n}`),G=(t,n,a=!1)=>{const s={...k.value},u={...A.value},_=a?new Set(u[t]||[]):new Set;for(const $ of n){const U=ne($);U&&(s[U]=t,_.add(U))}u[t]=Array.from(_),k.value=s,A.value=u},pe=()=>{if(V.clearSurfaces(),A.value={},k.value={},!m.enableA2UI)return;const t=[];if(m.messages.forEach((n,a)=>{const s=b(n);if(s.length===0)return;const u=ae(n,a);G(u,s),t.push(...s)}),t.length!==0)try{V.processMessages(t)}catch(n){console.warn("[rt-chat-messages] A2UI payload render failed",n),M("a2ui-error",n)}},X=(t,n)=>{if(!m.enableA2UI)return[];if(L(t)==="text_only")return[];const s=ae(t,n);return(A.value[s]||[]).filter(u=>k.value[u]===s)},Z=t=>{const n=typeof t.content=="string"?t.content.trimStart():"";if(!n||b(t).length>0)return!1;const a=n.match(/^```([^\s\n`]*)?/);if(!a)return!1;const s=(a[1]||"").toLowerCase();return s?["a","ag","agu","agui","ag-","ag-u","ag-ui","a2","a2u","a2ui"].includes(s):!1},K=(t,n)=>!!(m.enableA2UI&&m.showA2UISkeleton&&m.isStreaming&&n===m.messages.length-1&&X(t,n).length===0&&Z(t)),F=(t,n)=>{if(!m.hideA2UIRawContent||t.attachments&&t.attachments.length>0)return!0;if(Z(t)||!t.content)return!1;if(b(t).length===0)return!0;const s=L(t);return s==="text_only"||s==="text_and_ui"?!0:s==="ui_only"?!1:X(t,n).length===0},ge=async t=>{var a;const n=(a=t==null?void 0:t.message)==null?void 0:a.action;M("a2ui-action",n,t);try{const s=m.a2uiActionHandler?await m.a2uiActionHandler(t):[],u=x(s);if(u.length>0){const _=k.value[n==null?void 0:n.surfaceId];_&&G(_,u,!0),V.processMessages(u),m.autoScroll&&!S.value&&(await e.nextTick(),ee("smooth"))}t.resolve(u)}catch(s){M("a2ui-error",s),t.reject(s instanceof Error?s:new Error(String(s)))}};let Q=0,oe=!1;const we=()=>{I()||(v.value=!1,S.value=!0)},ee=async(t="smooth",n=!1)=>{if(await e.nextTick(),B.value){if(n&&(S.value=!1),S.value)return;v.value=!0,oe=!0,B.value.scrollTo({top:B.value.scrollHeight,behavior:t}),setTimeout(()=>{oe=!1},50)}},Ee=t=>{if(M("scroll",t),!B.value)return;const n=B.value.scrollTop,a=n<Q;Q=n,!oe&&a&&(S.value=!0,v.value=!1),I()&&(v.value=!0,S.value=!1,M("scroll-bottom"))};e.watch(()=>m.messages.length,async(t,n)=>{t>(n||0)&&(S.value=!1,m.autoScroll&&ee("instant"))}),e.watch(()=>[m.messages,m.enableA2UI],pe,{deep:!0,immediate:!0});let o=null;e.watch(()=>m.messages,async()=>{if(!m.isStreaming||!m.autoScroll||S.value||document.hidden)return;const t=m.messages[m.messages.length-1];!t||t.role!=="assistant"||(o&&cancelAnimationFrame(o),o=requestAnimationFrame(async()=>{await e.nextTick(),B.value&&!S.value&&B.value.scrollTo({top:B.value.scrollHeight,behavior:"instant"})}))},{deep:!0}),e.watch(()=>m.isTyping,t=>{t&&m.autoScroll&&ee("instant")});const r=t=>{M("copy",t),navigator.clipboard&&t.content&&navigator.clipboard.writeText(t.content)};e.watch(()=>m.agentSteps,()=>{m.autoScroll&&!S.value&&ee()},{deep:!0});const c=()=>{m.autoScroll&&!S.value&&ee()},p=()=>{!document.hidden&&m.isStreaming&&m.autoScroll&&!S.value&&e.nextTick(()=>{B.value&&(B.value.scrollTo({top:B.value.scrollHeight,behavior:"instant"}),v.value=!0)})};let d;return e.onMounted(()=>{E(),d=V.onEvent(ge),document.addEventListener("visibilitychange",p)}),e.onUnmounted(()=>{d==null||d(),document.removeEventListener("visibilitychange",p)}),h({scrollToBottom:ee,containerRef:B}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Dt,[l.showBackground?(e.openBlock(),e.createElementBlock("div",Ht)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"chat-message-list",ref_key:"containerRef",ref:B,onScroll:Ee,onWheel:we,onTouchmove:we,style:e.normalizeStyle({paddingTop:l.contentPaddingTop,paddingBottom:l.contentPaddingBottom})},[l.showWelcome&&l.messages.length===0?(e.openBlock(),e.createElementBlock("div",Pt,[e.renderSlot(t.$slots,"welcome",{},()=>[e.createElementVNode("div",Rt,[e.createElementVNode("div",Ft,[l.appLogo?(e.openBlock(),e.createElementBlock("img",{key:0,src:l.appLogo,alt:"Logo"},null,8,Ot)):(e.openBlock(),e.createElementBlock("div",Wt,[...n[1]||(n[1]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"32",height:"32"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})],-1)])]))]),e.createElementVNode("h2",jt,e.toDisplayString(l.appName),1),n[2]||(n[2]=e.createElementVNode("p",{class:"welcome-desc"},"今天有什么可以帮您?",-1))])],!0)])):(e.openBlock(),e.createElementBlock("div",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.messages,(a,s)=>(e.openBlock(),e.createElementBlock("div",{key:a.id||s,class:e.normalizeClass(["message-row",a.role==="user"?"message-user":"message-assistant"])},[a.role==="user"?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("div",Xt,[e.createVNode(ke,{message:a,"is-user":!0,"api-base-url":l.apiBaseUrl},null,8,["message","api-base-url"])]),a.content?(e.openBlock(),e.createElementBlock("div",Zt,[e.createElementVNode("button",{class:"action-btn",onClick:u=>r(a),title:"复制"},[...n[3]||(n[3]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"})],-1),e.createElementVNode("span",null,"复制",-1)])],8,Kt)])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Jt,[l.showAgentSteps&&s===l.messages.length-1&&l.agentSteps&&l.agentSteps.length>0?(e.openBlock(),e.createBlock(Be,{key:0,steps:l.agentSteps,onResize:c},null,8,["steps"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-bubble assistant-bubble",{"assistant-bubble-a2ui":X(a,s).length>0}])},[F(a,s)?(e.openBlock(),e.createBlock(ke,{key:0,message:a,"is-user":!1,"api-base-url":l.apiBaseUrl,"is-streaming":l.isStreaming&&s===l.messages.length-1},null,8,["message","api-base-url","is-streaming"])):e.createCommentVNode("",!0),X(a,s).length>0?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["a2ui-surfaces",{"a2ui-surfaces-with-content":F(a,s)}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X(a,s),u=>(e.openBlock(),e.createBlock(e.unref(ie.A2UISurface),{key:u,"surface-id":u},null,8,["surface-id"]))),128))],2)):e.createCommentVNode("",!0),K(a,s)?(e.openBlock(),e.createElementBlock("div",Gt,[...n[4]||(n[4]=[e.createStaticVNode('<div class="skeleton-header" data-v-eac8b914><div class="skeleton-avatar skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-title-group" data-v-eac8b914><div class="skeleton-line skeleton-title skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-line skeleton-subtitle skeleton-shimmer" data-v-eac8b914></div></div></div><div class="skeleton-line skeleton-summary skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-line skeleton-summary short skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-facts" data-v-eac8b914><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div><div class="skeleton-fact skeleton-shimmer" data-v-eac8b914></div></div>',4)])])):e.createCommentVNode("",!0)],2),F(a,s)&&a.content&&!(l.isStreaming&&s===l.messages.length-1)?(e.openBlock(),e.createElementBlock("div",Qt,[e.createElementVNode("button",{class:"action-btn",onClick:u=>r(a),title:"复制"},[...n[5]||(n[5]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"})],-1),e.createElementVNode("span",null,"复制",-1)])],8,en)])):e.createCommentVNode("",!0)]))],2))),128)),l.isTyping?(e.openBlock(),e.createElementBlock("div",tn,[...n[6]||(n[6]=[e.createElementVNode("div",{class:"typing-indicator"},[e.createElementVNode("div",{class:"typing-dot"}),e.createElementVNode("div",{class:"typing-dot",style:{"animation-delay":"0.2s"}}),e.createElementVNode("div",{class:"typing-dot",style:{"animation-delay":"0.4s"}})],-1)])])):e.createCommentVNode("",!0)]))],36),e.createVNode(e.Transition,{name:"fade-slide"},{default:e.withCtx(()=>[v.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"scroll-to-bottom-btn",style:e.normalizeStyle({bottom:`calc(${l.contentPaddingBottom||"140px"} + 20px)`}),onClick:n[0]||(n[0]=a=>ee("smooth",!0))},[n[8]||(n[8]=e.createElementVNode("div",{class:"btn-inner"},[e.createElementVNode("svg",{class:"arrow-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M19 9l-7 7-7-7"})])],-1)),l.isStreaming?(e.openBlock(),e.createElementBlock("svg",nn,[...n[7]||(n[7]=[e.createElementVNode("circle",{class:"loading-circle",cx:"18",cy:"18",r:"16"},null,-1)])])):e.createCommentVNode("",!0)],4))]),_:1})]))}}),[["__scopeId","data-v-eac8b914"]]),an={install(l){l.component("ChatMessageList",Ae),l.component("MultimodalMessage",ke),l.component("MarkdownMessage",Me),l.component("AgentSteps",Be)}};D.AgentSteps=Be,D.ChatMessageList=Ae,D.MarkdownMessage=Me,D.MultimodalMessage=ke,D.default=an,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(H,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("a2ui-vue"),require("markdown-it"),require("@vscode/markdown-it-katex"),require("mermaid")):typeof define=="function"&&define.amd?define(["exports","vue","a2ui-vue","markdown-it","@vscode/markdown-it-katex","mermaid"],e):(H=typeof globalThis<"u"?globalThis:H||self,e(H.ChatMessages={},H.Vue,H.A2UIVue,H.markdownit,H.markdownItKatex,H.mermaid))})(this,(function(H,e,ie,$e,Ie,Ve){"use strict";const ze={class:"cm-dialog__body"},Le=e.defineComponent({__name:"Dialog",props:{visible:{type:Boolean,default:!1},width:{default:"50%"},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},appendToBody:{type:Boolean,default:!0}},emits:["update:visible","close"],setup(i,{emit:h}){const w=i,y=h,m=e.ref(!1);e.onMounted(()=>{m.value=!0});const M=e.computed(()=>w.fullscreen?{width:"100%",height:"100%",margin:0}:{width:w.width}),B=()=>{y("update:visible",!1),y("close")},S=()=>{w.closeOnClickModal&&B()};return(A,$)=>m.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:"body"},[i.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["cm-dialog-overlay",{"is-fullscreen":i.fullscreen}]),onClick:e.withModifiers(S,["self"])},[e.createElementVNode("div",{class:"cm-dialog",style:e.normalizeStyle(M.value),role:"dialog","aria-modal":"true"},[e.createElementVNode("div",ze,[e.renderSlot(A.$slots,"default",{},void 0,!0)]),i.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cm-dialog__close",onClick:B},[...$[0]||($[0]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})],-1)])])):e.createCommentVNode("",!0)],4)],2)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}),ce=(i,h)=>{const w=i.__vccOpts||i;for(const[y,m]of h)w[y]=m;return w},Ce=ce(Le,[["__scopeId","data-v-efdf0259"]]),Te=["disabled"],Ue={key:0,class:"cm-icon-loading"},R=ce(e.defineComponent({__name:"Button",props:{type:{default:"default"},size:{default:"default"},circle:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(i,{emit:h}){const w=i,y=h,m=M=>{w.disabled||w.loading||y("click",M)};return(M,B)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["cm-button",[`cm-button--${i.type}`,`cm-button--${i.size}`,{"is-circle":i.circle,"is-disabled":i.disabled,"is-loading":i.loading}]]),disabled:i.disabled||i.loading,onClick:m},[i.loading?(e.openBlock(),e.createElementBlock("span",Ue,[...B[0]||(B[0]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"1em",height:"1em"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"})],-1)])])):e.renderSlot(M.$slots,"default",{key:1},void 0,!0)],10,Te))}}),[["__scopeId","data-v-bab126c7"]]),O=(i,h)=>e.defineComponent({name:i,render(){return e.h("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",width:"1em",height:"1em",fill:"currentColor",style:"vertical-align: middle"},[e.h("path",{d:h})])}}),me=O("Close","M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"),be=O("ZoomIn","M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm268.48-154.56a32 32 0 0 0-32 32v90.496h-90.56a32 32 0 0 0 0 64h90.56v90.56a32 32 0 0 0 64 0v-90.496h90.496a32 32 0 0 0 0-64H373.632v-90.56a32 32 0 0 0-32-32z"),_e=O("ZoomOut","M637.696 587.392a316.032 316.032 0 1 0-45.44 49.344l191.232 191.296a32 32 0 0 0 45.312-45.184L637.696 587.392zM73.152 357.696a284.48 284.48 0 1 1 284.48 284.48A284.672 284.672 0 0 1 73.152 357.568zm145.92-58.56a32 32 0 0 0 0 64h245.12a32 32 0 0 0 0-64H219.072z"),De=O("Document","M854.6 288.7c0.4 0 0.7 0 1 0v431.5c0 17.6-14.4 32-32 32H200.4c-17.6 0-32-14.4-32-32l0-575.2c0-17.6 14.4-32 32-32h391.5c0 0.3 0 0.7 0 1l0 142.1c0 17.6 14.4 32.1 32 32.1h142.6c0-0.4 0-0.7 0-1.1L854.6 288.7zM790.2 220.2L668 97.9v122.3h122.2zM240 448h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h544a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64zm0 128h384a32 32 0 0 0 0-64H240a32 32 0 0 0 0 64z"),Ne=O("Download","M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2 0.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"),He=O("VideoPlay","M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-48-247.616L668.608 512 464 375.616v272.768zm10.656-340.32a32 32 0 0 1 32 32V673.92a32 32 0 0 1-50.208 26.24l-236.8-161.92a32 32 0 0 1 0-52.48l236.8-161.92a32 32 0 0 1 18.208-5.632z"),Pe=O("VideoPause","M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm-96-544a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32zm192 0a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V384a32 32 0 0 1 32-32z"),Re=O("ArrowLeft","M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"),Fe=O("ArrowRight","M340.864 149.312a29.12 29.12 0 0 0-41.728 0 30.592 30.592 0 0 0 0 42.752L611.072 511.936 299.136 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L672.448 534.272a32 32 0 0 0 0-44.672L340.864 149.312z"),ve=O("Spinner","M512 64a448 448 0 0 1 448 448 32 32 0 1 1-64 0 416 416 0 0 0-416-416 416 416 0 0 0-416 416 32 32 0 1 1-64 0 448 448 0 0 1 448-448z"),xe=O("Check","M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"),Oe=O("ChevronUp","M854.6 642.5l-320-320c-12.5-12.5-32.8-12.5-45.3 0l-320 320c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L512 390.6l297.4 297.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3z"),We=O("ChevronDown","M854.6 381.5l-320 320c-12.5 12.5-32.8 12.5-45.3 0l-320-320c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L512 633.4l297.4-297.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3z"),je=["src","alt"],Ye={class:"preview-controls"},qe={class:"cm-button-group"},Xe={key:0,class:"mobile-close-hint"},Ze=["innerHTML"],Ke={class:"preview-controls"},Je={class:"cm-button-group"},Ge={key:0,class:"mobile-close-hint"},Me=ce(e.defineComponent({__name:"MarkdownMessage",props:{content:{},isStreaming:{type:Boolean,default:!1}},setup(i){const h=i,w=e.ref(),y=e.ref(),m=e.ref(!1),M=e.ref(""),B=e.ref(""),S=e.ref(!1),A=e.ref(""),$=e.ref(!1),k=e.ref(1),T=e.ref({x:0,y:0}),b=e.ref(!1),z=e.ref({x:0,y:0}),E=e.ref(1),U=e.ref({x:0,y:0}),C=e.ref(!1),re=e.ref({x:0,y:0}),_=e.ref(""),J=e.ref(new Map),te=e.ref(!1);let le=0;Ve.initialize({startOnLoad:!1,theme:"default",securityLevel:"loose",fontFamily:"inherit"});const ue=o=>{const r=o.renderer.rules.fence;o.renderer.rules.fence=(c,g,d,t,n)=>{const a=c[g],s=a.content.trim();return(a.info?a.info.trim():"")==="mermaid"?(le++,`<div class="mermaid-container"><pre class="mermaid" data-mermaid-id="${`mermaid-${Date.now()}-${le}`}">${s}</pre></div>`):r(c,g,d,t,n)}},P=new $e({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,quotes:`""''`,highlight:function(o,r){return r&&r.trim()?`<pre class="hljs language-${r}"><code>${(g=>g.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"))(o)}</code></pre>`:`<pre class="hljs"><code>${o}</code></pre>`}}),Y=P.renderer.rules.image||function(o,r,c,g,d){return d.renderToken(o,r,c)};P.renderer.rules.image=function(o,r,c,g,d){const t=o[r],n=t.attrIndex("src");if(n>=0){const a=t.attrs[n][1],f="img-"+(v=>{let I=0;for(let D=0;D<v.length;D++){const se=v.charCodeAt(D);I=(I<<5)-I+se,I=I&I}return Math.abs(I).toString(36)})(a);t.attrSet("id",f),t.attrSet("data-image-id",f),t.attrSet("key",f),t.attrSet("loading","eager"),t.attrSet("decoding","async"),t.attrSet("fetchpriority","high"),t.attrSet("data-src",a),t.attrSet("data-cached","true")}return Y(o,r,c,g,d)},P.use(Ie,{throwOnError:!1,errorColor:"#cc0000"}),P.use(ue);const N=o=>{const r=o.match(/```[\w]*\n/g),c=o.match(/\n```/g),g=(r==null?void 0:r.length)||0,d=(c==null?void 0:c.length)||0;return g>d&&(o+="\n```"),o},x=o=>{if(!o)return"";o=o.replace(/;;\s*$/g,""),o=o.replace(/;;\s*$/g,"");const r=/^```(?:markdown|md)\s*\n([\s\S]*?)\n```$/,c=o.match(r);if(c)o=c[1];else{const g=/^```\s*\n([\s\S]*?)\n```$/,d=o.match(g);if(d){const t=d[1];(/^#{1,6}\s/.test(t)||/^\*{1,2}[^*]+\*{1,2}/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/!\[.*?\]\(.*?\)/.test(t)||/\[.*?\]\(.*?\)/.test(t)||/^\|.+\|/.test(t)||/^\|[\s-:]+\|/m.test(t))&&(o=t)}}if(h.isStreaming){const g=/^```(?:markdown|md)?\s*\n/;if(g.test(o)){const t=o.replace(g,"");(/^#{1,6}\s/.test(t)||/^\|.+\|/.test(t)||/^\|[\s-:]+\|/m.test(t)||/!\[.*?\]\(.*?\)/.test(t)||/\[.*?\]\(.*?\)/.test(t))&&(o=o.replace(g,""))}if(/^```(?:markdown|md)?\s*\n/.test(h.content)){const t=/\n```\s*$/;t.test(o)&&(o=o.replace(t,""))}}return o=o.replace(/```(?:markdown|md)\s*\n([\s\S]*?)\n```/g,(g,d)=>d),h.isStreaming&&(o=N(o)),o},q=o=>{if(!o.includes("<img"))return o;const r=/<img[^>]*?src="([^"]*)"[^>]*?>/g;let c,g=o;const d=[];for(;(c=r.exec(o))!==null;){const t=c[0],n=c[1];if(J.value.has(n)){const a=J.value.get(n);t!==a&&d.push({original:t,cached:a})}else J.value.set(n,t)}for(const{original:t,cached:n}of d)g=g.replace(t,n);return g},fe=o=>{if(!y.value)return;const r=y.value,c=new Map;if(h.isStreaming&&r.children.length>0&&r.querySelectorAll("img[data-image-id]").forEach(g=>{const d=g.getAttribute("data-image-id");d&&c.set(d,g)}),r.innerHTML=o,!h.isStreaming){e.nextTick(()=>{Ee(),p()});return}c.size>0&&r.querySelectorAll("img[data-image-id]").forEach(g=>{const d=g.getAttribute("data-image-id");if(d&&c.has(d)){const t=c.get(d);g.parentNode&&t!==g&&g.parentNode.replaceChild(t,g)}})},W=()=>{try{if(!h.content){_.value="",y.value&&(y.value.innerHTML=""),h.isStreaming||J.value.clear();return}if(document.hidden&&h.isStreaming){te.value=!0;return}const o=x(h.content);let r=P.render(o);h.isStreaming&&r.includes("<img")&&(r=q(r)),r!==_.value&&(_.value=r,fe(r)),h.isStreaming||J.value.clear()}catch(o){console.error("Markdown rendering error:",o),y.value&&(y.value.innerHTML=`<pre style="white-space: pre-wrap; word-wrap: break-word;">${h.content}</pre>`)}};e.watch(()=>h.content,W),e.watch(()=>h.isStreaming,(o,r)=>{r&&!o&&e.nextTick(()=>{W()})});const j=()=>{!document.hidden&&te.value&&(te.value=!1,e.nextTick(()=>{W()}))};document.addEventListener("visibilitychange",j),e.onUnmounted(()=>{document.removeEventListener("visibilitychange",j)});const l=()=>{$.value=window.innerWidth<768},u=o=>{let r=o;return r=r.replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1"),[/([A-Za-z0-9_]+)\[([^\]]*[\u4e00-\u9fa5]+[^\]]*)\]/g,/([A-Za-z0-9_]+)\(([^)]*[\u4e00-\u9fa5]+[^)]*)\)/g,/([A-Za-z0-9_]+)\{([^}]*[\u4e00-\u9fa5]+[^}]*)\}/g].forEach(g=>{r=r.replace(g,(d,t,n)=>{if(n.startsWith('"')&&n.endsWith('"'))return d;let a=n.replace(/^["']+|["']+$/g,"").replace(/["]/g,'\\"');return d.includes("[")?`${t}["${a}"]`:d.includes("(")?`${t}("${a}")`:d.includes("{")?`${t}{"${a}"}`:d})}),r},p=async()=>{var r,c;if(h.isStreaming||(await e.nextTick(),!w.value))return;const o=w.value.querySelectorAll(".mermaid");if(o.length!==0)for(const g of Array.from(o)){const d=g;let t=(r=d.textContent)==null?void 0:r.trim();if(t&&d.getAttribute("data-processed")!=="true")try{d.setAttribute("data-processed","true"),t=u(t);const n=d.getAttribute("data-mermaid-id")||`mermaid-${Date.now()}-${Math.random()}`,{svg:a}=await Ve.render(n,t),s=d.parentElement;if(s){const f=document.createElement("div");f.className="mermaid-svg",f.innerHTML=a,f.setAttribute("data-mermaid-svg","true"),f.style.cursor="pointer",f.title="Click to zoom",f.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),A.value=a,E.value=1,U.value={x:0,y:0},S.value=!0}),s.replaceChild(f,d)}}catch(n){console.error("Mermaid render failure:",n);const a=document.createElement("div");a.className="mermaid-error",a.textContent=`Mermaid render error: ${n}`,(c=d.parentElement)==null||c.replaceChild(a,d)}}},V=o=>{o.preventDefault(),o.stopPropagation();const r=o.target;M.value=r.src,B.value=r.alt||"Image Preview",k.value=1,T.value={x:0,y:0},m.value=!0},L=()=>{k.value<=1&&(T.value={x:0,y:0})},ne=()=>{k.value=Math.min(k.value+1,10),L()},ae=()=>{k.value=Math.max(k.value-1,.5),L()},G=()=>{k.value=1,T.value={x:0,y:0}},pe=()=>{k.value<=1&&(m.value=!1)},X=o=>{o.preventDefault();const r=o.deltaY>0?-.5:.5,c=Math.max(.5,Math.min(10,k.value+r));k.value=c,L()},Z=o=>{var t;if(k.value<=1)return;o.preventDefault(),b.value=!0,z.value={x:o.clientX-T.value.x,y:o.clientY-T.value.y};const r=o.target,c=(t=r.parentElement)==null?void 0:t.getBoundingClientRect(),g=n=>{if(!b.value||!c)return;let a=n.clientX-z.value.x,s=n.clientY-z.value.y;const f=r.offsetWidth,v=r.offsetHeight,I=f*k.value,D=v*k.value,se=.3,Se=c.width*(1-se-.5)-I/2,he=I/2-c.width*(1-se-.5),ye=c.height*(1-se-.5)-D/2,de=D/2-c.height*(1-se-.5);I>c.width?a=Math.max(Se,Math.min(he,a)):a=0,D>c.height?s=Math.max(ye,Math.min(de,s)):s=0,T.value={x:a,y:s}},d=()=>{b.value=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",d)},K=o=>{var s;if(o.touches.length!==1)return;const r=o.touches[0],c=r.clientX,g=r.clientY;if(k.value<=1)return;b.value=!0,z.value={x:c-T.value.x,y:g-T.value.y};const d=o.target,t=(s=d.parentElement)==null?void 0:s.getBoundingClientRect(),n=f=>{if(!b.value||f.touches.length!==1||!t)return;const v=f.touches[0];let I=v.clientX-z.value.x,D=v.clientY-z.value.y;const se=d.offsetWidth,Se=d.offsetHeight,he=se*k.value,ye=Se*k.value,de=.3,on=t.width*(1-de-.5)-he/2,sn=he/2-t.width*(1-de-.5),rn=t.height*(1-de-.5)-ye/2,ln=ye/2-t.height*(1-de-.5);he>t.width?I=Math.max(on,Math.min(sn,I)):I=0,ye>t.height?D=Math.max(rn,Math.min(ln,D)):D=0,T.value={x:I,y:D}},a=()=>{b.value=!1,document.removeEventListener("touchmove",n),document.removeEventListener("touchend",a)};document.addEventListener("touchmove",n,{passive:!1}),document.addEventListener("touchend",a)},F=()=>{E.value=Math.min(E.value+1,10)},ge=()=>{E.value=Math.max(E.value-1,.5)},Q=()=>{E.value=1,U.value={x:0,y:0}},oe=o=>{o.preventDefault();const r=o.deltaY>0?-.5:.5;E.value=Math.max(.5,Math.min(10,E.value+r))},we=o=>{var t,n;if(E.value<=1)return;o.preventDefault(),C.value=!0,re.value={x:o.clientX-U.value.x,y:o.clientY-U.value.y};const c=(n=(t=o.target.closest(".mermaid-preview-content"))==null?void 0:t.parentElement)==null?void 0:n.getBoundingClientRect(),g=a=>{if(!C.value||!c)return;let s=a.clientX-re.value.x,f=a.clientY-re.value.y;U.value={x:s,y:f}},d=()=>{C.value=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",d)},ee=o=>{},Ee=()=>{h.isStreaming||e.nextTick(()=>{if(!w.value)return;w.value.querySelectorAll(".markdown-content img").forEach(r=>{const c=r;c.getAttribute("data-processed")!=="true"&&(c.setAttribute("data-processed","true"),c.style.cursor="pointer",c.addEventListener("click",V))})})};return e.onMounted(()=>{l(),window.addEventListener("resize",l),W(),Ee(),p()}),e.onUnmounted(()=>{w.value&&w.value.querySelectorAll(".markdown-content img").forEach(r=>{r.removeEventListener("click",V)})}),(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:"markdown-message",ref_key:"markdownContainer",ref:w},[e.createElementVNode("div",{ref_key:"markdownContent",ref:y,class:"markdown-content"},null,512),e.createVNode(Ce,{visible:m.value,"onUpdate:visible":r[2]||(r[2]=c=>m.value=c),width:$.value?"95vw":"80vw",fullscreen:$.value,class:"image-preview-dialog","close-on-click-modal":!1,"append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"image-preview-container",onClick:r[1]||(r[1]=e.withModifiers(c=>m.value=!1,["self"]))},[e.createElementVNode("img",{src:M.value,alt:B.value,class:"preview-image",style:e.normalizeStyle({transform:`translate(${T.value.x}px, ${T.value.y}px) scale(${k.value})`}),onWheel:e.withModifiers(X,["prevent"]),onDblclick:G,onMousedown:Z,onTouchstart:e.withModifiers(K,["prevent"]),onClick:pe},null,44,je),e.createElementVNode("div",Ye,[e.createElementVNode("div",qe,[e.createVNode(R,{size:"small",onClick:ae,disabled:k.value<=.5},{default:e.withCtx(()=>[e.createVNode(e.unref(_e))]),_:1},8,["disabled"]),e.createVNode(R,{size:"small",onClick:G},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Math.round(k.value*100))+"% ",1)]),_:1}),e.createVNode(R,{size:"small",onClick:ne,disabled:k.value>=10},{default:e.withCtx(()=>[e.createVNode(e.unref(be))]),_:1},8,["disabled"])]),e.createVNode(R,{size:"small",onClick:r[0]||(r[0]=c=>m.value=!1),type:"danger"},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})]),$.value?(e.openBlock(),e.createElementBlock("div",Xe,"双击重置 · 轻触关闭")):e.createCommentVNode("",!0)])]),_:1},8,["visible","width","fullscreen"]),e.createVNode(Ce,{visible:S.value,"onUpdate:visible":r[5]||(r[5]=c=>S.value=c),width:$.value?"95vw":"90vw",fullscreen:$.value,class:"mermaid-preview-dialog","close-on-click-modal":!1,"append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"mermaid-preview-container",onClick:r[4]||(r[4]=e.withModifiers(c=>S.value=!1,["self"]))},[e.createElementVNode("div",{class:"mermaid-preview-content",innerHTML:A.value,style:e.normalizeStyle({transform:`translate(${U.value.x}px, ${U.value.y}px) scale(${E.value})`}),onWheel:e.withModifiers(oe,["prevent"]),onDblclick:Q,onMousedown:we,onTouchstart:e.withModifiers(ee,["prevent"])},null,44,Ze),e.createElementVNode("div",Ke,[e.createElementVNode("div",Je,[e.createVNode(R,{size:"small",onClick:ge,disabled:E.value<=.5},{default:e.withCtx(()=>[e.createVNode(e.unref(_e))]),_:1},8,["disabled"]),e.createVNode(R,{size:"small",onClick:Q},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Math.round(E.value*100))+"% ",1)]),_:1}),e.createVNode(R,{size:"small",onClick:F,disabled:E.value>=10},{default:e.withCtx(()=>[e.createVNode(e.unref(be))]),_:1},8,["disabled"])]),e.createVNode(R,{size:"small",onClick:r[3]||(r[3]=c=>S.value=!1),type:"danger"},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})]),$.value?(e.openBlock(),e.createElementBlock("div",Ge,"双击重置 · 轻触关闭")):e.createCommentVNode("",!0)])]),_:1},8,["visible","width","fullscreen"])],512))}}),[["__scopeId","data-v-c6385dde"]]),Qe={key:0,class:"text-content"},et={key:1,class:"images-content"},tt=["onClick"],nt=["src","alt","onError"],at={key:0,class:"more-images"},ot={key:2,class:"files-content"},st=["onClick"],rt={class:"file-icon-wrapper-small"},lt=["title"],it={class:"file-name"},ct={class:"file-type"},dt={class:"file-actions"},mt={key:3,class:"audio-content"},ut={class:"audio-player"},ft={class:"audio-info"},pt={class:"audio-progress"},gt={class:"progress-bar"},ht={class:"audio-time"},yt={class:"image-preview-container"},kt=["src"],wt={key:0,class:"image-nav"},Et={class:"image-counter"},ke=ce(e.defineComponent({__name:"MultimodalMessage",props:{message:{},isUser:{type:Boolean,default:!1},isStreaming:{type:Boolean,default:!1},apiBaseUrl:{default:""},onDownload:{}},setup(i){const h=i,w=e.computed(()=>{try{return h.message.metadata?JSON.parse(h.message.metadata):{}}catch{return{}}}),y=e.computed(()=>w.value.imageUrls||[]),m=e.computed(()=>w.value.audioUrl),M=e.ref(new Set),B=e.computed(()=>w.value.fileUrls||[]),S=e.computed(()=>B.value),A=e.computed(()=>h.message.attachments&&h.message.attachments.length>0?h.message.attachments:w.value.attachments&&Array.isArray(w.value.attachments)?w.value.attachments:[]),$=e.computed(()=>{const l=[];return A.value&&A.value.length>0?A.value.forEach(u=>{var V,L;((V=u.type)==null?void 0:V.startsWith("image/"))||((L=u.name)==null?void 0:L.match(/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)$/i))||l.push({url:u.url||u.download_url||u.file_url||"",name:u.original_name||u.name||"Unknown File",type:Y(u.original_name||u.name||"Unknown File")})}):S.value&&S.value.length>0&&S.value.forEach(u=>{l.push({url:u,name:P(u),type:Y(u)})}),l}),k=e.ref(!1),T=e.ref(""),b=e.ref(0),z=e.ref(!1),E=e.ref(!1),U=e.ref(0),C=e.ref(0),re=e.computed(()=>C.value>0?U.value/C.value*100:0);let _=null;const J=(l,u)=>{T.value=l,b.value=u,k.value=!0},te=()=>{b.value>0&&(b.value--,T.value=y.value[b.value])},le=()=>{b.value<y.value.length-1&&(b.value++,T.value=y.value[b.value])},ue=(l,u)=>{console.error("Image load failed:",u);const p=l.target;p.style.display="none"},P=l=>{if(!l)return"Unknown File";if(!l.includes("/"))return decodeURIComponent(l)||"Unknown File";try{const u=l.lastIndexOf("/"),p=u>=0?l.substring(u+1):l;return decodeURIComponent(p)||"Unknown File"}catch{return"Unknown File"}},Y=l=>{var V;return((V=P(l).split(".").pop())==null?void 0:V.toUpperCase())||"FILE"},N=(l,u)=>{q(l,u)},x=l=>{if(!l||l.startsWith("http://")||l.startsWith("https://")||l.startsWith("blob:"))return l;const u=h.apiBaseUrl?h.apiBaseUrl.replace(/\/$/,""):"";if(u){const p=new URL(u,window.location.origin).pathname.replace(/\/$/,"");return p&&(l===p||l.startsWith(`${p}/`))?`${window.location.origin}${l.startsWith("/")?l:`/${l}`}`:u+(l.startsWith("/")?l:"/"+l)}return l.startsWith("/")?l:`/${l}`},q=async(l,u)=>{try{const p=x(l);if(console.log("正在下载文件...",p),h.onDownload&&(M.value=new Set([...M.value,l]),await h.onDownload(l,u)!==!1)){const F=new Set(M.value);F.delete(l),M.value=F;return}M.value=new Set([...M.value,l]);const V=localStorage.getItem("token"),L={};if(V&&(L.Authorization=V.startsWith("Bearer ")?V:`Bearer ${V}`),typeof window<"u"&&typeof window.plus<"u"){const K=window.plus,F=K.downloader.createDownload(p,{method:"GET",filename:"_downloads/"+(u||P(l))},(ge,Q)=>{const oe=new Set(M.value);oe.delete(l),M.value=oe,Q===200||Q===206?K.runtime.openFile(ge.filename):console.error("App 环境原生下载失败, status:",Q)});L.Authorization&&F.setRequestHeader("Authorization",L.Authorization),F.start();return}const ne=await fetch(p,{headers:L});if(!ne.ok)throw new Error(`下载失败: ${ne.status}`);let ae=u;const G=ne.headers.get("Content-Disposition");if(G){const K=G.match(/filename\*=UTF-8''(.+)/i);if(K)ae=decodeURIComponent(K[1]);else{const F=G.match(/filename="?([^";\n]+)"?/i);F&&(ae=F[1])}}const pe=await ne.blob(),X=URL.createObjectURL(pe),Z=document.createElement("a");Z.href=X,Z.download=ae||u||P(l),document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL(X)}catch(p){console.error("下载文件失败:",p)}finally{const p=new Set(M.value);p.delete(l),M.value=p}},fe=async()=>{if(m.value)try{_||(_=new Audio,_.src=x(m.value),_.addEventListener("loadedmetadata",()=>{C.value=(_==null?void 0:_.duration)||0}),_.addEventListener("timeupdate",()=>{U.value=(_==null?void 0:_.currentTime)||0}),_.addEventListener("ended",()=>{z.value=!1,U.value=0}),_.addEventListener("error",l=>{console.error("Audio playback error:",l),E.value=!1,z.value=!1})),z.value?(_.pause(),z.value=!1):(E.value=!0,await _.play(),z.value=!0,E.value=!1)}catch(l){console.error("Audio playback failed:",l),E.value=!1,z.value=!1}},W=l=>{const u=Math.floor(l/60),p=Math.floor(l%60);return`${u}:${p.toString().padStart(2,"0")}`},j=l=>{k.value&&(l.key==="ArrowLeft"?te():l.key==="ArrowRight"?le():l.key==="Escape"&&(k.value=!1))};return e.watch(k,l=>{l?document.addEventListener("keydown",j):document.removeEventListener("keydown",j)}),e.onUnmounted(()=>{_&&(_.pause(),_=null),document.removeEventListener("keydown",j)}),(l,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["multimodal-message",{"is-user":i.isUser,"is-assistant":!i.isUser}])},[i.message.content?(e.openBlock(),e.createElementBlock("div",Qe,[e.createVNode(Me,{content:i.message.content,"is-streaming":i.isStreaming},null,8,["content","is-streaming"])])):e.createCommentVNode("",!0),y.value&&y.value.length>0?(e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",{class:e.normalizeClass(["images-grid",`grid-${Math.min(y.value.length,4)}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value.slice(0,4),(p,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"image-item",onClick:L=>J(p,V)},[e.createElementVNode("img",{src:p,alt:`图片 ${V+1}`,onError:L=>ue(L,p),loading:"lazy"},null,40,nt),V===3&&y.value.length>4?(e.openBlock(),e.createElementBlock("div",at," +"+e.toDisplayString(y.value.length-4),1)):e.createCommentVNode("",!0)],8,tt))),128))],2)])):e.createCommentVNode("",!0),$.value&&$.value.length>0?(e.openBlock(),e.createElementBlock("div",ot,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,(p,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"file-item",onClick:L=>N(p.url,p.name)},[e.createElementVNode("div",rt,[e.createVNode(e.unref(De),{class:"file-icon"})]),e.createElementVNode("div",{class:"file-info",title:p.name},[e.createElementVNode("span",it,e.toDisplayString(p.name),1),e.createElementVNode("span",ct,e.toDisplayString(p.type),1)],8,lt),e.createElementVNode("div",dt,[e.createVNode(R,{size:"small",type:"text",disabled:M.value.has(p.url),onClick:e.withModifiers(L=>q(p.url,p.name),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(Ne),{class:e.normalizeClass({"icon-spin":M.value.has(p.url)})},null,8,["class"])]),_:2},1032,["disabled","onClick"])])],8,st))),128))])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ut,[e.createVNode(R,{onClick:fe,loading:E.value,circle:"",size:"small",class:"play-btn"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z.value?e.unref(Pe):e.unref(He))))]),_:1},8,["loading"]),e.createElementVNode("div",ft,[e.createElementVNode("div",pt,[e.createElementVNode("div",gt,[e.createElementVNode("div",{class:"progress-fill",style:e.normalizeStyle({width:re.value+"%"})},null,4)])]),e.createElementVNode("div",ht,[e.createElementVNode("span",null,e.toDisplayString(W(U.value)),1),u[4]||(u[4]=e.createElementVNode("span",null,"/",-1)),e.createElementVNode("span",null,e.toDisplayString(W(C.value)),1)])]),e.createVNode(R,{onClick:u[0]||(u[0]=p=>q(m.value)),size:"small",type:"text",class:"download-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(Ne))]),_:1})])])):e.createCommentVNode("",!0),e.createVNode(Ce,{visible:k.value,"onUpdate:visible":u[3]||(u[3]=p=>k.value=p),width:"90%","show-close":!1,"append-to-body":"",class:"image-preview-dialog-wrapper"},{default:e.withCtx(()=>[e.createElementVNode("div",yt,[e.createElementVNode("img",{src:T.value,alt:"预览图片",class:"preview-image",onClick:u[1]||(u[1]=p=>k.value=!1)},null,8,kt),y.value&&y.value.length>1?(e.openBlock(),e.createElementBlock("div",wt,[e.createVNode(R,{onClick:te,disabled:b.value===0,circle:"",class:"nav-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(Re))]),_:1},8,["disabled"]),e.createElementVNode("span",Et,e.toDisplayString(b.value+1)+" / "+e.toDisplayString(y.value.length),1),e.createVNode(R,{onClick:le,disabled:b.value===y.value.length-1,circle:"",class:"nav-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe))]),_:1},8,["disabled"])])):e.createCommentVNode("",!0),e.createVNode(R,{onClick:u[2]||(u[2]=p=>k.value=!1),class:"close-btn",circle:""},{default:e.withCtx(()=>[e.createVNode(e.unref(me))]),_:1})])]),_:1},8,["visible"])],2))}}),[["__scopeId","data-v-b3bc1307"]]),Ct=["aria-expanded"],Mt={class:"steps-indicator"},Bt={key:0,class:"icon-running"},St={key:1,class:"icon-error"},Vt={key:2,class:"icon-completed"},bt={class:"steps-copy"},_t={class:"steps-summary"},Nt={class:"steps-meta"},vt={class:"steps-count"},xt={class:"icon-chevron"},At={class:"steps-progress","aria-hidden":"true"},$t={class:"steps-list"},It={class:"step-rail","aria-hidden":"true"},zt={class:"step-icon"},Lt={key:3,class:"icon-dot"},Tt={class:"step-name"},Ut={class:"step-status"},Be=ce(e.defineComponent({__name:"AgentSteps",props:{steps:{}},emits:["resize"],setup(i,{emit:h}){const w=i,y=e.ref(!0),m=h,M=()=>{y.value=!y.value,e.nextTick(()=>{requestAnimationFrame(()=>m("resize"))})},B=e.computed(()=>w.steps.some(E=>E.status==="running")),S=e.computed(()=>w.steps.some(E=>E.status==="error")),A=e.computed(()=>w.steps.filter(E=>E.status==="completed").length),$=e.computed(()=>w.steps.length===0?0:Math.round(A.value/w.steps.length*100)),k=e.computed(()=>({width:`${$.value}%`})),T=e.computed(()=>B.value?"智能处理流程":S.value?"需要关注":"全部步骤已同步"),b=e.computed(()=>{const E=w.steps.find(U=>U.status==="running");return E?`正在处理 ${E.displayName}`:S.value?"处理遇到问题":A.value===w.steps.length?"处理完成":`已完成 ${A.value}/${w.steps.length} 个步骤`}),z=E=>E==="running"?"进行中":E==="error"?"异常":"完成";return(E,U)=>i.steps.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["agent-steps",{"is-running":B.value,"is-error":S.value,"is-collapsed":!y.value}])},[e.createElementVNode("button",{type:"button",class:"steps-header","aria-expanded":y.value,onClick:M},[e.createElementVNode("span",Mt,[B.value?(e.openBlock(),e.createElementBlock("span",Bt,[e.createVNode(e.unref(ve))])):S.value?(e.openBlock(),e.createElementBlock("span",St,[e.createVNode(e.unref(me))])):(e.openBlock(),e.createElementBlock("span",Vt,[e.createVNode(e.unref(xe))]))]),e.createElementVNode("span",bt,[e.createElementVNode("span",_t,e.toDisplayString(b.value),1),e.createElementVNode("span",Nt,e.toDisplayString(T.value),1)]),e.createElementVNode("span",vt,e.toDisplayString(A.value)+"/"+e.toDisplayString(i.steps.length),1),e.createElementVNode("span",xt,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value?e.unref(Oe):e.unref(We))))])],8,Ct),e.createElementVNode("div",At,[e.createElementVNode("span",{style:e.normalizeStyle(k.value)},null,4)]),e.withDirectives(e.createElementVNode("div",$t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.steps,C=>(e.openBlock(),e.createElementBlock("div",{key:C.name,class:e.normalizeClass(["step-item",{"is-running":C.status==="running","is-completed":C.status==="completed","is-error":C.status==="error"}])},[e.createElementVNode("span",It,[e.createElementVNode("span",zt,[C.status==="running"?(e.openBlock(),e.createBlock(e.unref(ve),{key:0,class:"icon-spin"})):C.status==="completed"?(e.openBlock(),e.createBlock(e.unref(xe),{key:1})):C.status==="error"?(e.openBlock(),e.createBlock(e.unref(me),{key:2})):(e.openBlock(),e.createElementBlock("span",Lt))])]),e.createElementVNode("span",Tt,e.toDisplayString(C.displayName),1),e.createElementVNode("span",Ut,e.toDisplayString(z(C.status)),1)],2))),128))],512),[[e.vShow,y.value]])],2)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-5030f19a"]]),Dt={class:"chat-message-list-root"},Ht={key:0,class:"bg-grid"},Pt={key:0,class:"welcome-screen"},Rt={class:"welcome-content"},Ft={class:"welcome-logo"},Ot=["src"],Wt={key:1,class:"default-logo"},jt={class:"welcome-title"},Yt={key:1,class:"messages-container"},qt={key:0,class:"user-message-wrapper"},Xt={class:"message-bubble user-bubble"},Zt={key:0,class:"message-actions user-actions"},Kt=["onClick"],Jt={key:1,class:"message-content assistant-content"},Gt={key:2,class:"a2ui-card-skeleton","aria-hidden":"true"},Qt={key:1,class:"message-actions"},en=["onClick"],tn={key:0,class:"message-row message-assistant"},nn={key:0,class:"loading-ring",viewBox:"0 0 36 36"},Ae=ce(e.defineComponent({__name:"ChatMessageList",props:{messages:{default:()=>[]},isStreaming:{type:Boolean,default:!1},isTyping:{type:Boolean,default:!1},showWelcome:{type:Boolean,default:!0},appName:{default:"AI助手"},appLogo:{},agentSteps:{},showAgentSteps:{type:Boolean,default:!0},autoScroll:{type:Boolean,default:!0},contentPaddingTop:{default:"80px"},contentPaddingBottom:{default:"140px"},showBackground:{type:Boolean,default:!0},apiBaseUrl:{default:""},enableA2UI:{type:Boolean,default:!0},autoProvideA2UI:{type:Boolean,default:!0},a2uiCatalog:{},hideA2UIRawContent:{type:Boolean,default:!0},showA2UISkeleton:{type:Boolean,default:!0},a2uiActionHandler:{}},emits:["copy","scroll","scroll-bottom","a2ui-action","a2ui-error"],setup(i,{expose:h,emit:w}){const y=new WeakMap,m=i,M=w,B=e.ref(null),S=e.ref(!1),A=e.ref(!0),$=e.ref({}),k=e.ref({});(()=>{var a;if(!m.autoProvideA2UI)return;if(!m.a2uiCatalog)try{ie.useA2UIConfig();return}catch{}const t=(a=e.getCurrentInstance())==null?void 0:a.appContext.app,n=m.a2uiCatalog||ie.DEFAULT_CATALOG;!t||y.get(t)===n||(ie.provideA2UI({app:t,catalog:n,theme:ie.defaultTheme}),y.set(t,n))})();const b=ie.useMessageProcessor(),z=()=>{if(!B.value)return!0;const{scrollTop:t,scrollHeight:n,clientHeight:a}=B.value;return n-t-a<50},E=()=>{A.value=z()},U=t=>{var a,s;return!t||typeof t!="object"||t.version!=="v0.9"||[t.createSurface,t.updateComponents,t.updateDataModel,t.deleteSurface].filter(Boolean).length!==1?!1:t.createSurface?re(t.createSurface):t.updateComponents?ue(t.updateComponents):t.updateDataModel?typeof((a=C(t.updateDataModel))==null?void 0:a.surfaceId)=="string":t.deleteSurface?typeof((s=C(t.deleteSurface))==null?void 0:s.surfaceId)=="string":!1},C=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:null,re=t=>{const n=C(t);if(!n)return!1;const a=Object.keys(n);return typeof n.surfaceId=="string"&&typeof n.catalogId=="string"&&a.every(s=>s==="surfaceId"||s==="catalogId")},_=t=>Array.isArray(t)?t.every(n=>{const a=C(n);return!!(a&&typeof a.label=="string"&&typeof a.value=="string")}):!1,J=t=>Array.isArray(t)&&t.every(n=>typeof n=="string"),te=t=>Array.isArray(t)?t.every(n=>{const a=C(n);return!!(a&&typeof a.label=="string"&&typeof a.value=="string")}):!1,le=t=>{const n=C(t);return!(!n||typeof n.id!="string"||typeof n.component!="string"||Object.prototype.hasOwnProperty.call(n,"props")||Object.prototype.hasOwnProperty.call(n,"componentType")||Object.prototype.hasOwnProperty.call(n,"component_type")||n.facts!==void 0&&!_(n.facts)||n.tags!==void 0&&!J(n.tags)||["policyOptions","audienceOptions","detailOptions"].some(s=>n[s]!==void 0&&!te(n[s])))},ue=t=>{const n=C(t);return!n||typeof n.surfaceId!="string"||!Array.isArray(n.components)||n.components.length===0?!1:n.components.every(le)},P=t=>{const n=t.trim();if(!n)return null;const a=n.match(/^```(?:json|a2ui|agui|ag-ui)?\s*([\s\S]*?)\s*```$/i),s=a?a[1].trim():n;if(!s.startsWith("{")&&!s.startsWith("["))return null;try{return JSON.parse(s)}catch{return null}},Y=t=>{if(typeof t!="string")return null;const n=t.trim().toLowerCase();return n==="text_only"||n==="text-only"||n==="text"?"text_only":n==="ui_only"||n==="ui-only"||n==="ui"?"ui_only":n==="text_and_ui"||n==="text-and-ui"||n==="text+ui"||n==="both"?"text_and_ui":null},N=t=>{const n=Y(t);if(n)return n;if(typeof t=="string"){const s=P(t);return s?N(s):null}if(Array.isArray(t)){for(const s of t){const f=N(s);if(f)return f}return null}const a=C(t);return a&&(Y(a.displayMode)||Y(a.display_mode)||Y(a.a2uiDisplayMode)||Y(a.a2ui_display_mode)||N(a.metadata)||N(a.payload)||N(a.data)||N(a.rawEvent)||N(a.raw_event)||N(a.state)||N(a.delta)||N(a.aguiEvents)||N(a.agui_events)||N(a.events))||null},x=t=>{if(!t)return[];if(typeof t=="string"){const f=P(t);return f?x(f):Array.from(t.matchAll(/```(?:agui|ag-ui|a2ui|json)\s*\n([\s\S]*?)\n```/gi)).flatMap(v=>{const I=P(v[1]);return I?x(I):[]})}if(Array.isArray(t)){const f=t.map(v=>C(v)).filter(v=>!!v);return f.length===t.length&&f.every(U)?f:q(t)}if(typeof t!="object")return[];const n=t;if(U(n))return[n];const a=q(n);if(a.length>0)return a;const s=p(n);return s.length>0?s:[]},q=t=>{if(!t)return[];if(typeof t=="string"){const a=P(t);return a?q(a):[]}if(typeof t!="object")return[];if(Array.isArray(t))return t.map(s=>C(s)).filter(s=>!!s).flatMap(W);const n=t;return n.protocol==="ag-ui"?q(n.aguiEvents||n.agui_events):fe(n)?W(n):[]},fe=t=>{const n=String(t.type||"").toUpperCase();return n?n==="STATE_SNAPSHOT"?j(t.state).length>0:n==="STATE_DELTA"?j(t.delta).length>0:!0:!1},W=t=>{const n=String(t.type||"").toUpperCase();if(n==="STATE_SNAPSHOT"){const a=j(t.state);return a.length>0?a:u(t)}if(n==="STATE_DELTA"){const a=j(t.delta);return a.length>0?a:u(t)}return[]},j=t=>{const n=C(t);return n?[...x(n.a2uiMessages),...x(n.a2ui_messages),...x(n.a2ui)]:[]},l=t=>{const n=C(t);return n?W(n):[]},u=t=>[...l(t.rawEvent),...l(t.raw_event)],p=t=>{const n=[t.value,t.metadata,t.payload,t.data,t.a2uiMessages,t.a2ui_messages,t.a2ui,t.aguiEvents,t.agui_events,t.agui];for(const a of n){if(a===void 0||a===t)continue;const s=x(a);if(s.length>0)return s}return[]},V=t=>[...x(t.a2ui),...x(t.a2uiMessage),...x(t.a2uiMessages),...x(t.a2ui_message),...x(t.a2ui_messages),...x(t.agui),...x(t.aguiEvents),...x(t.agui_events),...x(t.metadata),...x(t.content)],L=t=>N(t.displayMode)||N(t.display_mode)||N(t.a2uiDisplayMode)||N(t.a2ui_display_mode)||N(t.agui)||N(t.aguiEvents)||N(t.agui_events)||N(t.metadata)||null,ne=t=>{var n,a,s,f;return((n=t==null?void 0:t.createSurface)==null?void 0:n.surfaceId)||((a=t==null?void 0:t.updateComponents)==null?void 0:a.surfaceId)||((s=t==null?void 0:t.updateDataModel)==null?void 0:s.surfaceId)||((f=t==null?void 0:t.deleteSurface)==null?void 0:f.surfaceId)||null},ae=(t,n)=>String(t.id||`index-${n}`),G=(t,n,a=!1)=>{const s={...k.value},f={...$.value},v=a?new Set(f[t]||[]):new Set;for(const I of n){const D=ne(I);D&&(s[D]=t,v.add(D))}f[t]=Array.from(v),k.value=s,$.value=f},pe=()=>{if(b.clearSurfaces(),$.value={},k.value={},!m.enableA2UI)return;const t=[];if(m.messages.forEach((n,a)=>{const s=V(n);if(s.length===0)return;const f=ae(n,a);G(f,s),t.push(...s)}),t.length!==0)try{b.processMessages(t)}catch(n){console.warn("[rt-chat-messages] A2UI payload render failed",n),M("a2ui-error",n)}},X=(t,n)=>{if(!m.enableA2UI)return[];if(L(t)==="text_only")return[];const s=ae(t,n);return($.value[s]||[]).filter(f=>k.value[f]===s)},Z=t=>{const n=typeof t.content=="string"?t.content.trimStart():"";if(!n||V(t).length>0)return!1;const a=n.match(/^```([^\s\n`]*)?/);if(!a)return!1;const s=(a[1]||"").toLowerCase();return s?["a","ag","agu","agui","ag-","ag-u","ag-ui","a2","a2u","a2ui"].includes(s):!1},K=(t,n)=>{const a=L(t);return!!(m.enableA2UI&&m.showA2UISkeleton&&m.isStreaming&&n===m.messages.length-1&&X(t,n).length===0&&(Z(t)||a==="ui_only"||a==="text_and_ui"))},F=(t,n)=>{if(!m.hideA2UIRawContent||t.attachments&&t.attachments.length>0)return!0;if(Z(t)||!t.content)return!1;if(V(t).length===0)return!0;const s=L(t);return s==="text_only"||s==="text_and_ui"?!0:s==="ui_only"?!1:X(t,n).length===0},ge=async t=>{var a;const n=(a=t==null?void 0:t.message)==null?void 0:a.action;M("a2ui-action",n,t);try{const s=m.a2uiActionHandler?await m.a2uiActionHandler(t):[],f=x(s);if(f.length>0){const v=k.value[n==null?void 0:n.surfaceId];v&&G(v,f,!0),b.processMessages(f),m.autoScroll&&!S.value&&(await e.nextTick(),ee("smooth"))}t.resolve(f)}catch(s){M("a2ui-error",s),t.reject(s instanceof Error?s:new Error(String(s)))}};let Q=0,oe=!1;const we=()=>{z()||(A.value=!1,S.value=!0)},ee=async(t="smooth",n=!1)=>{if(await e.nextTick(),B.value){if(n&&(S.value=!1),S.value)return;A.value=!0,oe=!0,B.value.scrollTo({top:B.value.scrollHeight,behavior:t}),setTimeout(()=>{oe=!1},50)}},Ee=t=>{if(M("scroll",t),!B.value)return;const n=B.value.scrollTop,a=n<Q;Q=n,!oe&&a&&(S.value=!0,A.value=!1),z()&&(A.value=!0,S.value=!1,M("scroll-bottom"))};e.watch(()=>m.messages.length,async(t,n)=>{t>(n||0)&&(S.value=!1,m.autoScroll&&ee("instant"))}),e.watch(()=>[m.messages,m.enableA2UI],pe,{deep:!0,immediate:!0});let o=null;e.watch(()=>m.messages,async()=>{if(!m.isStreaming||!m.autoScroll||S.value||document.hidden)return;const t=m.messages[m.messages.length-1];!t||t.role!=="assistant"||(o&&cancelAnimationFrame(o),o=requestAnimationFrame(async()=>{await e.nextTick(),B.value&&!S.value&&B.value.scrollTo({top:B.value.scrollHeight,behavior:"instant"})}))},{deep:!0}),e.watch(()=>m.isTyping,t=>{t&&m.autoScroll&&ee("instant")});const r=t=>{M("copy",t),navigator.clipboard&&t.content&&navigator.clipboard.writeText(t.content)};e.watch(()=>m.agentSteps,()=>{m.autoScroll&&!S.value&&ee()},{deep:!0});const c=()=>{m.autoScroll&&!S.value&&ee()},g=()=>{!document.hidden&&m.isStreaming&&m.autoScroll&&!S.value&&e.nextTick(()=>{B.value&&(B.value.scrollTo({top:B.value.scrollHeight,behavior:"instant"}),A.value=!0)})};let d;return e.onMounted(()=>{E(),d=b.onEvent(ge),document.addEventListener("visibilitychange",g)}),e.onUnmounted(()=>{d==null||d(),document.removeEventListener("visibilitychange",g)}),h({scrollToBottom:ee,containerRef:B}),(t,n)=>(e.openBlock(),e.createElementBlock("div",Dt,[i.showBackground?(e.openBlock(),e.createElementBlock("div",Ht)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"chat-message-list",ref_key:"containerRef",ref:B,onScroll:Ee,onWheel:we,onTouchmove:we,style:e.normalizeStyle({paddingTop:i.contentPaddingTop,paddingBottom:i.contentPaddingBottom})},[i.showWelcome&&i.messages.length===0?(e.openBlock(),e.createElementBlock("div",Pt,[e.renderSlot(t.$slots,"welcome",{},()=>[e.createElementVNode("div",Rt,[e.createElementVNode("div",Ft,[i.appLogo?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.appLogo,alt:"Logo"},null,8,Ot)):(e.openBlock(),e.createElementBlock("div",Wt,[...n[1]||(n[1]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"32",height:"32"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"})],-1)])]))]),e.createElementVNode("h2",jt,e.toDisplayString(i.appName),1),n[2]||(n[2]=e.createElementVNode("p",{class:"welcome-desc"},"今天有什么可以帮您?",-1))])],!0)])):(e.openBlock(),e.createElementBlock("div",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.messages,(a,s)=>(e.openBlock(),e.createElementBlock("div",{key:a.id||s,class:e.normalizeClass(["message-row",a.role==="user"?"message-user":"message-assistant"])},[a.role==="user"?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("div",Xt,[e.createVNode(ke,{message:a,"is-user":!0,"api-base-url":i.apiBaseUrl},null,8,["message","api-base-url"])]),a.content?(e.openBlock(),e.createElementBlock("div",Zt,[e.createElementVNode("button",{class:"action-btn",onClick:f=>r(a),title:"复制"},[...n[3]||(n[3]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"})],-1),e.createElementVNode("span",null,"复制",-1)])],8,Kt)])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Jt,[i.showAgentSteps&&s===i.messages.length-1&&i.agentSteps&&i.agentSteps.length>0?(e.openBlock(),e.createBlock(Be,{key:0,steps:i.agentSteps,onResize:c},null,8,["steps"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-bubble assistant-bubble",{"assistant-bubble-a2ui":X(a,s).length>0}])},[F(a,s)?(e.openBlock(),e.createBlock(ke,{key:0,message:a,"is-user":!1,"api-base-url":i.apiBaseUrl,"is-streaming":i.isStreaming&&s===i.messages.length-1},null,8,["message","api-base-url","is-streaming"])):e.createCommentVNode("",!0),X(a,s).length>0?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["a2ui-surfaces",{"a2ui-surfaces-with-content":F(a,s)}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X(a,s),f=>(e.openBlock(),e.createBlock(e.unref(ie.A2UISurface),{key:f,"surface-id":f},null,8,["surface-id"]))),128))],2)):e.createCommentVNode("",!0),K(a,s)?(e.openBlock(),e.createElementBlock("div",Gt,[...n[4]||(n[4]=[e.createStaticVNode('<div class="skeleton-header" data-v-7758e8ae><div class="skeleton-avatar skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-title-group" data-v-7758e8ae><div class="skeleton-line skeleton-title skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-line skeleton-subtitle skeleton-shimmer" data-v-7758e8ae></div></div></div><div class="skeleton-line skeleton-summary skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-line skeleton-summary short skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-facts" data-v-7758e8ae><div class="skeleton-fact skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-fact skeleton-shimmer" data-v-7758e8ae></div><div class="skeleton-fact skeleton-shimmer" data-v-7758e8ae></div></div>',4)])])):e.createCommentVNode("",!0)],2),F(a,s)&&a.content&&!(i.isStreaming&&s===i.messages.length-1)?(e.openBlock(),e.createElementBlock("div",Qt,[e.createElementVNode("button",{class:"action-btn",onClick:f=>r(a),title:"复制"},[...n[5]||(n[5]=[e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"12",height:"12"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c6 6 14.1 9.4 22.6 9.4H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM352 853.3V704h149.3l-149.3 149.3zM224 256h448v640H416V672c0-17.7-14.3-32-32-32H224V256z"})],-1),e.createElementVNode("span",null,"复制",-1)])],8,en)])):e.createCommentVNode("",!0)]))],2))),128)),i.isTyping?(e.openBlock(),e.createElementBlock("div",tn,[...n[6]||(n[6]=[e.createElementVNode("div",{class:"typing-indicator"},[e.createElementVNode("div",{class:"typing-dot"}),e.createElementVNode("div",{class:"typing-dot",style:{"animation-delay":"0.2s"}}),e.createElementVNode("div",{class:"typing-dot",style:{"animation-delay":"0.4s"}})],-1)])])):e.createCommentVNode("",!0)]))],36),e.createVNode(e.Transition,{name:"fade-slide"},{default:e.withCtx(()=>[A.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"scroll-to-bottom-btn",style:e.normalizeStyle({bottom:`calc(${i.contentPaddingBottom||"140px"} + 20px)`}),onClick:n[0]||(n[0]=a=>ee("smooth",!0))},[n[8]||(n[8]=e.createElementVNode("div",{class:"btn-inner"},[e.createElementVNode("svg",{class:"arrow-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2.5",d:"M19 9l-7 7-7-7"})])],-1)),i.isStreaming?(e.openBlock(),e.createElementBlock("svg",nn,[...n[7]||(n[7]=[e.createElementVNode("circle",{class:"loading-circle",cx:"18",cy:"18",r:"16"},null,-1)])])):e.createCommentVNode("",!0)],4))]),_:1})]))}}),[["__scopeId","data-v-7758e8ae"]]),an={install(i){i.component("ChatMessageList",Ae),i.component("MultimodalMessage",ke),i.component("MarkdownMessage",Me),i.component("AgentSteps",Be)}};H.AgentSteps=Be,H.ChatMessageList=Ae,H.MarkdownMessage=Me,H.MultimodalMessage=ke,H.default=an,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|