@blueking/ai-blueking 3.1.0-beta.3 → 3.1.0-beta.4
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/standalone/index.es.min.js +18 -18
- package/dist/standalone/index.iife.min.js +1 -1
- package/dist/standalone/index.umd.min.js +1 -1
- package/dist/vue2/index.es.min.js +18 -18
- package/dist/vue2/index.iife.min.js +1 -1
- package/dist/vue2/index.umd.min.js +1 -1
- package/dist/vue3/index.iife.min.js +1 -1
- package/package.json +3 -3
|
@@ -3903,7 +3903,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
|
|
|
3903
3903
|
data-tag-* 是编辑器 void 节点的识别依据(见 ai-slash-input/constants.ts 的 tagSchema)。
|
|
3904
3904
|
在消息里它们不参与交互,但保留后从消息复制到输入框可以原样还原成标签。
|
|
3905
3905
|
`),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{class:(0,t.normalizeClass)([`ai-mention-tag`,{"is-interactive":!!e.description||i.value}]),contenteditable:`false`,"data-tag-description":e.description||void 0,"data-tag-icon":e.icon||void 0,"data-tag-label":e.label,"data-tag-type":e.type,"data-tag-value":e.value,onClick:a},[(0,t.createVNode)((0,t.unref)(T9),{icon:e.icon,name:e.label,type:e.type},null,8,[`icon`,`name`,`type`]),(0,t.createElementVNode)(`span`,xRt,(0,t.toDisplayString)(e.label),1)],10,bRt)),[[(0,t.unref)(Ju),o.value]])],2112))}}),CRt={class:`ai-mention-text`},wRt={key:0},TRt={key:0},ERt=(0,t.defineComponent)({__name:`mention-text`,props:{doc:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,CRt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.doc,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[n>0?((0,t.openBlock)(),(0,t.createElementBlock)(`br`,wRt)):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[e.type===`text`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,TRt,(0,t.toDisplayString)(e.text),1)):((0,t.openBlock)(),(0,t.createBlock)(SRt,{key:1,description:e.data.description,icon:e.data.icon,label:e.data.label,type:e.data.type,value:e.data.value},null,8,[`description`,`icon`,`label`,`type`,`value`]))],64))),128))],64))),128))]))}}),DRt=(e,t,n,r)=>new i9().delete(n,r),ORt=(e,t)=>{let n=0;for(let r of e){let e=`text`in r?r.text.length:1;if(t<n+e)return!(`text`in r);n+=e}return!1},kRt=(e,t,n)=>{let[r,i]=t;if(Q7(r,i)!==0)return;let[a,o]=i,s=e[a];if(!s)return;let l=n===`backward`?o-1:o;if(!(l<0||!ORt(s,l)))return new i9().delete([a,l],[a,l+1])},ARt=(e,t,n,r)=>new i9().insert(n,[[{data:{label:r.name,value:r.id,type:r.type,icon:typeof r.icon==`string`?r.icon:``,description:r.description??``}}]]),jRt=(e,t,n,r)=>new i9().insert(n,[[{text:r}]]),MRt=e=>{let t=e.data;return t.type===`skill`?`/${t.value}`:`@${t.label}`},NRt=e=>e9(e,MRt),PRt=yLt({multiline:!0,void:{tag:vLt({is:e=>e.contentEditable===`false`&&e.dataset.tagType!==void 0,data:e=>({label:e.dataset.tagLabel??e.textContent,value:e.dataset.tagValue,type:e.dataset.tagType,icon:e.dataset.tagIcon??``,description:e.dataset.tagDescription??``}),plain:e=>e.type===`skill`?`/${e.value}`:e.label})}}),E9=()=>{if(typeof window>`u`)return null;let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=t.startContainer;if(n.nodeType!==Node.TEXT_NODE)return null;let r=t.startOffset;return{node:n,offset:r,textBefore:(n.textContent||``).slice(0,r)}},FRt=()=>{let e=(0,t.shallowRef)(null),n=(0,t.shallowRef)(``),r=null,i=()=>{e.value=null,n.value=``,r=null},a=e=>{let t=E9();if(!t){i();return}let r=e===`\\`?`\\\\`:e,a=t.textBefore.match(RegExp(`(${r}[^\\s]*)$`));if(!a){i();return}n.value=a[1].slice(1)},o=()=>{let e=E9();if(!e){n.value=``;return}if(r){if(e.node!==r.node||e.offset<r.offset){i();return}n.value=(e.node.textContent||``).slice(r.offset,e.offset);return}n.value=e.textBefore.match(/(\S*)$/)?.[1]??``};return{trigger:e,keyword:n,activateChar:t=>{e.value=t,n.value=``,r=null},activatePlus:()=>{let t=E9();e.value=`plus`,n.value=``,r=t?{node:t.node,offset:t.offset}:null},close:i,sync:()=>{if(e.value){if(e.value===`plus`){o();return}a(e.value)}},getConsumeLength:()=>n.value.length+(e.value&&e.value!==`plus`?1:0)}},IRt={class:`ai-slash-input-wrapper`},LRt=[`aria-placeholder`],RRt={key:0},zRt={key:1},BRt=(0,t.defineComponent)({__name:`ai-slash-input`,props:{modelValue:{},placeholder:{default:wl?`Please enter content`:`请输入内容`}},emits:[`update:modelValue`,`keydown`,`upload`,`menuChange`],setup(e,{expose:n,emit:r}){let i=(0,t.useTemplateRef)(`editorRef`),a=r,o=e,s=(0,t.customRef)((e,t)=>({get(){return e(),typeof o.modelValue==`string`?t9(o.modelValue):o.modelValue},set(e){a(`update:modelValue`,e),t()}})),{commandSelection:l,GetCursorPosition:u,GetDocSnapshot:d,docSnapshot:f}=DSe(),p=FRt(),m,h,g=null,_=null,v=()=>{g!==null&&(clearTimeout(g),g=null),_!==null&&(clearTimeout(_),_=null)};(0,t.watch)(()=>o.modelValue,()=>{m.command(d),e9(f.value||[])!==e9(s.value||[])&&m.command(l9,e9(s.value||[]))},{deep:!1}),(0,t.watch)([p.trigger,p.keyword],()=>{a(`menuChange`,{trigger:p.trigger.value,keyword:p.keyword.value})});let y=()=>{g!==null&&clearTimeout(g),g=setTimeout(()=>{g=null,p.sync()},16)},b=!1,x=(e,t,n)=>{let r=kRt(e,t,n);return b=r!=null,r},S=e=>(e.key===`Backspace`||e.key===`Delete`)&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey,C=e=>{if(a(`keydown`,e),e.key===`Enter`||e.key===`NumpadEnter`)return e.shiftKey?void 0:(e.preventDefault?.(),!1);if(S(e)&&(b=!1,m.command(x,e.key===`Backspace`?`backward`:`forward`),b))return e.preventDefault?.(),y(),!0;hRt.includes(e.key)&&p.activateChar(e.key),y()},w=()=>{if(typeof window>`u`||!i.value)return;i.value.focus();let e=window.getSelection(),t=document.createRange();e&&(t.selectNodeContents(i.value),t.collapse(!1),e.removeAllRanges(),e.addRange(t))},T=()=>{_!==null&&clearTimeout(_),_=setTimeout(()=>{_=null,w()},100)},E=()=>{m.command(u);let{column:e,line:t}=l.value,n=Math.max(e-p.getConsumeLength(),0);return n<e&&m.command(DRt,[t,n],[t,e]),[t,n]},D=e=>{let[t,n]=E();m.command(ARt,[t,n],e),m.command(jRt,[t,n+1],` `),p.close(),T()},O=e=>{m.command(l9,e),p.close(),T()},k=e=>{let t=s.value??[],n=Math.max(t.length-1,0),r=(t[n]??[]).reduce((e,t)=>e+(t.type===`text`?t.text.length:1),0);m.command(ARt,[n,r],e),m.command(jRt,[n,r+1],` `),T()},A=()=>{if(!i.value)return;let e=window.getSelection()?.anchorNode??null;(!e||!i.value.contains(e))&&w(),p.activatePlus()},j=e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),a(`upload`,n))},M=()=>{h?.(),m=gLt({doc:s.value,schema:PRt,onChange:async e=>{s.value=e,y()},onKeyDown:e=>C(e)}),h=m.input(i.value)};return(0,t.onMounted)(()=>{M(),i.value?.addEventListener(`paste`,j)}),(0,t.onUnmounted)(()=>{v(),m.command(l9,``),h?.(),i.value?.removeEventListener(`paste`,j)}),n({appendMention:k,cleanup:()=>{m.command(l9,``),p.close()},closeMenu:p.close,consumeTriggerText:E,focus:T,insertMenuItem:D,openPlusMenu:A,replaceAll:O}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,IRt,[(0,t.createElementVNode)(`div`,{ref_key:`editorRef`,ref:i,"aria-placeholder":e.placeholder,class:`ai-slash-input`,spellcheck:`false`},[s.value?.length&&s.value.some(e=>e.length)?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(s.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n},[e.length?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(e,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n},[e.type===`text`?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,RRt,(0,t.toDisplayString)(e.text),1)):e.type===`tag`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(SRt),{key:1,description:e.data.description,icon:e.data.icon,label:e.data.label,type:e.data.type,value:e.data.value},null,8,[`description`,`icon`,`label`,`type`,`value`])):(0,t.createCommentVNode)(`v-if`,!0)],64))),128)):((0,t.openBlock)(),(0,t.createElementBlock)(`br`,zRt))]))),128)):(0,t.createCommentVNode)(`v-if`,!0)],8,LRt)]))}});function VRt(e){let{isEn:t,hasSlashMenu:n,hasPromptMenu:r,hasAtMenu:i}=e,a=[];return n&&a.push(t?`Input "/" to trigger Skill, tool and MCP`:`输入 "/" 唤出 Skill,工具,MCP`),i&&a.push(t?`Input "@" to trigger conversation files and knowledge base`:`输入 "@" 唤出会话产物,知识库`),r&&a.push(t?`Input "\\" to trigger prompt`:`输入 "\\" 唤出 Prompt`),a.push(t?`Use Shift + Enter to enter a new line`:`通过 Shift + Enter 进行换行输入`),a.join(`
|
|
3906
|
-
`)}var HRt={class:`ai-input-attachment`},URt={class:`ai-input-attachment-default`},WRt={class:`ai-input-attachment-before-send`},GRt=(0,t.defineComponent)({__name:`input-attachment`,props:{messageState:{},sendDisabledTip:{},tippyOptions:{}},emits:[`sendMessage`,`stopSending`],setup(e,{emit:n}){let r=e,i=n,a=()=>{i(`stopSending`)},o=()=>{r.sendDisabledTip||r.messageState===Al.Disabled||r.messageState===Al.Pending||r.messageState===Al.Streaming||i(`sendMessage`)};return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,HRt,[(0,t.createElementVNode)(`div`,URt,[(0,t.renderSlot)(n.$slots,`default`)]),(0,t.createElementVNode)(`div`,WRt,[(0,t.renderSlot)(n.$slots,`before-send`)]),(0,t.renderSlot)(n.$slots,`send-icon`,{},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`send-message-icon`,[e.messageState&&`send-message-icon__${e.messageState}`,{"send-message-icon__disabled":e.sendDisabledTip}]]),onClick:o},[e.messageState===(0,t.unref)(Al).Streaming||e.messageState===(0,t.unref)(Al).Pending||e.messageState===(0,t.unref)(Al).Fetching?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(pye),{key:0,onClick:a},null,512)),[[(0,t.unref)(Ju),{...e.tippyOptions,content:(0,t.unref)(Tl)(`停止`),theme:`ai-chat-box`,offset:[0,16]}]]):(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fye),{key:1},null,512)),[[(0,t.unref)(Ju),{...e.tippyOptions,content:e.sendDisabledTip||(r.messageState===(0,t.unref)(Al).Disabled?void 0:(0,t.unref)(Tl)(`发送`)),theme:`ai-chat-box`,offset:[0,16]}]])],2)])]))}}),KRt={class:`ai-input-menu-option-name`},qRt=(0,t.defineComponent)({__name:`input-menu-option`,props:{active:{type:Boolean},item:{}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>{if(!r.item.description)return{content:``,onShow:()=>!1};let e=_Rt(r.item.type);return dRt({title:e?`${Tl(e)}:${r.item.name}`:r.item.name,description:r.item.description})}),o=()=>{r.item.disabled||i(`select`,r.item)};return(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-input-menu-option`,{"is-active":e.active,"is-disabled":e.item.disabled}]),onClick:o},[(0,t.createVNode)((0,t.unref)(T9),{icon:e.item.icon,name:e.item.name,type:e.item.type},null,8,[`icon`,`name`,`type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,KRt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.item.name),1)])),[[(0,t.unref)(ld),{text:e.item.name,zIndex:(0,t.unref)(Ml)}]])],2)),[[(0,t.unref)(Ju),a.value]])}}),JRt={class:`ai-input-menu-title`},YRt={key:0,class:`ai-input-menu-empty`},XRt=[`onClick`],ZRt=(0,t.defineComponent)({__name:`input-menu-panel`,props:{flatItems:{},groups:{}},emits:[`select`,`toggleGroup`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`panelRef`),o=(0,t.computed)(()=>r.flatItems),{activeIndex:s}=BSe({items:o,onSelect:e=>i(`select`,e),menuRef:a}),l=(0,t.computed)(()=>r.flatItems[s.value]);(0,t.watch)(o,()=>{s.value=0});let u=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(`close`))};return(0,t.onMounted)(()=>{window.addEventListener(`keydown`,u,!0)}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,u,!0)}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`panelRef`,ref:a,class:`ai-input-menu`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.groups,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`ai-input-menu-group`,{"is-divided":e.divided}])},[(0,t.createElementVNode)(`div`,JRt,(0,t.toDisplayString)((0,t.unref)(Tl)(e.name)),1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createBlock)(qRt,{key:e.id,active:l.value?.id===e.id,item:e,onSelect:r[0]||=e=>i(`select`,e)},null,8,[`active`,`item`]))),128)),e.items.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,YRt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无数据`)),1)),e.restCount?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`ai-input-menu-toggle`,onClick:t=>i(`toggleGroup`,e.key)},[(0,t.createVNode)((0,t.unref)(Rl),{class:(0,t.normalizeClass)([`ai-input-menu-toggle-icon`,{"is-expanded":e.expanded}])},null,8,[`class`]),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.expanded?(0,t.unref)(Tl)(`收起`):(0,t.unref)(Tl)(`更多`))+` +`+(0,t.toDisplayString)(e.restCount),1)],8,XRt)):(0,t.createCommentVNode)(`v-if`,!0)],2))),128))],512))}}),QRt=(0,t.defineComponent)({__name:`input-menu`,props:{flatItems:{},groups:{},tippyOptions:{},visible:{type:Boolean}},emits:[`select`,`toggleGroup`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`tippyRef`),o={name:`sameWidth`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>{e.elements.popper.style.width=`${e.elements.reference.getBoundingClientRect().width}px`}},s=(0,t.computed)(()=>({appendTo:()=>document.body,arrow:!1,duration:0,hideOnClick:!1,interactive:!0,maxWidth:`none`,offset:[0,8],placement:`top`,popperOptions:{modifiers:[o]},theme:`ai-input-menu`,trigger:`manual`,zIndex:Ml,...r.tippyOptions||{},onClickOutside:()=>i(`close`)}));return(0,t.watch)(()=>r.visible,()=>{if(r.visible){a.value?.show?.();return}a.value?.hide?.()},{flush:`post`,immediate:!0}),(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:a,tag:`div`},s.value),{content:(0,t.withCtx)(()=>[e.visible?((0,t.openBlock)(),(0,t.createBlock)(ZRt,{key:0,"flat-items":e.flatItems,groups:e.groups,onClose:r[0]||=e=>i(`close`),onSelect:r[1]||=e=>i(`select`,e),onToggleGroup:r[2]||=e=>i(`toggleGroup`,e)},null,8,[`flat-items`,`groups`])):(0,t.createCommentVNode)(`v-if`,!0)]),default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`)]),_:3},16))}}),$Rt=e=>{let n=(0,t.shallowRef)([]);(0,t.watch)([()=>e.keyword.value,()=>e.trigger.value],()=>{n.value=[]});let r=(0,t.computed)(()=>{let t=e.trigger.value;if(!t)return[];let r=Math.max(e.groupItemLimit.value,1),i=e.keyword.value.trim().toLowerCase(),a=[];for(let o of pRt[t]){let t=fRt[o],s=e.sources.value.filter(e=>(e.type!==`artifact`||!!e.id)&&t.types.includes(e.type)&&(!i||e.name.toLowerCase().includes(i)));if(!s.length)continue;let l=n.value.includes(o),u=Math.max(s.length-r,0);a.push({key:o,name:t.name,divided:mRt.includes(o),expanded:l,items:l||!u?s:s.slice(0,r),restCount:u})}return a});return{groups:r,flatItems:(0,t.computed)(()=>r.value.flatMap(e=>e.items.filter(e=>!e.disabled))),hasContent:(0,t.computed)(()=>r.value.length>0),toggleGroup:e=>{let t=n.value.indexOf(e);n.value=t===-1?[...n.value,e]:[...n.value.slice(0,t),...n.value.slice(t+1)]}}},ezt=[{key:`support_thinking`,label:()=>Tl(`深度思考`),theme:`primary`},{key:`support_thinking_quick`,label:()=>Tl(`快速思考`),theme:`success`},{key:`support_vision`,label:()=>Tl(`图生文`),theme:`warning`}],tzt=e=>ezt.filter(t=>e.property?.[t.key]).map(e=>({text:e.label(),theme:e.theme})),nzt=(e,t)=>({allowHTML:!1,appendTo:t?.appendTo??(()=>document.body),arrow:!0,content:``,delay:[0,0],getReferenceClientRect:e,interactive:!1,offset:[0,8],placement:t?.placement??`auto`,popperOptions:{strategy:`fixed`},theme:`ai-chat-box`,trigger:`manual`,zIndex:t?.zIndex??10001}),rzt={class:`ai-model-selector-panel-search`},izt=[`onClick`,`onMouseenter`],azt=[`title`],ozt={key:1,class:`ai-model-selector-panel-option-tags`},szt={key:0,class:`ai-model-selector-panel-empty`},czt=(0,t.defineComponent)({__name:`model-selector-panel`,props:(0,t.mergeModels)({models:{},searchPlaceholder:{},selectedName:{},tippyOptions:{}},{keyword:{default:``},keywordModifiers:{}}),emits:(0,t.mergeModels)([`select`],[`update:keyword`]),setup(e,{expose:r,emit:i}){let a=e,o=(0,t.computed)(()=>{let e=new Map;return a.models.forEach(t=>e.set(t.llm_name,tzt(t))),e}),s=i,l=(0,t.useModel)(e,`keyword`),u=(0,t.useTemplateRef)(`panelRef`),d=(0,t.useTemplateRef)(`searchInputRef`),f,p,m,h=0,g=e=>e.description?.trim()||void 0,_=e=>g(e)?void 0:e.llm_name,v=Object.assign(()=>p?.isConnected?p.getBoundingClientRect():new DOMRect,{contextElement:document.body}),y=e=>{if(e instanceof HTMLElement)return e;if(typeof e==`function`){let t=e(document.body);if(t instanceof HTMLElement)return t}return document.body},b=()=>{m!==void 0&&(clearTimeout(m),m=void 0)},x=()=>{h+=1,b(),p=void 0;let e=f;f=void 0,e?.destroy()},S=(e,t)=>{let r=g(t);if(!r){x();return}let i=e.currentTarget;if(!(i instanceof HTMLElement))return;b(),p=i;let o=h;m=setTimeout(()=>{m=void 0,!(o!==h||p!==i||!i.isConnected)&&(f||=(v.contextElement=y(a.tippyOptions?.appendTo),(0,n.default)(document.createElement(`div`),{...nzt(v,a.tippyOptions),onShow:()=>{if(!p?.isConnected)return!1}})),f.setContent(r),f.show())},300)},C=()=>{x()};(0,t.onBeforeUnmount)(x);let w=(0,t.shallowRef)(a.models),{activeIndex:T}=BSe({items:w,menuRef:u,onSelect:e=>E(e)});(0,t.watch)(()=>a.models,e=>{w.value=e,T.value=0,x()});let E=e=>{e.disabled||s(`select`,e)};return r({focusSearch:()=>{(0,t.nextTick)(()=>{d.value?.focus()})},hideDescriptionTip:x}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`panelRef`,ref:u,class:`ai-model-selector-panel`,onScrollPassive:x},[(0,t.createElementVNode)(`div`,rzt,[(0,t.createVNode)((0,t.unref)(is),{ref_key:`searchInputRef`,ref:d,modelValue:l.value,"onUpdate:modelValue":r[0]||=e=>l.value=e,behavior:`simplicity`,class:`ai-model-selector-panel-search-input`,clearable:``,placeholder:e.searchPlaceholder,type:`text`},{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($ve),{class:`ai-model-selector-panel-search-icon`})]),_:1},8,[`modelValue`,`placeholder`])]),(0,t.createElementVNode)(`div`,{class:`ai-model-selector-panel-list`,onScrollPassive:x},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.models,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.id,class:(0,t.normalizeClass)([`ai-model-selector-panel-option`,{"is-selected":n.llm_name===e.selectedName,"is-active":r===(0,t.unref)(T),"is-disabled":n.disabled}]),onClick:e=>E(n),onMouseenter:e=>S(e,n),onMouseleave:C},[n.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(T9),{key:0,class:`ai-model-selector-panel-option-icon`,icon:n.icon,name:n.llm_name,type:`model`},null,8,[`icon`,`name`])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,{class:`ai-model-selector-panel-option-name`,title:_(n)},(0,t.toDisplayString)(n.llm_name),9,azt),o.value.get(n.llm_name)?.length?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,ozt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value.get(n.llm_name),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:n,class:(0,t.normalizeClass)([`ai-model-capability-tag`,`is-${e.theme||`default`}`])},(0,t.toDisplayString)(e.text),3))),128))])):(0,t.createCommentVNode)(`v-if`,!0)],42,izt))),128)),e.models.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,szt,[(0,t.createVNode)((0,t.unref)(hc),{scene:`part`,type:`empty`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`搜索结果为空`)),1)]),_:1})]))],32)],544))}}),lzt={class:`ai-model-selector-trigger-name`},uzt=(0,t.defineComponent)({__name:`model-selector-trigger`,props:{disabled:{type:Boolean},expanded:{type:Boolean},model:{},placeholder:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-model-selector-trigger`,{"is-expanded":e.expanded,"is-disabled":e.disabled}])},[e.model?.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(T9),{key:0,class:`ai-model-selector-trigger-icon`,icon:e.model.icon,name:e.model.llm_name,type:`model`},null,8,[`icon`,`name`])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,lzt,(0,t.toDisplayString)(e.model?.llm_name||e.placeholder),1),(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-model-selector-trigger-arrow`})],2))}}),dzt=e=>{let n=(0,t.shallowRef)(``);return{keyword:n,filteredModels:(0,t.computed)(()=>{let t=n.value.trim().toLowerCase();return t?e.models.value.filter(e=>e.llm_name.toLowerCase().includes(t)):e.models.value}),currentModel:(0,t.computed)(()=>e.models.value.find(t=>t.llm_name===e.selectedModel.value)),resetKeyword:()=>{n.value=``}}},fzt=(0,t.defineComponent)({__name:`model-selector`,props:(0,t.mergeModels)({disabled:{type:Boolean},models:{default:()=>[]},placeholder:{default:()=>Tl(`选择模型`)},searchPlaceholder:{default:()=>Tl(`搜索模型关键字`)},tippyOptions:{default:void 0}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`,`show`],[`update:modelValue`]),setup(e,{emit:n}){let r=e,i=n,a=(0,t.useModel)(e,`modelValue`),o=(0,t.useTemplateRef)(`tippyRef`),s=(0,t.useTemplateRef)(`panelRef`),l=(0,t.shallowRef)(!1),{keyword:u,filteredModels:d,currentModel:f,resetKeyword:p}=dzt({models:(0,t.toRef)(r,`models`),selectedModel:a}),m=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],placement:`top-end`,theme:`ai-model-selector`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),h=()=>{if(r.disabled||!r.models.length)return!1;l.value=!0,p(),i(`show`),s.value?.focusSearch()},g=()=>{l.value=!1,s.value?.hideDescriptionTip()},_=e=>{a.value=e.llm_name,i(`change`,e),o.value?.hide?.()};return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:o},m.value,{onHidden:g,onShow:h}),{content:(0,t.withCtx)(()=>[(0,t.createVNode)(czt,{ref_key:`panelRef`,ref:s,keyword:(0,t.unref)(u),"onUpdate:keyword":r[0]||=e=>(0,t.isRef)(u)?u.value=e:null,models:(0,t.unref)(d),"search-placeholder":e.searchPlaceholder,"selected-name":a.value,"tippy-options":e.tippyOptions,onSelect:_},null,8,[`keyword`,`models`,`search-placeholder`,`selected-name`,`tippy-options`])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(uzt,{disabled:e.disabled,expanded:l.value,model:(0,t.unref)(f),placeholder:e.placeholder},null,8,[`disabled`,`expanded`,`model`,`placeholder`])]),_:1},16))}}),pzt={class:`chat-input-wrapper`},mzt=[`accept`],hzt={key:1,class:`ai-divider`},gzt=(0,t.defineComponent)({__name:`chat-input`,props:(0,t.mergeModels)({accept:{default:g_e},defaultUploadFiles:{},inputMaxHeight:{default:280},menuGroupItemLimit:{default:4},menuSources:{default:()=>[]},messageStatus:{},models:{},modelValue:{},onSendMessage:{},onStopSending:{},onUpload:{},placeholder:{},sendDisabledTip:{},shortcutId:{},shortcuts:{},supportUpload:{type:Boolean,default:!0},tippyOptions:{}},{cite:{required:!1,default:``},citeModifiers:{},selectedModel:{required:!1},selectedModelModifiers:{}}),emits:(0,t.mergeModels)([`selectShortcut`,`deleteShortcut`,`deleteFile`,`update:modelValue`,`modelChange`],[`update:cite`,`update:selectedModel`]),setup(e,{expose:n,emit:r}){let i=(0,t.useTemplateRef)(`aiSlashInputRef`),a=(0,t.useTemplateRef)(`filesRef`),o=(0,t.useTemplateRef)(`fileInputRef`),s=(0,t.useModel)(e,`cite`),l=(0,t.useModel)(e,`selectedModel`),u=(0,t.shallowRef)(280),d=e,f=r,p=(0,t.computed)(()=>new Set(_.value.map(e=>e.type))),m=(0,t.computed)(()=>d.placeholder===void 0?VRt({isEn:wl,hasSlashMenu:[`skill`,`mcp`,`tool`].some(e=>p.value.has(e)),hasAtMenu:[`knowledgebase`,`doc`,`artifact`].some(e=>p.value.has(e)),hasPromptMenu:p.value.has(`prompt`)}):d.placeholder),h=(0,t.ref)(d.defaultUploadFiles||[]),g=(0,t.computed)(()=>h.value.map(id).filter(e=>!!e)),_=(0,t.computed)(()=>{let e=new Map(d.menuSources.map(e=>[`${e.type}:${e.id}`,e]));for(let t of g.value)e.set(`artifact:${t.outputId}`,ad(t));return[...e.values()]}),v=(0,t.computed)(()=>d.shortcuts?.find(e=>e.id===d.shortcutId)),y=(0,t.shallowRef)(null),b=(0,t.shallowRef)(``),x=(0,t.computed)(()=>typeof d.modelValue==`string`?new Set:new Set(d.modelValue.flat().filter(e=>e.type===`tag`).map(e=>`${e.data.type}:${e.data.value}`))),S=(0,t.computed)(()=>{let e=_.value.filter(e=>!x.value.has(`${e.type}:${e.id}`));return d.supportUpload?[{id:`__built_in_file__`,type:`file`,name:Tl(`文件`)},...e]:e}),C=(0,t.computed)(()=>d.accept||void 0),{groups:w,flatItems:T,hasContent:E,toggleGroup:D}=$Rt({sources:S,keyword:b,trigger:y,groupItemLimit:(0,t.computed)(()=>d.menuGroupItemLimit)}),O=(0,t.computed)(()=>!!y.value&&E.value),k=(0,t.computed)(()=>d.supportUpload||d.menuSources.length>0),A=e=>{y.value=e.trigger,b.value=e.keyword},j=()=>{i.value?.closeMenu?.()},M=()=>{if(y.value===`plus`){j();return}i.value?.openPlusMenu?.()},N=e=>{D(e)},P=()=>{o.value?.click()},F=e=>{if(e.type===`file`){i.value?.consumeTriggerText?.(),j(),P();return}if(e.type===`prompt`){i.value?.replaceAll?.(e.content??e.name);return}i.value?.insertMenuItem?.(e)},I=(0,t.computed)(()=>typeof d.modelValue==`string`?d.modelValue:NRt(d.modelValue)),L=(0,t.computed)(()=>d.messageStatus&&[Al.Pending,Al.Streaming,Al.Fetching].includes(d.messageStatus)||h.value.length>0||I.value.trim()?d.messageStatus:Al.Disabled),R=(0,t.computed)(()=>h.value.some(e=>e.status===S9.Pending)),ee=(0,t.computed)(()=>h.value.some(e=>e.status===S9.Error)),z=(0,t.computed)(()=>{if(d.sendDisabledTip)return d.sendDisabledTip;if(R.value)return Tl(`文件上传中,请稍候`);if(ee.value)return Tl(`存在上传失败的文件,请删除后重试`)});(0,t.watchPostEffect)(()=>{let e=d.inputMaxHeight||280;if(h.value.length<1||!a.value){u.value=e;return}u.value=e+(a.value?.clientHeight||0)});let B=()=>USe(Array.isArray(d.modelValue)?d.modelValue:[],g.value),V=async()=>{try{if(z.value)return!1;i.value?.cleanup?.();let e;return h.value?.length?(e=h.value?.slice().map(e=>({type:Ol.Binary,id:e.id,outputId:e.outputId,url:e.url,mimeType:e.mimeType||e.file?.type||``,filename:nd(e),size:rd(e)})),I.value.trim()&&e.push({type:Ol.Text,text:I.value})):e=I.value,d.onSendMessage?.(e,B()),h.value=[],!0}catch(e){return console.error(e),!1}},te=e=>{if(e.key===`Enter`||e.key===`NumpadEnter`){if(e.shiftKey||O.value||L.value===Al.Disabled||z.value||L.value===Al.Fetching||L.value===Al.Streaming||L.value===Al.Pending)return;V()}},ne=async()=>{try{d.onStopSending?.()}catch(e){console.error(e)}},re=()=>{s.value=``},ie=e=>{f(`selectShortcut`,e)},ae=()=>{f(`deleteShortcut`)},H=e=>{f(`modelChange`,e)},oe=(C_e/(1024*1024)).toFixed(1),se=(e,t)=>{if(t?.status!==`failed`&&(t?.id||t?.path||t?.download_url||t?.status===`success`)){e.id=t.id||t.path,e.outputId=t.path,e.url=t.download_url,e.status=S9.Success;return}e.status=S9.Error},ce=async e=>{if(!d.supportUpload)return;let n=new Set(h.value.map(e=>e.file?td(e.file):``)),r=[],i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o],l=td(s);if(n.has(l))continue;if(h.value.length>=9){i+=e.length-o;break}if(!XSe(s,d.accept)){a+=1;continue}if(s.size<=0||s.size>=20971520){i+=1;continue}n.add(l);let u=(0,t.reactive)({file:s,mimeType:s.type,status:S9.Pending});h.value.push(u),r.push(u)}if(a>0&&Cc({message:Tl(`有 {count} 个文件因格式不支持未添加`).replace(`{count}`,String(a)),theme:`error`}),i>0&&Cc({message:qSe(i,oe,wl),theme:`error`}),r.length>0){be();let e=r.map(e=>e.file).filter(e=>!!e),t=d.onUpload?.(e);if(!t)return;t.then(e=>{let t=Array.isArray(e)?e:[e];r.forEach((e,n)=>{se(e,t[n])})}).catch(()=>{r.forEach(e=>{e.status=S9.Error})})}},le=(0,t.shallowRef)(!1),ue=0,de=e=>!!e.dataTransfer?.types?.includes(`Files`),fe=e=>d.supportUpload&&de(e),pe=e=>{fe(e)&&(ue+=1,le.value=!0)},me=e=>{fe(e)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))},he=e=>{fe(e)&&(ue=Math.max(ue-1,0),ue===0&&(le.value=!1))},ge=e=>{if(!fe(e))return;e.preventDefault(),ue=0,le.value=!1;let t=Array.from(e.dataTransfer?.files??[]);t.length&&ce(t)},_e=e=>{h.value=h.value.filter(t=>t.id&&e.id?t.id!==e.id:t.file?t.file!==e.file:t.url?t.url!==e.url:t.filename?t.filename!==e.filename:!0),f(`deleteFile`,e)},ve=e=>{f(`update:modelValue`,e,e.flat().filter(e=>e.type===`tag`).map(e=>_.value.find(t=>t.id===e.data.value&&t.type===e.data.type)).filter(e=>!!e))},ye=e=>{let t=e.target,n=Array.from(t.files??[]);n.length&&ce(n),t.value=``},be=()=>{i.value?.focus?.()};return n({focus:be,getUploadFiles:()=>h.value.slice(),insertMention:e=>{i.value?.appendMention?.(e)},triggerSendMessage:V,uploadedArtifacts:g}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ai-chat-input-container`,style:(0,t.normalizeStyle)({"--chat-z-index":(0,t.unref)(__e)})},[(0,t.renderSlot)(n.$slots,`top`),(0,t.renderSlot)(n.$slots,`interrupt`),(0,t.createElementVNode)(`div`,pzt,[(0,t.createVNode)((0,t.unref)(QRt),{"flat-items":(0,t.unref)(T),groups:(0,t.unref)(w),"tippy-options":e.tippyOptions,visible:O.value,onClose:j,onSelect:F,onToggleGroup:N},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`chat-input`,{"is-dragover":le.value}]),style:(0,t.normalizeStyle)({maxHeight:u.value+`px`}),onDragenter:pe,onDragleave:he,onDragover:me,onDrop:ge},[(0,t.renderSlot)(n.$slots,`input-header`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(CLt,{key:0,class:`chat-input-cite`,content:s.value,onClose:re},null,8,[`content`])):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.renderSlot)(n.$slots,`files`,(0,t.normalizeProps)((0,t.guardReactiveProps)({files:h.value})),()=>[h.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`filesRef`,ref:a,class:`chat-input-files`},[(0,t.createVNode)(aRt,{files:h.value,onDeleteFile:_e},null,8,[`files`])],512)):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createVNode)(BRt,{ref_key:`aiSlashInputRef`,ref:i,"model-value":e.modelValue,placeholder:m.value,onKeydown:te,onMenuChange:A,"onUpdate:modelValue":ve,onUpload:ce},null,8,[`model-value`,`placeholder`]),(0,t.createVNode)(GRt,{"message-state":L.value,"send-disabled-tip":z.value,"tippy-options":e.tippyOptions,onSendMessage:V,onStopSending:ne},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`input`,{ref_key:`fileInputRef`,ref:o,accept:C.value,class:`chat-input-file-input`,multiple:``,type:`file`,onChange:ye},null,40,mzt),k.value?((0,t.openBlock)(),(0,t.createBlock)(bLt,{key:0,active:y.value===`plus`,"tippy-options":e.tippyOptions,onToggle:M},null,8,[`active`,`tippy-options`])):(0,t.createCommentVNode)(`v-if`,!0),k.value&&(e.shortcuts?.length||v.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,hzt)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.renderSlot)(n.$slots,`attachment`,{},()=>[e.shortcuts&&!v.value?((0,t.openBlock)(),(0,t.createBlock)(cSe,{key:0,shortcuts:e.shortcuts,onSelectShortcut:ie},null,8,[`shortcuts`])):(0,t.createCommentVNode)(`v-if`,!0),v.value?((0,t.openBlock)(),(0,t.createBlock)(Yu,{key:1,class:`selected-shortcut-btn`,shortcut:v.value},{append:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vl),{onClick:ae})]),_:1},8,[`shortcut`])):(0,t.createCommentVNode)(`v-if`,!0)])]),"before-send":(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`model-selector`,(0,t.normalizeProps)((0,t.guardReactiveProps)({models:e.models,selectedModel:l.value})),()=>[e.models?.length?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fzt),{key:0,modelValue:l.value,"onUpdate:modelValue":r[0]||=e=>l.value=e,class:`chat-input-model-selector`,models:e.models,"tippy-options":e.tippyOptions,onChange:H,onShow:j},null,8,[`modelValue`,`models`,`tippy-options`])):(0,t.createCommentVNode)(`v-if`,!0)])]),"send-icon":(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`send-icon`,{sendDisabledTip:z.value})]),_:3},8,[`message-state`,`send-disabled-tip`,`tippy-options`])],38)]),_:3},8,[`flat-items`,`groups`,`tippy-options`,`visible`])])],4))}}),_zt={class:`ai-chat-input-info-alert`},vzt={class:`ai-chat-input-info-alert__text`},yzt=(0,t.defineComponent)({__name:`input-info-alert`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_zt,[(0,t.createVNode)((0,t.unref)(aye),{class:`ai-chat-input-info-alert__icon`}),(0,t.createElementVNode)(`span`,vzt,(0,t.toDisplayString)(e.content),1)]))}}),bzt={class:`ai-artifact-file-card-info`},xzt={class:`ai-artifact-file-card-name`},Szt={class:`ai-artifact-file-card-actions`},Czt=(0,t.defineComponent)({__name:`artifact-file-card`,props:{active:{type:Boolean},file:{},onDownload:{type:Function},onPreview:{type:Function},variant:{}},setup(e){let n=e,r=Zu(),i=Xu(),a=zSe(),o=(0,t.computed)(()=>!!n.onPreview||!!r),s=(0,t.computed)(()=>!!n.onDownload||!!r?.canResolveArtifactUrl.value),l=(0,t.computed)(()=>(0,t.cloneVNode)(G_e)),u=(0,t.computed)(()=>(0,t.cloneVNode)(Ul)),d=(0,t.shallowRef)(!1),f=(0,t.computed)(()=>({...i?.value,content:Tl(`下载`),theme:`ai-chat-box`,placement:`top`})),p=(0,t.computed)(()=>({...i?.value,content:Tl(`引用`),theme:`ai-chat-box`,placement:`top`})),m=()=>{n.file.outputId&&a?.insertMention(ad(n.file))},h=()=>{if(n.onPreview){n.onPreview(n.file);return}r?.openPreview({file:n.file})},g=async()=>{if(!d.value){if(n.onDownload){n.onDownload(n.file);return}if(r?.canResolveArtifactUrl.value){d.value=!0;try{let{download_url:e}=await r.resolveArtifactUrls(n.file);e&&CSe(e,n.file.name)}finally{d.value=!1}}}};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-artifact-file-card`,{"is-active":e.active,"is-clickable":o.value,"is-list":e.variant===`list`}]),onClick:h},[(0,t.createCommentVNode)(` 左侧:文件类型图标 + 文件名 `),(0,t.createElementVNode)(`div`,bzt,[(0,t.createVNode)(w9,{class:`ai-artifact-file-card-icon`,"file-name":e.file.name,"file-type":e.file.type},null,8,[`file-name`,`file-type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,xzt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.file.name),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(i),text:e.file.name,placement:`top`}]])]),(0,t.createCommentVNode)(` 右侧操作区:hover 显示,设计稿中引用在下载左侧 `),(0,t.createElementVNode)(`div`,Szt,[(0,t.unref)(a)&&e.file.outputId?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`ai-artifact-file-card-action ai-artifact-file-card-cite`,onClick:(0,t.withModifiers)(m,[`stop`])},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u.value)))])),[[(0,t.unref)(Ju),p.value]]):(0,t.createCommentVNode)(`v-if`,!0),s.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`ai-artifact-file-card-action ai-artifact-file-card-download`,{"is-loading":d.value}]),onClick:(0,t.withModifiers)(g,[`stop`])},[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value),{key:1}))],2)),[[(0,t.unref)(Ju),f.value]]):(0,t.createCommentVNode)(`v-if`,!0)])],2))}}),wzt={class:`ai-message-loading-row`},Tzt={class:`ai-message-loading-icon-wrap`},Ezt={key:0,class:`ai-message-loading-text ai-message-loading-text-custom`},Dzt={key:1,"aria-live":`polite`,class:`ai-message-loading-text`},Ozt=(0,t.defineComponent)({name:`MessageLoading`,inheritAttrs:!1,__name:`message-loading`,props:{duration:{default:1.8},gap:{default:8},iconSize:{default:32},stagger:{default:.135},text:{default:`加载中...`}},setup(e){let n=e,r=(0,t.useAttrs)(),i=(0,t.computed)(()=>{let{class:e,style:t,...n}=r;return n}),a=(0,t.computed)(()=>({display:`block`,width:`${n.iconSize}px`,height:`${n.iconSize}px`})),o=(0,t.computed)(()=>[...n.text]),s=(0,t.computed)(()=>{let e=r.style,t={"--ai-message-loading-duration":`${n.duration}s`,"--ai-message-loading-stagger":`${n.stagger}s`,"--ai-message-loading-gap":`${n.gap}px`};return e&&typeof e==`object`&&!Array.isArray(e)?{...t,...e}:t});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({class:[`ai-message-loading`,(0,t.unref)(r).class],style:s.value},i.value),[(0,t.createElementVNode)(`div`,wzt,[(0,t.createElementVNode)(`span`,Tzt,[(0,t.renderSlot)(e.$slots,`icon`,{},()=>[(0,t.createVNode)((0,t.unref)(k_e),{class:`ai-message-loading-icon-svg`,style:(0,t.normalizeStyle)(a.value)},null,8,[`style`])])]),e.$slots.text?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ezt,[(0,t.renderSlot)(e.$slots,`text`)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Dzt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:`${n}-${e}`,class:`ai-message-loading-char`,style:(0,t.normalizeStyle)({"--char-index":n})},(0,t.toDisplayString)(e),5))),128))]))])],16))}}),kzt={class:`ai-artifact-code-preview`},Azt=[`innerHTML`],jzt=3e5,Mzt=(0,t.defineComponent)({__name:`code-preview`,props:{content:{},extension:{}},setup(e){let n={cfg:`ini`,conf:`ini`,dockerignore:`plaintext`,editorconfig:`ini`,env:`ini`,gitignore:`plaintext`,jsonc:`json`,jsx:`javascript`,tsx:`typescript`,vue:`xml`,zsh:`bash`},r=e,i=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),a=e=>n[e]||(Zf.getLanguage(e)?e:`plaintext`),o=(0,t.computed)(()=>{let{content:e}=r;if(!e)return``;let t=a(r.extension);if(t===`plaintext`||e.length>jzt)return i(e);try{return Zf.highlight(e,{language:t,ignoreIllegals:!0}).value}catch{return i(e)}});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` 高亮结果由 highlight.js 生成,未识别语言时走 escapeHtml 兜底,无注入风险 `),(0,t.createElementVNode)(`pre`,kzt,[(0,t.createElementVNode)(`code`,{class:`hljs`,innerHTML:o.value},null,8,Azt)])],2112))}}),Nzt=[`srcdoc`],Pzt=(0,t.defineComponent)({__name:`html-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`iframe`,{class:`ai-artifact-html-preview`,srcdoc:e.content},null,8,Nzt))}}),Fzt={class:`ai-artifact-image-preview`},Izt=[`alt`,`src`],Lzt=(0,t.defineComponent)({__name:`image-preview`,props:{name:{},url:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fzt,[(0,t.createElementVNode)(`img`,{alt:e.name,src:e.url},null,8,Izt)]))}}),Rzt={class:`ai-artifact-markdown-preview`},zzt=(0,t.defineComponent)({__name:`markdown-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Rzt,[(0,t.createVNode)(J7,{content:e.content,status:(0,t.unref)(Al).Success},null,8,[`content`,`status`])]))}}),Bzt={class:`ai-artifact-txt-preview`},Vzt=(0,t.defineComponent)({__name:`txt-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`pre`,Bzt,(0,t.toDisplayString)(e.content),1))}}),Hzt=[`src`],Uzt=(0,t.defineComponent)({__name:`url-iframe-preview`,props:{url:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`iframe`,{class:`ai-artifact-url-iframe-preview`,src:e.url},null,8,Hzt))}}),Wzt={binary:{load:`preview_url`,renderer:`urlIframe`},code:{load:`text_from_download`,renderer:`code`},html:{load:`text_from_download`,renderer:`html`},image:{load:`preview_url`,renderer:`image`},markdown:{load:`text_from_download`,renderer:`markdown`},text:{load:`text_from_download`,renderer:`txt`}},Gzt=(e,t)=>Wzt[Fve(e,t)],Kzt=e=>{let n=(0,t.shallowRef)(`idle`),r=(0,t.shallowRef)(``),i=(0,t.shallowRef)(``),a=(0,t.shallowRef)(``),o=(0,t.shallowRef)(`urlIframe`),s,l=0,u=()=>{r.value=``,i.value=``,a.value=``},d=async()=>{let t=++l;s?.abort(),s=void 0;let d=e.getFile();if(!d||!e.canResolve()){n.value=`empty`,u();return}n.value=`loading`,u();let f=Gzt(d.type,d.name);o.value=f.renderer;try{let o=await e.resolveUrls(d);if(t!==l)return;if(f.load===`text_from_download`){if(!o.download_url){n.value=`empty`;return}let e=new AbortController;s=e;let i=await fetch(o.download_url,{signal:e.signal});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.text();if(e.signal.aborted||t!==l)return;r.value=a,n.value=`ready`;return}if(f.renderer===`image`){if(!o.download_url){n.value=`empty`;return}a.value=o.download_url,n.value=`ready`;return}if(!o.preview_url){n.value=`empty`;return}i.value=o.preview_url,n.value=`ready`}catch{if(t!==l||s?.signal.aborted)return;n.value=`error`}},f=()=>{l+=1,s?.abort()};return(0,t.onBeforeUnmount)(f),{content:r,dispose:f,downloadUrl:a,load:d,previewUrl:i,renderer:o,status:n}},qzt={class:`ai-artifact-preview-host`},Jzt={key:0,class:`ai-artifact-preview-host-loading`},Yzt={key:1,class:`ai-artifact-preview-host-error`},Xzt={key:2,class:`ai-artifact-preview-host-empty`},Zzt=(0,t.defineComponent)({__name:`artifact-preview-host`,props:{file:{}},setup(e,{expose:n}){let r=e,i=Zu(),{content:a,downloadUrl:o,load:s,previewUrl:l,renderer:u,status:d}=Kzt({canResolve:()=>!!i?.canResolveArtifactUrl.value,getFile:()=>r.file,resolveUrls:e=>i?.resolveArtifactUrls(e)??Promise.resolve({})}),f=(0,t.computed)(()=>Ll(r.file?.type,r.file?.name));return(0,t.watch)(()=>r.file?`${r.file.outputId}:${r.file.type}`:``,()=>{s()},{immediate:!0}),n({content:a,renderer:u,status:d}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qzt,[(0,t.unref)(d)===`loading`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Jzt,[(0,t.createVNode)(Ozt)])):(0,t.unref)(d)===`error`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Yzt,[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`预览加载失败`)),1),(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,text:``,theme:`primary`,onClick:r[0]||=()=>(0,t.unref)(s)()},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`重试`)),1)]),_:1})])):(0,t.unref)(d)===`empty`||!e.file?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Xzt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无可预览的文件`)),1)):(0,t.unref)(u)===`html`?((0,t.openBlock)(),(0,t.createBlock)(Pzt,{key:3,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`code`?((0,t.openBlock)(),(0,t.createBlock)(Mzt,{key:4,content:(0,t.unref)(a),extension:f.value},null,8,[`content`,`extension`])):(0,t.unref)(u)===`txt`?((0,t.openBlock)(),(0,t.createBlock)(Vzt,{key:5,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`markdown`?((0,t.openBlock)(),(0,t.createBlock)(zzt,{key:6,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`image`?((0,t.openBlock)(),(0,t.createBlock)(Lzt,{key:7,name:e.file?.name,url:(0,t.unref)(o)},null,8,[`name`,`url`])):((0,t.openBlock)(),(0,t.createBlock)(Uzt,{key:8,url:(0,t.unref)(l)},null,8,[`url`]))]))}}),Qzt={key:0,class:`ai-file-artifact-panel is-empty`},$zt={class:`ai-file-artifact-panel-empty-text`},eBt={key:1,class:`ai-file-artifact-panel`},tBt={class:`ai-file-artifact-panel-list`},nBt={class:`ai-file-artifact-panel-list-title`},rBt={class:`ai-file-artifact-panel-list-scroll`},iBt={key:1,class:`ai-file-artifact-panel-list-empty`},aBt={class:`ai-file-artifact-panel-preview`},oBt={key:0,class:`ai-file-artifact-panel-preview-header`},sBt={class:`ai-file-artifact-panel-preview-header-info`},cBt={class:`ai-file-artifact-panel-preview-header-name`},lBt={class:`ai-file-artifact-panel-preview-header-actions`},uBt={class:`ai-file-artifact-panel-preview-body`},dBt=(0,t.defineComponent)({__name:`file-artifact-panel`,setup(e){let n=new Set([`code`,`html`,`markdown`,`text`]),r=Zu(),i=(0,t.computed)(()=>r?.artifacts.value??[]),a=(0,t.computed)(()=>r?.activeArtifactId.value??``),o=(0,t.computed)(()=>!!r?.canResolveArtifactUrl.value),s=zSe(),{copy:l}=Qu(),u=Xu(),d=(0,t.useTemplateRef)(`previewHostRef`),f=()=>(0,t.cloneVNode)(G_e),p=()=>(0,t.cloneVNode)(Hl),m=()=>(0,t.cloneVNode)(Ul),h=(0,t.shallowRef)(``),g=(0,t.shallowRef)(!1),_=(0,t.computed)(()=>({...u?.value,content:Tl(`复制`),placement:`top`,theme:`ai-chat-box`})),v=(0,t.computed)(()=>({...u?.value,content:Tl(`下载`),placement:`top`,theme:`ai-chat-box`})),y=(0,t.computed)(()=>({...u?.value,content:Tl(`引用`),placement:`top`,theme:`ai-chat-box`})),b=e=>{e.outputId&&s?.insertMention(ad(e))},x=(0,t.computed)(()=>{let e=h.value.trim().toLowerCase();return e?i.value.filter(t=>t.name.toLowerCase().includes(e)):i.value}),S=(0,t.computed)(()=>i.value.find(e=>e.outputId===a.value)),C=(0,t.computed)(()=>{let e=S.value;return e?n.has(Fve(e.type,e.name)):!1}),w=(0,t.computed)(()=>{let e=d.value;return!!e&&e.status===`ready`&&!!e.content}),T=e=>{e.outputId!==a.value&&r?.setActiveArtifactId(e.outputId)},E=()=>{if(!w.value)return;let e=d.value?.content;e&&l(e)},D=async e=>{if(!(g.value||!r?.canResolveArtifactUrl.value)){g.value=!0;try{let{download_url:t}=await r.resolveArtifactUrls(e);t&&CSe(t,e.name)}finally{g.value=!1}}};return(0,t.watch)(()=>S.value?.outputId,()=>{g.value=!1}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` 无产物:整块空态,不展示文件列表与预览区 `),i.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,eBt,[(0,t.createCommentVNode)(` 左侧:文件列表 + 搜索 `),(0,t.createElementVNode)(`div`,tBt,[(0,t.createElementVNode)(`p`,nBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`文件列表`))+`(`+(0,t.toDisplayString)(i.value.length)+`)`,1),(0,t.createVNode)((0,t.unref)(is),{modelValue:h.value,"onUpdate:modelValue":n[0]||=e=>h.value=e,class:`ai-file-artifact-panel-list-search`,clearable:``,placeholder:(0,t.unref)(Tl)(`搜索文件关键字`)},null,8,[`modelValue`,`placeholder`]),(0,t.createElementVNode)(`div`,rBt,[x.value.length?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(x.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Czt,{key:e.outputId,active:e.outputId===a.value,file:e,"on-preview":()=>T(e),variant:`list`},null,8,[`active`,`file`,`on-preview`]))),128)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,iBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`搜索结果为空`)),1))])]),(0,t.createCommentVNode)(` 右侧:预览区 `),(0,t.createElementVNode)(`div`,aBt,[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,oBt,[(0,t.createElementVNode)(`div`,sBt,[(0,t.createVNode)(w9,{class:`ai-file-artifact-panel-preview-header-icon`,"file-name":S.value.name,"file-type":S.value.type},null,8,[`file-name`,`file-type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,cBt,[(0,t.createTextVNode)((0,t.toDisplayString)(S.value.name),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(u),text:S.value.name,placement:`top`}]])]),(0,t.createElementVNode)(`div`,lBt,[C.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ai-file-artifact-panel-preview-header-action`,{"is-disabled":!w.value}]),onClick:E},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(p())))],2)),[[(0,t.unref)(Ju),_.value]]):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 设计稿:引用位于下载左侧,点击后该文件以标签形式进入输入框 `),(0,t.unref)(s)&&S.value.outputId?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`ai-file-artifact-panel-preview-header-action`,onClick:n[1]||=e=>b(S.value)},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(m())))])),[[(0,t.unref)(Ju),y.value]]):(0,t.createCommentVNode)(`v-if`,!0),o.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`ai-file-artifact-panel-preview-header-action`,{"is-loading":g.value}]),onClick:n[2]||=e=>D(S.value)},[g.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(f()),{key:1}))],2)),[[(0,t.unref)(Ju),v.value]]):(0,t.createCommentVNode)(`v-if`,!0)])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,uBt,[(0,t.createVNode)(Zzt,{ref_key:`previewHostRef`,ref:d,file:S.value},null,8,[`file`])])])])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qzt,[(0,t.createVNode)((0,t.unref)(hc),{class:`ai-file-artifact-panel-empty-exception`,scene:`part`,type:`empty`}),(0,t.createElementVNode)(`div`,$zt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无数据`)),1)]))],2112))}}),D9=`others`,fBt=e=>e<26?String.fromCharCode(65+e):String(e+1),pBt=e=>{let n=(0,t.computed)(()=>e()?.metadata?.questions??[]),r=(0,t.shallowRef)({}),i=(0,t.shallowRef)(0),a=(0,t.computed)(()=>n.value.length),o=(0,t.computed)(()=>n.value.reduce((e,t,n)=>e+ +!!r.value[n],0)),s=(0,t.computed)(()=>a.value>0&&o.value===a.value),l=(0,t.computed)(()=>i.value>0),u=(0,t.computed)(()=>i.value<a.value-1),d=e=>r.value[e],f=()=>{l.value&&--i.value},p=()=>{u.value&&(i.value+=1)},m=(e,t,r)=>{t||e===i.value&&n.value[e]?.multiSelect!==!0&&(r.answer.some(e=>e.label===`others`)||u.value&&(i.value+=1))},h=(e,t)=>{let n=r.value[e];r.value={...r.value,[e]:t},t&&m(e,n,t)},g=()=>n.value.map((e,t)=>r.value[t]??{question:e.question,answer:[]});return{questions:n,answeredCount:o,totalCount:a,completed:s,currentIndex:i,canGoPrev:l,canGoNext:u,goPrev:f,goNext:p,getAnswer:d,setAnswer:h,buildResolvePayload:()=>({interruptId:e()?.id??``,reason:Dl.UserQuestion,status:`resolved`,payload:{answers:g()}}),buildSkipPayload:()=>mBt(e())}},mBt=e=>({interruptId:e?.id??``,reason:Dl.UserQuestion,status:`cancelled`,payload:{answers:[]}}),hBt={class:`ai-user-question-answered`},gBt={class:`ai-user-question-answered__header`},_Bt={class:`ai-user-question-answered__title-wrap`},vBt={class:`ai-user-question-answered__title`},yBt={class:`ai-user-question-answered__status`},bBt={class:`ai-user-question-answered__body`},xBt={class:`ai-user-question-answered__question`},SBt={class:`ai-user-question-answered__question-text`},CBt={key:0,class:`ai-user-question-answered__tag`},wBt=(0,t.defineComponent)({__name:`user-question-answered-card`,props:{answers:{},status:{default:`resolved`}},setup(e){let n=e,r=(0,t.computed)(()=>n.status===`cancelled`?Tl(`已取消`):Tl(`已回复`));return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,hBt,[(0,t.createElementVNode)(`header`,gBt,[(0,t.createElementVNode)(`div`,_Bt,[(0,t.createVNode)((0,t.unref)(iye),{class:`ai-user-question-answered__help-icon`}),(0,t.createElementVNode)(`span`,vBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`回答内容`)),1)]),(0,t.createElementVNode)(`span`,yBt,(0,t.toDisplayString)(r.value),1)]),(0,t.createElementVNode)(`div`,bBt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.answers,(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:i,class:`ai-user-question-answered__item`},[(0,t.createElementVNode)(`div`,xBt,[(0,t.createElementVNode)(`span`,SBt,(0,t.toDisplayString)(i+1)+`. `+(0,t.toDisplayString)(r.question),1),r.multiSelect===void 0?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,CBt,(0,t.toDisplayString)(r.multiSelect?(0,t.unref)(Tl)(`多选`):(0,t.unref)(Tl)(`单选`)),1))]),(0,t.createCommentVNode)(` 默认逐条回显选择题答案;业务方可覆盖此 slot 渲染自定义表单的回显 `),(0,t.renderSlot)(n.$slots,`answer`,(0,t.mergeProps)({ref_for:!0},{item:r,index:i,status:e.status}),()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.answer,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:n,class:`ai-user-question-answered__answer`},(0,t.toDisplayString)(e.description||e.label),1))),128))])]))),128))])]))}}),TBt={class:`ai-user-question-option__badge`},EBt=[`placeholder`,`value`],DBt={key:1,class:`ai-user-question-option__text`},OBt=(0,t.defineComponent)({__name:`user-question-option`,props:{option:{},othersText:{},selected:{type:Boolean}},emits:[`confirm`,`select`,`update:othersText`],setup(e,{emit:n}){let r=e,i=n,a=()=>{i(`select`)},o=()=>{r.selected||i(`select`)},s=e=>{let t=e.target.value;i(`update:othersText`,t),r.selected||i(`select`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-user-question-option`,{"ai-user-question-option--selected":e.selected,"ai-user-question-option--others":e.option.isOthers}]),onClick:a},[(0,t.createElementVNode)(`span`,TBt,(0,t.toDisplayString)(e.option.letter),1),(0,t.createCommentVNode)(` Others:自定义输入 `),e.option.isOthers?((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{key:0,class:`ai-user-question-option__input`,placeholder:(0,t.unref)(Tl)(`请输入...`),value:e.othersText,onClick:r[0]||=(0,t.withModifiers)(()=>{},[`stop`]),onFocus:o,onInput:s,onKeydown:r[1]||=(0,t.withKeys)((0,t.withModifiers)(e=>i(`confirm`),[`stop`]),[`enter`])},null,40,EBt)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,DBt,(0,t.toDisplayString)(e.option.description),1))],2))}}),kBt={class:`ai-user-question-choice`},ABt=(0,t.defineComponent)({__name:`user-question-choice`,props:{question:{}},emits:[`answer`,`confirm`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.shallowRef)([]),o=(0,t.shallowRef)(``),s=(0,t.computed)(()=>{let e=(r.question.options??[]).filter(e=>e.label!==D9).map((e,t)=>({...e,isOthers:!1,letter:fBt(t)}));return e.push({label:D9,description:``,isOthers:!0,letter:fBt(e.length)}),e}),l=(0,t.computed)(()=>s.value.findIndex(e=>e.isOthers)),u=e=>a.value.includes(e),d=(0,t.computed)(()=>a.value.length?l.value>=0&&a.value.includes(l.value)?o.value.trim().length>0:!0:!1),f=()=>({question:r.question.question,multiSelect:r.question.multiSelect,answer:a.value.map(e=>{let t=s.value[e];return t?.isOthers?{label:D9,description:o.value.trim()}:{label:t?.label??``,description:t?.description??``}})}),p=()=>i(`answer`,d.value?f():void 0),m=e=>{let t=a.value;a.value=r.question.multiSelect?t.includes(e)?t.filter(t=>t!==e):[...t,e]:[e],p()},h=e=>{o.value=e,p()};return(0,t.watch)(()=>r.question,()=>{a.value=[],o.value=``,p()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kBt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(OBt,{key:r,option:e,"others-text":o.value,selected:u(r),onConfirm:n[0]||=e=>i(`confirm`),onSelect:e=>m(r),"onUpdate:othersText":h},null,8,[`option`,`others-text`,`selected`,`onSelect`]))),128))]))}}),jBt={class:`ai-user-question-card__title-wrap`},MBt={class:`ai-user-question-card__title`},NBt={class:`ai-user-question-card__header-actions`},PBt={class:`ai-user-question-card__pager`},FBt=[`disabled`],IBt={class:`ai-user-question-card__pager-text`},LBt=[`disabled`],RBt={class:`ai-user-question-card__body`},zBt={class:`ai-user-question-card__question-title`},BBt={class:`ai-user-question-card__question-text`},VBt={key:0,class:`ai-user-question-card__tag`},HBt={class:`ai-user-question-card__options`},UBt={class:`ai-user-question-card__footer`},WBt={class:`ai-user-question-card__progress`},GBt={class:`ai-user-question-card__progress-num`},KBt={class:`ai-user-question-card__actions`},qBt=(0,t.defineComponent)({__name:`user-question-card`,props:{interrupt:{},onResume:{type:Function}},setup(e){let n=e,r=Xu(),i=(0,t.shallowRef)(!1),{questions:a,answeredCount:o,totalCount:s,completed:l,currentIndex:u,canGoPrev:d,canGoNext:f,goPrev:p,goNext:m,getAnswer:h,setAnswer:g,buildResolvePayload:_,buildSkipPayload:v}=pBt(()=>n.interrupt),y=(0,t.computed)(()=>n.interrupt.metadata?.questions?.[0]?.header||n.interrupt.message||``),b=()=>{i.value=!i.value},x=()=>{i.value&&=!1},S=(0,t.shallowRef)(null),C=()=>{!l.value||S.value!==null||(S.value=`complete`,n.onResume?.(_(),n.interrupt))},w=()=>{S.value===null&&(S.value=`skip`,n.onResume?.(v(),n.interrupt))};return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{class:(0,t.normalizeClass)([`ai-user-question-card`,{"ai-user-question-card--collapsed":i.value}])},[(0,t.createElementVNode)(`header`,{class:`ai-user-question-card__header`,onClick:x},[(0,t.createElementVNode)(`div`,jBt,[(0,t.createVNode)((0,t.unref)(iye),{class:`ai-user-question-card__help-icon`}),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,MBt,[(0,t.createTextVNode)((0,t.toDisplayString)(y.value),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]])]),(0,t.createElementVNode)(`div`,NBt,[(0,t.createElementVNode)(`div`,PBt,[(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`ai-user-question-card__nav-btn`,{"is-disabled":!(0,t.unref)(d)}]),disabled:!(0,t.unref)(d),type:`button`,onClick:n[0]||=(0,t.withModifiers)((...e)=>(0,t.unref)(p)&&(0,t.unref)(p)(...e),[`stop`])},[(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-user-question-card__nav-icon`})],10,FBt),(0,t.createElementVNode)(`span`,IBt,(0,t.toDisplayString)((0,t.unref)(u)+1)+` / `+(0,t.toDisplayString)((0,t.unref)(s)),1),(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`ai-user-question-card__nav-btn`,{"is-disabled":!(0,t.unref)(f)}]),disabled:!(0,t.unref)(f),type:`button`,onClick:n[1]||=(0,t.withModifiers)((...e)=>(0,t.unref)(m)&&(0,t.unref)(m)(...e),[`stop`])},[(0,t.createVNode)((0,t.unref)(Gve),{class:`ai-user-question-card__nav-icon`})],10,LBt)]),n[2]||=(0,t.createElementVNode)(`span`,{class:`ai-user-question-card__divider`},null,-1),(0,t.createElementVNode)(`button`,{class:`ai-user-question-card__collapse-btn`,type:`button`,onClick:(0,t.withModifiers)(b,[`stop`])},[(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-user-question-card__arrow`,style:(0,t.normalizeStyle)({transform:i.value?`rotate(180deg)`:`rotate(-90deg)`})},null,8,[`style`])])])]),(0,t.createCommentVNode)(` 折叠用 v-show 而非 v-if:保留 UserQuestionChoice 及自定义 slot 的勾选态,避免卸载丢失选中 `),(0,t.withDirectives)((0,t.createElementVNode)(`div`,RBt,[(0,t.createCommentVNode)(` 一次只展示一题;全部题目仍挂载以保留勾选 / Others 输入态 `),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(a),(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`ai-user-question-card__question`},[(0,t.createElementVNode)(`div`,zBt,[(0,t.createElementVNode)(`span`,BBt,(0,t.toDisplayString)(r+1)+`. `+(0,t.toDisplayString)(n.question),1),n.multiSelect===void 0?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,VBt,(0,t.toDisplayString)(n.multiSelect?(0,t.unref)(Tl)(`多选`):(0,t.unref)(Tl)(`单选`)),1))]),(0,t.createElementVNode)(`div`,HBt,[(0,t.createCommentVNode)(` 默认渲染选择题;业务方可覆盖此 slot 渲染任意表单,作答有效时通过 setAnswer 回传 `),(0,t.renderSlot)(e.$slots,`question`,(0,t.mergeProps)({ref_for:!0},{question:n,qIndex:r,answer:(0,t.unref)(h)(r),setAnswer:e=>(0,t.unref)(g)(r,e),confirm:C}),()=>[(0,t.createVNode)(ABt,{question:n,onAnswer:e=>(0,t.unref)(g)(r,e),onConfirm:C},null,8,[`question`,`onAnswer`])])])])),[[t.vShow,r===(0,t.unref)(u)]])),128))],512),[[t.vShow,!i.value]]),(0,t.withDirectives)((0,t.createElementVNode)(`footer`,UBt,[(0,t.createElementVNode)(`span`,WBt,[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`已完成`))+` `,1),(0,t.createElementVNode)(`span`,GBt,(0,t.toDisplayString)((0,t.unref)(o)),1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`题`)),1)]),(0,t.createElementVNode)(`div`,KBt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-user-question-card__skip`,disabled:S.value===`complete`,loading:S.value===`skip`,size:`small`,text:``,onClick:w},{default:(0,t.withCtx)(()=>[S.value===`skip`?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(sye),{key:0,class:`ai-user-question-card__skip-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`跳过`)),1)]),_:1},8,[`disabled`,`loading`]),(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-user-question-card__complete`,disabled:!(0,t.unref)(l)||S.value===`skip`,loading:S.value===`complete`,size:`small`,theme:`primary`,onClick:C},{default:(0,t.withCtx)(()=>[S.value===`complete`?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(oye),{key:0,class:`ai-user-question-card__enter-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`完成`)),1)]),_:1},8,[`disabled`,`loading`])])],512),[[t.vShow,!i.value]])],2))}}),JBt=864e5,YBt={day:`numeric`,hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`,month:`numeric`,year:`numeric`},XBt=new Map,ZBt=e=>{let t=e??``,n=XBt.get(t);if(n)return n;let r;try{r=new Intl.DateTimeFormat(`en-US`,{...YBt,timeZone:e})}catch{r=new Intl.DateTimeFormat(`en-US`,YBt)}return XBt.set(t,r),r},QBt=(e,t)=>{let n=e.formatToParts(t),r=e=>Number(n.find(t=>t.type===e)?.value);return{day:r(`day`),hour:r(`hour`),minute:r(`minute`),month:r(`month`),year:r(`year`)}},$Bt=e=>Date.UTC(e.year,e.month-1,e.day),eVt=e=>String(e).padStart(2,`0`),tVt=(e,t)=>{if(e==null||e===``)return``;let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=ZBt(t),i=QBt(r,n),a=QBt(r,Date.now()),o=`${eVt(i.hour)}:${eVt(i.minute)}`,s=Math.round(($Bt(a)-$Bt(i))/JBt);if(s===0)return o;if(s===1)return`${Tl(`昨天`)} ${o}`;let l=`${i.month}-${i.day} ${o}`;return i.year===a.year?l:`${i.year}-${l}`},nVt={key:0,class:`ai-message-time`},rVt=(0,t.defineComponent)({__name:`message-time`,props:{createdAt:{},timezone:{}},setup(e){let n=e,r=ISe(),i=(0,t.computed)(()=>n.timezone??r?.timezone?.value),a=(0,t.computed)(()=>tVt(n.createdAt,i.value));return(e,n)=>a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nVt,(0,t.toDisplayString)(a.value),1)):(0,t.createCommentVNode)(`v-if`,!0)}}),iVt={class:`ai-delete-confirm`},aVt={class:`ai-delete-confirm__title`},oVt={class:`ai-delete-confirm__desc`},sVt={class:`ai-delete-confirm__actions`},cVt=(0,t.defineComponent)({__name:`delete-tool`,props:{description:{},hidden:{type:Boolean},icon:{},id:{},name:{},triggerSelection:{type:Boolean},disabled:{type:Boolean},tippyOptions:{}},emits:[`confirm`,`cancel`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`tippyRef`),o=(0,t.computed)(()=>({id:r.id,name:r.name,description:r.description,disabled:r.disabled,tippyOptions:r.tippyOptions})),s=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],theme:`ai-chat-box-light light`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),l=()=>{if(r.disabled)return!1},u=()=>{a.value?.hide?.()},d=()=>{u(),i(`confirm`)},f=()=>{u(),i(`cancel`)};return(0,t.onUnmounted)(()=>{u()}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:a},s.value,{onShow:l}),{content:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,iVt,[(0,t.createElementVNode)(`div`,aVt,(0,t.toDisplayString)((0,t.unref)(Tl)(`确认删除该回答?`)),1),(0,t.createElementVNode)(`div`,oVt,(0,t.toDisplayString)((0,t.unref)(Tl)(`删除操作无法撤回,请谨慎操作!`)),1),(0,t.createElementVNode)(`div`,sVt,[(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,theme:`danger`,onClick:d},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`删除`)),1)]),_:1}),(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,onClick:f},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消`)),1)]),_:1})])])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(ud,(0,t.normalizeProps)((0,t.guardReactiveProps)(o.value)),null,16)]),_:1},16))}}),lVt={class:`ai-feedback-title`},uVt={class:`ai-feedback-reason-list`},dVt=[`onClick`],fVt={class:`ai-feedback-other`},pVt={class:`ai-feedback-footer`},mVt=(0,t.defineComponent)({__name:`user-feedback`,props:{loading:{type:Boolean},reasonList:{},title:{}},emits:[`submit`,`cancel`],setup(e,{emit:n}){let r=n,i=(0,t.shallowRef)(``),a=(0,t.shallowRef)([]),o=e=>{a.value.includes(e)?a.value=a.value.filter(t=>t!==e):a.value=[...a.value,e]},s=()=>{r(`submit`,a.value,i.value)},l=()=>{a.value=[],i.value=``,r(`cancel`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ai-user-feedback`,onMouseenter:r[1]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`])},[(0,t.createElementVNode)(`div`,lVt,(0,t.toDisplayString)(e.title),1),(0,t.createElementVNode)(`div`,uVt,[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(8,e=>(0,t.createElementVNode)(`div`,{key:e,class:`reason-item ai-skeleton-element`})),64)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(e.reasonList,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:(0,t.normalizeClass)([`reason-item`,{"is-active":a.value.includes(e)}]),onClick:t=>o(e)},(0,t.toDisplayString)(e),11,dVt))),128))]),(0,t.createElementVNode)(`div`,fVt,[(0,t.createVNode)((0,t.unref)(is),{modelValue:i.value,"onUpdate:modelValue":r[0]||=e=>i.value=e,placeholder:(0,t.unref)(Tl)(`说出您的想法`),rows:3,type:`textarea`},null,8,[`modelValue`,`placeholder`])]),(0,t.createElementVNode)(`div`,pVt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`custom-btn`,disabled:!i.value&&a.value.length===0,size:`small`,theme:`primary`,onClick:s},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`提交`)),1)]),_:1},8,[`disabled`]),(0,t.createVNode)((0,t.unref)(Ko),{class:`custom-btn`,size:`small`,width:`80px`,onClick:l},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消`)),1)]),_:1})])],32))}}),hVt={ref:`messageToolsRef`,class:`ai-message-tools-container`},gVt={key:0,class:`ai-message-tools-prepend`},_Vt={class:`message-tools`},vVt={key:1,class:`ai-divider`,style:{"margin-right":`4px`,"margin-left":`4px`}},yVt={key:2,class:`message-tools`},bVt={key:3,class:`ai-message-tools-append`},xVt=(0,t.defineComponent)({__name:`message-tools`,props:{messageTools:{default:()=>b_e},messageToolsStatus:{},onAction:{},tippyOptions:{},updateTools:{default:()=>S_e}},emits:[`feedback`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`feedbackTippyRef`),o=(0,t.shallowRef)(!1),s=(0,t.shallowRef)([]),l=(0,t.shallowRef)(null),u=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],theme:`ai-chat-box-light light`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),d=async e=>{if(e.id===`like`||e.id===`unlike`){try{o.value=!0,s.value=[],s.value=await r.onAction?.(e)||[]}finally{o.value=!1}return}await r.onAction?.(e)},f=async e=>{await r.onAction?.(e)},p=()=>{a.value?.forEach(e=>e?.hide?.())},m=e=>l.value?l.value===`like`&&e===`like`?`activeLike`:l.value===`unlike`&&e===`unlike`?`activeUnLike`:e:e,h=e=>{let t=m(e);return t===`activeLike`?Tl(`取消满意`):t===`activeUnLike`?Tl(`取消不满意`):r.updateTools?.find(e=>e.id===t)?.description||``},g=(e,t,n)=>{p(),l.value===e.id?l.value=null:l.value=e.id,i(`feedback`,e,t,n)},_=e=>{if(r.messageToolsStatus===C9.Disabled)return!1;if(l.value&&l.value===e)return l.value=null,!1};return(0,t.onUnmounted)(()=>{p(),s.value=[]}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,hVt,[n.$slots.prepend?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gVt,[(0,t.renderSlot)(n.$slots,`prepend`)])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,_Vt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.messageTools,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.id},[n.id===`delete`?((0,t.openBlock)(),(0,t.createBlock)(cVt,(0,t.mergeProps)({key:0,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onConfirm:e=>f(n)}),null,16,[`disabled`,`tippy-options`,`onConfirm`])):((0,t.openBlock)(),(0,t.createBlock)(ud,(0,t.mergeProps)({key:1,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onClick:e=>d(n)}),null,16,[`disabled`,`tippy-options`,`onClick`]))],64))),128))]),e.updateTools.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vVt)):(0,t.createCommentVNode)(`v-if`,!0),e.updateTools.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,yVt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.updateTools,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.id},[n.id===`like`||n.id===`unlike`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({key:0,ref_for:!0,ref_key:`feedbackTippyRef`,ref:a},{ref_for:!0},u.value,{onShow:e=>_(n.id)}),{content:(0,t.withCtx)(()=>[(0,t.createVNode)(mVt,{loading:o.value,"reason-list":s.value,title:n.id===`like`?(0,t.unref)(Tl)(`什么原因让你满意?`):(0,t.unref)(Tl)(`什么原因让你不满意?`),onCancel:p,onSubmit:(e,t)=>g(n,e,t)},null,8,[`loading`,`reason-list`,`title`,`onSubmit`])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(ud,(0,t.mergeProps)({ref_for:!0},n,{id:m(n.id),active:l.value===n.id,disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":{...e.tippyOptions,content:h(n.id)},onClick:e=>d(n)}),null,16,[`id`,`active`,`disabled`,`tippy-options`,`onClick`])]),_:2},1040,[`onShow`])):n.id===`delete`?((0,t.openBlock)(),(0,t.createBlock)(cVt,(0,t.mergeProps)({key:1,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onConfirm:e=>f(n)}),null,16,[`disabled`,`tippy-options`,`onConfirm`])):((0,t.openBlock)(),(0,t.createBlock)(ud,(0,t.mergeProps)({key:2,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onClick:e=>d(n)}),null,16,[`disabled`,`tippy-options`,`onClick`]))],64))),128))])):(0,t.createCommentVNode)(`v-if`,!0),n.$slots.append?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bVt,[(0,t.renderSlot)(n.$slots,`append`)])):(0,t.createCommentVNode)(`v-if`,!0)],512))}}),SVt=e=>{if(e===void 0||e===``)return;let t=new Date(e).getTime();return Number.isNaN(t)?void 0:t},CVt=e=>{let t;for(let n of e){let e=SVt(n.createdAt);e!==void 0&&(t===void 0||e>t)&&(t=e)}return t},wVt=(e,t)=>{if(!(e===void 0||t===void 0))return Math.max(0,t-e)},TVt=e=>e<=0?``:e<1e3?`<1s`:Sl(Math.floor(e/1e3)*1e3),EVt=(0,t.defineComponent)({__name:`message-process-header`,props:{collapsible:{type:Boolean,default:!1},endAt:{},expanded:{type:Boolean,default:!1},label:{},loading:{type:Boolean,default:!1},startAt:{}},emits:[`toggle`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>{let e=wVt(r.startAt,r.endAt);return e===void 0?``:TVt(e)}),o=()=>{r.collapsible&&i(`toggle`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-message-process-header`,{"is-collapsible":e.collapsible}]),onClick:o},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-message-process-header-text`,{"is-loading":e.loading}])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1),a.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`,`+(0,t.toDisplayString)((0,t.unref)(Tl)(`耗时`))+` `+(0,t.toDisplayString)(a.value),1)],64)):(0,t.createCommentVNode)(`v-if`,!0)],2),e.collapsible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(U_e),{key:0,class:(0,t.normalizeClass)({"is-expanded":e.expanded})},null,8,[`class`])):(0,t.createCommentVNode)(`v-if`,!0)],2))}}),DVt=new Set([Al.Streaming,Al.StopLoading,Al.Fetching,Al.Pending]),OVt=e=>e!==void 0&&DVt.has(e),kVt=(e,t)=>{if(t)return`处理中`;switch(e.at(-1)?.status){case Al.Error:return`失败`;case Al.Stop:return`已停止`;case Al.Disabled:return`已禁用`;default:return`已完成`}},AVt=e=>e.type===kl.Assistant&&e.messages.length>0,jVt=(e,t)=>!t&&e.length>=2,MVt=(0,t.defineComponent)({__name:`message-process-list`,props:{enabled:{type:Boolean,default:!1},generating:{type:Boolean,default:!1},messages:{},requestCreatedAt:{}},setup(e){let n=e,r=(0,t.shallowRef)(!1),i=(0,t.computed)(()=>jVt(n.messages,n.generating)),a=(0,t.computed)(()=>Tl(kVt(n.messages,n.generating))),o=(0,t.computed)(()=>n.generating?{startAt:void 0,endAt:void 0}:{startAt:SVt(n.requestCreatedAt),endAt:CVt(n.messages)}),s=(0,t.computed)(()=>{if(!n.enabled||!i.value||r.value)return n.messages;let e=n.messages.at(-1);return e?[e]:[]});(0,t.watch)(i,e=>{e&&(r.value=!1)});let l=()=>{i.value&&(r.value=!r.value)};return(n,u)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-message-process`,{"is-enabled":e.enabled}])},[e.enabled?((0,t.openBlock)(),(0,t.createBlock)(EVt,{key:0,collapsible:i.value,"end-at":o.value.endAt,expanded:i.value&&r.value,label:a.value,loading:e.generating,"start-at":o.value.startAt,onToggle:l},null,8,[`collapsible`,`end-at`,`expanded`,`label`,`loading`,`start-at`])):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,e=>(0,t.renderSlot)(n.$slots,`message`,{key:e.uid||e.id,message:e})),128))],2))}}),NVt={class:`ai-activity-message`},PVt={class:`ai-activity-message-content`},O9=(0,t.defineComponent)({__name:`activity-layout`,props:(0,t.mergeModels)({activityType:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=(0,t.useModel)(e,`collapsed`);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,NVt,[(0,t.createElementVNode)(`div`,{class:`ai-activity-message-title`,onClick:i[0]||=e=>n.value=!n.value},[(0,t.renderSlot)(r.$slots,`title`,(0,t.normalizeProps)((0,t.guardReactiveProps)({collapsed:n.value}))),e.activityType===(0,t.unref)(Ol).FlowAgent?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ai-activity-message-title-icon collapsed-icon`,{"is-collapsed":n.value}])},[(0,t.createVNode)((0,t.unref)(Bl))],2))]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,PVt,[(0,t.renderSlot)(r.$slots,`default`)],512),[[t.vShow,!n.value]])]))}}),k9=[{color:`#3A84FF`,icon:null,key:`running`,label:Tl(`执行中`),rawStates:[`CREATED`,`LOOP_READY`,`READY`,`RUNNING`,`BLOCKED`,`ROLLING_BACK`,`ROLL_BACK_SUCCESS`]},{color:`#65C389`,icon:I_e,key:`success`,label:Tl(`成功`),rawStates:[`FINISHED`]},{color:`#EA3636`,icon:L_e,key:`failed`,label:Tl(`失败`),rawStates:[`FAILED`,`ROLL_BACK_FAILED`]},{color:`#F59500`,icon:z_e,key:`suspended`,label:Tl(`挂起`),rawStates:[`SUSPENDED`]},{color:`#F55B0E`,dotFill:`#FEE8DD`,flowHeader:!0,icon:R_e,key:`terminated`,label:Tl(`已终止`),rawStates:[`REVOKED`]},{color:`#4D4F56`,dotColor:`#DCDEE5`,icon:B_e,key:`pending`,label:Tl(`待执行`),rawStates:[`PENDING`]},{color:`#5B7290`,icon:V_e,key:`skipped`,label:Tl(`跳过`),rawStates:[`SKIPPED`]}],A9=Object.fromEntries(k9.map(e=>[e.key,e])),FVt=Object.fromEntries(k9.flatMap(e=>e.rawStates.map(t=>[t,e.key]))),j9=e=>FVt[e]??`running`,IVt=e=>{for(let t of e){let e=A9[j9(t)];if(e.flowHeader)return e}},LVt=e=>e.showInStats!==!1,RVt=e=>A9[e].dotColor??A9[e].color,zVt=e=>A9[e].dotFill,BVt=e=>{let n=(0,t.cloneVNode)(e);return n.el=null,n.anchor=null,Array.isArray(e.children)&&(n.children=e.children.map(e=>(0,t.isVNode)(e)?BVt(e):e)),n},VVt=e=>{let t=A9[e].icon;return t?BVt(t):null},HVt=e=>{let n=(0,t.computed)(()=>Array.isArray(e.value)?e.value:[e.value??{}]),r=(0,t.shallowRef)({}),i=e=>r.value[e.task_id]!==!1,a=e=>{r.value={...r.value,[e.task_id]:!i(e)}},o=(0,t.computed)(()=>n.value.map(e=>{let t=Object.values(e.nodes??{}).map(e=>{let t=j9(e.state);return{convergedState:t,dotColor:RVt(t),dotFill:zVt(t),elapsedTimeText:p_e(e.elapsed_time),id:e.id,name:e.name,raw:e,retryable:!!e.retryable,skippable:!!e.skippable}}),n=t.reduce((e,t)=>e+t.raw.elapsed_time,0),r=j9(e.task_state??``);return{convergedState:r,hasConfidence:!!e.has_confidence,confidenceTitle:e.confidence_title,isActive:!!e.is_active,nodes:t,raw:e,stateIcon:VVt(r),taskId:e.task_id,taskName:e.task_name,totalTimeText:p_e(n)}})),s=(0,t.computed)(()=>{let e={};for(let t of k9)e[t.key]=0;for(let t of n.value)for(let[n,r]of Object.entries(t.statistics?.state_counts??{}))e[j9(n)]+=r;return k9.filter(t=>LVt(t)&&e[t.key]>0).map(t=>({color:t.color,display:e[t.key]>99?`99+`:String(e[t.key]),dotColor:RVt(t.key),dotFill:zVt(t.key),key:t.key,label:t.label}))});return{flowHeaderDef:(0,t.computed)(()=>IVt(n.value.map(e=>e.task_state??``))),isTaskExpanded:i,taskList:n,toggleTaskExpanded:a,viewTasks:o,visibleStats:s}},UVt=[{blockedTip:()=>Tl(`任务正在跳过中,不可重试`),icon:Wl,id:jl.FlowNodeRetry,label:()=>Tl(`重试`),pendingLabel:()=>Tl(`重试中`),visible:e=>e.convergedState===`failed`&&e.retryable},{blockedTip:()=>Tl(`任务正在重试中,不可跳过`),icon:sye,id:jl.FlowNodeSkip,label:()=>Tl(`跳过`),pendingLabel:()=>Tl(`跳过中`),visible:e=>e.convergedState===`failed`&&e.skippable}],M9=(e,t)=>`${e.task_id}:${t.id}:${t.retry}`,WVt=e=>{let{hideResumeActions:n,onInterruptResume:r,openNodeDetail:i}=e,a=(0,t.shallowRef)({}),o=(e,t,n)=>{let i=M9(t,n);a.value[i]||(a.value={...a.value,[i]:e},r.value?.({payload:{node_id:n.id,task_id:t.task_id},operation:e}))};return{getNodeActions:(e,t)=>{let r=a.value[M9(e.raw,t.raw)],s=(n?.value?[]:UVt).filter(e=>e.visible(t)).map(n=>{let i=r===n.id,a=r!==void 0&&!i;return{disabled:r!==void 0,icon:n.icon,id:n.id,label:i?n.pendingLabel():n.label(),loading:i,run:()=>o(n.id,e.raw,t.raw),tooltip:a?n.blockedTip():void 0}});return s.push({disabled:!1,icon:Fl,id:`detail`,label:Tl(`详情`),loading:!1,run:()=>i(e.raw,t.raw)}),s},isNodePending:(e,t)=>a.value[M9(e.raw,t.raw)]!==void 0}},GVt={class:`ai-detail-section`},KVt={class:`section-heading`},qVt={class:`section-text`},N9=(0,t.defineComponent)({__name:`detail-section`,props:{title:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,GVt,[(0,t.createElementVNode)(`div`,KVt,[r[0]||=(0,t.createElementVNode)(`span`,{class:`section-bar`},null,-1),(0,t.createElementVNode)(`span`,qVt,(0,t.toDisplayString)(e.title),1)]),(0,t.renderSlot)(n.$slots,`default`)]))}}),JVt={class:`ai-simple-table`},YVt={key:0},XVt=[`colspan`],P9=(0,t.defineComponent)({__name:`simple-table`,props:{columns:{},data:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`table`,JVt,[(0,t.createElementVNode)(`thead`,null,[(0,t.createElementVNode)(`tr`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.columns,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:e.key},(0,t.toDisplayString)(e.label),1))),128))])]),(0,t.createElementVNode)(`tbody`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.data,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:r},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.columns,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:e.key,class:(0,t.normalizeClass)({"is-break-all":e.breakAll})},(0,t.toDisplayString)(n[e.key]??`--`),3))),128))]))),128)),e.data.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,YVt,[(0,t.createElementVNode)(`td`,{class:`is-empty`,colspan:e.columns.length},` -- `,8,XVt)]))])]))}}),ZVt={class:`ai-flow-agent-node-detail`},QVt={class:`detail-title`},$Vt={key:1,class:`detail-title-content`},eHt={class:`detail-tab-bar`},tHt=[`onClick`],nHt={class:`detail-body`},rHt={class:`skeleton-section`},iHt={class:`skeleton-section`},aHt={class:`info-form`},oHt={class:`info-label`},sHt={class:`info-value`},cHt={class:`info-row`},lHt={class:`info-label`},uHt={class:`info-value`},dHt={key:0,class:`failure-item`},fHt={key:1,class:`failure-item`},pHt={class:`info-row`},mHt={class:`info-label`},hHt={class:`info-value`},gHt={key:0,class:`skeleton-section`},F9=function(e){return e.Config=`config`,e.Output=`output`,e}(F9||{}),_Ht=(0,t.defineComponent)({__name:`flow-agent-node-detail`,props:{data:{},has_confidence:{type:Boolean},loading:{type:Boolean},node_id:{},node_name:{},task_id:{},task_name:{}},setup(e){let n=[{key:F9.Config,label:Tl(`节点配置`)},{key:F9.Output,label:Tl(`节点输出`)}],r=[{key:`key`,label:Tl(`参数名`)},{breakAll:!0,key:`value`,label:Tl(`参数值`)}],i=[{key:`name`,label:Tl(`名称`)},{key:`description`,label:Tl(`变量说明`)},{key:`key`,label:`KEY`}],a=[{key:`key`,label:Tl(`参数名`)},{breakAll:!0,key:`value`,label:Tl(`参数值`)}],o={forced_fail:wl?`Force Fail`:`强制失败`},s=e,l=(0,t.shallowRef)(F9.Config),u=(0,t.computed)(()=>s.data?.basic_info),d=(0,t.computed)(()=>{let e=u.value;return e?[{label:Tl(`流程模板`),value:e.template_name||`--`},{label:Tl(`节点名称`),value:e.node_name||`--`},{label:Tl(`步骤名称`),value:e.stage_name||`--`},{label:Tl(`是否可选`),value:e.optional?Tl(`是`):Tl(`否`)}]:[]}),f=(0,t.computed)(()=>{let e=u.value;return e?.skippable||e?.auto_retry?.enable}),p=(0,t.computed)(()=>{let e=u.value?.auto_retry;return e?.enable?wl?`In ${e.interval} seconds, auto retry ${e.times} times`:`在 ${e.interval} 秒后,自动重试 ${e.times} 次`:``}),m=(0,t.computed)(()=>{let e=u.value?.timeout_config;if(!e?.enable)return`--`;let t=o[e.action]??e.action;return wl?`Timeout ${e.seconds} seconds later, ${t}`:`超时 ${e.seconds} 秒后则${t}`}),h=(0,t.computed)(()=>Object.entries(s.data?.inputs??{}).map(([e,t])=>({key:e,value:v(t)}))),g=(0,t.computed)(()=>(s.data?.plugin_output??[]).map(e=>({description:e.schema?.description||`--`,name:e.name,key:e.key}))),_=(0,t.computed)(()=>(s.data?.outputs??[]).map(e=>({key:e.key,value:v(e.value)}))),v=e=>e==null?`--`:typeof e==`object`?JSON.stringify(e):String(e);return(o,s)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ZVt,[(0,t.createElementVNode)(`h3`,QVt,[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`节点`))+`:`,1),s[0]||=(0,t.createElementVNode)(`span`,{class:`skeleton-title ai-skeleton-element`},null,-1)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,$Vt,(0,t.toDisplayString)((0,t.unref)(Tl)(`节点`))+`:`+(0,t.toDisplayString)(u.value?.node_name),1)),(0,t.renderSlot)(o.$slots,`locateButton`)]),(0,t.createElementVNode)(`div`,eHt,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n,e=>(0,t.createElementVNode)(`div`,{key:e.key,class:(0,t.normalizeClass)([`detail-tab`,{"is-active":l.value===e.key}]),onClick:t=>l.value=e.key},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.key===F9.Config?(0,t.unref)(Il):(0,t.unref)(Fl)),{class:`detail-tab-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)],10,tHt)),64))]),(0,t.createElementVNode)(`div`,nHt,[l.value===F9.Config?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,rHt,[s[1]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(6,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))]),(0,t.createElementVNode)(`div`,iHt,[s[2]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(4,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))])],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`基础信息`)},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,aHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.label,class:`info-row`},[(0,t.createElementVNode)(`div`,oHt,(0,t.toDisplayString)(e.label),1),(0,t.createElementVNode)(`div`,sHt,(0,t.toDisplayString)(e.value),1)]))),128)),(0,t.createElementVNode)(`div`,cHt,[(0,t.createElementVNode)(`div`,lHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`失败处理`)),1),(0,t.createElementVNode)(`div`,uHt,[f.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[u.value?.skippable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,dHt,[s[3]||=(0,t.createElementVNode)(`span`,{class:`tag-badge`},`MS`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`手动跳过`))+(0,t.toDisplayString)(u.value?.auto_retry?.enable?`;`:``),1)])):(0,t.createCommentVNode)(`v-if`,!0),u.value?.auto_retry?.enable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fHt,[s[4]||=(0,t.createElementVNode)(`span`,{class:`tag-badge`},`AR`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(p.value),1)])):(0,t.createCommentVNode)(`v-if`,!0)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)(`--`)],64))])]),(0,t.createElementVNode)(`div`,pHt,[(0,t.createElementVNode)(`div`,mHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`超时控制`)),1),(0,t.createElementVNode)(`div`,hHt,(0,t.toDisplayString)(m.value),1)])])]),_:1},8,[`title`]),(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`输入参数`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:r,data:h.value},null,8,[`data`])]),_:1},8,[`title`]),(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`输出参数`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:i,data:g.value},null,8,[`data`])]),_:1},8,[`title`])],64))],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gHt,[s[5]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(5,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))])):((0,t.openBlock)(),(0,t.createBlock)(N9,{key:1,title:(0,t.unref)(Tl)(`结构化输出`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:a,data:_.value},null,8,[`data`])]),_:1},8,[`title`]))],64))])]))}}),I9=e=>e.task_id==null?``:`${e.task_id}`,L9=I9,R9=(e,t)=>e.task_id==null?``:`${e.task_id}|${t.id}|${t.name}`,vHt=e=>{let{messageUid:n,taskList:r}=e,i=MSe(),a=$u(),o=(0,t.computed)(()=>i.selectedTab.value?.name??``),s=(0,t.shallowRef)(!1),l=()=>{s.value=!0},u=(0,t.computed)(()=>{if(s.value)return o.value;let e=r.value.find(e=>e.is_active);return e?.task_id==null?o.value:I9(e)}),d=e=>{let t=u.value;return t===I9(e)||t===L9(e)},f=(e,t)=>u.value===R9(e,t),p=(e,t)=>{let r=e.task_id;r!=null&&(l(),i.addCustomTab?.({closable:t.closable,icon:Il,label:t.name,name:R9(e,t),order:t.tab_order??100,data:{component:_Ht,messageUid:n.value,props:{data:{},loading:!0,node_id:t.id,node_name:t.name,task_id:r,task_name:e.task_name}}}))},m=e=>{let t=e?.task_id;t&&(l(),i.addCustomTab?.({closable:e.closable,icon:Il,label:Tl(`有效证据`),name:L9(e),order:e.tab_order??10,data:{component:_Ht,messageUid:n.value,props:{data:{},has_confidence:e.has_confidence,loading:!0,task_id:t,task_name:e.task_name}}}))};return(0,t.watch)(o,(e,t)=>{t!==void 0&&l()}),(0,t.onMounted)(()=>{a?.value&&m(r.value.find(e=>e.is_active&&e.has_confidence))}),(0,t.onUnmounted)(()=>{if(a?.value)for(let e of r.value){i.removeCustomTab?.(I9(e)),i.removeCustomTab?.(L9(e));for(let t of Object.values(e.nodes??{}))i.removeCustomTab?.(R9(e,t))}}),{displaySelectedTabName:u,isNodeSelected:f,isTaskSelected:d,markUserTabSelection:l,openConfidence:m,openNodeDetail:p}},yHt={class:`ai-activity-message-title-text`},bHt={class:`flow-agent-title-label`},xHt={key:1,class:`flow-agent-flow-header-paren is-open`},SHt={class:`flow-agent-stat-list`},CHt={key:2,class:`flow-agent-flow-header-paren is-close`},wHt={class:`flow-agent-stat-tooltip`},THt={class:`flow-agent-stat-tooltip-status`},EHt={class:`flow-agent-stat-tooltip-label`},DHt=[`onClick`],OHt={class:`flow-agent-task-state-icon`},kHt={class:`flow-agent-task-name`},AHt={class:`flow-agent-task-trailing`},jHt={class:`flow-agent-task-time`},MHt=[`onClick`],NHt={class:`flow-agent-task-nodes`},PHt={class:`flow-agent-node-status`},FHt=[`title`],IHt={class:`flow-agent-node-trailing`},LHt={class:`flow-agent-node-time`},RHt={class:`flow-agent-node-actions`},zHt=[`onClick`],BHt=(0,t.defineComponent)({__name:`flow-agent-content`,props:(0,t.mergeModels)({content:{},messageUid:{},onInterruptResume:{type:Function},status:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=Xu(),i=(0,t.useModel)(e,`collapsed`),a=fSe(),o=(0,t.computed)(()=>a.value===Nl.Share),s=(0,t.computed)(()=>n.status===Al.Pending||n.status===Al.Streaming),{flowHeaderDef:l,isTaskExpanded:u,taskList:d,toggleTaskExpanded:f,viewTasks:p,visibleStats:m}=HVt((0,t.toRef)(n,`content`)),{isNodeSelected:h,isTaskSelected:g,openConfidence:_,openNodeDetail:v}=vHt({messageUid:(0,t.toRef)(n,`messageUid`),taskList:d}),{getNodeActions:y,isNodePending:b}=WVt({hideResumeActions:o,onInterruptResume:(0,t.toRef)(n,`onInterruptResume`),openNodeDetail:v}),x=e=>{e.disabled||e.run()},S=e=>({backgroundColor:e.dotFill,borderColor:e.dotColor});return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:i.value,"onUpdate:collapsed":n[0]||=e=>i.value=e,"activity-type":(0,t.unref)(Ol).FlowAgent,class:`ai-flow-agent-activity`},{title:(0,t.withCtx)(()=>[(0,t.createCommentVNode)(` hover 整条执行情况栏展示统计 tooltip(设计稿 annotation) `),(0,t.createVNode)((0,t.unref)(Ku),(0,t.mergeProps)({class:`flow-agent-title-bar`,theme:`ai-chat-box-light light`},{...(0,t.unref)(r),tag:`div`,arrow:!0,followCursor:!1,offset:[0,10]}),{content:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,wHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(m),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:`flow-agent-stat-tooltip-item`},[(0,t.createElementVNode)(`span`,THt,[e.key===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-stat-dot`,style:(0,t.normalizeStyle)(S(e))},null,4))]),(0,t.createElementVNode)(`span`,EHt,(0,t.toDisplayString)(e.label)+`:`,1),(0,t.createElementVNode)(`span`,{class:`flow-agent-stat-tooltip-count`,style:(0,t.normalizeStyle)({color:e.color})},(0,t.toDisplayString)(e.display),5)]))),128))])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-activity-message-title-icon`,{"icon-collapsed":i.value}])},[s.value?((0,t.openBlock)(),(0,t.createBlock)(Gl,{key:0,size:12})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(P_e),{key:1}))],2),(0,t.createElementVNode)(`span`,yHt,[(0,t.createElementVNode)(`span`,bHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`执行情况`))+`:`,1),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`flow-agent-flow-header`,style:(0,t.normalizeStyle)({color:(0,t.unref)(l).color})},(0,t.toDisplayString)((0,t.unref)(l).label),5)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,xHt,`(`)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,SHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(m),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.key,class:`flow-agent-stat-item`},[e.key===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,class:`flow-agent-stat-loading`,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-stat-dot`,style:(0,t.normalizeStyle)(S(e))},null,4)),(0,t.createElementVNode)(`span`,{class:`flow-agent-stat-count`,style:(0,t.normalizeStyle)({color:e.color})},(0,t.toDisplayString)(e.display),5)]))),128))]),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,CHt,`)`)):(0,t.createCommentVNode)(`v-if`,!0)])]),_:1},16)]),default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(p),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.taskId,class:`flow-agent-task-group`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flow-agent-task-header`,{"has-confidence":e.hasConfidence,"is-selected":(0,t.unref)(g)(e.raw)}])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flow-agent-task-arrow`,{"is-expanded":(0,t.unref)(u)(e.raw)}]),onClick:(0,t.withModifiers)(n=>(0,t.unref)(f)(e.raw),[`stop`])},[(0,t.createVNode)((0,t.unref)(P_e))],10,DHt),(0,t.createElementVNode)(`span`,OHt,[e.convergedState===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` key 绑定归一状态:FAILED→FINISHED 等同为 svg 时强制重建,避免就地 patch 复用旧图标 DOM `),((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.stateIcon),{key:e.convergedState}))],2112))]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,kHt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.taskName),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]]),(0,t.createElementVNode)(`span`,AHt,[(0,t.createElementVNode)(`span`,jHt,(0,t.toDisplayString)(e.totalTimeText),1),e.hasConfidence?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`flow-agent-task-action-btn flow-agent-task-confidence-btn`,onClick:(0,t.withModifiers)(n=>(0,t.unref)(_)(e.raw),[`stop`])},[(0,t.createVNode)((0,t.unref)(Fl)),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.confidenceTitle??(0,t.unref)(Tl)(`有效证据`)),1)],8,MHt)):(0,t.createCommentVNode)(`v-if`,!0)])],2),(0,t.withDirectives)((0,t.createElementVNode)(`div`,NHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.nodes,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.id,class:(0,t.normalizeClass)([`flow-agent-node-item`,{"is-selected":(0,t.unref)(h)(e.raw,n.raw),"is-pending":(0,t.unref)(b)(e,n)}])},[(0,t.createElementVNode)(`span`,PHt,[n.convergedState===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-status-dot`,style:(0,t.normalizeStyle)(S(n))},null,4))]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{class:`flow-agent-node-name`,title:n.name},[(0,t.createTextVNode)((0,t.toDisplayString)(n.name),1)],8,FHt)),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]]),(0,t.createElementVNode)(`span`,IHt,[(0,t.createElementVNode)(`span`,LHt,(0,t.toDisplayString)(n.elapsedTimeText),1),(0,t.createElementVNode)(`span`,RHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(y)(e,n),e=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.id,class:(0,t.normalizeClass)([`flow-agent-node-action-btn`,{"is-disabled":e.disabled}]),onClick:(0,t.withModifiers)(t=>x(e),[`stop`])},[(0,t.createCommentVNode)(` 进行中:图标切换为 loading 菊花(与节点执行中态一致) `),e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,class:`flow-agent-node-action-loading`,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.icon),{key:1})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)],10,zHt)),[[(0,t.unref)(Ju),e.tooltip?{...(0,t.unref)(r),content:e.tooltip,theme:`ai-chat-box`,offset:[0,8]}:{content:``}]])),128))])])],2))),128))],512),[[t.vShow,(0,t.unref)(u)(e.raw)]])]))),128))]),_:1},8,[`collapsed`,`activity-type`]))}}),VHt={class:`ai-activity-message-title-icon`},HHt={class:`ai-activity-message-title-text`},UHt={class:`ai-knowledge-rag-content`},WHt=(0,t.defineComponent)({__name:`knowledge-rag-content`,props:(0,t.mergeModels)({content:{},messageUid:{},status:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),i=(0,t.computed)(()=>n.status===Al.Pending||n.status===Al.Streaming),a=(0,t.computed)(()=>i.value?Tl(`检索中`):Tl(`检索完成`));return(n,o)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:r.value,"onUpdate:collapsed":o[0]||=e=>r.value=e},{title:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,VHt,[i.value?((0,t.openBlock)(),(0,t.createBlock)(Gl,{key:0})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(j_e),{key:1,style:{"font-size":`12px`}}))]),(0,t.createElementVNode)(`span`,HHt,(0,t.toDisplayString)(a.value),1)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,UHt,[(0,t.createVNode)(J7,{content:e.content?.content||``},null,8,[`content`])]),(0,t.createVNode)(Y7,{content:e.content?.referenceDocument||[]},null,8,[`content`])]),_:1},8,[`collapsed`]))}}),GHt={class:`ai-activity-message-title-icon`},KHt={class:`ai-activity-message-title-text`},qHt=(0,t.defineComponent)({__name:`reference-doc-content`,props:(0,t.mergeModels)({content:{},messageUid:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),i=(0,t.computed)(()=>{let e=n.content?.length??0;return wl?`Reference ${e} documents as reference`:`引用 ${e} 篇资料作为参考`});return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:r.value,"onUpdate:collapsed":a[0]||=e=>r.value=e},{title:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,GHt,[(0,t.createVNode)((0,t.unref)(j_e),{style:{"font-size":`12px`}})]),(0,t.createElementVNode)(`span`,KHt,(0,t.toDisplayString)(i.value),1)]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(Y7,{content:e.content||[]},null,8,[`content`])]),_:1},8,[`collapsed`]))}}),JHt=(0,t.defineComponent)({__name:`activity-message`,props:(0,t.mergeModels)({activityType:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{},onInterruptResume:{type:Function}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n={[Ol.FlowAgent]:BHt,[Ol.KnowledgeRag]:WHt,[Ol.ReferenceDocument]:qHt},r=e,i=(0,t.useModel)(e,`collapsed`),a=(0,t.computed)(()=>n[r.activityType??``]);return(n,r)=>a.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(a.value),{key:0,collapsed:i.value,"onUpdate:collapsed":r[0]||=e=>i.value=e,content:e.content,"message-uid":e.uid,"on-interrupt-resume":e.onInterruptResume,status:e.status},null,40,[`collapsed`,`content`,`message-uid`,`on-interrupt-resume`,`status`])):(0,t.createCommentVNode)(`v-if`,!0)}}),YHt={class:`ai-toolcall-desc`},XHt={class:`desc-title`},ZHt=[`title`],QHt={class:`desc-panel`},$Ht={class:`desc-label`},eUt={class:`desc-value`},tUt={style:{"word-break":`break-all`}},nUt={key:1,style:{wordBreak:`break-all`}},z9=(0,t.defineComponent)({__name:`desc-panel`,props:{desc:{},title:{}},setup(e){let n=e,{copy:r}=Qu(),i=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),a=(0,t.computed)(()=>{try{return JSON.parse(n.desc||``)}catch{return n.desc}}),o=()=>{n.desc&&r(n.desc)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,YHt,[(0,t.createElementVNode)(`div`,XHt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.title)+` `,1),e.desc?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`desc-copy`,title:(0,t.unref)(Tl)(`复制`),onClick:o},[(0,t.createVNode)((0,t.unref)(Hl))],8,ZHt)):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createElementVNode)(`div`,QHt,[(0,t.createCommentVNode)(` null 的 typeof 为 object,需排除,避免 v-for 异常;键/值统一转字符串后展示 `),a.value!==null&&typeof a.value==`object`?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(a.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:`desc-panel-item`},[(0,t.createElementVNode)(`span`,$Ht,(0,t.toDisplayString)(String(n))+`:`,1),(0,t.createElementVNode)(`span`,eUt,[(0,t.createElementVNode)(`span`,tUt,(0,t.toDisplayString)(i(e)),1)])]))),128)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nUt,(0,t.toDisplayString)(i(a.value)),1))])]))}}),rUt={class:`ai-tool-message`},iUt=(0,t.defineComponent)({__name:`tool-message`,props:{duration:{},error:{type:[Boolean,String]},toolCallId:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,rUt,[(0,t.createVNode)(z9,{desc:e.content||(typeof e.error==`string`?e.error:void 0),title:(0,t.unref)(Tl)(`返回内容`)},null,8,[`desc`,`title`])]))}}),aUt={class:`ai-toolcall-render`},oUt={class:`toolcall-header-text`},sUt={key:0,class:`toolcall-header-status`},cUt={class:`ai-toolcall-render-content`},lUt=(0,t.defineComponent)({__name:`toolcall-render`,props:{duration:{},status:{},toolCall:{}},setup(e){let n=e,r=(0,t.shallowRef)(!0),i=Xu();function a(){r.value=!r.value}let o=(0,t.computed)(()=>[Al.Complete,Al.Completed,Al.Success].includes(n.status)),s=(0,t.computed)(()=>n.status===Al.Error||!!n.toolCall?.toolMessage?.error),l=(0,t.computed)(()=>n.status===Al.Stop),u=(0,t.computed)(()=>!o.value&&!s.value&&!l.value),d=(0,t.computed)(()=>{let e=n.toolCall?.function;return e?.function_type??(e?.mcpName?`mcp`:`function`)}),f=(0,t.computed)(()=>d.value===`skill`?Tl(`读取 Skill`):d.value===`mcp`?Tl(`调用 MCP`):Tl(`调用工具`)),p=(0,t.computed)(()=>d.value===`skill`?Tl(`正在读取`):Tl(`正在调用`)),m=(0,t.computed)(()=>{let e=n.toolCall?.function,t=e?.mcpName||``,r=e?.name||n.toolCall?.id||``;return t?`${t} / ${r}`:r}),h=(0,t.computed)(()=>s.value?Tl(`失败`):o.value?Tl(`成功`):``),g=(0,t.computed)(()=>{let e=n.duration||n.toolCall?.toolMessage?.duration;return e?Sl(e):``}),_=(0,t.computed)(()=>{let e=`${u.value?p.value:f.value} ${m.value}`;if(!h.value)return e;let t=g.value?`,${Tl(`耗时`)}:${g.value}`:``;return`${e}(${h.value}${t})`});return(n,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,aUt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ai-toolcall-render-header`,{"is-expanded":!r.value}]),onClick:a},[(0,t.createVNode)((0,t.unref)(H_e)),(0,t.createCommentVNode)(` 前缀、工具名与状态同处一个内联文本块,保证「(成功,…)」紧贴工具名,与设计稿一致 `),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,oUt,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`toolcall-header-title`,{"is-loading":u.value}])},(0,t.toDisplayString)(u.value?p.value:f.value)+` `+(0,t.toDisplayString)(m.value),3),h.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,sUt,[o[0]||=(0,t.createTextVNode)(`\xA0(\xA0`,-1),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`toolcall-header-result`,s.value?`is-error`:`is-success`])},(0,t.toDisplayString)(h.value),3),g.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`,`+(0,t.toDisplayString)((0,t.unref)(Tl)(`耗时`))+`:`+(0,t.toDisplayString)(g.value),1)],64)):(0,t.createCommentVNode)(`v-if`,!0),o[1]||=(0,t.createTextVNode)(`\xA0)`,-1)])):(0,t.createCommentVNode)(`v-if`,!0)])),[[(0,t.unref)(ld),{...(0,t.unref)(i),text:_.value,appendTo:`parent`}]]),u.value?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(U_e),{key:0,class:(0,t.normalizeClass)({"is-expanded":!r.value})},null,8,[`class`]))],2),(0,t.withDirectives)((0,t.createElementVNode)(`div`,cUt,[(0,t.createVNode)(z9,{desc:e.toolCall?.function.description,title:(0,t.unref)(Tl)(`描述`)},null,8,[`desc`,`title`]),(0,t.createVNode)(z9,{desc:e.toolCall?.function.arguments,title:(0,t.unref)(Tl)(`参数`)},null,8,[`desc`,`title`]),e.toolCall?.toolMessage?((0,t.openBlock)(),(0,t.createBlock)(iUt,(0,t.normalizeProps)((0,t.mergeProps)({key:0},e.toolCall.toolMessage)),null,16)):(0,t.createCommentVNode)(`v-if`,!0)],512),[[t.vShow,!r.value]])]))}}),uUt={class:`ai-message-artifacts`},dUt=(0,t.defineComponent)({__name:`message-artifacts`,props:{artifacts:{},onDownload:{type:Function},onPreview:{type:Function}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,uUt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.artifacts,n=>((0,t.openBlock)(),(0,t.createBlock)(Czt,{key:n.outputId,file:n,"on-download":e.onDownload,"on-preview":e.onPreview},null,8,[`file`,`on-download`,`on-preview`]))),128))]))}}),fUt={class:`ai-assistant-message`},pUt={key:0,class:`ai-assistant-message-content`},mUt={key:1,class:`ai-assistant-message-toolcalls`},hUt=(0,t.defineComponent)({__name:`assistant-message`,props:{content:{},id:{},messageId:{},name:{},property:{},role:{},status:{},toolCalls:{},uid:{}},setup(e){let n=e,r=(0,t.computed)(()=>n.property?.artifacts),i=e=>{let{toolMessage:t}=e;return t?t.error?Al.Error:t.status??n.status:n.status===Al.Stop?Al.Stop:Al.Pending};return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fUt,[(0,t.createCommentVNode)(` 内容 `),e.content?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pUt,[(0,t.renderSlot)(n.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)({content:e.content})),()=>[(0,t.createVNode)(X7,{content:e.content||``,status:e.status,type:(0,t.unref)(Ol).Text},null,8,[`content`,`status`,`type`])])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 工具调用 `),e.toolCalls&&e.toolCalls.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mUt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.toolCalls,e=>((0,t.openBlock)(),(0,t.createBlock)(lUt,{key:e.id,status:i(e),"tool-call":e},null,8,[`status`,`tool-call`]))),128))])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 生成文件产物 `),r.value&&r.value.length>0?((0,t.openBlock)(),(0,t.createBlock)(dUt,{key:2,artifacts:r.value},null,8,[`artifacts`])):(0,t.createCommentVNode)(`v-if`,!0)]))}}),gUt={class:`ai-info-message`},_Ut={class:`ai-info-message-body`},vUt=(0,t.defineComponent)({__name:`info-message`,props:{content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gUt,[(0,t.createElementVNode)(`div`,_Ut,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Array.isArray(e.content)?e.content:[e.content],(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:`ai-info-message-content`},(0,t.toDisplayString)(e),1))),128))])]))}}),yUt={class:`ai-tool-approval-card`},bUt={class:`ai-tool-approval-card__header`},xUt={class:`ai-tool-approval-card__title-wrap`},SUt={class:`ai-tool-approval-card__title`},CUt={class:`ai-tool-approval-card__fields`},wUt={class:`ai-tool-approval-card__field`},TUt={class:`ai-tool-approval-card__field`},EUt={key:0,class:`ai-tool-approval-card__processor`},DUt={class:`ai-tool-approval-card__processor-text`},OUt={class:`ai-tool-approval-card__actions`},kUt={class:`ai-tool-approval-card__cancel-wrap`},AUt=2e3,jUt=(0,t.defineComponent)({__name:`tool-approval-card`,props:{interrupt:{},onInterruptResume:{type:Function},readonly:{type:Boolean}},setup(e){let n=e,r=Xu(),i=fSe(),a=(0,t.computed)(()=>i.value===Nl.Share),{copy:o}=Qu(),s=new Set([El.PENDING,El.DRAFT]),l=new Set([El.ABANDONED,El.CANCELLED,El.EXPIRED,El.REJECTED]),u=(0,t.computed)(()=>n.interrupt.metadata?.ticket??{approvers:[],sn:``,status:El.PENDING,submit_time:``,title:``,url:``}),d=new Set([El.CANCELLED,El.REVOKED]),f={[El.APPROVED]:Tl(`该单据已通过,无法取消`),[El.CANCELLED]:Tl(`单据已取消审批`),[El.REJECTED]:Tl(`该单据已被拒绝,无法取消`),[El.REVOKED]:Tl(`单据已取消审批`)},p=(0,t.computed)(()=>s.has(u.value.status)),m=(0,t.computed)(()=>p.value?`pending`:u.value.status),h=(0,t.computed)(()=>p.value?Tl(`审批中`):h_e[u.value.status]??u.value.status),g=(0,t.computed)(()=>u.value.approvers.filter(Boolean).join(`、`)||Tl(`无`)),_=(0,t.computed)(()=>u.value.url||u.value.sn),v=(0,t.computed)(()=>d.has(u.value.status)?Tl(`已取消审批`):Tl(`取消审批`)),y=(0,t.computed)(()=>f[u.value.status]??Tl(`当前状态无法取消审批`)),b=()=>{u.value.url&&window.open(u.value.url,`_blank`,`noopener`)},x=()=>{_.value&&o(_.value)},S=(0,t.shallowRef)(!1),C=(0,t.shallowRef)(!1),w,T=()=>{C.value=!0,clearTimeout(w),w=setTimeout(()=>{C.value=!1},AUt)},E=()=>{S.value||(S.value=!0,T(),n.onInterruptResume?.({operation:jl.ApprovalCancel,payload:{interrupt_id:n.interrupt.id}},n.interrupt))},D=()=>{C.value||a.value||(T(),n.onInterruptResume?.({operation:jl.ApprovalRefresh,payload:{interrupt_id:n.interrupt.id}},n.interrupt))};return(0,t.onUnmounted)(()=>clearTimeout(w)),(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,yUt,[(0,t.createElementVNode)(`header`,bUt,[(0,t.createElementVNode)(`div`,xUt,[i[0]||=(0,t.createElementVNode)(`span`,{class:`ai-tool-approval-card__title-bar`},null,-1),(0,t.createElementVNode)(`span`,SUt,(0,t.toDisplayString)(u.value.title||(0,t.unref)(Tl)(`算法方案评审单`)),1),(0,t.withDirectives)((0,t.createVNode)((0,t.unref)(Hl),{class:(0,t.normalizeClass)([`ai-tool-approval-card__copy-icon`,{"is-disabled":!_.value}]),onClick:x},null,8,[`class`]),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:(0,t.unref)(Tl)(`复制单据链接`),theme:`ai-chat-box`,offset:[0,8]}]]),(0,t.createCommentVNode)(` 审批中态提供刷新图标:取消为后端轮询、无法实时返回,用户可手动拉取单据最新状态;每次刷新 2s 冷却 `),p.value&&!e.readonly?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Wl),{key:0,class:(0,t.normalizeClass)([`ai-tool-approval-card__refresh-icon`,{"is-disabled":C.value||a.value}]),onClick:D},null,8,[`class`])),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:(0,t.unref)(Tl)(`刷新单据状态`),theme:`ai-chat-box`,offset:[0,8]}]]):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-tool-approval-card__status`,`ai-tool-approval-card__status--${m.value}`])},[u.value.status===(0,t.unref)(El).APPROVED?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(eye),{key:0,class:`ai-tool-approval-card__status-icon`})):(0,t.unref)(l).has(u.value.status)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(nye),{key:1,class:`ai-tool-approval-card__status-icon`})):u.value.status===(0,t.unref)(El).REVOKED?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(rye),{key:2,class:(0,t.normalizeClass)([`ai-tool-approval-card__status-icon`,{"ai-tool-approval-card__status-icon--revoked":u.value.status===(0,t.unref)(El).REVOKED}])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:3,class:`ai-tool-approval-card__status-icon`,mode:`spin`,size:`mini`,theme:`primary`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(h.value),1)],2)]),(0,t.createElementVNode)(`dl`,CUt,[(0,t.createElementVNode)(`div`,wUt,[(0,t.createElementVNode)(`dt`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`单据编号`)),1),(0,t.createElementVNode)(`dd`,null,(0,t.toDisplayString)(u.value.sn||`--`),1)]),(0,t.createElementVNode)(`div`,TUt,[(0,t.createElementVNode)(`dt`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`提交时间`)),1),(0,t.createElementVNode)(`dd`,null,(0,t.toDisplayString)(u.value.submit_time||`--`),1)])]),p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,EUt,[(0,t.createVNode)((0,t.unref)(tye),{class:`ai-tool-approval-card__processor-icon`}),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,DUt,[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`当前处理人`))+`:`+(0,t.toDisplayString)(g.value),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,OUt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-tool-approval-card__detail`,disabled:!u.value.url,theme:`primary`,onClick:b},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`查看单据详情`))+` `,1),(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-tool-approval-card__detail-icon`})]),_:1},8,[`disabled`]),(0,t.createCommentVNode)(` 待审批态:可点「取消审批」;点击后按钮进入 loading(同步 resume 无结果,防重复提交) `),p.value&&!e.readonly?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ko),{key:0,class:`ai-tool-approval-card__cancel`,disabled:S.value||a.value,loading:S.value,outline:``,theme:`primary`,onClick:E},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消审批`)),1)]),_:1},8,[`disabled`,`loading`])):e.readonly?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` 终态:保留「取消审批」按钮但置灰,hover 显示当前状态无法取消的原因(tooltip 挂在外层 span,规避 disabled 按钮不触发 hover) `),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,kUt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-tool-approval-card__cancel`,disabled:``,outline:``},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(v.value),1)]),_:1})])),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:y.value,theme:`ai-chat-box`,offset:[0,8]}]])],2112))])]))}}),MUt={class:`ai-interrupt-message`},NUt={key:0,class:`ai-interrupt-message__content`},PUt={class:`ai-interrupt-message__fallback`},FUt=(0,t.defineComponent)({__name:`interrupt-message`,props:{content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{},onInterruptResume:{type:Function}},setup(e){let n={[Dl.AIDevToolApproval]:jUt},r=e=>({id:e.interruptId||e.id||``,reason:Dl.AIDevToolApproval,toolCallId:``,metadata:e.payload.metadata}),i={[Dl.AIDevToolApproval]:e=>({component:jUt,props:{interrupt:r(e),onInterruptResume:o.onInterruptResume,readonly:!1}}),[Dl.UserQuestion]:e=>({component:wBt,props:{answers:e.payload?.answers??[],status:e.status}})},a=new Set([Dl.UserQuestion]),o=e,s=(0,t.computed)(()=>o.content?.outcome?.type===`interrupt`?o.content.outcome.interrupts:[]),l=(0,t.computed)(()=>o.content?.message),u=e=>n[e.reason],d=e=>a.has(e.reason),f=(0,t.computed)(()=>{if(o.content?.outcome?.type!==`success`)return;let e=o.content?.result;if(e)return i[e.reason]?.(e)});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,MUt,[l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,NUt,(0,t.toDisplayString)(l.value),1)):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.toolCallId},[u(n)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u(n)),{key:0,interrupt:n,"on-interrupt-resume":e.onInterruptResume},null,40,[`interrupt`,`on-interrupt-resume`])):d(n)?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` UserQuestion 的交互浮层渲染在 chat-input 上方,不在会话内渲染 `),(0,t.createElementVNode)(`div`,PUt,(0,t.toDisplayString)(n.message||(0,t.unref)(Tl)(`暂不支持的中断消息`)),1)],2112))],64))),128)),(0,t.createCommentVNode)(` outcome.success 时按 reason 在会话内回显 resume 结果(审批单 / 已回答内容等) `),f.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(f.value.component),(0,t.normalizeProps)((0,t.mergeProps)({key:1},f.value.props)),(0,t.createSlots)({_:2},[n.$slots.answeredQuestion?{name:`answer`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`answeredQuestion`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)))]),key:`0`}:void 0]),1040)):(0,t.createCommentVNode)(`v-if`,!0)]))}}),IUt={class:`ai-loading-message`},LUt=(0,t.defineComponent)({__name:`loading-message`,setup(e){let n=$u();return(0,t.onMounted)(()=>{n?.value?.jumpToBottom?.()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,IUt,[(0,t.createVNode)(Gl,{size:18}),(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`请求中...`)),1)])]))}}),RUt={class:`ai-reasoning-message`},zUt={key:0,class:`ai-reasoning-message-title-icon`},BUt={class:`ai-reasoning-message-title-text`},VUt={class:`ai-reasoning-message-content`},HUt=(0,t.defineComponent)({__name:`reasoning-message`,props:(0,t.mergeModels)({duration:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),{stop:i}=(0,t.watch)(()=>n.duration,async e=>{e&&(r.value=!0,await(0,t.nextTick)(),i?.())},{immediate:!0}),a=(0,t.computed)(()=>{switch(n.status){case Al.Pending:return Tl(`思考中`);case Al.Success:case Al.Complete:return Tl(`已思考完成`)+(n.duration?` (${Tl(`耗时`)} :${Sl(n.duration)})`:``);case Al.Error:return Tl(`思考失败`);case Al.Stop:return Tl(`思考已停止`);default:return Tl(`思考中`)}});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,RUt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ai-reasoning-message-title`,{"ai-reasoning-message-title-collapsed":r.value,"is-thinking":e.status===(0,t.unref)(Al).Pending||e.status===(0,t.unref)(Al).Streaming,"is-complete":e.status===(0,t.unref)(Al).Complete||e.status===(0,t.unref)(Al).Success,"is-error":e.status===(0,t.unref)(Al).Error}]),onClick:i[0]||=e=>r.value=!r.value},[e.status===(0,t.unref)(Al).Pending||e.status===(0,t.unref)(Al).Streaming?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,zUt,[(0,t.createVNode)(Gl)])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,BUt,(0,t.toDisplayString)(a.value),1),(0,t.createCommentVNode)(` <template v-if="status === MessageStatus.Pending || status === MessageStatus.Streaming">
|
|
3906
|
+
`)}var HRt={class:`ai-input-attachment`},URt={class:`ai-input-attachment-default`},WRt={class:`ai-input-attachment-before-send`},GRt=(0,t.defineComponent)({__name:`input-attachment`,props:{messageState:{},sendDisabledTip:{},tippyOptions:{}},emits:[`sendMessage`,`stopSending`],setup(e,{emit:n}){let r=e,i=n,a=()=>{i(`stopSending`)},o=()=>{r.sendDisabledTip||r.messageState===Al.Disabled||r.messageState===Al.Pending||r.messageState===Al.Streaming||i(`sendMessage`)};return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,HRt,[(0,t.createElementVNode)(`div`,URt,[(0,t.renderSlot)(n.$slots,`default`)]),(0,t.createElementVNode)(`div`,WRt,[(0,t.renderSlot)(n.$slots,`before-send`)]),(0,t.renderSlot)(n.$slots,`send-icon`,{},()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`send-message-icon`,[e.messageState&&`send-message-icon__${e.messageState}`,{"send-message-icon__disabled":e.sendDisabledTip}]]),onClick:o},[e.messageState===(0,t.unref)(Al).Streaming||e.messageState===(0,t.unref)(Al).Pending||e.messageState===(0,t.unref)(Al).Fetching?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(pye),{key:0,onClick:a},null,512)),[[(0,t.unref)(Ju),{...e.tippyOptions,content:(0,t.unref)(Tl)(`停止`),theme:`ai-chat-box`,offset:[0,16]}]]):(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fye),{key:1},null,512)),[[(0,t.unref)(Ju),{...e.tippyOptions,content:e.sendDisabledTip||(r.messageState===(0,t.unref)(Al).Disabled?void 0:(0,t.unref)(Tl)(`发送`)),theme:`ai-chat-box`,offset:[0,16]}]])],2)])]))}}),KRt={class:`ai-input-menu-option-name`},qRt=(0,t.defineComponent)({__name:`input-menu-option`,props:{active:{type:Boolean},item:{}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>{if(!r.item.description)return{content:``,onShow:()=>!1};let e=_Rt(r.item.type);return dRt({title:e?`${Tl(e)}:${r.item.name}`:r.item.name,description:r.item.description})}),o=()=>{r.item.disabled||i(`select`,r.item)};return(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-input-menu-option`,{"is-active":e.active,"is-disabled":e.item.disabled}]),onClick:o},[(0,t.createVNode)((0,t.unref)(T9),{icon:e.item.icon,name:e.item.name,type:e.item.type},null,8,[`icon`,`name`,`type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,KRt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.item.name),1)])),[[(0,t.unref)(ld),{text:e.item.name,zIndex:(0,t.unref)(Ml)}]])],2)),[[(0,t.unref)(Ju),a.value]])}}),JRt={class:`ai-input-menu-title`},YRt={key:0,class:`ai-input-menu-empty`},XRt=[`onClick`],ZRt=(0,t.defineComponent)({__name:`input-menu-panel`,props:{flatItems:{},groups:{}},emits:[`select`,`toggleGroup`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`panelRef`),o=(0,t.computed)(()=>r.flatItems),{activeIndex:s}=BSe({items:o,onSelect:e=>i(`select`,e),menuRef:a}),l=(0,t.computed)(()=>r.flatItems[s.value]);(0,t.watch)(o,()=>{s.value=0});let u=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(`close`))};return(0,t.onMounted)(()=>{window.addEventListener(`keydown`,u,!0)}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,u,!0)}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`panelRef`,ref:a,class:`ai-input-menu`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.groups,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:(0,t.normalizeClass)([`ai-input-menu-group`,{"is-divided":e.divided}])},[(0,t.createElementVNode)(`div`,JRt,(0,t.toDisplayString)((0,t.unref)(Tl)(e.name)),1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createBlock)(qRt,{key:e.id,active:l.value?.id===e.id,item:e,onSelect:r[0]||=e=>i(`select`,e)},null,8,[`active`,`item`]))),128)),e.items.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,YRt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无数据`)),1)),e.restCount?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:`ai-input-menu-toggle`,onClick:t=>i(`toggleGroup`,e.key)},[(0,t.createVNode)((0,t.unref)(Rl),{class:(0,t.normalizeClass)([`ai-input-menu-toggle-icon`,{"is-expanded":e.expanded}])},null,8,[`class`]),(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)(e.expanded?(0,t.unref)(Tl)(`收起`):(0,t.unref)(Tl)(`更多`))+` +`+(0,t.toDisplayString)(e.restCount),1)],8,XRt)):(0,t.createCommentVNode)(`v-if`,!0)],2))),128))],512))}}),QRt=(0,t.defineComponent)({__name:`input-menu`,props:{flatItems:{},groups:{},tippyOptions:{},visible:{type:Boolean}},emits:[`select`,`toggleGroup`,`close`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`tippyRef`),o={name:`sameWidth`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>{e.elements.popper.style.width=`${e.elements.reference.getBoundingClientRect().width}px`}},s=(0,t.computed)(()=>({appendTo:()=>document.body,arrow:!1,duration:0,hideOnClick:!1,interactive:!0,maxWidth:`none`,offset:[0,8],placement:`top`,popperOptions:{modifiers:[o]},theme:`ai-input-menu`,trigger:`manual`,zIndex:Ml,...r.tippyOptions||{},onClickOutside:()=>i(`close`)}));return(0,t.watch)(()=>r.visible,()=>{if(r.visible){a.value?.show?.();return}a.value?.hide?.()},{flush:`post`,immediate:!0}),(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:a,tag:`div`},s.value),{content:(0,t.withCtx)(()=>[e.visible?((0,t.openBlock)(),(0,t.createBlock)(ZRt,{key:0,"flat-items":e.flatItems,groups:e.groups,onClose:r[0]||=e=>i(`close`),onSelect:r[1]||=e=>i(`select`,e),onToggleGroup:r[2]||=e=>i(`toggleGroup`,e)},null,8,[`flat-items`,`groups`])):(0,t.createCommentVNode)(`v-if`,!0)]),default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`)]),_:3},16))}}),$Rt=e=>{let n=(0,t.shallowRef)([]);(0,t.watch)([()=>e.keyword.value,()=>e.trigger.value],()=>{n.value=[]});let r=(0,t.computed)(()=>{let t=e.trigger.value;if(!t)return[];let r=Math.max(e.groupItemLimit.value,1),i=e.keyword.value.trim().toLowerCase(),a=[];for(let o of pRt[t]){let t=fRt[o],s=e.sources.value.filter(e=>(e.type!==`artifact`||!!e.id)&&t.types.includes(e.type)&&(!i||e.name.toLowerCase().includes(i)));if(!s.length)continue;let l=n.value.includes(o),u=Math.max(s.length-r,0);a.push({key:o,name:t.name,divided:mRt.includes(o),expanded:l,items:l||!u?s:s.slice(0,r),restCount:u})}return a});return{groups:r,flatItems:(0,t.computed)(()=>r.value.flatMap(e=>e.items.filter(e=>!e.disabled))),hasContent:(0,t.computed)(()=>r.value.length>0),toggleGroup:e=>{let t=n.value.indexOf(e);n.value=t===-1?[...n.value,e]:[...n.value.slice(0,t),...n.value.slice(t+1)]}}},ezt=[{key:`support_thinking`,label:()=>Tl(`深度思考`),theme:`primary`},{key:`support_thinking_quick`,label:()=>Tl(`快速思考`),theme:`success`},{key:`support_vision`,label:()=>Tl(`图生文`),theme:`warning`}],tzt=e=>ezt.filter(t=>e.property?.[t.key]).map(e=>({text:e.label(),theme:e.theme})),nzt=(e,t)=>({allowHTML:!1,appendTo:t?.appendTo??(()=>document.body),arrow:!0,content:``,delay:[0,0],getReferenceClientRect:e,interactive:!1,offset:[0,8],placement:t?.placement??`auto`,popperOptions:{strategy:`fixed`},theme:`ai-chat-box`,trigger:`manual`,zIndex:t?.zIndex??10001}),rzt={class:`ai-model-selector-panel-search`},izt=[`onClick`,`onMouseenter`],azt=[`title`],ozt={key:1,class:`ai-model-selector-panel-option-tags`},szt={key:0,class:`ai-model-selector-panel-empty`},czt=(0,t.defineComponent)({__name:`model-selector-panel`,props:(0,t.mergeModels)({models:{},searchPlaceholder:{},selectedName:{},tippyOptions:{}},{keyword:{default:``},keywordModifiers:{}}),emits:(0,t.mergeModels)([`select`],[`update:keyword`]),setup(e,{expose:r,emit:i}){let a=e,o=(0,t.computed)(()=>{let e=new Map;return a.models.forEach(t=>e.set(t.llm_name,tzt(t))),e}),s=i,l=(0,t.useModel)(e,`keyword`),u=(0,t.useTemplateRef)(`panelRef`),d=(0,t.useTemplateRef)(`searchInputRef`),f,p,m,h=0,g=e=>e.description?.trim()||void 0,_=e=>g(e)?void 0:e.llm_name,v=Object.assign(()=>p?.isConnected?p.getBoundingClientRect():new DOMRect,{contextElement:document.body}),y=e=>{if(e instanceof HTMLElement)return e;if(typeof e==`function`){let t=e(document.body);if(t instanceof HTMLElement)return t}return document.body},b=()=>{m!==void 0&&(clearTimeout(m),m=void 0)},x=()=>{h+=1,b(),p=void 0;let e=f;f=void 0,e?.destroy()},S=(e,t)=>{let r=g(t);if(!r){x();return}let i=e.currentTarget;if(!(i instanceof HTMLElement))return;b(),p=i;let o=h;m=setTimeout(()=>{m=void 0,!(o!==h||p!==i||!i.isConnected)&&(f||=(v.contextElement=y(a.tippyOptions?.appendTo),(0,n.default)(document.createElement(`div`),{...nzt(v,a.tippyOptions),onShow:()=>{if(!p?.isConnected)return!1}})),f.setContent(r),f.show())},300)},C=()=>{x()};(0,t.onBeforeUnmount)(x);let w=(0,t.shallowRef)(a.models),{activeIndex:T}=BSe({items:w,menuRef:u,onSelect:e=>E(e)});(0,t.watch)(()=>a.models,e=>{w.value=e,T.value=0,x()});let E=e=>{e.disabled||s(`select`,e)};return r({focusSearch:()=>{(0,t.nextTick)(()=>{d.value?.focus()})},hideDescriptionTip:x}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`panelRef`,ref:u,class:`ai-model-selector-panel`,onScrollPassive:x},[(0,t.createElementVNode)(`div`,rzt,[(0,t.createVNode)((0,t.unref)(is),{ref_key:`searchInputRef`,ref:d,modelValue:l.value,"onUpdate:modelValue":r[0]||=e=>l.value=e,behavior:`simplicity`,class:`ai-model-selector-panel-search-input`,clearable:``,placeholder:e.searchPlaceholder,type:`text`},{prefix:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($ve),{class:`ai-model-selector-panel-search-icon`})]),_:1},8,[`modelValue`,`placeholder`])]),(0,t.createElementVNode)(`div`,{class:`ai-model-selector-panel-list`,onScrollPassive:x},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.models,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.id,class:(0,t.normalizeClass)([`ai-model-selector-panel-option`,{"is-selected":n.llm_name===e.selectedName,"is-active":r===(0,t.unref)(T),"is-disabled":n.disabled}]),onClick:e=>E(n),onMouseenter:e=>S(e,n),onMouseleave:C},[n.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(T9),{key:0,class:`ai-model-selector-panel-option-icon`,icon:n.icon,name:n.llm_name,type:`model`},null,8,[`icon`,`name`])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,{class:`ai-model-selector-panel-option-name`,title:_(n)},(0,t.toDisplayString)(n.llm_name),9,azt),o.value.get(n.llm_name)?.length?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,ozt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value.get(n.llm_name),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:n,class:(0,t.normalizeClass)([`ai-model-capability-tag`,`is-${e.theme||`default`}`])},(0,t.toDisplayString)(e.text),3))),128))])):(0,t.createCommentVNode)(`v-if`,!0)],42,izt))),128)),e.models.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,szt,[(0,t.createVNode)((0,t.unref)(hc),{scene:`part`,type:`empty`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`搜索结果为空`)),1)]),_:1})]))],32)],544))}}),lzt={class:`ai-model-selector-trigger-name`},uzt=(0,t.defineComponent)({__name:`model-selector-trigger`,props:{disabled:{type:Boolean},expanded:{type:Boolean},model:{},placeholder:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-model-selector-trigger`,{"is-expanded":e.expanded,"is-disabled":e.disabled}])},[e.model?.icon?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(T9),{key:0,class:`ai-model-selector-trigger-icon`,icon:e.model.icon,name:e.model.llm_name,type:`model`},null,8,[`icon`,`name`])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,lzt,(0,t.toDisplayString)(e.model?.llm_name||e.placeholder),1),(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-model-selector-trigger-arrow`})],2))}}),dzt=e=>{let n=(0,t.shallowRef)(``);return{keyword:n,filteredModels:(0,t.computed)(()=>{let t=n.value.trim().toLowerCase();return t?e.models.value.filter(e=>e.llm_name.toLowerCase().includes(t)):e.models.value}),currentModel:(0,t.computed)(()=>e.models.value.find(t=>t.llm_name===e.selectedModel.value)),resetKeyword:()=>{n.value=``}}},fzt=(0,t.defineComponent)({__name:`model-selector`,props:(0,t.mergeModels)({disabled:{type:Boolean},models:{default:()=>[]},placeholder:{default:()=>Tl(`选择模型`)},searchPlaceholder:{default:()=>Tl(`搜索模型关键字`)},tippyOptions:{default:void 0}},{modelValue:{},modelModifiers:{}}),emits:(0,t.mergeModels)([`change`,`show`],[`update:modelValue`]),setup(e,{emit:n}){let r=e,i=n,a=(0,t.useModel)(e,`modelValue`),o=(0,t.useTemplateRef)(`tippyRef`),s=(0,t.useTemplateRef)(`panelRef`),l=(0,t.shallowRef)(!1),{keyword:u,filteredModels:d,currentModel:f,resetKeyword:p}=dzt({models:(0,t.toRef)(r,`models`),selectedModel:a}),m=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],placement:`top-end`,theme:`ai-model-selector`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),h=()=>{if(r.disabled||!r.models.length)return!1;l.value=!0,p(),i(`show`),s.value?.focusSearch()},g=()=>{l.value=!1,s.value?.hideDescriptionTip()},_=e=>{a.value=e.llm_name,i(`change`,e),o.value?.hide?.()};return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:o},m.value,{onHidden:g,onShow:h}),{content:(0,t.withCtx)(()=>[(0,t.createVNode)(czt,{ref_key:`panelRef`,ref:s,keyword:(0,t.unref)(u),"onUpdate:keyword":r[0]||=e=>(0,t.isRef)(u)?u.value=e:null,models:(0,t.unref)(d),"search-placeholder":e.searchPlaceholder,"selected-name":a.value,"tippy-options":e.tippyOptions,onSelect:_},null,8,[`keyword`,`models`,`search-placeholder`,`selected-name`,`tippy-options`])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(uzt,{disabled:e.disabled,expanded:l.value,model:(0,t.unref)(f),placeholder:e.placeholder},null,8,[`disabled`,`expanded`,`model`,`placeholder`])]),_:1},16))}}),pzt={class:`chat-input-wrapper`},mzt=[`accept`],hzt={key:1,class:`ai-divider`},gzt=(0,t.defineComponent)({__name:`chat-input`,props:(0,t.mergeModels)({accept:{default:g_e},defaultUploadFiles:{},inputMaxHeight:{default:280},menuGroupItemLimit:{default:4},menuSources:{default:()=>[]},messageStatus:{},models:{},modelValue:{},onSendMessage:{},onStopSending:{},onUpload:{},placeholder:{},sendDisabledTip:{},shortcutId:{},shortcuts:{},supportUpload:{type:Boolean,default:!0},tippyOptions:{}},{cite:{required:!1,default:``},citeModifiers:{},selectedModel:{required:!1},selectedModelModifiers:{}}),emits:(0,t.mergeModels)([`selectShortcut`,`deleteShortcut`,`deleteFile`,`update:modelValue`,`modelChange`],[`update:cite`,`update:selectedModel`]),setup(e,{expose:n,emit:r}){let i=(0,t.useTemplateRef)(`aiSlashInputRef`),a=(0,t.useTemplateRef)(`filesRef`),o=(0,t.useTemplateRef)(`fileInputRef`),s=(0,t.useModel)(e,`cite`),l=(0,t.useModel)(e,`selectedModel`),u=(0,t.shallowRef)(280),d=e,f=r,p=(0,t.computed)(()=>new Set(_.value.map(e=>e.type))),m=(0,t.computed)(()=>d.placeholder===void 0?VRt({isEn:wl,hasSlashMenu:[`skill`,`mcp`,`tool`].some(e=>p.value.has(e)),hasAtMenu:[`knowledgebase`,`doc`,`artifact`].some(e=>p.value.has(e)),hasPromptMenu:p.value.has(`prompt`)}):d.placeholder),h=(0,t.ref)(d.defaultUploadFiles||[]),g=(0,t.computed)(()=>h.value.map(id).filter(e=>!!e)),_=(0,t.computed)(()=>{let e=new Map(d.menuSources.map(e=>[`${e.type}:${e.id}`,e]));for(let t of g.value)e.set(`artifact:${t.outputId}`,ad(t));return[...e.values()]}),v=(0,t.computed)(()=>d.shortcuts?.find(e=>e.id===d.shortcutId)),y=(0,t.shallowRef)(null),b=(0,t.shallowRef)(``),x=(0,t.computed)(()=>typeof d.modelValue==`string`?new Set:new Set(d.modelValue.flat().filter(e=>e.type===`tag`).map(e=>`${e.data.type}:${e.data.value}`))),S=(0,t.computed)(()=>{let e=_.value.filter(e=>!x.value.has(`${e.type}:${e.id}`));return d.supportUpload?[{id:`__built_in_file__`,type:`file`,name:Tl(`文件`)},...e]:e}),C=(0,t.computed)(()=>d.accept||void 0),{groups:w,flatItems:T,hasContent:E,toggleGroup:D}=$Rt({sources:S,keyword:b,trigger:y,groupItemLimit:(0,t.computed)(()=>d.menuGroupItemLimit)}),O=(0,t.computed)(()=>!!y.value&&E.value),k=(0,t.computed)(()=>d.supportUpload||d.menuSources.length>0),A=e=>{y.value=e.trigger,b.value=e.keyword},j=()=>{i.value?.closeMenu?.()},M=()=>{if(y.value===`plus`){j();return}i.value?.openPlusMenu?.()},N=e=>{D(e)},P=()=>{o.value?.click()},F=e=>{if(e.type===`file`){i.value?.consumeTriggerText?.(),j(),P();return}if(e.type===`prompt`){i.value?.replaceAll?.(e.content??e.name);return}i.value?.insertMenuItem?.(e)},I=(0,t.computed)(()=>typeof d.modelValue==`string`?d.modelValue:NRt(d.modelValue)),L=(0,t.computed)(()=>d.messageStatus&&[Al.Pending,Al.Streaming,Al.Fetching].includes(d.messageStatus)||h.value.length>0||I.value.trim()?d.messageStatus:Al.Disabled),R=(0,t.computed)(()=>h.value.some(e=>e.status===S9.Pending)),ee=(0,t.computed)(()=>h.value.some(e=>e.status===S9.Error)),z=(0,t.computed)(()=>{if(d.sendDisabledTip)return d.sendDisabledTip;if(R.value)return Tl(`文件上传中,请稍候`);if(ee.value)return Tl(`存在上传失败的文件,请删除后重试`)});(0,t.watchPostEffect)(()=>{let e=d.inputMaxHeight||280;if(h.value.length<1||!a.value){u.value=e;return}u.value=e+(a.value?.clientHeight||0)});let B=()=>USe(Array.isArray(d.modelValue)?d.modelValue:[],g.value),V=async()=>{try{if(z.value)return!1;i.value?.cleanup?.();let e;return h.value?.length?(e=h.value?.slice().map(e=>({type:Ol.Binary,id:e.id,outputId:e.outputId,url:e.url,mimeType:e.mimeType||e.file?.type||``,filename:nd(e),size:rd(e)})),I.value.trim()&&e.push({type:Ol.Text,text:I.value})):e=I.value,d.onSendMessage?.(e,B()),h.value=[],!0}catch(e){return console.error(e),!1}},te=e=>{if(e.key===`Enter`||e.key===`NumpadEnter`){if(e.shiftKey||O.value||L.value===Al.Disabled||z.value||L.value===Al.Fetching||L.value===Al.Streaming||L.value===Al.Pending)return;V()}},ne=async()=>{try{d.onStopSending?.()}catch(e){console.error(e)}},re=()=>{s.value=``},ie=e=>{f(`selectShortcut`,e)},ae=()=>{f(`deleteShortcut`)},H=e=>{f(`modelChange`,e)},oe=(C_e/(1024*1024)).toFixed(1),se=(e,t)=>{if(t?.status!==`failed`&&(t?.id||t?.path||t?.download_url||t?.status===`success`)){e.id=t.id||t.path,e.outputId=t.path,e.url=t.download_url,e.status=S9.Success;return}e.status=S9.Error},ce=async e=>{if(!d.supportUpload)return;let n=new Set(h.value.map(e=>e.file?td(e.file):``)),r=[],i=0,a=0;for(let o=0;o<e.length;o++){let s=e[o],l=td(s);if(n.has(l))continue;if(h.value.length>=9){i+=e.length-o;break}if(!XSe(s,d.accept)){a+=1;continue}if(s.size<=0||s.size>=20971520){i+=1;continue}n.add(l);let u=(0,t.reactive)({file:s,mimeType:s.type,status:S9.Pending});h.value.push(u),r.push(u)}if(a>0&&Cc({message:Tl(`有 {count} 个文件因格式不支持未添加`).replace(`{count}`,String(a)),theme:`error`}),i>0&&Cc({message:qSe(i,oe,wl),theme:`error`}),r.length>0){be();let e=r.map(e=>e.file).filter(e=>!!e),t=d.onUpload?.(e);if(!t)return;t.then(e=>{let t=Array.isArray(e)?e:[e];r.forEach((e,n)=>{se(e,t[n])})}).catch(()=>{r.forEach(e=>{e.status=S9.Error})})}},le=(0,t.shallowRef)(!1),ue=0,de=e=>!!e.dataTransfer?.types?.includes(`Files`),fe=e=>d.supportUpload&&de(e),pe=e=>{fe(e)&&(ue+=1,le.value=!0)},me=e=>{fe(e)&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))},he=e=>{fe(e)&&(ue=Math.max(ue-1,0),ue===0&&(le.value=!1))},ge=e=>{if(!fe(e))return;e.preventDefault(),ue=0,le.value=!1;let t=Array.from(e.dataTransfer?.files??[]);t.length&&ce(t)},_e=e=>{h.value=h.value.filter(t=>t.id&&e.id?t.id!==e.id:t.file?t.file!==e.file:t.url?t.url!==e.url:t.filename?t.filename!==e.filename:!0),f(`deleteFile`,e)},ve=e=>{f(`update:modelValue`,e,e.flat().filter(e=>e.type===`tag`).map(e=>_.value.find(t=>t.id===e.data.value&&t.type===e.data.type)).filter(e=>!!e))},ye=e=>{let t=e.target,n=Array.from(t.files??[]);n.length&&ce(n),t.value=``},be=()=>{i.value?.focus?.()};return n({focus:be,getUploadFiles:()=>h.value.slice(),insertMention:e=>{i.value?.appendMention?.(e)},triggerSendMessage:V,uploadedArtifacts:g}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ai-chat-input-container`,style:(0,t.normalizeStyle)({"--chat-z-index":(0,t.unref)(__e)})},[(0,t.renderSlot)(n.$slots,`top`),(0,t.renderSlot)(n.$slots,`interrupt`),(0,t.createElementVNode)(`div`,pzt,[(0,t.createVNode)((0,t.unref)(QRt),{"flat-items":(0,t.unref)(T),groups:(0,t.unref)(w),"tippy-options":e.tippyOptions,visible:O.value,onClose:j,onSelect:F,onToggleGroup:N},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`chat-input`,{"is-dragover":le.value}]),style:(0,t.normalizeStyle)({maxHeight:u.value+`px`}),onDragenter:pe,onDragleave:he,onDragover:me,onDrop:ge},[(0,t.renderSlot)(n.$slots,`input-header`,{},()=>[s.value?((0,t.openBlock)(),(0,t.createBlock)(CLt,{key:0,class:`chat-input-cite`,content:s.value,onClose:re},null,8,[`content`])):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.renderSlot)(n.$slots,`files`,(0,t.normalizeProps)((0,t.guardReactiveProps)({files:h.value})),()=>[h.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`filesRef`,ref:a,class:`chat-input-files`},[(0,t.createVNode)(aRt,{files:h.value,onDeleteFile:_e},null,8,[`files`])],512)):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createVNode)(BRt,{ref_key:`aiSlashInputRef`,ref:i,"model-value":e.modelValue,placeholder:m.value,onKeydown:te,onMenuChange:A,"onUpdate:modelValue":ve,onUpload:ce},null,8,[`model-value`,`placeholder`]),(0,t.createVNode)(GRt,{"message-state":L.value,"send-disabled-tip":z.value,"tippy-options":e.tippyOptions,onSendMessage:V,onStopSending:ne},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`input`,{ref_key:`fileInputRef`,ref:o,accept:C.value,class:`chat-input-file-input`,multiple:``,type:`file`,onChange:ye},null,40,mzt),k.value?((0,t.openBlock)(),(0,t.createBlock)(bLt,{key:0,active:y.value===`plus`,"tippy-options":e.tippyOptions,onToggle:M},null,8,[`active`,`tippy-options`])):(0,t.createCommentVNode)(`v-if`,!0),k.value&&(e.shortcuts?.length||v.value)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,hzt)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.renderSlot)(n.$slots,`attachment`,{},()=>[e.shortcuts&&!v.value?((0,t.openBlock)(),(0,t.createBlock)(cSe,{key:0,shortcuts:e.shortcuts,onSelectShortcut:ie},null,8,[`shortcuts`])):(0,t.createCommentVNode)(`v-if`,!0),v.value?((0,t.openBlock)(),(0,t.createBlock)(Yu,{key:1,class:`selected-shortcut-btn`,shortcut:v.value},{append:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vl),{onClick:ae})]),_:1},8,[`shortcut`])):(0,t.createCommentVNode)(`v-if`,!0)])]),"before-send":(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`model-selector`,(0,t.normalizeProps)((0,t.guardReactiveProps)({models:e.models,selectedModel:l.value})),()=>[e.models?.length?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fzt),{key:0,modelValue:l.value,"onUpdate:modelValue":r[0]||=e=>l.value=e,class:`chat-input-model-selector`,models:e.models,"tippy-options":e.tippyOptions,onChange:H,onShow:j},null,8,[`modelValue`,`models`,`tippy-options`])):(0,t.createCommentVNode)(`v-if`,!0)])]),"send-icon":(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`send-icon`,{sendDisabledTip:z.value})]),_:3},8,[`message-state`,`send-disabled-tip`,`tippy-options`])],38)]),_:3},8,[`flat-items`,`groups`,`tippy-options`,`visible`])])],4))}}),_zt={class:`ai-chat-input-info-alert`},vzt={class:`ai-chat-input-info-alert__text`},yzt=(0,t.defineComponent)({__name:`input-info-alert`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_zt,[(0,t.createVNode)((0,t.unref)(aye),{class:`ai-chat-input-info-alert__icon`}),(0,t.createElementVNode)(`span`,vzt,(0,t.toDisplayString)(e.content),1)]))}}),bzt={class:`ai-artifact-file-card-info`},xzt={class:`ai-artifact-file-card-name`},Szt={class:`ai-artifact-file-card-actions`},Czt=(0,t.defineComponent)({__name:`artifact-file-card`,props:{active:{type:Boolean},file:{},onDownload:{type:Function},onPreview:{type:Function},variant:{}},setup(e){let n=e,r=Zu(),i=Xu(),a=zSe(),o=(0,t.computed)(()=>!!n.onPreview||!!r),s=(0,t.computed)(()=>!!n.onDownload||!!r?.canResolveArtifactUrl.value),l=(0,t.computed)(()=>(0,t.cloneVNode)(G_e)),u=(0,t.computed)(()=>(0,t.cloneVNode)(Ul)),d=(0,t.shallowRef)(!1),f=(0,t.computed)(()=>({...i?.value,content:Tl(`下载`),theme:`ai-chat-box`,placement:`top`})),p=(0,t.computed)(()=>({...i?.value,content:Tl(`引用`),theme:`ai-chat-box`,placement:`top`})),m=()=>{n.file.outputId&&a?.insertMention(ad(n.file))},h=()=>{if(n.onPreview){n.onPreview(n.file);return}r?.openPreview({file:n.file})},g=async()=>{if(!d.value){if(n.onDownload){n.onDownload(n.file);return}if(r?.canResolveArtifactUrl.value){d.value=!0;try{let{download_url:e}=await r.resolveArtifactUrls(n.file);e&&CSe(e,n.file.name)}finally{d.value=!1}}}};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-artifact-file-card`,{"is-active":e.active,"is-clickable":o.value,"is-list":e.variant===`list`}]),onClick:h},[(0,t.createCommentVNode)(` 左侧:文件类型图标 + 文件名 `),(0,t.createElementVNode)(`div`,bzt,[(0,t.createVNode)(w9,{class:`ai-artifact-file-card-icon`,"file-name":e.file.name,"file-type":e.file.type},null,8,[`file-name`,`file-type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,xzt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.file.name),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(i),text:e.file.name,placement:`top`}]])]),(0,t.createCommentVNode)(` 右侧操作区:hover 显示,设计稿中引用在下载左侧 `),(0,t.createElementVNode)(`div`,Szt,[(0,t.unref)(a)&&e.file.outputId?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`ai-artifact-file-card-action ai-artifact-file-card-cite`,onClick:(0,t.withModifiers)(m,[`stop`])},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u.value)))])),[[(0,t.unref)(Ju),p.value]]):(0,t.createCommentVNode)(`v-if`,!0),s.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:1,class:(0,t.normalizeClass)([`ai-artifact-file-card-action ai-artifact-file-card-download`,{"is-loading":d.value}]),onClick:(0,t.withModifiers)(g,[`stop`])},[d.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value),{key:1}))],2)),[[(0,t.unref)(Ju),f.value]]):(0,t.createCommentVNode)(`v-if`,!0)])],2))}}),wzt={class:`ai-message-loading-row`},Tzt={class:`ai-message-loading-icon-wrap`},Ezt={key:0,class:`ai-message-loading-text ai-message-loading-text-custom`},Dzt={key:1,"aria-live":`polite`,class:`ai-message-loading-text`},Ozt=(0,t.defineComponent)({name:`MessageLoading`,inheritAttrs:!1,__name:`message-loading`,props:{duration:{default:1.8},gap:{default:8},iconSize:{default:32},stagger:{default:.135},text:{default:`加载中...`}},setup(e){let n=e,r=(0,t.useAttrs)(),i=(0,t.computed)(()=>{let{class:e,style:t,...n}=r;return n}),a=(0,t.computed)(()=>({display:`block`,width:`${n.iconSize}px`,height:`${n.iconSize}px`})),o=(0,t.computed)(()=>[...n.text]),s=(0,t.computed)(()=>{let e=r.style,t={"--ai-message-loading-duration":`${n.duration}s`,"--ai-message-loading-stagger":`${n.stagger}s`,"--ai-message-loading-gap":`${n.gap}px`};return e&&typeof e==`object`&&!Array.isArray(e)?{...t,...e}:t});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,(0,t.mergeProps)({class:[`ai-message-loading`,(0,t.unref)(r).class],style:s.value},i.value),[(0,t.createElementVNode)(`div`,wzt,[(0,t.createElementVNode)(`span`,Tzt,[(0,t.renderSlot)(e.$slots,`icon`,{},()=>[(0,t.createVNode)((0,t.unref)(k_e),{class:`ai-message-loading-icon-svg`,style:(0,t.normalizeStyle)(a.value)},null,8,[`style`])])]),e.$slots.text?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ezt,[(0,t.renderSlot)(e.$slots,`text`)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Dzt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:`${n}-${e}`,class:`ai-message-loading-char`,style:(0,t.normalizeStyle)({"--char-index":n})},(0,t.toDisplayString)(e),5))),128))]))])],16))}}),kzt={class:`ai-artifact-code-preview`},Azt=[`innerHTML`],jzt=3e5,Mzt=(0,t.defineComponent)({__name:`code-preview`,props:{content:{},extension:{}},setup(e){let n={cfg:`ini`,conf:`ini`,dockerignore:`plaintext`,editorconfig:`ini`,env:`ini`,gitignore:`plaintext`,jsonc:`json`,jsx:`javascript`,tsx:`typescript`,vue:`xml`,zsh:`bash`},r=e,i=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),a=e=>n[e]||(Zf.getLanguage(e)?e:`plaintext`),o=(0,t.computed)(()=>{let{content:e}=r;if(!e)return``;let t=a(r.extension);if(t===`plaintext`||e.length>jzt)return i(e);try{return Zf.highlight(e,{language:t,ignoreIllegals:!0}).value}catch{return i(e)}});return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` 高亮结果由 highlight.js 生成,未识别语言时走 escapeHtml 兜底,无注入风险 `),(0,t.createElementVNode)(`pre`,kzt,[(0,t.createElementVNode)(`code`,{class:`hljs`,innerHTML:o.value},null,8,Azt)])],2112))}}),Nzt=[`srcdoc`],Pzt=(0,t.defineComponent)({__name:`html-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`iframe`,{class:`ai-artifact-html-preview`,srcdoc:e.content},null,8,Nzt))}}),Fzt={class:`ai-artifact-image-preview`},Izt=[`alt`,`src`],Lzt=(0,t.defineComponent)({__name:`image-preview`,props:{name:{},url:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Fzt,[(0,t.createElementVNode)(`img`,{alt:e.name,src:e.url},null,8,Izt)]))}}),Rzt={class:`ai-artifact-markdown-preview`},zzt=(0,t.defineComponent)({__name:`markdown-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Rzt,[(0,t.createVNode)(J7,{content:e.content,status:(0,t.unref)(Al).Success},null,8,[`content`,`status`])]))}}),Bzt={class:`ai-artifact-txt-preview`},Vzt=(0,t.defineComponent)({__name:`txt-preview`,props:{content:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`pre`,Bzt,(0,t.toDisplayString)(e.content),1))}}),Hzt=[`src`],Uzt=(0,t.defineComponent)({__name:`url-iframe-preview`,props:{url:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`iframe`,{class:`ai-artifact-url-iframe-preview`,src:e.url},null,8,Hzt))}}),Wzt={binary:{load:`preview_url`,renderer:`urlIframe`},code:{load:`text_from_download`,renderer:`code`},html:{load:`text_from_download`,renderer:`html`},image:{load:`preview_url`,renderer:`image`},markdown:{load:`text_from_download`,renderer:`markdown`},text:{load:`text_from_download`,renderer:`txt`}},Gzt=(e,t)=>Wzt[Fve(e,t)],Kzt=e=>{let n=(0,t.shallowRef)(`idle`),r=(0,t.shallowRef)(``),i=(0,t.shallowRef)(``),a=(0,t.shallowRef)(``),o=(0,t.shallowRef)(`urlIframe`),s,l=0,u=()=>{r.value=``,i.value=``,a.value=``},d=async()=>{let t=++l;s?.abort(),s=void 0;let d=e.getFile();if(!d||!e.canResolve()){n.value=`empty`,u();return}n.value=`loading`,u();let f=Gzt(d.type,d.name);o.value=f.renderer;try{let o=await e.resolveUrls(d);if(t!==l)return;if(f.load===`text_from_download`){if(!o.download_url){n.value=`empty`;return}let e=new AbortController;s=e;let i=await fetch(o.download_url,{signal:e.signal});if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.text();if(e.signal.aborted||t!==l)return;r.value=a,n.value=`ready`;return}if(f.renderer===`image`){if(!o.download_url){n.value=`empty`;return}a.value=o.download_url,n.value=`ready`;return}if(!o.preview_url){n.value=`empty`;return}i.value=o.preview_url,n.value=`ready`}catch{if(t!==l||s?.signal.aborted)return;n.value=`error`}},f=()=>{l+=1,s?.abort()};return(0,t.onBeforeUnmount)(f),{content:r,dispose:f,downloadUrl:a,load:d,previewUrl:i,renderer:o,status:n}},qzt={class:`ai-artifact-preview-host`},Jzt={key:0,class:`ai-artifact-preview-host-loading`},Yzt={key:1,class:`ai-artifact-preview-host-error`},Xzt={key:2,class:`ai-artifact-preview-host-empty`},Zzt=(0,t.defineComponent)({__name:`artifact-preview-host`,props:{file:{}},setup(e,{expose:n}){let r=e,i=Zu(),{content:a,downloadUrl:o,load:s,previewUrl:l,renderer:u,status:d}=Kzt({canResolve:()=>!!i?.canResolveArtifactUrl.value,getFile:()=>r.file,resolveUrls:e=>i?.resolveArtifactUrls(e)??Promise.resolve({})}),f=(0,t.computed)(()=>Ll(r.file?.type,r.file?.name));return(0,t.watch)(()=>r.file?`${r.file.outputId}:${r.file.type}`:``,()=>{s()},{immediate:!0}),n({content:a,renderer:u,status:d}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,qzt,[(0,t.unref)(d)===`loading`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Jzt,[(0,t.createVNode)(Ozt)])):(0,t.unref)(d)===`error`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Yzt,[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`预览加载失败`)),1),(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,text:``,theme:`primary`,onClick:r[0]||=()=>(0,t.unref)(s)()},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`重试`)),1)]),_:1})])):(0,t.unref)(d)===`empty`||!e.file?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Xzt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无可预览的文件`)),1)):(0,t.unref)(u)===`html`?((0,t.openBlock)(),(0,t.createBlock)(Pzt,{key:3,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`code`?((0,t.openBlock)(),(0,t.createBlock)(Mzt,{key:4,content:(0,t.unref)(a),extension:f.value},null,8,[`content`,`extension`])):(0,t.unref)(u)===`txt`?((0,t.openBlock)(),(0,t.createBlock)(Vzt,{key:5,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`markdown`?((0,t.openBlock)(),(0,t.createBlock)(zzt,{key:6,content:(0,t.unref)(a)},null,8,[`content`])):(0,t.unref)(u)===`image`?((0,t.openBlock)(),(0,t.createBlock)(Lzt,{key:7,name:e.file?.name,url:(0,t.unref)(o)},null,8,[`name`,`url`])):((0,t.openBlock)(),(0,t.createBlock)(Uzt,{key:8,url:(0,t.unref)(l)},null,8,[`url`]))]))}}),Qzt={key:0,class:`ai-file-artifact-panel is-empty`},$zt={class:`ai-file-artifact-panel-empty-text`},eBt={key:1,class:`ai-file-artifact-panel`},tBt={class:`ai-file-artifact-panel-list`},nBt={class:`ai-file-artifact-panel-list-title`},rBt={class:`ai-file-artifact-panel-list-scroll`},iBt={key:1,class:`ai-file-artifact-panel-list-empty`},aBt={class:`ai-file-artifact-panel-preview`},oBt={key:0,class:`ai-file-artifact-panel-preview-header`},sBt={class:`ai-file-artifact-panel-preview-header-info`},cBt={class:`ai-file-artifact-panel-preview-header-name`},lBt={class:`ai-file-artifact-panel-preview-header-actions`},uBt={class:`ai-file-artifact-panel-preview-body`},dBt=(0,t.defineComponent)({__name:`file-artifact-panel`,setup(e){let n=new Set([`code`,`html`,`markdown`,`text`]),r=Zu(),i=(0,t.computed)(()=>r?.artifacts.value??[]),a=(0,t.computed)(()=>r?.activeArtifactId.value??``),o=(0,t.computed)(()=>!!r?.canResolveArtifactUrl.value),s=zSe(),{copy:l}=Qu(),u=Xu(),d=(0,t.useTemplateRef)(`previewHostRef`),f=()=>(0,t.cloneVNode)(G_e),p=()=>(0,t.cloneVNode)(Hl),m=()=>(0,t.cloneVNode)(Ul),h=(0,t.shallowRef)(``),g=(0,t.shallowRef)(!1),_=(0,t.computed)(()=>({...u?.value,content:Tl(`复制`),placement:`top`,theme:`ai-chat-box`})),v=(0,t.computed)(()=>({...u?.value,content:Tl(`下载`),placement:`top`,theme:`ai-chat-box`})),y=(0,t.computed)(()=>({...u?.value,content:Tl(`引用`),placement:`top`,theme:`ai-chat-box`})),b=e=>{e.outputId&&s?.insertMention(ad(e))},x=(0,t.computed)(()=>{let e=h.value.trim().toLowerCase();return e?i.value.filter(t=>t.name.toLowerCase().includes(e)):i.value}),S=(0,t.computed)(()=>i.value.find(e=>e.outputId===a.value)),C=(0,t.computed)(()=>{let e=S.value;return e?n.has(Fve(e.type,e.name)):!1}),w=(0,t.computed)(()=>{let e=d.value;return!!e&&e.status===`ready`&&!!e.content}),T=e=>{e.outputId!==a.value&&r?.setActiveArtifactId(e.outputId)},E=()=>{if(!w.value)return;let e=d.value?.content;e&&l(e)},D=async e=>{if(!(g.value||!r?.canResolveArtifactUrl.value)){g.value=!0;try{let{download_url:t}=await r.resolveArtifactUrls(e);t&&CSe(t,e.name)}finally{g.value=!1}}};return(0,t.watch)(()=>S.value?.outputId,()=>{g.value=!1}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` 无产物:整块空态,不展示文件列表与预览区 `),i.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,eBt,[(0,t.createCommentVNode)(` 左侧:文件列表 + 搜索 `),(0,t.createElementVNode)(`div`,tBt,[(0,t.createElementVNode)(`p`,nBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`文件列表`))+`(`+(0,t.toDisplayString)(i.value.length)+`)`,1),(0,t.createVNode)((0,t.unref)(is),{modelValue:h.value,"onUpdate:modelValue":n[0]||=e=>h.value=e,class:`ai-file-artifact-panel-list-search`,clearable:``,placeholder:(0,t.unref)(Tl)(`搜索文件关键字`)},null,8,[`modelValue`,`placeholder`]),(0,t.createElementVNode)(`div`,rBt,[x.value.length?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(x.value,e=>((0,t.openBlock)(),(0,t.createBlock)(Czt,{key:e.outputId,active:e.outputId===a.value,file:e,"on-preview":()=>T(e),variant:`list`},null,8,[`active`,`file`,`on-preview`]))),128)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,iBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`搜索结果为空`)),1))])]),(0,t.createCommentVNode)(` 右侧:预览区 `),(0,t.createElementVNode)(`div`,aBt,[S.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,oBt,[(0,t.createElementVNode)(`div`,sBt,[(0,t.createVNode)(w9,{class:`ai-file-artifact-panel-preview-header-icon`,"file-name":S.value.name,"file-type":S.value.type},null,8,[`file-name`,`file-type`]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,cBt,[(0,t.createTextVNode)((0,t.toDisplayString)(S.value.name),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(u),text:S.value.name,placement:`top`}]])]),(0,t.createElementVNode)(`div`,lBt,[C.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ai-file-artifact-panel-preview-header-action`,{"is-disabled":!w.value}]),onClick:E},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(p())))],2)),[[(0,t.unref)(Ju),_.value]]):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 设计稿:引用位于下载左侧,点击后该文件以标签形式进入输入框 `),(0,t.unref)(s)&&S.value.outputId?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`ai-file-artifact-panel-preview-header-action`,onClick:n[1]||=e=>b(S.value)},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(m())))])),[[(0,t.unref)(Ju),y.value]]):(0,t.createCommentVNode)(`v-if`,!0),o.value?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`ai-file-artifact-panel-preview-header-action`,{"is-loading":g.value}]),onClick:n[2]||=e=>D(S.value)},[g.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(f()),{key:1}))],2)),[[(0,t.unref)(Ju),v.value]]):(0,t.createCommentVNode)(`v-if`,!0)])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,uBt,[(0,t.createVNode)(Zzt,{ref_key:`previewHostRef`,ref:d,file:S.value},null,8,[`file`])])])])):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qzt,[(0,t.createVNode)((0,t.unref)(hc),{class:`ai-file-artifact-panel-empty-exception`,scene:`part`,type:`empty`}),(0,t.createElementVNode)(`div`,$zt,(0,t.toDisplayString)((0,t.unref)(Tl)(`暂无数据`)),1)]))],2112))}}),D9=`others`,fBt=e=>e<26?String.fromCharCode(65+e):String(e+1),pBt=e=>{let n=(0,t.computed)(()=>e()?.metadata?.questions??[]),r=(0,t.shallowRef)({}),i=(0,t.shallowRef)(0),a=(0,t.computed)(()=>n.value.length),o=(0,t.computed)(()=>n.value.reduce((e,t,n)=>e+ +!!r.value[n],0)),s=(0,t.computed)(()=>a.value>0&&o.value===a.value),l=(0,t.computed)(()=>i.value>0),u=(0,t.computed)(()=>i.value<a.value-1),d=e=>r.value[e],f=()=>{l.value&&--i.value},p=()=>{u.value&&(i.value+=1)},m=(e,t,r)=>{t||e===i.value&&n.value[e]?.multiSelect!==!0&&(r.answer.some(e=>e.label===`others`)||u.value&&(i.value+=1))},h=(e,t)=>{let n=r.value[e];r.value={...r.value,[e]:t},t&&m(e,n,t)},g=()=>n.value.map((e,t)=>r.value[t]??{question:e.question,answer:[]});return{questions:n,answeredCount:o,totalCount:a,completed:s,currentIndex:i,canGoPrev:l,canGoNext:u,goPrev:f,goNext:p,getAnswer:d,setAnswer:h,buildResolvePayload:()=>({interruptId:e()?.id??``,reason:Dl.UserQuestion,status:`resolved`,payload:{answers:g()}}),buildSkipPayload:()=>mBt(e())}},mBt=e=>({interruptId:e?.id??``,reason:Dl.UserQuestion,status:`cancelled`,payload:{answers:[]}}),hBt={class:`ai-user-question-answered`},gBt={class:`ai-user-question-answered__header`},_Bt={class:`ai-user-question-answered__title-wrap`},vBt={class:`ai-user-question-answered__title`},yBt={class:`ai-user-question-answered__status`},bBt={class:`ai-user-question-answered__body`},xBt={class:`ai-user-question-answered__question`},SBt={class:`ai-user-question-answered__question-text`},CBt={key:0,class:`ai-user-question-answered__tag`},wBt=(0,t.defineComponent)({__name:`user-question-answered-card`,props:{answers:{},status:{default:`resolved`}},setup(e){let n=e,r=(0,t.computed)(()=>n.status===`cancelled`?Tl(`已取消`):Tl(`已回复`));return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,hBt,[(0,t.createElementVNode)(`header`,gBt,[(0,t.createElementVNode)(`div`,_Bt,[(0,t.createVNode)((0,t.unref)(iye),{class:`ai-user-question-answered__help-icon`}),(0,t.createElementVNode)(`span`,vBt,(0,t.toDisplayString)((0,t.unref)(Tl)(`回答内容`)),1)]),(0,t.createElementVNode)(`span`,yBt,(0,t.toDisplayString)(r.value),1)]),(0,t.createElementVNode)(`div`,bBt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.answers,(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:i,class:`ai-user-question-answered__item`},[(0,t.createElementVNode)(`div`,xBt,[(0,t.createElementVNode)(`span`,SBt,(0,t.toDisplayString)(i+1)+`. `+(0,t.toDisplayString)(r.question),1),r.multiSelect===void 0?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,CBt,(0,t.toDisplayString)(r.multiSelect?(0,t.unref)(Tl)(`多选`):(0,t.unref)(Tl)(`单选`)),1))]),(0,t.createCommentVNode)(` 默认逐条回显选择题答案;业务方可覆盖此 slot 渲染自定义表单的回显 `),(0,t.renderSlot)(n.$slots,`answer`,(0,t.mergeProps)({ref_for:!0},{item:r,index:i,status:e.status}),()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.answer,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:n,class:`ai-user-question-answered__answer`},(0,t.toDisplayString)(e.description||e.label),1))),128))])]))),128))])]))}}),TBt={class:`ai-user-question-option__badge`},EBt=[`placeholder`,`value`],DBt={key:1,class:`ai-user-question-option__text`},OBt=(0,t.defineComponent)({__name:`user-question-option`,props:{option:{},othersText:{},selected:{type:Boolean}},emits:[`confirm`,`select`,`update:othersText`],setup(e,{emit:n}){let r=e,i=n,a=()=>{i(`select`)},o=()=>{r.selected||i(`select`)},s=e=>{let t=e.target.value;i(`update:othersText`,t),r.selected||i(`select`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-user-question-option`,{"ai-user-question-option--selected":e.selected,"ai-user-question-option--others":e.option.isOthers}]),onClick:a},[(0,t.createElementVNode)(`span`,TBt,(0,t.toDisplayString)(e.option.letter),1),(0,t.createCommentVNode)(` Others:自定义输入 `),e.option.isOthers?((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{key:0,class:`ai-user-question-option__input`,placeholder:(0,t.unref)(Tl)(`请输入...`),value:e.othersText,onClick:r[0]||=(0,t.withModifiers)(()=>{},[`stop`]),onFocus:o,onInput:s,onKeydown:r[1]||=(0,t.withKeys)((0,t.withModifiers)(e=>i(`confirm`),[`stop`]),[`enter`])},null,40,EBt)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,DBt,(0,t.toDisplayString)(e.option.description),1))],2))}}),kBt={class:`ai-user-question-choice`},ABt=(0,t.defineComponent)({__name:`user-question-choice`,props:{question:{}},emits:[`answer`,`confirm`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.shallowRef)([]),o=(0,t.shallowRef)(``),s=(0,t.computed)(()=>{let e=(r.question.options??[]).filter(e=>e.label!==D9).map((e,t)=>({...e,isOthers:!1,letter:fBt(t)}));return e.push({label:D9,description:``,isOthers:!0,letter:fBt(e.length)}),e}),l=(0,t.computed)(()=>s.value.findIndex(e=>e.isOthers)),u=e=>a.value.includes(e),d=(0,t.computed)(()=>a.value.length?l.value>=0&&a.value.includes(l.value)?o.value.trim().length>0:!0:!1),f=()=>({question:r.question.question,multiSelect:r.question.multiSelect,answer:a.value.map(e=>{let t=s.value[e];return t?.isOthers?{label:D9,description:o.value.trim()}:{label:t?.label??``,description:t?.description??``}})}),p=()=>i(`answer`,d.value?f():void 0),m=e=>{let t=a.value;a.value=r.question.multiSelect?t.includes(e)?t.filter(t=>t!==e):[...t,e]:[e],p()},h=e=>{o.value=e,p()};return(0,t.watch)(()=>r.question,()=>{a.value=[],o.value=``,p()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,kBt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(OBt,{key:r,option:e,"others-text":o.value,selected:u(r),onConfirm:n[0]||=e=>i(`confirm`),onSelect:e=>m(r),"onUpdate:othersText":h},null,8,[`option`,`others-text`,`selected`,`onSelect`]))),128))]))}}),jBt={class:`ai-user-question-card__title-wrap`},MBt={class:`ai-user-question-card__title`},NBt={class:`ai-user-question-card__header-actions`},PBt={class:`ai-user-question-card__pager`},FBt=[`disabled`],IBt={class:`ai-user-question-card__pager-text`},LBt=[`disabled`],RBt={class:`ai-user-question-card__body`},zBt={class:`ai-user-question-card__question-title`},BBt={class:`ai-user-question-card__question-text`},VBt={key:0,class:`ai-user-question-card__tag`},HBt={class:`ai-user-question-card__options`},UBt={class:`ai-user-question-card__footer`},WBt={class:`ai-user-question-card__progress`},GBt={class:`ai-user-question-card__progress-num`},KBt={class:`ai-user-question-card__actions`},qBt=(0,t.defineComponent)({__name:`user-question-card`,props:{interrupt:{},onResume:{type:Function}},setup(e){let n=e,r=Xu(),i=(0,t.shallowRef)(!1),{questions:a,answeredCount:o,totalCount:s,completed:l,currentIndex:u,canGoPrev:d,canGoNext:f,goPrev:p,goNext:m,getAnswer:h,setAnswer:g,buildResolvePayload:_,buildSkipPayload:v}=pBt(()=>n.interrupt),y=(0,t.computed)(()=>n.interrupt.metadata?.questions?.[0]?.header||n.interrupt.message||``),b=()=>{i.value=!i.value},x=()=>{i.value&&=!1},S=(0,t.shallowRef)(null),C=()=>{!l.value||S.value!==null||(S.value=`complete`,n.onResume?.(_(),n.interrupt))},w=()=>{S.value===null&&(S.value=`skip`,n.onResume?.(v(),n.interrupt))};return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{class:(0,t.normalizeClass)([`ai-user-question-card`,{"ai-user-question-card--collapsed":i.value}])},[(0,t.createElementVNode)(`header`,{class:`ai-user-question-card__header`,onClick:x},[(0,t.createElementVNode)(`div`,jBt,[(0,t.createVNode)((0,t.unref)(iye),{class:`ai-user-question-card__help-icon`}),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,MBt,[(0,t.createTextVNode)((0,t.toDisplayString)(y.value),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]])]),(0,t.createElementVNode)(`div`,NBt,[(0,t.createElementVNode)(`div`,PBt,[(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`ai-user-question-card__nav-btn`,{"is-disabled":!(0,t.unref)(d)}]),disabled:!(0,t.unref)(d),type:`button`,onClick:n[0]||=(0,t.withModifiers)((...e)=>(0,t.unref)(p)&&(0,t.unref)(p)(...e),[`stop`])},[(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-user-question-card__nav-icon`})],10,FBt),(0,t.createElementVNode)(`span`,IBt,(0,t.toDisplayString)((0,t.unref)(u)+1)+` / `+(0,t.toDisplayString)((0,t.unref)(s)),1),(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`ai-user-question-card__nav-btn`,{"is-disabled":!(0,t.unref)(f)}]),disabled:!(0,t.unref)(f),type:`button`,onClick:n[1]||=(0,t.withModifiers)((...e)=>(0,t.unref)(m)&&(0,t.unref)(m)(...e),[`stop`])},[(0,t.createVNode)((0,t.unref)(Gve),{class:`ai-user-question-card__nav-icon`})],10,LBt)]),n[2]||=(0,t.createElementVNode)(`span`,{class:`ai-user-question-card__divider`},null,-1),(0,t.createElementVNode)(`button`,{class:`ai-user-question-card__collapse-btn`,type:`button`,onClick:(0,t.withModifiers)(b,[`stop`])},[(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-user-question-card__arrow`,style:(0,t.normalizeStyle)({transform:i.value?`rotate(180deg)`:`rotate(-90deg)`})},null,8,[`style`])])])]),(0,t.createCommentVNode)(` 折叠用 v-show 而非 v-if:保留 UserQuestionChoice 及自定义 slot 的勾选态,避免卸载丢失选中 `),(0,t.withDirectives)((0,t.createElementVNode)(`div`,RBt,[(0,t.createCommentVNode)(` 一次只展示一题;全部题目仍挂载以保留勾选 / Others 输入态 `),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(a),(n,r)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:r,class:`ai-user-question-card__question`},[(0,t.createElementVNode)(`div`,zBt,[(0,t.createElementVNode)(`span`,BBt,(0,t.toDisplayString)(r+1)+`. `+(0,t.toDisplayString)(n.question),1),n.multiSelect===void 0?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,VBt,(0,t.toDisplayString)(n.multiSelect?(0,t.unref)(Tl)(`多选`):(0,t.unref)(Tl)(`单选`)),1))]),(0,t.createElementVNode)(`div`,HBt,[(0,t.createCommentVNode)(` 默认渲染选择题;业务方可覆盖此 slot 渲染任意表单,作答有效时通过 setAnswer 回传 `),(0,t.renderSlot)(e.$slots,`question`,(0,t.mergeProps)({ref_for:!0},{question:n,qIndex:r,answer:(0,t.unref)(h)(r),setAnswer:e=>(0,t.unref)(g)(r,e),confirm:C}),()=>[(0,t.createVNode)(ABt,{question:n,onAnswer:e=>(0,t.unref)(g)(r,e),onConfirm:C},null,8,[`question`,`onAnswer`])])])])),[[t.vShow,r===(0,t.unref)(u)]])),128))],512),[[t.vShow,!i.value]]),(0,t.withDirectives)((0,t.createElementVNode)(`footer`,UBt,[(0,t.createElementVNode)(`span`,WBt,[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`已完成`))+` `,1),(0,t.createElementVNode)(`span`,GBt,(0,t.toDisplayString)((0,t.unref)(o)),1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`题`)),1)]),(0,t.createElementVNode)(`div`,KBt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-user-question-card__skip`,disabled:S.value===`complete`,loading:S.value===`skip`,size:`small`,text:``,onClick:w},{default:(0,t.withCtx)(()=>[S.value===`skip`?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(sye),{key:0,class:`ai-user-question-card__skip-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`跳过`)),1)]),_:1},8,[`disabled`,`loading`]),(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-user-question-card__complete`,disabled:!(0,t.unref)(l)||S.value===`skip`,loading:S.value===`complete`,size:`small`,theme:`primary`,onClick:C},{default:(0,t.withCtx)(()=>[S.value===`complete`?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(oye),{key:0,class:`ai-user-question-card__enter-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`完成`)),1)]),_:1},8,[`disabled`,`loading`])])],512),[[t.vShow,!i.value]])],2))}}),JBt=864e5,YBt={day:`numeric`,hour:`2-digit`,hourCycle:`h23`,minute:`2-digit`,month:`numeric`,year:`numeric`},XBt=new Map,ZBt=e=>{let t=e??``,n=XBt.get(t);if(n)return n;let r;try{r=new Intl.DateTimeFormat(`en-US`,{...YBt,timeZone:e})}catch{r=new Intl.DateTimeFormat(`en-US`,YBt)}return XBt.set(t,r),r},QBt=(e,t)=>{let n=e.formatToParts(t),r=e=>Number(n.find(t=>t.type===e)?.value);return{day:r(`day`),hour:r(`hour`),minute:r(`minute`),month:r(`month`),year:r(`year`)}},$Bt=e=>Date.UTC(e.year,e.month-1,e.day),eVt=e=>String(e).padStart(2,`0`),tVt=(e,t)=>{if(e==null||e===``)return``;let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=ZBt(t),i=QBt(r,n),a=QBt(r,Date.now()),o=`${eVt(i.hour)}:${eVt(i.minute)}`,s=Math.round(($Bt(a)-$Bt(i))/JBt);if(s===0)return o;if(s===1)return`${Tl(`昨天`)} ${o}`;let l=`${i.month}-${i.day} ${o}`;return i.year===a.year?l:`${i.year}-${l}`},nVt={key:0,class:`ai-message-time`},rVt=(0,t.defineComponent)({__name:`message-time`,props:{createdAt:{},timezone:{}},setup(e){let n=e,r=ISe(),i=(0,t.computed)(()=>n.timezone??r?.timezone?.value),a=(0,t.computed)(()=>tVt(n.createdAt,i.value));return(e,n)=>a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nVt,(0,t.toDisplayString)(a.value),1)):(0,t.createCommentVNode)(`v-if`,!0)}}),iVt={class:`ai-delete-confirm`},aVt={class:`ai-delete-confirm__title`},oVt={class:`ai-delete-confirm__desc`},sVt={class:`ai-delete-confirm__actions`},cVt=(0,t.defineComponent)({__name:`delete-tool`,props:{description:{},hidden:{type:Boolean},icon:{},id:{},name:{},triggerSelection:{type:Boolean},disabled:{type:Boolean},tippyOptions:{}},emits:[`confirm`,`cancel`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`tippyRef`),o=(0,t.computed)(()=>({id:r.id,name:r.name,description:r.description,disabled:r.disabled,tippyOptions:r.tippyOptions})),s=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],theme:`ai-chat-box-light light`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),l=()=>{if(r.disabled)return!1},u=()=>{a.value?.hide?.()},d=()=>{u(),i(`confirm`)},f=()=>{u(),i(`cancel`)};return(0,t.onUnmounted)(()=>{u()}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({ref_key:`tippyRef`,ref:a},s.value,{onShow:l}),{content:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,iVt,[(0,t.createElementVNode)(`div`,aVt,(0,t.toDisplayString)((0,t.unref)(Tl)(`确认删除该回答?`)),1),(0,t.createElementVNode)(`div`,oVt,(0,t.toDisplayString)((0,t.unref)(Tl)(`删除操作无法撤回,请谨慎操作!`)),1),(0,t.createElementVNode)(`div`,sVt,[(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,theme:`danger`,onClick:d},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`删除`)),1)]),_:1}),(0,t.createVNode)((0,t.unref)(Ko),{size:`small`,onClick:f},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消`)),1)]),_:1})])])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(ud,(0,t.normalizeProps)((0,t.guardReactiveProps)(o.value)),null,16)]),_:1},16))}}),lVt={class:`ai-feedback-title`},uVt={class:`ai-feedback-reason-list`},dVt=[`onClick`],fVt={class:`ai-feedback-other`},pVt={class:`ai-feedback-footer`},mVt=(0,t.defineComponent)({__name:`user-feedback`,props:{loading:{type:Boolean},reasonList:{},title:{}},emits:[`submit`,`cancel`],setup(e,{emit:n}){let r=n,i=(0,t.shallowRef)(``),a=(0,t.shallowRef)([]),o=e=>{a.value.includes(e)?a.value=a.value.filter(t=>t!==e):a.value=[...a.value,e]},s=()=>{r(`submit`,a.value,i.value)},l=()=>{a.value=[],i.value=``,r(`cancel`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`ai-user-feedback`,onMouseenter:r[1]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`])},[(0,t.createElementVNode)(`div`,lVt,(0,t.toDisplayString)(e.title),1),(0,t.createElementVNode)(`div`,uVt,[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(8,e=>(0,t.createElementVNode)(`div`,{key:e,class:`reason-item ai-skeleton-element`})),64)):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(e.reasonList,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e,class:(0,t.normalizeClass)([`reason-item`,{"is-active":a.value.includes(e)}]),onClick:t=>o(e)},(0,t.toDisplayString)(e),11,dVt))),128))]),(0,t.createElementVNode)(`div`,fVt,[(0,t.createVNode)((0,t.unref)(is),{modelValue:i.value,"onUpdate:modelValue":r[0]||=e=>i.value=e,placeholder:(0,t.unref)(Tl)(`说出您的想法`),rows:3,type:`textarea`},null,8,[`modelValue`,`placeholder`])]),(0,t.createElementVNode)(`div`,pVt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`custom-btn`,disabled:!i.value&&a.value.length===0,size:`small`,theme:`primary`,onClick:s},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`提交`)),1)]),_:1},8,[`disabled`]),(0,t.createVNode)((0,t.unref)(Ko),{class:`custom-btn`,size:`small`,width:`80px`,onClick:l},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消`)),1)]),_:1})])],32))}}),hVt={ref:`messageToolsRef`,class:`ai-message-tools-container`},gVt={key:0,class:`ai-message-tools-prepend`},_Vt={class:`message-tools`},vVt={key:1,class:`ai-divider`,style:{"margin-right":`4px`,"margin-left":`4px`}},yVt={key:2,class:`message-tools`},bVt={key:3,class:`ai-message-tools-append`},xVt=(0,t.defineComponent)({__name:`message-tools`,props:{messageTools:{default:()=>b_e},messageToolsStatus:{},onAction:{},tippyOptions:{},updateTools:{default:()=>S_e}},emits:[`feedback`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useTemplateRef)(`feedbackTippyRef`),o=(0,t.shallowRef)(!1),s=(0,t.shallowRef)([]),l=(0,t.shallowRef)(null),u=(0,t.computed)(()=>({arrow:!1,interactive:!0,offset:[0,6],theme:`ai-chat-box-light light`,trigger:`click`,appendTo:()=>document.body,...r.tippyOptions||{}})),d=async e=>{if(e.id===`like`||e.id===`unlike`){try{o.value=!0,s.value=[],s.value=await r.onAction?.(e)||[]}finally{o.value=!1}return}await r.onAction?.(e)},f=async e=>{await r.onAction?.(e)},p=()=>{a.value?.forEach(e=>e?.hide?.())},m=e=>l.value?l.value===`like`&&e===`like`?`activeLike`:l.value===`unlike`&&e===`unlike`?`activeUnLike`:e:e,h=e=>{let t=m(e);return t===`activeLike`?Tl(`取消满意`):t===`activeUnLike`?Tl(`取消不满意`):r.updateTools?.find(e=>e.id===t)?.description||``},g=(e,t,n)=>{p(),l.value===e.id?l.value=null:l.value=e.id,i(`feedback`,e,t,n)},_=e=>{if(r.messageToolsStatus===C9.Disabled)return!1;if(l.value&&l.value===e)return l.value=null,!1};return(0,t.onUnmounted)(()=>{p(),s.value=[]}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,hVt,[n.$slots.prepend?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gVt,[(0,t.renderSlot)(n.$slots,`prepend`)])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,_Vt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.messageTools,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.id},[n.id===`delete`?((0,t.openBlock)(),(0,t.createBlock)(cVt,(0,t.mergeProps)({key:0,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onConfirm:e=>f(n)}),null,16,[`disabled`,`tippy-options`,`onConfirm`])):((0,t.openBlock)(),(0,t.createBlock)(ud,(0,t.mergeProps)({key:1,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onClick:e=>d(n)}),null,16,[`disabled`,`tippy-options`,`onClick`]))],64))),128))]),e.updateTools.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vVt)):(0,t.createCommentVNode)(`v-if`,!0),e.updateTools.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,yVt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.updateTools,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.id},[n.id===`like`||n.id===`unlike`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ku),(0,t.mergeProps)({key:0,ref_for:!0,ref_key:`feedbackTippyRef`,ref:a},{ref_for:!0},u.value,{onShow:e=>_(n.id)}),{content:(0,t.withCtx)(()=>[(0,t.createVNode)(mVt,{loading:o.value,"reason-list":s.value,title:n.id===`like`?(0,t.unref)(Tl)(`什么原因让你满意?`):(0,t.unref)(Tl)(`什么原因让你不满意?`),onCancel:p,onSubmit:(e,t)=>g(n,e,t)},null,8,[`loading`,`reason-list`,`title`,`onSubmit`])]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(ud,(0,t.mergeProps)({ref_for:!0},n,{id:m(n.id),active:l.value===n.id,disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":{...e.tippyOptions,content:h(n.id)},onClick:e=>d(n)}),null,16,[`id`,`active`,`disabled`,`tippy-options`,`onClick`])]),_:2},1040,[`onShow`])):n.id===`delete`?((0,t.openBlock)(),(0,t.createBlock)(cVt,(0,t.mergeProps)({key:1,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onConfirm:e=>f(n)}),null,16,[`disabled`,`tippy-options`,`onConfirm`])):((0,t.openBlock)(),(0,t.createBlock)(ud,(0,t.mergeProps)({key:2,ref_for:!0},n,{disabled:e.messageToolsStatus===(0,t.unref)(C9).Disabled,"tippy-options":e.tippyOptions,onClick:e=>d(n)}),null,16,[`disabled`,`tippy-options`,`onClick`]))],64))),128))])):(0,t.createCommentVNode)(`v-if`,!0),n.$slots.append?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,bVt,[(0,t.renderSlot)(n.$slots,`append`)])):(0,t.createCommentVNode)(`v-if`,!0)],512))}}),SVt=e=>{if(e===void 0||e===``)return;let t=new Date(e).getTime();return Number.isNaN(t)?void 0:t},CVt=e=>{let t;for(let n of e){let e=SVt(n.createdAt);e!==void 0&&(t===void 0||e>t)&&(t=e)}return t},wVt=(e,t)=>{if(!(e===void 0||t===void 0))return Math.max(0,t-e)},TVt=e=>e<=0?``:e<1e3?`<1s`:Sl(Math.floor(e/1e3)*1e3),EVt=(0,t.defineComponent)({__name:`message-process-header`,props:{collapsible:{type:Boolean,default:!1},endAt:{},expanded:{type:Boolean,default:!1},label:{},loading:{type:Boolean,default:!1},startAt:{}},emits:[`toggle`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>{let e=wVt(r.startAt,r.endAt);return e===void 0?``:TVt(e)}),o=()=>{r.collapsible&&i(`toggle`)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-message-process-header`,{"is-collapsible":e.collapsible}]),onClick:o},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-message-process-header-text`,{"is-loading":e.loading}])},[(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1),a.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`,`+(0,t.toDisplayString)((0,t.unref)(Tl)(`耗时`))+` `+(0,t.toDisplayString)(a.value),1)],64)):(0,t.createCommentVNode)(`v-if`,!0)],2),e.collapsible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(U_e),{key:0,class:(0,t.normalizeClass)({"is-expanded":e.expanded})},null,8,[`class`])):(0,t.createCommentVNode)(`v-if`,!0)],2))}}),DVt=new Set([Al.Streaming,Al.StopLoading,Al.Fetching,Al.Pending]),OVt=e=>e!==void 0&&DVt.has(e),kVt=(e,t)=>{if(t)return`处理中`;switch(e.at(-1)?.status){case Al.Error:return`失败`;case Al.Stop:return`已停止`;case Al.Disabled:return`已禁用`;default:return`已完成`}},AVt=e=>e.type===kl.Assistant&&e.messages.length>0,jVt=(e,t)=>{if(t)return 0;for(let t=e.length-1;t>=0;t--)if(e[t].role===kl.Assistant)return t;return 0},MVt=(0,t.defineComponent)({__name:`message-process-list`,props:{enabled:{type:Boolean,default:!1},generating:{type:Boolean,default:!1},messages:{},requestCreatedAt:{}},setup(e){let n=e,r=(0,t.shallowRef)(!1),i=(0,t.computed)(()=>jVt(n.messages,n.generating)),a=(0,t.computed)(()=>i.value>0),o=(0,t.computed)(()=>Tl(kVt(n.messages,n.generating))),s=(0,t.computed)(()=>n.generating?{startAt:void 0,endAt:void 0}:{startAt:SVt(n.requestCreatedAt),endAt:CVt(n.messages)}),l=(0,t.computed)(()=>!n.enabled||!a.value||r.value?n.messages:n.messages.slice(i.value));(0,t.watch)(a,e=>{e&&(r.value=!1)});let u=()=>{a.value&&(r.value=!r.value)};return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`ai-message-process`,{"is-enabled":e.enabled}])},[e.enabled?((0,t.openBlock)(),(0,t.createBlock)(EVt,{key:0,collapsible:a.value,"end-at":s.value.endAt,expanded:a.value&&r.value,label:o.value,loading:e.generating,"start-at":s.value.startAt,onToggle:u},null,8,[`collapsible`,`end-at`,`expanded`,`label`,`loading`,`start-at`])):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(l.value,e=>(0,t.renderSlot)(n.$slots,`message`,{key:e.uid||e.id,message:e})),128))],2))}}),NVt={class:`ai-activity-message`},PVt={class:`ai-activity-message-content`},O9=(0,t.defineComponent)({__name:`activity-layout`,props:(0,t.mergeModels)({activityType:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=(0,t.useModel)(e,`collapsed`);return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,NVt,[(0,t.createElementVNode)(`div`,{class:`ai-activity-message-title`,onClick:i[0]||=e=>n.value=!n.value},[(0,t.renderSlot)(r.$slots,`title`,(0,t.normalizeProps)((0,t.guardReactiveProps)({collapsed:n.value}))),e.activityType===(0,t.unref)(Ol).FlowAgent?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:(0,t.normalizeClass)([`ai-activity-message-title-icon collapsed-icon`,{"is-collapsed":n.value}])},[(0,t.createVNode)((0,t.unref)(Bl))],2))]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,PVt,[(0,t.renderSlot)(r.$slots,`default`)],512),[[t.vShow,!n.value]])]))}}),k9=[{color:`#3A84FF`,icon:null,key:`running`,label:Tl(`执行中`),rawStates:[`CREATED`,`LOOP_READY`,`READY`,`RUNNING`,`BLOCKED`,`ROLLING_BACK`,`ROLL_BACK_SUCCESS`]},{color:`#65C389`,icon:I_e,key:`success`,label:Tl(`成功`),rawStates:[`FINISHED`]},{color:`#EA3636`,icon:L_e,key:`failed`,label:Tl(`失败`),rawStates:[`FAILED`,`ROLL_BACK_FAILED`]},{color:`#F59500`,icon:z_e,key:`suspended`,label:Tl(`挂起`),rawStates:[`SUSPENDED`]},{color:`#F55B0E`,dotFill:`#FEE8DD`,flowHeader:!0,icon:R_e,key:`terminated`,label:Tl(`已终止`),rawStates:[`REVOKED`]},{color:`#4D4F56`,dotColor:`#DCDEE5`,icon:B_e,key:`pending`,label:Tl(`待执行`),rawStates:[`PENDING`]},{color:`#5B7290`,icon:V_e,key:`skipped`,label:Tl(`跳过`),rawStates:[`SKIPPED`]}],A9=Object.fromEntries(k9.map(e=>[e.key,e])),FVt=Object.fromEntries(k9.flatMap(e=>e.rawStates.map(t=>[t,e.key]))),j9=e=>FVt[e]??`running`,IVt=e=>{for(let t of e){let e=A9[j9(t)];if(e.flowHeader)return e}},LVt=e=>e.showInStats!==!1,RVt=e=>A9[e].dotColor??A9[e].color,zVt=e=>A9[e].dotFill,BVt=e=>{let n=(0,t.cloneVNode)(e);return n.el=null,n.anchor=null,Array.isArray(e.children)&&(n.children=e.children.map(e=>(0,t.isVNode)(e)?BVt(e):e)),n},VVt=e=>{let t=A9[e].icon;return t?BVt(t):null},HVt=e=>{let n=(0,t.computed)(()=>Array.isArray(e.value)?e.value:[e.value??{}]),r=(0,t.shallowRef)({}),i=e=>r.value[e.task_id]!==!1,a=e=>{r.value={...r.value,[e.task_id]:!i(e)}},o=(0,t.computed)(()=>n.value.map(e=>{let t=Object.values(e.nodes??{}).map(e=>{let t=j9(e.state);return{convergedState:t,dotColor:RVt(t),dotFill:zVt(t),elapsedTimeText:p_e(e.elapsed_time),id:e.id,name:e.name,raw:e,retryable:!!e.retryable,skippable:!!e.skippable}}),n=t.reduce((e,t)=>e+t.raw.elapsed_time,0),r=j9(e.task_state??``);return{convergedState:r,hasConfidence:!!e.has_confidence,confidenceTitle:e.confidence_title,isActive:!!e.is_active,nodes:t,raw:e,stateIcon:VVt(r),taskId:e.task_id,taskName:e.task_name,totalTimeText:p_e(n)}})),s=(0,t.computed)(()=>{let e={};for(let t of k9)e[t.key]=0;for(let t of n.value)for(let[n,r]of Object.entries(t.statistics?.state_counts??{}))e[j9(n)]+=r;return k9.filter(t=>LVt(t)&&e[t.key]>0).map(t=>({color:t.color,display:e[t.key]>99?`99+`:String(e[t.key]),dotColor:RVt(t.key),dotFill:zVt(t.key),key:t.key,label:t.label}))});return{flowHeaderDef:(0,t.computed)(()=>IVt(n.value.map(e=>e.task_state??``))),isTaskExpanded:i,taskList:n,toggleTaskExpanded:a,viewTasks:o,visibleStats:s}},UVt=[{blockedTip:()=>Tl(`任务正在跳过中,不可重试`),icon:Wl,id:jl.FlowNodeRetry,label:()=>Tl(`重试`),pendingLabel:()=>Tl(`重试中`),visible:e=>e.convergedState===`failed`&&e.retryable},{blockedTip:()=>Tl(`任务正在重试中,不可跳过`),icon:sye,id:jl.FlowNodeSkip,label:()=>Tl(`跳过`),pendingLabel:()=>Tl(`跳过中`),visible:e=>e.convergedState===`failed`&&e.skippable}],M9=(e,t)=>`${e.task_id}:${t.id}:${t.retry}`,WVt=e=>{let{hideResumeActions:n,onInterruptResume:r,openNodeDetail:i}=e,a=(0,t.shallowRef)({}),o=(e,t,n)=>{let i=M9(t,n);a.value[i]||(a.value={...a.value,[i]:e},r.value?.({payload:{node_id:n.id,task_id:t.task_id},operation:e}))};return{getNodeActions:(e,t)=>{let r=a.value[M9(e.raw,t.raw)],s=(n?.value?[]:UVt).filter(e=>e.visible(t)).map(n=>{let i=r===n.id,a=r!==void 0&&!i;return{disabled:r!==void 0,icon:n.icon,id:n.id,label:i?n.pendingLabel():n.label(),loading:i,run:()=>o(n.id,e.raw,t.raw),tooltip:a?n.blockedTip():void 0}});return s.push({disabled:!1,icon:Fl,id:`detail`,label:Tl(`详情`),loading:!1,run:()=>i(e.raw,t.raw)}),s},isNodePending:(e,t)=>a.value[M9(e.raw,t.raw)]!==void 0}},GVt={class:`ai-detail-section`},KVt={class:`section-heading`},qVt={class:`section-text`},N9=(0,t.defineComponent)({__name:`detail-section`,props:{title:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,GVt,[(0,t.createElementVNode)(`div`,KVt,[r[0]||=(0,t.createElementVNode)(`span`,{class:`section-bar`},null,-1),(0,t.createElementVNode)(`span`,qVt,(0,t.toDisplayString)(e.title),1)]),(0,t.renderSlot)(n.$slots,`default`)]))}}),JVt={class:`ai-simple-table`},YVt={key:0},XVt=[`colspan`],P9=(0,t.defineComponent)({__name:`simple-table`,props:{columns:{},data:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`table`,JVt,[(0,t.createElementVNode)(`thead`,null,[(0,t.createElementVNode)(`tr`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.columns,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`th`,{key:e.key},(0,t.toDisplayString)(e.label),1))),128))])]),(0,t.createElementVNode)(`tbody`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.data,(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,{key:r},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.columns,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`td`,{key:e.key,class:(0,t.normalizeClass)({"is-break-all":e.breakAll})},(0,t.toDisplayString)(n[e.key]??`--`),3))),128))]))),128)),e.data.length?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`tr`,YVt,[(0,t.createElementVNode)(`td`,{class:`is-empty`,colspan:e.columns.length},` -- `,8,XVt)]))])]))}}),ZVt={class:`ai-flow-agent-node-detail`},QVt={class:`detail-title`},$Vt={key:1,class:`detail-title-content`},eHt={class:`detail-tab-bar`},tHt=[`onClick`],nHt={class:`detail-body`},rHt={class:`skeleton-section`},iHt={class:`skeleton-section`},aHt={class:`info-form`},oHt={class:`info-label`},sHt={class:`info-value`},cHt={class:`info-row`},lHt={class:`info-label`},uHt={class:`info-value`},dHt={key:0,class:`failure-item`},fHt={key:1,class:`failure-item`},pHt={class:`info-row`},mHt={class:`info-label`},hHt={class:`info-value`},gHt={key:0,class:`skeleton-section`},F9=function(e){return e.Config=`config`,e.Output=`output`,e}(F9||{}),_Ht=(0,t.defineComponent)({__name:`flow-agent-node-detail`,props:{data:{},has_confidence:{type:Boolean},loading:{type:Boolean},node_id:{},node_name:{},task_id:{},task_name:{}},setup(e){let n=[{key:F9.Config,label:Tl(`节点配置`)},{key:F9.Output,label:Tl(`节点输出`)}],r=[{key:`key`,label:Tl(`参数名`)},{breakAll:!0,key:`value`,label:Tl(`参数值`)}],i=[{key:`name`,label:Tl(`名称`)},{key:`description`,label:Tl(`变量说明`)},{key:`key`,label:`KEY`}],a=[{key:`key`,label:Tl(`参数名`)},{breakAll:!0,key:`value`,label:Tl(`参数值`)}],o={forced_fail:wl?`Force Fail`:`强制失败`},s=e,l=(0,t.shallowRef)(F9.Config),u=(0,t.computed)(()=>s.data?.basic_info),d=(0,t.computed)(()=>{let e=u.value;return e?[{label:Tl(`流程模板`),value:e.template_name||`--`},{label:Tl(`节点名称`),value:e.node_name||`--`},{label:Tl(`步骤名称`),value:e.stage_name||`--`},{label:Tl(`是否可选`),value:e.optional?Tl(`是`):Tl(`否`)}]:[]}),f=(0,t.computed)(()=>{let e=u.value;return e?.skippable||e?.auto_retry?.enable}),p=(0,t.computed)(()=>{let e=u.value?.auto_retry;return e?.enable?wl?`In ${e.interval} seconds, auto retry ${e.times} times`:`在 ${e.interval} 秒后,自动重试 ${e.times} 次`:``}),m=(0,t.computed)(()=>{let e=u.value?.timeout_config;if(!e?.enable)return`--`;let t=o[e.action]??e.action;return wl?`Timeout ${e.seconds} seconds later, ${t}`:`超时 ${e.seconds} 秒后则${t}`}),h=(0,t.computed)(()=>Object.entries(s.data?.inputs??{}).map(([e,t])=>({key:e,value:v(t)}))),g=(0,t.computed)(()=>(s.data?.plugin_output??[]).map(e=>({description:e.schema?.description||`--`,name:e.name,key:e.key}))),_=(0,t.computed)(()=>(s.data?.outputs??[]).map(e=>({key:e.key,value:v(e.value)}))),v=e=>e==null?`--`:typeof e==`object`?JSON.stringify(e):String(e);return(o,s)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ZVt,[(0,t.createElementVNode)(`h3`,QVt,[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`节点`))+`:`,1),s[0]||=(0,t.createElementVNode)(`span`,{class:`skeleton-title ai-skeleton-element`},null,-1)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,$Vt,(0,t.toDisplayString)((0,t.unref)(Tl)(`节点`))+`:`+(0,t.toDisplayString)(u.value?.node_name),1)),(0,t.renderSlot)(o.$slots,`locateButton`)]),(0,t.createElementVNode)(`div`,eHt,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(n,e=>(0,t.createElementVNode)(`div`,{key:e.key,class:(0,t.normalizeClass)([`detail-tab`,{"is-active":l.value===e.key}]),onClick:t=>l.value=e.key},[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.key===F9.Config?(0,t.unref)(Il):(0,t.unref)(Fl)),{class:`detail-tab-icon`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)],10,tHt)),64))]),(0,t.createElementVNode)(`div`,nHt,[l.value===F9.Config?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`div`,rHt,[s[1]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(6,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))]),(0,t.createElementVNode)(`div`,iHt,[s[2]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(4,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))])],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`基础信息`)},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,aHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.label,class:`info-row`},[(0,t.createElementVNode)(`div`,oHt,(0,t.toDisplayString)(e.label),1),(0,t.createElementVNode)(`div`,sHt,(0,t.toDisplayString)(e.value),1)]))),128)),(0,t.createElementVNode)(`div`,cHt,[(0,t.createElementVNode)(`div`,lHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`失败处理`)),1),(0,t.createElementVNode)(`div`,uHt,[f.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[u.value?.skippable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,dHt,[s[3]||=(0,t.createElementVNode)(`span`,{class:`tag-badge`},`MS`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)((0,t.unref)(Tl)(`手动跳过`))+(0,t.toDisplayString)(u.value?.auto_retry?.enable?`;`:``),1)])):(0,t.createCommentVNode)(`v-if`,!0),u.value?.auto_retry?.enable?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fHt,[s[4]||=(0,t.createElementVNode)(`span`,{class:`tag-badge`},`AR`,-1),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(p.value),1)])):(0,t.createCommentVNode)(`v-if`,!0)],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createTextVNode)(`--`)],64))])]),(0,t.createElementVNode)(`div`,pHt,[(0,t.createElementVNode)(`div`,mHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`超时控制`)),1),(0,t.createElementVNode)(`div`,hHt,(0,t.toDisplayString)(m.value),1)])])]),_:1},8,[`title`]),(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`输入参数`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:r,data:h.value},null,8,[`data`])]),_:1},8,[`title`]),(0,t.createVNode)(N9,{title:(0,t.unref)(Tl)(`输出参数`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:i,data:g.value},null,8,[`data`])]),_:1},8,[`title`])],64))],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gHt,[s[5]||=(0,t.createElementVNode)(`div`,{class:`skeleton-heading ai-skeleton-element`},null,-1),((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(5,e=>(0,t.createElementVNode)(`div`,{key:e,class:`skeleton-row ai-skeleton-element`})),64))])):((0,t.openBlock)(),(0,t.createBlock)(N9,{key:1,title:(0,t.unref)(Tl)(`结构化输出`)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(P9,{columns:a,data:_.value},null,8,[`data`])]),_:1},8,[`title`]))],64))])]))}}),I9=e=>e.task_id==null?``:`${e.task_id}`,L9=I9,R9=(e,t)=>e.task_id==null?``:`${e.task_id}|${t.id}|${t.name}`,vHt=e=>{let{messageUid:n,taskList:r}=e,i=MSe(),a=$u(),o=(0,t.computed)(()=>i.selectedTab.value?.name??``),s=(0,t.shallowRef)(!1),l=()=>{s.value=!0},u=(0,t.computed)(()=>{if(s.value)return o.value;let e=r.value.find(e=>e.is_active);return e?.task_id==null?o.value:I9(e)}),d=e=>{let t=u.value;return t===I9(e)||t===L9(e)},f=(e,t)=>u.value===R9(e,t),p=(e,t)=>{let r=e.task_id;r!=null&&(l(),i.addCustomTab?.({closable:t.closable,icon:Il,label:t.name,name:R9(e,t),order:t.tab_order??100,data:{component:_Ht,messageUid:n.value,props:{data:{},loading:!0,node_id:t.id,node_name:t.name,task_id:r,task_name:e.task_name}}}))},m=e=>{let t=e?.task_id;t&&(l(),i.addCustomTab?.({closable:e.closable,icon:Il,label:Tl(`有效证据`),name:L9(e),order:e.tab_order??10,data:{component:_Ht,messageUid:n.value,props:{data:{},has_confidence:e.has_confidence,loading:!0,task_id:t,task_name:e.task_name}}}))};return(0,t.watch)(o,(e,t)=>{t!==void 0&&l()}),(0,t.onMounted)(()=>{a?.value&&m(r.value.find(e=>e.is_active&&e.has_confidence))}),(0,t.onUnmounted)(()=>{if(a?.value)for(let e of r.value){i.removeCustomTab?.(I9(e)),i.removeCustomTab?.(L9(e));for(let t of Object.values(e.nodes??{}))i.removeCustomTab?.(R9(e,t))}}),{displaySelectedTabName:u,isNodeSelected:f,isTaskSelected:d,markUserTabSelection:l,openConfidence:m,openNodeDetail:p}},yHt={class:`ai-activity-message-title-text`},bHt={class:`flow-agent-title-label`},xHt={key:1,class:`flow-agent-flow-header-paren is-open`},SHt={class:`flow-agent-stat-list`},CHt={key:2,class:`flow-agent-flow-header-paren is-close`},wHt={class:`flow-agent-stat-tooltip`},THt={class:`flow-agent-stat-tooltip-status`},EHt={class:`flow-agent-stat-tooltip-label`},DHt=[`onClick`],OHt={class:`flow-agent-task-state-icon`},kHt={class:`flow-agent-task-name`},AHt={class:`flow-agent-task-trailing`},jHt={class:`flow-agent-task-time`},MHt=[`onClick`],NHt={class:`flow-agent-task-nodes`},PHt={class:`flow-agent-node-status`},FHt=[`title`],IHt={class:`flow-agent-node-trailing`},LHt={class:`flow-agent-node-time`},RHt={class:`flow-agent-node-actions`},zHt=[`onClick`],BHt=(0,t.defineComponent)({__name:`flow-agent-content`,props:(0,t.mergeModels)({content:{},messageUid:{},onInterruptResume:{type:Function},status:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=Xu(),i=(0,t.useModel)(e,`collapsed`),a=fSe(),o=(0,t.computed)(()=>a.value===Nl.Share),s=(0,t.computed)(()=>n.status===Al.Pending||n.status===Al.Streaming),{flowHeaderDef:l,isTaskExpanded:u,taskList:d,toggleTaskExpanded:f,viewTasks:p,visibleStats:m}=HVt((0,t.toRef)(n,`content`)),{isNodeSelected:h,isTaskSelected:g,openConfidence:_,openNodeDetail:v}=vHt({messageUid:(0,t.toRef)(n,`messageUid`),taskList:d}),{getNodeActions:y,isNodePending:b}=WVt({hideResumeActions:o,onInterruptResume:(0,t.toRef)(n,`onInterruptResume`),openNodeDetail:v}),x=e=>{e.disabled||e.run()},S=e=>({backgroundColor:e.dotFill,borderColor:e.dotColor});return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:i.value,"onUpdate:collapsed":n[0]||=e=>i.value=e,"activity-type":(0,t.unref)(Ol).FlowAgent,class:`ai-flow-agent-activity`},{title:(0,t.withCtx)(()=>[(0,t.createCommentVNode)(` hover 整条执行情况栏展示统计 tooltip(设计稿 annotation) `),(0,t.createVNode)((0,t.unref)(Ku),(0,t.mergeProps)({class:`flow-agent-title-bar`,theme:`ai-chat-box-light light`},{...(0,t.unref)(r),tag:`div`,arrow:!0,followCursor:!1,offset:[0,10]}),{content:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,wHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(m),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.key,class:`flow-agent-stat-tooltip-item`},[(0,t.createElementVNode)(`span`,THt,[e.key===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-stat-dot`,style:(0,t.normalizeStyle)(S(e))},null,4))]),(0,t.createElementVNode)(`span`,EHt,(0,t.toDisplayString)(e.label)+`:`,1),(0,t.createElementVNode)(`span`,{class:`flow-agent-stat-tooltip-count`,style:(0,t.normalizeStyle)({color:e.color})},(0,t.toDisplayString)(e.display),5)]))),128))])]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-activity-message-title-icon`,{"icon-collapsed":i.value}])},[s.value?((0,t.openBlock)(),(0,t.createBlock)(Gl,{key:0,size:12})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(P_e),{key:1}))],2),(0,t.createElementVNode)(`span`,yHt,[(0,t.createElementVNode)(`span`,bHt,(0,t.toDisplayString)((0,t.unref)(Tl)(`执行情况`))+`:`,1),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`flow-agent-flow-header`,style:(0,t.normalizeStyle)({color:(0,t.unref)(l).color})},(0,t.toDisplayString)((0,t.unref)(l).label),5)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,xHt,`(`)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,SHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(m),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.key,class:`flow-agent-stat-item`},[e.key===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,class:`flow-agent-stat-loading`,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-stat-dot`,style:(0,t.normalizeStyle)(S(e))},null,4)),(0,t.createElementVNode)(`span`,{class:`flow-agent-stat-count`,style:(0,t.normalizeStyle)({color:e.color})},(0,t.toDisplayString)(e.display),5)]))),128))]),(0,t.unref)(l)?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,CHt,`)`)):(0,t.createCommentVNode)(`v-if`,!0)])]),_:1},16)]),default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(p),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.taskId,class:`flow-agent-task-group`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`flow-agent-task-header`,{"has-confidence":e.hasConfidence,"is-selected":(0,t.unref)(g)(e.raw)}])},[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`flow-agent-task-arrow`,{"is-expanded":(0,t.unref)(u)(e.raw)}]),onClick:(0,t.withModifiers)(n=>(0,t.unref)(f)(e.raw),[`stop`])},[(0,t.createVNode)((0,t.unref)(P_e))],10,DHt),(0,t.createElementVNode)(`span`,OHt,[e.convergedState===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` key 绑定归一状态:FAILED→FINISHED 等同为 svg 时强制重建,避免就地 patch 复用旧图标 DOM `),((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.stateIcon),{key:e.convergedState}))],2112))]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,kHt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.taskName),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]]),(0,t.createElementVNode)(`span`,AHt,[(0,t.createElementVNode)(`span`,jHt,(0,t.toDisplayString)(e.totalTimeText),1),e.hasConfidence?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`flow-agent-task-action-btn flow-agent-task-confidence-btn`,onClick:(0,t.withModifiers)(n=>(0,t.unref)(_)(e.raw),[`stop`])},[(0,t.createVNode)((0,t.unref)(Fl)),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.confidenceTitle??(0,t.unref)(Tl)(`有效证据`)),1)],8,MHt)):(0,t.createCommentVNode)(`v-if`,!0)])],2),(0,t.withDirectives)((0,t.createElementVNode)(`div`,NHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.nodes,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.id,class:(0,t.normalizeClass)([`flow-agent-node-item`,{"is-selected":(0,t.unref)(h)(e.raw,n.raw),"is-pending":(0,t.unref)(b)(e,n)}])},[(0,t.createElementVNode)(`span`,PHt,[n.convergedState===`running`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`flow-agent-status-dot`,style:(0,t.normalizeStyle)(S(n))},null,4))]),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{class:`flow-agent-node-name`,title:n.name},[(0,t.createTextVNode)((0,t.toDisplayString)(n.name),1)],8,FHt)),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]]),(0,t.createElementVNode)(`span`,IHt,[(0,t.createElementVNode)(`span`,LHt,(0,t.toDisplayString)(n.elapsedTimeText),1),(0,t.createElementVNode)(`span`,RHt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(y)(e,n),e=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:e.id,class:(0,t.normalizeClass)([`flow-agent-node-action-btn`,{"is-disabled":e.disabled}]),onClick:(0,t.withModifiers)(t=>x(e),[`stop`])},[(0,t.createCommentVNode)(` 进行中:图标切换为 loading 菊花(与节点执行中态一致) `),e.loading?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:0,class:`flow-agent-node-action-loading`,mode:`spin`,size:`mini`,theme:`primary`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.icon),{key:1})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(e.label),1)],10,zHt)),[[(0,t.unref)(Ju),e.tooltip?{...(0,t.unref)(r),content:e.tooltip,theme:`ai-chat-box`,offset:[0,8]}:{content:``}]])),128))])])],2))),128))],512),[[t.vShow,(0,t.unref)(u)(e.raw)]])]))),128))]),_:1},8,[`collapsed`,`activity-type`]))}}),VHt={class:`ai-activity-message-title-icon`},HHt={class:`ai-activity-message-title-text`},UHt={class:`ai-knowledge-rag-content`},WHt=(0,t.defineComponent)({__name:`knowledge-rag-content`,props:(0,t.mergeModels)({content:{},messageUid:{},status:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),i=(0,t.computed)(()=>n.status===Al.Pending||n.status===Al.Streaming),a=(0,t.computed)(()=>i.value?Tl(`检索中`):Tl(`检索完成`));return(n,o)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:r.value,"onUpdate:collapsed":o[0]||=e=>r.value=e},{title:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,VHt,[i.value?((0,t.openBlock)(),(0,t.createBlock)(Gl,{key:0})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(j_e),{key:1,style:{"font-size":`12px`}}))]),(0,t.createElementVNode)(`span`,HHt,(0,t.toDisplayString)(a.value),1)]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,UHt,[(0,t.createVNode)(J7,{content:e.content?.content||``},null,8,[`content`])]),(0,t.createVNode)(Y7,{content:e.content?.referenceDocument||[]},null,8,[`content`])]),_:1},8,[`collapsed`]))}}),GHt={class:`ai-activity-message-title-icon`},KHt={class:`ai-activity-message-title-text`},qHt=(0,t.defineComponent)({__name:`reference-doc-content`,props:(0,t.mergeModels)({content:{},messageUid:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),i=(0,t.computed)(()=>{let e=n.content?.length??0;return wl?`Reference ${e} documents as reference`:`引用 ${e} 篇资料作为参考`});return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)(O9,{collapsed:r.value,"onUpdate:collapsed":a[0]||=e=>r.value=e},{title:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,GHt,[(0,t.createVNode)((0,t.unref)(j_e),{style:{"font-size":`12px`}})]),(0,t.createElementVNode)(`span`,KHt,(0,t.toDisplayString)(i.value),1)]),default:(0,t.withCtx)(()=>[(0,t.createVNode)(Y7,{content:e.content||[]},null,8,[`content`])]),_:1},8,[`collapsed`]))}}),JHt=(0,t.defineComponent)({__name:`activity-message`,props:(0,t.mergeModels)({activityType:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{},onInterruptResume:{type:Function}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n={[Ol.FlowAgent]:BHt,[Ol.KnowledgeRag]:WHt,[Ol.ReferenceDocument]:qHt},r=e,i=(0,t.useModel)(e,`collapsed`),a=(0,t.computed)(()=>n[r.activityType??``]);return(n,r)=>a.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(a.value),{key:0,collapsed:i.value,"onUpdate:collapsed":r[0]||=e=>i.value=e,content:e.content,"message-uid":e.uid,"on-interrupt-resume":e.onInterruptResume,status:e.status},null,40,[`collapsed`,`content`,`message-uid`,`on-interrupt-resume`,`status`])):(0,t.createCommentVNode)(`v-if`,!0)}}),YHt={class:`ai-toolcall-desc`},XHt={class:`desc-title`},ZHt=[`title`],QHt={class:`desc-panel`},$Ht={class:`desc-label`},eUt={class:`desc-value`},tUt={style:{"word-break":`break-all`}},nUt={key:1,style:{wordBreak:`break-all`}},z9=(0,t.defineComponent)({__name:`desc-panel`,props:{desc:{},title:{}},setup(e){let n=e,{copy:r}=Qu(),i=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),a=(0,t.computed)(()=>{try{return JSON.parse(n.desc||``)}catch{return n.desc}}),o=()=>{n.desc&&r(n.desc)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,YHt,[(0,t.createElementVNode)(`div`,XHt,[(0,t.createTextVNode)((0,t.toDisplayString)(e.title)+` `,1),e.desc?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:0,class:`desc-copy`,title:(0,t.unref)(Tl)(`复制`),onClick:o},[(0,t.createVNode)((0,t.unref)(Hl))],8,ZHt)):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createElementVNode)(`div`,QHt,[(0,t.createCommentVNode)(` null 的 typeof 为 object,需排除,避免 v-for 异常;键/值统一转字符串后展示 `),a.value!==null&&typeof a.value==`object`?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:0},(0,t.renderList)(a.value,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:`desc-panel-item`},[(0,t.createElementVNode)(`span`,$Ht,(0,t.toDisplayString)(String(n))+`:`,1),(0,t.createElementVNode)(`span`,eUt,[(0,t.createElementVNode)(`span`,tUt,(0,t.toDisplayString)(i(e)),1)])]))),128)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,nUt,(0,t.toDisplayString)(i(a.value)),1))])]))}}),rUt={class:`ai-tool-message`},iUt=(0,t.defineComponent)({__name:`tool-message`,props:{duration:{},error:{type:[Boolean,String]},toolCallId:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,rUt,[(0,t.createVNode)(z9,{desc:e.content||(typeof e.error==`string`?e.error:void 0),title:(0,t.unref)(Tl)(`返回内容`)},null,8,[`desc`,`title`])]))}}),aUt={class:`ai-toolcall-render`},oUt={class:`toolcall-header-text`},sUt={key:0,class:`toolcall-header-status`},cUt={class:`ai-toolcall-render-content`},lUt=(0,t.defineComponent)({__name:`toolcall-render`,props:{duration:{},status:{},toolCall:{}},setup(e){let n=e,r=(0,t.shallowRef)(!0),i=Xu();function a(){r.value=!r.value}let o=(0,t.computed)(()=>[Al.Complete,Al.Completed,Al.Success].includes(n.status)),s=(0,t.computed)(()=>n.status===Al.Error||!!n.toolCall?.toolMessage?.error),l=(0,t.computed)(()=>n.status===Al.Stop),u=(0,t.computed)(()=>!o.value&&!s.value&&!l.value),d=(0,t.computed)(()=>{let e=n.toolCall?.function;return e?.function_type??(e?.mcpName?`mcp`:`function`)}),f=(0,t.computed)(()=>d.value===`skill`?Tl(`读取 Skill`):d.value===`mcp`?Tl(`调用 MCP`):Tl(`调用工具`)),p=(0,t.computed)(()=>d.value===`skill`?Tl(`正在读取`):Tl(`正在调用`)),m=(0,t.computed)(()=>{let e=n.toolCall?.function,t=e?.mcpName||``,r=e?.name||n.toolCall?.id||``;return t?`${t} / ${r}`:r}),h=(0,t.computed)(()=>s.value?Tl(`失败`):o.value?Tl(`成功`):``),g=(0,t.computed)(()=>{let e=n.duration||n.toolCall?.toolMessage?.duration;return e?Sl(e):``}),_=(0,t.computed)(()=>{let e=`${u.value?p.value:f.value} ${m.value}`;if(!h.value)return e;let t=g.value?`,${Tl(`耗时`)}:${g.value}`:``;return`${e}(${h.value}${t})`});return(n,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,aUt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ai-toolcall-render-header`,{"is-expanded":!r.value}]),onClick:a},[(0,t.createVNode)((0,t.unref)(H_e)),(0,t.createCommentVNode)(` 前缀、工具名与状态同处一个内联文本块,保证「(成功,…)」紧贴工具名,与设计稿一致 `),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,oUt,[(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`toolcall-header-title`,{"is-loading":u.value}])},(0,t.toDisplayString)(u.value?p.value:f.value)+` `+(0,t.toDisplayString)(m.value),3),h.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,sUt,[o[0]||=(0,t.createTextVNode)(`\xA0(\xA0`,-1),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`toolcall-header-result`,s.value?`is-error`:`is-success`])},(0,t.toDisplayString)(h.value),3),g.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)(`,`+(0,t.toDisplayString)((0,t.unref)(Tl)(`耗时`))+`:`+(0,t.toDisplayString)(g.value),1)],64)):(0,t.createCommentVNode)(`v-if`,!0),o[1]||=(0,t.createTextVNode)(`\xA0)`,-1)])):(0,t.createCommentVNode)(`v-if`,!0)])),[[(0,t.unref)(ld),{...(0,t.unref)(i),text:_.value,appendTo:`parent`}]]),u.value?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(U_e),{key:0,class:(0,t.normalizeClass)({"is-expanded":!r.value})},null,8,[`class`]))],2),(0,t.withDirectives)((0,t.createElementVNode)(`div`,cUt,[(0,t.createVNode)(z9,{desc:e.toolCall?.function.description,title:(0,t.unref)(Tl)(`描述`)},null,8,[`desc`,`title`]),(0,t.createVNode)(z9,{desc:e.toolCall?.function.arguments,title:(0,t.unref)(Tl)(`参数`)},null,8,[`desc`,`title`]),e.toolCall?.toolMessage?((0,t.openBlock)(),(0,t.createBlock)(iUt,(0,t.normalizeProps)((0,t.mergeProps)({key:0},e.toolCall.toolMessage)),null,16)):(0,t.createCommentVNode)(`v-if`,!0)],512),[[t.vShow,!r.value]])]))}}),uUt={class:`ai-message-artifacts`},dUt=(0,t.defineComponent)({__name:`message-artifacts`,props:{artifacts:{},onDownload:{type:Function},onPreview:{type:Function}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,uUt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.artifacts,n=>((0,t.openBlock)(),(0,t.createBlock)(Czt,{key:n.outputId,file:n,"on-download":e.onDownload,"on-preview":e.onPreview},null,8,[`file`,`on-download`,`on-preview`]))),128))]))}}),fUt={class:`ai-assistant-message`},pUt={key:0,class:`ai-assistant-message-content`},mUt={key:1,class:`ai-assistant-message-toolcalls`},hUt=(0,t.defineComponent)({__name:`assistant-message`,props:{content:{},id:{},messageId:{},name:{},property:{},role:{},status:{},toolCalls:{},uid:{}},setup(e){let n=e,r=(0,t.computed)(()=>n.property?.artifacts),i=e=>{let{toolMessage:t}=e;return t?t.error?Al.Error:t.status??n.status:n.status===Al.Stop?Al.Stop:Al.Pending};return(n,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fUt,[(0,t.createCommentVNode)(` 内容 `),e.content?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pUt,[(0,t.renderSlot)(n.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)({content:e.content})),()=>[(0,t.createVNode)(X7,{content:e.content||``,status:e.status,type:(0,t.unref)(Ol).Text},null,8,[`content`,`status`,`type`])])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 工具调用 `),e.toolCalls&&e.toolCalls.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mUt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.toolCalls,e=>((0,t.openBlock)(),(0,t.createBlock)(lUt,{key:e.id,status:i(e),"tool-call":e},null,8,[`status`,`tool-call`]))),128))])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createCommentVNode)(` 生成文件产物 `),r.value&&r.value.length>0?((0,t.openBlock)(),(0,t.createBlock)(dUt,{key:2,artifacts:r.value},null,8,[`artifacts`])):(0,t.createCommentVNode)(`v-if`,!0)]))}}),gUt={class:`ai-info-message`},_Ut={class:`ai-info-message-body`},vUt=(0,t.defineComponent)({__name:`info-message`,props:{content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gUt,[(0,t.createElementVNode)(`div`,_Ut,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Array.isArray(e.content)?e.content:[e.content],(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:`ai-info-message-content`},(0,t.toDisplayString)(e),1))),128))])]))}}),yUt={class:`ai-tool-approval-card`},bUt={class:`ai-tool-approval-card__header`},xUt={class:`ai-tool-approval-card__title-wrap`},SUt={class:`ai-tool-approval-card__title`},CUt={class:`ai-tool-approval-card__fields`},wUt={class:`ai-tool-approval-card__field`},TUt={class:`ai-tool-approval-card__field`},EUt={key:0,class:`ai-tool-approval-card__processor`},DUt={class:`ai-tool-approval-card__processor-text`},OUt={class:`ai-tool-approval-card__actions`},kUt={class:`ai-tool-approval-card__cancel-wrap`},AUt=2e3,jUt=(0,t.defineComponent)({__name:`tool-approval-card`,props:{interrupt:{},onInterruptResume:{type:Function},readonly:{type:Boolean}},setup(e){let n=e,r=Xu(),i=fSe(),a=(0,t.computed)(()=>i.value===Nl.Share),{copy:o}=Qu(),s=new Set([El.PENDING,El.DRAFT]),l=new Set([El.ABANDONED,El.CANCELLED,El.EXPIRED,El.REJECTED]),u=(0,t.computed)(()=>n.interrupt.metadata?.ticket??{approvers:[],sn:``,status:El.PENDING,submit_time:``,title:``,url:``}),d=new Set([El.CANCELLED,El.REVOKED]),f={[El.APPROVED]:Tl(`该单据已通过,无法取消`),[El.CANCELLED]:Tl(`单据已取消审批`),[El.REJECTED]:Tl(`该单据已被拒绝,无法取消`),[El.REVOKED]:Tl(`单据已取消审批`)},p=(0,t.computed)(()=>s.has(u.value.status)),m=(0,t.computed)(()=>p.value?`pending`:u.value.status),h=(0,t.computed)(()=>p.value?Tl(`审批中`):h_e[u.value.status]??u.value.status),g=(0,t.computed)(()=>u.value.approvers.filter(Boolean).join(`、`)||Tl(`无`)),_=(0,t.computed)(()=>u.value.url||u.value.sn),v=(0,t.computed)(()=>d.has(u.value.status)?Tl(`已取消审批`):Tl(`取消审批`)),y=(0,t.computed)(()=>f[u.value.status]??Tl(`当前状态无法取消审批`)),b=()=>{u.value.url&&window.open(u.value.url,`_blank`,`noopener`)},x=()=>{_.value&&o(_.value)},S=(0,t.shallowRef)(!1),C=(0,t.shallowRef)(!1),w,T=()=>{C.value=!0,clearTimeout(w),w=setTimeout(()=>{C.value=!1},AUt)},E=()=>{S.value||(S.value=!0,T(),n.onInterruptResume?.({operation:jl.ApprovalCancel,payload:{interrupt_id:n.interrupt.id}},n.interrupt))},D=()=>{C.value||a.value||(T(),n.onInterruptResume?.({operation:jl.ApprovalRefresh,payload:{interrupt_id:n.interrupt.id}},n.interrupt))};return(0,t.onUnmounted)(()=>clearTimeout(w)),(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,yUt,[(0,t.createElementVNode)(`header`,bUt,[(0,t.createElementVNode)(`div`,xUt,[i[0]||=(0,t.createElementVNode)(`span`,{class:`ai-tool-approval-card__title-bar`},null,-1),(0,t.createElementVNode)(`span`,SUt,(0,t.toDisplayString)(u.value.title||(0,t.unref)(Tl)(`算法方案评审单`)),1),(0,t.withDirectives)((0,t.createVNode)((0,t.unref)(Hl),{class:(0,t.normalizeClass)([`ai-tool-approval-card__copy-icon`,{"is-disabled":!_.value}]),onClick:x},null,8,[`class`]),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:(0,t.unref)(Tl)(`复制单据链接`),theme:`ai-chat-box`,offset:[0,8]}]]),(0,t.createCommentVNode)(` 审批中态提供刷新图标:取消为后端轮询、无法实时返回,用户可手动拉取单据最新状态;每次刷新 2s 冷却 `),p.value&&!e.readonly?(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Wl),{key:0,class:(0,t.normalizeClass)([`ai-tool-approval-card__refresh-icon`,{"is-disabled":C.value||a.value}]),onClick:D},null,8,[`class`])),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:(0,t.unref)(Tl)(`刷新单据状态`),theme:`ai-chat-box`,offset:[0,8]}]]):(0,t.createCommentVNode)(`v-if`,!0)]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`ai-tool-approval-card__status`,`ai-tool-approval-card__status--${m.value}`])},[u.value.status===(0,t.unref)(El).APPROVED?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(eye),{key:0,class:`ai-tool-approval-card__status-icon`})):(0,t.unref)(l).has(u.value.status)?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(nye),{key:1,class:`ai-tool-approval-card__status-icon`})):u.value.status===(0,t.unref)(El).REVOKED?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(rye),{key:2,class:(0,t.normalizeClass)([`ai-tool-approval-card__status-icon`,{"ai-tool-approval-card__status-icon--revoked":u.value.status===(0,t.unref)(El).REVOKED}])},null,8,[`class`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ro),{key:3,class:`ai-tool-approval-card__status-icon`,mode:`spin`,size:`mini`,theme:`primary`})),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(h.value),1)],2)]),(0,t.createElementVNode)(`dl`,CUt,[(0,t.createElementVNode)(`div`,wUt,[(0,t.createElementVNode)(`dt`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`单据编号`)),1),(0,t.createElementVNode)(`dd`,null,(0,t.toDisplayString)(u.value.sn||`--`),1)]),(0,t.createElementVNode)(`div`,TUt,[(0,t.createElementVNode)(`dt`,null,(0,t.toDisplayString)((0,t.unref)(Tl)(`提交时间`)),1),(0,t.createElementVNode)(`dd`,null,(0,t.toDisplayString)(u.value.submit_time||`--`),1)])]),p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,EUt,[(0,t.createVNode)((0,t.unref)(tye),{class:`ai-tool-approval-card__processor-icon`}),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,DUt,[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`当前处理人`))+`:`+(0,t.toDisplayString)(g.value),1)])),[[(0,t.unref)(ld),{...(0,t.unref)(r)}]])])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`div`,OUt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-tool-approval-card__detail`,disabled:!u.value.url,theme:`primary`,onClick:b},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`查看单据详情`))+` `,1),(0,t.createVNode)((0,t.unref)(Rl),{class:`ai-tool-approval-card__detail-icon`})]),_:1},8,[`disabled`]),(0,t.createCommentVNode)(` 待审批态:可点「取消审批」;点击后按钮进入 loading(同步 resume 无结果,防重复提交) `),p.value&&!e.readonly?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ko),{key:0,class:`ai-tool-approval-card__cancel`,disabled:S.value||a.value,loading:S.value,outline:``,theme:`primary`,onClick:E},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`取消审批`)),1)]),_:1},8,[`disabled`,`loading`])):e.readonly?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` 终态:保留「取消审批」按钮但置灰,hover 显示当前状态无法取消的原因(tooltip 挂在外层 span,规避 disabled 按钮不触发 hover) `),(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`span`,kUt,[(0,t.createVNode)((0,t.unref)(Ko),{class:`ai-tool-approval-card__cancel`,disabled:``,outline:``},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(v.value),1)]),_:1})])),[[(0,t.unref)(Ju),{...(0,t.unref)(r),content:y.value,theme:`ai-chat-box`,offset:[0,8]}]])],2112))])]))}}),MUt={class:`ai-interrupt-message`},NUt={key:0,class:`ai-interrupt-message__content`},PUt={class:`ai-interrupt-message__fallback`},FUt=(0,t.defineComponent)({__name:`interrupt-message`,props:{content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{},onInterruptResume:{type:Function}},setup(e){let n={[Dl.AIDevToolApproval]:jUt},r=e=>({id:e.interruptId||e.id||``,reason:Dl.AIDevToolApproval,toolCallId:``,metadata:e.payload.metadata}),i={[Dl.AIDevToolApproval]:e=>({component:jUt,props:{interrupt:r(e),onInterruptResume:o.onInterruptResume,readonly:!1}}),[Dl.UserQuestion]:e=>({component:wBt,props:{answers:e.payload?.answers??[],status:e.status}})},a=new Set([Dl.UserQuestion]),o=e,s=(0,t.computed)(()=>o.content?.outcome?.type===`interrupt`?o.content.outcome.interrupts:[]),l=(0,t.computed)(()=>o.content?.message),u=e=>n[e.reason],d=e=>a.has(e.reason),f=(0,t.computed)(()=>{if(o.content?.outcome?.type!==`success`)return;let e=o.content?.result;if(e)return i[e.reason]?.(e)});return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,MUt,[l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,NUt,(0,t.toDisplayString)(l.value),1)):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(s.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:n.toolCallId},[u(n)?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u(n)),{key:0,interrupt:n,"on-interrupt-resume":e.onInterruptResume},null,40,[`interrupt`,`on-interrupt-resume`])):d(n)?(0,t.createCommentVNode)(`v-if`,!0):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.createCommentVNode)(` UserQuestion 的交互浮层渲染在 chat-input 上方,不在会话内渲染 `),(0,t.createElementVNode)(`div`,PUt,(0,t.toDisplayString)(n.message||(0,t.unref)(Tl)(`暂不支持的中断消息`)),1)],2112))],64))),128)),(0,t.createCommentVNode)(` outcome.success 时按 reason 在会话内回显 resume 结果(审批单 / 已回答内容等) `),f.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(f.value.component),(0,t.normalizeProps)((0,t.mergeProps)({key:1},f.value.props)),(0,t.createSlots)({_:2},[n.$slots.answeredQuestion?{name:`answer`,fn:(0,t.withCtx)(e=>[(0,t.renderSlot)(n.$slots,`answeredQuestion`,(0,t.normalizeProps)((0,t.guardReactiveProps)(e)))]),key:`0`}:void 0]),1040)):(0,t.createCommentVNode)(`v-if`,!0)]))}}),IUt={class:`ai-loading-message`},LUt=(0,t.defineComponent)({__name:`loading-message`,setup(e){let n=$u();return(0,t.onMounted)(()=>{n?.value?.jumpToBottom?.()}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,IUt,[(0,t.createVNode)(Gl,{size:18}),(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(Tl)(`请求中...`)),1)])]))}}),RUt={class:`ai-reasoning-message`},zUt={key:0,class:`ai-reasoning-message-title-icon`},BUt={class:`ai-reasoning-message-title-text`},VUt={class:`ai-reasoning-message-content`},HUt=(0,t.defineComponent)({__name:`reasoning-message`,props:(0,t.mergeModels)({duration:{},content:{},createdAt:{},id:{},messageId:{},name:{},role:{},status:{},uid:{},property:{}},{collapsed:{type:Boolean,default:!1},collapsedModifiers:{}}),emits:[`update:collapsed`],setup(e){let n=e,r=(0,t.useModel)(e,`collapsed`),{stop:i}=(0,t.watch)(()=>n.duration,async e=>{e&&(r.value=!0,await(0,t.nextTick)(),i?.())},{immediate:!0}),a=(0,t.computed)(()=>{switch(n.status){case Al.Pending:return Tl(`思考中`);case Al.Success:case Al.Complete:return Tl(`已思考完成`)+(n.duration?` (${Tl(`耗时`)} :${Sl(n.duration)})`:``);case Al.Error:return Tl(`思考失败`);case Al.Stop:return Tl(`思考已停止`);default:return Tl(`思考中`)}});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,RUt,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`ai-reasoning-message-title`,{"ai-reasoning-message-title-collapsed":r.value,"is-thinking":e.status===(0,t.unref)(Al).Pending||e.status===(0,t.unref)(Al).Streaming,"is-complete":e.status===(0,t.unref)(Al).Complete||e.status===(0,t.unref)(Al).Success,"is-error":e.status===(0,t.unref)(Al).Error}]),onClick:i[0]||=e=>r.value=!r.value},[e.status===(0,t.unref)(Al).Pending||e.status===(0,t.unref)(Al).Streaming?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,zUt,[(0,t.createVNode)(Gl)])):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`span`,BUt,(0,t.toDisplayString)(a.value),1),(0,t.createCommentVNode)(` <template v-if="status === MessageStatus.Pending || status === MessageStatus.Streaming">
|
|
3907
3907
|
<ContentLoadingIcon
|
|
3908
3908
|
v-for="i in 3"
|
|
3909
3909
|
:key="i"
|