@vuagent/console 0.0.0-stage → 0.7.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/assets/Console-CbKuGLUf.css +1 -0
- package/dist/assets/Console-CeBWhbU5.js +48 -0
- package/dist/assets/index-CbbTa0Fy.js +3 -0
- package/dist/assets/index-qb90pvqy.css +1 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +9 -0
- package/dist/index.html +36 -0
- package/package.json +30 -3
- package/README.md +0 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{d as ce,o as f,c as h,n as ue,r as xe,a as A,b as Le,e as Pe,f as R,g as S,u as r,F as j,h as Q,i as Re,j as be,k as c,t as C,w as ve,l as Nl,m as G,p as H,T as Pt,q as oe,s as B,v as _e,x as ye,y as ga,z as dn,A as Ee,B as ze,C as tn,D as _t,E as Se,G as Ln,H as Ct,I as Lt,J as vt,K as Ia,L as zo,M as Po,N as Ba,O as Lo,P as ql,Q as ke,R as Oo,S as Wl,U as ka,V as jo,W as Vl,X as Jl,Y as Kl,Z as Hl}from"./index-CbbTa0Fy.js";const Zl=["type","disabled","aria-busy"],Xl={key:0,class:"va-btn__icon"},Gl={key:1,class:"va-btn__label"},Yl={key:2,class:"va-btn__icon"},Bt=ce({__name:"VaButton",props:{variant:{default:"primary"},size:{default:"md"},type:{default:"button"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},setup(e){return(t,n)=>(f(),h("button",{class:ue(["va-btn",[`va-btn--${e.variant}`,`va-btn--${e.size}`,{"va-btn--block":e.block,"va-btn--loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading,"aria-busy":e.loading||void 0},[t.$slots.icon?(f(),h("span",Xl,[xe(t.$slots,"icon")])):A("",!0),t.$slots.default?(f(),h("span",Gl,[xe(t.$slots,"default")])):A("",!0),t.$slots["icon-right"]?(f(),h("span",Yl,[xe(t.$slots,"icon-right")])):A("",!0)],10,Zl))}});function Ql(e,t){const n=S(!1);let a=null,s;const o=R(()=>new Intl.NumberFormat(e.locale??void 0,e.format)),i=R(()=>o.value.format(e.value)),l=R(()=>{const u=[];let p=0,v=0;for(let b=i.value.length-1;b>=0;b--){const _=i.value[b];_>="0"&&_<="9"?u.unshift({key:`d${p++}`,digit:_.charCodeAt(0)-48}):u.unshift({key:`s${v++}`,char:_})}return u});function d(){n.value||(s=window.setTimeout(()=>n.value=!0,e.delay))}return Le(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches){n.value=!0;return}if(typeof IntersectionObserver>"u"){d();return}a=new IntersectionObserver(u=>{u.some(p=>p.isIntersecting)&&(d(),a?.disconnect(),a=null)},{threshold:.3}),a.observe(t.value)}),Pe(()=>{a?.disconnect(),s!==void 0&&window.clearTimeout(s)}),{rolled:n,parts:l,formatted:i}}const er=["aria-label"],tr=["data-static"],nr={key:1,class:"va-ticker__char"},ds=ce({__name:"VaNumberTicker",props:{value:{},format:{},locale:{},duration:{default:900},delay:{default:0}},setup(e){const t=e,n=Re("root"),{rolled:a,parts:s,formatted:o}=Ql(t,n);return(i,l)=>(f(),h("span",{ref_key:"root",ref:n,class:"va-ticker",role:"img","aria-label":r(o)},[(f(!0),h(j,null,Q(r(s),d=>(f(),h("span",{key:d.key,class:"va-ticker__col","data-static":d.digit===void 0||void 0},[d.digit!==void 0?(f(),h("span",{key:0,class:"va-ticker__reel",style:be({transform:r(a)?`translateY(${-d.digit/11*100}%)`:"translateY(0)",transitionDuration:`${e.duration}ms`})},[(f(),h(j,null,Q(11,u=>c("span",{key:u,class:"va-ticker__num"},C((u-1)%10),1)),64))],4)):(f(),h("span",nr,C(d.char),1))],8,tr))),128))],8,er))}}),ct=ce({__name:"VaSkeleton",props:{width:{},height:{},radius:{},circle:{type:Boolean}},setup(e){const t=e,n=s=>{if(s!==void 0)return typeof s=="number"?`${s}px`:/^\d+(\.\d+)?$/.test(s)?`${s}px`:s},a=R(()=>{const s=n(t.width??"100%"),o=n(t.height??"12px");return{width:t.circle?o:s,height:o,borderRadius:t.circle?"50%":n(t.radius??"6px")}});return(s,o)=>(f(),h("span",{class:"va-skel",style:be(a.value),"aria-hidden":"true"},null,4))}}),ar=Symbol("va-tool-call-group");function za(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t<10?t.toFixed(1):Math.round(t)}s`;const n=Math.floor(t/60);if(n<60)return`${n}m ${String(Math.round(t%60)).padStart(2,"0")}s`;const a=Math.floor(n/60);return a<24?`${a}h ${String(n%60).padStart(2,"0")}m`:`${Math.floor(a/24)}d ${a%24}h`}function Oe(e){if(!Number.isFinite(e)||e<0)return"0";if(e<1e3)return String(Math.round(e));if(e<1e6){const n=e/1e3;return`${n<100?n.toFixed(1).replace(/\.0$/,""):String(Math.round(n))}K`}const t=e/1e6;return t<100?t.toFixed(1).replace(/\.0$/,"")+"M":`${Math.round(t)}M`}function fs(e){if(e==null)return"";if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")||t.startsWith("["))try{return JSON.stringify(JSON.parse(t),null,2)}catch{return e}return e}if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function On(e,t){const n=S(Date.now());let a;function s(){a!==void 0||typeof window>"u"||(n.value=Date.now(),a=window.setInterval(()=>n.value=Date.now(),e))}function o(){a!==void 0&&(window.clearInterval(a),a=void 0)}return ve(t,i=>i?s():o(),{immediate:!0}),Pe(o),n}function sr(e,t){const n=Nl(ar,null),a=S(!1),s=S(!1),o=R(()=>e.open!==void 0?e.open:s.value?a.value:e.defaultOpen??!1);function i(D){s.value=!0,a.value=D,t(D)}const l=R(()=>e.status==="running"&&e.startedAt!=null),d=On(200,l),u=S(void 0);ve(l,D=>{D||(u.value=p.value||void 0)});const p=R(()=>e.startedAt!=null?Math.max(0,d.value-e.startedAt):0),v=R(()=>e.status==="running"?p.value:e.duration!=null?e.duration:u.value??0),b=R(()=>za(v.value)),_=S(!1);ve(()=>e.status,(D,M)=>{!e.openOnError||s.value||(D==="error"&&M!=="error"&&!o.value?(i(!0),_.value=!0):M==="error"&&D!=="error"&&_.value&&(i(!1),_.value=!1))});function g(){i(!o.value)}const m=R(()=>fs(e.args)),k=R(()=>e.status==="error"?"":fs(e.result)),w=S({});function x(D){return D.length>400}const y=`va-tcl-${Math.random().toString(36).slice(2,8)}`,$=()=>({name:e.name,status:e.status,duration:e.status==="running"?void 0:e.duration??u.value,hasIcon:!0});return Le(()=>{n?.register($),e.status==="error"&&e.openOnError&&!o.value&&(i(!0),_.value=!0)}),Pe(()=>{n?.unregister($)}),{id:y,isOpen:o,timeLabel:b,timeMs:v,argsText:m,resultText:k,expanded:w,isLong:x,toggle:g}}const or=["data-status"],ir=["id","aria-expanded"],lr=["data-status"],rr={key:0,class:"va-tcl__spin","aria-hidden":"true"},ur={class:"va-tcl__meta"},cr={class:"va-tcl__name"},dr={key:0,class:"va-tcl__summary"},fr={class:"va-tcl__side"},vr={class:"va-tcl__time"},pr={key:0,class:"va-tcl__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},hr={key:1,class:"va-tcl__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},_r=["aria-label"],mr={class:"va-tcl__inner"},gr={key:0,class:"va-tcl__error"},kr={class:"va-tcl__error-text"},br={key:1,class:"va-tcl__sec"},yr={key:2,class:"va-tcl__sec"},wr=ce({__name:"VaToolCallCard",props:{name:{},summary:{default:void 0},status:{},args:{default:void 0},result:{default:void 0},error:{default:void 0},startedAt:{default:void 0},duration:{default:void 0},maxCodeHeight:{default:220},openOnError:{type:Boolean,default:!0},defaultOpen:{type:Boolean,default:!1},open:{type:Boolean,default:void 0}},emits:["retry","update:open"],setup(e,{emit:t}){const n=e,a=t,{id:s,isOpen:o,timeLabel:i,argsText:l,resultText:d,expanded:u,isLong:p,toggle:v}=sr(n,b=>a("update:open",b));return(b,_)=>(f(),h("div",{class:ue(["va-tcl",[`va-tcl--${n.status}`,r(o)?"va-tcl--open":""]]),"data-status":n.status},[c("button",{id:r(s),class:"va-tcl__head",type:"button","aria-expanded":r(o),onClick:_[0]||(_[0]=(...g)=>r(v)&&r(v)(...g))},[c("span",{class:"va-tcl__tile","data-status":n.status},[xe(b.$slots,"icon",{},()=>[_[4]||(_[4]=c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[c("path",{d:"M14.7 6.3a4.6 4.6 0 0 0-6.16 5.44L3.4 16.9a2 2 0 1 0 2.83 2.83l5.16-5.16a4.6 4.6 0 0 0 5.44-6.16l-2.6 2.6-2.3-.62-.62-2.3 2.6-2.6Z"})],-1))]),n.status==="running"?(f(),h("span",rr)):A("",!0)],8,lr),c("span",ur,[c("code",cr,C(n.name),1),n.summary?(f(),h("span",dr,C(n.summary),1)):A("",!0)]),c("span",fr,[c("span",vr,C(r(i)),1),n.status==="success"?(f(),h("svg",pr,[..._[5]||(_[5]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):n.status==="error"?(f(),h("svg",hr,[..._[6]||(_[6]=[c("circle",{cx:"12",cy:"12",r:"9"},null,-1),c("path",{d:"M12 8v4.5M12 16h.01"},null,-1)])])):A("",!0),_[7]||(_[7]=c("svg",{class:"va-tcl__chevron",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"m9.5 7 5 5-5 5"})],-1))])],8,ir),c("div",{class:"va-tcl__body",role:"region","aria-label":`${n.name} 详情`},[c("div",mr,[n.error?(f(),h("div",gr,[c("span",kr,C(n.error),1),c("button",{class:"va-act va-act--sm va-act--danger va-tcl__retry",type:"button",onClick:_[1]||(_[1]=g=>a("retry"))},"↻ 重试")])):A("",!0),r(l)?(f(),h("section",br,[_[8]||(_[8]=c("h4",{class:"va-tcl__sec-title"},"参数",-1)),c("pre",{class:ue(["va-tcl__code",{"va-tcl__code--capped":r(p)(r(l))&&!r(u).args}]),style:be(r(u).args||!r(p)(r(l))?void 0:{maxHeight:`${n.maxCodeHeight}px`})},C(r(l)),7),r(p)(r(l))?(f(),h("button",{key:0,class:"va-tcl__more",type:"button",onClick:_[2]||(_[2]=g=>r(u).args=!r(u).args)},C(r(u).args?"收起":"显示全部"),1)):A("",!0)])):A("",!0),r(d)?(f(),h("section",yr,[_[9]||(_[9]=c("h4",{class:"va-tcl__sec-title"},"结果",-1)),c("pre",{class:ue(["va-tcl__code",{"va-tcl__code--capped":r(p)(r(d))&&!r(u).result}]),style:be(r(u).result||!r(p)(r(d))?void 0:{maxHeight:`${n.maxCodeHeight}px`})},C(r(d)),7),r(p)(r(d))?(f(),h("button",{key:0,class:"va-tcl__more",type:"button",onClick:_[3]||(_[3]=g=>r(u).result=!r(u).result)},C(r(u).result?"收起":"显示全部"),1)):A("",!0)])):A("",!0)])],8,_r)],10,or))}});function xr(e){const t=S({});ve(()=>e.decisions,o=>{const i=new Set;for(const l of o)i.add(l.id),t.value[l.id]||(t.value[l.id]={open:!l.collapsed});for(const l of Object.keys(t.value))i.has(l)||delete t.value[l]},{immediate:!0,deep:!1});function n(o,i){const l=t.value[o.id];return!l||l.answered?!1:(l.answered=i,window.setTimeout(()=>{const d=t.value[o.id];d?.answered===i&&(d.gone=!0)},1e3),!0)}const a=R(()=>e.decisions.filter(o=>!t.value[o.id]?.gone)),s=R(()=>a.value.filter(o=>!t.value[o.id]?.answered));return{states:t,answer:n,visible:a,pending:s}}const $r=["data-empty"],Cr={key:0,class:"va-dib__head",role:"status"},Ar=["onClick"],Dr={class:"va-dib__fold-title"},Rr={class:"va-dib__title"},Er={key:0,class:"va-dib__detail"},Sr={key:1,class:"va-dib__confirm",role:"status"},Mr={key:2,class:"va-dib__detail"},Tr={key:3,class:"va-dib__actions"},Fr=["onClick"],Ir=["onClick"],Br=ce({__name:"VaDecisionInbox",props:{decisions:{}},emits:["decide"],setup(e,{emit:t}){const n=e,a=t,{states:s,answer:o,visible:i,pending:l}=xr(n);function d(u,p){o(u,p)&&a("decide",u,p)}return(u,p)=>(f(),h("div",{class:"va-dib","data-empty":!r(i).length||void 0},[r(i).length?(f(),h("p",Cr,[p[0]||(p[0]=c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"M12 9v4M12 16.5h.01M10.3 3.9 2.8 17a2 2 0 0 0 1.7 3h15a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"})],-1)),G(" "+C(r(l).length?`${r(l).length} 项待你拍板`:"全部已处理"),1)])):(f(),H(Pt,{key:1,name:"va-dib-fade",tag:"div"},{default:oe(()=>[...p[1]||(p[1]=[c("p",{key:"empty",class:"va-dib__empty va-fade-in"},"收件箱清空了,去忙别的吧。",-1)])]),_:1})),B(Pt,{name:"va-dib",tag:"div",class:"va-dib__list"},{default:oe(()=>[(f(!0),h(j,null,Q(r(i),v=>(f(),h("article",{key:v.id,class:ue(["va-dib__item",{"va-dib__item--folded":!r(s)[v.id]?.open,"va-dib__item--answered":r(s)[v.id]?.answered}])},[!r(s)[v.id]?.open&&!r(s)[v.id]?.answered?(f(),h("button",{key:0,class:"va-dib__fold",type:"button",onClick:b=>r(s)[v.id].open=!0},[c("span",Dr,C(v.title),1),p[2]||(p[2]=c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"m9.5 7 5 5-5 5"})],-1))],8,Ar)):(f(),h(j,{key:1},[c("h4",Rr,C(v.title),1),v.detail?(f(),h("p",Er,C(v.detail),1)):A("",!0),r(s)[v.id]?.answered?(f(),h("div",Sr,[p[3]||(p[3]=c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"M5.5 12.5l4 4L18.5 8"})],-1)),G(" 已选择「"+C(r(s)[v.id]?.answered==="primary"?v.primary??"":v.secondary??"")+"」 ",1)])):!v.primary&&!v.secondary&&v.detail?(f(),h("p",Mr,C(v.detail),1)):v.primary||v.secondary?(f(),h("div",Tr,[v.primary?(f(),h("button",{key:0,class:"va-act va-act--ink va-dib__btn",type:"button",onClick:b=>d(v,"primary")},C(v.primary),9,Fr)):A("",!0),v.secondary?(f(),h("button",{key:1,class:"va-act va-dib__btn",type:"button",onClick:b=>d(v,"secondary")},C(v.secondary),9,Ir)):A("",!0)])):A("",!0)],64))],2))),128))]),_:1})],8,$r))}});function zr(e,t,n){const a=S(e.value);let s,o=0,i=0;function l(){s!==void 0&&(window.clearInterval(s),s=void 0)}function d(){l(),!(typeof window>"u")&&(a.value=e.value,!(a.value<=0)&&(o=Date.now()+a.value*1e3,i=Date.now(),s=window.setInterval(()=>{const u=Date.now();if(t.value){o+=u-i,i=u;return}i=u,a.value=Math.max(0,(o-u)/1e3),a.value<=0&&(l(),n())},100)))}return Pe(l),{remaining:a,start:d,stop:l}}function Pr(e,t){const n=e.status==="approved"||e.status==="denied"?e.status:null,a=e.reason&&e.reason.toLowerCase().includes("timeout")?"timeout":void 0,s=S(n),o=S(a),i=S(!1),l=S(e.defaultCollapsed??!!n);ve(()=>e.status,y=>{y==="approved"||y==="denied"?(s.value=y,y==="denied"&&e.reason?.toLowerCase().includes("timeout")&&(o.value="timeout"),l.value=!0,v()):y==="pending"&&(s.value=null,l.value=!1,p())});const d=R(()=>s.value?0:e.countdown??0),{remaining:u,start:p,stop:v}=zr(d,i,()=>g("denied","timeout")),b=R(()=>({low:"低风险",medium:"中风险",high:"高风险"})[e.risk??"medium"]),_=R(()=>d.value>0?u.value/d.value*100:0);function g(y,$){s.value||(s.value=y,o.value=$,v(),l.value=!0,y==="approved"?t.approve():t.deny($))}function m(){g("approved")}function k(){g("denied","manual")}function w(){l.value=!l.value}function x(y){if(s.value)return;const $=y.target?.closest?.("button")!=null;y.key==="Enter"&&!$?(y.preventDefault(),e.approveShortcut?m():k()):y.key==="Escape"&&(y.preventDefault(),k())}return n||p(),{result:s,denyReason:o,paused:i,remaining:u,percent:_,riskLabel:b,isCollapsed:l,toggleCollapse:w,onApprove:m,onDeny:k,onKeydown:x}}const Lr=["aria-label","aria-describedby"],Or={key:0,class:"va-acd__count","aria-hidden":"true"},jr=["data-risk"],Ur={class:"va-acd__title"},Nr={key:0,class:"va-acd__timer",role:"timer","aria-live":"off"},qr={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","aria-hidden":"true"},Wr={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},Vr=["title"],Jr={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},Kr={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},Hr={class:"va-acd__main"},Zr=["id"],Xr={key:1,class:"va-acd__preview"},Gr={key:2,class:"va-acd__actions"},Yr={key:0,class:"va-acd__kbd-hint"},Qr={key:3,class:"va-acd__done",role:"status"},eu={key:0,class:"va-acd__done-detail"},tu=ce({__name:"VaApprovalCard",props:{title:{},detail:{default:void 0},risk:{default:"medium"},preview:{default:void 0},confirmLabel:{default:"批准"},denyLabel:{default:"拒绝"},countdown:{default:void 0},shortcuts:{type:Boolean,default:!0},approveShortcut:{type:Boolean,default:!1},status:{default:void 0},reason:{default:void 0},collapsible:{type:Boolean,default:!0},defaultCollapsed:{type:Boolean,default:void 0}},emits:["approve","deny"],setup(e,{emit:t}){const n=e,a=t,{result:s,denyReason:o,paused:i,percent:l,remaining:d,riskLabel:u,isCollapsed:p,toggleCollapse:v,onApprove:b,onDeny:_,onKeydown:g}=Pr(n,{approve:()=>a("approve"),deny:y=>a("deny",y)}),m=S(null),k=dn();Le(()=>{s.value||m.value?.focus()});function w(y){y.target!==m.value&&(i.value=!0)}function x(y){y.relatedTarget&&m.value?.contains(y.relatedTarget)||(i.value=!1)}return(y,$)=>(f(),h("div",{ref_key:"rootEl",ref:m,class:ue(["va-acd",[`va-acd--${n.risk}`,r(s)?`va-acd--${r(s)}`:"",r(p)?"va-acd--collapsed":""]]),tabindex:"-1",role:"alertdialog","aria-modal":"true","aria-label":n.title,"aria-describedby":n.detail?r(k):void 0,onKeydown:$[4]||($[4]=(...D)=>r(g)&&r(g)(...D)),onPointerenter:$[5]||($[5]=D=>i.value=!0),onPointerleave:$[6]||($[6]=D=>i.value=!1),onFocusin:w,onFocusout:x},[n.countdown&&!r(s)&&!r(p)?(f(),h("div",Or,[c("span",{class:"va-acd__count-fill",style:be({width:`${r(l)}%`})},null,4)])):A("",!0),c("header",{class:ue(["va-acd__head",{"va-acd__head--clickable":n.collapsible!==!1}]),onClick:$[1]||($[1]=D=>n.collapsible!==!1?r(v)():null)},[c("span",{class:"va-acd__risk","data-risk":n.risk},C(r(u)),9,jr),c("h3",Ur,C(n.title),1),n.countdown&&!r(s)?(f(),h("span",Nr,C(Math.ceil(r(d)))+"s 后自动拒绝 ",1)):r(s)?(f(),h("span",{key:1,class:ue(["va-acd__status-badge",`va-acd__status-badge--${r(s)}`])},[r(s)==="approved"?(f(),h("svg",qr,[...$[7]||($[7]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):(f(),h("svg",Wr,[...$[8]||($[8]=[c("path",{d:"m7.5 7.5 9 9m0-9-9 9"},null,-1)])])),c("span",null,C(r(s)==="approved"?"已批准":r(o)==="timeout"?"超时已拒":"已拒绝"),1)],2)):A("",!0),n.collapsible!==!1?(f(),h("button",{key:2,class:"va-acd__collapse-btn",type:"button",title:r(p)?"展开详情":"收起卡片",onClick:$[0]||($[0]=_e((...D)=>r(v)&&r(v)(...D),["stop"]))},[r(p)?(f(),h("svg",Jr,[...$[9]||($[9]=[c("polyline",{points:"6 9 12 15 18 9"},null,-1)])])):(f(),h("svg",Kr,[...$[10]||($[10]=[c("polyline",{points:"18 15 12 9 6 15"},null,-1)])]))],8,Vr)):A("",!0)],2),ye(c("div",Hr,[n.detail?(f(),h("p",{key:0,id:r(k),class:"va-acd__detail"},C(n.detail),9,Zr)):A("",!0),n.preview?(f(),h("pre",Xr,C(n.preview),1)):A("",!0),r(s)?(f(),h("div",Qr,[c("span",null,C(r(s)==="approved"?"已批准执行该操作":r(o)==="timeout"?"超时未响应,已自动拒绝":"已拒绝执行该操作"),1),n.detail?(f(),h("span",eu,C(n.detail),1)):A("",!0)])):(f(),h("div",Gr,[c("button",{class:"va-act va-acd__btn",type:"button",onClick:$[2]||($[2]=_e((...D)=>r(_)&&r(_)(...D),["stop"]))},C(n.denyLabel),1),c("button",{class:"va-act va-act--ink va-acd__btn",type:"button",onClick:$[3]||($[3]=_e((...D)=>r(b)&&r(b)(...D),["stop"]))},C(n.confirmLabel),1),n.shortcuts&&!r(s)?(f(),h("span",Yr,[n.approveShortcut?(f(),h(j,{key:0},[$[11]||($[11]=c("kbd",null,"Enter",-1)),$[12]||($[12]=G(" 批准 · ",-1)),$[13]||($[13]=c("kbd",null,"Esc",-1)),$[14]||($[14]=G(" 拒绝",-1))],64)):(f(),h(j,{key:1},[$[15]||($[15]=c("kbd",null,"Enter / Esc",-1)),$[16]||($[16]=G(" 拒绝",-1))],64))])):A("",!0)]))],512),[[ga,!r(p)]])],42,Lr))}}),nu=["aria-label"],au={class:"va-chart-header"},su={class:"va-chart-title"},ou={class:"va-chart-summary"},iu={class:"va-chart-max-val"},lu={key:0,class:"va-chart-unit"},ru={class:"va-bar-container"},uu={class:"va-bar-tooltip"},cu={class:"va-bar-labels"},du=["title"],fu={class:"va-line-container"},vu={class:"va-line-svg",viewBox:"0 0 300 100",preserveAspectRatio:"none"},pu=["d"],hu=["points"],_u=["cx","cy"],mu={class:"va-bar-labels"},gu=["title"],vs=ce({__name:"VaMetricChart",props:{title:{},chartType:{default:"bar"},unit:{default:""},series:{default:()=>[]}},setup(e){const t=e,n=R(()=>{if(t.series.length===0)return 1;const l=Math.max(...t.series.map(d=>d.value));return l>0?l:1}),a=R(()=>t.series.length===0?0:t.series[t.series.length-1].value),s=R(()=>{const l=t.series.length;if(l<2)return[];const d=300,u=90,p=10,v=8,b=d-p*2,_=u-v*2;return t.series.map((g,m)=>{const k=p+m/(l-1)*b,w=u-v-g.value/n.value*_;return{x:k,y:w,...g}})}),o=R(()=>s.value.map(l=>`${l.x.toFixed(1)},${l.y.toFixed(1)}`).join(" ")),i=R(()=>{const l=s.value;if(l.length<2)return"";const d=l[0],u=l[l.length-1];return`M ${d.x},90 L ${o.value} L ${u.x},90 Z`});return(l,d)=>(f(),h("div",{class:"va-metric-chart",role:"region","aria-label":e.title},[c("header",au,[c("h4",su,C(e.title),1),c("div",ou,[c("span",iu,C(a.value),1),e.unit?(f(),h("span",lu,C(e.unit),1)):A("",!0)])]),e.chartType==="bar"?(f(),h(j,{key:0},[c("div",ru,[(f(!0),h(j,null,Q(e.series,(u,p)=>(f(),h("div",{key:p,class:"va-bar-col"},[c("div",uu,C(u.value)+C(e.unit),1),c("div",{class:"va-bar-pill",style:be({height:`${Math.max(4,u.value/n.value*100)}%`})},null,4)]))),128))]),c("div",cu,[(f(!0),h(j,null,Q(e.series,(u,p)=>(f(),h("span",{key:p,class:"va-bar-label",title:u.label},C(u.label),9,du))),128))])],64)):e.chartType==="line"?(f(),h(j,{key:1},[c("div",fu,[(f(),h("svg",vu,[d[0]||(d[0]=c("defs",null,[c("linearGradient",{id:"va-line-gradient",x1:"0",y1:"0",x2:"0",y2:"1"},[c("stop",{offset:"0%","stop-color":"var(--va-accent, #c2410c)"}),c("stop",{offset:"100%","stop-color":"transparent"})])],-1)),c("path",{d:i.value,class:"va-line-area"},null,8,pu),c("polyline",{points:o.value,class:"va-line-path"},null,8,hu),(f(!0),h(j,null,Q(s.value,(u,p)=>(f(),h("circle",{key:p,cx:u.x,cy:u.y,r:"3",class:"va-line-dot"},[c("title",null,C(u.label)+": "+C(u.value)+C(e.unit),1)],8,_u))),128))]))]),c("div",mu,[(f(!0),h(j,null,Q(e.series,(u,p)=>(f(),h("span",{key:p,class:"va-bar-label",title:u.label},C(u.label),9,gu))),128))])],64)):A("",!0)],8,nu))}});function ku(e,t){const n=R(()=>e.steps.some(w=>w.status==="running")),a=On(500,n);function s(w){if(w.status==="running")return w.startedAt!=null?a.value-w.startedAt:void 0;if(w.status==="done")return w.duration}const o=R(()=>e.steps.filter(w=>w.status==="done").length),i=R(()=>e.steps.some(w=>w.status==="error"));let l=0;const d=S(null),u=S(""),p=S("");function v(w){t["update:steps"](w)}function b(w){d.value=w.id,u.value=w.title}function _(w){const x=u.value.trim();d.value=null,!(!x||x===w.title)&&v(e.steps.map(y=>y.id===w.id?{...y,title:x}:y))}function g(w,x){const y=w+x;if(y<0||y>=e.steps.length)return;const $=[...e.steps],[D]=$.splice(w,1);$.splice(y,0,D),v($)}function m(w){v(e.steps.filter(x=>x.id!==w.id))}function k(){const w=p.value.trim();w&&(v([...e.steps,{id:`step-${Date.now()}-${l++}`,title:w}]),p.value="")}return{now:a,elapsedOf:s,doneCount:o,anyError:i,editingId:d,draft:u,addDraft:p,startRename:b,rename:_,move:g,remove:m,add:k}}const bu={class:"va-plan__head"},yu={class:"va-plan__title"},wu=["data-error"],xu={key:1,class:"va-plan__progress"},$u=["data-status"],Cu={key:0,class:"va-plan__edit-row"},Au={class:"va-plan__idx"},Du=["onKeydown","onBlur"],Ru=["onClick"],Eu={class:"va-plan__ops"},Su=["disabled","onClick"],Mu=["disabled","onClick"],Tu=["onClick"],Fu={class:"va-plan__node","aria-hidden":"true"},Iu={key:0,class:"va-plan__spin"},Bu={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.4","stroke-linecap":"round"},zu={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},Pu={key:3,class:"va-plan__dot"},Lu={class:"va-plan__body"},Ou=["data-done"],ju={key:0,class:"va-plan__step-detail"},Uu={class:"va-plan__side"},Nu={key:0,class:"va-plan__time"},qu=["onClick"],Wu={key:0,class:"va-plan__add"},Vu=["disabled"],Ju={key:1,class:"va-plan__collab"},Ku={key:0,class:"va-plan__errors",role:"alert"},Hu={class:"va-plan__collab-actions"},Zu=["disabled"],Xu=["disabled"],Gu=ce({__name:"VaAgentPlan",props:{steps:{},editable:{type:Boolean,default:!1},title:{default:"执行计划"},collaborative:{type:Boolean},disabled:{type:Boolean},fieldErrors:{}},emits:["update:steps","retry","confirm","cancel"],setup(e,{emit:t}){const n=e,a=t,{elapsedOf:s,doneCount:o,anyError:i,editingId:l,draft:d,addDraft:u,startRename:p,rename:v,move:b,remove:_,add:g}=ku(n,{"update:steps":w=>a("update:steps",w)}),m=R(()=>w=>{const x=s(w);return x===void 0?void 0:za(x)}),k=R(()=>Object.entries(n.fieldErrors??{}).map(([w,x])=>`${w}:${x}`));return(w,x)=>(f(),h("div",{class:ue(["va-plan",n.editable?"va-plan--edit":""])},[c("header",bu,[c("h4",yu,C(n.title),1),!n.editable&&n.steps.length?(f(),h("span",{key:0,class:"va-plan__progress","data-error":r(i)||void 0},[G(C(r(o))+"/"+C(n.steps.length)+" 步 ",1),r(i)?(f(),h(j,{key:0},[G(" · 有失败")],64)):A("",!0)],8,wu)):n.editable?(f(),h("span",xu,"可调整后交给 agent 执行")):A("",!0)]),B(Pt,{tag:"ol",class:"va-plan__list",name:"va-plan"},{default:oe(()=>[(f(!0),h(j,null,Q(n.steps,(y,$)=>(f(),h("li",{key:y.id,class:"va-plan__item","data-status":y.status??"pending"},[n.editable?(f(),h("div",Cu,[c("span",Au,C($+1),1),r(l)===y.id?ye((f(),h("input",{key:0,"onUpdate:modelValue":x[0]||(x[0]=D=>tn(d)?d.value=D:null),class:"va-plan__input",type:"text",autofocus:"",onKeydown:[ze(D=>r(v)(y),["enter"]),x[1]||(x[1]=ze(D=>l.value=null,["esc"]))],onBlur:D=>r(v)(y)},null,40,Du)),[[Ee,r(d)]]):(f(),h("button",{key:1,class:"va-plan__rename",type:"button",title:"点击重命名",onClick:D=>r(p)(y)},C(y.title),9,Ru)),c("span",Eu,[c("button",{class:"va-act va-act--ghost va-plan__op",type:"button","aria-label":"上移",disabled:$===0,onClick:D=>r(b)($,-1)},"↑",8,Su),c("button",{class:"va-act va-act--ghost va-plan__op",type:"button","aria-label":"下移",disabled:$===n.steps.length-1,onClick:D=>r(b)($,1)},"↓",8,Mu),c("button",{class:"va-act va-act--ghost va-plan__op va-plan__op--danger",type:"button","aria-label":"删除步骤",onClick:D=>r(_)(y)},"✕",8,Tu)])])):(f(),h(j,{key:1},[c("span",Fu,[y.status==="running"?(f(),h("span",Iu)):y.status==="done"?(f(),h("svg",Bu,[...x[7]||(x[7]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):y.status==="error"?(f(),h("svg",zu,[...x[8]||(x[8]=[c("path",{d:"M12 8v4.5M12 16h.01"},null,-1)])])):(f(),h("span",Pu))]),c("div",Lu,[c("span",{class:"va-plan__step-title","data-done":y.status==="done"||void 0},C(y.title),9,Ou),y.detail?(f(),h("span",ju,C(y.detail),1)):A("",!0)]),c("div",Uu,[m.value(y)!==void 0?(f(),h("span",Nu,C(m.value(y)),1)):A("",!0),y.status==="error"?(f(),h("button",{key:1,class:"va-act va-act--sm va-act--danger va-plan__retry",type:"button",onClick:D=>a("retry",y)},"↻ 重试",8,qu)):A("",!0)])],64))],8,$u))),128))]),_:1}),n.editable?(f(),h("div",Wu,[ye(c("input",{"onUpdate:modelValue":x[2]||(x[2]=y=>tn(u)?u.value=y:null),class:"va-plan__input",type:"text",placeholder:"添加步骤…",onKeydown:x[3]||(x[3]=ze((...y)=>r(g)&&r(g)(...y),["enter"]))},null,544),[[Ee,r(u)]]),c("button",{class:"va-plan__add-btn",type:"button",disabled:!r(u).trim(),onClick:x[4]||(x[4]=(...y)=>r(g)&&r(g)(...y))},"+ 添加",8,Vu)])):A("",!0),n.collaborative?(f(),h("footer",Ju,[k.value.length?(f(),h("div",Ku,[(f(!0),h(j,null,Q(k.value,y=>(f(),h("span",{key:y,class:"va-plan__error"},C(y),1))),128))])):A("",!0),c("div",Hu,[c("button",{class:"va-plan__confirm",type:"button",disabled:n.disabled,onClick:x[5]||(x[5]=y=>a("confirm"))},"确认计划",8,Zu),c("button",{class:"va-plan__giveup",type:"button",disabled:n.disabled,onClick:x[6]||(x[6]=y=>a("cancel"))},"放弃",8,Xu)])])):A("",!0)],2))}}),ba={system:"系统提示",file:"文件",history:"对话历史",tools:"工具结果"};function Yu(e){const t=R(()=>e.parts.reduce((d,u)=>d+u.tokens,0)),n=R(()=>Math.max(e.capacity,t.value,1)),a=R(()=>Math.min(100,t.value/e.capacity*100)),s=R(()=>e.parts.some(d=>d.kind==="history"));function o(d){return e.compacting&&d.kind==="history"}function i(d){return o(d)?"0%":`${Math.max(d.tokens/n.value*100,2)}%`}const l=R(()=>{const d=Object.keys(ba),u=new Set(e.parts.map(p=>p.kind));return d.filter(p=>u.has(p))});return{used:t,scale:n,percent:a,hasHistory:s,shrinking:o,widthOf:i,legendKinds:l}}const Qu=["aria-label"],ec={class:"va-ctx__head"},tc={class:"va-ctx__used"},nc={class:"va-ctx__pct"},ac=["disabled"],sc={class:"va-ctx__bar","aria-hidden":"true"},oc=["data-kind","data-shrink"],ic=["aria-label","onClick","onKeydown"],lc={class:"va-ctx__tip"},rc={class:"va-ctx__legend"},uc=["data-kind"],ps=ce({__name:"VaContextWindow",props:{parts:{},capacity:{},compacting:{type:Boolean,default:!1},removable:{type:Boolean,default:!0}},emits:["remove","compact"],setup(e,{emit:t}){const n=e,a=t,{used:s,percent:o,hasHistory:i,shrinking:l,widthOf:d,legendKinds:u}=Yu(n);return(p,v)=>(f(),h("div",{class:ue(["va-ctx",{"va-ctx--compacting":n.compacting}]),role:"img","aria-label":`上下文已用 ${r(Oe)(r(s))} / ${r(Oe)(n.capacity)}`},[c("header",ec,[c("span",tc,[c("strong",null,C(r(Oe)(r(s))),1),G(" / "+C(r(Oe)(n.capacity)),1)]),c("span",nc,C(Math.round(r(o)))+"%",1),c("button",{class:"va-act va-act--sm va-ctx__compact",type:"button",disabled:n.compacting||!r(i),onClick:v[0]||(v[0]=b=>a("compact"))},C(n.compacting?"压缩中…":"压缩对话"),9,ac)]),c("div",sc,[(f(!0),h(j,null,Q(n.parts,b=>(f(),h("div",{key:b.id,class:"va-ctx__cell","data-kind":b.kind,"data-shrink":r(l)(b)||void 0,style:be({width:r(d)(b)}),tabindex:"0"},[n.removable&&b.kind==="file"?(f(),h("button",{key:0,class:"va-ctx__remove",type:"button","aria-label":`移除 ${b.label}`,onClick:_e(_=>a("remove",b),["stop"]),onKeydown:ze(_e(_=>a("remove",b),["stop"]),["enter"])},"×",40,ic)):A("",!0),c("span",lc,[c("strong",null,C(b.label),1),c("em",null,C(r(ba)[b.kind])+" · "+C(r(Oe)(b.tokens))+" tokens",1)])],12,oc))),128))]),c("footer",rc,[(f(!0),h(j,null,Q(r(u),b=>(f(),h("span",{key:b,class:"va-ctx__legend-item"},[c("i",{"data-kind":b},null,8,uc),G(C(r(ba)[b]),1)]))),128))])],10,Qu))}}),cc=/([\u4e00-\u9fff\u3400-\u4dbf\u3040-\u30ff\uac00-\ud7af])|([A-Za-z0-9][A-Za-z0-9'_-]*)|(\s+)|([\s\S])/g;function hs(e){const t=[];let n=!1;for(const a of e.matchAll(cc)){if(a[3]!==void 0){n=!0;continue}t.push({t:a[0],sp:n&&t.length>0}),n=!1}return t}const dc=1e6;function fc(e,t){const n=hs(e),a=hs(t),s=n.length,o=a.length;if(s*o>dc){const p=[];for(const v of n)p.push({type:"del",t:v.t,sp:v.sp});for(const v of a)p.push({type:"add",t:v.t,sp:v.sp});return p}const i=Array.from({length:s+1},()=>new Uint32Array(o+1));for(let p=s-1;p>=0;p--)for(let v=o-1;v>=0;v--)i[p][v]=n[p].t===a[v].t?i[p+1][v+1]+1:Math.max(i[p+1][v],i[p][v+1]);const l=[];let d=0,u=0;for(;d<s&&u<o;)n[d].t===a[u].t?(l.push({type:"same",t:n[d].t,sp:n[d].sp}),d++,u++):i[d+1][u]>=i[d][u+1]?(l.push({type:"del",t:n[d].t,sp:n[d].sp}),d++):(l.push({type:"add",t:a[u].t,sp:a[u].sp}),u++);for(;d<s;)l.push({type:"del",t:n[d].t,sp:n[d].sp}),d++;for(;u<o;)l.push({type:"add",t:a[u].t,sp:a[u].sp}),u++;return l}const vc=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const _s=e=>e==="";const pc=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();const ms=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const hc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());const _c=e=>{const t=hc(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Kt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const mc=({name:e,iconNode:t,absoluteStrokeWidth:n,"absolute-stroke-width":a,strokeWidth:s,"stroke-width":o,size:i=Kt.width,color:l=Kt.stroke,...d},{slots:u})=>_t("svg",{...Kt,...d,width:i,height:i,stroke:l,"stroke-width":_s(n)||_s(a)||n===!0||a===!0?Number(s||o||Kt["stroke-width"])*24/Number(i):s||o||Kt["stroke-width"],class:pc("lucide",d.class,...e?[`lucide-${ms(_c(e))}-icon`,`lucide-${ms(e)}`]:["lucide-icon"]),...!u.default&&!vc(d)&&{"aria-hidden":"true"}},[...t.map(p=>_t(...p)),...u.default?[u.default()]:[]]);const Ae=(e,t)=>(n,{slots:a,attrs:s})=>_t(mc,{...s,...n,iconNode:t,name:e},a);const gc=Ae("archive-restore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);const gs=Ae("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const kc=Ae("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const Gt=Ae("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Dt=Ae("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const ks=Ae("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const bc=Ae("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const yc=Ae("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const wc=Ae("clock-3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]);const xc=Ae("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const Uo=Ae("folder-closed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);const $c=Ae("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const Cc=Ae("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Ac=Ae("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);const ya=Ae("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);const bs=Ae("pin-off",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);const bn=Ae("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);const Rn=Ae("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Dc=Ae("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);const No=Ae("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Rc=Ae("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Ec=Ae("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);const yn=Ae("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Sc=Ae("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);const mt=Ae("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const qo=Ae("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Mc={class:"va-queuedock__tag"},Tc=["onKeydown"],Fc=["onClick"],Ic=["title"],Bc=["aria-label","disabled","onClick"],zc=["disabled","onClick"],Pc=["disabled","onClick"],Lc=ce({__name:"VaQueueDock",props:{items:{},disabled:{type:Boolean,default:!1}},emits:["remove","sendNow","edit"],setup(e,{emit:t}){const n=e,a=t,s=S(null),o=S(""),i=Re("input");function l(p,v){n.disabled||(s.value=p,o.value=v,Se(()=>i.value?.focus()))}function d(p){const v=o.value.trim();v&&v!==n.items[p]?.text&&a("edit",p,v),s.value=null}function u(){s.value=null}return(p,v)=>(f(),H(Pt,{tag:"div",class:"va-queuedock",role:"list","aria-label":"排队消息","enter-active-class":"va-enter-up","leave-active-class":"va-exit-left","move-class":"va-queuedock-move"},{default:oe(()=>[(f(!0),h(j,null,Q(n.items,(b,_)=>(f(),h("div",{key:b.id,class:"va-queuedock__row",role:"listitem"},[c("span",Mc,"排队 "+C(_+1),1),s.value===_?(f(),h(j,{key:0},[ye(c("input",{ref_for:!0,ref:"input","onUpdate:modelValue":v[0]||(v[0]=g=>o.value=g),class:"va-queuedock__input",type:"text",maxlength:"2000",onKeydown:[ze(_e(g=>d(_),["prevent"]),["enter"]),ze(_e(u,["prevent"]),["escape"])]},null,40,Tc),[[Ee,o.value]]),c("button",{class:"va-queuedock__op",type:"button","aria-label":"确认编辑",onClick:g=>d(_)},[B(r(Gt),{size:13})],8,Fc),c("button",{class:"va-queuedock__op",type:"button","aria-label":"取消编辑",onClick:u},[B(r(mt),{size:13})])],64)):(f(),h(j,{key:1},[c("span",{class:"va-queuedock__text",title:b.text},C(b.text),9,Ic),c("button",{class:"va-queuedock__op",type:"button","aria-label":`插队:立即发送第 ${_+1} 条`,title:"插队:run 结束后立即下发",disabled:n.disabled,onClick:g=>a("sendNow",_)},[B(r(qo),{size:13})],8,Bc),c("button",{class:"va-queuedock__op",type:"button","aria-label":"编辑",disabled:n.disabled,onClick:g=>l(_,b.text)},[B(r(ya),{size:12})],8,zc),c("button",{class:"va-queuedock__op",type:"button","aria-label":"移除排队",disabled:n.disabled,onClick:g=>a("remove",_)},[B(r(mt),{size:13})],8,Pc)],64))]))),128))]),_:1}))}});function Oc(e,t,n,a){const s=S(!1);async function o(){const u=n.value;if(!u)return;u.style.height="auto",await Se();const p=e.maxHeight??160;u.style.height=`${Math.min(u.scrollHeight,p)}px`}function i(u){t.value=u.target.value,o()}function l(){const u=t.value.trim();e.disabled||!e.allowEmpty&&!u||(a.send(u),t.value="",o())}function d(u){u.key!=="Enter"||u.shiftKey||s.value||(u.preventDefault(),l())}return Le(()=>{t.value&&o()}),{composing:s,onInput:i,submit:l,onKeydown:d}}const jc=[{id:"claude",name:"Claude",tag:"推荐"},{id:"gpt",name:"GPT"},{id:"gemini",name:"Gemini"},{id:"deepseek",name:"DeepSeek"},{id:"qwen",name:"Qwen"}];function Uc(e,t,n){const a=R(()=>e.models?.length?e.models:jc),s=S(!1),o=S(0),i=R(()=>a.value.find(g=>g.id===t.value)??a.value[0]);function l(g){const m=n.value;m&&!m.contains(g.target)&&u()}function d(){s.value=!0,o.value=Math.max(0,a.value.findIndex(g=>g.id===t.value)),typeof document<"u"&&document.addEventListener("pointerdown",l,!0)}function u(){s.value=!1,typeof document<"u"&&document.removeEventListener("pointerdown",l,!0)}function p(){s.value?u():d()}function v(g){g.detail!==0&&p()}function b(g){t.value=g.id,u()}function _(g){if(g.key==="Escape"){g.preventDefault(),u();return}if(s.value){if(g.key==="ArrowDown"||g.key==="ArrowUp"){g.preventDefault();const m=g.key==="ArrowDown"?1:-1;o.value=(o.value+m+a.value.length)%a.value.length}else if(g.key==="Enter"){g.preventDefault();const m=a.value[o.value];m&&b(m)}}}return Le(()=>{a.value.some(g=>g.id===t.value)||(t.value=a.value[0]?.id??"")}),Pe(u),{models:a,open:s,activeIdx:o,current:i,toggle:p,onTriggerClick:v,closeMenu:u,pick:b,onKeydown:_}}const Nc=["aria-expanded","aria-label"],qc={class:"va-mpk__group-header"},Wc={class:"va-mpk__group-title"},Vc={class:"va-mpk__group-count"},Jc=["aria-label"],Kc=["aria-selected","onMouseenter","onClick"],Hc={class:"va-mpk__check","aria-hidden":"true"},Zc={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.4","stroke-linecap":"round"},Xc=["title"],Gc=["title"],Yc={key:1,class:"va-mpk__list",role:"listbox"},Qc=["aria-selected","onMouseenter","onClick"],ed={class:"va-mpk__check","aria-hidden":"true"},td={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.4","stroke-linecap":"round"},nd=["title"],ad=["title"],sd=ce({__name:"VaModelPicker",props:Lt({models:{default:void 0},align:{default:"left"},ariaLabel:{default:"选择模型"}},{selected:{default:""},selectedModifiers:{}}),emits:["update:selected"],setup(e){const t=e,n=Ln(e,"selected"),a=Re("root"),{models:s,open:o,activeIdx:i,current:l,onTriggerClick:d,pick:u,onKeydown:p}=Uc(t,n,a),v=R(()=>{const g=[],m=new Map;return s.value.forEach((k,w)=>{let x=(k.provider||"").trim();!x&&k.tag&&k.tag.includes("·")&&(x=k.tag.split("·")[0].trim());const y=x||"默认";let $=m.get(y);$||($={provider:y,items:[]},m.set(y,$),g.push($)),$.items.push({model:k,flatIndex:w})}),g}),b=R(()=>v.value.length>1||v.value.length===1&&v.value[0].provider!=="默认");function _(g,m){const k=g.model||(m&&g.tag?.includes("·")?g.tag.split("·").slice(1).join("·").trim():g.tag)||"";return k===g.name?"":k}return(g,m)=>(f(),h("div",{ref_key:"root",ref:a,class:"va-mpk",onKeydown:m[1]||(m[1]=(...k)=>r(p)&&r(p)(...k))},[xe(g.$slots,"trigger",{current:r(l),open:r(o),toggle:r(d)},()=>[c("button",{class:"va-mpk__btn",type:"button","aria-expanded":r(o),"aria-label":t.ariaLabel,onClick:m[0]||(m[0]=(...k)=>r(d)&&r(d)(...k))},[G(C(r(l)?.name??"选择模型")+" ",1),m[2]||(m[2]=c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"m7 9.5 5 5 5-5"})],-1))],8,Nc)]),B(Ct,{name:"va-mpk"},{default:oe(()=>[r(o)?(f(),h("div",{key:0,class:ue(["va-mpk__menu",`va-mpk__menu--${t.align}`]),role:"listbox"},[b.value?(f(!0),h(j,{key:0},Q(v.value,k=>(f(),h("div",{key:k.provider,class:"va-mpk__group"},[c("div",qc,[c("span",Wc,C(k.provider),1),c("span",Vc,C(k.items.length),1)]),c("ul",{class:"va-mpk__list",role:"group","aria-label":k.provider},[(f(!0),h(j,null,Q(k.items,w=>(f(),h("li",{key:w.model.id},[c("button",{class:ue(["va-mpk__item",{"va-mpk__item--active":w.flatIndex===r(i),"va-mpk__item--selected":w.model.id===n.value}]),type:"button",role:"option","aria-selected":w.model.id===n.value,onMouseenter:x=>i.value=w.flatIndex,onClick:x=>r(u)(w.model)},[c("span",Hc,[w.model.id===n.value?(f(),h("svg",Zc,[...m[3]||(m[3]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):A("",!0)]),c("span",{class:"va-mpk__name",title:w.model.name},C(w.model.name),9,Xc),_(w.model,!0)?(f(),h("span",{key:0,class:"va-mpk__tag",title:w.model.tag||w.model.model},C(_(w.model,!0)),9,Gc)):A("",!0)],42,Kc)]))),128))],8,Jc)]))),128)):(f(),h("ul",Yc,[(f(!0),h(j,null,Q(r(s),(k,w)=>(f(),h("li",{key:k.id},[c("button",{class:ue(["va-mpk__item",{"va-mpk__item--active":w===r(i),"va-mpk__item--selected":k.id===n.value}]),type:"button",role:"option","aria-selected":k.id===n.value,onMouseenter:x=>i.value=w,onClick:x=>r(u)(k)},[c("span",ed,[k.id===n.value?(f(),h("svg",td,[...m[4]||(m[4]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):A("",!0)]),c("span",{class:"va-mpk__name",title:k.name},C(k.name),9,nd),_(k,!1)?(f(),h("span",{key:0,class:"va-mpk__tag",title:k.tag||k.model},C(_(k,!1)),9,ad)):A("",!0)],42,Qc)]))),128))]))],2)):A("",!0)]),_:1})],544))}}),od={key:0,class:"va-cmp__atts"},id=["src"],ld=["title"],rd={key:2,class:"va-cmp__att-size"},ud=["aria-label","onClick"],cd={key:1,class:"va-cmp__prefix"},dd={class:"va-cmp__input-wrap"},fd=["innerHTML"],vd=["value","placeholder","disabled"],pd={class:"va-cmp__foot"},hd={class:"va-cmp__actions"},_d=["aria-expanded","aria-label","disabled","onClick"],md={class:"va-cmp__seat-label"},gd={key:1,class:"va-cmp__seat-wrap"},kd=["aria-label","disabled"],bd={class:"va-cmp__seat-label"},yd={key:0,class:"va-cmp__menu",role:"menu","aria-label":"权限预设"},wd=["data-active","onClick"],xd={key:1,class:"va-cmp__menu-gap","aria-hidden":"true"},$d={class:"va-cmp__menu-col"},Cd={class:"va-cmp__menu-name"},Ad={key:0,class:"va-cmp__menu-desc"},Dd=["disabled"],Rd={key:3,class:"va-cmp__trailing"},Ed=["disabled"],ys=ce({__name:"VaComposer",props:Lt({placeholder:{default:"给 agent 一个任务…"},disabled:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},maxHeight:{default:160},allowEmpty:{type:Boolean,default:!1},models:{default:()=>[]},model:{default:""},permissions:{default:()=>[]},permission:{default:""},attachable:{type:Boolean,default:!1},uploading:{type:Boolean,default:!1},attachments:{default:()=>[]},mentionPaths:{default:()=>[]}},{text:{default:""},textModifiers:{}}),emits:Lt(["update:text","send","stop","update:model","update:permission","removeAttachment","filesSelected"],["update:text"]),setup(e,{expose:t,emit:n}){const a=e,s=Ln(e,"text"),o=n,i=Re("area"),{composing:l,onInput:d,submit:u,onKeydown:p}=Oc(a,s,i,{send:Y=>o("send",Y)}),v=R(()=>a.model||a.models[0]?.id||""),b=R(()=>a.permission||a.permissions[0]?.id||""),_=S(!1);function g(){_.value=!_.value}function m(Y){Y!==b.value&&o("update:permission",Y),_.value=!1}const k=R(()=>a.models.map(Y=>({id:Y.id,name:Y.label,tag:Y.meta,provider:Y.provider,model:Y.model})));function w(Y){Y!==v.value&&o("update:model",Y)}const x=R(()=>a.models.find(Y=>Y.id===v.value)?.label??v.value),y=R(()=>a.permissions.find(Y=>Y.id===b.value)?.label??b.value),$=Re("backdrop"),D=R(()=>new Set(a.mentionPaths??[]));function M(Y){return Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const N=R(()=>{const Y=s.value;if(!Y)return"";const ie=D.value;if(ie.size===0)return M(Y);let le="",T=0;const P=/@[^\s@]+/g;let L;for(;(L=P.exec(Y))!==null;)ie.has(L[0].slice(1))&&(le+=M(Y.slice(T,L.index)),le+=`<mark class="va-cmp__hl">${M(L[0])}</mark>`,T=L.index+L[0].length);return le+=M(Y.slice(T)),le});function K(){const Y=i.value,ie=$.value;!Y||!ie||(ie.scrollTop=Y.scrollTop,ie.scrollLeft=Y.scrollLeft)}const te=Re("file"),ne=S(!1);function V(){a.disabled||a.uploading||te.value?.click()}function X(Y){const ie=Y.target.files;ie?.length&&o("filesSelected",Array.from(ie)),Y.target.value=""}function O(Y){if(ne.value=!1,!a.attachable||a.disabled)return;const ie=Y.dataTransfer?.files;ie?.length&&o("filesSelected",Array.from(ie))}function J(Y){if(!a.attachable||a.disabled)return;const ie=Y.clipboardData?.files;ie?.length&&(Y.preventDefault(),o("filesSelected",Array.from(ie)))}function Z(Y){return!Y&&Y!==0?"":Y<1024?`${Y} B`:Y<1024*1024?`${(Y/1024).toFixed(0)} KB`:`${(Y/1024/1024).toFixed(1)} MB`}return t({focus:()=>i.value?.focus()}),(Y,ie)=>(f(),h("div",{class:ue(["va-cmp",{"va-cmp--busy":a.busy,"va-cmp--drag":ne.value}]),onDragover:ie[6]||(ie[6]=_e(le=>ne.value=a.attachable,["prevent"])),onDragleave:ie[7]||(ie[7]=le=>ne.value=!1),onDrop:O},[a.attachments.length?(f(),h("div",od,[(f(!0),h(j,null,Q(a.attachments,le=>(f(),h("span",{key:le.id,class:"va-cmp__att"},[le.kind==="image"&&le.previewUrl?(f(),h("img",{key:0,class:"va-cmp__att-thumb",src:le.previewUrl,alt:""},null,8,id)):(f(),H(r(xc),{key:1,size:13,"aria-hidden":"true"})),c("span",{class:"va-cmp__att-name",title:le.name},C(le.name),9,ld),le.size!==void 0?(f(),h("span",rd,C(Z(le.size)),1)):A("",!0),c("button",{class:"va-cmp__att-x",type:"button","aria-label":`移除附件 ${le.name}`,onClick:T=>o("removeAttachment",le.id)},[B(r(mt),{size:11,"aria-hidden":"true"})],8,ud)]))),128))])):A("",!0),Y.$slots.prefix?(f(),h("div",cd,[xe(Y.$slots,"prefix")])):A("",!0),c("div",dd,[c("div",{ref_key:"backdrop",ref:$,class:"va-cmp__backdrop","aria-hidden":"true",innerHTML:N.value},null,8,fd),c("textarea",{ref_key:"area",ref:i,class:"va-cmp__area",value:s.value,placeholder:a.placeholder,disabled:a.disabled,rows:"1",onInput:ie[0]||(ie[0]=(...le)=>r(d)&&r(d)(...le)),onKeydown:ie[1]||(ie[1]=(...le)=>r(p)&&r(p)(...le)),onCompositionstart:ie[2]||(ie[2]=le=>l.value=!0),onCompositionend:ie[3]||(ie[3]=le=>l.value=!1),onPaste:J,onScroll:K},null,40,vd)]),c("div",pd,[c("div",hd,[xe(Y.$slots,"actions"),a.models.length?(f(),H(r(sd),{key:0,class:"va-cmp__seat-wrap",models:k.value,selected:v.value,align:"left","aria-label":`切换模型(当前 ${x.value})`,"onUpdate:selected":w},{trigger:oe(({open:le,toggle:T})=>[c("button",{class:"va-cmp__seat",type:"button","aria-expanded":le,"aria-label":`切换模型(当前 ${x.value})`,disabled:a.disabled,onClick:_e(T,["stop"])},[B(r(qo),{size:12,"aria-hidden":"true"}),c("span",md,C(x.value),1),B(r(Dt),{size:11,"aria-hidden":"true"})],8,_d)]),_:1},8,["models","selected","aria-label"])):A("",!0),a.permissions.length?(f(),h("span",gd,[c("button",{class:"va-cmp__seat",type:"button","aria-label":`权限预设(当前 ${y.value})`,disabled:a.disabled,onClick:_e(g,["stop"])},[B(r(Rc),{size:12,"aria-hidden":"true"}),c("span",bd,C(y.value),1),B(r(Dt),{size:11,"aria-hidden":"true"})],8,kd),_.value?(f(),h("div",yd,[(f(!0),h(j,null,Q(a.permissions,le=>(f(),h("button",{key:le.id,class:"va-cmp__menu-row",type:"button",role:"menuitem","data-active":le.id===b.value||void 0,onClick:_e(T=>m(le.id),["stop"])},[le.id===b.value?(f(),H(r(Gt),{key:0,size:13,"aria-hidden":"true"})):(f(),h("span",xd)),c("span",$d,[c("span",Cd,C(le.label),1),le.desc?(f(),h("span",Ad,C(le.desc),1)):A("",!0)])],8,wd))),128))])):A("",!0)])):A("",!0),a.attachable?(f(),h("button",{key:2,class:"va-cmp__seat va-cmp__seat--icon",type:"button","aria-label":"上传附件",title:"上传附件(也可拖入/粘贴)",disabled:a.disabled||a.uploading,onClick:V},[a.uploading?(f(),H(r(Cc),{key:0,size:12,class:"va-cmp__spin","aria-hidden":"true"})):(f(),H(r(Ac),{key:1,size:12,"aria-hidden":"true"}))],8,Dd)):A("",!0),c("input",{ref:"file",class:"va-cmp__file",type:"file",multiple:"",hidden:"",onChange:X},null,544),Y.$slots.trailing?(f(),h("div",Rd,[xe(Y.$slots,"trailing")])):A("",!0)]),a.busy?(f(),h("button",{key:0,class:"va-cmp__send va-cmp__send--stop",type:"button","aria-label":"停止运行",title:"停止(Esc)",onClick:ie[4]||(ie[4]=le=>o("stop"))},[...ie[8]||(ie[8]=[c("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},[c("rect",{x:"7",y:"7",width:"10",height:"10",rx:"1.5"})],-1)])])):(f(),h("button",{key:1,class:"va-cmp__send",type:"button",disabled:a.disabled||!a.allowEmpty&&!s.value.trim(),"aria-label":"发送",onClick:ie[5]||(ie[5]=(...le)=>r(u)&&r(u)(...le))},[...ie[9]||(ie[9]=[c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[c("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5"})],-1)])],8,Ed))])],34))}});function Sd(e,t){const n=S(!1),a=S(new Set),s=S(!1);let o=null;function i(u){return!n.value||a.value.has(u)}const l=R(()=>!n.value||s.value);async function d(){await Se();const u=e.value;if(!(!u||!o)){if(o.disconnect(),!s.value){const p=u.querySelector(".va-traj__lanes");p&&o.observe(p)}for(const p of u.querySelectorAll(".va-traj__row[data-id]")){const v=p.dataset.id;v&&!a.value.has(v)&&o.observe(p)}}}return Le(()=>{e.value&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||typeof IntersectionObserver>"u"||(n.value=!0,o=new IntersectionObserver(p=>{for(const v of p){if(!v.isIntersecting)continue;const b=v.target;if(b.classList.contains("va-traj__lanes"))s.value=!0;else if(b.dataset.id){const _=new Set(a.value);_.add(b.dataset.id),a.value=_}o?.unobserve(b)}},{threshold:.15}),d()))}),ve(t,()=>{n.value&&d()}),Pe(()=>{o?.disconnect(),o=null}),{active:n,rowVisible:i,blocksVisible:l}}const Md=["data-reveal"],Td={class:"va-traj__panel"},Fd={class:"va-traj__bar"},Id={class:"va-traj__chip"},Bd={class:"va-traj__chip"},zd={class:"va-traj__chip"},Pd={class:"va-traj__chip"},Ld={class:"va-traj__search"},Od={class:"va-traj__lanes"},jd={class:"va-traj__lane-label"},Ud={class:"va-traj__track"},Nd=["data-lane","data-shown","title"],qd={key:0,class:"va-traj__empty"},Wd=["data-id","data-shown","title","data-open","data-selected","onClick","onKeydown"],Vd={class:"va-traj__rail"},Jd={key:0,class:"va-traj__turn"},Kd=["data-role"],Hd=["data-tool"],Zd={class:"va-traj__toolname"},Xd={key:0,class:"va-traj__detail"},Gd={class:"va-traj__detail-head"},Yd=["data-role"],Qd={class:"va-traj__detail-meta"},ef={class:"va-traj__detail-title"},tf={key:0},nf={key:1},af={key:2,class:"va-traj__detail-none"},wa=ce({__name:"VaTrajectory",props:{events:{type:Array,required:!0},ledgerMaxHeight:{type:Number,default:void 0},bordered:{type:Boolean,default:!0},splitDetail:{type:Boolean,default:!1}},emits:["toggle","select"],setup(e,{emit:t}){const n=e,a=t,s=R(()=>n.events[0]?.at??0),o=R(()=>{const O=n.events.at(-1);return O?Math.max(O.endAt??O.at,n.events[0]?.at??0):0}),i=R(()=>Math.max(o.value-s.value,1)),l=R(()=>({durationMs:Math.max(o.value-s.value,0),turns:new Set(n.events.map(O=>O.turn)).size,calls:n.events.filter(O=>O.lane==="tool").length,subcalls:0})),d=O=>O<1e3?`${O}ms`:`${(O/1e3).toFixed(1)}s`,u=[{key:"input",label:"输入"},{key:"model",label:"模型"},{key:"tool",label:"工具"}],p=O=>n.events.filter(J=>J.lane===O);function v(O){const J=(O.at-s.value)/i.value*100;return{left:`${Math.min(Math.max(J,0),99)}%`}}const b=S(""),_=S(new Set);function g(O){const J=!_.value.has(O),Z=new Set(_.value);J?Z.add(O):Z.delete(O),_.value=Z,a("toggle",O,J)}const m=S(null),k=R(()=>n.events.find(O=>O.id===m.value)??null);function w(O){m.value=m.value===O?null:O,a("select",m.value)}function x(){m.value=null,a("select",null)}function y(O){n.splitDetail?w(O.id):g(O.id)}const $=R(()=>{const O=b.value.trim().toLowerCase();return O?n.events.filter(J=>J.title.toLowerCase().includes(O)||(J.detail??"").toLowerCase().includes(O)||(J.result??"").toLowerCase().includes(O)):n.events}),D=R(()=>{const O=new Set,J=new Set;for(const Z of $.value)O.has(Z.turn)||(O.add(Z.turn),J.add(Z.id));return J}),M=O=>new Date(O).toLocaleTimeString("zh-CN",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),N=S(null),{active:K,rowVisible:te,blocksVisible:ne}=Sd(N,$),V={user:"用户",assistant:"助手",tool:"工具",system:"系统",context:"上下文"};function X(O){if(O.lane==="tool"){const J=O.detail&&O.detail.length>240?`${O.detail.slice(0,240)}…`:O.detail??"",Z=O.result&&O.result.length>240?`${O.result.slice(0,240)}…`:O.result??"";return J?`${J} → ${Z}`:Z}return O.title}return(O,J)=>(f(),h("div",{ref_key:"rootEl",ref:N,class:ue(["va-traj",{"va-traj--plain":n.bordered===!1,"va-traj--split":n.splitDetail}]),"data-reveal":r(K)?"on":void 0},[c("div",Td,[c("div",Fd,[c("span",Id,[B(r(wc),{size:12,"aria-hidden":"true"}),G("时长 "+C(d(l.value.durationMs)),1)]),c("span",Bd,[B(r(Dc),{size:12,"aria-hidden":"true"}),G("轮次 "+C(l.value.turns),1)]),c("span",zd,[B(r(Sc),{size:12,"aria-hidden":"true"}),G("调用 "+C(l.value.calls),1)]),c("span",Pd,[B(r($c),{size:12,"aria-hidden":"true"}),G("子调用 "+C(l.value.subcalls),1)]),J[1]||(J[1]=c("span",{class:"va-traj__spacer"},null,-1)),c("label",Ld,[B(r(No),{size:13,"aria-hidden":"true"}),ye(c("input",{"onUpdate:modelValue":J[0]||(J[0]=Z=>b.value=Z),type:"text",placeholder:"搜索","aria-label":"搜索轨迹事件"},null,512),[[Ee,b.value]])])]),c("div",Od,[(f(),h(j,null,Q(u,Z=>c("div",{key:Z.key,class:"va-traj__lane"},[c("span",jd,C(Z.label),1),c("div",Ud,[(f(!0),h(j,null,Q(p(Z.key),Y=>(f(),h("span",{key:Y.id,class:"va-traj__block","data-lane":Z.key,"data-shown":r(ne)?"true":void 0,style:be(v(Y)),title:`${M(Y.at)} ${Y.title}`},null,12,Nd))),128))])])),64))]),c("div",{class:"va-traj__ledger",style:be(n.ledgerMaxHeight?{maxHeight:`${n.ledgerMaxHeight}px`}:void 0)},[$.value.length?A("",!0):(f(),h("p",qd,C(n.events.length?"没有匹配的事件。":"还没有轨迹。发一条任务,这里会按轮记录全部事件。"),1)),(f(!0),h(j,null,Q($.value,Z=>(f(),h("div",{key:Z.id,class:"va-traj__row","data-id":Z.id,"data-shown":r(te)(Z.id)?"true":void 0,title:`${M(Z.at)}${Z.endAt?` · ${d(Z.endAt-Z.at)}`:""}`,"data-open":!n.splitDetail&&_.value.has(Z.id)||void 0,"data-selected":n.splitDetail&&m.value===Z.id||void 0,role:"button",tabindex:"0",onClick:Y=>y(Z),onKeydown:ze(_e(Y=>y(Z),["prevent"]),["enter"])},[c("span",Vd,[D.value.has(Z.id)?(f(),h("span",Jd,"第"+C(Z.turn)+"轮",1)):A("",!0),J[2]||(J[2]=c("i",{class:"va-traj__dot","aria-hidden":"true"},null,-1))]),c("span",{class:"va-traj__role","data-role":Z.role},C(V[Z.role]??Z.role),9,Kd),c("span",{class:"va-traj__content","data-tool":Z.lane==="tool"||void 0},[Z.lane==="tool"?(f(),h(j,{key:0},[c("b",Zd,C(Z.title),1),G(" "+C(X(Z)),1)],64)):(f(),h(j,{key:1},[G(C(Z.title),1)],64))],8,Hd)],40,Wd))),128))],4)]),n.splitDetail&&k.value?(f(),h("aside",Xd,[c("header",Gd,[c("span",{class:"va-traj__role","data-role":k.value.role},C(V[k.value.role]??k.value.role),9,Yd),c("span",Qd,[G(C(M(k.value.at)),1),k.value.endAt?(f(),h(j,{key:0},[G(" · "+C(d(k.value.endAt-k.value.at)),1)],64)):A("",!0),G(" · 第"+C(k.value.turn)+"轮 ",1)]),c("button",{class:"va-traj__detail-close",type:"button",title:"关闭详情","aria-label":"关闭详情",onClick:x},[B(r(mt),{size:14})])]),c("div",ef,C(k.value.title),1),k.value.detail?(f(),h("section",tf,[J[3]||(J[3]=c("h4",null,"输入 / 参数",-1)),c("pre",null,C(k.value.detail),1)])):A("",!0),k.value.result?(f(),h("section",nf,[J[4]||(J[4]=c("h4",null,"结果 / 输出",-1)),c("pre",null,C(k.value.result),1)])):A("",!0),!k.value.detail&&!k.value.result?(f(),h("p",af," 该事件没有更多详情 ")):A("",!0)])):A("",!0)],10,Md))}}),sf={class:"va-hero va-enter-up"},of={class:"va-hero__badge","aria-hidden":"true"},lf={class:"va-hero__title"},rf={class:"va-hero__desc"},uf={class:"va-hero__cards"},cf=["disabled","title","onClick"],df={class:"va-hero__card-name"},ff={key:0,class:"va-hero__card-path"},vf=["disabled"],pf=ce({__name:"VaEmptyHero",props:{workspaces:{default:()=>[]},creating:{type:Boolean,default:!1},title:{default:"开始一个任务"},description:{default:"选择一个工作区开启会话;agent 的文件读写都限定在其目录内。"}},emits:["createWorkspace","createSession"],setup(e,{emit:t}){const n=e,a=t;return(s,o)=>(f(),h("div",sf,[c("div",of,[xe(s.$slots,"icon",{},()=>[B(r(Ec),{size:20,class:"va-hero__icon"})])]),c("h3",lf,C(n.title),1),c("p",rf,C(n.description),1),c("div",uf,[(f(!0),h(j,null,Q(n.workspaces,i=>(f(),h("button",{key:i.id,class:"va-hero__card",type:"button",disabled:n.creating,title:i.path||i.name,onClick:l=>a("createSession",i.id)},[B(r(Uo),{size:18,"aria-hidden":"true"}),c("span",df,C(i.name),1),i.path?(f(),h("span",ff,C(i.path),1)):A("",!0)],8,cf))),128)),c("button",{class:"va-hero__card va-hero__card--new",type:"button",disabled:n.creating,onClick:o[0]||(o[0]=i=>a("createWorkspace"))},[B(r(Rn),{size:18,"aria-hidden":"true"}),o[1]||(o[1]=c("span",{class:"va-hero__card-name"},"新建工作区",-1)),o[2]||(o[2]=c("span",{class:"va-hero__card-path"},"弹出系统文件夹选择框",-1))],8,vf)])]))}}),hf=["data-hover-ops"],_f=["disabled","title"],mf={key:0,class:"va-stree__ws-create"},gf=["onKeydown"],kf=["disabled"],bf={key:2,class:"va-stree__search"},yf=["data-current"],wf={class:"va-stree__head"},xf=["aria-label","onClick"],$f=["title"],Cf={class:"va-stree__ws-icon","aria-hidden":"true"},Af={class:"va-stree__ws-name"},Df={class:"va-stree__count"},Rf={key:0,class:"va-stree__tag"},Ef=["disabled","onClick"],Sf=["data-danger","aria-label","disabled","onClick"],Mf={key:0,class:"va-stree__confirm"},Tf={key:0,class:"va-stree__list"},Ff={class:"va-stree__list-clip"},If=["data-active"],Bf=["onKeydown"],zf=["title","onClick"],Pf={key:0,class:"va-stree__dot va-stree__dot--warn","aria-hidden":"true"},Lf={key:1,class:"va-stree__dot va-stree__dot--run","aria-hidden":"true"},Of={class:"va-stree__session-title"},jf={key:3,class:"va-stree__warn-tag"},Uf={class:"va-stree__time"},Nf=["aria-label","disabled","onClick"],qf=["disabled","onClick"],Wf=["disabled","onClick"],Vf=["data-danger","aria-label","disabled","onClick"],Jf={key:0,class:"va-stree__confirm"},Kf={key:0,class:"va-stree__empty va-fade-in"},Hf={key:3,class:"va-stree__empty va-stree__search-empty va-fade-in"},Zf={key:4,class:"va-stree__group"},Xf={class:"va-stree__head"},Gf={class:"va-stree__ws"},Yf={class:"va-stree__count"},Qf={class:"va-stree__list"},ev={class:"va-stree__list-clip"},tv=["data-active"],nv=["onKeydown"],av=["title","onClick"],sv={key:0,class:"va-stree__dot va-stree__dot--warn","aria-hidden":"true"},ov={key:1,class:"va-stree__dot va-stree__dot--run","aria-hidden":"true"},iv={class:"va-stree__session-title"},lv={key:3,class:"va-stree__warn-tag"},rv={class:"va-stree__time"},uv=["aria-label","disabled","onClick"],cv=["disabled","onClick"],dv=["disabled","onClick"],fv=["data-danger","aria-label","disabled","onClick"],vv={key:0,class:"va-stree__confirm"},pv={key:5,class:"va-stree__archived"},hv={key:0,class:"va-stree__list"},_v={class:"va-stree__list-clip"},mv={class:"va-stree__session-main va-stree__session-main--static"},gv={class:"va-stree__session-title"},kv={class:"va-stree__time"},bv=["disabled","onClick"],yv=["data-danger","aria-label","disabled","onClick"],wv={key:0,class:"va-stree__confirm"},xv={key:6,class:"va-stree__footer"},$v=ce({__name:"VaSessionTree",props:{workspaces:{},sessions:{},archived:{},currentWorkspaceId:{},currentSessionId:{},disabled:{type:Boolean,default:!1},workspaceCreateMode:{default:"input"},newSession:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!1},hoverOps:{type:Boolean,default:!1},confirmMode:{default:"inline"}},emits:["createWorkspace","createWorkspacePick","selectSession","createSession","removeWorkspace","togglePin","rename","archive","remove"],setup(e,{emit:t}){const n=e,a=t,s=vt(new Set);ve(()=>n.workspaces.map(T=>T.id).join(","),T=>{if(n.collapsible)for(const P of T.split(","))P&&s.add(P)},{immediate:!0});function o(T){s.has(T)?s.delete(T):s.add(T)}const i=T=>!n.collapsible||s.has(T);function l(){n.disabled||!n.currentWorkspaceId||a("createSession",n.currentWorkspaceId)}const d=S(""),u=T=>!d.value.trim()||(T.title||"未命名会话").toLowerCase().includes(d.value.trim().toLowerCase()),p=R(()=>d.value.trim().length>0),v=S(!1),b=S("");function _(){if(!n.disabled){if(n.workspaceCreateMode==="picker"){a("createWorkspacePick");return}v.value=!0,b.value=""}}function g(){const T=b.value.trim();T&&a("createWorkspace",T),v.value=!1}function m(){v.value=!1}const k=S(null),w=S("");function x(T){n.disabled||(k.value=T.id,w.value=T.title||"未命名会话")}function y(){if(k.value){const T=w.value.trim(),P=[...n.sessions,...n.archived].find(L=>L.id===k.value)?.title??"";T&&T!==P&&a("rename",k.value,T)}k.value=null}function $(){k.value=null}const D=S(null);let M;function N(T,P,L,q){if(n.confirmMode==="none"){q();return}T===L?(q(),P(null)):(P(L),window.clearTimeout(M),M=window.setTimeout(()=>P(null),3e3))}function K(T){n.disabled||N(D.value,P=>D.value=P,T,()=>a("remove",T))}const te=S(null);function ne(T){n.disabled||N(te.value,P=>te.value=P,T,()=>a("removeWorkspace",T))}const V=R(()=>n.workspaces.map(T=>({workspace:T,sessions:n.sessions.filter(P=>(P.workspaceId??"")===T.id&&u(P))}))),X=R(()=>n.sessions.filter(T=>!O(T)&&u(T)));function O(T){return n.workspaces.some(P=>P.id===(T.workspaceId??""))}const J=S(!1),Z=T=>T.title||"未命名会话";function Y(T){const P=Date.now()-T;return P<6e4?"刚刚":P<36e5?`${Math.floor(P/6e4)} 分钟前`:P<864e5?`${Math.floor(P/36e5)} 小时前`:P<7*864e5?`${Math.floor(P/864e5)} 天前`:new Date(T).toLocaleDateString("zh-CN")}function ie(T){n.disabled||T.id!==n.currentSessionId&&a("selectSession",T.id)}function le(T){n.disabled||a("createSession",T)}return(T,P)=>(f(),h("div",{class:"va-stree","data-hover-ops":n.hoverOps||void 0},[n.newSession?(f(),h("button",{key:0,class:"va-stree__new-session",type:"button",disabled:n.disabled||!n.currentWorkspaceId,title:n.currentWorkspaceId?`在「${n.workspaces.find(L=>L.id===n.currentWorkspaceId)?.name??""}」新建会话`:"先选择或新建工作区",onClick:l},[B(r(Rn),{size:15,"aria-hidden":"true"}),P[5]||(P[5]=G("新建会话",-1))],8,_f)):A("",!0),B(Ct,{name:"va-stree-pop"},{default:oe(()=>[v.value?(f(),h("div",mf,[ye(c("input",{"onUpdate:modelValue":P[0]||(P[0]=L=>b.value=L),class:"va-stree__input",type:"text",placeholder:"本地文件夹路径,如 ~/code/my-proj",maxlength:"60",onKeydown:[ze(_e(g,["prevent"]),["enter"]),ze(_e(m,["prevent"]),["escape"])]},null,40,gf),[[Ee,b.value]]),c("button",{class:"va-stree__op",type:"button","aria-label":"确认创建",onClick:g},[B(r(Gt),{size:14})]),c("button",{class:"va-stree__op",type:"button","aria-label":"取消",onClick:m},[B(r(mt),{size:14})])])):A("",!0)]),_:1}),v.value?A("",!0):(f(),h("button",{key:1,class:"va-stree__new",type:"button",disabled:n.disabled,onClick:_},[B(r(Rn),{size:15,"aria-hidden":"true"}),P[6]||(P[6]=G("新建工作区",-1))],8,kf)),n.searchable?(f(),h("label",bf,[B(r(No),{size:13,"aria-hidden":"true"}),ye(c("input",{"onUpdate:modelValue":P[1]||(P[1]=L=>d.value=L),type:"text",placeholder:"搜索会话","aria-label":"搜索会话"},null,512),[[Ee,d.value]])])):A("",!0),(f(!0),h(j,null,Q(V.value,L=>(f(),h("section",{key:L.workspace.id,class:"va-stree__group","data-current":L.workspace.id===n.currentWorkspaceId||void 0},[c("div",wf,[n.collapsible?(f(),h("button",{key:0,class:"va-stree__toggle",type:"button","aria-label":i(L.workspace.id)?`收起 ${L.workspace.name} 的会话`:`展开 ${L.workspace.name} 的会话`,onClick:_e(q=>o(L.workspace.id),["stop"])},[i(L.workspace.id)?(f(),H(r(Dt),{key:0,size:13,"aria-hidden":"true"})):(f(),H(r(ks),{key:1,size:13,"aria-hidden":"true"}))],8,xf)):A("",!0),c("span",{class:"va-stree__ws",title:L.workspace.description||L.workspace.name},[c("span",Cf,[B(r(Uo),{size:14})]),c("span",Af,C(L.workspace.name),1),c("span",Df,C(L.sessions.length),1),L.workspace.id===n.currentWorkspaceId?(f(),h("span",Rf,"当前")):A("",!0)],8,$f),c("button",{class:"va-stree__op",type:"button","aria-label":"在此工作区新建会话",disabled:n.disabled,onClick:_e(q=>le(L.workspace.id),["stop"])},[B(r(Rn),{size:14})],8,Ef),c("button",{class:"va-stree__op",type:"button","data-danger":te.value===L.workspace.id||void 0,"aria-label":te.value===L.workspace.id?"确认删除工作区":"删除工作区",disabled:n.disabled,onClick:_e(q=>ne(L.workspace.id),["stop"])},[te.value===L.workspace.id?(f(),h("span",Mf,"确认?")):(f(),H(r(yn),{key:1,size:13}))],8,Sf)]),B(Ct,{name:"va-stree-fold"},{default:oe(()=>[i(L.workspace.id)?(f(),h("div",Tf,[c("div",Ff,[(f(!0),h(j,null,Q(L.sessions,q=>(f(),h("div",{key:q.id,class:"va-stree__session","data-active":q.id===n.currentSessionId||void 0},[k.value===q.id?(f(),h(j,{key:0},[ye(c("input",{"onUpdate:modelValue":P[2]||(P[2]=fe=>w.value=fe),class:"va-stree__input",type:"text",onKeydown:[ze(_e(y,["prevent"]),["enter"]),ze(_e($,["prevent"]),["escape"])]},null,40,Bf),[[Ee,w.value]]),c("button",{class:"va-stree__op",type:"button","aria-label":"确认重命名",onClick:y},[B(r(Gt),{size:14})]),c("button",{class:"va-stree__op",type:"button","aria-label":"取消",onClick:$},[B(r(mt),{size:14})])],64)):(f(),h(j,{key:1},[c("button",{class:"va-stree__session-main",type:"button",title:Z(q),onClick:fe=>ie(q)},[q.waitingApproval?(f(),h("span",Pf)):q.running?(f(),h("span",Lf)):q.pinned?(f(),H(r(bn),{key:2,class:"va-stree__pin",size:11,"aria-hidden":"true"})):A("",!0),c("span",Of,C(Z(q)),1),q.waitingApproval?(f(),h("span",jf,"待审批")):A("",!0),c("span",Uf,C(Y(q.updatedAt)),1)],8,zf),c("button",{class:"va-stree__op",type:"button","aria-label":q.pinned?"取消置顶":"置顶",disabled:n.disabled,onClick:_e(fe=>a("togglePin",q.id),["stop"])},[q.pinned?(f(),H(r(bs),{key:0,size:13})):(f(),H(r(bn),{key:1,size:13}))],8,Nf),c("button",{class:"va-stree__op",type:"button","aria-label":"重命名",disabled:n.disabled,onClick:_e(fe=>x(q),["stop"])},[B(r(ya),{size:13})],8,qf),c("button",{class:"va-stree__op",type:"button","aria-label":"归档",disabled:n.disabled,onClick:_e(fe=>a("archive",q.id,!0),["stop"])},[B(r(gs),{size:13})],8,Wf),c("button",{class:"va-stree__op",type:"button","data-danger":D.value===q.id||void 0,"aria-label":D.value===q.id?"确认删除":"删除",disabled:n.disabled,onClick:_e(fe=>K(q.id),["stop"])},[D.value===q.id?(f(),h("span",Jf,"确认?")):(f(),H(r(yn),{key:1,size:13}))],8,Vf)],64))],8,If))),128)),L.sessions.length===0?(f(),h("p",Kf,C(p.value?"无匹配会话":"暂无会话"),1)):A("",!0)])])):A("",!0)]),_:2},1024)],8,yf))),128)),p.value&&V.value.every(L=>L.sessions.length===0)&&X.value.length===0?(f(),h("p",Hf," 没有匹配「"+C(d.value.trim())+"」的会话 ",1)):A("",!0),X.value.length?(f(),h("section",Zf,[c("div",Xf,[c("span",Gf,[P[7]||(P[7]=c("span",{class:"va-stree__ws-name"},"未分组",-1)),c("span",Yf,C(X.value.length),1)])]),c("div",Qf,[c("div",ev,[(f(!0),h(j,null,Q(X.value,L=>(f(),h("div",{key:L.id,class:"va-stree__session","data-active":L.id===n.currentSessionId||void 0},[k.value===L.id?(f(),h(j,{key:0},[ye(c("input",{"onUpdate:modelValue":P[3]||(P[3]=q=>w.value=q),class:"va-stree__input",type:"text",onKeydown:[ze(_e(y,["prevent"]),["enter"]),ze(_e($,["prevent"]),["escape"])]},null,40,nv),[[Ee,w.value]]),c("button",{class:"va-stree__op",type:"button","aria-label":"确认重命名",onClick:y},[B(r(Gt),{size:14})]),c("button",{class:"va-stree__op",type:"button","aria-label":"取消",onClick:$},[B(r(mt),{size:14})])],64)):(f(),h(j,{key:1},[c("button",{class:"va-stree__session-main",type:"button",title:Z(L),onClick:q=>ie(L)},[L.waitingApproval?(f(),h("span",sv)):L.running?(f(),h("span",ov)):L.pinned?(f(),H(r(bn),{key:2,class:"va-stree__pin",size:11,"aria-hidden":"true"})):A("",!0),c("span",iv,C(Z(L)),1),L.waitingApproval?(f(),h("span",lv,"待审批")):A("",!0),c("span",rv,C(Y(L.updatedAt)),1)],8,av),c("button",{class:"va-stree__op",type:"button","aria-label":L.pinned?"取消置顶":"置顶",disabled:n.disabled,onClick:_e(q=>a("togglePin",L.id),["stop"])},[L.pinned?(f(),H(r(bs),{key:0,size:13})):(f(),H(r(bn),{key:1,size:13}))],8,uv),c("button",{class:"va-stree__op",type:"button","aria-label":"重命名",disabled:n.disabled,onClick:_e(q=>x(L),["stop"])},[B(r(ya),{size:13})],8,cv),c("button",{class:"va-stree__op",type:"button","aria-label":"归档",disabled:n.disabled,onClick:_e(q=>a("archive",L.id,!0),["stop"])},[B(r(gs),{size:13})],8,dv),c("button",{class:"va-stree__op",type:"button","data-danger":D.value===L.id||void 0,"aria-label":D.value===L.id?"确认删除":"删除",disabled:n.disabled,onClick:_e(q=>K(L.id),["stop"])},[D.value===L.id?(f(),h("span",vv,"确认?")):(f(),H(r(yn),{key:1,size:13}))],8,fv)],64))],8,tv))),128))])])])):A("",!0),n.archived.length&&!p.value?(f(),h("div",pv,[c("button",{class:"va-stree__archived-toggle",type:"button",onClick:P[4]||(P[4]=L=>J.value=!J.value)},[G(" 已归档("+C(n.archived.length)+") ",1),J.value?(f(),H(r(Dt),{key:0,size:14,"aria-hidden":"true"})):(f(),H(r(ks),{key:1,size:14,"aria-hidden":"true"}))]),B(Ct,{name:"va-stree-fold"},{default:oe(()=>[J.value?(f(),h("div",hv,[c("div",_v,[(f(!0),h(j,null,Q(n.archived,L=>(f(),h("div",{key:L.id,class:"va-stree__session","data-archived":"true"},[c("span",mv,[c("span",gv,C(Z(L)),1),c("span",kv,C(Y(L.updatedAt)),1)]),c("button",{class:"va-stree__op",type:"button","aria-label":"恢复",disabled:n.disabled,onClick:_e(q=>a("archive",L.id,!1),["stop"])},[B(r(gc),{size:13})],8,bv),c("button",{class:"va-stree__op",type:"button","data-danger":D.value===L.id||void 0,"aria-label":D.value===L.id?"确认删除":"删除",disabled:n.disabled,onClick:_e(q=>K(L.id),["stop"])},[D.value===L.id?(f(),h("span",wv,"确认?")):(f(),H(r(yn),{key:1,size:13}))],8,yv)]))),128))])])):A("",!0)]),_:1})])):A("",!0),T.$slots.footer?(f(),h("footer",xv,[xe(T.$slots,"footer")])):A("",!0)],8,hf))}}),Cv=["不够准确","太啰嗦","没听懂指令"];function Pa(e,t){const n=S(!1);let a;async function s(){const o=e();try{if(typeof navigator<"u"&&navigator.clipboard)await navigator.clipboard.writeText(o);else if(typeof document<"u"){const i=document.createElement("textarea");i.value=o,document.body.appendChild(i),i.select(),document.execCommand("copy"),i.remove()}}catch{}n.value=!0,t?.(o),a!==void 0&&window.clearTimeout(a),a=window.setTimeout(()=>n.value=!1,1500)}return Pe(()=>{a!==void 0&&window.clearTimeout(a)}),{copied:n,copy:s}}function Av(e,t,n){const{copied:a,copy:s}=Pa(()=>e.text??"",k=>n.copy(k)),o=S(null),i=S(!1),l=R(()=>e.reasons??Cv),d=S("");function u(k){if(k==="up"){o.value=o.value==="up"?null:"up",i.value=!1,n.feedback(o.value);return}if(i.value){i.value=!1;return}o.value="down",i.value=!0,d.value=""}function p(k){o.value="down",i.value=!1,n.feedback("down",k||void 0)}function v(){o.value=null,i.value=!1,n.feedback(null)}const b=R(()=>typeof e.versions=="number"?Math.max(1,e.versions):1),_=R(()=>b.value>=2),g=R(()=>{const k=t.value;return k==null||k<0||k>=b.value?b.value-1:k});function m(k){const w=Math.min(b.value-1,Math.max(0,g.value+k));t.value=w,n.versionChange(w)}return{copied:a,copy:s,chosen:o,panelOpen:i,reasons:l,customReason:d,thumb:u,sendDown:p,takeBack:v,count:b,effective:g,showVersions:_,go:m}}const Dv={class:"va-msg__bar"},Rv=["aria-label"],Ev=["aria-label"],Sv={key:0,class:"va-msg__versions"},Mv=["disabled"],Tv={class:"va-msg__ver-label"},Fv=["disabled"],Iv=["aria-pressed"],Bv=["aria-pressed"],zv={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",style:{transform:"rotate(180deg)"}},Pv={key:0,class:"va-msg__panel"},Lv={class:"va-msg__reasons"},Ov=["onClick"],jv={class:"va-msg__other"},Uv=["disabled"],Nv=ce({__name:"VaMessageActions",props:Lt({text:{default:void 0},versions:{default:void 0},regenerating:{type:Boolean,default:!1},quiet:{type:Boolean,default:!1},reasons:{default:void 0}},{version:{},versionModifiers:{}}),emits:Lt(["copy","regenerate","versionChange","feedback"],["update:version"]),setup(e,{emit:t}){const n=e,a=t,s=Ln(e,"version"),{copied:o,copy:i,chosen:l,panelOpen:d,reasons:u,customReason:p,thumb:v,sendDown:b,takeBack:_,count:g,effective:m,showVersions:k,go:w}=Av(n,s,{copy:x=>a("copy",x),regenerate:()=>a("regenerate"),versionChange:x=>a("versionChange",x),feedback:(x,y)=>a("feedback",x,y)});return(x,y)=>(f(),h("div",{class:ue(["va-msg",{"va-msg--quiet":n.quiet,"va-msg--panel":r(d)}])},[c("div",Dv,[c("button",{class:"va-msg__act",type:"button","aria-label":r(o)?"已复制":"复制",onClick:y[0]||(y[0]=(...$)=>r(i)&&r(i)(...$))},[c("span",{class:ue(["va-copy",{"va-copy--done":r(o)}]),"aria-hidden":"true"},[...y[10]||(y[10]=[c("svg",{class:"va-copy__idle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round"},[c("path",{d:"M9 9.5A1.5 1.5 0 0 1 10.5 8h8A1.5 1.5 0 0 1 20 9.5v9a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 9 18.5zM15 8V5.5A1.5 1.5 0 0 0 13.5 4h-8A1.5 1.5 0 0 0 4 5.5v9A1.5 1.5 0 0 0 5.5 16H9"})],-1),c("svg",{class:"va-copy__done",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round"},[c("path",{d:"M5.5 12.5l4 4L18.5 8"})],-1)])],2)],8,Rv),c("button",{class:"va-msg__act",type:"button","aria-label":n.regenerating?"再生成中":"再生成",onClick:y[1]||(y[1]=$=>a("regenerate"))},[(f(),h("svg",{class:ue({"va-msg__spin":n.regenerating}),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[...y[11]||(y[11]=[c("path",{d:"M19.5 12a7.5 7.5 0 1 1-2.2-5.3L19.5 9M19.5 4.5V9H15"},null,-1)])],2))],8,Ev),r(k)?(f(),h("span",Sv,[c("button",{class:"va-msg__act",type:"button","aria-label":"上一版本",disabled:r(m)<=0,onClick:y[2]||(y[2]=$=>r(w)(-1))},[...y[12]||(y[12]=[c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"m14.5 7-5 5 5 5"})],-1)])],8,Mv),c("span",Tv,C(r(m)+1)+" / "+C(r(g)),1),c("button",{class:"va-msg__act",type:"button","aria-label":"下一版本",disabled:r(m)>=r(g)-1,onClick:y[3]||(y[3]=$=>r(w)(1))},[...y[13]||(y[13]=[c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","aria-hidden":"true"},[c("path",{d:"m9.5 7 5 5-5 5"})],-1)])],8,Fv)])):A("",!0),y[16]||(y[16]=c("span",{class:"va-msg__sep","aria-hidden":"true"},null,-1)),c("button",{class:ue(["va-msg__act",{"va-msg__act--on":r(l)==="up"}]),type:"button","aria-label":"赞","aria-pressed":r(l)==="up",onClick:y[4]||(y[4]=$=>r(v)("up"))},[...y[14]||(y[14]=[c("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[c("path",{d:"M7.5 10.5v9M7.5 10.5l3.3-6a1.8 1.8 0 0 1 3.3 1.2l-.6 3.8H18a2 2 0 0 1 2 2.3l-1.2 6.4a2 2 0 0 1-2 1.8H5a1 1 0 0 1-1-1v-7.5a1 1 0 0 1 1-1z"})],-1)])],10,Iv),c("button",{class:ue(["va-msg__act",{"va-msg__act--on":r(l)==="down"}]),type:"button","aria-label":"踩","aria-pressed":r(l)==="down",onClick:y[5]||(y[5]=$=>r(v)("down"))},[(f(),h("svg",zv,[...y[15]||(y[15]=[c("path",{d:"M7.5 10.5v9M7.5 10.5l3.3-6a1.8 1.8 0 0 1 3.3 1.2l-.6 3.8H18a2 2 0 0 1 2 2.3l-1.2 6.4a2 2 0 0 1-2 1.8H5a1 1 0 0 1-1-1v-7.5a1 1 0 0 1 1-1z"},null,-1)])]))],10,Bv)]),B(Ct,{name:"va-msg-panel"},{default:oe(()=>[r(d)?(f(),h("div",Pv,[y[17]||(y[17]=c("p",{class:"va-msg__panel-title"},"哪里不满意?",-1)),c("div",Lv,[(f(!0),h(j,null,Q(r(u),$=>(f(),h("button",{key:$,class:"va-msg__reason",type:"button",onClick:D=>r(b)($)},C($),9,Ov))),128))]),c("div",jv,[ye(c("input",{"onUpdate:modelValue":y[6]||(y[6]=$=>tn(p)?p.value=$:null),class:"va-msg__other-input",type:"text",placeholder:"其他原因…",onKeydown:y[7]||(y[7]=ze($=>r(b)(r(p)),["enter"]))},null,544),[[Ee,r(p)]]),c("button",{class:"va-msg__reason va-msg__reason--go",type:"button",disabled:!r(p).trim(),onClick:y[8]||(y[8]=$=>r(b)(r(p)))},"发送",8,Uv),c("button",{class:"va-msg__reason",type:"button",onClick:y[9]||(y[9]=(...$)=>r(_)&&r(_)(...$))},"撤回反馈")])])):A("",!0)]),_:1})],2))}});function qv(e,t,n){const a=S({left:0,width:0}),s=R(()=>Math.max(0,e.options.findIndex(u=>u.value===t.value)));function o(){const u=n.value;if(!u||typeof window>"u")return;const p=u.querySelector(`[data-idx="${s.value}"]`);p&&(a.value={left:p.offsetLeft,width:p.offsetWidth})}function i(){o()}ve(()=>[e.options,t.value],()=>{Se(o)},{deep:!1}),Le(()=>{Se(o),typeof window<"u"&&window.addEventListener("resize",i)}),Pe(()=>{typeof window<"u"&&window.removeEventListener("resize",i)});function l(u){t.value=u}function d(u){const p=e.options,v=s.value,b=u.key==="ArrowRight"||u.key==="ArrowDown"?1:u.key==="ArrowLeft"||u.key==="ArrowUp"?-1:0;if(b===0&&u.key!=="Home"&&u.key!=="End")return;let _=u.key==="Home"?0:u.key==="End"?p.length-1:(v+b+p.length)%p.length,g=p.length;for(;p[_]?.disabled&&g-- >0;)_=(_+b+p.length)%p.length;const m=p[_];!m||m.disabled||(u.preventDefault(),t.value=m.value,n.value?.querySelector(`[data-idx="${_}"]`)?.focus())}return{indicator:a,activeIdx:s,select:l,onKeydown:d}}const Wv=["aria-label"],Vv=["data-idx","data-active","aria-checked","tabindex","disabled","onClick"],Wo=ce({__name:"VaSegmentedControl",props:Lt({options:{},size:{default:"md"},fullWidth:{type:Boolean,default:!1},ariaLabel:{default:void 0}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,n=Ln(e,"modelValue"),a=Re("root"),{indicator:s,activeIdx:o,select:i,onKeydown:l}=qv(t,n,a);return(d,u)=>(f(),h("div",{ref_key:"root",ref:a,class:ue(["va-seg",[`va-seg--${t.size}`,{"va-seg--full":t.fullWidth}]]),role:"radiogroup","aria-label":t.ariaLabel,onKeydown:u[0]||(u[0]=(...p)=>r(l)&&r(l)(...p))},[c("span",{class:"va-seg__thumb","aria-hidden":"true",style:be({transform:`translateX(${r(s).left}px)`,width:`${r(s).width}px`})},null,4),(f(!0),h(j,null,Q(t.options,(p,v)=>(f(),h("button",{key:p.value,class:"va-seg__btn","data-idx":v,"data-active":n.value===p.value||void 0,type:"button",role:"radio","aria-checked":n.value===p.value,tabindex:v===r(o)?0:-1,disabled:p.disabled,onClick:b=>r(i)(p.value)},C(p.label),9,Vv))),128))],42,Wv))}}),Mn=vt({toasts:[]});let Jv=0;function Vo(e){const t=Mn.toasts.findIndex(n=>n.id===e);t>=0&&Mn.toasts.splice(t,1)}function Kv(e){const t={id:++Jv,kind:"info",duration:4200,...e};return Mn.toasts.push(t),t.duration>0&&typeof window<"u"&&window.setTimeout(()=>Vo(t.id),t.duration),t.id}const he={state:Mn,add:Kv,dismiss:Vo},Hv=["data-kind"],Zv={class:"va-toast__icon","aria-hidden":"true"},Xv={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round"},Gv={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},Yv={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},Qv={key:3,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},ep={class:"va-toast__body"},tp={class:"va-toast__title"},np={key:0,class:"va-toast__desc"},ap=["onClick"],sp=ce({__name:"VaToaster",props:{position:{default:"bottom-right"}},setup(e){const t=new Map;let n=new Set;return ve(()=>he.state.toasts.map(a=>a.id),a=>{let s=0;for(const o of a)n.has(o)||(t.set(o,Math.min(s,8)*40),s++);n=new Set(a);for(const o of[...t.keys()])n.has(o)||t.delete(o)},{immediate:!0}),(a,s)=>(f(),h("div",{class:ue(["va-toast",`va-toast--${e.position}`]),"aria-live":"polite",role:"status"},[B(Pt,{name:"va-toast"},{default:oe(()=>[(f(!0),h(j,null,Q(r(he).state.toasts,o=>(f(),h("div",{key:o.id,class:"va-toast__item","data-kind":o.kind,style:be({"--va-toast-stagger":`${r(t).get(o.id)??0}ms`})},[c("span",Zv,[o.kind==="success"?(f(),h("svg",Xv,[...s[0]||(s[0]=[c("path",{d:"M5.5 12.5l4 4L18.5 8"},null,-1)])])):o.kind==="danger"?(f(),h("svg",Gv,[...s[1]||(s[1]=[c("circle",{cx:"12",cy:"12",r:"9"},null,-1),c("path",{d:"M12 8v4.5M12 16h.01"},null,-1)])])):o.kind==="warning"?(f(),h("svg",Yv,[...s[2]||(s[2]=[c("path",{d:"M12 9v4M12 16.5h.01M10.3 3.9 2.8 17a2 2 0 0 0 1.7 3h15a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"},null,-1)])])):(f(),h("svg",Qv,[...s[3]||(s[3]=[c("circle",{cx:"12",cy:"12",r:"9"},null,-1),c("path",{d:"M12 11v5M12 8h.01"},null,-1)])]))]),c("div",ep,[c("p",tp,C(o.title),1),o.description?(f(),h("p",np,C(o.description),1)):A("",!0)]),c("button",{class:"va-toast__close",type:"button","aria-label":"关闭通知",onClick:i=>r(he).dismiss(o.id)},"×",8,ap)],12,Hv))),128))]),_:1})],2))}});function ws(e){if(e==="")return[];const t=e.replace(/\r\n?/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`);return t[t.length-1]===""&&e.endsWith(`
|
|
4
|
+
`)&&t.pop(),t}const op=4e6;function ip(e,t){const n=ws(e),a=ws(t),s=n.length,o=a.length;if(s*o>op)return[...n.map((v,b)=>({type:"del",oldNo:b+1,text:v})),...a.map((v,b)=>({type:"add",newNo:b+1,text:v}))];const i=Array.from({length:s+1},()=>new Uint32Array(o+1));for(let v=s-1;v>=0;v--)for(let b=o-1;b>=0;b--)i[v][b]=n[v]===a[b]?i[v+1][b+1]+1:Math.max(i[v+1][b],i[v][b+1]);const l=[];let d=0,u=0;const p=()=>l.push({type:"same",oldNo:d+1,newNo:u+1,text:n[d]});for(;d<s&&u<o;)n[d]===a[u]?(p(),d++,u++):i[d+1][u]>=i[d][u+1]?(l.push({type:"del",oldNo:d+1,text:n[d]}),d++):(l.push({type:"add",newNo:u+1,text:a[u]}),u++);for(;d<s;)l.push({type:"del",oldNo:d+1,text:n[d]}),d++;for(;u<o;)l.push({type:"add",newNo:u+1,text:a[u]}),u++;return l}function lp(e){const t=[];for(const n of e){const a=n.sp&&t.length>0?" ":"",s=t[t.length-1];s&&s.kind===n.type?s.text+=a+n.t:t.push({kind:n.type,text:a+n.t})}return t}function rp(e,t=!0){const n=new Array(e.length).fill(void 0);if(!t)return n;let a=0;for(;a<e.length;){if(e[a].type!=="del"){a++;continue}const s=a;for(;a<e.length&&e[a].type==="del";)a++;const o=a,i=a;for(;a<e.length&&e[a].type==="add";)a++;const l=a,d=Math.min(o-s,l-i);for(let u=0;u<d;u++){const p=e[s+u].text,v=e[i+u].text;if(p===v)continue;const b=[],_=[];for(const g of lp(fc(p,v)))(g.kind==="del"||g.kind==="same")&&b.push({kind:g.kind,text:g.text}),(g.kind==="add"||g.kind==="same")&&_.push({kind:g.kind,text:g.text});n[s+u]={del:b,add:_}}}return n}function Jo(e){return`${e.from}-${e.to}`}function up(e,t=3,n,a){const s=new Uint8Array(e.length);e.forEach((l,d)=>{if(l.type!=="same")for(let u=Math.max(0,d-t);u<=Math.min(e.length-1,d+t);u++)s[u]=1});const o=[];let i=0;for(;i<e.length;){if(s[i]){const b=e[i];o.push(b.type==="same"?{kind:"row",row:b}:{kind:"row",row:b,inline:n?.[i]}),i++;continue}const l=i;for(;i<e.length&&!s[i];)i++;const d=e[l].oldNo??e[l].newNo??l+1,u=e[i-1],p=u.oldNo??u.newNo??i,v=Jo({from:d,to:p});if(a?.has(v))for(let b=l;b<i;b++){const _=e[b];o.push(_.type==="same"?{kind:"row",row:_}:{kind:"row",row:_,inline:n?.[b]})}else o.push({kind:"expand",count:i-l,from:d,to:p})}return o}function cp(e){const t=R(()=>e.defaultExpandAll?Number.POSITIVE_INFINITY:e.context??3),n=R(()=>ip(e.oldText,e.newText)),a=R(()=>rp(n.value,e.wordLevel!==!1)),s=R(()=>{let v=0,b=0;for(const _ of n.value)_.type==="add"?v++:_.type==="del"&&b++;return{additions:v,deletions:b}}),o=S(new Set);ve([()=>e.oldText,()=>e.newText],()=>{o.value=new Set});const i=R(()=>up(n.value,t.value,a.value,o.value)),l=R(()=>i.value.some(v=>v.kind==="expand")),d=S(e.defaultExpandAll??!1);ve(d,v=>{v||(o.value=new Set)});function u(v){const b=new Set(o.value);b.add(Jo(v)),o.value=b}const p=R(()=>n.value.length===0||s.value.additions+s.value.deletions===0);return{render:i,stats:s,hasCollapsed:l,expandAll:d,toggleExpand:u,empty:p,rows:n,inline:a}}const dp={class:"va-cdiff"},fp={class:"va-cdiff__head"},vp={key:0,class:"va-cdiff__file"},pp={class:"va-cdiff__stats",role:"status"},hp=["aria-pressed"],_p=["aria-label"],mp=["aria-label"],gp={key:0,class:"va-cdiff__empty"},kp={key:1,class:"va-cdiff__side"},bp=["data-type"],yp={class:"va-cdiff__no","aria-hidden":"true"},wp=["data-side"],xp=["data-kind"],$p={class:"va-cdiff__no","aria-hidden":"true"},Cp=["data-side"],Ap=["data-kind"],Dp=["data-type"],Rp={class:"va-cdiff__no","aria-hidden":"true"},Ep={class:"va-cdiff__no","aria-hidden":"true"},Sp={class:"va-cdiff__sign","aria-hidden":"true"},Mp={class:"va-cdiff__code"},Tp=["data-seg"],Fp=["title","onClick"],xs=ce({__name:"VaCodeDiff",props:{oldText:{},newText:{},fileName:{},context:{},wordLevel:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean},maxHeight:{},layout:{default:"unified"}},emits:["copy"],setup(e,{emit:t}){const n=e,a=t,{render:s,stats:o,hasCollapsed:i,expandAll:l,toggleExpand:d,empty:u,rows:p,inline:v}=cp(n),{copied:b,copy:_}=Pa(()=>n.newText,k=>a("copy",k)),g=k=>k==="add"?"+":k==="del"?"−":"",m=R(()=>{if(n.layout!=="side")return[];const k=p.value,w=v.value,x=[];let y=0;const $=(D,M)=>{const N=w[M];return D.type==="del"&&N?{no:D.oldNo,text:D.text,segs:N.del}:D.type==="add"&&N?{no:D.newNo,text:D.text,segs:N.add}:{no:D.oldNo??D.newNo,text:D.text}};for(;y<k.length;){if(k[y].type==="same"){x.push({type:"eq",left:$(k[y],y),right:$(k[y],y)}),y++;continue}const D=y;for(;y<k.length&&k[y].type==="del";)y++;const M=y,N=y;for(;y<k.length&&k[y].type==="add";)y++;const K=y,te=M-D,ne=K-N,V=Math.max(te,ne);for(let X=0;X<V;X++){const O=D+X,J=N+X;x.push({type:O<M&&J<K?"pair":O<M?"del":"add",left:O<M?$(k[O],O):void 0,right:J<K?$(k[J],J):void 0})}}return x});return(k,w)=>(f(),h("figure",dp,[c("header",fp,[n.fileName?(f(),h("span",vp,C(n.fileName),1)):A("",!0),c("span",pp,[r(u)?(f(),h(j,{key:1},[G("无变更")],64)):(f(),h(j,{key:0},[G("+"+C(r(o).additions)+" −"+C(r(o).deletions),1)],64))]),w[3]||(w[3]=c("span",{class:"va-cdiff__spacer"},null,-1)),r(i)?(f(),h("button",{key:1,class:"va-act va-act--sm va-cdiff__btn",type:"button","aria-pressed":r(l),onClick:w[0]||(w[0]=x=>l.value=!r(l))},C(r(l)?"折叠上下文":"全部展开"),9,hp)):A("",!0),c("button",{class:"va-act va-act--sm va-cdiff__btn",type:"button","aria-label":r(b)?"已复制":"复制新文件内容",onClick:w[1]||(w[1]=(...x)=>r(_)&&r(_)(...x))},[c("span",{class:ue(["va-copy",{"va-copy--done":r(b)}]),"aria-hidden":"true"},[...w[2]||(w[2]=[c("span",{class:"va-copy__idle"},"复制新文件",-1),c("span",{class:"va-copy__done"},"已复制 ✓",-1)])],2)],8,_p)]),c("div",{class:"va-cdiff__body",style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0),tabindex:"0",role:"region","aria-label":`代码差异${n.fileName?`:${n.fileName}`:""}`},[r(u)?(f(),h("p",gp,"两个版本内容一致。")):A("",!0),!r(u)&&n.layout==="side"?(f(),h("div",kp,[(f(!0),h(j,null,Q(m.value,(x,y)=>(f(),h("div",{key:y,class:"va-cdiff__srow","data-type":x.type},[c("span",yp,C(x.left?.no??""),1),c("code",{class:"va-cdiff__code va-cdiff__code--half","data-side":x.left?"old":"empty"},[x.left?.segs?(f(!0),h(j,{key:0},Q(x.left.segs,($,D)=>(f(),h("span",{key:D,class:"va-cdiff__seg","data-kind":$.kind},C($.text),9,xp))),128)):(f(),h(j,{key:1},[G(C(x.left?.text??""),1)],64))],8,wp),c("span",$p,C(x.right?.no??""),1),c("code",{class:"va-cdiff__code va-cdiff__code--half","data-side":x.right?"new":"empty"},[x.right?.segs?(f(!0),h(j,{key:0},Q(x.right.segs,($,D)=>(f(),h("span",{key:D,class:"va-cdiff__seg","data-kind":$.kind},C($.text),9,Ap))),128)):(f(),h(j,{key:1},[G(C(x.right?.text??""),1)],64))],8,Cp)],8,bp))),128))])):A("",!0),!r(u)&&n.layout!=="side"?(f(!0),h(j,{key:2},Q(r(s),(x,y)=>(f(),h(j,{key:y},[x.kind==="row"?(f(),h("div",{key:0,class:"va-cdiff__row","data-type":x.row.type},[c("span",Rp,C(x.row.oldNo??""),1),c("span",Ep,C(x.row.newNo??""),1),c("span",Sp,C(g(x.row.type)),1),c("code",Mp,[x.inline?(f(!0),h(j,{key:0},Q(x.row.type==="del"?x.inline.del:x.inline.add,($,D)=>(f(),h("span",{key:D,class:"va-cdiff__seg","data-seg":$.kind},C($.text),9,Tp))),128)):(f(),h(j,{key:1},[G(C(x.row.text),1)],64))])],8,Dp)):(f(),h("button",{key:1,class:"va-cdiff__expand",type:"button","aria-expanded":!1,title:`展开第 ${x.from}–${x.to} 行`,onClick:$=>r(d)(x)}," ⋯ 展开隐藏的 "+C(x.count)+" 行 ",9,Fp))],64))),128)):A("",!0)],12,mp)]))}}),xa={modified:"M",added:"A",deleted:"D",untracked:"U"};function Ip(e,t){const n=[],a=(s,o)=>{for(const i of s){const l=i.type==="dir"||(i.children?.length??0)>0,d=l&&t(i.path);n.push({node:i,level:o,isDir:l,expanded:d}),d&&i.children?.length&&a(i.children,o+1)}};return a(e,1),n}function $a(e){return e.children?.length?e.children.reduce((t,n)=>t+$a(n),0):e.status?1:0}function Bp(e){const t=S(new Set);ve(()=>e.tree,v=>{const b=new Set,_=e.defaultExpandDepth??1,g=(m,k)=>{for(const w of m)w.children?.length&&k<=_&&(b.add(w.path),g(w.children,k+1))};g(v,1),t.value=b},{immediate:!0});function n(v,b){const _=new Set(t.value),g=b??!_.has(v);return g?_.add(v):_.delete(v),t.value=_,g}const a=S(!1),s=S(e.defaultSelected),o=R(()=>e.selected!==void 0||a.value?e.selected:s.value);function i(v){return a.value=!0,s.value=v,v}const l=R(()=>Ip(e.tree,v=>t.value.has(v))),d=S(l.value[0]?.node.path);ve(l,v=>{v.some(b=>b.node.path===d.value)||(d.value=v[0]?.node.path)});function u(v){const b=l.value,_=b.findIndex(m=>m.node.path===d.value),g=b[Math.min(b.length-1,Math.max(0,_+v))];g&&(d.value=g.node.path)}function p(v){return d.value===v}return{expanded:t,toggleDir:n,currentSelected:o,select:i,rows:l,focusedPath:d,moveFocus:u,isActive:p}}const zp={class:"va-ftree"},Pp={key:0,class:"va-ftree__head"},Lp=["aria-label"],Op=["aria-level","aria-expanded","aria-selected","data-active","tabindex","onClick","onKeydown"],jp=["data-open"],Up={key:1,class:"va-ftree__dot","aria-hidden":"true"},Np={class:"va-ftree__name"},qp={key:2,class:"va-ftree__count","aria-label":"含变更文件"},Wp=["data-status","title"],Vp={key:0,class:"va-ftree__empty va-fade-in"},Ca=ce({__name:"VaFileTree",props:{tree:{},defaultExpandDepth:{},selected:{},defaultSelected:{},title:{},maxHeight:{},lazy:{type:Boolean,default:!1}},emits:["update:selected","select","toggle","load","open"],setup(e,{emit:t}){const n=e,a=t,s={modified:"已修改",added:"新增",deleted:"删除",untracked:"未跟踪"},{toggleDir:o,currentSelected:i,select:l,rows:d,moveFocus:u,isActive:p}=Bp(n),v=S(null);function b(w){n.lazy&&w.isDir&&!w.expanded&&w.node.children===void 0&&a("load",w.node)}function _(w){if(w.isDir){b(w);const x=o(w.node.path);a("toggle",w.node,x);return}a("update:selected",l(w.node.path)),a("select",w.node),a("open",w.node)}function g(){Se(()=>v.value?.querySelector("[data-active='true']")?.focus())}function m(w,x){switch(w.key){case"ArrowUp":w.preventDefault(),u(-1),g();break;case"ArrowDown":w.preventDefault(),u(1),g();break;case"ArrowRight":x.isDir&&!x.expanded&&(w.preventDefault(),b(x),a("toggle",x.node,o(x.node.path,!0)));break;case"ArrowLeft":if(x.isDir&&x.expanded)w.preventDefault(),a("toggle",x.node,o(x.node.path,!1));else{const y=x.node.path.split("/").slice(0,-1).join("/");y&&(w.preventDefault(),k(y))}break;case"Enter":case" ":w.preventDefault(),_(x);break}}function k(w){const x=d.value.findIndex(y=>y.node.path===w);if(x>=0){const y=d.value.findIndex($=>p($.node.path));y>=0&&u(x-y),g()}}return(w,x)=>(f(),h("div",zp,[n.title?(f(),h("header",Pp,C(n.title),1)):A("",!0),c("div",{ref_key:"rootEl",ref:v,class:"va-ftree__body",role:"tree","aria-label":n.title||"文件树",style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0)},[(f(!0),h(j,null,Q(r(d),y=>(f(),h("div",{key:y.node.path,role:"treeitem","aria-level":y.level,"aria-expanded":y.isDir?y.expanded:void 0,"aria-selected":y.isDir?void 0:r(i)===y.node.path,"data-active":r(p)(y.node.path),tabindex:r(p)(y.node.path)?0:-1,class:ue(["va-ftree__row",{"va-ftree__row--dir":y.isDir,"va-ftree__row--selected":!y.isDir&&r(i)===y.node.path}]),style:be({paddingLeft:`${(y.level-1)*16+8}px`}),onClick:$=>_(y),onKeydown:$=>m($,y)},[y.isDir?(f(),h("span",{key:0,class:"va-ftree__caret","aria-hidden":"true","data-open":y.expanded||void 0},[B(r(Dt),{size:12})],8,jp)):(f(),h("span",Up)),c("span",Np,C(y.node.path.split("/").pop()),1),x[0]||(x[0]=c("span",{class:"va-ftree__spacer"},null,-1)),y.isDir&&r($a)(y.node)?(f(),h("span",qp,C(r($a)(y.node)),1)):A("",!0),y.node.status?(f(),h("span",{key:3,class:"va-ftree__status","data-status":y.node.status,title:`${r(xa)[y.node.status]} · ${s[y.node.status]}`},C(r(xa)[y.node.status]),9,Wp)):A("",!0)],46,Op))),128)),r(d).length?A("",!0):(f(),h("p",Vp,"没有文件。"))],12,Lp)]))}}),En=["#4f5b66","#e06c75","#98c379","#e5c07b","#61afef","#c678dd","#56b6c2","#abb2bf","#5c6370","#e06c75","#98c379","#e5c07b","#61afef","#c678dd","#56b6c2","#ffffff"];function Jp(e){if(e<16)return En[e];if(e<232){const n=e-16,a=[0,95,135,175,215,255],s=a[Math.floor(n/36)%6],o=a[Math.floor(n/6)%6],i=a[n%6];return`rgb(${s}, ${o}, ${i})`}const t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}const $s=/\x1b\[([0-9;:]*)([A-Za-z])/g,Kp=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;function Hp(e,t){let n=0;for(;n<t.length;){const a=t[n];if(a===0)e.color=e.bgColor=void 0,e.bold=e.dim=e.italic=e.underline=void 0;else if(a===1)e.bold=!0;else if(a===2)e.dim=!0;else if(a===3)e.italic=!0;else if(a===4)e.underline=!0;else if(a===22)e.bold=e.dim=void 0;else if(a===23)e.italic=void 0;else if(a===24)e.underline=void 0;else if(a>=30&&a<=37)e.color=En[a-30];else if(a===38||a===48){const s=t[n+1],o=a===38?"color":"bgColor";s===5&&t[n+2]!==void 0?(e[o]=Jp(t[n+2]),n+=2):s===2&&t[n+4]!==void 0&&(e[o]=`rgb(${t[n+2]}, ${t[n+3]}, ${t[n+4]})`,n+=4)}else a===39?e.color=void 0:a===49?e.bgColor=void 0:a>=90&&a<=97?e.color=En[a-90+8]:a>=100&&a<=107&&(e.bgColor=En[a-100+8]);n++}}function Cs(e,t,n){const a=n.color||n.bgColor||n.bold||n.dim||n.italic||n.underline;e.push(a?{text:t,...n}:{text:t})}function Zp(e){const t=e.split("\r");let n=t[t.length-1]??"";n=n.replace(Kp,"");const a=[],s={};let o="",i=0;$s.lastIndex=0;for(const l of n.matchAll($s)){if(l.index>i&&(o+=n.slice(i,l.index)),i=l.index+l[0].length,l[2]!=="m")continue;o&&(Cs(a,o,s),o="");const d=(l[1]??"").split(";").map(u=>u===""?0:Number.parseInt(u,10));Hp(s,d.length?d:[0])}return i<n.length&&(o+=n.slice(i)),o&&Cs(a,o,s),a}function Xp(e,t){const n=R(()=>{const u=e.maxLines??1e3,p=e.lines.map((v,b)=>typeof v=="string"?{text:v,id:String(b)}:{id:String(b),...v});return p.length>u?p.slice(p.length-u):p}),a=R(()=>n.value.map(u=>u.text.includes("\x1B")?Zp(u.text):[{text:u.text}])),s=u=>a.value[u].map(p=>p.text).join(""),o=S(!0);function i(){const u=t.value;u&&(o.value=u.scrollTop+u.clientHeight>=u.scrollHeight-32)}function l(){const u=t.value;if(!u)return;const p=typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1);u.scrollTo({top:u.scrollHeight,behavior:p?"auto":"smooth"})}ve(()=>e.lines.length,()=>{!e.autoScroll||!o.value||Se(l)});let d;return Le(()=>{const u=t.value;u&&e.autoScroll&&(u.scrollTop=u.scrollHeight),typeof ResizeObserver<"u"&&u&&(d=new ResizeObserver(()=>{o.value&&e.autoScroll&&(u.scrollTop=u.scrollHeight)}),d.observe(u))}),Pe(()=>d?.disconnect()),{rows:n,spans:a,plainText:s,onScroll:i}}const Gp={class:"va-term"},Yp={class:"va-term__head"},Qp={class:"va-term__title"},eh={key:0,class:"va-term__count"},th=["aria-label"],nh={key:0,class:"va-term__empty"},ah=["data-kind"],sh={key:0,class:"va-term__no","aria-hidden":"true"},oh={class:"va-term__code"},ih=["aria-label","onClick"],lh=ce({__name:"VaTerminalLog",props:{lines:{},title:{},autoScroll:{type:Boolean,default:!0},maxLines:{},showLineNumbers:{type:Boolean},maxHeight:{}},emits:["copy"],setup(e,{emit:t}){const n=e,a=t,s=Re("body"),{rows:o,spans:i,plainText:l,onScroll:d}=Xp(n,s),u=S(null),{copied:p,copy:v}=Pa(()=>u.value!==null?l(u.value):"");ve(p,g=>{g&&u.value!==null&&a("copy",l(u.value))});function b(g,m){m.stopPropagation(),u.value=g,v()}const _=(g,m)=>({color:g,backgroundColor:m});return(g,m)=>(f(),h("figure",Gp,[c("header",Yp,[m[1]||(m[1]=c("span",{class:"va-term__dots","aria-hidden":"true"},[c("i"),c("i"),c("i")],-1)),c("span",Qp,C(n.title??"terminal"),1),m[2]||(m[2]=c("span",{class:"va-term__spacer"},null,-1)),r(o).length?(f(),h("span",eh,C(r(o).length)+" 行",1)):A("",!0)]),c("div",{ref:"body",class:ue(["va-term__body",{"va-term__body--scroll":n.maxHeight}]),style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0),tabindex:"0",role:"log","aria-label":`${n.title??"终端"}输出`,onScroll:m[0]||(m[0]=(...k)=>r(d)&&r(d)(...k))},[r(o).length?A("",!0):(f(),h("p",nh,"等待输出…")),(f(!0),h(j,null,Q(r(o),(k,w)=>(f(),h("div",{key:k.id,class:"va-term__row","data-kind":k.kind??"out"},[n.showLineNumbers?(f(),h("span",sh,C(w+1),1)):A("",!0),c("code",oh,[(f(!0),h(j,null,Q(r(i)[w],(x,y)=>(f(),h("span",{key:y,style:be(_(x.color,x.bgColor)),class:ue({"va-term__b":x.bold,"va-term__i":x.italic,"va-term__u":x.underline,"va-term__dim":x.dim})},C(x.text),7))),128))]),c("button",{class:"va-term__copy",type:"button","aria-label":r(p)&&u.value===w?`第 ${w+1} 行已复制`:`复制第 ${w+1} 行`,onClick:x=>b(w,x)},[c("span",{class:ue(["va-copy",{"va-copy--done":r(p)&&u.value===w}]),"aria-hidden":"true"},[...m[3]||(m[3]=[c("span",{class:"va-copy__idle"},"⧉",-1),c("span",{class:"va-copy__done"},"✓",-1)])],2)],8,ih)],8,ah))),128))],46,th)]))}});function Ko(e,t=Date.now()){const n=Math.max(0,t-e),a=Math.floor(n/6e4);if(a<1)return"刚刚";if(a<60)return`${a} 分钟前`;const s=new Date(e),o=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`,i=new Date(t),l=new Date(t-864e5);return s.toDateString()===i.toDateString()?`今天 ${o}`:s.toDateString()===l.toDateString()?`昨天 ${o}`:`${s.getMonth()+1}-${s.getDate()} ${o}`}const rh={class:"va-cmt"},uh={key:0,class:"va-cmt__empty va-fade-in"},ch=["src","alt"],dh={class:"va-cmt__main"},fh={class:"va-cmt__head"},vh={class:"va-cmt__author"},ph=["data-agent"],hh={key:1,class:"va-cmt__time"},_h={class:"va-cmt__text"},mh={key:0,class:"va-cmt__pending-ops"},gh=["onClick"],kh=["onClick"],bh=["onClick"],yh=["placeholder"],wh=["disabled"],xh=ce({__name:"VaCommentThread",props:{comments:{},placeholder:{},busy:{type:Boolean},composer:{type:Boolean,default:!0},maxHeight:{}},emits:["submit","adopt","rewrite","discard"],setup(e,{emit:t}){const n=e,a=t,s=R(()=>n.comments.length>0),o=On(3e4,s),i=S(""),l=Re("area");function d(){const _=i.value.trim();!_||n.busy||(a("submit",_),i.value="",requestAnimationFrame(()=>l.value?.focus()))}function u(_){_.key==="Enter"&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),d())}const p=[16,145,210,268,34,190],v=_=>({background:`hsl(${p[_.length%p.length]} 45% 88%)`,color:`hsl(${p[_.length%p.length]} 45% 30%)`}),b=(_,g)=>g??_.slice(0,1).toUpperCase();return(_,g)=>(f(),h("div",rh,[c("div",{class:"va-cmt__list",style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0)},[n.comments.length?A("",!0):(f(),h("p",uh,"还没有评论,说点什么吧。")),(f(!0),h(j,null,Q(n.comments,m=>(f(),h("article",{key:m.id,class:ue(["va-cmt__item",{"va-cmt__item--pending":m.pending}])},[m.avatar?(f(),h("img",{key:0,class:"va-cmt__avatar",src:m.avatar,alt:m.author},null,8,ch)):(f(),h("span",{key:1,class:"va-cmt__avatar va-cmt__avatar--text",style:be(v(m.author)),"aria-hidden":"true"},C(b(m.author,m.initials)),5)),c("div",dh,[c("header",fh,[c("span",vh,C(m.author),1),m.role?(f(),h("span",{key:0,class:"va-cmt__role","data-agent":m.pending??!1},C(m.role),9,ph)):A("",!0),m.createdAt?(f(),h("span",hh,C(r(Ko)(m.createdAt,r(o))),1)):A("",!0)]),c("p",_h,C(m.text),1),m.pending?(f(),h("footer",mh,[c("button",{class:"va-act va-act--sm va-act--primary va-cmt__op",type:"button",onClick:k=>a("adopt",m.id)},"以此发布",8,gh),c("button",{class:"va-act va-act--sm va-cmt__op",type:"button",onClick:k=>a("rewrite",m.id)},"让 agent 重写",8,kh),c("button",{class:"va-act va-act--sm va-act--ghost va-cmt__op va-cmt__op--discard",type:"button",onClick:k=>a("discard",m.id)},"丢弃",8,bh)])):A("",!0)])],2))),128))],4),n.composer?(f(),h("form",{key:0,class:"va-cmt__composer",onSubmit:_e(d,["prevent"])},[ye(c("textarea",{ref_key:"area",ref:l,"onUpdate:modelValue":g[0]||(g[0]=m=>i.value=m),class:"va-cmt__area",rows:"1",placeholder:n.placeholder??"写下评论…","aria-label":"评论输入",onKeydown:u},null,40,yh),[[Ee,i.value]]),c("button",{class:"va-act va-act--primary va-cmt__send",type:"submit",disabled:!i.value.trim()||n.busy},C(n.busy?"发布中…":"发布"),9,wh)],32)):A("",!0)]))}}),$h=["data-level"],Ch={class:"va-usage__head"},Ah={class:"va-usage__amount"},Dh={class:"va-usage__limit"},Rh={class:"va-usage__period"},Eh=["aria-valuemax","aria-valuenow","aria-label"],Sh={key:0,class:"va-usage__alert",role:"status"},Mh={key:1,class:"va-usage__legend"},Th={class:"va-usage__label"},Fh={class:"va-usage__value"},Ih={class:"va-usage__pct"},As=ce({__name:"VaUsageMeter",props:{segments:{},limit:{},unit:{},period:{},warnAt:{},barHeight:{}},emits:["manage"],setup(e,{emit:t}){const n=e,a=t,s=["var(--va-info)","var(--va-accent)","var(--va-success)","var(--va-warning)"],o=R(()=>n.segments.reduce((v,b)=>v+b.used,0)),i=R(()=>n.limit>0?o.value/n.limit:0),l=R(()=>n.warnAt??.8),d=R(()=>i.value>=1?"exceeded":i.value>=l.value?"warn":"ok"),u=v=>v.toLocaleString("en-US"),p=(v,b)=>({width:n.limit>0?`${Math.min(100,b/n.limit*100)}%`:"0%",background:n.segments[v].color??s[v%s.length]});return(v,b)=>(f(),h("div",{class:"va-usage","data-level":d.value},[c("header",Ch,[c("span",Ah,[c("strong",null,C(u(o.value)),1),c("span",Dh,"/ "+C(u(n.limit))+" "+C(n.unit??""),1)]),c("span",Rh,C(n.period),1)]),c("div",{class:"va-usage__bar",role:"meter","aria-valuemin":0,"aria-valuemax":n.limit,"aria-valuenow":o.value,"aria-label":`已用 ${u(o.value)} / ${u(n.limit)} ${n.unit??""}`,style:be({height:`${n.barHeight??10}px`})},[(f(!0),h(j,null,Q(n.segments,(_,g)=>(f(),h("span",{key:_.label,class:"va-usage__seg",style:be(p(g,_.used))},null,4))),128))],12,Eh),d.value!=="ok"?(f(),h("p",Sh,[d.value==="exceeded"?(f(),h(j,{key:0},[G("已超出限额,新任务将被限流")],64)):(f(),h(j,{key:1},[G("已用 "+C(Math.round(i.value*100))+"%,接近本期限额",1)],64)),c("button",{class:"va-act va-act--sm va-usage__manage",type:"button",onClick:b[0]||(b[0]=_=>a("manage"))},"管理额度")])):(f(),h("ul",Mh,[(f(!0),h(j,null,Q(n.segments,(_,g)=>(f(),h("li",{key:_.label,class:"va-usage__item"},[c("span",{class:"va-usage__swatch",style:be({background:_.color??s[g%s.length]})},null,4),c("span",Th,C(_.label),1),c("span",Fh,C(u(_.used)),1),c("span",Ih,C(n.limit>0?Math.round(_.used/n.limit*100):0)+"%",1)]))),128))]))],8,$h))}});function Bh(e,t,n,a){const s=S(!1),o=S(e.defaultOpen??!1),i=R(()=>e.open!==void 0||s.value?e.open:o.value);let l=null;function d(){s.value=!0,o.value=!0,a["update:open"](!0)}function u(){s.value=!0,o.value=!1,a["update:open"](!1)}ve(i,$=>{$?(typeof document<"u"&&(l=document.activeElement),p.value="",g.value=0,Se(()=>t.value?.focus())):l&&typeof l.focus=="function"&&(l.focus(),l=null)});const p=S(""),v=R(()=>{const $=p.value.trim().toLowerCase();return $?e.commands.filter(D=>D.label.toLowerCase().includes($)||D.keywords?.toLowerCase().includes($)):e.commands}),b=R(()=>{const $=[];for(const D of v.value){const M=$[$.length-1];M&&M.group===D.group?M.items.push(D):$.push({group:D.group,items:[D]})}return $}),_=R(()=>b.value.flatMap($=>$.items)),g=S(0);ve(v,()=>{g.value=0});function m($){const D=_.value.length;D&&(g.value=(g.value+$+D)%D,Se(()=>{n.value?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"})}))}function k($){$.disabled||(a.select($),u())}function w($){if($.key==="ArrowDown")$.preventDefault(),m(1);else if($.key==="ArrowUp")$.preventDefault(),m(-1);else if($.key==="Enter"){$.preventDefault();const D=_.value[g.value];D&&k(D)}else $.key==="Escape"&&($.preventDefault(),u())}function x($){$.key==="Tab"&&($.preventDefault(),t.value?.focus())}function y(){u()}return{isOpen:i,openMenu:d,closeMenu:u,query:p,filtered:v,flat:_,groups:b,activeIdx:g,onInputKeydown:w,trapTab:x,onBackdropClick:y,pick:k}}const zh={class:"va-cmd"},Ph=["aria-expanded"],Lh={key:0,class:"va-cmd__kbd"},Oh={class:"va-cmd__search"},jh=["aria-activedescendant","placeholder"],Uh={id:"va-cmd-list",class:"va-cmd__list",role:"listbox","aria-label":"命令列表"},Nh={key:0,class:"va-cmd__empty va-fade-in"},qh={key:0,class:"va-cmd__group","aria-hidden":"true"},Wh=["id","aria-selected","aria-disabled","data-active","data-danger","disabled","onClick","onMousemove"],Vh={class:"va-cmd__label"},Jh={key:0,class:"va-cmd__kbd"},Kh=ce({__name:"VaCommandMenu",props:{commands:{},open:{type:Boolean},defaultOpen:{type:Boolean},placeholder:{},hotkey:{},triggerLabel:{},hideTrigger:{type:Boolean},emptyLabel:{},maxHeight:{}},emits:["update:open","select"],setup(e,{emit:t}){const n=e,a=t,s=Re("input"),o=Re("panel"),{isOpen:i,openMenu:l,query:d,flat:u,groups:p,activeIdx:v,onInputKeydown:b,trapTab:_,onBackdropClick:g,pick:m}=Bh(n,s,o,{"update:open":w=>a("update:open",w),select:w=>a("select",w)});function k(w){(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),l())}return(w,x)=>(f(),h("span",zh,[n.hideTrigger?A("",!0):(f(),h("button",{key:0,class:"va-cmd__trigger",type:"button","aria-expanded":r(i),"aria-haspopup":"dialog",onClick:x[0]||(x[0]=(...y)=>r(l)&&r(l)(...y)),onKeydown:k},[x[5]||(x[5]=c("span",{class:"va-cmd__icon","aria-hidden":"true"},"⌘",-1)),G(" "+C(n.triggerLabel??"命令")+" ",1),n.hotkey?(f(),h("kbd",Lh,C(n.hotkey),1)):A("",!0)],40,Ph)),(f(),H(Ia,{to:"body"},[r(i)?(f(),h("div",{key:0,class:"va-cmd__backdrop",onClick:x[1]||(x[1]=(...y)=>r(g)&&r(g)(...y)),onKeydown:x[2]||(x[2]=(...y)=>r(_)&&r(_)(...y))},null,32)):A("",!0),r(i)?(f(),h("div",{key:1,ref:"panel",class:"va-cmd__panel",role:"dialog","aria-modal":"true","aria-label":"命令面板",style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0)},[c("div",Oh,[x[6]||(x[6]=c("span",{class:"va-cmd__mag","aria-hidden":"true"},"⌕",-1)),ye(c("input",{ref:"input","onUpdate:modelValue":x[3]||(x[3]=y=>tn(d)?d.value=y:null),class:"va-cmd__input",type:"text",role:"combobox","aria-expanded":"true","aria-controls":"va-cmd-list","aria-activedescendant":r(u)[r(v)]?`va-cmd-opt-${r(u)[r(v)].id}`:void 0,placeholder:n.placeholder??"输入命令或搜索…","aria-label":"搜索命令",autocomplete:"off",onKeydown:x[4]||(x[4]=(...y)=>r(b)&&r(b)(...y))},null,40,jh),[[Ee,r(d)]]),x[7]||(x[7]=c("kbd",{class:"va-cmd__kbd va-cmd__kbd--fixed"},"esc",-1))]),c("div",Uh,[r(u).length?A("",!0):(f(),h("p",Nh,C(n.emptyLabel??"没有匹配的命令"),1)),(f(!0),h(j,null,Q(r(p),y=>(f(),h(j,{key:y.group??""},[y.group?(f(),h("div",qh,C(y.group),1)):A("",!0),(f(!0),h(j,null,Q(y.items,$=>(f(),h("button",{id:`va-cmd-opt-${$.id}`,key:$.id,class:"va-cmd__item",type:"button",role:"option","aria-selected":r(u)[r(v)]?.id===$.id,"aria-disabled":$.disabled,"data-active":r(u)[r(v)]?.id===$.id,"data-danger":$.danger,disabled:$.disabled,onClick:D=>r(m)($),onMousemove:D=>v.value=r(u).findIndex(M=>M.id===$.id)},[c("span",Vh,C($.label),1),$.hint?(f(),h("kbd",Jh,C($.hint),1)):A("",!0)],40,Wh))),128))],64))),128))])],4)):A("",!0)]))]))}}),Hh=8,Ho=6;function Ds(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}function Zo(e){const[t,n]=e.split("-");return{side:t,align:n??"center"}}function Rs(e,t){return t==="center"?e:`${e}-${t}`}function Es(e,t,n){return e==="start"?t.left:e==="end"?t.right-n:t.left+t.width/2-n/2}function Zh(e,t,n,a,s){switch(e){case"bottom":return{x:Es(t,n,a.width),y:n.bottom+s};case"top":return{x:Es(t,n,a.width),y:n.top-a.height-s};case"right":return{x:n.right+s,y:n.top+n.height/2-a.height/2};case"left":return{x:n.left-a.width-s,y:n.top+n.height/2-a.height/2}}}function Xh(e,t,n,a,s,o){const{side:i,align:l}=Zo(e);if(i!=="top"&&i!=="bottom")return e;const d=n.height+s,u=a.height-t.bottom-o,p=t.top-o;return i==="bottom"&&d>u&&d<=p?Rs("top",l):i==="top"&&d>p&&d<=u?Rs("bottom",l):e}function Gh(e,t,n,a,s){return{x:Ds(e,s,a.width-n.width-s),y:Ds(t,s,a.height-n.height-s)}}function Yh(e){const t=e.offset??Ho,n=e.padding??Hh,a=Xh(e.placement,e.anchorRect,e.floatingSize,e.viewport,t,n),{side:s,align:o}=Zo(a),i=Zh(s,o,e.anchorRect,e.floatingSize,t),{x:l,y:d}=Gh(i.x,i.y,e.floatingSize,e.viewport,n);return{x:l,y:d,placement:a,minWidth:e.matchAnchorWidth?e.anchorRect.width:void 0}}const Mt=[];let Qh=0;const Ss=()=>typeof window<"u"&&typeof document<"u";function Ms(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function e_(e,t){return e?e instanceof Element&&e.contains(t):!1}function t_(e){const t=++Qh,n=S({x:0,y:0}),a=S(e.placement.value),s=S(null),o=S(!1);let i=null,l=!1,d=null;function u(){if(!Ss()||!e.open.value)return;const w=e.anchor.value,x=e.floating.value;if(!w||!x)return;const y=Yh({anchorRect:Ms(w.getBoundingClientRect()),floatingSize:Ms(x.getBoundingClientRect()),placement:e.placement.value,offset:e.offset.value,viewport:{width:window.innerWidth,height:window.innerHeight},matchAnchorWidth:e.matchAnchorWidth.value});n.value={x:y.x,y:y.y},a.value=y.placement,s.value=y.minWidth??null,o.value=!0}function p(){if(typeof requestAnimationFrame!="function"){u();return}i===null&&(i=requestAnimationFrame(()=>{i=null,u()}))}const v=()=>p(),b=w=>{if(!e.open.value||!e.closeOnOutsideClick.value)return;const x=w.target;if(!x)return;const y=e.floating.value;y&&y.contains(x)||e_(e.anchor.value,x)||e.onRequestClose()},_=w=>{w.key==="Escape"&&(!e.open.value||!e.closeOnEscape.value||Mt[Mt.length-1]===t&&e.onRequestClose())};function g(){if(!Ss()||l)return;l=!0,window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),document.addEventListener("mousedown",b),document.addEventListener("keydown",_),Mt.includes(t)||Mt.push(t);const w=e.floating.value;w&&typeof ResizeObserver=="function"&&(d=new ResizeObserver(()=>p()),d.observe(w))}function m(){if(!l)return;l=!1,window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v),d?.disconnect(),d=null,document.removeEventListener("mousedown",b),document.removeEventListener("keydown",_);const w=Mt.indexOf(t);w>=0&&Mt.splice(w,1),i!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(i),i=null)}return ve(e.open,async w=>{w?(await Se(),u(),g()):(m(),o.value=!1)},{flush:"post"}),ve([e.placement,e.offset,e.anchor,e.matchAnchorWidth],()=>{e.open.value&&p()}),Le(()=>{e.open.value&&(u(),g())}),Pe(m),{floatingStyle:R(()=>({position:"fixed",top:`${n.value.y}px`,left:`${n.value.x}px`,...s.value!=null?{minWidth:`${s.value}px`}:{},visibility:o.value?"visible":"hidden"})),actualPlacement:a,measured:o,update:u}}const n_=["data-open","data-disabled"],a_=["data-placement"],ft=ce({__name:"VaPopover",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean},anchor:{},placement:{},offset:{},matchAnchorWidth:{type:Boolean},closeOnOutsideClick:{type:Boolean,default:void 0},closeOnEscape:{type:Boolean,default:void 0},disabled:{type:Boolean},teleportTo:{}},emits:["update:open","open","close"],setup(e,{expose:t,emit:n}){const a=e,s=n,o=S(a.defaultOpen??!1),i=R(()=>a.open??o.value);function l(M){M!==i.value&&(o.value=M,s("update:open",M),s(M?"open":"close"))}function d(){a.disabled||l(!0)}function u(){l(!1)}function p(){i.value?u():d()}ve(()=>a.disabled,M=>{M&&u()});const v=R(()=>a.placement??"bottom-start"),b=R(()=>a.offset??Ho),_=R(()=>a.matchAnchorWidth??!1),g=R(()=>a.closeOnOutsideClick??!0),m=R(()=>a.closeOnEscape??!0),k=Re("trigger"),w=Re("floating"),x=R(()=>a.anchor??k.value??null),{floatingStyle:y,actualPlacement:$,update:D}=t_({anchor:x,floating:w,open:i,placement:v,offset:b,matchAnchorWidth:_,closeOnOutsideClick:g,closeOnEscape:m,onRequestClose:u});return t({open:d,close:u,toggle:p,update:D}),(M,N)=>(f(),h(j,null,[M.$slots.trigger?(f(),h("span",{key:0,ref:"trigger",class:"va-pop__trigger","data-open":i.value,"data-disabled":a.disabled||void 0,onClick:p},[xe(M.$slots,"trigger",{open:i.value,toggle:p})],8,n_)):A("",!0),(f(),H(Ia,{to:a.teleportTo??"body"},[B(Ct,{name:"va-pop"},{default:oe(()=>[i.value?(f(),h("div",{key:0,ref:"floating",class:"va-pop",style:be(r(y)),"data-placement":r($)},[xe(M.$slots,"default",{close:u})],12,a_)):A("",!0)]),_:3})],8,["to"]))],64))}});function s_(e,t,n){const s=`va-sel-${dn()}-list`,o=S(e.defaultOpen??!1),i=S(""),l=S(-1),d=S(e.defaultValue??(e.multiple?[]:void 0)),u=R(()=>e.modelValue??d.value??(e.multiple?[]:"")),p=R(()=>Array.isArray(u.value)?u.value:u.value?[u.value]:[]),v=R(()=>e.options.filter(T=>p.value.includes(T.value))),b=R(()=>p.value.length>0);function _(T){return p.value.includes(T.value)}const g=R(()=>{const T=i.value.trim().toLowerCase();return T?e.options.filter(P=>P.label.toLowerCase().includes(T)||P.value.toLowerCase().includes(T)):e.options}),m=R(()=>{const T=g.value.filter(q=>!q.group),P=[];for(const q of g.value)q.group&&!P.includes(q.group)&&P.push(q.group);return[...T,...P.flatMap(q=>g.value.filter(fe=>fe.group===q))].map((q,fe)=>({option:q,index:fe,domId:`${s}-opt-${fe}`}))}),k=R(()=>{const T=[];for(const P of m.value){const L=P.option.group;if(L){let q=T[T.length-1];(!q||q.type!=="group"||q.label!==L)&&(q={type:"group",label:L,titleId:`${s}-group-${T.length}`,items:[]},T.push(q)),q.items.push(P)}else{let q=T[T.length-1];(!q||q.type!=="plain")&&(q={type:"plain",items:[]},T.push(q)),q.items.push(P)}}return T});function w(T){o.value!==T&&(o.value=T,n.visibleChange(T))}function x(){e.disabled||o.value||w(!0)}function y(){w(!1)}function $(){o.value?y():x()}function D(){t.trigger.value?.focus()}ve(o,T=>{if(T){i.value="";const P=m.value,L=P.findIndex(fe=>_(fe.option)&&!fe.option.disabled),q=P.findIndex(fe=>!fe.option.disabled);l.value=L>=0?L:q,Se(()=>{e.searchable&&t.search.value?.focus(),ne()})}else i.value="",l.value=-1});function M(T,P){d.value=T,n["update:modelValue"](T),n.change(T,P)}function N(T){if(!T.disabled)if(e.multiple){const P=[...p.value],L=P.indexOf(T.value);L>=0?P.splice(L,1):P.push(T.value),M(P,T),i.value=""}else M(T.value,T),y(),D()}const K=R(()=>!!(e.clearable&&b.value&&!e.disabled&&!e.loading));function te(T){T.stopPropagation();const P=e.multiple?[]:"";d.value=P,n["update:modelValue"](P),n.clear(),D()}function ne(){if(typeof document>"u")return;const T=m.value[l.value];T&&document.getElementById(T.domId)?.scrollIntoView?.({block:"nearest"})}function V(T){const P=m.value,L=P.length;if(!L)return;let q=l.value;for(let fe=0;fe<L;fe++)if(q=(q+T+L)%L,!P[q].option.disabled){l.value=q,ne();return}}function X(T){const P=m.value,q=(T==="first"?P:[...P].reverse()).find(fe=>!fe.option.disabled);q&&(l.value=q.index,ne())}function O(T){const P=m.value,L=P.length;if(!L)return;const q=T.toLowerCase();for(let fe=1;fe<=L;fe++){const we=(l.value+fe)%L,De=P[we];if(!De.option.disabled&&De.option.label.toLowerCase().startsWith(q)){l.value=we,ne();return}}}function J(){const T=m.value[l.value];T&&N(T.option)}const Z=R(()=>o.value&&l.value>=0?m.value[l.value]?.domId:void 0);function Y(T){if(!e.disabled){if(!o.value){(T.key==="ArrowDown"||T.key==="ArrowUp"||T.key==="Enter"||T.key===" ")&&(T.preventDefault(),x());return}switch(T.key){case"ArrowDown":T.preventDefault(),V(1);break;case"ArrowUp":T.preventDefault(),V(-1);break;case"Home":T.preventDefault(),X("first");break;case"End":T.preventDefault(),X("last");break;case"Enter":case" ":T.preventDefault(),J();break;case"Escape":T.preventDefault(),T.stopPropagation(),y(),D();break;case"Tab":y();break;default:T.key.length===1&&!T.ctrlKey&&!T.metaKey&&!T.altKey&&O(T.key)}}}function ie(T){T.key===" "&&T.preventDefault()}function le(T){switch(T.key){case"ArrowDown":T.preventDefault(),V(1);break;case"ArrowUp":T.preventDefault(),V(-1);break;case"Home":T.preventDefault(),X("first");break;case"End":T.preventDefault(),X("last");break;case"Enter":T.preventDefault(),J();break;case"Escape":T.preventDefault(),T.stopPropagation(),y(),D();break}}return ve(m,T=>{if(o.value){if(!T.length){l.value=-1;return}(l.value<0||l.value>=T.length)&&(l.value=T.findIndex(P=>!P.option.disabled))}}),{listId:s,open:o,query:i,activeIdx:l,value:u,values:p,selectedOptions:v,hasValue:b,isSelected:_,filtered:g,flatItems:m,renderEntries:k,showClear:K,activeDomId:Z,setOpen:w,openMenu:x,closeMenu:y,toggleMenu:$,focusTrigger:D,pick:N,onClear:te,move:V,onTriggerKeydown:Y,onTriggerKeyup:ie,onSearchKeydown:le}}const o_=["data-disabled","data-loading","data-clearable"],i_=["aria-expanded","aria-controls","aria-invalid","aria-label","aria-activedescendant","disabled"],l_=["data-placeholder"],r_={class:"va-sel__indicators","aria-hidden":"true"},u_={key:0,class:"va-sel__spinner"},c_={key:1,class:"va-sel__chev",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},d_={class:"va-sel__panel"},f_={key:0,class:"va-sel__search"},v_=["aria-controls","aria-activedescendant"],p_=["id","aria-multiselectable","aria-label"],h_=["aria-labelledby"],__=["id"],m_=["id","aria-selected","aria-disabled","data-active","onClick","onMousemove"],g_=["data-checked"],k_={class:"va-sel__opt-main"},b_={class:"va-sel__opt-label"},y_={key:0,class:"va-sel__opt-desc"},w_={key:1,class:"va-sel__opt-tick","aria-hidden":"true"},x_=["id","aria-selected","aria-disabled","data-active","onClick","onMousemove"],$_=["data-checked"],C_={class:"va-sel__opt-main"},A_={class:"va-sel__opt-label"},D_={key:0,class:"va-sel__opt-desc"},R_={key:1,class:"va-sel__opt-tick","aria-hidden":"true"},E_={key:2,class:"va-sel__empty va-fade-in"},Tn=ce({__name:"VaSelect",props:{options:{},modelValue:{},defaultValue:{},multiple:{type:Boolean},searchable:{type:Boolean},clearable:{type:Boolean},size:{default:"md"},disabled:{type:Boolean},invalid:{type:Boolean},loading:{type:Boolean},placeholder:{default:"请选择"},emptyLabel:{default:"无匹配项"},label:{},defaultOpen:{type:Boolean}},emits:["update:modelValue","change","clear","visibleChange"],setup(e,{emit:t}){const n=e,a=t,s=Re("trigger"),o=Re("search"),{listId:i,open:l,query:d,activeIdx:u,values:p,selectedOptions:v,hasValue:b,isSelected:_,flatItems:g,renderEntries:m,showClear:k,activeDomId:w,setOpen:x,pick:y,onClear:$,onTriggerKeydown:D,onTriggerKeyup:M,onSearchKeydown:N}=s_(n,{trigger:s,search:o},{"update:modelValue":ne=>a("update:modelValue",ne),change:(ne,V)=>a("change",ne,V),clear:()=>a("clear"),visibleChange:ne=>a("visibleChange",ne)}),K=R(()=>{const ne=V=>n.options.find(X=>X.value===V)?.label??V;return p.value.map(ne).join("、")}),te=R(()=>["va-sel",`va-sel--${n.size}`,{"va-sel--open":l.value,"va-sel--disabled":n.disabled,"va-sel--invalid":n.invalid,"va-sel--multiple":n.multiple}]);return(ne,V)=>(f(),H(r(ft),{open:r(l),disabled:n.disabled,"match-anchor-width":"",placement:"bottom-start","onUpdate:open":r(x)},{trigger:oe(()=>[c("span",{class:ue(te.value),"data-disabled":n.disabled||void 0,"data-loading":n.loading||void 0,"data-clearable":r(k)||void 0},[c("button",{ref:"trigger",type:"button",class:"va-sel__trigger",role:"combobox","aria-expanded":r(l),"aria-haspopup":"listbox","aria-controls":r(i),"aria-invalid":n.invalid||void 0,"aria-label":n.label??"选择","aria-activedescendant":n.searchable?void 0:r(w),disabled:n.disabled,onKeydown:V[0]||(V[0]=(...X)=>r(D)&&r(D)(...X)),onKeyup:V[1]||(V[1]=(...X)=>r(M)&&r(M)(...X))},[c("span",{class:"va-sel__value","data-placeholder":!r(b)||void 0},[xe(ne.$slots,"value",{options:r(v),values:r(p)},()=>[G(C(r(b)?K.value:n.placeholder),1)])],8,l_),c("span",r_,[n.loading?(f(),h("span",u_)):(f(),h("svg",c_,[...V[7]||(V[7]=[c("polyline",{points:"6 9 12 15 18 9"},null,-1)])]))])],40,i_),r(k)?(f(),h("button",{key:0,type:"button",class:"va-sel__clear","aria-label":"清除选择",title:"清除",onClick:V[2]||(V[2]=(...X)=>r($)&&r($)(...X)),onMousedown:V[3]||(V[3]=_e(()=>{},["stop"]))}," × ",32)):A("",!0)],10,o_)]),default:oe(()=>[c("div",d_,[n.searchable?(f(),h("div",f_,[ye(c("input",{ref:"search","onUpdate:modelValue":V[4]||(V[4]=X=>tn(d)?d.value=X:null),type:"text",class:"va-sel__search-input",placeholder:"搜索…","aria-label":"搜索选项","aria-controls":r(i),"aria-activedescendant":n.searchable?r(w):void 0,autocomplete:"off",onKeydown:V[5]||(V[5]=(...X)=>r(N)&&r(N)(...X))},null,40,v_),[[Ee,r(d)]])])):A("",!0),r(g).length?(f(),h("div",{key:1,id:r(i),class:"va-sel__list",role:"listbox","aria-multiselectable":n.multiple||void 0,"aria-label":n.label??"选项列表",onMousedown:V[6]||(V[6]=_e(()=>{},["prevent"]))},[(f(!0),h(j,null,Q(r(m),X=>(f(),h(j,{key:X.type==="group"?X.titleId:`plain-${X.items[0]?.index??0}`},[X.type==="group"?(f(),h("div",{key:0,class:"va-sel__group",role:"group","aria-labelledby":X.titleId},[c("div",{id:X.titleId,class:"va-sel__group-title"},C(X.label),9,__),(f(!0),h(j,null,Q(X.items,O=>(f(),h("div",{id:O.domId,key:O.domId,class:"va-sel__opt",role:"option","aria-selected":r(_)(O.option),"aria-disabled":O.option.disabled||void 0,"data-active":O.index===r(u)||void 0,onClick:J=>r(y)(O.option),onMousemove:J=>!O.option.disabled&&(u.value=O.index)},[n.multiple?(f(),h("span",{key:0,class:"va-sel__check","data-checked":r(_)(O.option)||void 0,"aria-hidden":"true"},null,8,g_)):A("",!0),c("span",k_,[xe(ne.$slots,"option",{option:O.option,selected:r(_)(O.option),active:O.index===r(u)},()=>[c("span",b_,C(O.option.label),1),O.option.description?(f(),h("span",y_,C(O.option.description),1)):A("",!0)])]),!n.multiple&&r(_)(O.option)?(f(),h("span",w_,"✓")):A("",!0)],40,m_))),128))],8,h_)):A("",!0),(f(!0),h(j,null,Q(X.type==="plain"?X.items:[],O=>(f(),h("div",{id:O.domId,key:O.domId,class:"va-sel__opt",role:"option","aria-selected":r(_)(O.option),"aria-disabled":O.option.disabled||void 0,"data-active":O.index===r(u)||void 0,onClick:J=>r(y)(O.option),onMousemove:J=>!O.option.disabled&&(u.value=O.index)},[n.multiple?(f(),h("span",{key:0,class:"va-sel__check","data-checked":r(_)(O.option)||void 0,"aria-hidden":"true"},null,8,$_)):A("",!0),c("span",C_,[xe(ne.$slots,"option",{option:O.option,selected:r(_)(O.option),active:O.index===r(u)},()=>[c("span",A_,C(O.option.label),1),O.option.description?(f(),h("span",D_,C(O.option.description),1)):A("",!0)])]),!n.multiple&&r(_)(O.option)?(f(),h("span",R_,"✓")):A("",!0)],40,x_))),128))],64))),128))],40,p_)):(f(),h("div",E_,[xe(ne.$slots,"empty",{},()=>[G(C(n.emptyLabel),1)])]))])]),_:3},8,["open","disabled","onUpdate:open"]))}}),wn=()=>typeof window<"u"&&typeof document<"u";function Ts(e){const t=[];let n;return e.forEach((a,s)=>{if(a.divider){t.push({type:"divider",key:`divider-${s}`}),n=void 0;return}a.group&&a.group!==n&&t.push({type:"group",key:`group-${s}`,label:a.group}),n=a.group,t.push({type:"item",key:`item-${a.id}-${s}`,item:a})}),t}function S_(e,t){return{getBoundingClientRect:()=>({x:e,y:t,top:t,left:e,right:e,bottom:t,width:0,height:0})}}function M_(e,t,n){const a=dn(),s=`va-dd-${a}-menu`,o=`va-dd-${a}-submenu`,i=S(e.defaultOpen??!1),l=R(()=>e.open??i.value),d=S(l.value?ne(e.items.filter(U=>!U.divider)):null),u=S(null),p=S(null),v=S(null),b=S(null);let _=!1;const g=R(()=>e.trigger==="contextmenu"?b.value??void 0:void 0),m=R(()=>e.items.filter(U=>!U.divider)),k=R(()=>Ts(e.items)),w=R(()=>u.value?e.items.find(U=>U.id===u.value)?.children??[]:[]),x=R(()=>w.value.filter(U=>!U.divider)),y=R(()=>Ts(w.value)),$=R(()=>u.value!==null),D=R(()=>e.items.find(U=>U.id===u.value)?.label??"子菜单"),M=R(()=>m.value.find(U=>U.id===d.value)??null),N=U=>String(U).replace(/[^\w-]+/g,"-"),K=U=>`${s}-i-${N(U)}`,te=(U,de)=>`${o}-${N(U)}-${N(de)}`;function ne(U){return U.find(de=>!de.disabled)?.id??U[0]?.id??null}function V(U){!wn()||!U||document.getElementById(U)?.focus()}function X(){if(t.trigger.value){t.trigger.value.focus();return}t.triggerWrap.value?.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")?.focus()}function O(U){l.value!==U&&(i.value=U,n["update:open"](U),U?n.open():n.close())}function J(){e.disabled||l.value||O(!0)}function Z(U={}){l.value&&(_=!!U.restoreFocus,O(!1))}function Y(){l.value?Z():J()}ve(l,async U=>{if(U)u.value=null,p.value=null,v.value=null,d.value=ne(m.value),await Se(),V(d.value?K(d.value):null);else{u.value=null,p.value=null,v.value=null,b.value=null,d.value=null;const de=_;_=!1,await Se(),de&&X()}});function ie(U,de,Me){const z=U.length;if(!z)return null;let W=de?U.findIndex(ae=>ae.id===de):-1;W<0&&(W=Me>0?-1:0);for(let ae=0;ae<z;ae++)if(W=(W+Me+z)%z,!U[W].disabled)return U[W].id;return de}function le(U,de){return(de==="first"?U:[...U].reverse()).find(z=>!z.disabled)?.id??null}function T(U){d.value=U}function P(U){p.value=U}function L(U){const de=ie(m.value,d.value,U);de&&(d.value=de,V(K(de)))}function q(U){const de=le(m.value,U);de&&(d.value=de,V(K(de)))}function fe(U){const de=u.value;if(!de)return;const Me=ie(x.value,p.value,U);Me&&(p.value=Me,V(te(de,Me)))}function we(U){const de=u.value;if(!de)return;const Me=le(x.value,U);Me&&(p.value=Me,V(te(de,Me)))}function De(U){const de=e.items.find(Me=>Me.id===U);!de?.children?.length||u.value===U||(v.value=wn()?document.getElementById(K(U)):null,u.value=U,p.value=ne(de.children.filter(Me=>!Me.divider)),Se(()=>{u.value&&p.value&&V(te(u.value,p.value))}))}function ge(U={}){const de=u.value;u.value=null,p.value=null,v.value=null,U.focusParent&&de&&(d.value=de,Se(()=>V(K(de))))}function ee(U,de=!0){if(!(U.disabled||U.divider)){if(de&&U.children?.length){De(U.id);return}n.select(U),e.keepOpenOnSelect||Z({restoreFocus:!0})}}function Ue(U){U.disabled||(d.value=U.id,ee(U))}function bt(U){U.disabled||(p.value=U.id,ee(U,!1))}function me(U){e.trigger!=="click"&&U.stopPropagation()}function Je(U){e.trigger!=="contextmenu"||e.disabled||(U.preventDefault(),U.stopPropagation(),b.value=S_(U.clientX,U.clientY),l.value||J())}function Ut(U){if(!(e.disabled||e.trigger==="manual")){if(!l.value){(U.key==="ArrowDown"||U.key==="ArrowUp"||U.key==="Enter"||U.key===" ")&&(U.preventDefault(),J());return}(U.key==="ArrowDown"||U.key==="ArrowUp")&&(U.preventDefault(),L(U.key==="ArrowDown"?1:-1))}}function pt(U){U.key===" "&&U.preventDefault()}function Ye(U){if(!l.value)return;const de=M.value;switch(U.key){case"ArrowDown":U.preventDefault(),L(1);break;case"ArrowUp":U.preventDefault(),L(-1);break;case"Home":U.preventDefault(),q("first");break;case"End":U.preventDefault(),q("last");break;case"Enter":case" ":if(!de)return;U.preventDefault(),ee(de);break;case"ArrowRight":de?.children?.length&&(U.preventDefault(),De(de.id));break;case"ArrowLeft":u.value&&(U.preventDefault(),ge({focusParent:!0}));break;case"Tab":Z();break}}function Nt(U){if(!u.value)return;const de=x.value.find(Me=>Me.id===p.value)??null;switch(U.key){case"ArrowDown":U.preventDefault(),fe(1);break;case"ArrowUp":U.preventDefault(),fe(-1);break;case"Home":U.preventDefault(),we("first");break;case"End":U.preventDefault(),we("last");break;case"Enter":case" ":if(!de)return;U.preventDefault(),ee(de,!1);break;case"ArrowLeft":U.preventDefault(),ge({focusParent:!0});break;case"ArrowRight":U.preventDefault();break;case"Tab":Z();break}}function it(U){return[t.trigger.value,t.triggerWrap.value,t.menu.value,t.submenu.value].some(de=>!!de&&de.contains(U))}function Rt(U){if(!l.value)return;const de=U.target;!de||it(de)||Z()}function Et(U){U.key!=="Escape"||!l.value||(U.preventDefault(),Z({restoreFocus:!0}))}return Le(()=>{wn()&&(document.addEventListener("mousedown",Rt),document.addEventListener("keydown",Et),l.value&&V(d.value?K(d.value):null))}),Pe(()=>{wn()&&(document.removeEventListener("mousedown",Rt),document.removeEventListener("keydown",Et))}),{menuId:s,submenuId:o,isOpen:l,activeId:d,openSubId:u,subActiveId:p,submenuAnchor:v,submenuOpen:$,submenuLabel:D,popoverAnchor:g,entries:k,subEntries:y,navItems:m,subNavItems:x,activeItem:M,itemDomId:K,subItemDomId:te,setActive:T,setSubActive:P,openMenu:J,closeMenu:Z,toggleMenu:Y,setOpen:O,onTriggerClick:me,onTriggerKeydown:Ut,onTriggerKeyup:pt,onTriggerContextmenu:Je,onMenuKeydown:Ye,onSubKeydown:Nt,onItemClick:Ue,onSubItemClick:bt,openSub:De,closeSub:ge}}const T_=["aria-expanded","aria-controls","aria-label","disabled"],F_={key:0,class:"va-dd__icon","aria-hidden":"true"},I_={key:1,class:"va-dd__label"},B_={key:2,class:"va-dd__chev","aria-hidden":"true"},z_=["id","aria-label"],P_={key:0,class:"va-dd__group",role:"presentation"},L_={key:1,class:"va-dd__divider",role:"separator"},O_=["id","aria-haspopup","aria-expanded","aria-disabled","data-active","data-checked","data-danger","disabled","onClick","onMouseenter","onFocus"],j_={class:"va-dd__check","aria-hidden":"true"},U_={key:0,class:"va-dd__item-icon","aria-hidden":"true"},N_={class:"va-dd__item-label"},q_={key:1,class:"va-dd__shortcut"},W_={key:2,class:"va-dd__sub-arrow","aria-hidden":"true"},V_=["id","aria-label"],J_={key:0,class:"va-dd__group",role:"presentation"},K_={key:1,class:"va-dd__divider",role:"separator"},H_=["id","aria-disabled","data-active","data-checked","data-danger","disabled","onClick","onMouseenter","onFocus"],Z_={class:"va-dd__check","aria-hidden":"true"},X_={key:0,class:"va-dd__item-icon","aria-hidden":"true"},G_={class:"va-dd__item-label"},Y_={key:1,class:"va-dd__shortcut"},Q_=ce({__name:"VaDropdown",props:{items:{},trigger:{default:"click"},placement:{default:"bottom-end"},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean},triggerLabel:{},triggerIcon:{},hideChevron:{type:Boolean,default:!1},keepOpenOnSelect:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},ariaLabel:{}},emits:["update:open","select","open","close"],setup(e,{expose:t,emit:n}){const a=e,s=n,o=Re("trigger"),i=Re("triggerWrap"),l=Re("menu"),d=Re("submenu"),{menuId:u,submenuId:p,isOpen:v,activeId:b,openSubId:_,subActiveId:g,submenuAnchor:m,submenuOpen:k,submenuLabel:w,popoverAnchor:x,entries:y,subEntries:$,itemDomId:D,subItemDomId:M,setActive:N,setSubActive:K,openMenu:te,closeMenu:ne,toggleMenu:V,setOpen:X,onTriggerClick:O,onTriggerKeydown:J,onTriggerKeyup:Z,onTriggerContextmenu:Y,onMenuKeydown:ie,onSubKeydown:le,onItemClick:T,onSubItemClick:P}=M_(a,{trigger:o,triggerWrap:i,menu:l,submenu:d},{"update:open":De=>s("update:open",De),open:()=>s("open"),close:()=>s("close"),select:De=>s("select",De)}),L=R(()=>a.triggerIcon!==void 0?a.triggerIcon!=="":!a.triggerLabel),q=R(()=>!!a.triggerLabel&&!L.value),fe=R(()=>a.triggerIcon??"⋮"),we=R(()=>a.ariaLabel??a.triggerLabel??"更多操作");return t({open:te,close:ne,toggle:V,setOpen:X}),(De,ge)=>(f(),H(r(ft),{open:r(v),anchor:r(x),placement:a.placement,disabled:a.disabled,"close-on-outside-click":!1,"close-on-escape":!1,"onUpdate:open":r(X)},{trigger:oe(()=>[c("span",{ref_key:"triggerWrap",ref:i,class:"va-dd",onClick:ge[0]||(ge[0]=(...ee)=>r(O)&&r(O)(...ee)),onKeydown:ge[1]||(ge[1]=(...ee)=>r(J)&&r(J)(...ee)),onKeyup:ge[2]||(ge[2]=(...ee)=>r(Z)&&r(Z)(...ee)),onContextmenu:ge[3]||(ge[3]=(...ee)=>r(Y)&&r(Y)(...ee))},[xe(De.$slots,"trigger",{open:r(v),toggle:r(V)},()=>[c("button",{ref:"trigger",type:"button",class:"va-dd__trigger","aria-haspopup":"menu","aria-expanded":r(v),"aria-controls":r(v)?r(u):void 0,"aria-label":q.value?void 0:we.value,disabled:a.disabled},[L.value?(f(),h("span",F_,C(fe.value),1)):A("",!0),q.value?(f(),h("span",I_,C(a.triggerLabel),1)):A("",!0),a.hideChevron?A("",!0):(f(),h("span",B_,"▾"))],8,T_)])],544)]),default:oe(()=>[c("div",{id:r(u),ref:"menu",class:"va-dd__menu",role:"menu","aria-label":a.ariaLabel??"动作菜单",onKeydown:ge[5]||(ge[5]=(...ee)=>r(ie)&&r(ie)(...ee)),onMousedown:ge[6]||(ge[6]=_e(()=>{},["prevent"]))},[(f(!0),h(j,null,Q(r(y),ee=>(f(),h(j,{key:ee.key},[ee.type==="group"?(f(),h("div",P_,C(ee.label),1)):ee.type==="divider"?(f(),h("div",L_)):ee.type==="item"?(f(),h("button",{key:2,id:r(D)(ee.item.id),type:"button",class:"va-dd__item",role:"menuitem",tabindex:"-1","aria-haspopup":ee.item.children?.length?"menu":void 0,"aria-expanded":ee.item.children?.length?r(_)===ee.item.id:void 0,"aria-disabled":ee.item.disabled||void 0,"data-active":r(b)===ee.item.id||void 0,"data-checked":ee.item.checked||void 0,"data-danger":ee.item.danger||void 0,disabled:ee.item.disabled,onClick:Ue=>r(T)(ee.item),onKeyup:ge[4]||(ge[4]=ze(_e(()=>{},["prevent"]),["space"])),onMouseenter:Ue=>r(N)(ee.item.id),onFocus:Ue=>r(N)(ee.item.id)},[xe(De.$slots,"item",{item:ee.item,active:r(b)===ee.item.id,checked:!!ee.item.checked,disabled:!!ee.item.disabled},()=>[c("span",j_,C(ee.item.checked?"✓":""),1),ee.item.icon?(f(),h("span",U_,C(ee.item.icon),1)):A("",!0),c("span",N_,C(ee.item.label),1),ee.item.shortcut?(f(),h("span",q_,C(ee.item.shortcut),1)):A("",!0),ee.item.children?.length?(f(),h("span",W_,"›")):A("",!0)])],40,O_)):A("",!0)],64))),128))],40,z_),B(r(ft),{open:r(k),anchor:r(m),placement:"right",offset:2,"close-on-outside-click":!1,"close-on-escape":!1},{default:oe(()=>[c("div",{id:r(p),ref:"submenu",class:"va-dd__menu va-dd__submenu",role:"menu","aria-label":r(w),onKeydown:ge[8]||(ge[8]=(...ee)=>r(le)&&r(le)(...ee)),onMousedown:ge[9]||(ge[9]=_e(()=>{},["prevent"]))},[(f(!0),h(j,null,Q(r($),ee=>(f(),h(j,{key:ee.key},[ee.type==="group"?(f(),h("div",J_,C(ee.label),1)):ee.type==="divider"?(f(),h("div",K_)):ee.type==="item"?(f(),h("button",{key:2,id:r(M)(r(_),ee.item.id),type:"button",class:"va-dd__item",role:"menuitem",tabindex:"-1","aria-disabled":ee.item.disabled||void 0,"data-active":r(g)===ee.item.id||void 0,"data-checked":ee.item.checked||void 0,"data-danger":ee.item.danger||void 0,disabled:ee.item.disabled,onClick:Ue=>r(P)(ee.item),onKeyup:ge[7]||(ge[7]=ze(_e(()=>{},["prevent"]),["space"])),onMouseenter:Ue=>r(K)(ee.item.id),onFocus:Ue=>r(K)(ee.item.id)},[xe(De.$slots,"item",{item:ee.item,active:r(g)===ee.item.id,checked:!!ee.item.checked,disabled:!!ee.item.disabled},()=>[c("span",Z_,C(ee.item.checked?"✓":""),1),ee.item.icon?(f(),h("span",X_,C(ee.item.icon),1)):A("",!0),c("span",G_,C(ee.item.label),1),ee.item.shortcut?(f(),h("span",Y_,C(ee.item.shortcut),1)):A("",!0)])],40,H_)):A("",!0)],64))),128))],40,V_)]),_:3},8,["open","anchor"])]),_:3},8,["open","anchor","placement","disabled","onUpdate:open"]))}}),em=["data-disabled"],tm=["data-variant"],nm="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",Xo=ce({__name:"VaTooltip",props:{content:{},placement:{default:"top"},delay:{default:300},hideDelay:{default:80},disabled:{type:Boolean,default:!1},maxWidth:{default:280},variant:{default:"inverse"}},emits:["show","hide"],setup(e,{expose:t,emit:n}){const a=e,s=n,o=zo(),i=`va-tip-${dn()}`,l=S(!1),d=Re("trigger");let u=null,p=null;function v(){u!=null&&(clearTimeout(u),u=null)}function b(){p!=null&&(clearTimeout(p),p=null)}function _(){return!!a.content||!!o.content}function g(){v(),b(),!(a.disabled||l.value||!_())&&(l.value=!0,s("show"))}function m(){v(),b(),l.value&&(l.value=!1,s("hide"))}function k(){a.disabled||(b(),!(l.value||u!=null)&&(u=setTimeout(()=>{u=null,g()},a.delay)))}function w(){v(),!(!l.value||p!=null)&&(p=setTimeout(()=>{p=null,m()},a.hideDelay))}function x(N){N||m()}ve(()=>a.disabled,N=>{N&&m()});function y(){const N=d.value;return N?N.querySelector(nm)??N.firstElementChild??N:null}let $=null;function D(){const N=y();if(!N||N.hasAttribute("aria-label"))return;const K=(N.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);K.includes(i)||(N.setAttribute("aria-describedby",[...K,i].join(" ")),$=N)}function M(){const N=$;if($=null,!N)return;const te=(N.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean).filter(ne=>ne!==i);te.length?N.setAttribute("aria-describedby",te.join(" ")):N.removeAttribute("aria-describedby")}return ve(l,N=>{N?D():M()}),Pe(()=>{v(),b(),M()}),t({show:g,hide:m}),(N,K)=>(f(),h(j,null,[c("span",{ref:"trigger",class:"va-tip__trigger","data-disabled":a.disabled||void 0,onMouseenter:k,onMouseleave:w,onFocusin:k,onFocusout:w},[xe(N.$slots,"default")],40,em),B(r(ft),{open:l.value,anchor:d.value,placement:a.placement,disabled:a.disabled,"close-on-outside-click":!0,"close-on-escape":!0,"onUpdate:open":x},{default:oe(()=>[c("div",{id:i,class:"va-tip",role:"tooltip","data-variant":a.variant,style:be({maxWidth:`${a.maxWidth}px`})},[xe(N.$slots,"content",{},()=>[G(C(a.content),1)])],12,tm)]),_:3},8,["open","anchor","placement","disabled"])],64))}}),am=["a[href]","area[href]","button","input:not([type='hidden'])","select","textarea","iframe","object","embed","[contenteditable]","[tabindex]"].join(",");function sm(e){if(e.hasAttribute("disabled")||e.tabIndex<0||e.getAttribute("aria-hidden")==="true")return!1;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Fs(e){return Array.from(e.querySelectorAll(am)).filter(sm)}function om(e){let t=null;async function n(){if(typeof document>"u")return;t=document.activeElement,await Se();const o=e.container.value;if(!o)return;(e.initialFocus?.()??Fs(o)[0]??o).focus({preventScroll:!0})}function a(o){const i=e.container.value;if(!i||typeof document>"u")return;const l=Fs(i);if(l.length===0){o.preventDefault(),i.focus();return}const d=l[0],u=l[l.length-1],p=document.activeElement;if(!i.contains(p)){o.preventDefault(),(o.shiftKey?u:d).focus();return}o.shiftKey&&p===d?(o.preventDefault(),u.focus()):!o.shiftKey&&p===u&&(o.preventDefault(),d.focus())}function s(){const o=t;if(t=null,!(!o||typeof document>"u"))try{document.contains(o)&&o.focus({preventScroll:!0})}catch{}}return Pe(()=>{t=null}),{activate:n,handleTab:a,deactivate:s}}const im=["data-state","aria-hidden"],lm=["role","aria-labelledby","aria-describedby","aria-label"],rm={key:0,class:"va-dlg__header"},um={class:"va-dlg__body"},cm={key:1,class:"va-dlg__footer"},Tt=[];let dm=0,Yt=0,Zt=null;function fm(){if(!(typeof document>"u")){if(Yt===0){const e=document.body,t=window.innerWidth-document.documentElement.clientWidth;if(Zt={overflow:e.style.overflow,paddingRight:e.style.paddingRight},e.style.overflow="hidden",t>0){const n=Number.parseFloat(window.getComputedStyle(e).paddingRight)||0;e.style.paddingRight=`${n+t}px`}}Yt++}}function Is(){typeof document>"u"||(Yt=Math.max(0,Yt-1),Yt===0&&Zt&&(document.body.style.overflow=Zt.overflow,document.body.style.paddingRight=Zt.paddingRight,Zt=null))}const La=ce({__name:"VaDialog",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean},title:{},description:{},ariaLabel:{},role:{},size:{},closable:{type:Boolean,default:void 0},maskClosable:{type:Boolean,default:void 0},closeOnEscape:{type:Boolean,default:void 0},lockScroll:{type:Boolean,default:void 0},teleportTo:{},initialFocus:{},destroyOnClose:{type:Boolean}},emits:["update:open","close","opened","closed"],setup(e,{expose:t,emit:n}){const a=e,s=n,o=zo(),i=S(a.defaultOpen??!1),l=R(()=>a.open??i.value);function d(me){me!==l.value&&(i.value=me,s("update:open",me))}function u(){s("close"),d(!1)}function p(){d(!0)}const v=R(()=>a.closable??!0),b=R(()=>a.maskClosable??!0),_=R(()=>a.closeOnEscape??!0),g=R(()=>a.lockScroll??!0),m=R(()=>a.destroyOnClose??!1),k=R(()=>a.size??"md"),w=R(()=>a.role??"dialog"),x=S(l.value),y=S(l.value?"open":"closed"),$=++dm,D=()=>Tt[Tt.length-1]===$;let M=!1,N=!1;const K=200;function te(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}let ne=0;function V(me){const Je=++ne;if(te()){me();return}setTimeout(()=>{Je===ne&&me()},K)}const X=Re("panel");function O(){const me=a.initialFocus;if(me!=null)return typeof me=="string"?X.value?.querySelector(me)??void 0:me}const J=om({container:X,initialFocus:O}),Z=me=>{if(D()){if(me.key==="Escape"&&_.value){u();return}me.key==="Tab"&&J.handleTab(me)}};function Y(me){me.target===me.currentTarget&&(!D()||!b.value||u())}function ie(){typeof document>"u"||M||(M=!0,document.addEventListener("keydown",Z),Tt.includes($)||Tt.push($),g.value&&!N&&(fm(),N=!0))}function le(){if(!M)return;M=!1,document.removeEventListener("keydown",Z);const me=Tt.indexOf($);me>=0&&Tt.splice(me,1)}const T=dn(),P=`va-dlg-title-${T}`,L=`va-dlg-desc-${T}`,q=R(()=>!!a.title||!!o.title),fe=R(()=>q.value?P:void 0),we=R(()=>a.description?L:void 0),De=R(()=>q.value?void 0:a.ariaLabel);let ge=!1;function ee(){ge||typeof console>"u"||!q.value&&!a.ariaLabel&&(ge=!0,console.warn("[VaDialog] 缺少可访问名称:未提供 title / title 插槽时,请通过 aria-label 传入弹窗名称。"))}async function Ue(){x.value=!0,ee(),ie(),await Se(),y.value="open",await J.activate(),V(()=>s("opened"))}function bt(){y.value="closed",le(),V(()=>{J.deactivate(),N&&(Is(),N=!1),m.value&&(x.value=!1),s("closed")})}return ve(l,(me,Je)=>{me!==Je&&(me?Ue():bt())},{flush:"post"}),Le(()=>{l.value&&Ue()}),Pe(()=>{ne++,le(),N&&(Is(),N=!1),l.value&&J.deactivate()}),t({open:p,close:u}),(me,Je)=>(f(),H(Ia,{to:a.teleportTo??"body"},[x.value?(f(),h("div",{key:0,class:"va-dlg__overlay","data-state":y.value,"aria-hidden":y.value==="closed"?"true":void 0,onMousedown:Y},[c("div",{ref:"panel",class:ue(["va-dlg",`va-dlg--${k.value}`]),role:w.value,"aria-modal":"true","aria-labelledby":fe.value,"aria-describedby":we.value,"aria-label":De.value,tabindex:"-1"},[me.$slots.header||q.value||a.description?(f(),h("div",rm,[xe(me.$slots,"header",{close:u},()=>[q.value?(f(),h("h2",{key:0,id:P,class:"va-dlg__title"},[xe(me.$slots,"title",{},()=>[G(C(a.title),1)])])):A("",!0),a.description?(f(),h("p",{key:1,id:L,class:"va-dlg__desc"},C(a.description),1)):A("",!0)])])):A("",!0),c("div",um,[xe(me.$slots,"default",{close:u})]),me.$slots.footer?(f(),h("div",cm,[xe(me.$slots,"footer",{close:u})])):A("",!0),v.value?(f(),h("button",{key:2,type:"button",class:"va-dlg__close","aria-label":"关闭",onClick:u},[B(r(mt),{size:16})])):A("",!0)],10,lm)],40,im)):A("",!0)],8,["to"]))}}),vm={BASE_URL:"/",DEV:!1,MODE:"console",PROD:!0,SSR:!1},gt=vt({queue:[],details:null}),Aa=new Map;let pm=0,Fn=0,Da=!1;const hm="确认",_m="取消";function mm(){try{return vm?.DEV??!0}catch{return!0}}function gm(e){const t=e.tone??"default";return{id:++pm,title:e.title,description:e.description,tone:t,confirmText:e.confirmText??hm,cancelText:e.cancelText??_m,icon:e.icon??!1,requireText:e.requireText,checkboxLabel:e.checkboxLabel}}function km(e){if(Fn===0)return mm()&&!Da&&(Da=!0,console.warn("[VaConfirm] 未找到已挂载的 <VaConfirmHost />:vaConfirm() 将直接 resolve(false)。请在应用根节点挂载宿主组件。")),gt.details={ok:!1,checked:!1},Promise.resolve(!1);const t=gm(e),n=new Promise(a=>{Aa.set(t.id,{resolve:a})});return gt.queue.push(t),n}function Go(e,t,n=!1){const a=Aa.get(e);if(!a)return;Aa.delete(e),gt.details={ok:t,checked:n};const s=gt.queue.findIndex(o=>o.id===e);s>=0&>.queue.splice(s,1),a.resolve(t)}function bm(){for(const e of[...gt.queue])Go(e.id,!1,!1)}function ym(){Fn+=1,Da=!1}function wm(){Fn=Math.max(0,Fn-1)}const Yo=Object.assign(km,{state:gt,closeAll:bm});Object.defineProperty(Yo,"details",{get:()=>gt.details,enumerable:!0});const dt=Yo,xm=["data-tone"],$m={key:0,class:"va-confirm__icon","aria-hidden":"true"},Cm={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},Am={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},Dm={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},Rm={class:"va-confirm__title"},Em={class:"va-confirm__body"},Sm={key:0,class:"va-confirm__field"},Mm={class:"va-confirm__hint"},Tm={class:"va-confirm__need"},Fm=["placeholder"],Im={key:1,class:"va-confirm__check"},Bm=["disabled"],zm=ce({__name:"VaConfirmHost",setup(e){const t=S(null),n=S(!1),a=S(!1),s=S(""),o=R(()=>{const _=t.value?.requireText;return!!_&&s.value!==_}),i=R(()=>!o.value),l=R(()=>{const _=t.value;if(_)return _.requireText?".va-confirm__input":_.tone==="danger"||_.tone==="warning"?".va-confirm__btn--cancel":".va-confirm__btn--confirm"});function d(){a.value=!1,s.value=""}function u(){const _=dt.state.queue[0];!_||t.value||(d(),t.value=_,Se(()=>{n.value=!0}))}ve(()=>[dt.state.queue[0]?.id??null,t.value?.id??null],([_,g])=>{g===null&&_!==null&&u()},{flush:"post"}),ve(()=>t.value?dt.state.queue.some(_=>_.id===t.value.id):!0,_=>{!_&&t.value&&n.value&&(n.value=!1)},{flush:"post"});function p(_){const g=t.value;g&&(Go(g.id,_,a.value),n.value=!1)}function v(){t.value&&(t.value=null)}function b(){i.value&&p(!0)}return Le(ym),Pe(()=>{wm(),dt.closeAll()}),(_,g)=>t.value?(f(),H(La,{key:0,open:n.value,title:t.value.title,description:t.value.description,"initial-focus":l.value,closable:!1,role:"alertdialog",size:"sm",onClose:g[4]||(g[4]=m=>p(!1)),onClosed:v},{title:oe(()=>[c("span",{class:"va-confirm__heading","data-tone":t.value.tone},[t.value.icon?(f(),h("span",$m,[t.value.tone==="danger"?(f(),h("svg",Cm,[...g[5]||(g[5]=[c("circle",{cx:"12",cy:"12",r:"9"},null,-1),c("path",{d:"M12 8v4.5M12 16h.01"},null,-1)])])):t.value.tone==="warning"?(f(),h("svg",Am,[...g[6]||(g[6]=[c("path",{d:"M12 9v4M12 16.5h.01M10.3 3.9 2.8 17a2 2 0 0 0 1.7 3h15a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"},null,-1)])])):(f(),h("svg",Dm,[...g[7]||(g[7]=[c("circle",{cx:"12",cy:"12",r:"9"},null,-1),c("path",{d:"M9.6 9.3a2.4 2.4 0 0 1 4.7.5c0 1.6-2.3 2-2.3 3.4"},null,-1),c("path",{d:"M12 16.5h.01"},null,-1)])]))])):A("",!0),c("span",Rm,C(t.value.title),1)],8,xm)]),footer:oe(()=>[c("button",{type:"button",class:"va-act va-confirm__btn va-confirm__btn--cancel",onClick:g[2]||(g[2]=m=>p(!1))},C(t.value.cancelText),1),c("button",{type:"button",class:ue(["va-act va-confirm__btn va-confirm__btn--confirm",{"va-act--primary":t.value.tone==="default","va-confirm__btn--danger":t.value.tone==="danger","va-confirm__btn--warning":t.value.tone==="warning"}]),disabled:!i.value,onClick:g[3]||(g[3]=m=>p(!0))},C(t.value.confirmText),11,Bm)]),default:oe(()=>[c("div",Em,[t.value.requireText?(f(),h("label",Sm,[c("span",Mm,[g[8]||(g[8]=G(" 请输入 ",-1)),c("code",Tm,C(t.value.requireText),1),g[9]||(g[9]=G(" 以确认 ",-1))]),ye(c("input",{"onUpdate:modelValue":g[0]||(g[0]=m=>s.value=m),class:"va-confirm__input",type:"text",autocomplete:"off",spellcheck:"false",placeholder:t.value.requireText,onKeydown:ze(b,["enter"])},null,40,Fm),[[Ee,s.value]])])):A("",!0),t.value.checkboxLabel?(f(),h("label",Im,[ye(c("input",{"onUpdate:modelValue":g[1]||(g[1]=m=>a.value=m),type:"checkbox"},null,512),[[Po,a.value]]),c("span",null,C(t.value.checkboxLabel),1)])):A("",!0)])]),_:1},8,["open","title","description","initial-focus"])):A("",!0)}});function Pm(e={}){const t=e.stepMs??40,n=e.maxItems??8,a=e.disabled??!1,s=typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1);function o(i){return s||a?{"animation-delay":"0ms"}:{"animation-delay":`${Math.min(Math.max(i,0),n)*t}ms`}}return{delayStyle:o}}function Qo(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function In(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),Qo(n.getTime())}function Bs(e){const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function zs(e,t){const n=new Date(e,t,1),a=(n.getDay()+6)%7,s=In(n.getTime(),-a);return Array.from({length:42},(o,i)=>{const l=In(s,i),d=new Date(l);return{ts:l,day:d.getDate(),inMonth:d.getMonth()===t}})}const Lm=[{id:"today",label:"今天",from:0,to:0},{id:"7d",label:"近 7 天",from:-6,to:0},{id:"30d",label:"近 30 天",from:-29,to:0}];function Om(e,t){const n=S(!1),a=S((()=>{const k=e.end??e.start??Date.now(),w=new Date(k);return[w.getFullYear(),w.getMonth()]})()),s=R(()=>[...Lm,...e.presets??[]]),o=R(()=>zs(a.value[0],a.value[1])),i=R(()=>{const[k,w]=a.value;return zs(w===11?k+1:k,w===11?0:w+1)}),l=k=>{const[w,x]=a.value,y=x+k;return`${y<0?w-1:y>11?w+1:w} 年 ${(y%12+12)%12+1} 月`};function d(k){const[w,x]=a.value,y=x+k;a.value=[y<0?w-1:y>11?w+1:w,(y%12+12)%12]}const u=R(()=>e.start!==void 0&&e.end!==void 0?`${Bs(e.start)} → ${Bs(e.end)}`:e.placeholder??"选择日期范围"),p=S(null),v=S(null);function b(k,w){if(p.value===null)p.value=k,w.start(k),w.end(k),w.change({start:k,end:k});else{const[x,y]=p.value<=k?[p.value,k]:[k,p.value];p.value=null,w.start(x),w.end(y),w.change({start:x,end:y}),n.value=!1}}function _(k,w){const x=Qo(Date.now()),y=In(x,k.from),$=In(x,k.to);p.value=null,w.start(y),w.end($),w.change({start:y,end:$}),n.value=!1}function g(k){const w=p.value??e.start,x=p.value!==null?v.value:e.end;return w!==void 0&&k===w?"start":x!=null&&k===x?"end":w!==void 0&&x!==null&&x!==void 0&&k>w&&k<x?"in":""}const m=k=>{n.value&&t.value&&!t.value.contains(k.target)&&(n.value=!1)};return Le(()=>{typeof document<"u"&&document.addEventListener("mousedown",m)}),Pe(()=>{typeof document<"u"&&document.removeEventListener("mousedown",m)}),ve(()=>[e.start,e.end],()=>{(e.start===void 0||e.end===void 0)&&(p.value=e.start??null)},{immediate:!0}),{open:n,anchor:a,presets:s,leftGrid:o,rightGrid:i,monthLabel:l,summary:u,shiftMonth:d,onPick:b,applyPreset:_,hoverTs:v,cellState:g}}const jm={ref:"root",class:"va-drp"},Um=["aria-expanded"],Nm={key:0,class:"va-drp__panel",role:"dialog","aria-label":"选择日期范围"},qm={class:"va-drp__presets"},Wm=["onClick"],Vm={class:"va-drp__calendars"},Jm={class:"va-drp__cal"},Km={class:"va-drp__month"},Hm=["aria-label"],Zm=["data-state","data-out","data-today","aria-label","onClick","onMouseenter"],Xm={key:0,class:"va-drp__cal"},Gm={class:"va-drp__month"},Ym=["aria-label"],Qm=["data-state","data-out","data-today","aria-label","onClick","onMouseenter"],e1={class:"va-drp__foot"},t1=ce({__name:"VaDateRangePicker",props:{start:{},end:{},presets:{},placeholder:{},months:{}},emits:["update:start","update:end","change"],setup(e,{emit:t}){const n=e,a=t,s=Re("root"),o={start:$=>a("update:start",$),end:$=>a("update:end",$),change:$=>a("change",$)},{open:i,presets:l,leftGrid:d,rightGrid:u,monthLabel:p,summary:v,shiftMonth:b,onPick:_,applyPreset:g,hoverTs:m,cellState:k}=Om(n,s),w=["一","二","三","四","五","六","日"],x=new Date,y=new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime();return($,D)=>(f(),h("div",jm,[c("button",{class:"va-drp__trigger",type:"button","aria-expanded":r(i),"aria-haspopup":"dialog",onClick:D[0]||(D[0]=M=>i.value=!r(i))},[D[6]||(D[6]=c("span",{"aria-hidden":"true"},"▤",-1)),G(" "+C(r(v)),1)],8,Um),r(i)?(f(),h("div",Nm,[c("div",qm,[(f(!0),h(j,null,Q(r(l),M=>(f(),h("button",{key:M.id,class:"va-act va-act--sm va-drp__preset",type:"button",onClick:N=>r(g)(M,o)},C(M.label),9,Wm))),128))]),c("div",Vm,[c("div",Jm,[c("header",Km,[c("button",{class:"va-drp__nav",type:"button","aria-label":"上一个月",onClick:D[1]||(D[1]=M=>r(b)(-1))},"‹"),c("span",null,C(r(p)(0)),1)]),c("div",{class:"va-drp__grid",role:"grid","aria-label":r(p)(0)},[(f(),h(j,null,Q(w,M=>c("span",{key:M,class:"va-drp__wd","aria-hidden":"true"},C(M),1)),64)),(f(!0),h(j,null,Q(r(d),M=>(f(),h("button",{key:M.ts,class:"va-drp__day",type:"button","data-state":r(k)(M.ts),"data-out":!M.inMonth,"data-today":M.ts===r(y),"aria-label":new Date(M.ts).toLocaleDateString(),onClick:N=>r(_)(M.ts,o),onMouseenter:N=>m.value=M.ts,onMouseleave:D[2]||(D[2]=N=>m.value=null)},C(M.day),41,Zm))),128))],8,Hm)]),n.months!==1?(f(),h("div",Xm,[c("header",Gm,[c("span",null,C(r(p)(1)),1),c("button",{class:"va-drp__nav",type:"button","aria-label":"下一个月",onClick:D[3]||(D[3]=M=>r(b)(1))},"›")]),c("div",{class:"va-drp__grid",role:"grid","aria-label":r(p)(1)},[(f(),h(j,null,Q(w,M=>c("span",{key:M,class:"va-drp__wd","aria-hidden":"true"},C(M),1)),64)),(f(!0),h(j,null,Q(r(u),M=>(f(),h("button",{key:M.ts,class:"va-drp__day",type:"button","data-state":r(k)(M.ts),"data-out":!M.inMonth,"data-today":M.ts===r(y),"aria-label":new Date(M.ts).toLocaleDateString(),onClick:N=>r(_)(M.ts,o),onMouseenter:N=>m.value=M.ts,onMouseleave:D[4]||(D[4]=N=>m.value=null)},C(M.day),41,Qm))),128))],8,Ym)])):A("",!0)]),c("footer",e1,[D[7]||(D[7]=c("span",{class:"va-drp__hint"},"点击两个日期确定范围",-1)),c("button",{class:"va-drp__clear",type:"button",onClick:D[5]||(D[5]=M=>{o.start(Date.now()),o.end(Date.now()),i.value=!1})},"跳到今天")])])):A("",!0)],512))}}),n1=["aria-label"],a1={class:"va-ns__head"},s1={class:"va-ns__title"},o1={key:0,class:"va-ns__count"},i1={key:0,class:"va-ns__empty va-fade-in"},l1=["data-kind","data-unread"],r1=["onClick"],u1={class:"va-ns__icon","aria-hidden":"true"},c1={class:"va-ns__text"},d1={class:"va-ns__t"},f1={key:0,class:"va-ns__b"},v1={key:1,class:"va-ns__time"},p1={key:0,class:"va-ns__dot","aria-label":"未读"},h1=ce({__name:"VaNotificationStack",props:{notifications:{},title:{},relativeTime:{type:Boolean,default:!0},emptyLabel:{},maxHeight:{}},emits:["open","read","allRead"],setup(e,{emit:t}){const n=e,a=t,s=R(()=>n.notifications.length>0),o=On(3e4,s),i=R(()=>n.notifications.filter(u=>u.unread).length),l={info:"i",success:"✓",warning:"!",danger:"✕",agent:"✦"};function d(u){const p=n.notifications.find(v=>v.id===u);p&&(p.unread&&a("read",u),a("open",p))}return(u,p)=>(f(),h("section",{class:"va-ns","aria-label":n.title??"通知"},[c("header",a1,[c("h3",s1,[G(C(n.title??"通知")+" ",1),i.value?(f(),h("span",o1,C(i.value),1)):A("",!0)]),i.value?(f(),h("button",{key:0,class:"va-ns__allread",type:"button",onClick:p[0]||(p[0]=v=>a("allRead"))},"全部已读")):A("",!0)]),n.notifications.length?(f(),H(Pt,{key:1,tag:"ul",name:"va-ns",class:"va-ns__list",style:be(n.maxHeight?{maxHeight:`${n.maxHeight}px`}:void 0)},{default:oe(()=>[(f(!0),h(j,null,Q(n.notifications,v=>(f(),h("li",{key:v.id,class:"va-ns__item","data-kind":v.kind??"info","data-unread":v.unread??!1},[c("button",{class:"va-ns__main",type:"button",onClick:b=>d(v.id)},[c("span",u1,C(l[v.kind??"info"]),1),c("span",c1,[c("span",d1,C(v.title),1),v.body?(f(),h("span",f1,C(v.body),1)):A("",!0),v.createdAt&&n.relativeTime?(f(),h("span",v1,C(r(Ko)(v.createdAt,r(o))),1)):A("",!0)])],8,r1),v.unread?(f(),h("span",p1)):A("",!0)],8,l1))),128))]),_:1},8,["style"])):(f(),h("p",i1,C(n.emptyLabel??"没有新通知"),1))],8,n1))}}),_1={class:"va-cs va-enter-up","aria-label":"变更摘要"},m1={class:"va-cs__head"},g1={class:"va-cs__title"},k1={class:"va-cs__stats",role:"status"},b1={class:"va-cs__add"},y1={class:"va-cs__del"},w1={class:"va-cs__files"},x1=["onClick"],$1=["data-status"],C1={class:"va-cs__path"},A1={key:1,class:"va-cs__diff"},D1={class:"va-cs__add"},R1={class:"va-cs__del"},E1=ce({__name:"VaChangeSummary",props:{title:{},files:{},duration:{},toolCalls:{},finishedAt:{},maxFiles:{}},emits:["openFile","toggleAll"],setup(e,{emit:t}){const n=e,a=t,s=R(()=>n.files.reduce((u,p)=>({additions:u.additions+(p.additions??0),deletions:u.deletions+(p.deletions??0)}),{additions:0,deletions:0})),o=S(!0),i=R(()=>n.maxFiles!==void 0?Math.max(0,n.files.length-n.maxFiles):0),l=R(()=>i.value&&o.value?n.files.slice(0,n.maxFiles):n.files),{delayStyle:d}=Pm();return(u,p)=>(f(),h("section",_1,[c("header",m1,[c("span",g1,C(n.title??"本轮变更"),1),c("span",k1,[G(C(e.files.length)+" 个文件 ",1),s.value.additions||s.value.deletions?(f(),h(j,{key:0},[p[1]||(p[1]=G(" · ",-1)),c("b",b1,"+"+C(s.value.additions),1),p[2]||(p[2]=G()),c("b",y1,"−"+C(s.value.deletions),1)],64)):A("",!0),n.duration?(f(),h(j,{key:1},[G(" · "+C(r(za)(n.duration)),1)],64)):A("",!0),n.toolCalls?(f(),h(j,{key:2},[G(" · "+C(n.toolCalls)+" 次工具调用",1)],64)):A("",!0)])]),c("ul",w1,[(f(!0),h(j,null,Q(l.value,(v,b)=>(f(),h("li",{key:v.path,class:"va-enter-up",style:be(r(d)(b))},[c("button",{class:"va-cs__file",type:"button",onClick:_=>a("openFile",v)},[v.status?(f(),h("span",{key:0,class:"va-cs__status","data-status":v.status},C(r(xa)[v.status]),9,$1)):A("",!0),c("span",C1,C(v.path),1),v.additions||v.deletions?(f(),h("span",A1,[c("b",D1,"+"+C(v.additions??0),1),c("b",R1,"−"+C(v.deletions??0),1)])):A("",!0)],8,x1)],4))),128))]),i.value?(f(),h("button",{key:0,class:"va-cs__more",type:"button",onClick:p[0]||(p[0]=v=>{o.value=!o.value,a("toggleAll")})},C(o.value?`展开其余 ${i.value} 个文件`:`收起,只看前 ${n.maxFiles} 个`),1)):A("",!0)]))}}),S1=["aria-label"],M1=["onClick"],T1={class:"va-bdc__label"},F1={class:"va-bdc__track","aria-hidden":"true"},I1={class:"va-bdc__value"},B1={class:"va-bdc__pct"},z1=ce({__name:"VaBreakdownChart",props:{items:{},total:{},unit:{},barScale:{},maxRows:{}},emits:["select"],setup(e,{emit:t}){const n=e,a=t,s=["var(--va-info)","var(--va-accent)","var(--va-success)","var(--va-warning)","var(--va-muted)"],o=(u,p)=>p?.color??s[u%s.length],i=R(()=>{const u=[...n.items].sort((b,_)=>_.value-b.value);let p=u;if(n.maxRows!==void 0&&u.length>n.maxRows){const b=u.slice(0,n.maxRows-1),_=u.slice(n.maxRows-1);p=[...b,{label:"其他",value:_.reduce((g,m)=>g+m.value,0)}]}const v=n.total??u.reduce((b,_)=>b+_.value,0);return p.map(b=>({...b,pct:v>0?b.value/v:0}))}),l=R(()=>Math.max(1,...i.value.map(u=>u.value))),d=u=>u.toLocaleString("en-US");return(u,p)=>(f(),h("div",{class:"va-bdc",role:"img","aria-label":`分布:${i.value.map(v=>`${v.label} ${Math.round(v.pct*100)}%`).join(",")}`},[(f(!0),h(j,null,Q(i.value,(v,b)=>(f(),h("button",{key:v.label,class:"va-bdc__row",type:"button",onClick:_=>a("select",v)},[c("span",{class:"va-bdc__swatch",style:be({background:o(b,v.label==="其他"?void 0:v)}),"aria-hidden":"true"},null,4),c("span",T1,C(v.label),1),c("span",F1,[c("span",{class:"va-bdc__bar",style:be({width:`${(n.barScale==="total"?v.pct:v.value/l.value)*100}%`,background:o(b,v.label==="其他"?void 0:v)})},null,4)]),c("span",I1,C(d(v.value))+C(n.unit?` ${n.unit}`:""),1),c("span",B1,C(Math.round(v.pct*100))+"%",1)],8,M1))),128))],8,S1))}});function P1(e,t,n){return{nodes:R(()=>{const s=e(),o=t(),i=[],l=/\[(\d+)\]/g;let d=0,u;for(;(u=l.exec(s))!==null;){u.index>d&&i.push(u[0]?_t("span",s.slice(d,u.index)):_t("span"));const p=Number(u[1])-1;o[p]?i.push(_t("button",{class:"va-ans__cite",type:"button","aria-label":`查看来源 ${u[1]}`,onClick:()=>n(p)},u[1])):i.push(_t("span",u[0])),d=u.index+u[0].length}return d<s.length&&i.push(_t("span",s.slice(d))),i})}}const L1=["data-streaming"],O1={key:0,class:"va-ans__q"},j1={class:"va-ans__body"},U1={key:0,class:"va-ans__cursor","aria-hidden":"true"},N1={key:1,class:"va-ans__sr"},q1={key:1,class:"va-ans__sources"},W1={class:"va-ans__list"},V1=["onClick"],J1={class:"va-ans__no","aria-hidden":"true"},K1={class:"va-ans__src-main"},H1={class:"va-ans__src-title-text"},Z1={key:0,class:"va-ans__origin"},X1=ce({__name:"VaAiAnswer",props:{question:{},answer:{},sources:{},streaming:{type:Boolean},streamingLabel:{}},emits:["source"],setup(e,{emit:t}){const n=e,a=t;function s(i){const l=n.sources[i];l&&a("source",l)}const{nodes:o}=P1(()=>n.answer,()=>n.sources,s);return(i,l)=>(f(),h("article",{class:"va-ans","data-streaming":n.streaming??!1},[n.question?(f(),h("p",O1,C(n.question),1)):A("",!0),c("div",j1,[(f(!0),h(j,null,Q(r(o),(d,u)=>(f(),H(Ba(d),{key:u}))),128)),n.streaming?(f(),h("span",U1)):A("",!0),n.streaming?(f(),h("span",N1,C(n.streamingLabel??"正在生成回答"),1)):A("",!0)]),n.sources.length?(f(),h("footer",q1,[l[0]||(l[0]=c("h4",{class:"va-ans__src-title"},"来源",-1)),c("ol",W1,[(f(!0),h(j,null,Q(n.sources,(d,u)=>(f(),h("li",{key:d.id},[c("button",{class:"va-ans__src",type:"button",onClick:p=>a("source",d)},[c("span",J1,C(u+1),1),c("span",K1,[c("span",H1,C(d.title),1),d.origin?(f(),h("span",Z1,C(d.origin),1)):A("",!0)])],8,V1)]))),128))])])):A("",!0)],8,L1))}}),G1={key:0,class:"va-form__head"},Y1={key:0,class:"va-form__title"},Q1={key:1,class:"va-form__desc"},e0={class:"va-form__fields"},t0=["for"],n0={key:0,class:"va-form__req","aria-hidden":"true"},a0={key:1,class:"va-form__badge"},s0=["id"],o0={key:0,class:"va-form__req","aria-hidden":"true"},i0={key:1,class:"va-form__badge"},l0={class:"va-form__control-row"},r0=["id","onUpdate:modelValue","placeholder","disabled","aria-invalid","aria-describedby","onInput"],u0={key:2,class:"va-form__switch"},c0=["id","checked","disabled","onChange"],d0=["id","onUpdate:modelValue","type","placeholder","disabled","step","aria-invalid","aria-describedby","onInput"],f0={key:1,class:"va-form__unit"},v0=["id"],p0={key:3,class:"va-form__hint"},h0={class:"va-form__actions"},_0=ce({__name:"VaForm",props:{title:{default:void 0},description:{default:void 0},fields:{},submitLabel:{default:"提交"},cancelLabel:{default:"取消"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},fieldErrors:{default:void 0}},emits:["submit","cancel"],setup(e,{emit:t}){const n=e,a=t;function s(x){const y=x.default;switch(x.type){case"number":return typeof y=="number"&&Number.isFinite(y)?y:void 0;case"boolean":return typeof y=="boolean"?y:!1;case"select":return typeof y=="string"?y:"";default:return typeof y=="string"?y:""}}const o=S({}),i=S({}),l=S({}),d=S({});ve(()=>n.fields.map(x=>`${x.key}:${x.type}`).join("|"),()=>{const x={},y=n.fields.filter($=>!/^(?:__proto__|constructor|prototype)$/.test($.key));for(const $ of y)x[$.key]=s($);o.value=x,i.value={},l.value={},d.value={}},{immediate:!0});const v=x=>{if(i.value[x]=!0,d.value[x]=!0,l.value[x]){const{[x]:y,...$}=l.value;l.value=$}},b=x=>{if(l.value[x])return l.value[x];if(!d.value[x])return n.fieldErrors?.[x]},_=S({}),g=x=>x.type==="number"?"number":x.type==="date"?"date":x.secret?_.value[x.key]?"text":"password":"text",m=x=>x==null||typeof x=="string"&&x.trim()==="",k=()=>{const x={},y={};for(const $ of n.fields){if(/^(?:__proto__|constructor|prototype)$/.test($.key))continue;const D=o.value[$.key];if($.type==="boolean"){x[$.key]=D===!0;continue}if(m(D)){$.required&&(y[$.key]="必填项"),x[$.key]=$.type==="number"?void 0:"";continue}if($.type==="number"){const M=typeof D=="number"?D:Number(String(D).trim());if(!Number.isFinite(M)){y[$.key]="必须是数字",x[$.key]=void 0;continue}x[$.key]=M;continue}x[$.key]=String(D).trim()}return{values:x,errors:y}},w=()=>{if(n.disabled||n.loading)return;const{values:x,errors:y}=k();if(Object.keys(y).length>0){l.value=y;return}l.value={},d.value={},a("submit",x,Object.keys(i.value))};return(x,y)=>(f(),h("section",{class:ue(["va-form",{"va-form--disabled":e.disabled}])},[e.title||e.description?(f(),h("header",G1,[e.title?(f(),h("h4",Y1,C(e.title),1)):A("",!0),e.description?(f(),h("p",Q1,C(e.description),1)):A("",!0)])):A("",!0),c("div",e0,[(f(!0),h(j,null,Q(e.fields,$=>(f(),h("div",{key:$.key,class:"va-form__field"},[$.type!=="select"?(f(),h("label",{key:0,for:`va-form-${$.key}`,class:"va-form__label"},[G(C($.label)+" ",1),$.required?(f(),h("span",n0,"*")):A("",!0),$.secret?(f(),h("span",a0,"敏感")):A("",!0)],8,t0)):(f(),h("span",{key:1,id:`va-form-lbl-${$.key}`,class:"va-form__label"},[G(C($.label)+" ",1),$.required?(f(),h("span",o0,"*")):A("",!0),$.secret?(f(),h("span",i0,"敏感")):A("",!0)],8,s0)),c("div",l0,[$.type==="textarea"?ye((f(),h("textarea",{key:0,id:`va-form-${$.key}`,"onUpdate:modelValue":D=>o.value[$.key]=D,class:ue(["va-form__control va-form__control--area",{"va-form__control--error":b($.key)}]),placeholder:$.placeholder,disabled:e.disabled,rows:"3",maxlength:"2000","aria-invalid":b($.key)?"true":void 0,"aria-describedby":b($.key)?`va-form-err-${$.key}`:void 0,onInput:D=>v($.key)},null,42,r0)),[[Ee,o.value[$.key]]]):$.type==="select"?(f(),H(r(Tn),{key:1,class:"va-form__select","model-value":o.value[$.key]||"",options:$.options||[],disabled:e.disabled,invalid:!!b($.key),placeholder:$.placeholder||"请选择",label:$.label,"onUpdate:modelValue":D=>{o.value[$.key]=D,v($.key)}},null,8,["model-value","options","disabled","invalid","placeholder","label","onUpdate:modelValue"])):$.type==="boolean"?(f(),h("label",u0,[c("input",{id:`va-form-${$.key}`,type:"checkbox",checked:o.value[$.key]===!0,disabled:e.disabled,onChange:D=>{o.value[$.key]=D.target.checked,v($.key)}},null,40,c0),c("span",null,C(o.value[$.key]===!0?"是":"否"),1)])):(f(),h(j,{key:3},[ye(c("input",{id:`va-form-${$.key}`,"onUpdate:modelValue":D=>o.value[$.key]=D,class:ue(["va-form__control",{"va-form__control--error":b($.key)}]),type:g($),placeholder:$.placeholder,disabled:e.disabled,step:$.type==="number"?"any":void 0,maxlength:"2000","aria-invalid":b($.key)?"true":void 0,"aria-describedby":b($.key)?`va-form-err-${$.key}`:void 0,onInput:D=>v($.key)},null,42,d0),[[Lo,o.value[$.key]]]),$.secret?(f(),H(r(Bt),{key:0,variant:"ghost",size:"sm",disabled:e.disabled,onClick:D=>_.value[$.key]=!_.value[$.key]},{default:oe(()=>[G(C(_.value[$.key]?"隐藏":"显示"),1)]),_:2},1032,["disabled","onClick"])):A("",!0),$.unit?(f(),h("span",f0,C($.unit),1)):A("",!0)],64))]),b($.key)?(f(),h("p",{key:2,id:`va-form-err-${$.key}`,class:"va-form__error"},C(b($.key)),9,v0)):$.description?(f(),h("p",p0,C($.description),1)):A("",!0)]))),128))]),c("footer",h0,[B(r(Bt),{variant:"primary",disabled:e.disabled||e.loading,onClick:w},{default:oe(()=>[G(C(e.submitLabel),1)]),_:1},8,["disabled"]),B(r(Bt),{variant:"secondary",disabled:e.disabled,onClick:y[0]||(y[0]=$=>a("cancel"))},{default:oe(()=>[G(C(e.cancelLabel),1)]),_:1},8,["disabled"])]),xe(x.$slots,"after-actions")],2))}}),m0=64;function g0(e,t){const n=m0,a=S(!0);let s=null,o=!1;function i(){const p=e.value;p&&(a.value=p.scrollHeight-p.scrollTop-p.clientHeight<n)}function l(){i()}function d(p){p?.force&&(o=!0),s===null&&(s=requestAnimationFrame(()=>{s=null;const v=o;if(o=!1,!v&&!a.value)return;const b=e.value;b&&(b.scrollTop=b.scrollHeight)}))}function u(){s!==null&&(cancelAnimationFrame(s),s=null,o=!1)}return ql()&&Pe(u),{isPinned:a,onScroll:l,updatePinned:i,scrollToBottom:d,dispose:u}}const k0={class:"va-board",role:"list","aria-label":"任务看板"},b0=["aria-label"],y0={class:"va-board__col-head"},w0={class:"va-board__col-title"},x0={class:"va-board__count"},$0={class:"va-board__cards"},C0={key:0,class:"va-board__none"},A0=["data-selected","onClick"],D0={class:"va-board__card-title"},R0={class:"va-board__card-foot"},E0=["data-priority","aria-label"],S0={key:1,class:"va-board__meta"},M0=["aria-label"],T0=ce({__name:"VaTaskBoard",props:{columns:{},tasks:{},selected:{},defaultSelected:{}},emits:["update:selected","open"],setup(e,{emit:t}){const n=e,a=t,s=S(!1),o=S(n.defaultSelected),i=R(()=>n.selected!==void 0||s.value?n.selected:o.value),l=u=>n.tasks.filter(p=>p.columnId===u);function d(u){s.value=!0,o.value=u.id,a("update:selected",u.id),a("open",u)}return(u,p)=>(f(),h("div",k0,[(f(!0),h(j,null,Q(n.columns,v=>(f(),h("section",{key:v.id,class:"va-board__col","aria-label":v.title},[c("header",y0,[c("span",w0,C(v.title),1),c("span",x0,C(v.hint??l(v.id).length),1)]),c("div",$0,[l(v.id).length?A("",!0):(f(),h("p",C0,"空")),(f(!0),h(j,null,Q(l(v.id),b=>(f(),h("button",{key:b.id,class:"va-board__card",type:"button","data-selected":b.id===i.value,onClick:_=>d(b)},[c("span",D0,C(b.title),1),c("span",R0,[b.priority?(f(),h("span",{key:0,class:"va-board__prio","data-priority":b.priority,"aria-label":`优先级:${b.priority}`},null,8,E0)):A("",!0),b.meta?(f(),h("span",S0,C(b.meta),1)):A("",!0),b.assignee?(f(),h("span",{key:2,class:"va-board__assignee","aria-label":`负责人 ${b.assignee}`},C(b.assignee.slice(0,1)),9,M0)):A("",!0)])],8,A0))),128))])],8,b0))),128))]))}});function F0(e,t){const a=(t+e).replace(/\r\n|\r/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
|
|
7
|
+
`),s=a.pop()??"",o=[];for(const i of a){const l=[];for(const d of i.split(`
|
|
8
|
+
`))d.startsWith("data:")&&l.push(d.replace(/^data:\s*/,""));l.length!==0&&o.push(l.join(`
|
|
9
|
+
`))}return{payloads:o,buffer:s}}async function I0(e){const n=(await e.open()).body?.getReader();if(!n)throw new Error("ReadableStream not supported or empty response");const a=new TextDecoder("utf-8");let s="",o=!1;try{for(;;){const{done:i,value:l}=await n.read();if(i)break;const{payloads:d,buffer:u}=F0(a.decode(l,{stream:!0}),s);s=u;for(const p of d){if(p==="[DONE]"){e.onDone?.();continue}try{e.onEvent(JSON.parse(p))}catch(v){e.onParseError?e.onParseError(p,v):console.warn("[vuagent-ui] 解析 SSE 块失败:",p,v)}}}}catch(i){if(i?.name==="AbortError"||e.signal?.aborted)o=!0;else throw i}return{aborted:o}}const Ps={schedule(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):(e(),null)},cancel(e){typeof e=="number"&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e)}};function B0(e){const t=e.scheduler??Ps;let n="",a=null;const s=()=>{a=null;const o=n;n="",o&&e.commit(o)};return{push(o){if(n+=o,a!==null)return;if(t===Ps&&typeof requestAnimationFrame!="function"){s();return}const i=t.schedule(()=>{a===i&&s()});a=i},flush(){a!==null&&(t.cancel(a),a=null),s()},drop(){a!==null&&(t.cancel(a),a=null),n=""},get pendingText(){return n}}}const Ls={};function z0(e){let t=Ls[e];if(t)return t;t=Ls[e]=[];for(let n=0;n<128;n++){const a=String.fromCharCode(n);t.push(a)}for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);t[a]="%"+("0"+a.toString(16).toUpperCase()).slice(-2)}return t}function Ot(e,t){typeof t!="string"&&(t=Ot.defaultChars);const n=z0(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(a){let s="";for(let o=0,i=a.length;o<i;o+=3){const l=parseInt(a.slice(o+1,o+3),16);if(l<128){s+=n[l];continue}if((l&224)===192&&o+3<i){const d=parseInt(a.slice(o+4,o+6),16);if((d&192)===128){const u=l<<6&1984|d&63;u<128?s+="��":s+=String.fromCharCode(u),o+=3;continue}}if((l&240)===224&&o+6<i){const d=parseInt(a.slice(o+4,o+6),16),u=parseInt(a.slice(o+7,o+9),16);if((d&192)===128&&(u&192)===128){const p=l<<12&61440|d<<6&4032|u&63;p<2048||p>=55296&&p<=57343?s+="���":s+=String.fromCharCode(p),o+=6;continue}}if((l&248)===240&&o+9<i){const d=parseInt(a.slice(o+4,o+6),16),u=parseInt(a.slice(o+7,o+9),16),p=parseInt(a.slice(o+10,o+12),16);if((d&192)===128&&(u&192)===128&&(p&192)===128){let v=l<<18&1835008|d<<12&258048|u<<6&4032|p&63;v<65536||v>1114111?s+="����":(v-=65536,s+=String.fromCharCode(55296+(v>>10),56320+(v&1023))),o+=9;continue}}s+="�"}return s})}Ot.defaultChars=";/?:@&=+$,#";Ot.componentChars="";const Os={};function P0(e){let t=Os[e];if(t)return t;t=Os[e]=[];for(let n=0;n<128;n++){const a=String.fromCharCode(n);/^[0-9a-z]$/i.test(a)?t.push(a):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function ut(e,t,n){typeof t!="string"&&(n=t,t=ut.defaultChars),typeof n>"u"&&(n=!0);const a=P0(t);let s="";for(let o=0,i=e.length;o<i;o++){const l=e.charCodeAt(o);if(n&&l===37&&o+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(o+1,o+3))){s+=e.slice(o,o+3),o+=2;continue}if(l<128){s+=a[l];continue}if(l>=55296&&l<=57343){if(l>=55296&&l<=56319&&o+1<i){const d=e.charCodeAt(o+1);if(d>=56320&&d<=57343){s+=encodeURIComponent(e[o]+e[o+1]),o++;continue}}s+="%EF%BF%BD";continue}s+=encodeURIComponent(e[o])}return s}ut.defaultChars=";/?:@&=+$,-_.!~*'()#";ut.componentChars="-_.!~*'()";function Ra(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Bn(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const L0=/^([a-z0-9.+-]+:)/i,O0=/:[0-9]*$/,j0=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,U0=["<",">",'"',"`"," ","\r",`
|
|
10
|
+
`," "],N0=["{","}","|","\\","^","`"].concat(U0),q0=["'"].concat(N0),js=["%","/","?",";","#"].concat(q0),Us=["/","?","#"],W0=255,Ns=/^[+a-z0-9A-Z_-]{0,63}$/,V0=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,qs={javascript:!0,"javascript:":!0},Ws={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ea(e,t){if(e&&e instanceof Bn)return e;const n=new Bn;return n.parse(e,t),n}Bn.prototype.parse=function(e,t){let n,a,s,o=e;if(o=o.trim(),!t&&e.split("#").length===1){const u=j0.exec(o);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=L0.exec(o);if(i&&(i=i[0],n=i.toLowerCase(),this.protocol=i,o=o.substr(i.length)),(t||i||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(s=o.substr(0,2)==="//",s&&!(i&&qs[i])&&(o=o.substr(2),this.slashes=!0)),!qs[i]&&(s||i&&!Ws[i])){let u=-1;for(let g=0;g<Us.length;g++)a=o.indexOf(Us[g]),a!==-1&&(u===-1||a<u)&&(u=a);let p,v;u===-1?v=o.lastIndexOf("@"):v=o.lastIndexOf("@",u),v!==-1&&(p=o.slice(0,v),o=o.slice(v+1),this.auth=p),u=-1;for(let g=0;g<js.length;g++)a=o.indexOf(js[g]),a!==-1&&(u===-1||a<u)&&(u=a);u===-1&&(u=o.length),o[u-1]===":"&&u--;const b=o.slice(0,u);o=o.slice(u),this.parseHost(b),this.hostname=this.hostname||"";const _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_){const g=this.hostname.split(/\./);for(let m=0,k=g.length;m<k;m++){const w=g[m];if(w&&!w.match(Ns)){let x="";for(let y=0,$=w.length;y<$;y++)w.charCodeAt(y)>127?x+="x":x+=w[y];if(!x.match(Ns)){const y=g.slice(0,m),$=g.slice(m+1),D=w.match(V0);D&&(y.push(D[1]),$.unshift(D[2])),$.length&&(o=$.join(".")+o),this.hostname=y.join(".");break}}}}this.hostname.length>W0&&(this.hostname=""),_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const l=o.indexOf("#");l!==-1&&(this.hash=o.substr(l),o=o.slice(0,l));const d=o.indexOf("?");return d!==-1&&(this.search=o.substr(d),o=o.slice(0,d)),o&&(this.pathname=o),Ws[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Bn.prototype.parseHost=function(e){let t=O0.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};const J0=Object.freeze(Object.defineProperty({__proto__:null,decode:Ot,encode:ut,format:Ra,parse:Ea},Symbol.toStringTag,{value:"Module"})),ei=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ti=/[\0-\x1F\x7F-\x9F]/,K0=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Oa=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,ni=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,ai=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,H0=Object.freeze(Object.defineProperty({__proto__:null,Any:ei,Cc:ti,Cf:K0,P:Oa,S:ni,Z:ai},Symbol.toStringTag,{value:"Module"})),Z0=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function X0(e){return e===0||e>=55296&&e<=57343||e>1114111}function G0(e){return X0(e)?65533:e>=128&&e<=159&&Z0[e-128]||e}function Y0(e){return e-1>>>0<127||e-160>>>0<55136?String.fromCharCode(e):String.fromCodePoint(G0(e))}const Xe=(()=>{const e=new Uint8Array(127);let t=0;for(let n=33;n<=126;n++)n!==34&&n!==36&&n!==92&&(e[n]=t++);return e})();function Q0(e,t,n,a,s,o){const l=e.length,d=o*90;let u=0;const p=()=>{const te=Xe[e.charCodeAt(u++)];return te<o?te:te*91-d+Xe[e.charCodeAt(u++)]},v=n-a,b=n+s,_=new Int32Array(b);_.fill(-1,a,o),_.fill(-1,o+v,b);const g=new Int32Array(b),m=new Int32Array(b);function k(te,ne){let V=0,X=ne;const O=ne+te;for(;X<O;){const J=Xe[e.charCodeAt(u++)];if(J<89)V+=J,_[X++]=V;else if(J===89){let Z=Xe[e.charCodeAt(u++)]+2;for(;Z--;)_[X++]=++V}else{const Z=Xe[e.charCodeAt(u++)];V+=89+(Z<90?Z*91+Xe[e.charCodeAt(u++)]:Xe[e.charCodeAt(u++)]*8281+Xe[e.charCodeAt(u++)]*91+Xe[e.charCodeAt(u++)]),_[X++]=V}}}k(a,0),k(v,o);const w=new Int32Array(s*2);let x=0,y=0;function $(te,ne){for(let V=0;V<te;V++){const X=ne+V,O=p(),J=p();w[y*2]=O,w[y*2+1]=J,y+=1,g[X]=x;const Z=(_[O]<0?m[O]:1)+(_[J]<0?m[J]:1);m[X]=Z,x+=Z}}$(s-o+a,o+v),$(o-a,a);const D=new Uint16Array(x);let M=0;for(let te=0;te<y;te++)for(let ne=0;ne<2;ne++){const V=w[te*2+ne],X=_[V];if(X<0){let O=g[V];const J=O+m[V];for(;O<J;)D[M++]=D[O++]}else D[M++]=X}const N=new Uint16Array(t);let K=0;for(;u<l;){let te=Xe[e.charCodeAt(u++)];te>=o&&(te=te*91-d+Xe[e.charCodeAt(u++)]);const ne=_[te];if(ne<0){let V=g[te];const X=V+m[te];for(;V<X;)N[K++]=D[V++]}else N[K++]=ne}return N}const eg=Q0("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#<B%##%%'%+~#;#@%}#&%#&&%#(~#H1}'%'##&&~#?A}&'~#D#%32}'&&&&~#[}'(#%}'~#;C})&}%%#%~#=&%,3}%'(#%%~#^'#&&)#%'~#Y%-~#d-%'~#^%%&#&&&}#~#b~2t*&'~&(~&@~0%~e~3}%*''0})&}+~!9##-}#%-hD*)1fC#%/&/fB#40~!+#)*4~!+~!K'&:~!/*7~!.#~!H~!L':~%x&~!H#~!*~%1~!I#~!+A~#p'~!F~~#-#~,,(~.Z~!V~%;'B'mq-W~!N~%I%#&&#&}#%},%%}'%}+X#%}#&}(%}'%}<%}#%}%%'}'%}:~![)9@~%>~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37</31&83##&0#),H(?'&?/1##%#&&#%''-%&&&#(&''&#.-'%#%%(,')*'&#&#'##%(%(#%('#&##%%%%('%#%#%%#%#&%##h>w+v<ayvyvcg.uuhKr}g/v|g>u9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a0<or[yc3Dtq>6Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.<rAJwLZtT~?r@dZa%!a.&^*Za(/Reu[ya>6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:9<B@bX~3jVv&v@s@5Re[d/rQt{uAvo&a&a*)a2!,0Wf!3Dt0=Bs'>6Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh<vu5Rgq<=C::9bb~#dZ#T&Ta6Y.X*Dt>[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s<DtDJvyZqY5aws3Jvy!&Wei~Hr1:au5@Bag>23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay<a]C;b`}Vd6s/t{uAvoaxa()!a,a7%-a#a2Dt,[yF2Wo[>6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=<qnJvh_[xhg3v,Rh3kOwOw-sDuev/Re^dha[a%!%!a+#Ta7)-5TaCaO!aka!a)sf[yb2>Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2<E}5xIo9a*X#Y(;5RePJvD_g>vyRgNj8w)v8<wggs:RgXiZt|vjx,hSq3ah!-(~@:Ro/Ou!5RhWj^v(pyw8unRhUdx-UY#^Ua.a3a70!)%UX1TaDa)'omRiRRhE[y:3Dsz=Br,>6Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|i<ARk<c:Z(6Vy}Juh'!wziMRoS:F|vkLuauJv5vtvQRh1d='T+Y#VyO~DR|jcF#T'7R|g97R|kJv3'!ay<Rj,Jvh&!:ReXcsa6*a+#a#_aIRf9aLRf?c,Z&Rf5Rf7c.Z&Rf;Rf>cQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf<d~'Ua%U*^UYa(!a,-!#a4YaTalaEX0a8a<Weo3Dt/3Dsx=Br93Wen~Dr;~<5p<JwNZt2@3p=Pw:5p;Ou!5r3c7&!#:p>3Ds}KvGB)_6Vyk2sM=<r7x'eovA(!hFu1ARf}cV#X&@r5j6rvwQa^Rf3c=Za'wkghJv__g;unRggA53B9=b^}%j6uduo5Jq;!(hIv%2Re`Ou4ARe_e%a#^^^Xa&!a*a2!&a6YaP!*ad!#a:aE/5Rn?[y@>6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<<sSjJpqvewOJq/(!hNw'5ReBk0s2u3w/w'5ReE5@Jq.!a+JQ!&WeU23d(#Y&RjG5]jBk!u7w&u0udARjEe#+^^^Ub#!a2/a`Z(agT1!a-a;|@TaG!aS[yV=Re~fow'RguNuPRe?bz#'>RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=<r#ijuuv/sIKuYD'ZtG@3p9~Gr&d2#`(g<vtRgFj`u5w&rqpxRf2CJuY!+:wfnTOu!5Rg}jNs1ucv&RfwJvA!&3@q|BDcC#T,k/unq8w8Q5RkTklwQuzunq8w8Q5Rk9dga#!a'!a=#a0!:+Tb*b@aO.a4!aba8aFJv^}?!VyR~Dr<g;u%Rn.~<5p[x'e`wNZtR@3p]Pw:5pZhNvjBp.woe_g5u-r4JwF!%DtO3:ooc7&!#:p^3DtpLuGw(!+%)Dtk6Vz#2sd=<r8d'#Y([y#<x3gJt`w@!)%}MRiowzikRij=]ilxAf3,U(#B2Rf#g0v-Rm[ck{`U#]giKv3>)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9<E|u2@H|rx3gJu?w'!+'1Nu7Reg4=H~+9<wxgY95Rm]xLggZ-`(X}U2:Ri4h<uOawRmsJv__5@bb{jbV~3dka#a'a]!,#a+U=a>b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=<qoJvA!{~Jup!%@qk7Rn/KvyD!}''[xz;>wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;Rm<Rm=Rm>Rm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta<aKbD!2wphBRnk[yPw}hE|.=Br-3Dtm>6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2<H|*xHn]#-UX'3Ro)z=iT}6ARns=Bwsn_wpnaRncw]aR(#UXa&Ua*a/=]iPd'#Y&Ro'WnXf{QRm2hNvj]nZd`'T~&1`{|`#9b]{}c:'!#Wl{>@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQ<s7Nu;padH#X'`+WmJ@>RmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe<E|IJva!&WmNg8vsRmLd`*.`#Y'Xa!axRn*]hrA8Rhug5s@rXg8u!RmMd8#X'X*3@rV72smdI*#UY&RmICARho~GsgxVgd)Ta'U-Y&Xa!T#RnEWnA@Wffg1uDRi0hFvK5RnBxGnG&#`%owp)@wsf+bX}Ze-*1!a*^^^Ua|!#a.aq&Ya2!a>.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.<Ju(!&SoG}6Shd}6<Ju(!&SoH}6She}6Kur@._g5vHRieJvx!{L2G{Kx6gd'T#?Rh82Wi5cZ#X(g1w)Rm5dW-Y(Ta#!a)!#aYa=wnfE=su2>>bU{0j9udv:<svj8uQv-7RgHdE%#^'sq9sp=>Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_g<v~Rm#JvG'!6Vz0=<r{Ju{%!:pj@WfsiXuJu3Rm:JvZ&!WfA~Bph@c4Z&Dtwax5rubx(#:awRk1@d,#Y&RfjRfid1#,Y(@Wfp2Wlrg5s@ryKu[@!,'=]ig9wlk?Rk>g5u-rqJvy'!@9RkQcH(T#=>Ri~@<wkj(Wj(KuZB*!&<7rw@9RkRcH(T#=>Ri}@<wkj)Wj)dg(Ta2Xa9X#`-!a*CARhg@@=I}d9x;c~#X%so=<sj>2@@=aybb}XjWv0Q~EfEj3vLv;<d,#Y(56H}`978H}_dgaPaFa'a/!#a3Y0a_a;a|!1(a7-[yE3[xt;:pJNvZrrg3uJrvJwNZt=@3pIh=rt3rxPw:5pGOu!5rpJvG'!6Vys=<rz@c4Z&Dt(ax5rtJvZ!&~BpH@wsfNg-vaRlNci*U#=<wei<F}a5@Jq.!a*JQ!%@qZ23d(#Y&RjH5]jCk!u7w&u0udARjFd/prq=tyvpaEa(a:.!a1aZ(@@=I}:9wpd%=<sX55w_h}@@=I{t=ay<aU@@=I}T=ay<2@@=I})?C9:9au@9Cb]}DP~=x-fAZ(2Wl1=ay<aU@@=I}>5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}<BqP=4qS9:ReMg/ujReNJw0!/<Jui%!bd{kawwnemRelAxUa?a3#*.&UX(Ya+a/RhvRnQ<o}9Wmtd-#Y&RgSRmw9;Rmxay=Rmyg-vaRmuxEhSrNu,v-voC!%(aR.a(a7+1Ro1>Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=<r%JrM_=]h2@Wlud'#)U'Wf'b]{i=]h/Jvh!&~BpWg=v]RnMx+ny#'Nu;pVwjnu=]nwxJnx,T#`&Reqwjnt=]nvieu9vrRjLLuYwP(#+!th@wih5pX~Gr'g5v/Rh4KunA'!-CARnP@wwiN:Rm_9x'cvw>!|l=<saKvAA!0&3@q}>w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5<B92:E{ZLvhwA(a;a%!igQuyRmad+#Y}m@3Rh5d8#X'X*:AqUAHzmaxwbh<aXRnVcF}RT#Nw&cj#U(BWnug/vsRntdka)(a3+.Zb7aYYan1!bVa@Xa}[y^@b[{G=H{+hFu73Rj&Pv#5ReQcK%T#sig1v{Rj'Ku+D#'!t]~Grm~?rkKuMB!01d5#`'Vy.ta3Dtu~Hroc8#'{^45s85AwZbP&!#Rn!wghxWn#KvEA!)&2RlA2RlBx:h|#(T,=]j09Wobz>x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@<plJvf!%b`{(9;Rgwc;.!#2x7cw#T|UDb]|T5Ju={(!=@E{&Jv)&!Ab`{'awJvf!~*>>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8<RhmkMu9vrsBuev/RhlCJvB!,g<v{wchh~@:Rhji[vrv{wchi~@:RhkdS&a5UY#Ta!RgPwwiI5BwciI~@:Rh`x'iJvj'!5]iJPu8Bwch]~@:Rhach)U#h3rp]gLh@t|Ax,hTq3ah!-(~@:Ro0Ou!5RhXj^v(pyw8unRhVd|)`,^UYas!a?/a2Z'a^Ta{Tb7Ta(a#!a,Wf&9sZ3DtAadamov=Bqt3[xig8vsRm~>waiL2b`{QJv*_Ouv2qgj<v]v2BqfdR'X*X#Y-@3qr~Gqv~?p6hHv-]glPup5Lq+q?_%*b_{qF{n9b^{rOu4ARhpKvCD!+&~Bqp:5Dbb}nwoiKl&unuTuBv]v+ueunaXRf0=Jvh!0nKufu8v1w&w7q%w&uHrz:Rgnj5w,uxDJq/(!hNw'5ReCk0s2u3w/w'5ReFd>Za&!*UaA=<wkgsRnSJv^!%Refifw3vyRgOKu_B'!,<]gkiiu:w&Rh<=C@a^<B57@2F{[<B5@aW:=3away9A5aW=<B=C@a^<B57@2F{Ie-#`(^^^bCara.b8aza6!/bZ,!adTbnTbOb+aFaS!aAT9@Wf~2Wli3Dtl2@d,#Y&RfnRfmJwJZtN~GqyJva&!VyMg<v~Rm%iXuJu3Rm9Jv[_=]ih9wlkDRkCd1#`(@Wg>2Wls3cH#T(@<Rj*=>Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@<Rj+=>Ri{cNu+vlax-!(#a0qa9<Rii2;;bU{H;x<i=&X#Rk`<4wwi=C9H~8xAI(Y#<azRi@45wXI<B9;5bb~7dL(X#Xa(+!aL6Vy{g5QqOau:5au2@ay547EzbxOcU(UX-T#Ta#:Cbb|A?wjh/b_|SOw6ARgtihr}u7Rhy<d1#T)X1@@=I|~=ay<2@@=aybb}Sj3vLv;<d,#Y(56H}A978H}@dGpvs@uAu`vcw9*!aFa+ai%(b!aXa8.a?a[ozWey=sU2@G}Nch&U#Rf_WexKu+D#'!t:~Gr`~?r^j]uNr|~FRg*j^psurwJt|RmcKv)@&!)7Rkv~Br[@wxfO:Rl3co#U'6Rezj_q#vIuavjRltwzeyh@vr5JqD0!>aY?C9:9au@9Cb]}9cl#U*5;5<H||jbuus1ucv&Rfvg1v~d/pppzqFr^a--a~!aMat1(hFv;Wiz@@=Izoj5uuv-7Rix~Cw`fk2WlVcZ#X,k)u3vWs@u2]ktg;wEx'fBq(_2Wg/jTv|vV~EfoJv]!15x'hzqG!(P~EfU~CRl_j6v(us5x4i-#T(2WmZ?C2F|d>Kq<aj1!*jTqIsBv=Wl`~Cw`fi2WlWj`v0u*~>RlR=c>Z,k#u3vWs@u2]kr<c1Z+jTqIsBv=Wla~Cw`fm2WlXdmb3!a{(arZa`bkTa%TbQTa-a9+c'!aM!/[yL=Bqug.w'RifhFvyDRj.g>vgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9<H|yd'%_X#skDtb3awwqkgNulRkgdB#^',9:p'hJwSaxRmEBwVb8@4=H|qLu+w50&!)@3qs~?pU>Awwn;;Rn=c:Z'ARn<=<qwKvC@!/&~BqqJv6!&]eVb^z^xRge'/a%+^`#Sge}6<4Rn3=]n0Pw2>Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=<wkaNw~h3z_c5Z{=wjh#=]nLKv^D!&)Vyz=bW|swYb<WetcG#T(2wxa@qVx@gD#Y&b^|V5JwG&!5bb|pg/w&RgD@x=kHs=uAvn!a%%/'+RmSRh694Ro`g-vaRmRhHv-]mlxCcS#`&ba~.5cD#Ta)P~=d,#Y(56H{>978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(Xa<!aiX#(55RiG54RiHcI#T'WiU3RiVNvdwtfcRlKNvdd,#Y&RlHRlExQgf.1*^T'X#Sgf}6Wn4=]hfPrk>Rn7Jw0!&>Rn5>Rn9Lunw?&a2!,5<oq@@wqfdRlJj5Q~=d,#Y(~ARfcOuN]fdDKw;ay(}i!547E}j?cI#T(@5bV}iCbV}hdv(^^Tb?a40,b##Tbo!a*bR!a<b|a/!aKai!aU[yK=]o^g:v>ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Sh<eeJw;!&axEzOg,Qosc!#*:wkeJ]eJ>x'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUg<s2Rkod]+UY0TZ'!a&A9sw<=bczLNvuw{gqzNhJwSaxRmCKuLay!#&s_Rf-55b^{uJvZa!!c%#(55Ri654wmiu5RiuawLu,vp!+}^%b_}Y9;wkgxba}o>A9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8u<uJ5RmbjQrquJu3x,k>uq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;<!aJaYai'anasb(=azRmV:Cbb{MLq2vb!%')RjuRjrRjtRjqx3jnqCw3!%')Rk(Rk+Rk&Rk)Lq2vb!%')Rj{RjxRjzRjwLq2vb!%')RjsRjpRjfRjex3jcqCw3!%')Rk'Rk*RjkRjl9<CbbzfOu4ARhxLq2vb!%')RjyRjvRjhRjgx=joq*uKvb!%')+-Rk.Rk%Rj~Rk-Rk#Rj}x=jdq*uKvb!%')+-Rk,Rk!Rj|RjmRjjRjidAq&qKs@uAv8Aa.'*-a@a&0!aM@a5[y73Dsy3Ds|3Dt):wxgI2sHJwJZt.~Gqxwsf0ikrzt}Rl0Jvy_[xj~HqzKv_A|D!&WfP8axRoVcf,U#k(v]v+ueunaXRf1Ju}'!g8u#Ri=jQw!sCunLprq>!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{N<capoq2r[a&!aPa9,'Pw;5s:@@=I|,55w_h|@@=IzcP~=x'fCqB_2Wl2>aU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#<bI}l5@B932:aV2G{BOuNBJq:|M!5Ezt=<B=C@a^<B57@2F{v>cB{/T#=ay<bI{3Jv6!a.6BKq0ah&+!5E}HP~Ef{978BaU@@=Iza<7d#.Y#978BaU@@=IzH~AJq0!(@@=IzG978BaU@@=IzFe,aU*Y&^^^bvJb,b:bFad!a,c2Ta>aL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[g<v~Rm!==G|>JvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+<E|&2@H|%dE#(^,g;u.RiEg6vjRiC9xCkA{O|zY#g=ucRmXKs0@!&*@G|m@awRknJuh!,3d(}gY}eJvj!%Rm):Jw3!%Rm+Rm-Ls0w(&!a(a#@b[|6cZ#X'7RkxWgAOu4ARn'dH'U#Y*Vz-Wm'CARm}d]*#a%^a*T'aK!a<9bV{PC=p*Jw4!&SgxcbB5r]idw(wBRmF7xFkt#&`(Rm/Rm8E|!JuY_9:Rl5=wrgr2:bbxd@xXfB(a*#T+!.X0X1Ta/a'T&RlDRfL>RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`a<XaKYa1,a'P~=wxfB2bZ}}?C972@@=I}r8@55B9;5bb}G978B2@@=aybb}3j3vLv;<Jw3&!>Rfk=ayb^}4~Ad1#`*@@=aybb{w2@>==<bbz]dx+UY#^UaF!a9!bB'Ya1.!ajXa#%olRhD[y=3Dt#Ov5BrHKuMB%!(Rf^Wep~HrJwkiQjKr|~FRg)Ku+D#'!t5~GrF~?rDdV)UY,Z/_7RkuG{<~BrBg,rlsO:235B@bX}|d?a1!#`(6Vyn5@d##Y+jTv|vV~EfIj]uNpn~FRfH7Lq2vb1!a9-978BaU@@=Iz9978BbU}#~AJq0!(@@=Iz8978BaU@@=Iz7~AJQ|}!978BbU}!JvkaK!AdUa21-U#`a+(g/vsRn~Ou!5RPj:rmu9WhOjXuvvNr}:RhAj^v(pyw8unRn[kPr}p|u7vwv]RiSBd;pppzq@qHQa?(b.!a.a`@.|xa(hFv;Wiyj5uuv-7Riw~Cw`fg2WlU978BbU|wOuNBJqG!(P~EfD~CRlQcZ#X,k)u3vWs@u2]ksg;wEx'f@q1_2Wg.j]uNpn~FRfqJv]!15x'h{qG!(@@=IzK~CRl^j6v(us5x4i,#T(2WmY?C2F{1>Kq<aj1!*jTqIsBv=Wld~Cw`fj2Wl[j`v0u*~>RlT=c>Z,k#u3vWs@u2]kq<c1Z+jTqIsBv=Wle~Cw`fn2Wl]dn1#c(a(b^a2!b/bAT(bj!aDa7bu,a_a{c0!2T0g:v>ReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJ<!+'@Wg(g?QRlC@Jv`!%b[zIwsfII}8JQ_@w|kW|=Jv(%!AqcOuNBJvEzh!bYzjLs@wP#(0!oy@>RkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}w<zizixNgwa#Z'U+!/!a'!a+w~g~z6wcn{Rn}wcnzRn|5Rh%=]nJg5vuRmvNvdRlvcprJu}w*az*a#!%.a.'Bot9qT]kj@Wg'ay2Gzv@Jv`!%b[zEwsfHI}1;ck#Ux`<Cbbx_Lu+w!a&0*!wko*wwo,So,}6Juqxf!E}PigQuyRm`d3(`#8>Rn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=<riifuaw&RmoKrNA!%(Ro4>Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']o<CauRoRAd-#Y':RkpauRoQKu]C.!&;RoFJvB!%RoNRoPBx'h]v+_?w~ha}t5?w~he}ue!/UbhYacXaW^Tc&a;b:a-c/#b&aja1(!cL+!bKbt!bmcRc9aIc?8[yW3Dtt94Rg`Jv}!&SiRMzBhEebShEMNuPRe>x7gL#TzuwjirRipc<Z&>on;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJ<!+'@Wg%g/QRl@@Jv`!&awRl<wsfFIzgLu(w*!.*&ShBMwvhIRhI9;RhNx1hK'!#Sn]Mx1hK~0!#:2<H~7cNu+w7D*'1ZtW>Rn1~?rOc:Z&Rn2=<rQ<7wjh&=BSnLMc]#X(6Vz)w[b=a!U#9wzgMc3#&(RgMRitRis<x,gKt`ax!&+SioM=BSilMc3#&(RgKRinRimKurB,!&SiQMzBhDebShDM6BJQ!(P~Efx978B2@@=I}WLrJw!!,a*&@G}O@9wkibRid@@x'fKwC!&SlDMSfLMjUv~Q~EfKKv3@a+!(hFv-]mpx/hYZ(C5RiWz<o/MwkhY?So/M@x,gbvfB*&!SgEM:SoeeehFu3:Rgbda(,^TZa)X/7Sg[eb:2RgI~BrMC@wgkc:wwkcRerx3h(uUvK!&*,SnOM4Sh*MArRg;wHRh(x=h;rJvPwI!a4',a'0@Wg&=BSh/Mg>w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^<Rm^Jvv_@Wl(g;u1Si/ebKu'B&!*Sh?eb@Wl'z@aPeb95Si.ebcpputyvjB)!,&a+0a%ShAMWeK@G}C@WfJ9;RhMwvhH9w{ia}ix,hJvRA1(!zAn[MRhHx1hJ~*!#hFv(BSn[MBJQ!(@@=I~'978B2@@=I}2db.Ua<'X}+T#a0XaG2G}E;wkg|wuh!Rh!x,hZu,@)!&So0MVy)C5RiXACJvB!&5RiY5RiZg8w)cG}*T#2@bU}=KsA>(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUg<v~Rl~==G|<Jv+'!aYShC}6@B<5?ba~8@Jw3'!g2QRljhLrpWlOd+#Y'g.w'rIg>w*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2<H{mx3n[t{vl!,&a%3Ro(z=iS}6ARnr=Bwsn^wvn`Rnbd`*T}B0!#^X'BG{c9b]{a>>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}<j3vLv;<Jw3&!>Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==<bbzl?C972@@=Ix^d6rSu,v7w*C(0a)a6#B+a%!sQ[y?3Dt%3[xn~<5rLOu!5p@Ku+D#'!t7~GrP~?rNKvlaya7'!h+v-5qMg=t|cd,U#5AAaa5Abb{S@52B5@a[@52B5Gx[iXueu;d<#`a(!/549C;ag>23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!b<bwA!#5@B932:aV2G|:d-)Y#hJrL>RhG<7@C5<H|_=Cau:5aj5@B932:bJ|ng>vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5<H|Eg>unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2<BaY?C2F|GOu!5x,g|p{ah!-(?C2F|c9:4E|OjXuvvNr}:Rh&i[w*t|cd+U#jJvsu)vsSn~Mkfrmu9p}u7vwv]So!McW#Xa!ax5@A5aY:5;5<H|>kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2<BaY?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P",13494,2713,49,25,61);var Be;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE",e[e.VALUE_MASK=8191]="VALUE_MASK"})(Be||(Be={}));var Ne;(function(e){e[e.AMP=38]="AMP",e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_X=120]="LOWER_X"})(Ne||(Ne={}));const zn=32,si=21,tg=2097151,Sa=2047;let oi=0;function ng(e){const t=e>>>si;return t===Sa?oi:t}function ag(e){return e-Ne.ZERO>>>0<=9}function sg(e){return(e|zn)-Ne.LOWER_A>>>0<=5}function og(e){return(e|zn)-Ne.LOWER_A>>>0<=25}var Vs;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Vs||(Vs={}));var Js;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Js||(Js={}));function ig(e,t,n,a){const s=(t&Be.BRANCH_LENGTH)>>7,o=t&Be.JUMP_TABLE;if(o){if(s===0)return a===o?n:-1;const d=a-o;if(d>>>0>=s)return-1;const u=e[n+d];return u===0?-1:n+s+u-1&65535}if(s===0)return-1;const i=s+1>>1,l=n+i+s;for(let d=0;d<s;d++){const p=e[n+(d>>1)]>>((d&1)<<3)&255;if(p===a){const v=n+i+d;return l+e[v]&65535}if(p>a)return-1}return-1}function Ks(e,t,n){return n===1?String.fromCharCode(e[t]&Be.VALUE_MASK):n===2?String.fromCharCode(e[t+1]):String.fromCharCode(e[t+1],e[t+2])}function lg(e,t,n){let a=t+1,s=0,o=a;if(a<n&&(e.charCodeAt(a)|zn)===Ne.LOWER_X)for(a+=1,o=a;a<n;){const l=e.charCodeAt(a);if(ag(l))s=s*16+(l-Ne.ZERO);else if(sg(l))s=s*16+((l|zn)-Ne.LOWER_A+10);else break;a+=1}else for(;a<n;){const l=e.charCodeAt(a)-Ne.ZERO;if(l>>>0>9)break;s=s*10+l,a+=1}if(a===o)return 0;a<n&&e.charCodeAt(a)===Ne.SEMI&&(a+=1),s>1114111&&(s=1114112);let i=a-t;return i>=Sa&&(oi=i,i=Sa),i<<si|s}function rg(e,t,n){const a=eg;let s=e.indexOf("&");if(s<0)return e;const o=e.length;let i=0,l="";const d=a[0],u=d&Be.JUMP_TABLE,p=(d&Be.BRANCH_LENGTH)>>7;do{const v=s+1,b=e.charCodeAt(v);let _,g;if(b===Ne.NUM){const m=lg(e,v,o);_=ng(m),_>0&&e.charCodeAt(v+_-1)!==Ne.SEMI&&(_=0),g=_===0?"":Y0(m&tg)}else if(og(b)){_=0,g="";const m=b-u;let k;if(m>>>0<p){const D=a[1+m];k=D===0?-1:p+D&65535}else k=-1;let w=0,x=0,y=k<0?0:a[k],$=v+1;e:for(;$<o;){for(;(y&(Be.VALUE_LENGTH|Be.FLAG13))===0&&(y&Be.JUMP_TABLE)!==0;){const K=y&Be.JUMP_TABLE,te=(y&Be.BRANCH_LENGTH)>>7;if(te===0){if(e.charCodeAt($)!==K)break e;k+=1}else{const ne=e.charCodeAt($)-K;if(ne>>>0>=te)break e;const V=a[k+1+ne];if(V===0)break e;k=k+te+V&65535}if(y=a[k],$+=1,$>=o)break e}if((y&(Be.VALUE_LENGTH|Be.FLAG13))===Be.FLAG13){const K=(y&Be.BRANCH_LENGTH)>>7;if(e.charCodeAt($)!==(y&Be.JUMP_TABLE))break;$+=1;const te=K-1;let ne=k+1,V=0;for(;V+1<te;V+=2){const X=a[ne];if(e.charCodeAt($)!==(X&255)||($+=1,e.charCodeAt($)!==(X>>8&255)))break e;$+=1,ne+=1}if(V<te){if(e.charCodeAt($)!==(a[ne]&255))break;$+=1}k+=1+(K>>1),y=a[k];continue}const D=y>>>14,M=e.charCodeAt($);if(D!==0){if(M===Ne.SEMI){_=$-v+1,g=D===1?String.fromCharCode(y&Be.VALUE_MASK):Ks(a,k,D);break}if(D===1)break}const N=ig(a,y,k+(D||1),M);if(N<0)break;k=N,y=a[k],$+=1}g===""&&_>0&&(g=Ks(a,w,x))}else _=0,g="";_===0||n?s=v:(i<s&&(l+=e.slice(i,s)),l+=g,s=i=v+_),e.charCodeAt(s)!==Ne.AMP&&(s=e.indexOf("&",s))}while(s>=0);return l+e.slice(i)}function ii(e){return rg(e,!0,!1)}var ug=class{src_Any=ei.source;src_Cc=ti.source;src_Z=ai.source;src_P=Oa.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,t,n=4){const a=this.escapeRE(e),s=this.escapeRE(t),o=`(?:(?!${this.src_ZCc}|${a}|${s}).)`;let i=`${a}${o}{0,1000}${s}`;for(let l=2;l<=n;l++)i=`${a}(?:${o}|${i}){0,1000}${s}`;return i}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){const e="[0-9A-Fa-f]{1,4}",t=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${t}|::(?:${e}:){5}${t}|(?:${e})?::(?:${e}:){4}${t}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${t}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${t}|(?:(?:${e}:){0,3}${e})?::${e}:${t}|(?:(?:${e}:){0,4}${e})?::${t}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;const e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${this.src_ZPCc}))(?:(?![$+<=>^\`||])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><|]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},la={validate:(e,t,n)=>{const a=n.re.get_http_validator();a.lastIndex=t;const s=a.exec(e);return s?s[0].length:0},normalize:(e,t)=>t.normalize(e)},cg={"http:":la,"https:":la,"ftp:":la,"//":{validate:function(e,t,n){const a=n.re.get_relative_proto_validator();a.lastIndex=t;const s=a.exec(e);return s?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:s[0].length:0},normalize:(e,t)=>t.normalize(e)},"mailto:":{validate:function(e,t,n){const a=n.re.get_mailto_validator();a.lastIndex=t;const s=a.exec(e);return s?s[0].length:0},normalize:(e,t)=>t.normalize(e)}},dg="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",fg="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф";function vg(){const e=fg.split("|");return dg.split("|").forEach(t=>{const n=t.indexOf(":"),a=t.slice(0,n);for(const s of t.slice(n+1))e.push(a+s)}),e}var pg={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:vg(),urlAuth:!1,maxLength:1e4},Hs=class{schema;index;lastIndex;raw;text;url;constructor(e,t,n,a){const s=e.slice(n,a);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=a,this.raw=s,this.text=s,this.url=s}},hg=class{__opts__;__schemas__;re;constructor(e={}){const{rebuilder:t,...n}=e;this.__opts__={...pg,...n},this.__schemas__={...cg},this.re=t||new ug,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,t=null){if(!t)delete this.__schemas__[e];else{const n={normalize:(a,s)=>s.normalize(a),...t};this.__schemas__[e]=n}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let t,n;for(n=this.re.get_schema_search(),n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(n=this.re.get_fuzzy_link_search(),n.lastIndex=0,n.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){const a=this.re.get_fuzzy_mail_host_search(),s=this.re.get_mail_name_validator();for(a.lastIndex=0;(t=a.exec(e))!==null;){const o=e.slice(Math.max(0,t.index-65),t.index);if(s.test(o))return!0}}return!1}testSchemaAt(e,t,n){return this.__schemas__[t.toLowerCase()]?this.__schemas__[t.toLowerCase()].validate(e.slice(0,n+this.__opts__.maxLength),n,this):0}match(e){const t=[],n=this.re.get_schema_search();let a,s,o,i,l,d,u=!1,p=!1,v=!1,b=0;if(!e.length)return null;for(n.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(a=this.re.get_fuzzy_link_search(),a.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(s=this.re.get_fuzzy_mail_host_search(),s.lastIndex=0,o=this.re.get_mail_name_validator());;){const _=Math.max(b-1,0);if(s&&o&&!v&&(!l||l.index<b))for(s.lastIndex<_&&(s.lastIndex=_);;){const x=s.exec(e);if(!x){v=!0,l=void 0;break}const y=o.exec(e.slice(Math.max(0,x.index-65),x.index));if(y){if(l={schema:"mailto:",index:x.index-y[1].length,lastIndex:x.index+x[0].length},l.index>=b)break;s.lastIndex<_&&(s.lastIndex=_)}}if(a&&!p&&(!i||i.index<b))for(a.lastIndex<_&&(a.lastIndex=_);;){const x=a.exec(e);if(!x){p=!0,i=void 0;break}if(i={schema:"",index:x.index+x[1].length,lastIndex:x.index+x[0].length},i.index>=b)break;a.lastIndex<_&&(a.lastIndex=_)}let g=l;(!g||i&&(i.index<g.index||i.index===g.index&&i.lastIndex>g.lastIndex))&&(g=i);let m;if(!u)for(;;){if(!d){n.lastIndex<_&&(n.lastIndex=_);const $=n.exec(e);if(!$){u=!0;break}d={schema:$[2],index:$.index+$[1].length,lastIndex:$.index+$[0].length}}if(d.index<b){d=void 0;continue}if(g&&d.index>g.index)break;const x=d;d=void 0;const y=this.testSchemaAt(e,x.schema,x.lastIndex);if(y){m={schema:x.schema,index:x.index,lastIndex:x.lastIndex+y};break}}let k=m;if((!k||l&&(l.index<k.index||l.index===k.index&&l.lastIndex>k.lastIndex))&&(k=l),(!k||i&&(i.index<k.index||i.index===k.index&&i.lastIndex>k.lastIndex))&&(k=i),!k)break;k===l?l=void 0:k===i&&(i=void 0);const w=new Hs(e,k.schema,k.index,k.lastIndex);w.schema?this.__schemas__[w.schema].normalize(w,this):this.normalize(w),t.push(w),b=k.lastIndex}return t.length?t:null}matchAtStart(e){if(!e.length)return null;const t=this.re.get_schema_at_start().exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;const a=new Hs(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__schemas__[a.schema].normalize(a,this),a}tlds(e,t=!1){return e=Array.isArray(e)?e:[e],t?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};const zt=2147483647,tt=36,ja=1,nn=26,_g=38,mg=700,li=72,ri=128,ui="-",gg=/^xn--/,kg=/[^\0-\x7F]/,bg=/[\x2E\u3002\uFF0E\uFF61]/g,yg={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ra=tt-ja,nt=Math.floor,ua=String.fromCharCode;function ht(e){throw new RangeError(yg[e])}function wg(e,t){const n=[];let a=e.length;for(;a--;)n[a]=t(e[a]);return n}function ci(e,t){const n=e.split("@");let a="";n.length>1&&(a=n[0]+"@",e=n[1]),e=e.replace(bg,".");const s=e.split("."),o=wg(s,t).join(".");return a+o}function di(e){const t=[];let n=0;const a=e.length;for(;n<a;){const s=e.charCodeAt(n++);if(s>=55296&&s<=56319&&n<a){const o=e.charCodeAt(n++);(o&64512)==56320?t.push(((s&1023)<<10)+(o&1023)+65536):(t.push(s),n--)}else t.push(s)}return t}const xg=e=>String.fromCodePoint(...e),$g=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:tt},Zs=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},fi=function(e,t,n){let a=0;for(e=n?nt(e/mg):e>>1,e+=nt(e/t);e>ra*nn>>1;a+=tt)e=nt(e/ra);return nt(a+(ra+1)*e/(e+_g))},vi=function(e){const t=[],n=e.length;let a=0,s=ri,o=li,i=e.lastIndexOf(ui);i<0&&(i=0);for(let l=0;l<i;++l)e.charCodeAt(l)>=128&&ht("not-basic"),t.push(e.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){const d=a;for(let p=1,v=tt;;v+=tt){l>=n&&ht("invalid-input");const b=$g(e.charCodeAt(l++));b>=tt&&ht("invalid-input"),b>nt((zt-a)/p)&&ht("overflow"),a+=b*p;const _=v<=o?ja:v>=o+nn?nn:v-o;if(b<_)break;const g=tt-_;p>nt(zt/g)&&ht("overflow"),p*=g}const u=t.length+1;o=fi(a-d,u,d==0),nt(a/u)>zt-s&&ht("overflow"),s+=nt(a/u),a%=u,t.splice(a++,0,s)}return String.fromCodePoint(...t)},pi=function(e){const t=[];e=di(e);const n=e.length;let a=ri,s=0,o=li;for(const d of e)d<128&&t.push(ua(d));const i=t.length;let l=i;for(i&&t.push(ui);l<n;){let d=zt;for(const p of e)p>=a&&p<d&&(d=p);const u=l+1;d-a>nt((zt-s)/u)&&ht("overflow"),s+=(d-a)*u,a=d;for(const p of e)if(p<a&&++s>zt&&ht("overflow"),p===a){let v=s;for(let b=tt;;b+=tt){const _=b<=o?ja:b>=o+nn?nn:b-o;if(v<_)break;const g=v-_,m=tt-_;t.push(ua(Zs(_+g%m,0))),v=nt(g/m)}t.push(ua(Zs(v,0))),o=fi(s,u,l===i),s=0,++l}++s,++a}return t.join("")},Cg=function(e){return ci(e,function(t){return gg.test(t)?vi(t.slice(4).toLowerCase()):t})},Ag=function(e){return ci(e,function(t){return kg.test(t)?"xn--"+pi(t):t})},Xs={version:"2.3.1",ucs2:{decode:di,encode:xg},decode:vi,encode:pi,toASCII:Ag,toUnicode:Cg};var Gs=Object.defineProperty,hi=(e,t)=>{let n={};for(var a in e)Gs(n,a,{get:e[a],enumerable:!0});return Gs(n,Symbol.toStringTag,{value:"Module"}),n},Dg=hi({arrayReplaceAt:()=>Rg,asciiTrim:()=>Un,callable:()=>_i,escapeHtml:()=>kt,escapeRE:()=>Lg,fromCodePoint:()=>an,isMdAsciiPunct:()=>ln,isPunctChar:()=>gi,isPunctCharCode:()=>on,isSpace:()=>Ce,isValidEntityCode:()=>Ua,isWhiteSpace:()=>sn,lib:()=>Og,normalizeReference:()=>jn,unescapeAll:()=>jt,unescapeMd:()=>Tg});function _i(e){const t=function(...n){return Reflect.construct(e,n,new.target&&new.target!==t?new.target:e)};return Object.defineProperty(t,"name",{value:e.name}),Object.setPrototypeOf(t,e),t.prototype=e.prototype,t}function Rg(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Ua(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function an(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var mi=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Eg=new RegExp(`${mi.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),Sg=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Mg(e,t){if(t.charCodeAt(0)===35&&Sg.test(t)){const a=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Ua(a)?an(a):e}const n=ii(e);return n!==e?n:e}function Tg(e){return e.indexOf("\\")<0?e:e.replace(mi,"$1")}function jt(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(Eg,function(t,n,a){return n||Mg(t,a)})}var Fg=/[&<>"]/,Ig=/[&<>"]/g,Bg={"&":"&","<":"<",">":">",'"':"""};function zg(e){return Bg[e]}function kt(e){return Fg.test(e)?e.replace(Ig,zg):e}var Pg=/[.?*+^$[\]\\(){}|-]/g;function Lg(e){return e.replace(Pg,"\\$&")}function Ce(e){switch(e){case 9:case 32:return!0}return!1}function sn(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function gi(e){return Oa.test(e)||ni.test(e)}function on(e){return gi(an(e))}function ln(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function jn(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function Ys(e){return e===32||e===9||e===10||e===13}function Un(e){let t=0;for(;t<e.length&&Ys(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Ys(e.charCodeAt(n));n--);return e.slice(t,n+1)}var Og={mdurl:J0,ucmicro:H0};function jg(e,t,n){let a,s,o,i;const l=e.posMax,d=e.pos;for(e.pos=t+1,a=1;e.pos<l;){if(o=e.src.charCodeAt(e.pos),o===93&&(a--,a===0)){s=!0;break}if(i=e.pos,e.md.inline.skipToken(e),o===91){if(i===e.pos-1)a++;else if(n)return e.pos=d,-1}}let u=-1;return s&&(u=e.pos),e.pos=d,u}function Ug(e,t,n){let a,s=t;const o={ok:!1,pos:0,str:""};if(e.charCodeAt(s)===60){for(s++;s<n;){if(a=e.charCodeAt(s),a===10||a===60)return o;if(a===62)return o.pos=s+1,o.str=jt(e.slice(t+1,s)),o.ok=!0,o;if(a===92&&s+1<n){s+=2;continue}s++}return o}let i=0;for(;s<n&&(a=e.charCodeAt(s),!(a===32||a<32||a===127));){if(a===92&&s+1<n){if(e.charCodeAt(s+1)===32){s++;continue}s+=2;continue}if(a===40&&(i++,i>32))return o;if(a===41){if(i===0)break;i--}s++}return t===s||i!==0||(o.str=jt(e.slice(t,s)),o.pos=s,o.ok=!0),o}function Ng(e,t,n,a){let s,o=t;const i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(a)i.str=a.str,i.marker=a.marker;else{if(o>=n)return i;let l=e.charCodeAt(o);if(l!==34&&l!==39&&l!==40)return i;t++,o++,l===40&&(l=41),i.marker=l}for(;o<n;){if(s=e.charCodeAt(o),s===i.marker)return i.pos=o+1,i.str+=jt(e.slice(t,o)),i.ok=!0,i;if(s===40&&i.marker===41)return i;s===92&&o+1<n&&o++,o++}return i.can_continue=!0,i.str+=jt(e.slice(t,o)),i}var qg=hi({parseLinkDestination:()=>Ug,parseLinkLabel:()=>jg,parseLinkTitle:()=>Ng});function rn(e){"@babel/helpers - typeof";return rn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rn(e)}function Wg(e,t){if(rn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(rn(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vg(e){var t=Wg(e,"string");return rn(t)=="symbol"?t:t+""}function se(e,t,n){return(t=Vg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var At=class{constructor(e,t,n){se(this,"map",null),se(this,"level",0),se(this,"children",null),se(this,"content",""),se(this,"markup",""),se(this,"info",""),se(this,"block",!1),se(this,"hidden",!1),this.type=e,this.tag=t,this.attrs=null,this.nesting=n,this.meta=null}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,a=t.length;n<a;n++)if(t[n][0]===e)return n;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,t){const n=this.attrIndex(e),a=[e,t];n<0?this.attrPush(a):this.attrs[n]=a}attrGet(e){const t=this.attrIndex(e);let n=null;return t>=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},un=class{constructor(){se(this,"__rules__",[]),se(this,"__cache__",null)}__find__(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1}__compile__(){const e=new Set;this.__rules__.forEach(t=>{t.enabled&&t.alt.forEach(n=>{n&&e.add(n)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(t=>{t.enabled&&this.__cache__[""].push(t.fn)}),e.forEach(t=>{this.__cache__[t]=[],this.__rules__.forEach(n=>{n.enabled&&n.alt.indexOf(t)>=0&&this.__cache__[t].push(n.fn)})})}at(e,t,n={}){const a=this.__find__(e);if(a===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[a].fn=t,this.__rules__[a].alt=n.alt||[],this.__cache__=null}before(e,t,n,a={}){const s=this.__find__(e);if(s===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(s,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null}after(e,t,n,a={}){const s=this.__find__(e);if(s===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(s+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null}push(e,t,n={}){this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null}enable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(a=>{const s=this.__find__(a);if(s<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${a}`)}this.__rules__[s].enabled=!0,n.push(a)}),this.__cache__=null,n}enableOnly(e,t=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(n=>{n.enabled=!1}),this.enable(e,t)}disable(e,t=!1){Array.isArray(e)||(e=[e]);const n=[];return e.forEach(a=>{const s=this.__find__(a);if(s<0){if(t)return;throw new Error(`Rules manager: invalid rule name ${a}`)}this.__rules__[s].enabled=!1,n.push(a)}),this.__cache__=null,n}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},at={};at.code_inline=function(e,t,n,a,s){const o=e[t];return`<code${s.renderAttrs(o)}>${kt(o.content)}</code>`};at.code_block=function(e,t,n,a,s){const o=e[t];return`<pre${s.renderAttrs(o)}><code>${kt(e[t].content)}</code></pre>
|
|
11
|
+
`};at.fence=function(e,t,n,a,s){const o=e[t],i=o.info?jt(o.info).trim():"";let l="",d="";if(i){const p=i.split(/(\s+)/g);l=p[0],d=p.slice(2).join("")}let u;if(n.highlight?u=n.highlight(o.content,l,d)||kt(o.content):u=kt(o.content),u.indexOf("<pre")===0)return u+`
|
|
12
|
+
`;if(i){const p=o.attrIndex("class"),v=o.attrs?o.attrs.slice():[];p<0?v.push(["class",`${n.langPrefix}${l}`]):(v[p]=[v[p][0],v[p][1]],v[p][1]+=` ${n.langPrefix}${l}`);const b={attrs:v};return`<pre><code${s.renderAttrs(b)}>${u}</code></pre>
|
|
13
|
+
`}return`<pre><code${s.renderAttrs(o)}>${u}</code></pre>
|
|
14
|
+
`};at.image=function(e,t,n,a,s){const o=e[t];return o.attrs[o.attrIndex("alt")][1]=s.renderInlineAsText(o.children,n,a),s.renderToken(e,t,n)};at.hardbreak=function(e,t,n){return n.xhtmlOut?`<br />
|
|
15
|
+
`:`<br>
|
|
16
|
+
`};at.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br />
|
|
17
|
+
`:`<br>
|
|
18
|
+
`:`
|
|
19
|
+
`};at.text=function(e,t){return kt(e[t].content)};at.html_block=function(e,t){return e[t].content};at.html_inline=function(e,t){return e[t].content};var ki=class{constructor(){se(this,"rules",Object.assign({},at))}renderAttrs(e){let t,n,a;if(!e.attrs)return"";for(a="",t=0,n=e.attrs.length;t<n;t++)a+=` ${kt(e.attrs[t][0])}="${kt(String(e.attrs[t][1]))}"`;return a}renderToken(e,t,n){const a=e[t];let s="";if(a.hidden)return"";let o=t-1;for(;o>=0&&e[o].hidden&&e[o].nesting===0;)o--;a.block&&a.nesting!==-1&&o>=0&&e[o].hidden&&e[o].nesting===-1&&(s+=`
|
|
20
|
+
`),s+=(a.nesting===-1?"</":"<")+a.tag,s+=this.renderAttrs(a),a.nesting===0&&n.xhtmlOut&&(s+=" /");let i=!1;if(a.block&&(i=!0,a.nesting===1)){let l=t+1;for(;l<e.length&&e[l].hidden&&e[l].nesting===0;)l++;if(l<e.length){const d=e[l];(d.type==="inline"||d.hidden||d.nesting===-1&&d.tag===a.tag)&&(i=!1)}}return s+=i?`>
|
|
21
|
+
`:">",s}renderInline(e,t,n){let a="";const s=this.rules;for(let o=0,i=e.length;o<i;o++){const l=e[o].type;typeof s[l]<"u"?a+=s[l](e,o,t,n,this):a+=this.renderToken(e,o,t)}return a}renderInlineAsText(e,t,n){let a="";for(let s=0,o=e.length;s<o;s++)switch(e[s].type){case"text":case"code_inline":a+=e[s].content;break;case"image":a+=this.renderInlineAsText(e[s].children,t,n);break;case"html_inline":case"html_block":a+=e[s].content;break;case"softbreak":case"hardbreak":a+=`
|
|
22
|
+
`}return a}render(e,t,n){let a="";const s=this.rules;for(let o=0,i=e.length;o<i;o++){const l=e[o].type;l==="inline"?a+=this.renderInline(e[o].children,t,n):typeof s[l]<"u"?a+=s[l](e,o,t,n,this):a+=this.renderToken(e,o,t)}return a}},bi=class{constructor(e,t,n){se(this,"tokens",[]),se(this,"inlineMode",!1),se(this,"Token",At),this.src=e,this.env=n,this.md=t}},Jg=/\r\n?/g,Kg=/\0/g;function Hg(e){let t;t=e.src.replace(Jg,`
|
|
23
|
+
`),t=t.replace(Kg,"�"),e.src=t}function Zg(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Xg(e){const t=e.tokens;let n=0;for(let a=0;a<t.length;a++)t[a].type!=="reference_definition"&&(a!==n&&(t[n]=t[a]),n++);t.length!==n&&(t.length=n)}function Gg(e){const t=e.tokens;for(let n=0,a=t.length;n<a;n++){const s=t[n];s.type==="inline"&&e.md.inline.parse(s.content,e.md,e.env,s.children)}}function Yg(e){return/^<a[>\s]/i.test(e)}function Qg(e){return/^<\/a\s*>/i.test(e)}function ek(e){const t=e.tokens;if(e.md.options.linkify)for(let n=0,a=t.length;n<a;n++){if(t[n].type!=="inline"||!e.md.linkify.test(t[n].content))continue;const s=t[n].children,o=[];let i=0;for(let l=s.length-1;l>=0;l--){const d=s[l];if(d.type==="link_close"){for(l--;s[l].level!==d.level&&s[l].type!=="link_open";)l--;continue}if(d.type==="html_inline"&&(Yg(d.content)&&i>0&&i--,Qg(d.content)&&i++),!(i>0)&&d.type==="text"&&e.md.linkify.test(d.content)){const u=d.content;let p=e.md.linkify.match(u);const v=[];let b=d.level,_=0;p.length>0&&p[0].index===0&&l>0&&s[l-1].type==="text_special"&&(p=p.slice(1));for(let g=0;g<p.length;g++){const m=p[g].url,k=e.md.normalizeLink(m);if(!e.md.validateLink(k))continue;let w=p[g].text;p[g].schema?p[g].schema==="mailto:"&&!/^mailto:/i.test(w)?w=e.md.normalizeLinkText(`mailto:${w}`).replace(/^mailto:/,""):w=e.md.normalizeLinkText(w):w=e.md.normalizeLinkText(`http://${w}`).replace(/^http:\/\//,"");const x=p[g].index;if(x>_){const M=new e.Token("text","",0);M.content=u.slice(_,x),M.level=b,v.push(M)}const y=new e.Token("link_open","a",1);y.attrs=[["href",k]],y.level=b++,y.markup="linkify",y.info="auto",v.push(y);const $=new e.Token("text","",0);$.content=w,$.level=b,v.push($);const D=new e.Token("link_close","a",-1);D.level=--b,D.markup="linkify",D.info="auto",v.push(D),_=p[g].lastIndex}if(_<u.length){const g=new e.Token("text","",0);g.content=u.slice(_),g.level=b,v.push(g)}o.push({index:l,nodes:v})}}if(o.length>0){let l=s.length;for(const v of o)l+=v.nodes.length-1;const d=new Array(l);let u=0,p=0;o.reverse();for(let v=0;v<s.length;v++){const b=o[u];if(b?.index===v){for(const _ of b.nodes)d[p++]=_;u++}else d[p++]=s[v]}t[n].children=d}}}var yi=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,tk=/\((c|tm|r)\)/i,nk=/\((c|tm|r)\)/gi,ak={c:"©",r:"®",tm:"™"};function sk(e,t){return ak[t.toLowerCase()]}function ok(e){let t=0;for(let n=e.length-1;n>=0;n--){const a=e[n];a.type==="text"&&!t&&(a.content=a.content.replace(nk,sk)),a.type==="link_open"&&a.info==="auto"&&t--,a.type==="link_close"&&a.info==="auto"&&t++}}function ik(e){let t=0;for(let n=e.length-1;n>=0;n--){const a=e[n];a.type==="text"&&!t&&yi.test(a.content)&&(a.content=a.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),a.type==="link_open"&&a.info==="auto"&&t--,a.type==="link_close"&&a.info==="auto"&&t++}}function lk(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(tk.test(e.tokens[t].content)&&ok(e.tokens[t].children),yi.test(e.tokens[t].content)&&ik(e.tokens[t].children))}var rk=/['"]/,Qs=/['"]/g,eo="’",uk=1e3;function to(e,t,n){for(;e.length>n;){const a=e.pop();a.isSingleQuote?t.single=a.prevSameQuoteIdx:t.double=a.prevSameQuoteIdx}}function xn(e,t,n,a){e[t]||(e[t]=[]),e[t].push({pos:n,ch:a})}function ck(e,t){let n="",a=0;t.sort((s,o)=>s.pos-o.pos);for(let s=0;s<t.length;s++){const o=t[s];n+=e.slice(a,o.pos)+o.ch,a=o.pos+1}return n+e.slice(a)}function dk(e,t){let n;const a=[],s={single:-1,double:-1},o={};for(let i=0;i<e.length;i++){const l=e[i],d=e[i].level;for(n=a.length-1;n>=0&&!(a[n].level<=d);n--);if(to(a,s,n+1),l.type!=="text")continue;const u=l.content;let p=0;const v=u.length;e:for(;p<v;){Qs.lastIndex=p;const b=Qs.exec(u);if(!b)break;let _=!0,g=!0;p=b.index+1;const m=b[0]==="'";let k=32;if(b.index-1>=0)k=u.charCodeAt(b.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){k=e[n].content.charCodeAt(e[n].content.length-1);break}let w=32;if(p<v)w=u.charCodeAt(p);else for(n=i+1;n<e.length&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n++)if(e[n].content){w=e[n].content.charCodeAt(0);break}const x=ln(k)||on(k),y=ln(w)||on(w),$=sn(k),D=sn(w);if(D?_=!1:y&&($||x||(_=!1)),$?g=!1:x&&(D||y||(g=!1)),w===34&&b[0]==='"'&&k>=48&&k<=57&&(g=_=!1),_&&g&&(_=x,g=y),!_&&!g){m&&xn(o,i,b.index,eo);continue}if(g&&(n=m?s.single:s.double,n>=0&&a[n].level===d)){const M=a[n];let N,K;m?(N=t.md.options.quotes[2],K=t.md.options.quotes[3]):(N=t.md.options.quotes[0],K=t.md.options.quotes[1]),xn(o,i,b.index,K),xn(o,M.tokenIdx,M.contentPos,N),to(a,s,n);continue e}if(_){if(a.length>=uk)return;a.push({tokenIdx:i,contentPos:b.index,isSingleQuote:m,level:d,prevSameQuoteIdx:m?s.single:s.double}),m?s.single=a.length-1:s.double=a.length-1}else g&&m&&xn(o,i,b.index,eo)}}Object.keys(o).forEach(function(i){const l=Number(i);e[l].content=ck(e[l].content,o[i])})}function fk(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!rk.test(e.tokens[t].content)||dk(e.tokens[t].children,e)}function vk(e){let t,n;const a=e.length;for(t=0;t<a;t++)e[t].type==="text_special"&&(e[t].type="text");for(t=n=0;t<a;t++)e[t].type==="text"&&t+1<a&&e[t+1].type==="text"?e[t+1].content=e[t].content+e[t+1].content:(t!==n&&(e[n]=e[t]),n++);t!==n&&(e.length=n)}function pk(e){let t,n;const a=e.tokens,s=a.length;for(let o=0;o<s;o++){if(a[o].type!=="inline")continue;const i=a[o].children,l=i.length;for(t=0;t<l;t++)i[t].type==="text_special"&&(i[t].type="text"),i[t].children&&vk(i[t].children);for(t=n=0;t<l;t++)i[t].type==="text"&&t+1<l&&i[t+1].type==="text"?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var ca=[["normalize",Hg],["block",Zg],["strip_references",Xg],["inline",Gg],["linkify",ek],["replacements",lk],["smartquotes",fk],["text_join",pk]],wi=class{constructor(){se(this,"ruler",new un),se(this,"State",bi);for(let e=0;e<ca.length;e++)this.ruler.push(ca[e][0],ca[e][1])}process(e){const t=this.ruler.getRules("");for(let n=0,a=t.length;n<a;n++)t[n](e)}},xi=class{constructor(e,t,n,a){se(this,"bMarks",[]),se(this,"eMarks",[]),se(this,"tShift",[]),se(this,"sCount",[]),se(this,"bsCount",[]),se(this,"blkIndent",0),se(this,"line",0),se(this,"lineMax",0),se(this,"tight",!1),se(this,"listIndent",-1),se(this,"parentType","root"),se(this,"level",0),se(this,"Token",At),this.src=e,this.md=t,this.env=n,this.tokens=a;const s=this.src;for(let o=0,i=0,l=0,d=0,u=s.length,p=!1;i<u;i++){const v=s.charCodeAt(i);if(!p)if(Ce(v)){l++,v===9?d+=4-d%4:d++;continue}else p=!0;(v===10||i===u-1)&&(v!==10&&i++,this.bMarks.push(o),this.eMarks.push(i),this.tShift.push(l),this.sCount.push(d),this.bsCount.push(0),p=!1,l=0,d=0,o=i+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,t,n){const a=new At(e,t,n);return a.block=!0,n<0&&this.level--,a.level=this.level,n>0&&this.level++,this.tokens.push(a),a}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let t=this.src.length;e<t&&Ce(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,t){if(e<=t)return e;for(;e>t;)if(!Ce(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e}skipCharsBack(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,t,n,a){if(e>=t)return"";const s=new Array(t-e);for(let o=0,i=e;i<t;i++,o++){let l=0;const d=this.bMarks[i];let u=d,p;for(i+1<t||a?p=this.eMarks[i]+1:p=this.eMarks[i];u<p&&l<n;){const v=this.src.charCodeAt(u);if(Ce(v))v===9?l+=4-(l+this.bsCount[i])%4:l++;else if(u-d<this.tShift[i])l++;else break;u++}l>n?s[o]=new Array(l-n+1).join(" ")+this.src.slice(u,p):s[o]=this.src.slice(u,p)}return s.join("")}},hk=65536;function da(e,t){const n=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(n,a)}function no(e){const t=[],n=e.length;let a=0,s=e.charCodeAt(a),o=!1,i=0,l="";for(;a<n;)s===124&&(o?(l+=e.substring(i,a-1),i=a):(t.push(l+e.substring(i,a)),l="",i=a+1)),o=s===92,a++,s=e.charCodeAt(a);return t.push(l+e.substring(i)),t}function _k(e,t,n,a){if(t+2>n)return!1;let s=t+1;if(e.sCount[s]<e.blkIndent||e.sCount[s]-e.blkIndent>=4)return!1;let o=e.bMarks[s]+e.tShift[s];if(o>=e.eMarks[s])return!1;const i=e.src.charCodeAt(o++);if(i!==124&&i!==45&&i!==58||o>=e.eMarks[s])return!1;const l=e.src.charCodeAt(o++);if(l!==124&&l!==45&&l!==58&&!Ce(l)||i===45&&Ce(l))return!1;for(;o<e.eMarks[s];){const $=e.src.charCodeAt(o);if($!==124&&$!==45&&$!==58&&!Ce($))return!1;o++}let d=da(e,t+1),u=d.split("|");const p=[];for(let $=0;$<u.length;$++){const D=u[$].trim();if(!D){if($===0||$===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(D))return!1;D.charCodeAt(D.length-1)===58?p.push(D.charCodeAt(0)===58?"center":"right"):D.charCodeAt(0)===58?p.push("left"):p.push("")}if(d=da(e,t).trim(),d.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;u=no(d),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const v=u.length;if(v===0||v!==p.length)return!1;if(a)return!0;const b=e.parentType;e.parentType="table";const _=e.md.block.ruler.getRules("blockquote"),g=e.push("table_open","table",1),m=[t,0];g.map=m;const k=e.push("thead_open","thead",1);k.map=[t,t+1];const w=e.push("tr_open","tr",1);w.map=[t,t+1];for(let $=0;$<u.length;$++){const D=e.push("th_open","th",1);p[$]&&(D.attrs=[["style",`text-align:${p[$]}`]]);const M=e.push("inline","",0);M.content=u[$].trim(),M.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let x,y=0;for(s=t+2;s<n&&!(e.sCount[s]<e.blkIndent);s++){let $=!1;for(let M=0,N=_.length;M<N;M++)if(_[M](e,s,n,!0)){$=!0;break}if($||(d=da(e,s).trim(),!d)||e.sCount[s]-e.blkIndent>=4||(u=no(d),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),y+=v-u.length,y>hk))break;if(s===t+2){const M=e.push("tbody_open","tbody",1);M.map=x=[t+2,0]}const D=e.push("tr_open","tr",1);D.map=[s,s+1];for(let M=0;M<v;M++){const N=e.push("td_open","td",1);p[M]&&(N.attrs=[["style",`text-align:${p[M]}`]]);const K=e.push("inline","",0);K.content=u[M]?u[M].trim():"",K.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return x&&(e.push("tbody_close","tbody",-1),x[1]=s),e.push("table_close","table",-1),m[1]=s,e.parentType=b,e.line=s,!0}function mk(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let a=t+1,s=a;for(;a<n;){if(e.isEmpty(a)){a++;continue}if(e.sCount[a]-e.blkIndent>=4){a++,s=a;continue}break}e.line=s;const o=e.push("code_block","code",0);return o.content=e.getLines(t,s,4+e.blkIndent,!1)+`
|
|
24
|
+
`,o.map=[t,e.line],!0}function gk(e,t,n,a){let s=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||s+3>o)return!1;const i=e.src.charCodeAt(s);if(i!==126&&i!==96)return!1;let l=s;s=e.skipChars(s,i);let d=s-l;if(d<3)return!1;const u=e.src.slice(l,s),p=e.src.slice(s,o);if(i===96&&p.indexOf(String.fromCharCode(i))>=0)return!1;if(a)return!0;let v=t,b=!1;for(;v++,!(v>=n||(s=l=e.bMarks[v]+e.tShift[v],o=e.eMarks[v],s<o&&e.sCount[v]<e.blkIndent));)if(e.src.charCodeAt(s)===i&&!(e.sCount[v]-e.blkIndent>=4)&&(s=e.skipChars(s,i),!(s-l<d)&&(s=e.skipSpaces(s),!(s<o)))){b=!0;break}d=e.sCount[t],e.line=v+(b?1:0);const _=e.push("fence","code",0);return _.info=p,_.content=e.getLines(t+1,v,d,!0),_.markup=u,_.map=[t,e.line],!0}function kk(e,t,n,a){let s=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];const i=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(s)!==62)return!1;if(a)return!0;const l=[],d=[],u=[],p=[],v=e.md.block.ruler.getRules("blockquote"),b=e.parentType;e.parentType="blockquote";let _=!1,g;for(g=t;g<n;g++){const y=e.sCount[g]<e.blkIndent;if(s=e.bMarks[g]+e.tShift[g],o=e.eMarks[g],s>=o)break;if(e.src.charCodeAt(s++)===62&&!y){let D=e.sCount[g]+1,M,N;e.src.charCodeAt(s)===32?(s++,D++,N=!1,M=!0):e.src.charCodeAt(s)===9?(M=!0,(e.bsCount[g]+D)%4===3?(s++,D++,N=!1):N=!0):M=!1;let K=D;for(l.push(e.bMarks[g]),e.bMarks[g]=s;s<o;){const te=e.src.charCodeAt(s);if(Ce(te))te===9?K+=4-(K+e.bsCount[g]+(N?1:0))%4:K++;else break;s++}_=s>=o,d.push(e.bsCount[g]),e.bsCount[g]=e.sCount[g]+1+(M?1:0),u.push(e.sCount[g]),e.sCount[g]=K-D,p.push(e.tShift[g]),e.tShift[g]=s-e.bMarks[g];continue}if(_)break;let $=!1;for(let D=0,M=v.length;D<M;D++)if(v[D](e,g,n,!0)){$=!0;break}if($){e.lineMax=g,e.blkIndent!==0&&(l.push(e.bMarks[g]),d.push(e.bsCount[g]),p.push(e.tShift[g]),u.push(e.sCount[g]),e.sCount[g]-=e.blkIndent);break}l.push(e.bMarks[g]),d.push(e.bsCount[g]),p.push(e.tShift[g]),u.push(e.sCount[g]),e.sCount[g]=-1}const m=e.blkIndent;e.blkIndent=0;const k=e.push("blockquote_open","blockquote",1);k.markup=">";const w=[t,0];k.map=w,e.md.block.tokenize(e,t,g);const x=e.push("blockquote_close","blockquote",-1);x.markup=">",e.lineMax=i,e.parentType=b,w[1]=e.line;for(let y=0;y<p.length;y++)e.bMarks[y+t]=l[y],e.tShift[y+t]=p[y],e.sCount[y+t]=u[y],e.bsCount[y+t]=d[y];return e.blkIndent=m,!0}function bk(e,t,n,a){const s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.bMarks[t]+e.tShift[t];const i=e.src.charCodeAt(o++);if(i!==42&&i!==45&&i!==95)return!1;let l=1;for(;o<s;){const u=e.src.charCodeAt(o++);if(u!==i&&!Ce(u))return!1;u===i&&l++}if(l<3)return!1;if(a)return!0;e.line=t+1;const d=e.push("hr","hr",0);return d.map=[t,e.line],d.markup=Array(l+1).join(String.fromCharCode(i)),!0}function ao(e,t){const n=e.eMarks[t];let a=e.bMarks[t]+e.tShift[t];const s=e.src.charCodeAt(a++);return s!==42&&s!==45&&s!==43||a<n&&!Ce(e.src.charCodeAt(a))?-1:a}function so(e,t){const n=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];let s=n;if(s+1>=a)return-1;let o=e.src.charCodeAt(s++);if(o<48||o>57)return-1;for(;;){if(s>=a)return-1;if(o=e.src.charCodeAt(s++),o>=48&&o<=57){if(s-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return s<a&&(o=e.src.charCodeAt(s),!Ce(o))?-1:s}function yk(e,t){const n=e.level+2;for(let a=t+2,s=e.tokens.length-2;a<s;a++)e.tokens[a].level===n&&e.tokens[a].type==="paragraph_open"&&(e.tokens[a+2].hidden=!0,e.tokens[a].hidden=!0,a+=2)}function wk(e,t,n,a){let s,o,i,l,d=t,u=!0;if(e.sCount[d]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[d]-e.listIndent>=4&&e.sCount[d]<e.blkIndent)return!1;let p=!1;a&&e.parentType==="paragraph"&&e.sCount[d]>=e.blkIndent&&(p=!0);let v,b,_;if((_=so(e,d))>=0){if(v=!0,i=e.bMarks[d]+e.tShift[d],b=Number(e.src.slice(i,_-1)),p&&b!==1)return!1}else if((_=ao(e,d))>=0)v=!1;else return!1;if(p&&e.skipSpaces(_)>=e.eMarks[d])return!1;if(a)return!0;const g=e.src.charCodeAt(_-1),m=e.tokens.length;v?(l=e.push("ordered_list_open","ol",1),b!==1&&(l.attrs=[["start",b]])):l=e.push("bullet_list_open","ul",1);const k=[d,0];l.map=k,l.markup=String.fromCharCode(g);let w=!1;const x=e.md.block.ruler.getRules("list"),y=e.parentType;for(e.parentType="list";d<n;){o=_,s=e.eMarks[d];const $=e.sCount[d]+_-(e.bMarks[d]+e.tShift[d]);let D=$;for(;o<s;){const Z=e.src.charCodeAt(o);if(Z===9)D+=4-(D+e.bsCount[d])%4;else if(Z===32)D++;else break;o++}const M=o;let N;M>=s?N=1:N=D-$,N>4&&(N=1);const K=$+N;l=e.push("list_item_open","li",1),l.markup=String.fromCharCode(g);const te=[d,0];l.map=te,v&&(l.info=e.src.slice(i,_-1));const ne=e.tight,V=e.tShift[d],X=e.sCount[d],O=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=K,e.tight=!0,e.tShift[d]=M-e.bMarks[d],e.sCount[d]=D,M>=s&&e.isEmpty(d+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,d,n),(!e.tight||w)&&(u=!1),w=e.line-d>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=O,e.tShift[d]=V,e.sCount[d]=X,e.tight=ne,l=e.push("list_item_close","li",-1),l.markup=String.fromCharCode(g),d=e.line,te[1]=d,d>=n||e.sCount[d]<e.blkIndent||e.sCount[d]-e.blkIndent>=4)break;let J=!1;for(let Z=0,Y=x.length;Z<Y;Z++)if(x[Z](e,d,n,!0)){J=!0;break}if(J)break;if(v){if(_=so(e,d),_<0)break;i=e.bMarks[d]+e.tShift[d]}else if(_=ao(e,d),_<0)break;if(g!==e.src.charCodeAt(_-1))break}return v?l=e.push("ordered_list_close","ol",-1):l=e.push("bullet_list_close","ul",-1),l.markup=String.fromCharCode(g),k[1]=d,e.line=d,e.parentType=y,u&&yk(e,m),!0}var fa=999;function xk(e){let t=e.length;for(let n=0;n<e.length-1;n++){const a=e.charCodeAt(n);if(a<55296||a>56319)continue;const s=e.charCodeAt(n+1);s>=56320&&s<=57343&&(t--,n++)}return t}function Ht(e,t){return Math.min(e.eMarks[t]+1,e.src.length)}function $n(e,t){const n=e.lineMax;if(t>=n||e.isEmpty(t))return-1;let a=!1;if(e.sCount[t]-e.blkIndent>3&&(a=!0),e.sCount[t]<0&&(a=!0),!a){const s=e.md.block.ruler.getRules("reference"),o=e.parentType;e.parentType="reference";let i=!1;for(let l=0,d=s.length;l<d;l++)if(s[l](e,t,n,!0)){i=!0;break}if(e.parentType=o,i)return-1}return e.bMarks[t]+e.tShift[t]}function $k(e,t,n,a){const s=e.src;let o=e.bMarks[t]+e.tShift[t],i=t+1;if(e.sCount[t]-e.blkIndent>=4||s.charCodeAt(o)!==91)return!1;let l=Ht(e,t),d="",u=-1,p=++o;for(;o<l;){if(d.length+o-p>fa*2)return!1;let M=s.charCodeAt(o);if(M===91)return!1;if(M===93){u=o;break}if(M===92&&(M=s.charCodeAt(++o)),M===10&&o<l){const N=$n(e,i);if(N<0)return!1;d+=s.slice(p,l),o=p=N,l=Ht(e,i++);continue}o++}if(u<0||s.charCodeAt(u+1)!==58||(d+=s.slice(p,u),d.length>fa&&xk(d)>fa))return!1;for(o=u+2;o<l;){const M=s.charCodeAt(o);if(M===10){const N=$n(e,i);if(N<0)break;o=N,l=Ht(e,i++)}else if(Ce(M))o++;else break}const v=e.md.helpers.parseLinkDestination(s,o,l);if(!v.ok)return!1;const b=e.md.normalizeLink(v.str);if(!e.md.validateLink(b))return!1;o=v.pos;const _=o,g=l,m=i;for(;o<l;){const M=s.charCodeAt(o);if(M===10){const N=$n(e,i);if(N<0)break;o=N,l=Ht(e,i++)}else if(Ce(M))o++;else break}const k=o;let w=e.md.helpers.parseLinkTitle(s,o,l);for(;w.can_continue;){const M=$n(e,i);if(M<0)break;o=M,l=Ht(e,i++),w=e.md.helpers.parseLinkTitle(s,o,l,w)}let x;for(k!==_&&w.ok?(x=w.str,o=w.pos):(x="",o=_,l=g,i=m);o<l&&Ce(s.charCodeAt(o));)o++;if(o<l&&s.charCodeAt(o)!==10&&x)for(x="",o=_,l=g,i=m;o<l&&Ce(s.charCodeAt(o));)o++;if(o<l&&s.charCodeAt(o)!==10)return!1;const y=jn(d);if(!y)return!1;if(a)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[y]>"u"&&(e.env.references[y]={title:x,href:b});const $=e.push("reference_definition","",0);$.map=[t,i],$.hidden=!0;const D=Object.create(null);return D.label=y,$.meta=D,e.line=i,!0}var Ck=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ak=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Dk="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",$i=new RegExp(`^(?:${Ak}|${Dk})`),$t=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${Ck.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${$i.source}\\s*$`),/^$/,!1]];function Rk(e,t,n,a){let s=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(s)!==60)return!1;let i=e.src.slice(s,o),l=0;for(;l<$t.length&&!$t[l][0].test(i);l++);if(l===$t.length)return!1;if(a)return $t[l][2];let d=t+1;const u=$t[l][1].test("");if(!$t[l][1].test(i)){for(;d<n&&!(e.sCount[d]<e.blkIndent&&(u||!e.isEmpty(d)));d++)if(s=e.bMarks[d]+e.tShift[d],o=e.eMarks[d],i=e.src.slice(s,o),$t[l][1].test(i)){i.length!==0&&d++;break}}e.line=d;const p=e.push("html_block","",0);return p.map=[t,d],p.content=e.getLines(t,d,e.blkIndent,!0),!0}function Ek(e,t,n,a){let s=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.src.charCodeAt(s);if(i!==35||s>=o)return!1;let l=1;for(i=e.src.charCodeAt(++s);i===35&&s<o&&l<=6;)l++,i=e.src.charCodeAt(++s);if(l>6||s<o&&!Ce(i))return!1;if(a)return!0;o=e.skipSpacesBack(o,s);const d=e.skipCharsBack(o,35,s);d>s&&Ce(e.src.charCodeAt(d-1))&&(o=d),e.line=t+1;const u=e.push("heading_open",`h${l}`,1);u.markup="########".slice(0,l),u.map=[t,e.line];const p=e.push("inline","",0);p.content=Un(e.src.slice(s,o)),p.map=[t,e.line],p.children=[];const v=e.push("heading_close",`h${l}`,-1);return v.markup="########".slice(0,l),!0}function Sk(e,t,n){const a=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;const s=e.parentType;e.parentType="paragraph";let o=0,i,l=t+1;for(;l<n&&!e.isEmpty(l);l++){if(e.sCount[l]-e.blkIndent>3)continue;if(e.sCount[l]>=e.blkIndent){let _=e.bMarks[l]+e.tShift[l];const g=e.eMarks[l];if(_<g&&(i=e.src.charCodeAt(_),(i===45||i===61)&&(_=e.skipChars(_,i),_=e.skipSpaces(_),_>=g))){o=i===61?1:2;break}}if(e.sCount[l]<0)continue;let b=!1;for(let _=0,g=a.length;_<g;_++)if(a[_](e,l,n,!0)){b=!0;break}if(b)break}if(!o)return e.parentType=s,!1;const d=Un(e.getLines(t,l,e.blkIndent,!1));e.line=l+1;const u=e.push("heading_open",`h${o}`,1);u.markup=String.fromCharCode(i),u.map=[t,e.line];const p=e.push("inline","",0);p.content=d,p.map=[t,e.line-1],p.children=[];const v=e.push("heading_close",`h${o}`,-1);return v.markup=String.fromCharCode(i),e.parentType=s,!0}function Mk(e,t,n){const a=e.md.block.ruler.getRules("paragraph"),s=e.parentType;let o=t+1;for(e.parentType="paragraph";o<n&&!e.isEmpty(o);o++){if(e.sCount[o]-e.blkIndent>3||e.sCount[o]<0)continue;let u=!1;for(let p=0,v=a.length;p<v;p++)if(a[p](e,o,n,!0)){u=!0;break}if(u)break}const i=Un(e.getLines(t,o,e.blkIndent,!1));e.line=o;const l=e.push("paragraph_open","p",1);l.map=[t,e.line];const d=e.push("inline","",0);return d.content=i,d.map=[t,e.line],d.children=[],e.push("paragraph_close","p",-1),e.parentType=s,!0}var Cn=[["table",_k,["paragraph","reference"]],["code",mk],["fence",gk,["paragraph","reference","blockquote","list"]],["blockquote",kk,["paragraph","reference","blockquote","list"]],["hr",bk,["paragraph","reference","blockquote","list"]],["list",wk,["paragraph","reference","blockquote"]],["reference",$k],["html_block",Rk,["paragraph","reference","blockquote"]],["heading",Ek,["paragraph","reference","blockquote"]],["lheading",Sk],["paragraph",Mk]],Ci=class{constructor(){se(this,"ruler",new un),se(this,"State",xi);for(let e=0;e<Cn.length;e++)this.ruler.push(Cn[e][0],Cn[e][1],{alt:(Cn[e][2]||[]).slice()})}tokenize(e,t,n){const a=this.ruler.getRules(""),s=a.length,o=e.md.options.maxNesting;let i=t,l=!1;for(;i<n&&(e.line=i=e.skipEmptyLines(i),!(i>=n||e.sCount[i]<e.blkIndent));){if(e.level>=o){e.line=n;break}const d=e.line;let u=!1;for(let p=0;p<s;p++)if(u=a[p](e,i,n,!1),u){if(d>=e.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");e.tight=!l,e.isEmpty(e.line-1)&&(l=!0),i=e.line,i<n&&e.isEmpty(i)&&(l=!0,i++,e.line=i)}}parse(e,t,n,a){if(!e)return;const s=new this.State(e,t,n,a);this.tokenize(s,s.line,s.lineMax)}},Ai=class{constructor(e,t,n,a){se(this,"pos",0),se(this,"level",0),se(this,"pending",""),se(this,"pendingLevel",0),se(this,"cache",{}),se(this,"backticks",{}),se(this,"backticksScanned",!1),se(this,"skipHtmlSpecial",!1),se(this,"linkLevel",0),se(this,"delimiters",[]),se(this,"_prev_delimiters",[]),se(this,"Token",At),this.src=e,this.env=n,this.md=t,this.tokens=a,this.tokens_meta=Array(a.length),this.posMax=this.src.length}pushPending(){const e=new At("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}push(e,t,n){this.pending&&this.pushPending();const a=new At(e,t,n);let s;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),a.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(a),this.tokens_meta.push(s),a}scanDelims(e,t){const n=this.posMax,a=this.src.charCodeAt(e);let s;if(e===0)s=32;else if(e===1)s=this.src.charCodeAt(0),(s&63488)===55296&&(s=65533);else if(s=this.src.charCodeAt(e-1),(s&64512)===56320){const g=this.src.charCodeAt(e-2);s=(g&64512)===55296?65536+(g-55296<<10)+(s-56320):65533}else(s&64512)===55296&&(s=65533);let o=e;for(;o<n&&this.src.charCodeAt(o)===a;)o++;const i=o-e;let l=o<n?this.src.charCodeAt(o):32;if((l&64512)===55296){const g=this.src.charCodeAt(o+1);l=(g&64512)===56320?65536+(l-55296<<10)+(g-56320):65533}else(l&64512)===56320&&(l=65533);const d=ln(s)||on(s),u=ln(l)||on(l),p=sn(s),v=sn(l),b=!v&&(!u||p||d),_=!p&&(!d||v||u);return{can_open:b&&(t||!_||d),can_close:_&&(t||!b||u),length:i}}};function Tk(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Fk(e,t){let n=e.pos;for(;n<e.posMax&&!Tk(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}function Ik(e){return e>=65&&e<=90||e>=97&&e<=122}function Bk(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===45||e===46}function zk(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;const n=e.pos,a=e.posMax;if(n+3>a||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const s=n-Math.min(10,e.pending.length,n);let o=n;for(;o>s&&Bk(e.src.charCodeAt(o-1));)o--;if(o===n||!Ik(e.src.charCodeAt(o)))return!1;const i=n-o,l=e.md.linkify.matchAtStart(e.src.slice(o));if(!l)return!1;let d=l.url;if(d.length<=i)return!1;let u=d.length;for(;u>0&&d.charCodeAt(u-1)===42;)u--;u!==d.length&&(d=d.slice(0,u));const p=e.md.normalizeLink(d);if(!e.md.validateLink(p))return!1;if(!t){e.pending=e.pending.slice(0,-i);const v=e.push("link_open","a",1);v.attrs=[["href",p]],v.markup="linkify",v.info="auto";const b=e.push("text","",0);b.content=e.md.normalizeLinkText(d);const _=e.push("link_close","a",-1);_.markup="linkify",_.info="auto"}return e.pos+=d.length-i,!0}function Pk(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const a=e.pending.length-1,s=e.posMax;if(!t)if(a>=0&&e.pending.charCodeAt(a)===32)if(a>=1&&e.pending.charCodeAt(a-1)===32){let o=a-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(n++;n<s&&Ce(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var Na=[];for(let e=0;e<256;e++)Na.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Na[e.charCodeAt(0)]=1});function Lk(e,t){let n=e.pos;const a=e.posMax;if(e.src.charCodeAt(n)!==92||(n++,n>=a))return!1;let s=e.src.charCodeAt(n);if(s===10){for(t||e.push("hardbreak","br",0),n++;n<a&&(s=e.src.charCodeAt(n),!!Ce(s));)n++;return e.pos=n,!0}if(s===32){if(!t){const l=e.push("text_special","",0);l.content="\\",l.markup="\\",l.info="escape"}return e.pos=n,!0}let o=e.src[n];if(s>=55296&&s<=56319&&n+1<a){const l=e.src.charCodeAt(n+1);l>=56320&&l<=57343&&(o+=e.src[n+1],n++)}const i="\\"+o;if(!t){const l=e.push("text_special","",0);s<256&&Na[s]!==0?l.content=o:l.content=i,l.markup=i,l.info="escape"}return e.pos=n+1,!0}function Ok(e){const t={};let n=0;for(;(n=e.indexOf("`",n))!==-1;){const a=n;for(;e.charCodeAt(++n)===96;);t[n-a]=a}return t}function jk(e,t){var n;const a=e.pos;if(e.src.charCodeAt(a)!==96)return!1;const s=e.posMax;let o=a+1;for(;o<s&&e.src.charCodeAt(o)===96;)o++;const i=e.src.slice(a,o),l=i.length;if(e.backticksScanned||(e.backticks=Ok(e.src),e.backticksScanned=!0),((n=e.backticks[l])!==null&&n!==void 0?n:-1)>=o){let d=o,u;for(;(u=e.src.indexOf("`",d))!==-1&&u<s;){for(d=u+1;e.src.charCodeAt(d)===96;)d++;if(d>s)break;if(d-u===l){if(!t){const p=e.push("code_inline","code",0);p.markup=i;let v=e.src.slice(o,u).replace(/\n/g," ");v.startsWith(" ")&&v.endsWith(" ")&&/[^ ]/.test(v)&&(v=v.slice(1,-1)),p.content=v}return e.pos=d,!0}}}return t||(e.pending+=i),e.pos=o,!0}function Uk(e,t){const n=e.pos,a=e.src.charCodeAt(n);if(t||a!==126)return!1;const s=e.scanDelims(e.pos,!0);let o=s.length;const i=String.fromCharCode(a);if(o<2)return!1;let l;o%2&&(l=e.push("text","",0),l.content=i,o--);for(let d=0;d<o;d+=2)l=e.push("text","",0),l.content=i+i,e.delimiters.push({marker:a,length:0,token:e.tokens.length-1,end:-1,open:s.can_open,close:s.can_close});return e.pos+=s.length,!0}function oo(e,t){let n;const a=[],s=t.length;for(let o=0;o<s;o++){const i=t[o];if(i.marker!==126||i.end===-1)continue;const l=t[i.end];n=e.tokens[i.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=e.tokens[l.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",e.tokens[l.token-1].type==="text"&&e.tokens[l.token-1].content==="~"&&a.push(l.token-1)}for(;a.length;){const o=a.pop();let i=o+1;for(;i<e.tokens.length&&e.tokens[i].type==="s_close";)i++;i--,o!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[o],e.tokens[o]=n)}}function Nk(e){const t=e.tokens_meta,n=e.tokens_meta.length;oo(e,e.delimiters);for(let s=0;s<n;s++){var a;const o=(a=t[s])===null||a===void 0?void 0:a.delimiters;o&&oo(e,o)}}var Di={tokenize:Uk,postProcess:Nk};function qk(e,t){const n=e.pos,a=e.src.charCodeAt(n);if(t||a!==95&&a!==42)return!1;const s=e.scanDelims(e.pos,a===42);for(let o=0;o<s.length;o++){const i=e.push("text","",0);i.content=String.fromCharCode(a),e.delimiters.push({marker:a,length:s.length,token:e.tokens.length-1,end:-1,open:s.can_open,close:s.can_close})}return e.pos+=s.length,!0}function io(e,t){const n=t.length;for(let a=n-1;a>=0;a--){const s=t[a];if(s.marker!==95&&s.marker!==42||s.end===-1)continue;const o=t[s.end],i=a>0&&t[a-1].end===s.end+1&&t[a-1].marker===s.marker&&t[a-1].token===s.token-1&&t[s.end+1].token===o.token+1,l=String.fromCharCode(s.marker),d=e.tokens[s.token];d.type=i?"strong_open":"em_open",d.tag=i?"strong":"em",d.nesting=1,d.markup=i?l+l:l,d.content="";const u=e.tokens[o.token];u.type=i?"strong_close":"em_close",u.tag=i?"strong":"em",u.nesting=-1,u.markup=i?l+l:l,u.content="",i&&(e.tokens[t[a-1].token].content="",e.tokens[t[s.end+1].token].content="",a--)}}function Wk(e){const t=e.tokens_meta,n=e.tokens_meta.length;io(e,e.delimiters);for(let s=0;s<n;s++){var a;const o=(a=t[s])===null||a===void 0?void 0:a.delimiters;o&&io(e,o)}}var Ri={tokenize:qk,postProcess:Wk};function Vk(e,t){let n,a,s,o,i="",l="",d=e.pos,u=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;const p=e.pos,v=e.posMax,b=e.pos+1,_=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(_<0)return!1;let g=_+1;if(g<v&&e.src.charCodeAt(g)===40){for(u=!1,g++;g<v&&(n=e.src.charCodeAt(g),!(!Ce(n)&&n!==10));g++);if(g>=v)return!1;if(d=g,s=e.md.helpers.parseLinkDestination(e.src,g,e.posMax),s.ok){for(i=e.md.normalizeLink(s.str),e.md.validateLink(i)?g=s.pos:i="",d=g;g<v&&(n=e.src.charCodeAt(g),!(!Ce(n)&&n!==10));g++);if(s=e.md.helpers.parseLinkTitle(e.src,g,e.posMax),g<v&&d!==g&&s.ok)for(l=s.str,g=s.pos;g<v&&(n=e.src.charCodeAt(g),!(!Ce(n)&&n!==10));g++);}(g>=v||e.src.charCodeAt(g)!==41)&&(u=!0),g++}if(u){if(typeof e.env.references>"u")return!1;if(g<v&&e.src.charCodeAt(g)===91?(d=g+1,g=e.md.helpers.parseLinkLabel(e,g),g>=0?a=e.src.slice(d,g++):g=_+1):g=_+1,a||(a=e.src.slice(b,_)),a=jn(a),o=e.env.references[a],!o)return e.pos=p,!1;i=o.href,l=o.title}if(!t){e.pos=b,e.posMax=_;const m=e.push("link_open","a",1),k=[["href",i]];if(m.attrs=k,l&&k.push(["title",l]),a){const w=Object.create(null);w.label=a,m.meta=w}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=g,e.posMax=v,!0}function Jk(e,t){let n,a,s,o,i,l,d,u,p="";const v=e.pos,b=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const _=e.pos+2,g=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(g<0)return!1;if(o=g+1,o<b&&e.src.charCodeAt(o)===40){for(o++;o<b&&(n=e.src.charCodeAt(o),!(!Ce(n)&&n!==10));o++);if(o>=b)return!1;for(u=o,l=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),l.ok&&(p=e.md.normalizeLink(l.str),e.md.validateLink(p)?o=l.pos:p=""),u=o;o<b&&(n=e.src.charCodeAt(o),!(!Ce(n)&&n!==10));o++);if(l=e.md.helpers.parseLinkTitle(e.src,o,e.posMax),o<b&&u!==o&&l.ok)for(d=l.str,o=l.pos;o<b&&(n=e.src.charCodeAt(o),!(!Ce(n)&&n!==10));o++);else d="";if(o>=b||e.src.charCodeAt(o)!==41)return e.pos=v,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o<b&&e.src.charCodeAt(o)===91?(u=o+1,o=e.md.helpers.parseLinkLabel(e,o),o>=0?s=e.src.slice(u,o++):o=g+1):o=g+1,s||(s=e.src.slice(_,g)),s=jn(s),i=e.env.references[s],!i)return e.pos=v,!1;p=i.href,d=i.title}if(!t){a=e.src.slice(_,g);const m=[];e.md.inline.parse(a,e.md,e.env,m);const k=e.push("image","img",0),w=[["src",p],["alt",""]];if(k.attrs=w,k.children=m,k.content=a,d&&w.push(["title",d]),s){const x=Object.create(null);x.label=s,k.meta=x}}return e.pos=o,e.posMax=b,!0}var Kk=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Hk=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Zk(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;const a=e.pos,s=e.posMax;for(;;){if(++n>=s)return!1;const i=e.src.charCodeAt(n);if(i===60)return!1;if(i===62)break}const o=e.src.slice(a+1,n);if(Hk.test(o)){const i=e.md.normalizeLink(o);if(!e.md.validateLink(i))return!1;if(!t){const l=e.push("link_open","a",1);l.attrs=[["href",i]],l.markup="autolink",l.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(o);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=o.length+2,!0}if(Kk.test(o)){const i=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(i))return!1;if(!t){const l=e.push("link_open","a",1);l.attrs=[["href",i]],l.markup="autolink",l.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(o);const u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=o.length+2,!0}return!1}function Xk(e){return/^<a[>\s]/i.test(e)}function Gk(e){return/^<\/a\s*>/i.test(e)}function Ei(e){const t=e|32;return t>=97&&t<=122}function Yk(e,t){const n=e.src;let a,s;if(n.startsWith("<!--",t)){if(n.startsWith(">",t+4))return t+5;if(n.startsWith("->",t+4))return t+6;a=t+4,s="-->"}else if(n.startsWith("<![CDATA[",t))a=t+9,s="]]>";else if(n.charCodeAt(t+1)===63)a=t+2,s="?>";else if(Ei(n.charCodeAt(t+2)))a=t+3,s=">";else return-1;if(e.skipHtmlSpecial)return-1;const o=n.indexOf(s,a);return o<0?(e.skipHtmlSpecial=!0,-1):o+s.length}function Qk(e,t){if(!e.md.options.html)return!1;const n=e.posMax,a=e.pos;if(e.src.charCodeAt(a)!==60||a+2>=n)return!1;let s;const o=e.src.charCodeAt(a+1);if(o===33||o===63)s=Yk(e,a);else if(o===47||Ei(o)){const i=e.src.slice(a).match($i);s=i?a+i[0].length:-1}else return!1;if(s<0)return!1;if(!t){const i=e.push("html_inline","",0);i.content=e.src.slice(a,s),Xk(i.content)&&e.linkLevel++,Gk(i.content)&&e.linkLevel--}return e.pos=s,!0}var eb=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,tb=/^&([a-z][a-z0-9]{1,31});/i;function nb(e,t){const n=e.pos,a=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=a)return!1;if(e.src.charCodeAt(n+1)===35){const s=e.src.slice(n).match(eb);if(s){if(!t){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),i=e.push("text_special","",0);i.content=Ua(o)?an(o):an(65533),i.markup=s[0],i.info="entity"}return e.pos+=s[0].length,!0}}else{const s=e.src.slice(n).match(tb);if(s){const o=ii(s[0]);if(o!==s[0]){if(!t){const i=e.push("text_special","",0);i.content=o,i.markup=s[0],i.info="entity"}return e.pos+=s[0].length,!0}}}return!1}function lo(e){const t={},n=e.length;if(!n)return;let a=0,s=-2;const o=[];for(let i=0;i<n;i++){const l=e[i];if(o.push(0),(e[a].marker!==l.marker||s!==l.token-1)&&(a=i),s=l.token,l.length=l.length||0,!l.close)continue;t.hasOwnProperty(l.marker)||(t[l.marker]=[-1,-1,-1,-1,-1,-1]);const d=t[l.marker][(l.open?3:0)+l.length%3];let u=a-o[a]-1,p=u;for(;u>d;u-=o[u]+1){const v=e[u];if(v.marker===l.marker&&v.open&&v.end<0){let b=!1;if((v.close||l.open)&&(v.length+l.length)%3===0&&(v.length%3!==0||l.length%3!==0)&&(b=!0),!b){const _=u>0&&!e[u-1].open?o[u-1]+1:0;o[i]=i-u+_,o[u]=_,l.open=!1,v.end=i,v.close=!1,p=-1,s=-2;break}}}p!==-1&&(t[l.marker][(l.open?3:0)+(l.length||0)%3]=p)}}function ab(e){const t=e.tokens_meta,n=e.tokens_meta.length;lo(e.delimiters);for(let s=0;s<n;s++){var a;const o=(a=t[s])===null||a===void 0?void 0:a.delimiters;o&&lo(o)}}function sb(e){let t,n,a=0;const s=e.tokens,o=e.tokens.length;for(t=n=0;t<o;t++)s[t].nesting<0&&a--,s[t].level=a,s[t].nesting>0&&a++,s[t].type==="text"&&t+1<o&&s[t+1].type==="text"?s[t+1].content=s[t].content+s[t+1].content:(t!==n&&(s[n]=s[t]),n++);t!==n&&(s.length=n)}var va=[["text",Fk],["linkify",zk],["newline",Pk],["escape",Lk],["backticks",jk],["strikethrough",Di.tokenize],["emphasis",Ri.tokenize],["link",Vk],["image",Jk],["autolink",Zk],["html_inline",Qk],["entity",nb]],pa=[["balance_pairs",ab],["strikethrough",Di.postProcess],["emphasis",Ri.postProcess],["fragments_join",sb]],Si=class{constructor(){se(this,"ruler",new un),se(this,"ruler2",new un),se(this,"State",Ai);for(let e=0;e<va.length;e++)this.ruler.push(va[e][0],va[e][1]);for(let e=0;e<pa.length;e++)this.ruler2.push(pa[e][0],pa[e][1])}skipToken(e){const t=e.pos,n=this.ruler.getRules(""),a=n.length,s=e.md.options.maxNesting,o=e.cache;if(typeof o[t]<"u"){e.pos=o[t];return}let i=!1;if(e.level<s){for(let l=0;l<a;l++)if(e.level++,i=n[l](e,!0),e.level--,i){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;i||e.pos++,o[t]=e.pos}tokenize(e){const t=this.ruler.getRules(""),n=t.length,a=e.posMax,s=e.md.options.maxNesting;for(;e.pos<a;){const o=e.pos;let i=!1;if(e.level<s){for(let l=0;l<n;l++)if(i=t[l](e,!1),i){if(o>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(i){if(e.pos>=a)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,t,n,a){const s=new this.State(e,t,n,a);this.tokenize(s);const o=this.ruler2.getRules(""),i=o.length;for(let l=0;l<i;l++)o[l](s)}},ob={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},ib=/^(vbscript|javascript|file|data):/,lb=/^data:image\/(gif|png|jpeg|webp);/,ro=["http:","https:","mailto:"],st=class{validateLink(e){const t=e.trim().toLowerCase();return ib.test(t)?lb.test(t):!0}normalizeLink(e){const t=Ea(e,!0);if(t.hostname&&(!t.protocol||ro.indexOf(t.protocol)>=0))try{t.hostname=Xs.toASCII(t.hostname)}catch{}return t.auth&&(t.auth=ut(t.auth)),t.hostname&&(t.hostname=ut(t.hostname)),t.pathname&&(t.pathname=ut(t.pathname)),t.search&&(t.search=ut(t.search)),t.hash&&(t.hash=ut(t.hash)),Ra(t)}normalizeLinkText(e){const t=Ea(e,!0);if(t.hostname&&(!t.protocol||ro.indexOf(t.protocol)>=0))try{t.hostname=Xs.toUnicode(t.hostname)}catch{}return Ot(Ra(t),Ot.defaultChars+"%")}constructor(...e){se(this,"inline",new Si),se(this,"block",new Ci),se(this,"core",new wi),se(this,"renderer",new ki),se(this,"linkify",new hg),se(this,"utils",Dg),se(this,"helpers",Object.assign({},qg));const[t,n]=e;typeof t=="string"?(this.configure(t),n&&this.set(n)):(this.configure("default"),this.set(t||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let t;if(typeof e=="string"){const s=e;if(t=ob[s],!t)throw new Error(`Wrong 'markdown-it' preset "${s}", check name`)}else t=e;if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");t.options&&(this.options={...t.options});const n=t.components;if(n){var a;["core","block","inline"].forEach(o=>{var i;const l=(i=n[o])===null||i===void 0?void 0:i.rules;l&&this[o].ruler.enableOnly(l)});const s=(a=n.inline)===null||a===void 0?void 0:a.rules2;s&&this.inline.ruler2.enableOnly(s)}return this}enable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(s=>{n=n.concat(this[s].ruler.enable(e,!0))}),n=n.concat(this.inline.ruler2.enable(e,!0));const a=e.filter(s=>n.indexOf(s)<0);if(a.length&&!t)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${a}`);return this}disable(e,t=!1){let n=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(s=>{n=n.concat(this[s].ruler.disable(e,!0))}),n=n.concat(this.inline.ruler2.disable(e,!0));const a=e.filter(s=>n.indexOf(s)<0);if(a.length&&!t)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${a}`);return this}use(e,...t){return e.apply(e,[this,...t]),this}parse(e,t){if(typeof e!="string")throw new Error("Input data should be a String");const n=new this.core.State(e,this,t);return this.core.process(n),n.tokens}render(e,t={}){return this.renderer.render(this.parse(e,t),this.options,t)}parseInline(e,t){const n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens}renderInline(e,t={}){return this.renderer.render(this.parseInline(e,t),this.options,t)}};se(st,"Token",At);se(st,"Ruler",un);se(st,"Renderer",ki);se(st,"ParserCore",wi);se(st,"StateCore",bi);se(st,"ParserBlock",Ci);se(st,"StateBlock",xi);se(st,"ParserInline",Si);se(st,"StateInline",Ai);var rb=_i(st);const ub=["data-streaming"],cb=["innerHTML"],db={key:0,class:"va-md__caret","aria-hidden":"true"},fb=ce({__name:"VaMarkdown",props:{content:{default:""},streaming:{type:Boolean,default:!1},linkify:{type:Boolean,default:!0},breaks:{type:Boolean,default:!0}},setup(e){const t=e,n=new rb({html:!1,linkify:t.linkify,breaks:t.breaks,typographer:!1}),a=R(()=>t.content?n.render(t.content):"");return(s,o)=>(f(),h("div",{class:"va-md","data-streaming":e.streaming||void 0},[c("div",{class:"va-md__body",innerHTML:a.value},null,8,cb),e.streaming?(f(),h("span",db)):A("",!0)],8,ub))}}),vb={key:1,class:"va-thought-box"},pb={class:"va-thought-box__title"},hb={key:0,class:"va-thought-box__duration"},_b={key:1,class:"va-thought-box__duration"},mb={key:0,class:"va-thought-box__content"},gb=ce({__name:"VaThoughtBox",props:{thought:{default:""},expanded:{type:Boolean,default:!0},duration:{default:void 0},streaming:{type:Boolean,default:!1},summaryMode:{type:Boolean,default:!1},toolCount:{default:0}},emits:["update:expanded","update:summaryMode","toggle"],setup(e,{emit:t}){const n=e,a=t,s=R({get:()=>n.expanded,set:l=>{a("update:expanded",l),a("toggle",l)}});function o(){s.value=!s.value}function i(){a("update:summaryMode",!1),a("update:expanded",!0),a("toggle",!0)}return(l,d)=>n.summaryMode?(f(),h("button",{key:0,class:"va-thought-box__summary",type:"button",title:"展开过程详情",onClick:i},[B(r(yc),{size:14,class:"va-thought-box__summary-icon"}),c("span",null,[d[0]||(d[0]=G(" 已完成",-1)),n.duration!=null?(f(),h(j,{key:0},[G(" · 耗时 "+C(n.duration)+"s",1)],64)):A("",!0),n.toolCount?(f(),h(j,{key:1},[G(" · "+C(n.toolCount)+" 次工具调用",1)],64)):A("",!0)]),B(r(Dt),{size:13,class:"va-thought-box__summary-chevron"})])):(f(),h("div",vb,[c("div",{class:"va-thought-box__header",onClick:o},[c("div",pb,[B(r(kc),{size:15,class:ue({"va-thought-box__pulse-icon":n.streaming})},null,8,["class"]),d[1]||(d[1]=c("span",null,"思考过程",-1)),n.duration!=null?(f(),h("span",hb,"· 耗时 "+C(n.duration)+"s",1)):n.streaming?(f(),h("span",_b,"· 正在深度思考…")):A("",!0)]),c("button",{class:"va-thought-box__btn",type:"button",onClick:_e(o,["stop"])},[G(C(s.value?"收起":"展开")+" ",1),s.value?(f(),H(r(bc),{key:0,size:13})):(f(),H(r(Dt),{key:1,size:13}))])]),s.value?(f(),h("div",mb,[xe(l.$slots,"default",{},()=>[G(C(n.thought||(n.streaming?"正在拆解任务意图,规划工具调用序列与沙箱执行路径…":"暂无思考内容")),1)])])):A("",!0)]))}}),kb=["aria-label"],bb={class:"va-turn-rail__track","aria-hidden":"true"},yb=["aria-current","aria-label","onClick","onMouseenter","onFocus"],wb={class:"va-turn-rail__preview-index"},xb={class:"va-turn-rail__preview-text"},$b=96,uo=1,Cb=ce({__name:"VaTurnRail",props:{items:{default:()=>[]},container:{default:null},anchorAttr:{default:"data-turn-id"},offset:{default:16},minItems:{default:1},preview:{type:Boolean,default:!0},floating:{type:Boolean,default:!0},activeId:{default:""},ariaLabel:{default:"对话轮次快速跳转"}},emits:["select","update:activeId"],setup(e,{expose:t,emit:n}){const a=e,s=n,o=S(null),i=S([]),l=S(""),d=R(()=>a.activeId||l.value),u=R(()=>Math.max(0,a.items.findIndex(P=>P.id===d.value))),p=R(()=>a.items.length>a.minItems),v=R(()=>{const P=a.items.length;return P<=1?0:Math.min(1,Math.max(0,u.value/(P-1)))});function b(P,L){return(P.label??"").replace(/\s+/g," ").trim()||`第 ${L+1} 轮`}function _(P){return P.replace(/["\\]/g,"\\$&")}function g(P){const L=a.container;return L?L.querySelector(`[${a.anchorAttr}="${_(P)}"]`):null}let m=null,k=null,w=null;function x(){const P=a.container;if(!P||a.items.length===0)return;const L=P.getBoundingClientRect().top;let q=a.items[0].id;if(P.scrollHeight-P.clientHeight>uo&&P.scrollHeight-P.scrollTop-P.clientHeight<=uo)q=a.items[a.items.length-1].id;else for(const we of a.items){const De=g(we.id);if(De){if(De.getBoundingClientRect().top-L>$b)break;q=we.id}}q!==l.value&&(l.value=q,s("update:activeId",q))}function y(){if(m===null){if(typeof requestAnimationFrame!="function"){x();return}m=requestAnimationFrame(()=>{m=null,x()})}}function $(){y()}function D(){k&&k.removeEventListener("scroll",$),k=null,w?.disconnect(),w=null,m!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(m),m=null)}function M(){D();const P=a.container;if(P){if(k=P,P.addEventListener("scroll",$,{passive:!0}),typeof ResizeObserver<"u"){w=new ResizeObserver(()=>y()),w.observe(P);const L=P.firstElementChild;L instanceof HTMLElement&&w.observe(L)}y()}}ve(()=>a.container,M,{immediate:!0}),ve(()=>a.items.map(P=>P.id).join("|"),()=>y()),Pe(D);function N(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function K(P){const L=a.container,q=g(P);if(!L||!q)return;const fe=L.scrollTop+(q.getBoundingClientRect().top-L.getBoundingClientRect().top)-a.offset,we=Math.max(0,fe);if(typeof L.scrollTo=="function"){L.scrollTo({top:we,behavior:N()?"auto":"smooth"});return}L.scrollTop=we}function te(P,L){l.value=P.id,s("update:activeId",P.id),s("select",P.id,L),K(P.id)}function ne(P,L){i.value[L]=P??null}function V(P){const L=a.items.length;if(L===0)return;let q=-1;if(P.key==="Home"?q=0:P.key==="End"?q=L-1:P.key==="ArrowUp"?q=Math.max(0,u.value-1):P.key==="ArrowDown"&&(q=Math.min(L-1,u.value+1)),q<0)return;P.preventDefault();const fe=a.items[q];fe&&(te(fe,q),i.value[q]?.focus())}const X=S(""),O=S(""),J=R(()=>a.preview?X.value||O.value:""),Z=R(()=>a.items.find(P=>P.id===J.value)??null),Y=R(()=>a.items.findIndex(P=>P.id===J.value)),ie=S(0);function le(){const P=J.value,L=o.value,q=i.value[Y.value];if(!P||!L||!q)return;const fe=q.getBoundingClientRect(),we=L.getBoundingClientRect();ie.value=fe.top+fe.height/2-we.top}ve(J,async()=>{await Se(),le()});function T(){J.value&&le()}return t({measure:x,scrollTo:K,activeId:d}),(P,L)=>p.value?(f(),h("nav",{key:0,ref_key:"rootRef",ref:o,class:ue(["va-turn-rail",{"va-turn-rail--floating":a.floating}]),"aria-label":a.ariaLabel,onKeydown:V},[c("div",bb,[c("span",{class:"va-turn-rail__track-fill",style:be({transform:`scaleY(${v.value})`})},null,4)]),c("ol",{class:"va-turn-rail__list",onScrollPassive:T},[(f(!0),h(j,null,Q(a.items,(q,fe)=>(f(),h("li",{key:q.id,class:"va-turn-rail__item"},[c("button",{ref_for:!0,ref:we=>ne(we,fe),type:"button",class:ue(["va-turn-rail__dot",[`va-turn-rail__dot--${q.role==="assistant"?"assistant":"user"}`,{"va-turn-rail__dot--active":q.id===d.value,"va-turn-rail__dot--streaming":q.status==="streaming","va-turn-rail__dot--error":q.status==="error"}]]),"aria-current":q.id===d.value?"true":void 0,"aria-label":`跳到${b(q,fe)}`,onClick:we=>te(q,fe),onMouseenter:we=>X.value=q.id,onMouseleave:L[0]||(L[0]=we=>X.value=""),onFocus:we=>O.value=q.id,onBlur:L[1]||(L[1]=we=>O.value="")},[...L[2]||(L[2]=[c("span",{class:"va-turn-rail__pip","aria-hidden":"true"},null,-1)])],42,yb)]))),128))],32),Z.value?(f(),h("div",{key:0,class:"va-turn-rail__preview",role:"tooltip",style:be({top:`${ie.value}px`})},[c("span",wb,"#"+C(Y.value+1),1),c("span",xb,C(b(Z.value,Y.value)),1)],4)):A("",!0)],42,kb)):A("",!0)}});const Ab=ke("ArrowDownIcon",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const Db=ke("BellIcon",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);const Rb=ke("BotIcon",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const co=ke("BriefcaseIcon",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);const cn=ke("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Mi=ke("ChevronUpIcon",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Eb=ke("CircleAlertIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const fo=ke("CircleCheckIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Sb=ke("CpuIcon",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const Mb=ke("EllipsisIcon",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const Tb=ke("EyeOffIcon",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const Fb=ke("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Ib=ke("GaugeIcon",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Bb=ke("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const vo=ke("HistoryIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const po=ke("ImageIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const zb=ke("KeyIcon",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);const ho=ke("LayersIcon",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const Pb=ke("ListTodoIcon",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);const Xt=ke("LoaderCircleIcon",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Lb=ke("LockIcon",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const Ob=ke("MessageSquareTextIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);const jb=ke("MousePointerClickIcon",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);const Sn=ke("PanelRightIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const _o=ke("PlusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Ub=ke("RotateCcwIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Nb=ke("RouteIcon",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const Ti=ke("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qb=ke("ShieldAlertIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const Wb=ke("ShieldCheckIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Vb=ke("SlidersVerticalIcon",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);const Ma=ke("SparklesIcon",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const mo=ke("Trash2Icon",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const Jb=ke("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Pn=ke("WrenchIcon",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);const go=ke("ZapIcon",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Kb={class:"va-console__sidebar"},Hb={key:0,class:"va-console__stree-skeleton","aria-label":"加载会话列表"},Zb={class:"va-sidebar__foot"},Xb={class:"va-console__bell",type:"button","aria-label":"通知"},Gb={key:0,class:"va-console__bell-badge"},Yb={class:"va-console__notif-panel"},Qb=ce({__name:"ConsoleSidebar",props:{workspaces:{},sessions:{},loading:{type:Boolean},activeWorkspaceId:{},activeSessionId:{},isNewChat:{type:Boolean},sessionRunningMap:{},notifications:{},notifOpen:{type:Boolean}},emits:["start-new-chat","select-session","pick-workspace","delete-workspace","rename-session","toggle-archive","toggle-pin","delete-session","open-settings","update:notifOpen","open-notification","read-notification","all-read"],setup(e,{emit:t}){const n=e,a=t,s=R(()=>(n.notifications??[]).filter(v=>v.unread).length),o=R(()=>[...n.sessions.filter(b=>!b.archived&&b.status!=="archived")].sort((b,_)=>Number(_.pinned??!1)-Number(b.pinned??!1))),i=R(()=>n.sessions.filter(v=>v.archived||v.status==="archived")),l=R(()=>o.value.map(v=>({id:v.id,title:v.title,createdAt:v.createdAt,updatedAt:v.updatedAt,archived:!1,workspaceId:v.workspaceId,running:n.sessionRunningMap.get(v.id)||v.isRunning,pinned:v.pinned}))),d=R(()=>i.value.map(v=>({id:v.id,title:v.title,createdAt:v.createdAt,updatedAt:v.updatedAt,archived:!0,workspaceId:v.workspaceId,pinned:v.pinned}))),u=R(()=>n.workspaces.map(v=>({id:v.id,name:v.name,description:v.rootPath})));function p(v){return n.sessions.find(b=>b.id===v)}return(v,b)=>(f(),h("aside",Kb,[e.loading?(f(),h("div",Hb,[(f(),h(j,null,Q(6,_=>B(r(ct),{key:_,height:26,radius:"6px",width:_%2?"92%":"78%"},null,8,["width"])),64))])):(f(),H(r($v),{key:1,class:"va-console__stree",workspaces:u.value,sessions:l.value,archived:d.value,"current-workspace-id":e.activeWorkspaceId,"current-session-id":e.isNewChat?"":e.activeSessionId,"new-session":"",searchable:"",collapsible:"","hover-ops":"","workspace-create-mode":"picker","confirm-mode":"none",onCreateWorkspacePick:b[5]||(b[5]=_=>a("pick-workspace")),onCreateSession:b[6]||(b[6]=_=>a("start-new-chat",_)),onSelectSession:b[7]||(b[7]=_=>{const g=p(_);g&&a("select-session",g)}),onRemoveWorkspace:b[8]||(b[8]=_=>a("delete-workspace",_)),onRename:b[9]||(b[9]=(_,g)=>a("rename-session",_,g)),onArchive:b[10]||(b[10]=(_,g)=>a("toggle-archive",_,g)),onTogglePin:b[11]||(b[11]=_=>a("toggle-pin",_)),onRemove:b[12]||(b[12]=_=>a("delete-session",_))},{footer:oe(()=>[c("div",Zb,[B(r(ft),{open:n.notifOpen??!1,placement:"top-start",offset:8,"onUpdate:open":b[3]||(b[3]=_=>a("update:notifOpen",_))},{trigger:oe(()=>[c("button",Xb,[B(r(Db),{size:15}),s.value>0?(f(),h("span",Gb,C(s.value>9?"9+":s.value),1)):A("",!0)])]),default:oe(()=>[c("div",Yb,[B(r(h1),{notifications:n.notifications??[],title:"通知","relative-time":"","empty-label":"暂无通知;审批到达与后台任务结束会出现在这里",onOpen:b[0]||(b[0]=_=>a("open-notification",_)),onRead:b[1]||(b[1]=_=>a("read-notification",_)),onAllRead:b[2]||(b[2]=_=>a("all-read"))},null,8,["notifications"])])]),_:1},8,["open"]),B(r(Bt),{variant:"ghost",size:"sm",block:"",onClick:b[4]||(b[4]=_=>a("open-settings"))},{icon:oe(()=>[B(r(Ti),{size:15})]),default:oe(()=>[b[13]||(b[13]=G(" 设置 ",-1))]),_:1})])]),_:1},8,["workspaces","sessions","archived","current-workspace-id","current-session-id"]))]))}}),ey={class:"va-console__seat-btn",type:"button","aria-label":"输入辅助菜单"},ko=48*1024,bo=ce({__name:"ComposerMenu",emits:["clear","refFile","insert","openCommandMenu"],setup(e,{emit:t}){const n=t,a=[{id:"clear",label:"清空输入",icon:"✕"},{id:"ref-file",label:"引用工作区文件…",icon:"@",shortcut:"@"},{id:"import-text",label:"导入文本文件…",icon:"📄"},{id:"d1",label:"",divider:!0},{id:"cmdk",label:"命令面板",icon:"⌘",shortcut:"⌘K"}];function s(l){switch(l.id){case"clear":n("clear");break;case"ref-file":n("refFile");break;case"import-text":o.value?.click();break;case"cmdk":n("openCommandMenu");break}}const o=S(null);function i(l){const d=l.target,u=d.files?.[0];if(d.value="",!u)return;const p=new FileReader;p.onload=()=>{let v=String(p.result??"");v.length>ko&&(v=`${v.slice(0,ko)}
|
|
25
|
+
…(超出 48KB 已截断)`),n("insert",`
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
[${u.name}]
|
|
29
|
+
${v}
|
|
30
|
+
---
|
|
31
|
+
`)},p.readAsText(u)}return(l,d)=>(f(),h(j,null,[B(r(Q_),{items:a,trigger:"click",placement:"top-end",offset:6,onSelect:s},{trigger:oe(()=>[c("button",ey,[B(r(Mb),{size:13})])]),_:1}),c("input",{ref_key:"fileInput",ref:o,type:"file",hidden:"",accept:".txt,.md,.markdown,.json,.csv,.log,.yml,.yaml,.ts,.js,.vue,text/*",onChange:i},null,544)],64))}}),ty={class:"va-usage"},ny={class:"va-usage__window"},ay={class:"va-usage__hint"},sy={key:0,class:"va-usage__loading","aria-label":"加载用量数据"},oy=["title"],iy={class:"va-usage__kpis"},ly={class:"va-usage__kpi"},ry={class:"va-usage__kpi-sub"},uy={class:"va-usage__kpi"},cy={key:1,class:"va-usage__quota"},dy={key:2,class:"va-usage__quota"},fy={key:3,class:"va-usage__hint"},vy={key:4,class:"va-usage__breakdown"},py={key:5,class:"va-console__rtab-empty"},hy=ce({__name:"UsagePanel",props:{usage:{}},setup(e){const t=e,n=[{value:"24h",label:"24 小时"},{value:"7d",label:"7 天"},{value:"30d",label:"30 天"}],a=R(()=>t.usage.isCustom.value?"":t.usage.preset.value);function s(m){t.usage.setPreset(String(m))}function o(m){t.usage.setCustomRange(m.start,m.end)}const i=R(()=>{const m=t.usage.currentSessionCost.value;return m&&m.costUsd>0?m:null}),l=R(()=>t.usage.summary.value?.tokens??0),d=R(()=>t.usage.summary.value?.costUsd??0),u=R(()=>t.usage.summary.value?.recordCount??0),p=R(()=>Object.entries(t.usage.summary.value?.byModel??{}).map(([m,k])=>({label:m,value:Number(k.costUsd.toFixed(4))})).sort((m,k)=>k.value-m.value));function v(m){return m<36e5?`${Math.round(m/6e4)} 分钟`:m<864e5?`${Math.round(m/36e5)} 小时`:`${Math.round(m/864e5)} 天`}const b=R(()=>`准入窗口 · ${v(t.usage.limits.value.windowMs)} · 超限新请求 429`),_=R(()=>{const m=t.usage.limits.value.windowTokenLimit;return m>0?{limit:m,used:t.usage.quotaUsage.value?.tokens??0}:null}),g=R(()=>{const m=t.usage.limits.value.windowUsdLimit;return m>0?{limit:m,used:t.usage.quotaUsage.value?.costUsd??0}:null});return(m,k)=>(f(),h("div",ty,[c("div",ny,[B(r(Wo),{size:"sm","full-width":"","aria-label":"统计窗口",options:n,"model-value":a.value,"onUpdate:modelValue":s},null,8,["model-value"]),B(r(t1),{months:1,onChange:o})]),c("p",ay,[G(C(e.usage.isCustom.value?"自定义日期区间":"滚动窗口 · 截止此刻")+" ",1),u.value>0?(f(),h(j,{key:0},[G("· "+C(u.value)+" 轮",1)],64)):A("",!0)]),e.usage.loading.value&&!e.usage.summary.value?(f(),h("div",sy,[B(r(ct),{height:44,radius:"8px"}),B(r(ct),{height:44,radius:"8px"}),B(r(ct),{height:72,radius:"8px"})])):(f(),h(j,{key:1},[i.value?(f(),h("p",{key:0,class:"va-usage__session-cost",title:`近 30 天 · ${i.value.recordCount} 轮`}," 当前会话 · "+C(r(Oe)(i.value.tokens))+" tokens · $"+C(i.value.costUsd.toFixed(4)),9,oy)):A("",!0),c("div",iy,[c("div",ly,[k[0]||(k[0]=c("span",{class:"va-usage__kpi-label"},"Tokens",-1)),B(r(ds),{class:"va-usage__kpi-value",value:l.value,format:{notation:"compact",maximumFractionDigits:1}},null,8,["value"]),c("span",ry,C(r(Oe)(l.value)),1)]),c("div",uy,[k[1]||(k[1]=c("span",{class:"va-usage__kpi-label"},"Cost",-1)),B(r(ds),{class:"va-usage__kpi-value",value:d.value,format:{style:"currency",currency:"USD"}},null,8,["value"]),k[2]||(k[2]=c("span",{class:"va-usage__kpi-sub"},"USD · 计价表命中才记钱",-1))])]),_.value?(f(),h("div",cy,[B(r(As),{segments:[{label:"Tokens",used:_.value.used}],limit:_.value.limit,unit:"tokens",period:b.value},null,8,["segments","limit","period"])])):A("",!0),g.value?(f(),h("div",dy,[B(r(As),{segments:[{label:"Cost",used:g.value.used}],limit:g.value.limit,unit:"USD",period:b.value},null,8,["segments","limit","period"])])):A("",!0),!_.value&&!g.value?(f(),h("p",fy," 未设配额(设置 → 执行 → 成本配额:设窗口 Token/费用上限,达到后新请求 429 拒绝) ")):A("",!0),p.value.length>0?(f(),h("div",vy,[B(r(z1),{items:p.value,unit:"USD","bar-scale":"max","max-rows":5},null,8,["items"])])):(f(),h("div",py,[...k[3]||(k[3]=[c("p",null,"所选窗口内暂无用量记录",-1)])]))],64))]))}}),_y={},fn={"Content-Type":"application/json"};function my(){let e="";try{e=localStorage.getItem("vuagent_token")||""}catch{}return e||_y?.VITE_VUAGENT_TOKEN||""}function ot(){const e=my();return e?{Authorization:`Bearer ${e}`}:{}}async function Ge(e){const t=await fetch(e,{headers:ot()});return t.ok?await t.json():null}async function je(e,t,n){const a=await fetch(e,{method:t,headers:{...ot(),...n===void 0?{}:fn},body:n===void 0?void 0:JSON.stringify(n)});return a.ok?await a.json():null}function gy(){return Ge("/api/workspaces")}function ky(e){return je("/api/workspaces","POST",e)}function Fi(e){return Ge(`/api/workspaces/${e}/files`)}function by(e){return je(`/api/workspaces/${e}`,"DELETE")}function yy(){return je("/api/workspaces/pick-directory","POST")}function wy(){return Ge("/api/sessions")}function xy(e){return Ge(`/api/sessions/${e}`)}function $y(e){return je("/api/sessions","POST",e)}function Qt(e,t){return je(`/api/sessions/${e}`,"PATCH",t)}function Cy(e){return je(`/api/sessions/${e}`,"DELETE")}async function Ay(e){const t=await fetch(`/api/sessions/${e}/compact`,{method:"POST",headers:ot()}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error(n?.error||`压缩请求失败 [${t.status}] ${t.statusText}`);return n}function Dy(e,t){return je(`/api/settings/models/${e}`,"PATCH",t)}function Ry(e){return je(`/api/settings/models/${e}`,"DELETE")}function Ey(){return Ge("/api/settings/providers")}function Sy(e){return je("/api/settings/providers","POST",e)}function My(e,t){return je(`/api/settings/providers/${e}`,"PATCH",t)}async function Ty(e,t=!1){const n=await fetch(`/api/settings/providers/${e}${t?"?cascade=true":""}`,{method:"DELETE",headers:ot()});if(n.status===409){const a=await n.json().catch(()=>({}));return{success:!1,error:a.error,boundModels:a.boundModels,reason:a.reason}}return n.ok?await n.json():null}function Fy(e,t){return je(`/api/settings/providers/${e}/models`,"POST",t)}function Iy(e){return je(`/api/settings/models/${e}/verify-capabilities`,"POST",{})}function By(e){return Ge(`/api/settings/providers/${e}/models/discover`)}async function yo(e){const t=await fetch("/api/settings/models/test",{method:"POST",headers:{...ot(),...fn},body:JSON.stringify(e)});if(!t.ok)throw new Error(`探测请求失败 [${t.status}] ${t.statusText}`);return await t.json()}function Ii(){return Ge("/api/config")}function zy(e,t){return je(`/api/config/${encodeURIComponent(e)}`,"PATCH",t)}function Py(e){return je(`/api/config/${encodeURIComponent(e)}/reset`,"POST")}function Ly(){return Ge("/api/tools")}function Oy(e,t){return je(`/api/tools/${encodeURIComponent(e)}`,"PATCH",{enabled:t})}async function jy(){return Ge("/api/action/suspended")}async function Uy(e,t){return(await fetch(`/api/action/${e}`,{method:"POST",headers:{...ot(),...fn},body:JSON.stringify(t)})).ok}async function wo(e,t){const n=await fetch(`/api/action/${e}`,{method:"POST",headers:{...ot(),...fn},body:JSON.stringify(t)});if(n.status===422){const a=await n.json().catch(()=>null);if(a?.fieldErrors&&Object.keys(a.fieldErrors).length>0)return{ok:!1,status:422,fieldErrors:a.fieldErrors}}return{ok:n.ok,status:n.status}}async function Ny(e){try{await fetch(`/api/sessions/${e}/abort`,{method:"POST",headers:ot()})}catch{}}async function qy(e){const t=await fetch("/api/chat",{method:"POST",headers:{...ot(),...fn},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error(n?.error||`服务器返回错误 [${t.status}] ${t.statusText}`)}return t}async function Wy(e){const t=await fetch(`/api/sessions/${e}/stream`,{headers:ot()});if(!t.ok)throw new Error(`服务器返回错误 [${t.status}] ${t.statusText}`);return t}function ha(e={}){const t=new URLSearchParams;e.since&&e.until?(t.set("since",String(e.since)),t.set("until",String(e.until))):e.windowMs&&t.set("windowMs",String(e.windowMs));const n=t.toString()?`?${t.toString()}`:"";return Ge(`/api/finops/summary${n}`)}async function Vy(e=720*36e5){return Ge(`/api/finops/by-session?windowMs=${e}`)}async function Jy(){const t=(await Ii())?.namespaces.find(a=>a.id==="finops"),n=a=>typeof a=="number"&&Number.isFinite(a)&&a>0?a:0;return{windowTokenLimit:n(t?.values.windowTokenLimit),windowUsdLimit:n(t?.values.windowUsdLimit),windowMs:n(t?.values.windowMs)||864e5}}const Bi="vuagent:interaction-settings",Ky=1;function Ft(){return{autoCollapseThought:!0,autoCollapseToolCards:!0,showApprovals:!0,showFileTree:!0,showUsage:!0}}function Hy(e){const t=Ft();if(e===null||typeof e!="object")return t;const n=e,a={...t};for(const s of Object.keys(t)){const o=n[s];typeof o==typeof t[s]&&(a[s]=o)}return a}function Zy(e){if(!e)return Ft();try{const t=e.getItem(Bi);if(!t)return Ft();const n=JSON.parse(t);return n===null||typeof n!="object"?Ft():Hy(n.settings)}catch{return Ft()}}function Xy(e,t){if(t)try{const n={version:Ky,settings:{...e}};t.setItem(Bi,JSON.stringify(n))}catch{}}function Gy(){try{return typeof localStorage<"u"?localStorage:void 0}catch{return}}function Yy(e){const t=S(Zy(e));ve(t,s=>{Xy(s,e)},{deep:!0});function n(s,o){t.value={...t.value,[s]:o}}function a(){t.value=Ft()}return{settings:t,updateSetting:n,resetToDefaults:a}}let _a=null;function Nn(){return _a||(_a=Yy(Gy())),_a}const Qy={class:"va-console__right-sidebar"},e2={class:"va-console__rtabs"},t2=["aria-selected","onClick"],n2={key:0,class:"va-console__rtab-badge"},a2={class:"va-console__rtab-body"},s2={key:1,class:"va-console__rtab-empty"},o2={key:0,class:"va-console__rtab-empty"},i2={key:1,class:"va-rsb__skeleton","aria-label":"加载目录"},l2={key:2,class:"va-console__rtab-empty"},r2={key:0,class:"va-rsb__truncate-note"},u2={key:3,class:"va-console__rtab-empty"},c2=ce({__name:"ConsoleRightSidebar",props:{decisions:{},workspaceId:{},usage:{}},emits:["collapse","decide"],setup(e,{emit:t}){const n=e,a=t,{settings:s}=Nn(),o=R(()=>{const b=[];return s.value.showApprovals&&b.push({key:"approvals",label:"审批"}),s.value.showFileTree&&b.push({key:"files",label:"文件"}),s.value.showUsage&&b.push({key:"usage",label:"用量"}),b}),i=S("approvals");ve(o,b=>{b.some(_=>_.key===i.value)||(i.value=b[0]?.key??"approvals")});const l=S([]),d=S(!1),u=S(!1),p=S("");async function v(b){if(l.value=[],u.value=!1,p.value="",!b)return;d.value=!0;const _=await Fi(b);if(d.value=!1,!_){p.value="目录读取失败";return}l.value=_.tree,u.value=_.truncated}return ve(()=>n.workspaceId,b=>v(b),{immediate:!0}),(b,_)=>(f(),h("aside",Qy,[c("div",e2,[(f(!0),h(j,null,Q(o.value,g=>(f(),h("button",{key:g.key,class:ue(["va-console__rtab",{"va-console__rtab--active":i.value===g.key}]),type:"button","aria-selected":i.value===g.key,onClick:m=>i.value=g.key},[G(C(g.label)+" ",1),g.key==="approvals"&&e.decisions.length>0?(f(),h("span",n2,C(e.decisions.length),1)):A("",!0)],10,t2))),128)),B(r(Xo),{content:"收起侧栏",placement:"bottom"},{default:oe(()=>[c("button",{class:"va-console__rtab-collapse",type:"button","aria-label":"收起侧栏",onClick:_[0]||(_[0]=g=>a("collapse"))},[B(r(Sn),{size:14})])]),_:1})]),c("div",a2,[i.value==="approvals"?(f(),h(j,{key:0},[e.decisions.length>0?(f(),H(r(Br),{key:0,decisions:e.decisions,onDecide:_[1]||(_[1]=(g,m)=>a("decide",g,m))},null,8,["decisions"])):(f(),h("div",s2,[B(r(Sn),{size:20}),_[2]||(_[2]=c("p",null,"暂无待审批事项",-1))]))],64)):i.value==="files"?(f(),h(j,{key:1},[e.workspaceId?d.value?(f(),h("div",i2,[B(r(ct),{height:14,radius:"4px"}),B(r(ct),{height:14,radius:"4px",width:"86%"}),B(r(ct),{height:14,radius:"4px",width:"72%"}),B(r(ct),{height:14,radius:"4px",width:"80%"})])):p.value?(f(),h("div",l2,[c("p",null,C(p.value),1)])):(f(),h(j,{key:3},[u.value?(f(),h("p",r2,"目录过大,仅展示前 2000 项")):A("",!0),B(r(Ca),{tree:l.value,"default-expand-depth":1,"aria-label":"当前工作区文件目录"},null,8,["tree"])],64)):(f(),h("div",o2,[..._[3]||(_[3]=[c("p",null,"先选择或创建工作区",-1)])]))],64)):i.value==="usage"?(f(),H(hy,{key:2,usage:e.usage},null,8,["usage"])):A("",!0),o.value.length===0?(f(),h("div",u2,[B(r(Sn),{size:20}),_[4]||(_[4]=c("p",null,"侧栏内容已在「设置 → 交互」中全部隐藏",-1))])):A("",!0)])]))}}),d2={class:"va-console__docked-plan"},f2={class:"va-console__plan-bar-left"},v2={class:"va-console__plan-title"},p2={key:0,class:"va-console__plan-active-chip"},h2={class:"va-console__plan-bar-right"},_2={class:"va-console__plan-toggle-label"},m2={key:0,class:"va-console__plan-drawer"},g2={class:"va-console__plan-drawer-clip"},k2=ce({__name:"DockedPlanBar",props:{steps:{},completed:{},running:{},expanded:{type:Boolean}},emits:["toggle"],setup(e){return(t,n)=>(f(),h("div",d2,[c("div",{class:"va-console__plan-bar",onClick:n[0]||(n[0]=a=>t.$emit("toggle"))},[c("div",f2,[B(r(Pb),{size:15,class:"va-console__plan-icon"}),c("span",v2," 任务执行计划 ("+C(e.completed)+"/"+C(e.steps.length)+" 完成) ",1),e.running?(f(),h("span",p2,[B(r(Xt),{size:11,class:"va-console__spin"}),G(" 正在执行: "+C(e.running.title),1)])):A("",!0)]),c("div",h2,[c("span",_2,C(e.expanded?"折叠":"展开详情"),1),e.expanded?(f(),H(r(cn),{key:0,size:14})):(f(),H(r(Mi),{key:1,size:14}))])]),B(Ct,{name:"va-drawer-fold"},{default:oe(()=>[e.expanded?(f(),h("div",m2,[c("div",g2,[B(r(Gu),{steps:e.steps},null,8,["steps"])])])):A("",!0)]),_:1})]))}}),b2={BASE_URL:"/",DEV:!1,MODE:"console",PROD:!0,SSR:!1},Ve=vt({open:!1,title:"",description:"",placeholder:"",value:"",confirmText:"确认",cancelText:"取消"});let en=null,Ta=0,xo=!1;function y2(){try{return b2?.DEV??!0}catch{return!0}}function w2(){return Ta+=1,()=>{Ta-=1}}function x2(){return Ve}function $2(e){return Ta===0?(y2()&&!xo&&(xo=!0,console.warn("[askText] 未找到已挂载的 <TextPromptHost />:askText() 将直接 resolve(null)。请在应用根节点挂载宿主组件。")),Promise.resolve(null)):(Ve.title=e.title,Ve.description=e.description??"",Ve.placeholder=e.placeholder??"",Ve.value=e.initialValue??"",Ve.confirmText=e.confirmText??"确认",Ve.cancelText=e.cancelText??"取消",Ve.open=!0,en&&en(null),new Promise(t=>{en=t}))}function $o(){if(!Ve.open)return;const e=Ve.value.trim();zi(e||null)}function Co(){Ve.open&&zi(null)}function zi(e){Ve.open=!1;const t=en;en=null,t?.(e)}const C2=["placeholder","aria-label","onKeydown"],A2=ce({__name:"TextPromptHost",setup(e){const t=x2();let n=null;Le(()=>{n=w2()}),Oo(()=>n?.());const a=S(null);ve(()=>t.open,async o=>{o&&(await Se(),a.value?.focus(),a.value?.select())});function s(o){o.isComposing||o.keyCode===229||$o()}return(o,i)=>(f(),H(r(La),{open:r(t).open,size:"sm",title:r(t).title,description:r(t).description||void 0,"onUpdate:open":i[1]||(i[1]=l=>{l||r(Co)()})},{footer:oe(()=>[B(r(Bt),{variant:"secondary",size:"sm",onClick:r(Co)},{default:oe(()=>[G(C(r(t).cancelText),1)]),_:1},8,["onClick"]),B(r(Bt),{variant:"primary",size:"sm",onClick:r($o)},{default:oe(()=>[G(C(r(t).confirmText),1)]),_:1},8,["onClick"])]),default:oe(()=>[ye(c("input",{ref_key:"inputRef",ref:a,"onUpdate:modelValue":i[0]||(i[0]=l=>r(t).value=l),class:"va-console__input",type:"text",placeholder:r(t).placeholder,"aria-label":r(t).title,onKeydown:ze(_e(s,["prevent"]),["enter"])},null,40,C2),[[Ee,r(t).value]])]),_:1},8,["open","title","description"]))}}),D2=[{id:"models",title:"模型与 API",description:"供应商、模型与 API Key 配置"},{id:"interaction",title:"交互",description:"自动折叠等交互偏好"},{id:"tools",title:"工具",description:"内置工具的启用与停用"},{id:"execution",title:"执行",description:"步数上限、审批超时、上下文预算与成本配额"},{id:"security",title:"安全",description:"默认权限模式与网络边界"},{id:"prompt",title:"提示词",description:"系统提示组装块与全局自定义指令"}],R2=[{key:"autoCollapseThought",title:"自动折叠思考过程",description:"本轮输出结束后折叠思考过程;与下一项同时开启时收进「已完成」摘要条,点击可展开"},{key:"autoCollapseToolCards",title:"自动折叠工具执行卡片",description:"本轮输出结束后折叠工具调用;与上一项同时开启时收进「已完成」摘要条,只留文本结果;失败卡片始终展开"},{key:"showApprovals",title:"右侧边栏显示审批收件箱",description:"跨会话的人机协同 (HITL) 待审批决策;关闭后右侧边栏不再展示该分区"},{key:"showFileTree",title:"右侧边栏显示工作区文件树",description:"当前工作区的目录结构(只读预览,深度 4 层);关闭后右侧边栏不再展示该分区"},{key:"showUsage",title:"右侧边栏显示成本用量面板",description:"滚动窗口/自定义区间的 token 与费用、按模型分解与配额水位(TASK-075);关闭后右侧边栏不再展示该分区"}],Ao={high:{label:"高风险",className:"va-settings__tool-badge--high"},medium:{label:"中风险",className:"va-settings__tool-badge--medium"},low:{label:"低风险",className:"va-settings__tool-badge--low"}};function It(e){return Ao[e]??Ao.medium}const E2={class:"va-settings__title"},S2={class:"va-settings__dlg-body"},M2={class:"va-settings__nav","aria-label":"设置导航"},T2=["aria-current","onClick"],F2={class:"va-settings__nav-text"},I2={class:"va-settings__nav-title"},B2={class:"va-settings__nav-desc"},z2={class:"va-settings__panel-area"},P2=ce({__name:"SettingsModal",props:{open:{type:Boolean},activeTab:{default:"models"}},emits:["close","update:activeTab"],setup(e,{emit:t}){const n=e,a=t,s={models:Sb,interaction:jb,tools:Pn,execution:Ib,security:Wb,prompt:Ob};function o(i){i||a("close")}return(i,l)=>(f(),H(r(La),{open:n.open,size:"lg","aria-label":"设置",description:"管理模型供应商与交互偏好,后续可持续增加设置页","onUpdate:open":o},{title:oe(()=>[c("span",E2,[B(r(Ti),{size:16,"aria-hidden":"true"}),l[0]||(l[0]=G(" 设置 ",-1))])]),default:oe(()=>[c("div",S2,[c("nav",M2,[(f(!0),h(j,null,Q(r(D2),d=>(f(),h("button",{key:d.id,class:ue(["va-settings__nav-item",{"va-settings__nav-item--active":d.id===e.activeTab}]),type:"button","aria-current":d.id===e.activeTab?"true":void 0,onClick:u=>i.$emit("update:activeTab",d.id)},[(f(),H(Ba(s[d.id]),{size:15,class:"va-settings__nav-icon"})),c("span",F2,[c("span",I2,C(d.title),1),c("span",B2,C(d.description),1)])],10,T2))),128))]),c("div",z2,[xe(i.$slots,e.activeTab)])])]),_:3},8,["open"]))}}),L2={text:"文本",image:"图片",audio:"音频",video:"视频",pdf:"PDF"};function O2(e){return e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function j2(e,t={}){if(!e)return[];const n="capabilities"in e||"contextWindow"in e?e.capabilities??{}:e,a="contextWindow"in e&&typeof e.contextWindow=="number"?e.contextWindow:void 0,s=[],o=n.contextWindow||a;o&&s.push(O2(o));for(const i of n.inputModalities||[])i==="text"&&!t.includeText||s.push(L2[i]??i);return n.reasoning?.supported&&s.push("推理"),n.supportedParameters?.includes("tools")&&s.push("工具"),s}const An=[{id:"deepseek-v3",label:"DeepSeek V3",meta:"deepseek-chat",provider:"DeepSeek",model:"deepseek-chat"},{id:"qwen-2.5-72b",label:"Qwen 2.5 72B",meta:"qwen-2.5-72b",provider:"通义千问",model:"qwen-2.5-72b-instruct"},{id:"claude-3-7-sonnet",label:"Claude 3.7 Sonnet",meta:"claude-3-7-sonnet",provider:"Anthropic",model:"claude-3-7-sonnet-20250219"},{id:"ollama-local",label:"Ollama (Local)",meta:"llama3:8b",provider:"Ollama 本地",model:"llama3:8b"}],U2=[{id:"review",label:"严格审批 (Review)",desc:"写文件、命令执行等需人工确认"},{id:"auto",label:"自动执行 (Auto)",desc:"工具沙箱全自动运行"},{id:"readonly",label:"只读沙箱 (Read-Only)",desc:"禁止一切写入与执行操作"}],Do={deepseek:{name:"DeepSeek V3",model:"deepseek-chat",baseUrl:"https://api.deepseek.com/v1",contextWindow:128e3},anthropic:{name:"Claude 3.7 Sonnet",model:"claude-3-7-sonnet-20250219",baseUrl:"https://api.anthropic.com/v1",contextWindow:2e5},openai:{name:"OpenAI GPT-4o",model:"gpt-4o",baseUrl:"https://api.openai.com/v1",contextWindow:128e3},ollama:{name:"Ollama 本地模型",model:"qwen2.5-coder:7b",baseUrl:"http://localhost:11434/v1",contextWindow:32e3},custom:{name:"兼容模型 (Custom)",model:"custom-model",baseUrl:"http://localhost:8000/v1",contextWindow:32e3},qwen:{name:"Qwen 通义千问",model:"qwen-max",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode/v1",contextWindow:128e3}},N2=[{value:"deepseek",label:"DeepSeek (官方 API)"},{value:"qwen",label:"Qwen / 阿里云通义千问"},{value:"anthropic",label:"Anthropic (Claude)"},{value:"openai",label:"OpenAI (GPT-4o/o3)"},{value:"ollama",label:"Ollama (本地运行)"},{value:"custom",label:"Custom (OpenAI 兼容接口)"}],q2={id:"",name:"",provider:"deepseek",model:"deepseek-chat",baseUrl:"https://api.deepseek.com/v1",apiKey:"",contextWindow:128e3,temperature:.2,isDefault:!1},W2={class:"va-settings__panel va-settings__panel--models"},V2={class:"va-console__modal-body"},J2={class:"va-console__modal-left"},K2={class:"va-console__modal-list-head"},H2={class:"va-console__modal-profile-list"},Z2={key:0,class:"va-console__profile-card va-console__profile-card--active"},X2={class:"va-console__profile-card-top"},G2={class:"va-console__profile-name"},Y2={class:"va-console__profile-card-sub"},Q2={class:"va-console__provider-pill"},ew=["onClick"],tw={class:"va-console__profile-card-top"},nw={class:"va-console__profile-name"},aw={key:0,class:"va-prov-count-chip"},sw={class:"va-console__profile-card-sub"},ow={class:"va-console__provider-pill"},iw={key:0,class:"va-console__model-id"},lw={key:1,class:"va-console__empty-tip"},rw={class:"va-console__modal-right"},uw={class:"va-console__form-row"},cw={class:"va-console__form-group flex-1"},dw={class:"va-console__form-group flex-1"},fw={class:"va-console__form-group"},vw={class:"va-console__label"},pw={class:"va-console__form-group"},hw={class:"va-console__label"},_w={key:0,class:"va-console__profile-card-sub",style:{"margin-left":"6px"}},mw={class:"va-console__input-with-action"},gw=["type","placeholder"],kw={class:"va-prov-actions"},bw={class:"va-model-section"},yw={class:"va-model-section__head"},ww={class:"va-model-section__title"},xw={class:"va-model-section__count"},$w=["disabled"],Cw={key:0,class:"va-model-list"},Aw=["onClick"],Dw={class:"va-model-row__info"},Rw={class:"va-model-row__name"},Ew={key:0,class:"va-console__default-chip"},Sw={class:"va-model-row__id"},Mw={class:"va-model-row__badges"},Tw=["title","disabled","onClick"],Fw={class:"va-model-row__edit",type:"button"},Iw=["onClick"],Bw={key:1,class:"va-console__empty-tip"},zw={key:2,class:"va-model-editor"},Pw={class:"va-model-editor__head"},Lw={class:"va-model-editor__title"},Ow={class:"va-console__form-row"},jw={class:"va-console__form-group flex-1"},Uw={class:"va-console__form-group flex-1"},Nw={class:"va-console__input-with-action"},qw=["disabled"],Ww={id:"va-discovered-models"},Vw=["value"],Jw={class:"va-cap-block"},Kw={class:"va-cap-block__title"},Hw=["disabled"],Zw={key:0,class:"va-cap-verdicts"},Xw=["data-ok","data-fail","title"],Gw={class:"va-cap-verdict__mark"},Yw={class:"va-cap-verdict__name"},Qw={class:"va-cap-verdict__detail"},ex={class:"va-console__form-row"},tx={class:"va-console__form-group flex-1"},nx={class:"va-console__form-group flex-1"},ax={class:"va-console__form-group"},sx={class:"va-cap-chips"},ox=["onClick"],ix={class:"va-cap-toggles"},lx={class:"va-console__form-row"},rx={class:"va-console__form-group flex-1"},ux={class:"va-console__label"},cx={class:"va-console__form-group flex-1"},dx={class:"va-console__checkbox-row",style:{"margin-top":"22px"}},fx={class:"va-console__checkbox-label"},vx={class:"va-model-editor__foot"},px={class:"va-console__modal-foot"},hx={class:"va-console__foot-left"},_x={class:"va-console__foot-right"},mx=["disabled","title"],gx=ce({__name:"ModelProfilesPanel",props:{providers:{},selectedProviderId:{},isCreatingProvider:{type:Boolean},currentProvider:{},currentProviderModels:{},providerForm:{},modelDraft:{},isCreatingModel:{type:Boolean},showApiKey:{type:Boolean},isTestingConnection:{type:Boolean},testingProfileId:{},isDiscovering:{type:Boolean},testStatus:{},discoveredModels:{},discoveredItems:{},isVerifyingCapabilities:{type:Boolean},capabilityVerdicts:{}},emits:["close","select-provider","create-provider","delete-provider","create-model","edit-model","delete-model","cancel-model-edit","save-provider","save-model","test","discover","select-model","test-model","provider-kind-change","update:showApiKey","toggle-modality","toggle-reasoning","toggle-tool-use","verify-capabilities"],setup(e,{emit:t}){const n=e,a=t,s=S(!1),o=S(null);function i(){s.value=!s.value,o.value=s.value}const l=R(()=>n.discoveredItems.map(g=>({value:g.id,label:g.displayName?`${g.displayName} · ${g.id}`:g.id})));ve(()=>[n.discoveredModels.length,n.isDiscovering],([g,m])=>{m||(g===0?s.value=!0:o.value!==!0&&(s.value=!1))});const d=[{id:"image",label:"图片",icon:po},{id:"pdf",label:"PDF",icon:null},{id:"audio",label:"音频",icon:null},{id:"video",label:"视频",icon:null}];function u(g){return j2({capabilities:g.capabilities,contextWindow:g.contextWindow})}function p(g){return(n.modelDraft?.capabilities?.inputModalities||["text"]).includes(g)}function v(){return!!n.modelDraft?.capabilities?.reasoning?.supported}function b(){return!!n.modelDraft?.capabilities?.supportedParameters?.includes("tools")}const _=R(()=>n.modelDraft?.id||"");return(g,m)=>(f(),h("div",W2,[c("div",V2,[c("div",J2,[c("div",K2,[c("span",null,"供应商 ("+C(e.providers.length)+")",1),c("button",{class:"va-console__btn-add-profile",type:"button",onClick:m[0]||(m[0]=k=>a("create-provider"))},[B(r(_o),{size:13}),m[25]||(m[25]=G(" 添加 ",-1))])]),c("div",H2,[e.isCreatingProvider?(f(),h("div",Z2,[c("div",X2,[c("span",G2,C(e.providerForm.name||"新供应商"),1),m[26]||(m[26]=c("span",{class:"va-console__new-chip"},"新建中",-1))]),c("div",Y2,[c("span",Q2,C(e.providerForm.provider),1)])])):A("",!0),(f(!0),h(j,null,Q(e.providers,k=>(f(),h("div",{key:k.id,class:ue(["va-console__profile-card",{"va-console__profile-card--active":k.id===e.selectedProviderId&&!e.isCreatingProvider}]),onClick:w=>a("select-provider",k.id)},[c("div",tw,[c("span",nw,C(k.name),1),(k.models||[]).length?(f(),h("span",aw,C((k.models||[]).length),1)):A("",!0)]),c("div",sw,[c("span",ow,C(k.provider),1),k.maskedApiKey?(f(),h("span",iw,C(k.maskedApiKey),1)):A("",!0)])],10,ew))),128)),e.providers.length===0&&!e.isCreatingProvider?(f(),h("p",lw," 还没有供应商,先添加一个端点与密钥。 ")):A("",!0)])]),c("div",rw,[m[45]||(m[45]=c("div",{class:"va-settings__panel-heading"},[c("p",{class:"va-console__modal-sub"}," 端点与密钥在此配置一次,其下所有模型共用;修改后立即对全部模型生效。 ")],-1)),c("div",uw,[c("div",cw,[m[27]||(m[27]=c("label",{class:"va-console__label"},"供应商名称",-1)),ye(c("input",{"onUpdate:modelValue":m[1]||(m[1]=k=>e.providerForm.name=k),class:"va-console__input",type:"text",placeholder:"如 DeepSeek 官方"},null,512),[[Ee,e.providerForm.name]])]),c("div",dw,[m[28]||(m[28]=c("label",{class:"va-console__label"},"类型",-1)),B(r(Tn),{"model-value":e.providerForm.provider,options:r(N2),label:"供应商类型","onUpdate:modelValue":m[2]||(m[2]=k=>a("provider-kind-change",Array.isArray(k)?String(k[0]??""):String(k)))},null,8,["model-value","options"])])]),c("div",fw,[c("label",vw,[B(r(Bb),{size:12}),m[29]||(m[29]=G(" API 基础地址",-1))]),ye(c("input",{"onUpdate:modelValue":m[3]||(m[3]=k=>e.providerForm.baseUrl=k),class:"va-console__input font-mono",type:"text",placeholder:"如 https://api.deepseek.com/v1"},null,512),[[Ee,e.providerForm.baseUrl]])]),c("div",pw,[c("label",hw,[B(r(zb),{size:12}),m[30]||(m[30]=G(" API 密钥 ",-1)),e.providerForm.maskedApiKey?(f(),h("span",_w," 已配置 "+C(e.providerForm.maskedApiKey),1)):A("",!0)]),c("div",mw,[ye(c("input",{"onUpdate:modelValue":m[4]||(m[4]=k=>e.providerForm.apiKey=k),class:"va-console__input font-mono",type:e.showApiKey?"text":"password",placeholder:e.providerForm.maskedApiKey?"留空保持原密钥":"sk-..."},null,8,gw),[[Lo,e.providerForm.apiKey]]),c("button",{class:"va-console__input-addon-btn",type:"button",onClick:m[5]||(m[5]=k=>a("update:showApiKey",!e.showApiKey))},[e.showApiKey?(f(),H(r(Tb),{key:0,size:14})):(f(),H(r(Fb),{key:1,size:14}))])])]),c("div",kw,[c("button",{class:"va-console__btn-ghost",type:"button",onClick:m[6]||(m[6]=k=>a("save-provider"))},C(e.isCreatingProvider?"创建供应商":"保存供应商设置"),1)]),c("div",bw,[c("div",yw,[c("span",ww,[m[31]||(m[31]=G(" 此供应商下的模型 ",-1)),c("span",xw,C(e.currentProviderModels.length),1)]),c("button",{class:"va-console__btn-add-profile",type:"button",disabled:!e.currentProvider,onClick:m[7]||(m[7]=k=>a("create-model"))},[B(r(_o),{size:12}),m[32]||(m[32]=G(" 添加模型 ",-1))],8,$w)]),e.currentProviderModels.length?(f(),h("div",Cw,[(f(!0),h(j,null,Q(e.currentProviderModels,k=>(f(),h("div",{key:k.id,class:ue(["va-model-row",{"va-model-row--editing":k.id===_.value}])},[c("div",{class:"va-model-row__main",onClick:w=>a("edit-model",k)},[c("div",Dw,[c("span",Rw,[G(C(k.name)+" ",1),k.isDefault?(f(),h("span",Ew,"默认")):A("",!0)]),c("span",Sw,C(k.model),1)]),c("div",Mw,[(f(!0),h(j,null,Q(u(k),w=>(f(),h("span",{key:w,class:"va-prov-badge"},C(w),1))),128))]),c("button",{class:"va-model-row__edit",type:"button",title:e.testingProfileId===k.id?"探测中…":e.testingProfileId?"另有模型探测进行中":"不进编辑直接测试该模型连通性",disabled:!!e.testingProfileId,onClick:_e(w=>a("test-model",k),["stop"])},[e.testingProfileId===k.id?(f(),H(r(Xt),{key:0,size:13,class:"va-console__spin"})):(f(),H(r(go),{key:1,size:13}))],8,Tw),c("button",Fw,[k.id===_.value?(f(),H(r(Mi),{key:0,size:13})):(f(),H(r(cn),{key:1,size:13}))]),c("button",{class:"va-model-row__del",type:"button",title:"删除该模型",onClick:_e(w=>a("delete-model",k.id),["stop"])},[B(r(mo),{size:12})],8,Iw)],8,Aw)],2))),128))])):e.modelDraft?A("",!0):(f(),h("p",Bw," 该供应商下还没有模型。点「添加模型」即可复用上面的端点与密钥。 ")),e.modelDraft?(f(),h("div",zw,[c("div",Pw,[c("span",Lw,C(e.isCreatingModel?"添加模型":`编辑「${e.modelDraft.name||"未命名"}」`),1),c("button",{class:"va-model-editor__cancel",type:"button",onClick:m[8]||(m[8]=k=>a("cancel-model-edit"))}," 收起 ")]),c("div",Ow,[c("div",jw,[m[33]||(m[33]=c("label",{class:"va-console__label"},"显示名称",-1)),ye(c("input",{"onUpdate:modelValue":m[9]||(m[9]=k=>e.modelDraft.name=k),class:"va-console__input",type:"text",placeholder:"如 DeepSeek V3 生产"},null,512),[[Ee,e.modelDraft.name]])]),c("div",Uw,[m[34]||(m[34]=c("label",{class:"va-console__label"},"模型标识 (Model ID)",-1)),c("div",Nw,[s.value?ye((f(),h("input",{key:1,"onUpdate:modelValue":m[11]||(m[11]=k=>e.modelDraft.model=k),class:"va-console__input font-mono",type:"text",placeholder:"如 deepseek-chat",list:"va-discovered-models"},null,512)),[[Ee,e.modelDraft.model]]):(f(),H(r(Tn),{key:0,class:"va-console__model-select","model-value":e.modelDraft.model||"",options:l.value,searchable:"",disabled:e.isDiscovering,placeholder:e.isDiscovering?"正在拉取模型列表…":l.value.length?"选择模型标识(可搜索)":"暂无候选:刷新或手动输入",label:"模型标识",invalid:!e.modelDraft.model?.trim(),"onUpdate:modelValue":m[10]||(m[10]=k=>k&&a("select-model",String(k)))},null,8,["model-value","options","disabled","placeholder","invalid"])),c("button",{class:"va-console__input-addon-btn",type:"button",disabled:e.isDiscovering,title:"从供应商拉取可用模型列表",onClick:m[12]||(m[12]=k=>a("discover"))},[e.isDiscovering?(f(),H(r(Xt),{key:0,size:14,class:"va-console__spin"})):(f(),H(r(Wl),{key:1,size:14}))],8,qw)]),c("button",{type:"button",class:"va-console__model-manual-toggle",onClick:i},C(s.value?"改为列表选择":"列表里没有?手动输入标识"),1),c("datalist",Ww,[(f(!0),h(j,null,Q(e.discoveredModels,k=>(f(),h("option",{key:k,value:k},null,8,Vw))),128))])])]),c("div",Jw,[c("div",Kw,[B(r(Ma),{size:12}),m[36]||(m[36]=G(" 能力标记 ",-1)),m[37]||(m[37]=c("span",{class:"va-cap-block__hint"},"决定附件入口、上下文仪表等行为",-1)),e.modelDraft.id?(f(),h("button",{key:0,class:"va-console__btn-ghost va-cap-block__verify",type:"button",disabled:e.isVerifyingCapabilities,title:"按勾选能力逐项实测端点行为(产生少量真实 API 费用)",onClick:m[13]||(m[13]=k=>a("verify-capabilities"))},[e.isVerifyingCapabilities?(f(),H(r(Xt),{key:0,size:12,class:"va-console__spin"})):(f(),H(r(fo),{key:1,size:12})),m[35]||(m[35]=G(" 验证能力 ",-1))],8,Hw)):A("",!0)]),e.capabilityVerdicts.length?(f(),h("ul",Zw,[(f(!0),h(j,null,Q(e.capabilityVerdicts,k=>(f(),h("li",{key:k.capability,class:"va-cap-verdict","data-ok":k.ok===!0||void 0,"data-fail":k.ok===!1||void 0,title:k.detail},[c("span",Gw,C(k.ok===!0?"✓":k.ok===!1?"✗":"?"),1),c("span",Yw,C(k.capability==="image"?"图片输入":k.capability==="reasoning"?"推理档位":k.capability),1),c("span",Qw,C(k.ok===!1?"端点拒绝,建议取消勾选":k.ok===null?"无法判定(鉴权/网络)":"通过"),1)],8,Xw))),128))])):A("",!0),c("div",ex,[c("div",tx,[m[38]||(m[38]=c("label",{class:"va-console__label"},"上下文窗口 (tokens)",-1)),ye(c("input",{"onUpdate:modelValue":m[14]||(m[14]=k=>e.modelDraft.contextWindow=k),class:"va-console__input font-mono",type:"number",step:"1000",placeholder:"128000"},null,512),[[Ee,e.modelDraft.contextWindow,void 0,{number:!0}]])]),c("div",nx,[m[39]||(m[39]=c("label",{class:"va-console__label"},"最大输出 (tokens)",-1)),ye(c("input",{"onUpdate:modelValue":m[15]||(m[15]=k=>e.modelDraft.capabilities.maxOutputTokens=k),class:"va-console__input font-mono",type:"number",step:"1000",placeholder:"可选"},null,512),[[Ee,e.modelDraft.capabilities.maxOutputTokens,void 0,{number:!0}]])])]),c("div",ax,[m[41]||(m[41]=c("label",{class:"va-console__label"},"输入模态",-1)),c("div",sx,[m[40]||(m[40]=c("span",{class:"va-cap-chip va-cap-chip--locked"},"文本",-1)),(f(),h(j,null,Q(d,k=>c("button",{key:k.id,class:ue(["va-cap-chip",{"va-cap-chip--on":p(k.id)}]),type:"button",onClick:w=>a("toggle-modality",k.id)},[k.id==="image"?(f(),H(r(po),{key:0,size:11})):A("",!0),G(" "+C(k.label),1)],10,ox)),64))])]),c("div",ix,[c("button",{class:ue(["va-cap-toggle",{"va-cap-toggle--on":v()}]),type:"button",onClick:m[16]||(m[16]=k=>a("toggle-reasoning"))},[B(r(Ma),{size:12}),m[42]||(m[42]=c("span",null,"支持推理",-1)),v()?(f(),H(r(ka),{key:0,size:12,class:"va-cap-toggle__check"})):A("",!0)],2),c("button",{class:ue(["va-cap-toggle",{"va-cap-toggle--on":b()}]),type:"button",onClick:m[17]||(m[17]=k=>a("toggle-tool-use"))},[B(r(Pn),{size:12}),m[43]||(m[43]=c("span",null,"支持工具调用",-1)),b()?(f(),H(r(ka),{key:0,size:12,class:"va-cap-toggle__check"})):A("",!0)],2)])]),c("div",lx,[c("div",rx,[c("label",ux,[B(r(Vb),{size:12}),G(" 默认温度 ("+C(e.modelDraft.temperature)+") ",1)]),ye(c("input",{"onUpdate:modelValue":m[18]||(m[18]=k=>e.modelDraft.temperature=k),class:"va-console__range",type:"range",min:"0",max:"1",step:"0.05"},null,512),[[Ee,e.modelDraft.temperature,void 0,{number:!0}]])]),c("div",cx,[c("div",dx,[c("label",fx,[ye(c("input",{"onUpdate:modelValue":m[19]||(m[19]=k=>e.modelDraft.isDefault=k),type:"checkbox"},null,512),[[Po,e.modelDraft.isDefault]]),m[44]||(m[44]=c("span",null,"设为全局默认模型",-1))])])])]),c("div",vx,[c("button",{class:"va-console__btn-ghost",type:"button",onClick:m[20]||(m[20]=k=>a("cancel-model-edit"))}," 取消 "),c("button",{class:"va-console__btn-primary",type:"button",onClick:m[21]||(m[21]=k=>a("save-model"))},C(e.isCreatingModel?"添加":"保存"),1)])])):A("",!0)]),e.testStatus?(f(),h("div",{key:0,class:ue(["va-console__test-status-box",{"va-console__test-status-box--ok":e.testStatus.ok,"va-console__test-status-box--err":!e.testStatus.ok}])},[e.testStatus.ok?(f(),H(r(fo),{key:0,size:14})):(f(),H(r(Eb),{key:1,size:14})),c("span",null,C(e.testStatus.message),1)],2)):A("",!0)])]),c("div",px,[c("div",hx,[!e.isCreatingProvider&&e.currentProvider?(f(),h("button",{key:0,class:"va-console__btn-delete-profile",type:"button",onClick:m[22]||(m[22]=k=>a("delete-provider",e.currentProvider.id))},[B(r(mo),{size:13}),m[46]||(m[46]=G(" 删除供应商 ",-1))])):A("",!0)]),c("div",_x,[c("button",{class:"va-console__btn-ghost",disabled:e.isTestingConnection||!e.modelDraft?.model?.trim(),title:e.modelDraft?.model?.trim()?"向该模型发起最小探测(产生 1 token 费用)":"先选择或填写模型标识再测试",type:"button",onClick:m[23]||(m[23]=k=>a("test"))},[e.isTestingConnection?(f(),H(r(Xt),{key:0,size:13,class:"va-console__spin"})):(f(),H(r(go),{key:1,size:13})),m[47]||(m[47]=c("span",null,"测试连通性",-1))],8,mx),c("button",{class:"va-console__btn-ghost",type:"button",onClick:m[24]||(m[24]=k=>a("close"))},"关闭")])])]))}}),kx={class:"va-settings__panel va-settings__panel--interaction"},bx={class:"va-settings__section"},yx={class:"va-settings__toggle-list"},wx={class:"va-settings__toggle-text"},xx={class:"va-settings__toggle-title"},$x={class:"va-settings__toggle-desc"},Cx=["aria-checked","aria-label","onClick"],Ax=ce({__name:"InteractionPanel",setup(e){const{settings:t,updateSetting:n}=Nn();function a(s){n(s,!t.value[s])}return(s,o)=>(f(),h("div",kx,[c("div",bx,[o[1]||(o[1]=c("div",null,[c("div",{class:"va-settings__section-title"},"会话交互与侧栏内容"),c("p",{class:"va-console__modal-sub",style:{"margin-top":"2px"}}," 对话折叠行为与右侧边栏的内容显隐,修改即时生效并本地记忆 ")],-1)),c("div",yx,[(f(!0),h(j,null,Q(r(R2),i=>(f(),h("div",{key:i.key,class:"va-settings__toggle-row"},[c("div",wx,[c("span",xx,C(i.title),1),c("span",$x,C(i.description),1)]),c("button",{class:ue(["va-settings__switch",{"va-settings__switch--on":r(t)[i.key]}]),type:"button",role:"switch","aria-checked":r(t)[i.key],"aria-label":i.title,onClick:l=>a(i.key)},[...o[0]||(o[0]=[c("span",{class:"va-settings__switch-knob"},null,-1)])],10,Cx)]))),128))])])]))}}),Dx={class:"va-settings__panel va-settings__panel--tools"},Rx={key:0,class:"va-settings__tools-error"},Ex={key:1,class:"va-settings__tools-loading"},Sx={key:2,class:"va-settings__tools-loading"},Mx={key:3,class:"va-settings__section"},Tx={class:"va-settings__tool-filter-tabs"},Fx={key:0,class:"va-settings__group-block"},Ix={class:"va-settings__section-title"},Bx={class:"va-settings__toggle-list",style:{"margin-top":"8px"}},zx={class:"va-settings__toggle-text"},Px={class:"va-settings__tool-headline"},Lx={class:"va-settings__toggle-title"},Ox={key:0,class:"va-settings__tool-write"},jx=["title"],Ux=["aria-checked","aria-label","onClick"],Nx={key:1,class:"va-settings__group-block",style:{"margin-top":"14px"}},qx={class:"va-settings__section-title"},Wx={class:"va-settings__toggle-list",style:{"margin-top":"8px"}},Vx={class:"va-settings__toggle-text"},Jx={class:"va-settings__tool-headline"},Kx={class:"va-settings__toggle-title",style:{"font-family":"var(--va-font-mono, monospace)"}},Hx={key:0,class:"va-settings__approval-badge",title:"调用此工具前将强制弹出 HITL 人工审批卡"},Zx=["title"],Xx=["aria-checked","aria-label","onClick"],Gx={key:2,class:"va-settings__group-block",style:{"margin-top":"14px"}},Yx={class:"va-settings__section-title"},Qx={class:"va-settings__toggle-list",style:{"margin-top":"8px"}},e$={class:"va-settings__toggle-text"},t$={class:"va-settings__tool-headline"},n$={class:"va-settings__toggle-title",style:{"font-family":"var(--va-font-mono, monospace)"}},a$={key:0,class:"va-settings__scene-ready",title:"前端 CardRegistry 已注册对应渲染器"},s$={key:1,class:"va-settings__scene-unbound",title:"前端未注册对应组件,将使用优雅降级容器渲染"},o$=["title"],i$=["aria-checked","aria-label","onClick"],l$=ce({__name:"ToolsPanel",props:{tools:{},loading:{type:Boolean},loadError:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,a=t,s=S("all"),o=R(()=>n.tools.filter(u=>u.source==="builtin"||!u.source)),i=R(()=>n.tools.filter(u=>u.source==="custom")),l=R(()=>n.tools.filter(u=>u.source==="ui_component"));function d(u){return!!jo(u)}return(u,p)=>(f(),h("div",Dx,[e.loadError?(f(),h("p",Rx,C(e.loadError),1)):e.loading?(f(),h("p",Ex,"正在加载工具清单…")):e.tools.length===0?(f(),h("p",Sx," 服务端暂无已注册工具 ")):(f(),h("div",Mx,[c("div",Tx,[c("button",{type:"button",class:ue(["va-settings__tool-tab-btn",{"va-settings__tool-tab-btn--active":s.value==="all"}]),onClick:p[0]||(p[0]=v=>s.value="all")}," 全部 ("+C(e.tools.length)+") ",3),c("button",{type:"button",class:ue(["va-settings__tool-tab-btn",{"va-settings__tool-tab-btn--active":s.value==="builtin"}]),onClick:p[1]||(p[1]=v=>s.value="builtin")},[B(r(Pn),{size:12,style:{"vertical-align":"-1px","margin-right":"3px"}}),G(" 系统基础 ("+C(o.value.length)+") ",1)],2),i.value.length>0?(f(),h("button",{key:0,type:"button",class:ue(["va-settings__tool-tab-btn",{"va-settings__tool-tab-btn--active":s.value==="custom"}]),onClick:p[2]||(p[2]=v=>s.value="custom")},[B(r(co),{size:12,style:{"vertical-align":"-1px","margin-right":"3px",color:"#0284c7"}}),G(" 业务动作 ("+C(i.value.length)+") ",1)],2)):A("",!0),l.value.length>0?(f(),h("button",{key:1,type:"button",class:ue(["va-settings__tool-tab-btn",{"va-settings__tool-tab-btn--active":s.value==="scene"}]),onClick:p[3]||(p[3]=v=>s.value="scene")},[B(r(ho),{size:12,style:{"vertical-align":"-1px","margin-right":"3px",color:"#7e22ce"}}),G(" 场景组件 ("+C(l.value.length)+") ",1)],2)):A("",!0)]),s.value==="all"||s.value==="builtin"?(f(),h("div",Fx,[c("div",null,[c("div",Ix,[B(r(Pn),{size:14,style:{"vertical-align":"-2px","margin-right":"4px"}}),p[4]||(p[4]=G(" 内置系统基础工具 ",-1))]),p[5]||(p[5]=c("p",{class:"va-console__modal-sub",style:{"margin-top":"2px"}}," 底层文件读写、沙箱命令执行与文件检索工具。停用后 Agent 本轮起不再调用。 ",-1))]),c("div",Bx,[(f(!0),h(j,null,Q(o.value,v=>(f(),h("div",{key:v.name,class:"va-settings__toggle-row"},[c("div",zx,[c("div",Px,[c("span",Lx,C(v.name),1),c("span",{class:ue(["va-settings__tool-badge",r(It)(v.riskLevel).className])},C(r(It)(v.riskLevel).label),3),v.writesWorkspace?(f(),h("span",Ox,"写")):A("",!0)]),c("span",{class:"va-settings__toggle-desc",title:v.description},C(v.description),9,jx)]),c("button",{class:ue(["va-settings__switch",{"va-settings__switch--on":v.enabled}]),type:"button",role:"switch","aria-checked":v.enabled,"aria-label":`启用 ${v.name}`,onClick:b=>a("toggle",v)},[...p[6]||(p[6]=[c("span",{class:"va-settings__switch-knob"},null,-1)])],10,Ux)]))),128))])])):A("",!0),(s.value==="all"||s.value==="custom")&&i.value.length>0?(f(),h("div",Nx,[c("div",null,[c("div",qx,[B(r(co),{size:14,style:{"vertical-align":"-2px","margin-right":"4px",color:"#0284c7"}}),p[7]||(p[7]=G(" 业务扩展工具 (Custom Action Tools) ",-1))]),p[8]||(p[8]=c("p",{class:"va-console__modal-sub",style:{"margin-top":"2px"}}," 纯数据、逻辑与动作型业务扩展(数据库查询、Git 探针、CI 触发等)。执行结果直接作为上下文喂回大模型继续思考,高危操作可触发人工审批。 ",-1))]),c("div",Wx,[(f(!0),h(j,null,Q(i.value,v=>(f(),h("div",{key:v.name,class:"va-settings__toggle-row"},[c("div",Vx,[c("div",Jx,[c("span",Kx,C(v.name),1),p[10]||(p[10]=c("span",{class:"va-settings__custom-badge"},"业务工具",-1)),c("span",{class:ue(["va-settings__tool-badge",r(It)(v.riskLevel).className])},C(r(It)(v.riskLevel).label),3),v.requiresApproval?(f(),h("span",Hx,[B(r(qb),{size:10,style:{"vertical-align":"-1px","margin-right":"2px"}}),p[9]||(p[9]=G(" 人工审批 ",-1))])):A("",!0)]),c("span",{class:"va-settings__toggle-desc",title:v.description},C(v.description),9,Zx)]),c("button",{class:ue(["va-settings__switch",{"va-settings__switch--on":v.enabled}]),type:"button",role:"switch","aria-checked":v.enabled,"aria-label":`启用 ${v.name}`,onClick:b=>a("toggle",v)},[...p[11]||(p[11]=[c("span",{class:"va-settings__switch-knob"},null,-1)])],10,Xx)]))),128))])])):A("",!0),(s.value==="all"||s.value==="scene")&&l.value.length>0?(f(),h("div",Gx,[c("div",null,[c("div",Yx,[B(r(ho),{size:14,style:{"vertical-align":"-2px","margin-right":"4px",color:"#7e22ce"}}),p[12]||(p[12]=G(" 场景组件工具 (Generative UI) ",-1))]),p[13]||(p[13]=c("p",{class:"va-console__modal-sub",style:{"margin-top":"2px"}}," 由 UIComponentRegistry 开放注册的特定业务场景可视化卡片。模型按需输出参数,前端同名组件动态挂载渲染。 ",-1))]),c("div",Qx,[(f(!0),h(j,null,Q(l.value,v=>(f(),h("div",{key:v.name,class:"va-settings__toggle-row"},[c("div",e$,[c("div",t$,[c("span",n$,C(v.name),1),p[14]||(p[14]=c("span",{class:"va-settings__scene-badge"},"场景组件",-1)),d(v.name)?(f(),h("span",a$," ✨ 前端已就绪 ")):(f(),h("span",s$," 未绑定组件 "))]),c("span",{class:"va-settings__toggle-desc",title:v.description},C(v.description),9,o$)]),c("button",{class:ue(["va-settings__switch",{"va-settings__switch--on":v.enabled}]),type:"button",role:"switch","aria-checked":v.enabled,"aria-label":`启用 ${v.name}`,onClick:b=>a("toggle",v)},[...p[15]||(p[15]=[c("span",{class:"va-settings__switch-knob"},null,-1)])],10,i$)]))),128))])])):A("",!0)]))]))}}),r$={class:"va-settings__panel va-settings__panel--config"},u$={class:"va-settings__section"},c$={class:"va-settings__section-title"},d$={class:"va-console__modal-sub",style:{"margin-top":"2px"}},f$={key:0,class:"va-settings__tools-error"},v$={key:1,class:"va-settings__tools-loading"},p$={key:2,class:"va-settings__tools-loading"},h$={key:3,class:"va-settings__toggle-list"},_$={class:"va-settings__toggle-text"},m$={class:"va-settings__tool-headline"},g$={class:"va-settings__toggle-title"},k$=["title"],b$={class:"va-settings__toggle-desc"},y$={key:0,class:"va-settings__toggle-desc va-settings__config-lock-note"},w$=["aria-checked","aria-label","disabled","onClick"],x$=["value","min","max","disabled","aria-label","onInput","onChange"],$$=["value","maxlength","disabled","aria-label","onInput","onChange"],C$=["value","maxlength","disabled","aria-label","onInput","onChange"],A$={key:4,class:"va-settings__config-footer"},Dn=ce({__name:"ConfigPanel",props:{namespace:{},loading:{type:Boolean},loadError:{}},emits:["patch","reset"],setup(e,{emit:t}){const n=e,a=t;function s(_){return n.namespace?.values?.[_.key]??_.default}const o=vt({});function i(_){return o[_.key]??String(s(_)??"")}function l(_,g){o[_.key]=g.target.value}const d=vt({});ve(()=>n.namespace?.values,_=>{if(_){for(const[g,m]of Object.entries(o)){const k=String(_[g]??"");(k===m||k!==(d[g]??""))&&delete o[g]}for(const g of Object.keys(d))delete d[g];for(const[g,m]of Object.entries(_))d[g]=String(m??"")}},{deep:!0,immediate:!0}),ve(()=>n.namespace?.isDefault,_=>{if(_)for(const g of Object.keys(o))delete o[g]});function u(_,g){const m=g.target;if(m.value.trim()===""){delete o[_.key],m.value=String(s(_));return}const k=Number(m.value);if(!Number.isFinite(k)){delete o[_.key],m.value=String(s(_));return}let w=k;_.min!==void 0&&(w=Math.max(_.min,w)),_.max!==void 0&&(w=Math.min(_.max,w)),w!==k&&(he.add({title:"已按取值范围钳制",description:`${_.title} 允许范围 ${_.min??"-∞"} ~ ${_.max??"+∞"},已调整为 ${w}`,kind:"warning"}),m.value=String(w)),o[_.key]=String(w),w!==s(_)&&a("patch",_.key,w)}function p(_,g){const k=g.target.value;k!==s(_)?a("patch",_.key,k):delete o[_.key]}function v(_,g){const m=Array.isArray(g)?String(g[0]??""):String(g);m!==s(_)&&a("patch",_.key,m)}function b(_){_.locked||a("patch",_.key,!s(_))}return(_,g)=>(f(),h("div",r$,[c("div",u$,[c("div",null,[c("div",c$,C(e.namespace?.title??""),1),c("p",d$,C(e.namespace?.description??"")+";修改即时生效并由服务端持久化 ",1)]),e.loadError?(f(),h("p",f$,C(e.loadError),1)):e.loading?(f(),h("p",v$,"正在加载配置…")):e.namespace?(f(),h("div",h$,[(f(!0),h(j,null,Q(e.namespace.fields,m=>(f(),h("div",{key:m.key,class:"va-settings__toggle-row"},[c("div",_$,[c("div",m$,[c("span",g$,C(m.title),1),m.risk?(f(),h("span",{key:0,class:ue(["va-settings__tool-badge",r(It)(m.risk).className])},C(r(It)(m.risk).label),3)):A("",!0),m.locked?(f(),h("span",{key:1,class:"va-settings__config-lock",title:`由环境变量 ${m.envLock} 锁定`},[B(r(Lb),{size:12}),g[1]||(g[1]=G(" env 锁定 ",-1))],8,k$)):A("",!0)]),c("span",b$,C(m.description),1),m.locked?(f(),h("span",y$," 由环境变量 "+C(m.envLock)+" 显式设置锁定(部署级),不可在此修改 ",1)):A("",!0)]),m.type==="boolean"?(f(),h("button",{key:0,class:ue(["va-settings__switch",{"va-settings__switch--on":s(m)===!0}]),type:"button",role:"switch","aria-checked":s(m)===!0,"aria-label":m.title,disabled:m.locked,onClick:k=>b(m)},[...g[2]||(g[2]=[c("span",{class:"va-settings__switch-knob"},null,-1)])],10,w$)):m.type==="number"?(f(),h("input",{key:1,class:"va-console__input va-settings__config-input",type:"number",value:i(m),min:m.min,max:m.max,disabled:m.locked,"aria-label":m.title,onInput:k=>l(m,k),onChange:k=>u(m,k)},null,40,x$)):m.type==="text"?(f(),h("textarea",{key:2,class:"va-console__input va-settings__config-textarea",value:i(m),maxlength:m.maxLength,disabled:m.locked,"aria-label":m.title,rows:"4",onInput:k=>l(m,k),onChange:k=>p(m,k)},null,40,$$)):m.type==="select"?(f(),H(r(Tn),{key:3,size:"sm","model-value":String(s(m)??""),options:m.options??[],disabled:m.locked,label:m.title,"onUpdate:modelValue":k=>v(m,k)},null,8,["model-value","options","disabled","label","onUpdate:modelValue"])):(f(),h("input",{key:4,class:"va-console__input va-settings__config-input",type:"text",value:i(m),maxlength:m.maxLength,disabled:m.locked,"aria-label":m.title,onInput:k=>l(m,k),onChange:k=>p(m,k)},null,40,C$))]))),128))])):(f(),h("p",p$,"配置不可用")),e.namespace&&!e.namespace.isDefault?(f(),h("div",A$,[c("button",{class:"va-console__btn-add-profile va-settings__config-reset",type:"button",onClick:g[0]||(g[0]=m=>a("reset"))},[B(r(Ub),{size:13,style:{"vertical-align":"-2px","margin-right":"4px"}}),g[3]||(g[3]=G(" 恢复默认 ",-1))])])):A("",!0)])]))}});function D$(e){return e.autoCollapseThought===!0}function Ro(e){return e.autoCollapseThought===!0&&e.autoCollapseToolCards===!0}function R$(e,t){return e.autoCollapseToolCards?t.status==="error"?!1:t.turnStreaming:t.status==="streaming"}const E$={class:"va-console__card-item"},S$={key:9,class:"va-custom-card-fallback",style:{padding:"10px 14px",border:"1px dashed var(--va-color-border, #cbd5e1)","border-radius":"8px","font-size":"13px",margin:"4px 0"}},M$={style:{"font-weight":"600","margin-bottom":"4px",color:"var(--va-color-text-subtle, #64748b)"}},T$={style:{margin:"0","font-size":"11px","overflow-x":"auto","max-height":"160px",background:"var(--va-color-bg-subtle, #f8fafc)",padding:"8px","border-radius":"4px"}},F$=ce({__name:"CardRenderer",props:{card:{},turnStreaming:{type:Boolean}},emits:["approve","deny"],setup(e){const t=e,n=R(()=>{const w=t.card.data?.status;return w==="error"?"error":w==="done"?"success":"running"}),a=R(()=>{const w=t.card.data?.status;return w==="streaming"?"生成调用参数中…":w==="executing"?"沙箱执行中…":w==="error"?"执行失败":"执行完成"}),{settings:s}=Nn(),o=R(()=>R$(s.value,{turnStreaming:t.turnStreaming,status:t.card.data?.status})),i=R(()=>{const w=t.card.data?.status;if(w==="approved"||w==="denied")return;const x=t.card.data?.expiresAt;return typeof x=="number"&&x>0?Math.max(1,Math.ceil((x-Date.now())/1e3)):t.card.data?.expiresInSec}),l=new Set(["ui_code_diff","ui_metric_chart","ui_file_tree","ui_trajectory","ui_task_board","ui_change_summary","ui_comment_thread","ui_ai_answer"]),d=R(()=>t.card.data?.props||{}),u=R(()=>String(t.card.data?.component||"")),p=R(()=>l.has(u.value)),v=R(()=>jo(u.value)),b=S({}),_=R(()=>{const w=t.card.data?.formArgs?.fields;return Array.isArray(w)?w:[]}),g=S(!1),m=async(w,x)=>{if(!g.value){b.value={},g.value=!0;try{const y=await wo(t.card.data.actionId,{kind:"submit",values:w,meta:{editedFields:x}});y.ok?t.card.data.status="done":y.fieldErrors?b.value=y.fieldErrors:he.add({title:`表单提交失败(HTTP ${y.status})`,description:"请稍后重试;若持续失败请查看服务端日志",kind:"warning"})}catch(y){he.add({title:"表单提交网络异常",description:y instanceof Error?y.message:String(y),kind:"warning"})}finally{g.value=!1}}},k=async()=>{if(!g.value){b.value={},g.value=!0;try{const w=await wo(t.card.data.actionId,{kind:"cancel"});w.ok?t.card.data.status="done":he.add({title:`取消失败(HTTP ${w.status})`,description:"请稍后重试",kind:"warning"})}catch(w){he.add({title:"取消请求网络异常",description:w instanceof Error?w.message:String(w),kind:"warning"})}finally{g.value=!1}}};return(w,x)=>(f(),h("div",E$,[e.card.type==="ui"?(f(),h(j,{key:0},[v.value?(f(),H(Ba(v.value),Vl(Jl({key:0},d.value)),null,16)):p.value&&u.value==="ui_code_diff"?(f(),H(r(xs),{key:1,"file-name":d.value.fileName,"old-text":d.value.oldText,"new-text":d.value.newText,layout:d.value.layout||"unified","max-height":d.value.maxHeight},null,8,["file-name","old-text","new-text","layout","max-height"])):p.value&&u.value==="ui_metric_chart"?(f(),H(r(vs),{key:2,title:d.value.title,series:d.value.series},null,8,["title","series"])):p.value&&u.value==="ui_file_tree"?(f(),H(r(Ca),{key:3,title:d.value.title,tree:d.value.tree,"default-expand-depth":d.value.defaultExpandDepth},null,8,["title","tree","default-expand-depth"])):p.value&&u.value==="ui_trajectory"?(f(),H(r(wa),{key:4,events:d.value.events,"ledger-max-height":d.value.ledgerMaxHeight},null,8,["events","ledger-max-height"])):p.value&&u.value==="ui_task_board"?(f(),H(r(T0),{key:5,columns:d.value.columns,tasks:d.value.tasks},null,8,["columns","tasks"])):p.value&&u.value==="ui_change_summary"?(f(),H(r(E1),{key:6,title:d.value.title,files:d.value.files,duration:d.value.duration,"tool-calls":d.value.toolCalls,"finished-at":d.value.finishedAt},null,8,["title","files","duration","tool-calls","finished-at"])):p.value&&u.value==="ui_comment_thread"?(f(),H(r(xh),{key:7,comments:d.value.comments,"max-height":d.value.maxHeight,composer:!1},null,8,["comments","max-height"])):p.value&&u.value==="ui_ai_answer"?(f(),H(r(X1),{key:8,question:d.value.question,answer:d.value.answer,sources:d.value.sources},null,8,["question","answer","sources"])):(f(),h("div",S$,[c("div",M$,"[场景组件: "+C(u.value)+"]",1),c("pre",T$,C(JSON.stringify(d.value,null,2)),1)]))],64)):e.card.type==="toolcall"?(f(),H(r(wr),{key:1,name:e.card.data.toolName,summary:a.value,status:n.value,args:e.card.data.args,result:e.card.data.result,error:e.card.data.error,"started-at":e.card.data.startedAt,duration:e.card.data.duration,"default-open":o.value,"open-on-error":!0},null,8,["name","summary","status","args","result","error","started-at","duration","default-open"])):A("",!0),e.card.type==="approval"?(f(),H(r(tu),{key:2,title:e.card.data.title||`申请执行: ${e.card.data.toolName||"工具"}`,risk:e.card.data.risk,preview:e.card.data.command,detail:e.card.data.detail,status:e.card.data.status||"pending",reason:e.card.data.reason,countdown:i.value,collapsible:!0,"default-collapsed":e.card.data.status==="approved"||e.card.data.status==="denied",onApprove:x[0]||(x[0]=y=>w.$emit("approve")),onDeny:x[1]||(x[1]=y=>w.$emit("deny",y))},null,8,["title","risk","preview","detail","status","reason","countdown","default-collapsed"])):e.card.type==="form"?(f(),H(r(_0),{key:3,title:e.card.data.formArgs?.title,description:e.card.data.formArgs?.description,fields:_.value,"submit-label":e.card.data.formArgs?.submitLabel,disabled:e.card.data.status!=="pending",loading:g.value,"field-errors":b.value,onSubmit:m,onCancel:k},Kl({_:2},[e.card.data.status==="timeout"?{name:"after-actions",fn:oe(()=>[x[2]||(x[2]=c("p",{class:"va-console__form-note"},"⏱ 表单已超时关闭(按用户放弃处理,可在对话中重新发起)",-1))]),key:"0"}:e.card.data.status==="done"?{name:"after-actions",fn:oe(()=>[x[3]||(x[3]=c("p",{class:"va-console__form-note"},"✅ 表单已提交,agent 正在继续执行",-1))]),key:"1"}:void 0]),1032,["title","description","fields","submit-label","disabled","loading","field-errors"])):e.card.type==="diff"?(f(),H(r(xs),{key:4,"file-name":e.card.data.file,"old-text":e.card.data.oldCode,"new-text":e.card.data.newCode,layout:e.card.data.view||"unified"},null,8,["file-name","old-text","new-text","layout"])):e.card.type==="terminal"?(f(),H(r(lh),{key:5,title:e.card.data.title,lines:e.card.data.lines},null,8,["title","lines"])):e.card.type==="metric"?(f(),H(r(vs),{key:6,title:e.card.data.title,series:e.card.data.series},null,8,["title","series"])):e.card.type==="tree"?(f(),H(r(Ca),{key:7,title:e.card.data.title,tree:e.card.data.tree,"default-expand-depth":e.card.data.defaultExpandDepth},null,8,["title","tree","default-expand-depth"])):e.card.type==="trajectory"?(f(),H(r(wa),{key:8,events:e.card.data.events,"ledger-max-height":e.card.data.ledgerMaxHeight},null,8,["events","ledger-max-height"])):A("",!0)]))}}),I$={class:"va-console__assistant-turn"},B$={class:"va-console__agent-avatar"},z$={class:"va-console__turn-body"},P$={key:0,class:"va-console__markdown-content"},L$={key:1,class:"va-console__action-cards"},O$={key:2,class:"va-console__streaming-indicator"},j$=["title"],U$=ce({__name:"AssistantTurn",props:{turn:{}},emits:["approve","deny","regenerate","feedback"],setup(e){const t=e,n=R(()=>{switch(t.turn.abortedReason){case"user":return"手动停止";case"timeout":return"看门狗超时";case"preempt":return"被新请求顶替";case"process_restart":return"服务重启中断";case"token_budget":return"token 预算熔断";default:return""}}),{settings:a}=Nn(),s=S(!1),o=S(null),i=R(()=>!!t.turn.thought||(t.turn.cards||[]).some(p=>p.type==="toolcall")),l=R(()=>(t.turn.cards||[]).filter(p=>p.type==="toolcall").length);ve(()=>t.turn.isStreaming,(p,v)=>{v!==!0||p!==!1||(D$(a.value)&&(t.turn.thoughtExpanded=!1),Ro(a.value)&&i.value&&(o.value=Math.round((Date.now()-t.turn.timestamp)/100)/10,s.value=!0))}),Le(()=>{!t.turn.isStreaming&&i.value&&Ro(a.value)&&(s.value=!0)});const d=R(()=>{const p={};for(const v of t.turn.cards||[])p[v.id]=v;return p}),u=R(()=>{const p=t.turn;if(p.blocks&&p.blocks.length)return p.blocks;const v=[];p.content&&v.push({kind:"text",content:p.content});for(const b of p.cards||[])v.push({kind:"card",cardId:b.id});return v});return(p,v)=>(f(),h("div",I$,[c("div",B$,[B(r(Rb),{size:18})]),c("div",z$,[i.value||e.turn.isStreaming&&!e.turn.content?(f(),H(r(gb),{key:0,thought:e.turn.thought,expanded:e.turn.thoughtExpanded,duration:o.value??e.turn.thoughtDuration,streaming:e.turn.isStreaming&&!e.turn.content,"summary-mode":s.value,"tool-count":l.value,"onUpdate:expanded":v[0]||(v[0]=b=>e.turn.thoughtExpanded=b),"onUpdate:summaryMode":v[1]||(v[1]=b=>s.value=b)},null,8,["thought","expanded","duration","streaming","summary-mode","tool-count"])):A("",!0),(f(!0),h(j,null,Q(u.value,(b,_)=>(f(),h(j,{key:`${b.kind}-${_}`},[b.kind==="text"&&b.content?(f(),h("div",P$,[B(r(fb),{content:b.content,streaming:e.turn.isStreaming&&_===u.value.length-1},null,8,["content","streaming"])])):!s.value&&b.kind==="card"&&d.value[b.cardId]?(f(),h("div",L$,[B(F$,{card:d.value[b.cardId],"turn-streaming":e.turn.isStreaming,onApprove:g=>p.$emit("approve",d.value[b.cardId].data.actionId),onDeny:g=>p.$emit("deny",d.value[b.cardId].data.actionId,g)},null,8,["card","turn-streaming","onApprove","onDeny"])])):A("",!0)],64))),128)),!e.turn.isStreaming&&e.turn.content?(f(),H(r(Nv),{key:1,text:e.turn.content,quiet:"",class:"va-console__message-actions",onRegenerate:v[2]||(v[2]=b=>p.$emit("regenerate",e.turn.id)),onFeedback:v[3]||(v[3]=(b,_)=>p.$emit("feedback",b,_))},null,8,["text"])):A("",!0),e.turn.isStreaming?(f(),h("div",O$,[...v[4]||(v[4]=[c("span",{class:"va-console__cursor-dot"},null,-1),c("span",null,"Agent 正在分析中…",-1)])])):A("",!0),e.turn.abortedReason?(f(),h("div",{key:3,class:"va-console__abort-badge",title:`中止成因:${n.value}`},[v[5]||(v[5]=G(" ⏹ 任务已中止",-1)),n.value?(f(),h(j,{key:0},[G("("+C(n.value)+")",1)],64)):A("",!0)],8,j$)):A("",!0)])]))}}),N$=["data-turn-id"],q$={class:"va-console__user-bubble-container"},W$={class:"va-console__user-bubble"},V$={key:0,class:"va-console__user-atts"},J$=["href","title"],K$=["src","alt"],H$=["title"],Z$={class:"va-console__user-text"},X$={class:"va-console__user-avatar"},G$=["data-turn-id"],Y$=ce({__name:"TurnList",props:{turns:{}},emits:["approve","deny","regenerate","feedback"],setup(e){return(t,n)=>(f(!0),h(j,null,Q(e.turns,a=>(f(),h(j,{key:a.id},[a.role==="user"?(f(),h("div",{key:0,class:"va-console__turn-row","data-turn-id":a.id},[c("div",q$,[c("div",W$,[a.attachments?.length?(f(),h("div",V$,[(f(!0),h(j,null,Q(a.attachments,(s,o)=>(f(),h(j,{key:`${s.name}:${s.size}:${o}`},[s.kind==="image"&&s.dataUrl?(f(),h("a",{key:0,href:s.dataUrl,target:"_blank",rel:"noopener",class:"va-console__user-att-img-link",title:`${s.name}(点击新窗口查看原图)`},[c("img",{src:s.dataUrl,alt:s.name,class:"va-console__user-att-img"},null,8,K$)],8,J$)):(f(),h("span",{key:1,class:"va-console__user-att-chip",title:s.size?`${s.name} · ${s.size} B`:s.name},C(s.kind==="image"?`[图] ${s.name}`:`[附件] ${s.name}`),9,H$))],64))),128))])):A("",!0),c("p",Z$,C(a.content),1)]),c("div",X$,[B(r(Jb),{size:16})])])],8,N$)):(f(),h("div",{key:1,class:"va-console__turn-row","data-turn-id":a.id},[B(U$,{turn:a,onApprove:n[0]||(n[0]=s=>t.$emit("approve",s)),onDeny:n[1]||(n[1]=(s,o)=>t.$emit("deny",s,o)),onRegenerate:n[2]||(n[2]=s=>t.$emit("regenerate",s)),onFeedback:n[3]||(n[3]=(s,o)=>t.$emit("feedback",s,o))},null,8,["turn"])],8,G$))],64))),128))}}),Q$=["aria-label"],eC={class:"va-console__seat-text"},tC={class:"va-console__effort-menu",role:"menu","aria-label":"推理档位"},nC=["data-active","onClick"],aC={key:1,class:"va-console__effort-gap","aria-hidden":"true"},Eo=ce({__name:"ReasoningEffortMenu",props:{options:{},modelValue:{}},emits:["select"],setup(e,{emit:t}){const n=t;return(a,s)=>(f(),H(r(ft),{placement:"top-start",offset:8},{trigger:oe(()=>[c("button",{class:"va-console__seat-btn",type:"button","aria-label":`推理档位(当前 ${e.modelValue})`},[B(r(Ma),{size:12,"aria-hidden":"true"}),c("span",eC,"思考: "+C(e.modelValue),1),B(r(cn),{size:11,"aria-hidden":"true"})],8,Q$)]),default:oe(({close:o})=>[c("div",tC,[(f(!0),h(j,null,Q(e.options,i=>(f(),h("button",{key:i,class:"va-console__effort-item",type:"button",role:"menuitem","data-active":i===e.modelValue||void 0,onClick:l=>{n("select",i),o()}},[i===e.modelValue?(f(),H(r(ka),{key:0,size:13,"aria-hidden":"true"})):(f(),h("span",aC)),c("span",null,C(i),1)],8,nC))),128))])]),_:1}))}});function Pi(e,t,n,a){return new Promise(s=>{const o=new FileReader;o.onload=()=>{if(a.has(e)){const i=/^data:([^;]+);base64,(.+)$/.exec(String(o.result??""));i&&n.set(e,{name:t.name,mediaType:i[1],data:i[2]}),a.delete(e)}s()},o.onerror=()=>{a.delete(e),s()},o.readAsDataURL(t)})}function sC(e){if(e.atts.length===0)return;const t={atts:[...e.atts],texts:new Map,images:new Map,files:new Map};for(const n of e.atts){const a=e.texts.get(n.id);a!==void 0&&(t.texts.set(n.id,a),e.texts.delete(n.id));const s=e.images.get(n.id);s&&(t.images.set(n.id,s),e.images.delete(n.id));const o=e.files.get(n.id);o&&(t.files.set(n.id,o),e.files.delete(n.id))}return t}function So(e){const t=e.atts.filter(a=>a.kind!=="image");if(t.length===0)return"";const n=[];for(const a of t){const s=e.texts.get(a.id);n.push(s?`---
|
|
32
|
+
[${a.name}]
|
|
33
|
+
${s}
|
|
34
|
+
---`:`[附件] ${a.name}(文件)`)}return n.join(`
|
|
35
|
+
|
|
36
|
+
`)+`
|
|
37
|
+
|
|
38
|
+
`}function oC(e){return e.atts.map(t=>{const n=t.size??0;if(t.kind!=="image")return{name:t.name,kind:"file",size:n};const a=e.images.get(t.id);return{name:t.name,kind:"image",size:n,...a?{dataUrl:`data:${a.mediaType};base64,${a.data}`}:{}}})}async function iC(e){const t=e.atts.filter(a=>a.kind==="image");if(t.length===0)return;await Promise.all(t.filter(a=>!e.images.has(a.id)&&e.files.has(a.id)).map(a=>Pi(a.id,e.files.get(a.id),e.images,e.files)));const n=t.map(a=>e.images.get(a.id)).filter(a=>!!a);return n.length>0?n:void 0}function ma(e){for(const t of e.atts)t.previewUrl&&URL.revokeObjectURL(t.previewUrl),e.texts.delete(t.id),e.images.delete(t.id),e.files.delete(t.id)}function lC(e){function t(a,s,o,i){for(const l of a){if(!l.cards)continue;const d=l.cards.find(u=>u.data?.actionId===s||u.id===s||u.id===`approval-${s}`);d&&(d.data.status=o?"approved":"denied",d.data.reason=i)}}async function n(a,s,o){let i=!1;try{i=await Uy(a,{approved:s,note:o})}catch(l){console.error("提交审批失败:",l);return}if(i){t(e.chatTurns.value,a,s,o);for(const[,l]of e.sessionTurnsCache.entries())t(l,a,s,o)}}return{submitApproval:n}}function rC(e){const t=S([]),n=S(!1),a=S("");async function s(){n.value=!0,a.value="";try{const _=await Ly();if(_===null){a.value="工具清单加载失败,请检查服务端连接后重试";return}t.value=_}catch(_){console.error("拉取工具清单失败:",_),a.value="工具清单加载失败,请检查服务端连接后重试"}finally{n.value=!1}}async function o(_){const g=!_.enabled,m=_.enabled;_.enabled=g;try{const k=await Oy(_.name,g);if(!k){_.enabled=m,he.add({title:"工具启停保存失败",description:`${_.name} 的状态未能持久化,已恢复原状态`,kind:"danger"});return}_.enabled=k.enabled,he.add({title:k.enabled?`已启用 ${_.name}`:`已停用 ${_.name}`,kind:"success"})}catch(k){_.enabled=m,console.error("工具启停提交失败:",k),he.add({title:"工具启停保存失败",description:k instanceof Error?k.message:String(k),kind:"danger"})}}const i=S([]),l=S(!1),d=S("");function u(_){return i.value.find(g=>g.id===_)??null}async function p(){l.value=!0,d.value="";try{const _=await Ii();if(_===null){d.value="配置加载失败,请检查服务端连接后重试";return}i.value=_.namespaces;const g=u("security")?.values?.defaultPermissionMode;typeof g=="string"&&g&&(e.defaultPermission.value=g,e.isNewChat.value&&(e.activePermission.value=g))}catch(_){console.error("拉取配置中心失败:",_),d.value="配置加载失败,请检查服务端连接后重试"}finally{l.value=!1}}async function v(_,g,m){const k=u(_);if(!k)return;const w=k.values[g];k.values[g]=m;try{const x=await zy(_,{[g]:m});if(!x){k.values[g]=w,he.add({title:"配置保存失败",description:"服务端拒绝了本次修改(字段可能被 env 锁定),已恢复原值",kind:"danger"});return}k.values=x.values,k.isDefault=!1,_==="security"&&typeof x.values.defaultPermissionMode=="string"&&(e.defaultPermission.value=x.values.defaultPermissionMode)}catch(x){k.values[g]=w,console.error("配置提交失败:",x),he.add({title:"配置保存失败",description:x instanceof Error?x.message:String(x),kind:"danger"})}}async function b(_){const g=u(_);if(g)try{const m=await Py(_);if(!m){he.add({title:"恢复默认失败",description:"请检查服务端连接后重试",kind:"danger"});return}g.values=m.values,g.isDefault=!0,_==="security"&&typeof m.values.defaultPermissionMode=="string"&&(e.defaultPermission.value=m.values.defaultPermissionMode),he.add({title:`已恢复「${g.title}」默认配置`,kind:"success"})}catch(m){console.error("配置 reset 失败:",m),he.add({title:"恢复默认失败",description:m instanceof Error?m.message:String(m),kind:"danger"})}}return{tools:t,toolsLoading:n,toolsError:a,fetchTools:s,onToggleTool:o,configNamespaces:i,configLoading:l,configError:d,configNs:u,fetchConfig:p,onConfigPatch:v,onConfigReset:b}}function Li(e){return e.cards=e.cards||[],e.cards}function uC(e,t){const n=Li(e),a=n.find(s=>s.id===t.id);return a||(n.push(t),t)}function Mo(e,t){if(!t)return;e.blocks||(e.blocks=[]);const n=e.blocks[e.blocks.length-1];n&&n.kind==="text"?n.content+=t:e.blocks.push({kind:"text",content:t})}function Fa(e,t){e.blocks||(e.blocks=[]),!e.blocks.some(n=>n.kind==="card"&&n.cardId===t)&&e.blocks.push({kind:"card",cardId:t})}function et(e,t){const n=uC(e,t);return Fa(e,n.id),n}function cC(e,t,n,a){const s=t;if(!s||typeof s!="object"||!s.component)return;const o=s.props||{};switch(s.component){case"ui_code_diff":et(e,{id:`diff-${n}`,type:"diff",data:{file:o.fileName||"untitled.ts",oldCode:o.oldText||"",newCode:o.newText||"",view:o.layout||"unified"}});break;case"ui_metric_chart":et(e,{id:`metric-${n}`,type:"metric",data:{title:o.title||"指标图表",series:Array.isArray(o.series)?o.series:[]}});break;case"ui_agent_plan":Array.isArray(o.steps)&&a.setPlanSteps(o.steps);break;case"ui_file_tree":et(e,{id:`tree-${n}`,type:"tree",data:{title:o.title,tree:Array.isArray(o.tree)?o.tree:[],defaultExpandDepth:o.defaultExpandDepth}});break;case"ui_trajectory":et(e,{id:`traj-${n}`,type:"trajectory",data:{events:Array.isArray(o.events)?o.events:[],ledgerMaxHeight:o.ledgerMaxHeight}});break;case"ui_approval_card":break;default:et(e,{id:`ui-${n}`,type:"ui",data:{component:s.component,props:o}});break}}function dC(e,t){const n=t.seq;typeof n=="number"&&(e.lastSeq=n)}function To(e,t,n,a){switch(t.type){case"turn_start":e.isStreaming=!0;break;case"aborted":e.abortedReason=t.reason,e.isStreaming=!1;break;case"text_delta":e.content+=t.delta||"",Mo(e,t.delta||"");break;case"thought_delta":e.thought=(e.thought||"")+(t.delta||"");break;case"error":{const s=`
|
|
39
|
+
|
|
40
|
+
⚠️ **执行提示**:${t.message||"请求执行遇到错误"}`;e.content+=(e.content?`
|
|
41
|
+
|
|
42
|
+
`:"")+s.trimStart(),Mo(e,s)}break;case"ui_agent_plan":t.steps&&Array.isArray(t.steps)&&n.isActiveSession&&a.setPlanSteps(t.steps);break;case"ui_code_diff":et(e,{id:`diff-${Date.now()}`,type:"diff",data:{file:t.file||"untitled.ts",additions:t.additions||0,deletions:t.deletions||0,oldCode:t.oldCode||"",newCode:t.newCode||"",view:"side-by-side"}});break;case"ui_terminal_log":et(e,{id:`term-${Date.now()}`,type:"terminal",data:{title:t.title||"沙箱命令执行",lines:t.lines||[{text:"$ npm run build",kind:"cmd"},{text:"Build finished successfully in 410ms.",kind:"stdout"}]}});break;case"ui_metric_chart":et(e,{id:`metric-${Date.now()}`,type:"metric",data:{title:t.title||"指标图表",series:Array.isArray(t.points)?t.points.map(s=>({label:s.time,value:s.value})):[]}});break;case"suspended":{const s=Li(e);if(!s.some(o=>o.data?.actionId===t.actionId)){if(t.toolName==="ui_form"){const i={id:t.actionId,type:"form",data:{actionId:t.actionId,toolName:t.toolName,formArgs:t.args||{},status:"pending",timeoutMs:t.timeoutMs,expiresAt:Date.now()+(t.timeoutMs||0)}};s.push(i),Fa(e,i.id);break}const o={id:t.actionId,type:"approval",data:{actionId:t.actionId,risk:"high",title:t.toolName?`工具 [${t.toolName}] 申请权限`:"高风险操作介入确认",command:JSON.stringify(t.args||{},null,2),status:"pending",expiresInSec:Math.round((t.timeoutMs||6e4)/1e3),expiresAt:Date.now()+(t.timeoutMs||6e4)}};s.push(o),Fa(e,o.id)}break}case"resumed":{if(e.cards&&t.actionId){const s=e.cards.find(o=>o.data?.actionId===t.actionId||o.id===t.actionId||o.id===`approval-${t.actionId}`);if(s){if(s.type==="form"){const i=(t.payload||{}).reason;s.data.status=i==="timeout"?"timeout":"done";break}const o=t.payload||{};s.data.status=o.approved?"approved":"denied",s.data.reason=o.note||o.reason}}break}case"tool_call_start":et(e,{id:`call-${t.toolCallId}`,type:"toolcall",data:{toolName:t.toolName,status:"streaming",args:{},startedAt:Date.now()}});break;case"tool_call_args_delta":{const s=e.cards?.find(o=>o.id===`call-${t.toolCallId}`);s&&s.type==="toolcall"&&(s.data.args=t.partialArgs||{});break}case"tool_call_executing":{const s=e.cards?.find(o=>o.id===`call-${t.toolCallId}`);s&&s.type==="toolcall"&&(s.data.status="executing",s.data.args=t.args||{});break}case"tool_call_result":{const s=e.cards?.find(o=>o.id===`call-${t.toolCallId}`);if(s&&s.type==="toolcall"&&(s.data.status=t.status==="error"?"error":"done",s.data.result=t.data,s.data.error=t.error,s.data.duration=s.data.startedAt?Date.now()-s.data.startedAt:void 0),t.toolName==="bash_run"){et(e,{id:`term-${t.toolCallId}`,type:"terminal",data:{title:`终端执行: ${t.toolName}`,lines:[{text:`$ [状态: ${t.status}]`,kind:"cmd"},{text:typeof t.data=="string"?t.data:JSON.stringify(t.data||t.error||""),kind:t.status==="error"?"err":"stdout"}]}});break}cC(e,t.data,t.toolCallId,a);break}}}function fC(e){const t=vt(new Map),n=new Map,a=new Map;function s(u){return!u||u===e()}function o(u,p){t.set(u,!0),n.set(u,p)}function i(u){t.set(u,!1),n.delete(u)}function l(u,p){a.set(u,p)}function d(u){return n.get(u)}return{sessionRunningMap:t,sessionAbortControllers:n,sessionTurnsCache:a,isActiveSession:s,markRunning:o,markStopped:i,cacheTurns:l,getAbortController:d}}function vC(e,t){return e.value.push(t),e.value[e.value.length-1]}function pC(e){const t=S(0),n=S(128e3),a=S(0),s=vt(new Map),o=S([]);function i(d,u){t.value=d.promptTokens+d.completionTokens;const p=u||e();s.set(p,(s.get(p)??0)+d.promptTokens+d.completionTokens),(!u||u===e())&&(a.value+=d.promptTokens+d.completionTokens),d.contextWindow&&(n.value=d.contextWindow),o.value=d.parts?.length?d.parts:[{id:"history",label:"对话历史",tokens:t.value,kind:"history"}]}function l(){t.value=0,o.value=[],a.value=0}return{contextUsed:t,contextLimit:n,sessionTokensUsed:a,sessionTokensUsedMap:s,ctxParts:o,applyUsageEvent:i,reset:l}}function hC(){const e=S([]),t=S(!0),n=R(()=>e.value.length>0),a=R(()=>e.value.filter(l=>l.status==="done").length),s=R(()=>e.value.find(l=>l.status==="running"));function o(l){e.value=l,t.value=!0}function i(){e.value=[],t.value=!0}return{planSteps:e,isPlanExpanded:t,isPlanVisible:n,completedStepsCount:a,currentRunningStep:s,setPlanSteps:o,reset:i}}function _C(e){async function t(){const n=e.getActiveSessionId();if(n){await Ny(n);const a=e.registry.getAbortController(n);e.registry.markStopped(n),a?.abort()}e.onStopped()}return{stopExecution:t}}function mC(e){const t=S([]),n=fC(e.getActiveSessionId),a=pC(e.getActiveSessionId),s=hC(),o=S(!1),i=S(null);function l(k){return n.isActiveSession(k)}const d=new WeakMap;function u(k){d.get(k)?.flush()}function p(k){d.delete(k)}function v(){t.value=[],s.reset(),a.reset()}function b(k,w,x){if(dC(w,k),k.type==="usage"){a.applyUsageEvent(k,x);return}if(k.type==="traj"){w.trajEvents||(w.trajEvents=[]),w.trajEvents.push(k.event);return}if(k.type==="text_delta"){let y=d.get(w);y||(y=B0({commit:$=>{To(w,{type:"text_delta",delta:$},{isActiveSession:l(x)},{setPlanSteps:s.setPlanSteps}),e.scrollToBottom()}}),d.set(w,y)),y.push(k.delta);return}u(w),To(w,k,{isActiveSession:l(x)},{setPlanSteps:s.setPlanSteps}),e.scrollToBottom()}async function _(k,w,x,y){const $=new AbortController;n.markRunning(k,$),e.getActiveSessionId()===k&&(o.value=!0,i.value=$);const D=Date.now();p(w);try{const{aborted:M}=await I0({open:()=>x?qy(y):Wy(k),signal:$.signal,onEvent:N=>b(N,w,k),onDone:()=>{u(w),w.isStreaming=!1}});M&&(u(w),w.abortedReason??="user")}catch(M){u(w);const N=M?.message||String(M);w.content+=`
|
|
43
|
+
|
|
44
|
+
*(调用出错: ${N})*`}finally{u(w),p(w),w.isStreaming=!1,w.thoughtDuration=Math.round((Date.now()-D)/100)/10,n.markStopped(k),e.getActiveSessionId()===k&&(o.value=!1,i.value=null,e.scrollToBottom()),await e.refreshSessions()}}async function g(k,w){const x={id:`turn-user-${Date.now()}`,role:"user",content:k,...w.attachments?.length?{attachments:w.attachments}:{},timestamp:Date.now()};t.value.push(x);const y={id:`turn-asst-${Date.now()}`,role:"assistant",content:"",thought:"",thoughtExpanded:!0,thoughtDuration:0,isStreaming:!0,cards:[],blocks:[],trajEvents:[],timestamp:Date.now()};n.cacheTurns(w.sessionId,t.value);const $=vC(t,y);e.scrollToBottom({force:!0}),_(w.sessionId,$,!0,{sessionId:w.sessionId,workspaceId:w.workspaceId,prompt:k,modelProfileId:w.modelProfileId,permission:w.permission,reasoningEffort:w.reasoningEffort,images:w.images,attachments:w.attachments?.length?w.attachments.map(({name:D,kind:M,size:N})=>({name:D,kind:M,size:N})):void 0})}const{stopExecution:m}=_C({getActiveSessionId:e.getActiveSessionId,registry:n,onStopped:()=>{o.value=!1,i.value=null}});return{chatTurns:t,planSteps:s.planSteps,isPlanVisible:s.isPlanVisible,isPlanExpanded:s.isPlanExpanded,completedStepsCount:s.completedStepsCount,currentRunningStep:s.currentRunningStep,isRunning:o,activeAbortController:i,contextUsed:a.contextUsed,contextLimit:a.contextLimit,sessionTokensUsed:a.sessionTokensUsed,sessionTokensUsedMap:a.sessionTokensUsedMap,ctxParts:a.ctxParts,sessionTurnsCache:n.sessionTurnsCache,sessionRunningMap:n.sessionRunningMap,sessionAbortControllers:n.sessionAbortControllers,resetTurns:v,sendPrompt:g,connectToSessionStream:_,stopExecution:m}}const Fo=()=>({name:"",provider:"deepseek",baseUrl:"",apiKey:"",parameters:{temperature:.2}});function gC(e={}){const t=S([...An]),n=S("deepseek-v3"),a=S(""),s=S(!1),o=S([]),i=S([]),l=S(""),d=S(!1),u=S(Fo()),p=S(null),v=S(!1),b=S(!1),_=S(!1),g=S(null),m=S(!1),k=S([]),w=S(""),x=S([]),y=R(()=>t.value.find(z=>z.id===n.value)||t.value[0]),$=R(()=>i.value.find(z=>z.id===n.value)?.capabilities),D=R(()=>{const z=$.value?.inputModalities;return Array.isArray(z)&&z.includes("image")}),M=R(()=>$.value?.reasoning),N=R(()=>{const z=M.value;return z?.supported&&Array.isArray(z.supportedEfforts)&&z.supportedEfforts.length?z.supportedEfforts:[]}),K=vt(new Map),te=R(()=>{const z=N.value;if(z.length===0)return"";const W=K.get(e.getSessionId?.()??"");if(W&&z.includes(W))return W;const ae=M.value?.defaultEffort;return ae&&z.includes(ae)?ae:z[0]});function ne(z){K.set(e.getSessionId?.()??"",z)}function V(z,W){if(!W||z===W)return;const ae=K.get(z);ae!==void 0&&(K.has(W)||K.set(W,ae),K.delete(z))}const X=R(()=>o.value.find(z=>z.id===l.value)),O=R(()=>X.value?.models||[]);async function J(){try{const z=await Ey();if(!z)return;o.value=z;const W=z.find(ae=>ae.id===l.value);W?u.value={...u.value,id:W.id,name:W.name,provider:W.provider,baseUrl:W.baseUrl||"",maskedApiKey:W.maskedApiKey}:z.length>0?P(z[0].id):l.value="",Y(z)}catch(z){console.error("加载供应商失败:",z)}}async function Z(){try{await J()}catch(z){console.error("加载模型列表失败:",z)}}function Y(z){const W=new Map;for(const Te of z)W.set(Te.id,Te);const ae=[],pe=[];for(const Te of z){const vn=Te.name?.trim()||Te.provider||"默认供应商",qn=Te.models??[];for(const qe of qn)ae.push(qe),pe.push({id:qe.id,label:qe.name,meta:qe.model,provider:vn,model:qe.model,contextWindow:qe.contextWindow||qe.capabilities?.contextWindow||128e3})}if(i.value=ae,ae.length===0){t.value=[...An],a.value="",An.some(Te=>Te.id===n.value)||(n.value=An[0]?.id??"");return}t.value=pe;const Ke=ae.find(Te=>Te.isDefault)||ae[0];a.value=Ke.id,(!n.value||!ae.some(Te=>Te.id===n.value))&&(n.value=Ke.id)}function ie(){a.value&&(n.value=a.value)}async function le(){e.closeMenus?.(),s.value=!0,g.value=null,p.value=null,v.value=!1,await J(),o.value.length===0&&L()}function T(){s.value=!1,g.value=null,p.value=null,v.value=!1}function P(z){const W=o.value.find(ae=>ae.id===z);W&&(d.value=!1,l.value=z,p.value=null,v.value=!1,g.value=null,k.value=[],x.value=[],u.value={id:W.id,name:W.name,provider:W.provider,baseUrl:W.baseUrl||"",apiKey:"",maskedApiKey:W.maskedApiKey,parameters:{...W.parameters||{}}})}function L(){d.value=!0,l.value="",p.value=null,v.value=!1,g.value=null,k.value=[],x.value=[],u.value={...Fo(),name:"新供应商"}}function q(z){if(u.value.provider=z,!d.value)return;const W=Do[z];W&&(u.value.name=W.name,u.value.baseUrl=W.baseUrl)}async function fe(){const z=u.value;if(!z.name.trim()){he.add({title:"请填写供应商名称",kind:"warning"});return}const W={name:z.name.trim(),provider:z.provider,baseUrl:z.baseUrl?.trim()||void 0,apiKey:z.apiKey?.trim()||void 0,parameters:z.parameters};try{if(d.value){const ae=await Sy(W);ae&&(await J(),P(ae.id),g.value={ok:!0,message:"供应商已创建,可在下方添加模型"})}else z.id&&await My(z.id,W)&&(await J(),P(z.id),g.value={ok:!0,message:"供应商已更新,其下所有模型立即生效"})}catch(ae){g.value={ok:!1,message:`保存失败: ${ae.message||String(ae)}`}}}async function we(z){const W=o.value.find(Te=>Te.id===z),ae=W?.models?.length??0;if(!await dt({title:ae>0?`删除「${W?.name}」及其 ${ae} 个模型?`:"删除这个供应商?",description:ae>0?"该供应商下的模型配置会一并移除,此操作不可撤销。":`「${W?.name||"未命名供应商"}」将被移除,此操作不可撤销。`,confirmText:ae>0?"全部删除":"删除",tone:"danger",icon:!0}))return;const Ke=await Ty(z,ae>0);Ke?.success?(await J(),o.value.length>0?P(o.value[0].id):L()):he.add({title:Ke?.error||"删除失败",kind:"danger"})}function De(){const z=X.value;if(!z){he.add({title:"请先保存供应商",kind:"warning"});return}v.value=!0,k.value=[],x.value=[],g.value=null;const W=Do[z.provider];p.value={...q2,id:"",providerId:z.id,provider:z.provider,name:"",model:"",contextWindow:W?.contextWindow||128e3,capabilities:{source:"declared"},isDefault:!1},me({silent:!0})}function ge(z){v.value=!1,Ye.value=[],k.value=[],x.value=[],g.value=null,p.value={id:z.id,providerId:z.providerId,name:z.name,provider:z.provider,model:z.model,baseUrl:z.baseUrl||"",apiKey:"",maskedApiKey:z.maskedApiKey,contextWindow:z.contextWindow||z.capabilities?.contextWindow||128e3,capabilities:z.capabilities?{...z.capabilities}:{source:"declared"},temperature:z.temperature??.2,isDefault:!!z.isDefault},me({silent:!0})}function ee(){p.value=null,v.value=!1,Ye.value=[],k.value=[],x.value=[],g.value=null}async function Ue(){const z=p.value;if(!z)return;if(!z.name.trim()||!z.model.trim()){he.add({title:"请填写模型名称与模型标识",kind:"warning"});return}const W={...z.capabilities||{},contextWindow:z.contextWindow||void 0,source:z.capabilities?.source||"declared"},ae={name:z.name.trim(),model:z.model.trim(),contextWindow:z.contextWindow||void 0,capabilities:W,temperature:z.temperature,isDefault:z.isDefault};try{const pe=v.value;(pe?await Fy(z.providerId||l.value,ae):await Dy(z.id,ae))&&(await J(),ee(),g.value={ok:!0,message:pe?"模型已添加":"模型已更新"})}catch(pe){g.value={ok:!1,message:`保存失败: ${pe.message||String(pe)}`}}}async function bt(z){const W=i.value.find(pe=>pe.id===z);if(await dt({title:"删除这个模型?",description:`「${W?.name||"未命名模型"}」将被移除,此操作不可撤销。`,confirmText:"删除",tone:"danger",icon:!0}))try{await Ry(z)&&(p.value?.id===z&&ee(),await J())}catch(pe){console.error("删除模型失败:",pe)}}async function me(z){const W=z?.silent===!0,ae=X.value?.id;if(!ae){W||he.add({title:"请先保存供应商,再拉取模型列表",kind:"warning"});return}if(!(W&&w.value===ae&&k.value.length>0)){m.value=!0;try{const pe=await By(ae);if(pe?.ok&&pe.models){k.value=pe.models,x.value=pe.items??[],w.value=ae;const Ke=x.value.filter(Te=>Te.capabilities).length;W||he.add({title:`已拉取 ${pe.models.length} 个可用模型`,description:Ke>0?`其中 ${Ke} 个可自动填充能力信息`:"该供应商未提供能力信息,需手动填写",kind:"success"})}else W||he.add({title:`拉取失败:${pe?.error||"端点无响应"}`,kind:"warning"})}catch(pe){W||he.add({title:`拉取失败: ${pe.message||String(pe)}`,kind:"warning"})}finally{m.value=!1}}}function Je(z){const W=p.value;if(!W)return;const ae=z.capabilities,pe={...W.capabilities||{},...ae||{},source:ae?"detected":W.capabilities?.source||"declared"};p.value={...W,model:z.id,name:z.displayName||z.id,contextWindow:ae?.contextWindow||W.contextWindow,capabilities:pe}}function Ut(z){const W=x.value.find(pe=>pe.id===z);if(W){Je(W);return}const ae=p.value;ae&&(p.value={...ae,model:z,name:z})}const pt=S(!1),Ye=S([]);async function Nt(){const z=p.value;if(!z?.id||pt.value)return;const W=(z.capabilities?.inputModalities?.includes("image")?1:0)+(z.capabilities?.reasoning?.supported?1:0);if(W===0){he.add({title:"未勾选可探测能力",kind:"info"});return}if(await dt({title:`发起 ${W} 次最小探测请求?`,description:"将按勾选能力逐项实测端点行为(max_tokens=1 压成本),产生少量真实 API 费用。",confirmText:"开始验证",tone:"default",icon:!0})){pt.value=!0,Ye.value=[];try{const pe=await Iy(z.id);pe&&(Ye.value=pe.results??[],Ye.value.length===0&&he.add({title:pe.note||"未勾选可探测能力",kind:"info"}))}catch(pe){he.add({title:`验证失败: ${pe instanceof Error?pe.message:String(pe)}`,kind:"danger"})}finally{pt.value=!1}}}const it=S("");async function Rt(z){if(!it.value){it.value=z.id;try{const W=await yo({profileId:z.id,model:z.model});W.ok?he.add({title:`「${z.name||z.model}」连通正常`,description:`首响应 ${W.latencyMs}ms · ${W.model}`,kind:"success"}):he.add({title:`「${z.name||z.model}」探测失败`,description:W.error||"端点无响应",kind:"warning"})}catch(W){he.add({title:"探测请求失败",description:W.message||String(W),kind:"warning"})}finally{it.value=""}}}async function Et(){if(!p.value?.model?.trim()){g.value={ok:!1,message:"请先选择或填写模型标识(点输入框右侧按钮可从供应商拉取列表)"};return}_.value=!0,g.value=null;try{const z=p.value,W=await yo({profileId:z?.id||void 0,providerId:z&&z.providerId||X.value?.id,model:z?.model?.trim()});g.value=W.ok?{ok:!0,message:`连通性正常:${W.model} @ ${W.endpoint}(首响应 ${W.latencyMs}ms)`}:{ok:!1,message:`探测失败(${W.latencyMs}ms):${W.error||"端点无响应"}`}}catch(z){g.value={ok:!1,message:`探测失败: ${z.message||String(z)}`}}finally{_.value=!1}}function U(z){const W=p.value;if(!W)return;const ae=W.capabilities||{},pe=new Set(ae.inputModalities||["text"]);pe.has(z)?pe.delete(z):pe.add(z),pe.add("text"),p.value={...W,capabilities:{...ae,inputModalities:[...pe]}}}function de(){const z=p.value;if(!z)return;const W=z.capabilities||{},ae=!W.reasoning?.supported;p.value={...z,capabilities:{...W,reasoning:ae?{supported:!0,supportedEfforts:["low","medium","high"],defaultEffort:"medium"}:{supported:!1}}}}function Me(){const z=p.value;if(!z)return;const W=z.capabilities||{},ae=new Set(W.supportedParameters||["temperature"]);ae.has("tools")?ae.delete("tools"):ae.add("tools"),p.value={...z,capabilities:{...W,supportedParameters:[...ae]}}}return{availableModels:t,activeModel:n,activeModelObj:y,activeModelCapabilities:$,supportsImageInput:D,reasoningEffort:te,setReasoningEffort:ne,migrateSessionEffort:V,reasoningEffortOptions:N,defaultModelId:a,resetModelToDefault:ie,isModelSettingsOpen:s,providers:o,modelProfiles:i,selectedProviderId:l,isCreatingProvider:d,currentProvider:X,currentProviderModels:O,providerForm:u,modelDraft:p,isCreatingModel:v,showApiKey:b,isTestingConnection:_,isDiscovering:m,testStatus:g,discoveredModels:k,discoveredItems:x,loadProviders:J,fetchModelProfiles:Z,openModelSettings:le,closeModelSettings:T,selectProvider:P,startCreateProvider:L,onProviderKindChange:q,saveProvider:fe,deleteProvider:we,startCreateModel:De,editModel:ge,cancelModelEdit:ee,saveModel:Ue,deleteModel:bt,isVerifyingCapabilities:pt,capabilityVerdicts:Ye,verifyCapabilities:Nt,discoverModels:me,applyDetected:Je,selectDiscoveredModel:Ut,discoveredForProvider:w,testProfileConnection:Rt,testingProfileId:it,testModelConnection:Et,toggleModality:U,toggleReasoning:de,toggleToolUse:Me}}function kC(e,t){const n=[];let a=0;const s=t.filter(o=>typeof o.data?.contentOffset=="number").sort((o,i)=>o.data.contentOffset-i.data.contentOffset);for(const o of s){const i=Math.min(Math.max(o.data.contentOffset,0),e.length);i>a&&n.push({kind:"text",content:e.slice(a,i)}),n.push({kind:"card",cardId:o.id}),a=Math.max(a,i)}(e.length>a||n.length===0)&&n.push({kind:"text",content:e.slice(a)});for(const o of t)typeof o.data?.contentOffset!="number"&&n.push({kind:"card",cardId:o.id});return n}function bC(e){const{chat:t}=e,n=S([]),a=S(""),s=R(()=>n.value.filter(m=>!m.archived&&m.status!=="archived")),o=R(()=>n.value.filter(m=>m.archived||m.status==="archived")),i=S(!1);async function l(m){const k=m?.silent??n.value.length>0;k||(i.value=!0);try{const w=await wy();w&&(n.value=w)}catch(w){console.error("加载会话失败:",w)}finally{k||(i.value=!1)}}async function d(m){try{const k=await $y(m);return k&&(n.value.unshift(k),a.value=k.id),k}catch(k){return console.error("创建会话记录失败:",k),null}}async function u(m){a.value&&t.chatTurns.value.length>0&&t.sessionTurnsCache.set(a.value,[...t.chatTurns.value]),a.value=m.id,e.activeWorkspaceId.value=m.workspaceId,e.isNewChat.value=!1,e.activePermission.value=m.permission||"review",t.planSteps.value=[],t.contextUsed.value=0,t.sessionTokensUsed.value=t.sessionTokensUsedMap.get(m.id)??0;const k=!!t.sessionRunningMap.get(m.id);if(t.sessionTurnsCache.has(m.id)&&k){t.chatTurns.value=t.sessionTurnsCache.get(m.id),t.isRunning.value=!0,t.activeAbortController.value=t.sessionAbortControllers.get(m.id)||null,e.scrollToBottom({force:!0});return}try{const w=await xy(m.id);if(w){const x=[];if(w.turns&&w.turns.length>0){t.sessionTokensUsed.value=0;for(const y of w.turns){const $=y.telemetry?.totalTokens;if(typeof $=="number"&&$>0&&(t.sessionTokensUsed.value+=$),y.role)x.push({id:y.id||`turn-${Date.now()}`,role:y.role,content:y.content||"",thought:y.thought||"",thoughtExpanded:!1,thoughtDuration:y.thoughtDuration||0,cards:y.cards||[],timestamp:y.timestamp||Date.now()});else{const D=y.telemetry?.contextTokens;typeof D=="number"&&D>0&&(t.contextUsed.value=D),y.prompt&&x.push({id:`turn-user-${y.id}`,role:"user",content:y.prompt,...Array.isArray(y.attachments)&&y.attachments.length?{attachments:y.attachments}:{},timestamp:y.createdAt||Date.now()});let M=y.content;if(!M&&y.checkpoints&&y.checkpoints.length>0){const K=y.checkpoints[y.checkpoints.length-1];if(K&&Array.isArray(K.messagesSnapshot)){const te=[...K.messagesSnapshot].reverse().find(ne=>ne.role==="assistant"&&ne.content);te&&(M=te.content)}}M||(y.status==="error"?M="⚠️ *(此轮执行遇到错误或被中止)*":M=`*(本轮任务已执行完毕${y.telemetry?.durationMs?`,耗时 ${Math.round(y.telemetry.durationMs/100)/10}s`:""})*`);const N=(y.cards||[]).map(K=>K.type==="ui"&&K.data?.component==="ui_form"?{id:K.data.actionId||K.id,type:"form",data:{actionId:K.data.actionId,toolName:"ui_form",formArgs:K.data.props||{},status:K.data.status||"done"}}:K.type==="toolcall"&&(K.data?.status==="streaming"||K.data?.status==="executing")?{...K,data:{...K.data,status:"error",error:"执行被中止"}}:K);x.push({id:`turn-asst-${y.id}`,role:"assistant",content:M,thought:y.thought||"",thoughtExpanded:!1,thoughtDuration:y.telemetry?.durationMs?Math.round(y.telemetry.durationMs/100)/10:0,cards:N,blocks:kC(M,N),abortedReason:y.abortedReason??(y.errorMessage==="process_restart"?"process_restart":void 0),trajEvents:y.telemetry?.events||[],timestamp:y.completedAt||y.createdAt||Date.now()}),y.plan?.steps&&(t.planSteps.value=y.plan.steps)}}}if(w.isRunning){t.sessionRunningMap.set(m.id,!0),t.isRunning.value=!0;const y=w.activeRun?.prompt||"正在后台执行的任务…";x.push({id:`turn-user-live-${Date.now()}`,role:"user",content:y,timestamp:w.activeRun?.startedAt||Date.now()});const $={id:`turn-asst-live-${Date.now()}`,role:"assistant",content:"",thought:"",thoughtExpanded:!0,thoughtDuration:0,isStreaming:!0,cards:[],blocks:[],timestamp:Date.now()};x.push($),t.chatTurns.value=x,t.sessionTurnsCache.set(m.id,t.chatTurns.value);const D=t.chatTurns.value[t.chatTurns.value.length-1];t.connectToSessionStream(m.id,D,!1)}else t.sessionRunningMap.set(m.id,!1),t.isRunning.value=!1,x.length===0&&x.push({id:`turn-seed-${m.id}`,role:"assistant",content:`已加载会话「${m.title}」。工作区绑定至 \`${e.getWorkspaceRootPath()}\`。随时可以输入任务指令或向 Agent 提问。`,timestamp:m.updatedAt}),t.chatTurns.value=x,t.sessionTurnsCache.set(m.id,t.chatTurns.value)}}catch(w){console.error("加载会话详情失败:",w)}e.scrollToBottom({force:!0})}async function p(m,k){try{await Qt(m,{archived:k,status:k?"archived":"active"});const w=n.value.find(x=>x.id===m);w&&(w.archived=k,w.status=k?"archived":"active")}catch(w){console.error("归档操作失败:",w)}}async function v(m){const k=n.value.find(x=>x.id===m);if(!k)return;const w=!k.pinned;try{await Qt(m,{pinned:w}),k.pinned=w}catch(x){console.error("置顶操作失败:",x)}}async function b(m,k){const w=k.trim();if(w)try{if(await Qt(m,{title:w})){const y=n.value.find($=>$.id===m);y&&(y.title=w)}}catch(x){console.error("重命名会话失败:",x)}}async function _(m){const k=n.value.find(x=>x.id===m);await dt({title:"删除这个会话?",description:`「${k?.title||"未命名会话"}」的全部消息与工具调用记录将被清除,此操作不可撤销。`,confirmText:"删除",tone:"danger",icon:!0})&&await g(m)}async function g(m){try{await Cy(m),n.value=n.value.filter(k=>k.id!==m),a.value===m&&e.onActiveDeleted()}catch(k){console.error("删除会话失败:",k)}}return{sessions:n,activeSessionId:a,activeSessions:s,archivedSessions:o,fetchSessions:l,sessionsLoading:i,createSessionForPrompt:d,selectSession:u,renameSession:b,toggleArchiveSession:p,togglePinSession:v,askDeleteSession:_,deleteSession:g}}function yC(e={}){const t=S([]),n=S(""),a=R(()=>t.value.find(v=>v.id===n.value)||t.value[0]||null);async function s(){try{const v=await gy();v&&(t.value=v,t.value.length>0&&!n.value&&(n.value=t.value[0].id))}catch(v){console.error("加载工作区失败:",v)}}function o(v){n.value=v,e.onWorkspaceActivated?.()}async function i(){e.closeMenus?.();try{const v=await yy();if(!v)throw new Error("系统选择框调用失败");if(v.cancelled)return;await s(),v.id&&o(v.id)}catch(v){console.warn("系统文件夹选择降级:",v);const b=await $2({title:"手动输入工作区路径",description:"系统文件夹选择框不可用,请输入本地项目文件夹的绝对路径。",placeholder:"/Users/username/project",confirmText:"创建"});if(b&&b.trim())try{const _=await ky({name:b.split("/").filter(Boolean).pop()||"workspace",rootPath:b.trim(),permission:"read-write"});_&&(await s(),o(_.id))}catch(_){he.add({title:"创建工作区失败",description:String(_),kind:"danger"})}}}function l(v){n.value=v,e.closeWorkspaceMenu?.()}async function d(v){const b=t.value.find(g=>g.id===v);await dt({title:"删除这个工作区?",description:`「${b?.name||"未命名工作区"}」及其下的全部会话将被删除,此操作不可撤销。`,confirmText:"删除",tone:"danger",icon:!0})&&await u(v)}async function u(v){try{await by(v)&&(t.value=t.value.filter(_=>_.id!==v),n.value===v&&(n.value=t.value[0]?.id||""),await e.refreshSessions?.())}catch(b){console.error("删除工作区失败:",b)}}async function p(){if(!n.value){if(t.value.length>0)n.value=t.value[0].id;else if(await i(),!n.value)return!1}return!0}return{workspaces:t,activeWorkspaceId:n,currentWorkspace:a,fetchWorkspaces:s,pickAndCreateWorkspace:i,activateWorkspace:o,selectWorkspace:l,askDeleteWorkspace:d,deleteWorkspace:u,ensureActiveWorkspace:p}}const wC={"24h":24*36e5,"7d":168*36e5,"30d":720*36e5};function xC(e){return e+864e5}function $C(e={}){const t=S("24h"),n=S(null),a=R(()=>{const x=e.getSessionId?.()??"";return x?n.value?.bySession[x]??null:null}),s=S(null),o=S(null),i=S(null),l=S({windowTokenLimit:0,windowUsdLimit:0,windowMs:864e5}),d=S(!1),u=S(null),p=R(()=>s.value!=null&&o.value!=null),v=R(()=>Object.entries(i.value?.byModel??{}).map(([x,y])=>({label:x,value:y.tokens})).sort((x,y)=>y.value-x.value));async function b(){d.value=!0;try{i.value=p.value?await ha({since:s.value,until:xC(o.value)}):await ha({windowMs:wC[t.value]}),g(),_()}finally{d.value=!1}}async function _(){n.value=await Vy().catch(()=>null)}async function g(){const x=l.value.windowTokenLimit>0||l.value.windowUsdLimit>0;u.value=x?await ha({windowMs:l.value.windowMs}):null}function m(x){t.value=x,s.value=null,o.value=null,b()}function k(x,y){s.value=x,o.value=y,b()}async function w(){l.value=await Jy(),await g()}return{preset:t,customStart:s,customEnd:o,isCustom:p,summary:i,limits:l,quotaUsage:u,loading:d,byModelTokens:v,sessionCosts:n,currentSessionCost:a,refresh:b,setPreset:m,setCustomRange:k,refreshLimits:w}}const CC={class:"va-console"},AC={class:"va-console__main"},DC={class:"va-console__mention",role:"listbox","aria-label":"引用工作区文件"},RC={key:0,class:"va-console__mention-loading"},EC=["aria-selected","onMouseenter","onClick"],SC={class:"va-console__mention-path"},MC={key:2,class:"va-console__mention-empty"},TC={key:0,class:"va-console__welcome-view"},FC={class:"va-console__welcome-hero"},IC={class:"va-console__welcome-composer-box"},BC={class:"va-console__seat-btn",type:"button"},zC={class:"va-console__seat-text"},PC={class:"va-console__seat-text",title:"会话累计消耗(计费口径:Σ各步 prompt+completion,含压缩前所有轮次)"},LC={class:"va-console__ctx-panel"},OC={class:"va-console__suggestions"},jC={key:1,class:"va-console__chat-layout"},UC={class:"va-console__chat-view"},NC={class:"va-console__stream-wrap"},qC={class:"va-console__traj-view"},WC={key:1,class:"va-console__traj-empty"},VC={class:"va-console__bottom-composer"},JC={class:"va-console__seat-btn",type:"button"},KC={class:"va-console__seat-text"},HC={class:"va-console__seat-text",title:"会话累计消耗(计费口径:Σ各步 prompt+completion,含压缩前所有轮次)"},ZC={class:"va-console__ctx-panel"},XC={key:0,class:"va-console__rsb-badge","aria-label":"待审批数"},Io=48*1024,GC=5*1024*1024,Bo=4,QC=ce({__name:"Console",setup(e){const t=S(!0),n=S("chat"),a=S(!0),s=S(""),o=S("review"),i=S(o.value),l=U2,{tools:d,toolsLoading:u,toolsError:p,fetchTools:v,onToggleTool:b,configLoading:_,configError:g,configNs:m,fetchConfig:k,onConfigPatch:w,onConfigReset:x}=rC({defaultPermission:o,activePermission:i,isNewChat:t}),y=Re("chatScrollRef"),$=Re("composerRef"),{isPinned:D,onScroll:M,scrollToBottom:N}=g0(y),K=yC({refreshSessions:()=>te.fetchSessions(),onWorkspaceActivated:()=>Vt()});let te;const ne=gC({getSessionId:()=>te?.activeSessionId?.value??""}),V=mC({getActiveSessionId:()=>te.activeSessionId.value,refreshSessions:()=>te.fetchSessions({silent:!0}),scrollToBottom:N});te=bC({chat:V,isNewChat:t,activeWorkspaceId:K.activeWorkspaceId,activePermission:i,getWorkspaceRootPath:()=>K.currentWorkspace.value?.rootPath||"",scrollToBottom:N,onActiveDeleted:()=>Vt()});const X=S([]);let O;function J(F){const I=Object.entries(F).map(([re,$e])=>`${re}: ${typeof $e=="string"?$e:JSON.stringify($e)}`).join(", ");return I.length>120?`${I.slice(0,120)}…`:I||"(无参数)"}async function Z(){try{const F=await jy();X.value=(F||[]).map((E,I)=>{if(E.toolName==="ui_form"){const re=typeof E.args?.title=="string"?E.args.title:"";return{id:E.actionId,title:re?`表单待填写:${re}`:"表单待填写",detail:"请在对应会话中填写并提交表单(取消/超时按用户放弃处理)",collapsed:I!==0}}return{id:E.actionId,title:`${E.toolName} 请求执行`,detail:J(E.args),primary:"批准执行",secondary:"驳回",collapsed:I!==0}})}catch(F){console.error("拉取待审批列表失败:",F)}}async function Y(F,E){await ie(F.id,E==="primary"),he.add({title:E==="primary"?"已批准执行":"已驳回操作",description:F.title,kind:E==="primary"?"success":"warning"}),await Z()}const{submitApproval:ie}=lC({chatTurns:V.chatTurns,sessionTurnsCache:V.sessionTurnsCache}),{workspaces:le,activeWorkspaceId:T,activateWorkspace:P,fetchWorkspaces:L,pickAndCreateWorkspace:q,askDeleteWorkspace:fe,ensureActiveWorkspace:we}=K,{availableModels:De,activeModel:ge,isModelSettingsOpen:ee,providers:Ue,selectedProviderId:bt,isCreatingProvider:me,currentProvider:Je,currentProviderModels:Ut,providerForm:pt,modelDraft:Ye,isCreatingModel:Nt,showApiKey:it,isTestingConnection:Rt,isDiscovering:Et,isVerifyingCapabilities:U,capabilityVerdicts:de,verifyCapabilities:Me,testStatus:z,discoveredModels:W,discoveredItems:ae,activeModelObj:pe,supportsImageInput:Ke,reasoningEffort:Te,setReasoningEffort:vn,migrateSessionEffort:qn,reasoningEffortOptions:qe,fetchModelProfiles:Oi,resetModelToDefault:ji,openModelSettings:Ui,closeModelSettings:qa,selectProvider:Ni,startCreateProvider:qi,onProviderKindChange:Wi,saveProvider:Vi,deleteProvider:Ji,startCreateModel:Ki,editModel:Hi,cancelModelEdit:Zi,saveModel:Xi,deleteModel:Gi,discoverModels:Yi,selectDiscoveredModel:Qi,testModelConnection:el,testProfileConnection:tl,testingProfileId:nl,toggleModality:al,toggleReasoning:sl,toggleToolUse:ol}=ne,Wn=S("models");function il(F="models"){Wn.value=F,Ui()}const{sessions:He,sessionsLoading:ll,activeSessionId:lt,fetchSessions:rl,createSessionForPrompt:ul,selectSession:Vn,renameSession:cl,toggleArchiveSession:dl,togglePinSession:fl,askDeleteSession:vl}=te,Jn=$C({getSessionId:()=>te?.activeSessionId?.value??""}),pl=Hl(),yt=S(!1);function Wa(F){(F.metaKey||F.ctrlKey)&&(F.key==="k"||F.key==="K")&&(F.preventDefault(),yt.value=!yt.value)}const hl=R(()=>{const F=[];F.push({id:"new-chat",label:"新建会话",group:"会话"});for(const I of He.value.filter(re=>!re.archived&&re.status!=="archived").slice(0,8))F.push({id:`session:${I.id}`,label:`打开会话:${I.title}`,group:"会话",keywords:I.title});for(const I of le.value)F.push({id:`ws:${I.id}`,label:`切换工作区:${I.name}`,group:"工作区",keywords:I.name});for(const I of l)F.push({id:`perm:${I.id}`,label:`权限档:${I.label}`,group:"权限",keywords:I.id});const E=[["light","亮色"],["dark","暗色"],["system","跟随系统"]];for(const[I,re]of E)F.push({id:`theme:${I}`,label:`主题:${re}`,group:"外观"});return F.push({id:"open-settings",label:"打开设置",group:"操作"}),F.push({id:"usage-panel",label:"展开右侧用量面板",group:"操作"}),F.push({id:"compact",label:"压缩当前会话上下文",group:"操作",disabled:t.value||rt.value}),F.push({id:"stop",label:"中止当前运行",group:"操作",danger:!0,disabled:!rt.value}),F});function _l(F){const E=F.id;if(E==="new-chat")Vt();else if(E.startsWith("session:")){const I=He.value.find(re=>re.id===E.slice(8));I&&Vn(I)}else E.startsWith("ws:")?Vt(E.slice(3)):E.startsWith("perm:")?oa(E.slice(5)):E.startsWith("theme:")?pl.setPreference(E.slice(6)):E==="open-settings"?ee.value=!0:E==="usage-panel"?a.value=!1:E==="compact"?sa():E==="stop"&&Xa();yt.value=!1}const St=S([]),Kn=S(!1);function Va(F){St.value.unshift(F),St.value.length>20&&(St.value.length=20)}const Ja=new Set;ve(X,F=>{for(const E of F){const I=String(E.id);!I||Ja.has(I)||(Ja.add(I),Va({id:`approval-${I}`,title:"待审批决策",body:E.detail||E.title||"有操作等待你的批准",kind:"warning",createdAt:Date.now(),unread:!0}),Kn.value=!0)}},{deep:!0});const Ka=new Map;ve(()=>[...V.sessionRunningMap.entries()],F=>{for(const[E,I]of F){const re=Ka.get(E);if(Ka.set(E,I),re===!0&&I===!1&&E!==lt.value){const $e=He.value.find(Fe=>Fe.id===E);Va({id:`done-${E}`,title:"任务已结束",body:`会话「${$e?.title??E}」运行完成,点击查看`,kind:"success",createdAt:Date.now(),unread:!0})}}});function ml(F){if(F.unread=!1,F.id.startsWith("approval-"))a.value=!1;else if(F.id.startsWith("done-")){const E=He.value.find(I=>I.id===F.id.slice(5));E&&Vn(E)}}function gl(F){const E=St.value.find(I=>I.id===F);E&&(E.unread=!1)}function kl(){for(const F of St.value)F.unread=!1}const{chatTurns:wt,planSteps:bl,isPlanVisible:yl,isPlanExpanded:Hn,completedStepsCount:wl,currentRunningStep:xl,isRunning:rt,sessionRunningMap:$l,contextUsed:pn,contextLimit:hn,sessionTokensUsed:Ha,ctxParts:Zn,resetTurns:Cl,sendPrompt:Za,stopExecution:Xa}=V,Ga=R(()=>De.value.map(F=>({id:F.id,label:F.label,meta:F.meta,provider:F.provider,model:F.model}))),Ya=R(()=>l.map(F=>({id:F.id,label:F.label,desc:F.desc}))),Qa=R(()=>Zn.value.length>0?Zn.value:[{id:"history",label:"对话历史",tokens:pn.value,kind:"history"}]),qt=S(!1),Qe=S([]),Xn=new Map;function Al(F){const E={id:`q-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,text:F};return Qe.value.push(E),he.add({title:"已加入队列",description:"当前会话运行中,结束后自动发送",kind:"info"}),E}function Gn(F){const E=Xn.get(F);return E&&Xn.delete(F),E}function Dl(F){const[E]=Qe.value.splice(F,1),I=E?Gn(E.id):void 0;I&&ma(I)}function Rl(F){const[E]=Qe.value.splice(F,1);if(E){if(!rt.value){Jt(E.text,E.id);return}Qe.value.unshift(E)}}function El(F,E){Qe.value[F]&&(Qe.value[F].text=E)}ve(rt,(F,E)=>{if(E===!0&&F===!1&&Qe.value.length>0&&!t.value){const I=Qe.value.shift();I&&setTimeout(()=>{Jt(I.text,I.id)},400)}});const Ze=S(!1),Yn=S(""),Wt=S([]),Qn=S(!1),xt=S(0),ea=new Set;let es="";const _n=R(()=>{const F=Yn.value.toLowerCase();return(F?Wt.value.filter(I=>I.toLowerCase().includes(F)):Wt.value).slice(0,50)}),Sl=R(()=>Ze.value?Ml():null);function Ml(){for(const F of Array.from(document.querySelectorAll(".va-console__main .va-cmp")))if(F.offsetParent!==null)return F;return null}async function ts(F){if(!(!F||es===F)){Qn.value=!0;try{const E=await Fi(F),I=[],re=$e=>{for(const Fe of $e??[])Fe.type==="dir"&&Array.isArray(Fe.children)?re(Fe.children):I.push(Fe.path)};re(E?.tree??[]),Wt.value=I,es=F}finally{Qn.value=!1}}}ve(s,F=>{const E=/(?:^|\s)@([^\s@]*)$/.exec(F);E&&T.value?(Yn.value=E[1]??"",Ze.value||(Ze.value=!0,xt.value=0,ts(T.value))):Ze.value&&(Ze.value=!1)});function ns(F){s.value=s.value.replace(/(?:^|\s)@([^\s@]*)$/,E=>E.startsWith("@")?`@${F} `:` @${F} `),ea.add(F),Ze.value=!1,$.value?.focus()}function as(){const F=s.value;/@([^\s@]*)$/.test(F)?(Yn.value="",Ze.value=!0):s.value=F&&!F.endsWith(" ")&&!F.endsWith(`
|
|
45
|
+
`)?`${F} @`:`${F}@`,ts(T.value),Se(()=>$.value?.focus())}function ss(F){if(!Ze.value)return;const E=_n.value.length;if(F.key==="ArrowDown"||F.key==="ArrowUp"){F.preventDefault(),F.stopImmediatePropagation();const I=F.key==="ArrowDown"?1:-1;xt.value=E>0?(xt.value+I+E)%E:0}else if(F.key==="Enter"||F.key==="Tab"){const I=_n.value[xt.value];I&&(F.preventDefault(),F.stopImmediatePropagation(),ns(I))}else F.key==="Escape"&&(F.preventDefault(),F.stopImmediatePropagation(),Ze.value=!1)}const We=S([]),ta=new Map,na=new Map,mn=new Map;function aa(){return{atts:We.value,texts:ta,images:na,files:mn}}const Tl=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function os(F){for(const E of F.slice(0,6)){const I=`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,re=E.type.startsWith("image/");if(re&&!Ke.value){he.add({title:"当前模型未声明支持图片输入",description:"在「模型设置 → 能力标记」中勾选图片后即可上传",kind:"warning"});continue}if(re){if(!Tl.has(E.type)){he.add({title:`不支持的图片类型 ${E.type||"(未知)"}`,description:"支持 png / jpeg / webp / gif",kind:"warning"});continue}if(E.size>GC){he.add({title:`图片「${E.name}」超过 5MB 上限`,kind:"warning"});continue}if(We.value.filter(Fe=>Fe.kind==="image").length>=Bo){he.add({title:`单轮最多 ${Bo} 张图片`,kind:"warning"});continue}}if(We.value.push({id:I,name:E.name,size:E.size,kind:re?"image":"file",previewUrl:re?URL.createObjectURL(E):void 0}),re){mn.set(I,E),Pi(I,E,na,mn);continue}const $e=new FileReader;$e.onload=()=>{if(!We.value.some(kn=>kn.id===I))return;let Fe=String($e.result??"");Fe.length>Io&&(Fe=`${Fe.slice(0,Io)}
|
|
46
|
+
…(超出 48KB 已截断)`),ta.set(I,Fe)},$e.readAsText(E)}}function Fl(){ma(aa()),We.value=[]}function is(F){const E=We.value.find(I=>I.id===F);E?.previewUrl&&URL.revokeObjectURL(E.previewUrl),ta.delete(F),na.delete(F),mn.delete(F),We.value=We.value.filter(I=>I.id!==F)}async function sa(){if(qt.value)return;const F=lt.value;if(!F||t.value){he.add({title:"新会话暂无历史可压缩",kind:"info"});return}if(rt.value){he.add({title:"会话执行中,请等待本轮结束后再压缩",kind:"warning"});return}qt.value=!0;try{const E=await Ay(F);if(!E.compacted){he.add({title:"历史较少,暂无需压缩",description:`当前占用 ${Oe(E.totalTokens)} tokens`,kind:"info"});return}pn.value=E.totalTokens,Zn.value=E.parts?.length?E.parts:[{id:"history",label:"对话历史",tokens:E.totalTokens,kind:"history"}],he.add({title:`已压缩,释放 ${Oe(E.freed)} tokens`,description:`${E.compactedTurnCount} 轮早期历史已折叠为摘要`,kind:"success"})}catch(E){he.add({title:"压缩失败",description:E instanceof Error?E.message:String(E),kind:"danger"})}finally{qt.value=!1}}const Il=R(()=>le.value.map(F=>({id:F.id,name:F.name,path:F.rootPath})));function Bl(F){P(F)}const ls=R(()=>wt.value.flatMap(F=>F.trajEvents||[])),zl=R(()=>wt.value.flatMap((F,E)=>{if(F.role!=="user")return[];const I=wt.value[E+1],re=(F.content||"").replace(/\s+/g," ").trim(),$e=F.attachments?.length??0,Fe=re?re.length>48?`${re.slice(0,48)}…`:re:$e?`[附件 ×${$e}]`:"(空消息)";return[{id:F.id,label:Fe,role:"user",status:I?.role==="assistant"&&I.isStreaming?"streaming":void 0}]}));ve(()=>pe.value?.contextWindow,F=>{F&&(V.contextLimit.value=F)},{immediate:!0}),Le(async()=>{he.state.toasts=[],window.addEventListener("keydown",Wa),window.addEventListener("keydown",ss,!0),await Z(),O=setInterval(()=>{Z()},1e4),await k(),await L(),await rl(),await Oi(),v(),Jn.refresh(),Jn.refreshLimits();const F=He.value.find(E=>E.isRunning);F&&await rs(F)}),Oo(()=>{window.removeEventListener("keydown",Wa),window.removeEventListener("keydown",ss,!0),O!==void 0&&clearInterval(O)});function Pl(F,E){F!==null&&he.add({title:F==="up"?"感谢认可!":"已记录反馈",description:E,kind:"success"})}function Ll(F){if(rt.value)return;const E=wt.value.findIndex(re=>re.id===F);if(E<0)return;let I="";for(let re=E-1;re>=0;re--)if(wt.value[re].role==="user"){I=wt.value[re].content;break}!I||!lt.value||Za(I,{sessionId:lt.value,workspaceId:T.value,modelProfileId:ge.value,permission:i.value,reasoningEffort:Te.value||void 0})}function Vt(F){F&&(T.value=F),lt.value="",t.value=!0,n.value="chat",i.value=o.value,ji(),Cl(),s.value="",Se(()=>$.value?.focus())}async function rs(F){n.value="chat",await Vn(F);const E=F.activeModelProfileId;E&&De.value.some(I=>I.id===E)&&(ge.value=E)}async function oa(F){i.value=F;const E=lt.value;if(!(!E||t.value))try{const I=await Qt(E,{permission:F});if(I){const re=He.value.findIndex($e=>$e.id===E);re>=0&&(He.value[re]=I)}}catch(I){console.error("持久化权限模式失败:",I)}}async function us(F){ge.value=F;const E=lt.value;if(!(!E||t.value))try{const I=await Qt(E,{activeModelProfileId:F});if(I){const re=He.value.findIndex($e=>$e.id===E);re>=0&&(He.value[re]=I)}}catch(I){console.error("持久化模型档失败:",I)}}async function Jt(F,E){if(rt.value){const Ie=(F??s.value).trim();if(!Ie)return;const cs=E?Gn(E):F?void 0:sC(aa()),Ul=Al(Ie);cs&&(Xn.set(Ul.id,cs),!E&&!F&&(We.value=[]));return}let I=(F??s.value).trim();const re=[...ea].filter(Ie=>I.includes(`@${Ie}`));if(re.length>0){I+=re.map(Ie=>`
|
|
47
|
+
|
|
48
|
+
[@引用文件] ${Ie}`).join("");for(const Ie of re)ea.delete(Ie)}const $e=E?Gn(E):void 0,Fe=$e??aa(),kn=!!F&&!$e,Ol=kn?void 0:await iC(Fe),jl=kn?void 0:oC(Fe);if(!F&&We.value.length>0){const Ie=So(Fe);I=I?`${Ie}${I}`:Ie.trim(),Fl()}else if($e){const Ie=So($e);Ie&&(I=I?`${Ie}${I}`:Ie.trim()),ma($e)}if(!I||!await we())return;let ia=lt.value;if(t.value||!ia){const Ie=await ul({workspaceId:T.value,title:I.slice(0,24),activeModelProfileId:ge.value,permission:i.value});Ie&&(ia=Ie.id,t.value=!1,qn("",Ie.id))}s.value="",n.value="chat",await Za(I,{sessionId:ia,workspaceId:T.value,modelProfileId:ge.value,permission:i.value,reasoningEffort:Te.value||void 0,images:Ol,attachments:jl})}function gn(F){s.value=F,Jt()}return(F,E)=>(f(),h("div",CC,[B(Qb,{workspaces:r(le),sessions:r(He),loading:r(ll)&&r(He).length===0,"active-workspace-id":r(T),"active-session-id":r(lt),"is-new-chat":t.value,"session-running-map":r($l),onStartNewChat:Vt,onSelectSession:rs,onPickWorkspace:r(q),onDeleteWorkspace:r(fe),onRenameSession:r(cl),onToggleArchive:r(dl),onTogglePin:r(fl),onDeleteSession:r(vl),onOpenSettings:il,notifications:St.value,"notif-open":Kn.value,"onUpdate:notifOpen":E[0]||(E[0]=I=>Kn.value=I),onOpenNotification:ml,onReadNotification:gl,onAllRead:kl},null,8,["workspaces","sessions","loading","active-workspace-id","active-session-id","is-new-chat","session-running-map","onPickWorkspace","onDeleteWorkspace","onRenameSession","onToggleArchive","onTogglePin","onDeleteSession","notifications","notif-open"]),c("main",AC,[B(r(ft),{open:Ze.value,"onUpdate:open":E[1]||(E[1]=I=>Ze.value=I),anchor:Sl.value,placement:"top-start",offset:6,"close-on-outside-click":!0,"close-on-escape":!1},{default:oe(()=>[c("div",DC,[Qn.value?(f(),h("div",RC,[(f(),h(j,null,Q(3,I=>B(r(ct),{key:I,height:22,radius:"6px",width:I===2?"84%":"100%"},null,8,["width"])),64))])):_n.value.length>0?(f(!0),h(j,{key:1},Q(_n.value,(I,re)=>(f(),h("button",{key:I,class:ue(["va-console__mention-item",{"va-console__mention-item--active":re===xt.value}]),type:"button",role:"option","aria-selected":re===xt.value,onMouseenter:$e=>xt.value=re,onClick:$e=>ns(I)},[c("span",SC,C(I),1)],42,EC))),128)):(f(),h("p",MC," 无匹配文件(输入 @路径关键词 过滤工作区文件) "))])]),_:1},8,["open","anchor"]),B(r(Kh),{open:yt.value,"onUpdate:open":E[2]||(E[2]=I=>yt.value=I),commands:hl.value,"trigger-label":"命令",hotkey:"⌘K","hide-trigger":"",onSelect:_l},null,8,["open","commands"]),t.value?(f(),h("section",TC,[c("div",FC,[B(r(pf),{workspaces:Il.value,title:"准备好开启新任务了吗?",description:"面向工程任务的自主 Agent 工作台:支持代码修改、工具执行与丰富场景卡片",onCreateSession:Bl,onCreateWorkspace:r(q)},null,8,["workspaces","onCreateWorkspace"]),c("div",IC,[B(r(ys),{ref_key:"composerRef",ref:$,text:s.value,"onUpdate:text":E[6]||(E[6]=I=>s.value=I),placeholder:"给 Agent 一个任务(如:重构认证模块并编写单元测试)…",disabled:r(rt),"max-height":180,models:Ga.value,model:r(ge),permissions:Ya.value,permission:i.value,attachable:"",attachments:We.value,"mention-paths":Wt.value,onSend:E[7]||(E[7]=()=>Jt()),"onUpdate:model":us,"onUpdate:permission":oa,onFilesSelected:os,onRemoveAttachment:is},{actions:oe(()=>[B(r(ft),{placement:"top-start",offset:8},{trigger:oe(()=>[c("button",BC,[B(r(vo),{size:12}),c("span",zC,"Context: "+C(r(Oe)(r(pn)))+" / "+C(r(Oe)(r(hn))),1),c("span",PC,"· Session: "+C(r(Oe)(r(Ha))),1),B(r(cn),{size:11})])]),default:oe(()=>[c("div",LC,[B(r(ps),{parts:Qa.value,capacity:r(hn),removable:!1,compacting:qt.value,onCompact:sa},null,8,["parts","capacity","compacting"])])]),_:1}),r(qe).length?(f(),H(Eo,{key:0,options:r(qe),"model-value":r(Te),onSelect:r(vn)},null,8,["options","model-value","onSelect"])):A("",!0)]),trailing:oe(()=>[B(bo,{"workspace-id":r(T),onRefFile:as,onClear:E[3]||(E[3]=I=>s.value=""),onInsert:E[4]||(E[4]=I=>s.value+=I),onOpenCommandMenu:E[5]||(E[5]=I=>yt.value=!0)},null,8,["workspace-id"])]),_:1},8,["text","disabled","models","model","permissions","permission","attachments","mention-paths"]),c("div",OC,[E[35]||(E[35]=c("span",{class:"va-console__sug-label"},"试着运行:",-1)),c("button",{class:"va-console__chip",type:"button",onClick:E[8]||(E[8]=I=>gn("重构 auth 认证模块,抽取 JWT 校验并编写单元测试"))}," 重构认证模块并补全测试 "),c("button",{class:"va-console__chip",type:"button",onClick:E[9]||(E[9]=I=>gn("分析项目中所有涉及文件修改的代码,做一次安全合规检查"))}," 代码安全与依赖审计 "),c("button",{class:"va-console__chip",type:"button",onClick:E[10]||(E[10]=I=>gn("创建端到端自动化测试脚本并生成报告"))}," 生成自动化测试用例 "),c("button",{class:"va-console__chip",type:"button",onClick:E[11]||(E[11]=I=>gn("请分析当前项目的架构设计、核心模块划分与潜在代码风险"))}," 分析项目架构与潜在风险 ")])])])])):(f(),h("div",jC,[c("section",UC,[B(r(Wo),{modelValue:n.value,"onUpdate:modelValue":E[12]||(E[12]=I=>n.value=I),options:[{value:"chat",label:"对话"},{value:"traj",label:"轨迹"}],"aria-label":"主区视图"},null,8,["modelValue"]),ye(c("div",NC,[c("div",{ref_key:"chatScrollRef",ref:y,class:"va-console__messages-stream",onScrollPassive:E[15]||(E[15]=(...I)=>r(M)&&r(M)(...I))},[B(Y$,{turns:r(wt),onApprove:E[13]||(E[13]=I=>r(ie)(I,!0)),onDeny:E[14]||(E[14]=(I,re)=>r(ie)(I,!1,re)),onRegenerate:Ll,onFeedback:Pl},null,8,["turns"])],544),B(r(Cb),{items:zl.value,container:y.value,class:"va-console__turn-rail"},null,8,["items","container"]),r(D)?A("",!0):(f(),h("button",{key:0,class:"va-console__scroll-bottom",type:"button",onClick:E[16]||(E[16]=I=>r(N)({force:!0}))},[B(r(Ab),{size:13}),E[36]||(E[36]=c("span",null,"回到底部",-1))]))],512),[[ga,n.value==="chat"]]),ye(c("div",qC,[ls.value.length>0?(f(),H(r(wa),{key:0,events:ls.value,"ledger-max-height":void 0,bordered:!1,"split-detail":""},null,8,["events"])):(f(),h("div",WC,[B(r(Nb),{size:20}),E[37]||(E[37]=c("p",null,"本轮会话还没有轨迹",-1)),E[38]||(E[38]=c("small",null,"发送任务后,执行步骤将实时显示在这里",-1))]))],512),[[ga,n.value==="traj"]]),r(yl)?(f(),H(k2,{key:0,steps:r(bl),completed:r(wl),running:r(xl),expanded:r(Hn),onToggle:E[17]||(E[17]=I=>Hn.value=!r(Hn))},null,8,["steps","completed","running","expanded"])):A("",!0),c("div",VC,[Qe.value.length>0?(f(),H(r(Lc),{key:0,class:"va-console__queuedock",items:Qe.value,onRemove:Dl,onSendNow:Rl,onEdit:El},null,8,["items"])):A("",!0),B(r(ys),{ref_key:"composerRef",ref:$,text:s.value,"onUpdate:text":E[21]||(E[21]=I=>s.value=I),placeholder:"继续指令或追问…",busy:r(rt),models:Ga.value,model:r(ge),permissions:Ya.value,permission:i.value,attachable:"",attachments:We.value,"mention-paths":Wt.value,onSend:E[22]||(E[22]=()=>Jt()),onStop:r(Xa),"onUpdate:model":us,"onUpdate:permission":oa,onFilesSelected:os,onRemoveAttachment:is},{actions:oe(()=>[B(r(ft),{placement:"top-start",offset:8},{trigger:oe(()=>[c("button",JC,[B(r(vo),{size:12}),c("span",KC,"Context: "+C(r(Oe)(r(pn)))+" / "+C(r(Oe)(r(hn))),1),c("span",HC,"· Session: "+C(r(Oe)(r(Ha))),1),B(r(cn),{size:11})])]),default:oe(()=>[c("div",ZC,[B(r(ps),{parts:Qa.value,capacity:r(hn),removable:!1,compacting:qt.value,onCompact:sa},null,8,["parts","capacity","compacting"])])]),_:1}),r(qe).length?(f(),H(Eo,{key:0,options:r(qe),"model-value":r(Te),onSelect:r(vn)},null,8,["options","model-value","onSelect"])):A("",!0)]),trailing:oe(()=>[B(bo,{"workspace-id":r(T),onRefFile:as,onClear:E[18]||(E[18]=I=>s.value=""),onInsert:E[19]||(E[19]=I=>s.value+=I),onOpenCommandMenu:E[20]||(E[20]=I=>yt.value=!0)},null,8,["workspace-id"])]),_:1},8,["text","busy","models","model","permissions","permission","attachments","mention-paths","onStop"])])]),a.value?(f(),H(r(Xo),{key:1,content:"展开侧栏",placement:"left"},{default:oe(()=>[c("button",{class:"va-console__rsb-reopen",type:"button","aria-label":"展开侧栏",onClick:E[24]||(E[24]=I=>a.value=!1)},[B(r(Sn),{size:15}),X.value.length>0?(f(),h("span",XC,C(X.value.length),1)):A("",!0)])]),_:1})):(f(),H(c2,{key:0,decisions:X.value,"workspace-id":r(T),usage:r(Jn),onDecide:Y,onCollapse:E[23]||(E[23]=I=>a.value=!0)},null,8,["decisions","workspace-id","usage"]))]))]),B(P2,{open:r(ee),"active-tab":Wn.value,"onUpdate:activeTab":E[34]||(E[34]=I=>Wn.value=I),onClose:r(qa)},{models:oe(()=>[B(gx,{providers:r(Ue),"selected-provider-id":r(bt),"is-creating-provider":r(me),"current-provider":r(Je),"current-provider-models":r(Ut),"provider-form":r(pt),"model-draft":r(Ye),"is-creating-model":r(Nt),"show-api-key":r(it),"is-testing-connection":r(Rt),"testing-profile-id":r(nl),onTestModel:r(tl),"is-discovering":r(Et),"test-status":r(z),"discovered-models":r(W),"discovered-items":r(ae),"is-verifying-capabilities":r(U),"capability-verdicts":r(de),onClose:r(qa),onSelectProvider:r(Ni),onCreateProvider:r(qi),onDeleteProvider:r(Ji),onCreateModel:r(Ki),onEditModel:r(Hi),onDeleteModel:r(Gi),onCancelModelEdit:r(Zi),onSaveProvider:r(Vi),onSaveModel:r(Xi),onTest:r(el),onDiscover:r(Yi),onSelectModel:r(Qi),onProviderKindChange:r(Wi),"onUpdate:showApiKey":E[25]||(E[25]=I=>it.value=I),onToggleModality:r(al),onToggleReasoning:r(sl),onToggleToolUse:r(ol),onVerifyCapabilities:r(Me)},null,8,["providers","selected-provider-id","is-creating-provider","current-provider","current-provider-models","provider-form","model-draft","is-creating-model","show-api-key","is-testing-connection","testing-profile-id","onTestModel","is-discovering","test-status","discovered-models","discovered-items","is-verifying-capabilities","capability-verdicts","onClose","onSelectProvider","onCreateProvider","onDeleteProvider","onCreateModel","onEditModel","onDeleteModel","onCancelModelEdit","onSaveProvider","onSaveModel","onTest","onDiscover","onSelectModel","onProviderKindChange","onToggleModality","onToggleReasoning","onToggleToolUse","onVerifyCapabilities"])]),interaction:oe(()=>[B(Ax)]),tools:oe(()=>[B(l$,{tools:r(d),loading:r(u),"load-error":r(p),onToggle:r(b)},null,8,["tools","loading","load-error","onToggle"])]),execution:oe(()=>[B(Dn,{namespace:r(m)("execution"),loading:r(_),"load-error":r(g),onPatch:E[26]||(E[26]=(I,re)=>r(w)("execution",I,re)),onReset:E[27]||(E[27]=I=>r(x)("execution"))},null,8,["namespace","loading","load-error"]),B(Dn,{namespace:r(m)("finops"),loading:r(_),"load-error":r(g),onPatch:E[28]||(E[28]=(I,re)=>r(w)("finops",I,re)),onReset:E[29]||(E[29]=I=>r(x)("finops"))},null,8,["namespace","loading","load-error"])]),security:oe(()=>[B(Dn,{namespace:r(m)("security"),loading:r(_),"load-error":r(g),onPatch:E[30]||(E[30]=(I,re)=>r(w)("security",I,re)),onReset:E[31]||(E[31]=I=>r(x)("security"))},null,8,["namespace","loading","load-error"])]),prompt:oe(()=>[B(Dn,{namespace:r(m)("prompt"),loading:r(_),"load-error":r(g),onPatch:E[32]||(E[32]=(I,re)=>r(w)("prompt",I,re)),onReset:E[33]||(E[33]=I=>r(x)("prompt"))},null,8,["namespace","loading","load-error"])]),_:1},8,["open","active-tab","onClose"]),B(r(sp)),B(r(zm)),B(A2)]))}});export{QC as default};
|