\n
\n '.concat(t,"\n
\n ").concat(n.map(e=>'\n
\n
\n \n ').concat(e.name||a,'\n
\n
').concat("number"==typeof e.value?e.value.toLocaleString():e.value,"\n
\n ")).join(""),'\n
\n Click for details • Scroll to zoom\n
\n
\n ')}}}),L=e=>{let t=[{type:"element-active"},{type:"element-highlight"}];return!1!==e.enableZoom&&t.push({type:"view-zoom"},{type:"element-single-selected",cfg:{start:[{trigger:"element:click",action:"element-single-selected:toggle"}]}}),e.enableBrush&&t.push({type:"brush-x",cfg:{showEnable:[{trigger:"plot:mouseenter",action:"cursor:crosshair"},{trigger:"plot:mouseleave",action:"cursor:default"}]}}),{interactions:t}},D=(e,t)=>e.onDataPointClick?{onReady:n=>{t.current=n,n.on("element:click",t=>{var n;let{data:a}=t;null===(n=e.onDataPointClick)||void 0===n||n.call(e,null==a?void 0:a.data,t)})}}:{},P=e=>{let{onZoomIn:t,onZoomOut:n,onReset:a,onToggleFullscreen:r,isFullscreen:o,showZoom:s=!0,showFullscreen:m=!0}=e;return(0,i.jsxs)("div",{className:"chart-toolbar flex items-center gap-1 absolute top-2 right-2 z-10 bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-gray-200 dark:border-gray-700",children:[s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(N.Z,{title:"Zoom In",children:(0,i.jsx)(k.ZP,{type:"text",size:"small",icon:(0,i.jsx)(l.Z,{}),onClick:t,className:"!w-7 !h-7 !p-0"})}),(0,i.jsx)(N.Z,{title:"Zoom Out",children:(0,i.jsx)(k.ZP,{type:"text",size:"small",icon:(0,i.jsx)(c.Z,{}),onClick:n,className:"!w-7 !h-7 !p-0"})}),(0,i.jsx)(N.Z,{title:"Reset View",children:(0,i.jsx)(k.ZP,{type:"text",size:"small",icon:(0,i.jsx)(d.Z,{}),onClick:a,className:"!w-7 !h-7 !p-0"})})]}),m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700 mx-0.5"}),(0,i.jsx)(N.Z,{title:o?"Exit Fullscreen":"Fullscreen",children:(0,i.jsx)(k.ZP,{type:"text",size:"small",icon:o?(0,i.jsx)(u.Z,{}):(0,i.jsx)(p.Z,{}),onClick:r,className:"!w-7 !h-7 !p-0"})})]})]})},M=e=>{var t;let{config:n,chartRef:a}=e,r=(0,h.useMemo)(()=>{var e;return{data:n.data,xField:n.xField||"x",yField:n.yField||"y",seriesField:n.seriesField,smooth:null===(t=n.smooth)||void 0===t||t,...I(n),...R(n.showGrid),...w(n.showLegend),...O(n),...L(n),...D(n,a),point:{size:3,shape:"circle",style:{fill:"#ffffff",stroke:(null===(e=n.colors)||void 0===e?void 0:e[0])||v[0],lineWidth:2,cursor:"pointer"}},lineStyle:{lineWidth:2.5},color:n.colors||v,slider:!1!==n.enableZoom?{start:0,end:1}:void 0}},[n,a]);return(0,i.jsx)(m.Z,{...r,height:n.height||300})},F=e=>{let{config:t,chartRef:n}=e,a=(0,h.useMemo)(()=>({data:t.data,xField:t.xField||"x",yField:t.yField||"y",seriesField:t.seriesField,...I(t),...R(t.showGrid),...w(t.showLegend),...O(t),...L(t),...D(t,n),columnWidthRatio:.6,columnStyle:{radius:[4,4,0,0],cursor:"pointer"},color:t.colors||v,label:{position:"top",style:{fill:"#6b7280",fontSize:10}},scrollbar:t.data.length>12?{type:"horizontal"}:void 0}),[t,n]);return(0,i.jsx)(g.Z,{...a,height:t.height||300})},U=e=>{let{config:t,chartRef:n}=e,a=(0,h.useMemo)(()=>({data:t.data,xField:t.yField||"y",yField:t.xField||"x",seriesField:t.seriesField,...I(t),...R(t.showGrid),...w(t.showLegend),...O(t),...L(t),...D(t,n),barWidthRatio:.6,barStyle:{radius:[0,4,4,0],cursor:"pointer"},color:t.colors||v,label:{position:"right",style:{fill:"#6b7280",fontSize:10}},scrollbar:t.data.length>10?{type:"vertical"}:void 0}),[t,n]);return(0,i.jsx)(E,{...a,height:t.height||300})},B=e=>{let{config:t,chartRef:n}=e,a="donut"===t.chartType,r=(0,h.useMemo)(()=>({data:t.data,angleField:t.angleField||t.yField||"value",colorField:t.colorField||t.xField||"type",...I(t),...w(t.showLegend),...O(t),...D(t,n),radius:.9,innerRadius:a?.6:0,color:t.colors||v,label:{type:"outer",content:"{name}: {percentage}",style:{fill:"#6b7280",fontSize:11}},pieStyle:{lineWidth:2,stroke:"#ffffff",cursor:"pointer"},statistic:a?{title:{style:{fontSize:"14px",color:"#6b7280"},content:"Total"},content:{style:{fontSize:"24px",fontWeight:"600",color:"#111827"}}}:void 0,interactions:[{type:"element-active"},{type:"element-selected"},{type:"pie-legend-active"},{type:"pie-statistic-active"}]}),[t,a,n]);return(0,i.jsx)(y.Z,{...r,height:t.height||300})},j=e=>{var t;let{config:n,chartRef:a}=e,r=(0,h.useMemo)(()=>({data:n.data,xField:n.xField||"x",yField:n.yField||"y",seriesField:n.seriesField,smooth:null===(t=n.smooth)||void 0===t||t,...I(n),...R(n.showGrid),...w(n.showLegend),...O(n),...L(n),...D(n,a),areaStyle:()=>({fill:C.blue,fillOpacity:.25}),line:{style:{lineWidth:2}},color:n.colors||v,slider:!1!==n.enableZoom?{start:0,end:1}:void 0}),[n,a]);return(0,i.jsx)(T.Z,{...r,height:n.height||300})},G=e=>{let{config:t,chartRef:n}=e,a=(0,h.useMemo)(()=>({data:t.data,xField:t.xField||"x",yField:t.yField||"y",colorField:t.colorField||t.seriesField,...I(t),...R(t.showGrid),...w(t.showLegend),...O(t),...L(t),...D(t,n),size:5,shape:"circle",pointStyle:{fillOpacity:.8,stroke:"#ffffff",lineWidth:1,cursor:"pointer"},color:t.colors||v,brush:t.enableBrush?{enabled:!0,type:"rect"}:void 0}),[t,n]);return(0,i.jsx)(_,{...a,height:t.height||300})},H=e=>{let{config:t,chartRef:n}=e,a=(0,h.useMemo)(()=>{var e,a;return{data:[t.data,t.data],xField:t.xField||"x",yField:t.yFields||[t.yField||"y1","y2"],...I(t),...O(t),...D(t,n),geometryOptions:t.geometries||[{geometry:"column",columnWidthRatio:.4,color:(null===(e=t.colors)||void 0===e?void 0:e[0])||v[0]},{geometry:"line",smooth:!0,lineStyle:{lineWidth:2},color:(null===(a=t.colors)||void 0===a?void 0:a[1])||v[1]}],legend:{position:"top-right"},interactions:[{type:"element-active"},{type:"element-highlight"}],slider:!1!==t.enableZoom?{start:0,end:1}:void 0}},[t,n]);return(0,i.jsx)(A,{...a,height:t.height||300})},$=(e,t,n)=>{if(!e||0===e.length)return"line";let a=new Set(e.map(e=>e[t])).size,r=e.some(e=>e[n]<0),i=e.some(e=>{let n=e[t];return n instanceof Date||!isNaN(Date.parse(n))});return i?"area":a<=5&&!r&&e.length<=10?"pie":a>5&&a<=15?"column":"line"},z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.xField||"x",a=t.yField||"y",r=t.chartType||$(e,n,a);return{chartType:r,data:e,xField:n,yField:a,smooth:!0,autoFit:!0,showLegend:!0,showGrid:!0,animate:!0,enableZoom:!0,enableTooltipCrosshairs:!0,showToolbar:!0,enableFullscreen:!0,...t}};var Z=e=>{let{config:t,className:n,style:a}=e,r=(0,h.useRef)(null),o=(0,h.useRef)(null),[s,l]=(0,h.useState)(!1),[c,d]=(0,h.useState)(1),u=(0,h.useCallback)(()=>{var e;if(d(e=>Math.min(1.2*e,3)),null===(e=r.current)||void 0===e?void 0:e.chart){let e=r.current.chart;try{e.zoom(1.2)}catch(e){}}},[]),p=(0,h.useCallback)(()=>{var e;if(d(e=>Math.max(e/1.2,.5)),null===(e=r.current)||void 0===e?void 0:e.chart){let e=r.current.chart;try{e.zoom(.8)}catch(e){}}},[]),m=(0,h.useCallback)(()=>{var e,t;if(d(1),null===(e=r.current)||void 0===e?void 0:e.chart){let e=r.current.chart;try{null===(t=e.resetZoom)||void 0===t||t.call(e),e.render()}catch(t){e.render()}}},[]),g=(0,h.useCallback)(()=>{o.current&&(s?document.exitFullscreen&&document.exitFullscreen():o.current.requestFullscreen&&o.current.requestFullscreen(),l(!s))},[s]);h.useEffect(()=>{let e=()=>{l(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);let f=!1!==t.showToolbar&&"pie"!==t.chartType&&"donut"!==t.chartType;return(0,i.jsxs)("div",{ref:o,className:"advanced-chart-container relative ".concat(s?"fixed inset-0 z-50 bg-white dark:bg-gray-900 p-6":""," ").concat(n||""),style:a,children:[t.title&&(0,i.jsxs)("div",{className:"chart-header mb-3",children:[(0,i.jsx)("h3",{className:"chart-title text-sm font-semibold text-gray-800 dark:text-gray-200",children:t.title}),t.description&&(0,i.jsx)("p",{className:"chart-description text-xs text-gray-500 dark:text-gray-400 mt-1",children:t.description})]}),f&&(0,i.jsx)(P,{onZoomIn:u,onZoomOut:p,onReset:m,onToggleFullscreen:g,isFullscreen:s,showZoom:!1!==t.enableZoom,showFullscreen:!1!==t.enableFullscreen}),(0,i.jsx)("div",{className:"chart-body transition-transform duration-200",style:{transform:"scale(".concat(c,")"),transformOrigin:"center center"},children:(()=>{switch(t.chartType){case"line":default:return(0,i.jsx)(M,{config:t,chartRef:r});case"column":return(0,i.jsx)(F,{config:t,chartRef:r});case"bar":return(0,i.jsx)(U,{config:t,chartRef:r});case"pie":case"donut":return(0,i.jsx)(B,{config:t,chartRef:r});case"area":return(0,i.jsx)(j,{config:t,chartRef:r});case"scatter":return(0,i.jsx)(G,{config:t,chartRef:r});case"dual-axes":return(0,i.jsx)(H,{config:t,chartRef:r})}})()}),1!==c&&(0,i.jsxs)("div",{className:"absolute bottom-2 left-2 text-xs text-gray-400 bg-white/80 dark:bg-gray-800/80 px-2 py-1 rounded",children:[Math.round(100*c),"%"]})]})},W=n(18102),Y=n(31545),V=n(86548),q=n(9020),K=n(68795),X=n(89035),Q=n(74842),J=n(15360),ee=n(13520),et=n(50888),en=n(89739),ea=n(4340),er=n(97175),ei=n(45699),eo=n(43069),es=n(69243),el=n(15611),ec=n(61086),ed=n(26911),eu=n(99611),ep=n(57132),em=n(80882),eg=n(18073),eh=n(95591),ef=n(41156),eb=n(23430),eE=n(63606),ey=n(24969),eT=n(6171),eS=n(58638),e_=n(98165),ex=n(29158),eA=n(48115),eN=n(32975),ek=n(45360),ev=n(39773),eC=n(93967),eI=n.n(eC),eR=n(67421);let ew=e=>{if(!e||/^https?:\/\//.test(e))return e;if(e.startsWith("/images/")){let t="http://127.0.0.1:5670";return t?"".concat(t).concat(e):e}return e},eO=e=>{let t="http://127.0.0.1:5670";return t&&e?e.replace(/(src\s*=\s*["'])\/images\//gi,"$1".concat(t,"/images/")):e},eL=e=>{switch(e){case"read":return(0,i.jsx)(Y.Z,{className:"text-emerald-500"});case"edit":case"write":return(0,i.jsx)(V.Z,{className:"text-amber-500"});case"bash":return(0,i.jsx)(q.Z,{className:"text-purple-500"});case"grep":case"glob":return(0,i.jsx)(K.Z,{className:"text-cyan-500"});case"python":return(0,i.jsx)(X.Z,{className:"text-blue-500"});case"html":return(0,i.jsx)(X.Z,{className:"text-orange-500"});case"task":case"skill":return(0,i.jsx)(Q.Z,{className:"text-indigo-500"});case"sql":return(0,i.jsx)(q.Z,{className:"text-emerald-600"});default:return(0,i.jsx)(J.Z,{className:"text-gray-500"})}},eD=e=>{if(!e)return{icon:(0,i.jsx)(ee.Z,{className:"text-gray-500 text-sm"}),label:"Database"};let t=e.toLowerCase();return t.includes("mysql")?{icon:(0,i.jsx)(q.Z,{className:"text-blue-500 text-sm"}),label:"MySQL"}:t.includes("postgre")?{icon:(0,i.jsx)(ee.Z,{className:"text-blue-400 text-sm"}),label:"PostgreSQL"}:t.includes("sqlite")?{icon:(0,i.jsx)(ee.Z,{className:"text-amber-500 text-sm"}),label:"SQLite"}:t.includes("mongo")?{icon:(0,i.jsx)(ee.Z,{className:"text-green-500 text-sm"}),label:"MongoDB"}:t.includes("oracle")?{icon:(0,i.jsx)(ee.Z,{className:"text-red-500 text-sm"}),label:"Oracle"}:t.includes("mssql")||t.includes("sqlserver")?{icon:(0,i.jsx)(ee.Z,{className:"text-indigo-500 text-sm"}),label:"SQL Server"}:{icon:(0,i.jsx)(ee.Z,{className:"text-gray-500 text-sm"}),label:e}},eP=e=>{let{status:t}=e,{t:n}=(0,eR.$G)();switch(t){case"running":return(0,i.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-blue-100 dark:bg-blue-900/50 text-blue-600 dark:text-blue-400 text-[10px] font-medium",children:[(0,i.jsx)(et.Z,{spin:!0,className:"text-xs"}),(0,i.jsx)("span",{children:n("Status")})]});case"completed":return(0,i.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-emerald-100 dark:bg-emerald-900/50 text-emerald-600 dark:text-emerald-400 text-[10px] font-medium",children:[(0,i.jsx)(en.Z,{className:"text-xs"}),(0,i.jsx)("span",{children:n("completed")})]});case"error":return(0,i.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/50 text-red-600 dark:text-red-400 text-[10px] font-medium",children:[(0,i.jsx)(ea.Z,{className:"text-xs"}),(0,i.jsx)("span",{children:n("Error_Message")})]});default:return(0,i.jsx)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 text-[10px] font-medium",children:(0,i.jsx)("span",{children:n("Process")})})}},eM=(e,t)=>{navigator.clipboard.writeText(e),ek.ZP.success(t)},eF=e=>{switch(e.type){case"file":{let t=e.name.toLowerCase().split(".").pop()||"";if(["xlsx","xls","csv"].includes(t))return(0,i.jsx)(er.Z,{className:"text-green-600 text-lg"});if(["png","jpg","jpeg","gif","webp","svg"].includes(t))return(0,i.jsx)(ei.Z,{className:"text-pink-500 text-lg"});if(["ppt","pptx"].includes(t))return(0,i.jsx)(eo.Z,{className:"text-orange-500 text-lg"});return(0,i.jsx)(J.Z,{className:"text-blue-500 text-lg"})}case"html":return(0,i.jsx)(es.Z,{className:"text-blue-500 text-lg"});case"table":return(0,i.jsx)(el.Z,{className:"text-blue-500 text-lg"});case"chart":return(0,i.jsx)(ec.Z,{className:"text-green-500 text-lg"});case"image":return(0,i.jsx)(ei.Z,{className:"text-pink-500 text-lg"});case"code":return(0,i.jsx)(X.Z,{className:"text-purple-500 text-lg"});case"markdown":return(0,i.jsx)(J.Z,{className:"text-orange-500 text-lg"});case"summary":return(0,i.jsx)(J.Z,{className:"text-emerald-500 text-lg"});default:return(0,i.jsx)(ed.Z,{className:"text-gray-500 text-lg"})}},eU=e=>({file:"bg-gray-50 dark:bg-gray-800",html:"bg-blue-50 dark:bg-blue-900/20",table:"bg-blue-50 dark:bg-blue-900/20",chart:"bg-green-50 dark:bg-green-900/20",image:"bg-pink-50 dark:bg-pink-900/20",code:"bg-purple-50 dark:bg-purple-900/20",markdown:"bg-orange-50 dark:bg-orange-900/20",summary:"bg-emerald-50 dark:bg-emerald-900/20"})[e]||"bg-gray-50 dark:bg-gray-800",eB=e=>({file:"文件",html:"网页报告",table:"数据表",chart:"图表",image:"图片",code:"代码",markdown:"文档",summary:"分析总结"})[e]||"产物",ej=[{key:"all",label:"全部"},{key:"document",label:"文档"},{key:"image",label:"图片"},{key:"code",label:"代码文件"},{key:"link",label:"链接"}],eG=e=>{let t=["all"],n=e.name.toLowerCase().split(".").pop()||"";return("image"===e.type||["png","jpg","jpeg","gif","webp","svg"].includes(n))&&t.push("image"),("code"===e.type||["py","js","ts","tsx","jsx","sql","sh","json","yaml","yml"].includes(n))&&t.push("code"),("html"===e.type||"markdown"===e.type||"summary"===e.type||"table"===e.type||["xlsx","xls","csv","doc","docx","pdf","ppt","pptx","md","txt","html","htm"].includes(n))&&t.push("document"),"file"===e.type&&1===t.length&&t.push("document"),t},eH=e=>{let t=new Date,n=new Date(e),a=t.getTime()-n.getTime(),r=Math.floor(a/864e5);return 0===r?"今天":1===r?"昨天":r<7?["星期日","星期一","星期二","星期三","星期四","星期五","星期六"][n.getDay()]:"".concat(n.getMonth()+1,"月").concat(n.getDate(),"日")},e$=(0,h.memo)(e=>{let{artifact:t,onClick:n}=e,a="image"===t.type||/\.(png|jpg|jpeg|gif|webp|svg)$/i.test(t.name),r=a&&"string"==typeof t.content?ew(t.content):null;return(0,i.jsxs)("div",{onClick:n,className:"flex items-center gap-3 px-4 py-3.5 cursor-pointer hover:bg-gray-50 dark:hover:bg-[#1f2025] transition-colors border-b border-gray-100 dark:border-gray-800 last:border-b-0",children:[r?(0,i.jsx)("img",{src:r,alt:t.name,className:"w-10 h-10 rounded-lg object-cover flex-shrink-0 border border-gray-200 dark:border-gray-700"}):(0,i.jsx)("div",{className:eI()("w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",eU(t.type)),children:eF(t)}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:t.name}),(0,i.jsxs)("div",{className:"text-[11px] text-gray-400 dark:text-gray-500 flex items-center gap-1.5 mt-0.5",children:[(0,i.jsx)("span",{children:eB(t.type)}),null!=t.size&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text-gray-300 dark:text-gray-600",children:"\xb7"}),(0,i.jsx)("span",{children:t.size<1024?t.size+" B":t.size<1048576?(t.size/1024).toFixed(1)+" KB":(t.size/1048576).toFixed(1)+" MB"})]})]})]})]})});e$.displayName="FileListItem";let ez=(0,h.memo)(e=>{var t;let{output:n,index:a}=e,r=n.content;return"thought"===n.output_type?null:(0,i.jsxs)(i.Fragment,{children:["code"===n.output_type&&(0,i.jsx)(o.G,{code:String(r),language:"python",customStyle:{background:"#0f172a",margin:0,borderRadius:8}}),"error"===n.output_type&&(0,i.jsx)("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 px-4 py-3 text-sm text-red-600 dark:text-red-400 font-mono whitespace-pre overflow-x-auto",children:String(r)}),"text"===n.output_type&&(0,i.jsx)("div",{className:"rounded-lg bg-gray-900 px-4 py-3 text-sm text-green-400 font-mono whitespace-pre leading-relaxed overflow-x-auto",children:String(r)}),"markdown"===n.output_type&&(0,i.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,i.jsx)(eN.Z,{components:s.ZP,...s.dx,children:(0,s.CE)(String(r))})}),"table"===n.output_type&&(0,i.jsx)(ev.Z,{size:"small",pagination:{pageSize:10,showSizeChanger:!0},columns:((null==r?void 0:r.columns)||[]).map(e=>"string"==typeof e?{title:e,dataIndex:e,key:e,ellipsis:!0}:e),dataSource:(null==r?void 0:r.rows)||[],rowKey:(e,n)=>String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:n),scroll:{x:"max-content"},className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"}),"chart"===n.output_type&&(0,i.jsx)("div",{className:"h-72",children:(0,i.jsx)(Z,{config:z((null==r?void 0:r.data)||[],{chartType:(null==r?void 0:r.chartType)||"line",xField:(null==r?void 0:r.xField)||"x",yField:(null==r?void 0:r.yField)||"y",seriesField:null==r?void 0:r.seriesField,title:null==r?void 0:r.title,smooth:!0,height:280})})}),"json"===n.output_type&&(0,i.jsx)(o.G,{code:"string"==typeof r?r:JSON.stringify(r,null,2),language:"json",customStyle:{background:"#0f172a",margin:0,borderRadius:8}}),"html"===n.output_type&&(0,i.jsxs)("div",{className:"rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700",children:[(null==r?void 0:r.title)&&(0,i.jsxs)("div",{className:"px-4 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[(0,i.jsx)(J.Z,{className:"text-blue-500 text-xs"}),(0,i.jsx)("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:r.title})]}),(0,i.jsx)("iframe",{srcDoc:eO("string"==typeof r?r:(null==r?void 0:r.html)||(null==r?void 0:r.content)||String(r)),sandbox:"allow-scripts allow-same-origin",className:"w-full bg-white",style:{border:"none",minHeight:500},onLoad:e=>{try{var t;let n=e.target,a=n.contentDocument||(null===(t=n.contentWindow)||void 0===t?void 0:t.document);if(null==a?void 0:a.body){let e=Math.max(a.body.scrollHeight,500);n.style.height="".concat(Math.min(e,1200),"px")}}catch(e){}}})]}),"image"===n.output_type&&(0,i.jsx)("div",{className:"rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:(0,i.jsx)("img",{src:ew("string"==typeof r?r:(null==r?void 0:r.url)||(null==r?void 0:r.src)||String(r)),alt:"Generated chart",className:"w-full h-auto object-contain",style:{maxHeight:600}})})]})});ez.displayName="OutputRenderer";let eZ=e=>{if(!e)return null;try{let t=e.match(/Action Input:\s*({[\s\S]*?})(?:\n|$)/);if(!t)return null;let n=JSON.parse(t[1]),a=n.skill_name||"",r=n.resource_path||"",i=e.slice(e.indexOf(t[0])+t[0].length),o="",s=i.match(/{[\s\S]*}/);if(s)try{let e=JSON.parse(s[0]);o=e.content||""}catch(e){o=i.trim()}if(!a&&!r)return null;return{skillName:a,resourcePath:r,content:o}}catch(e){return null}},eW=e=>{if(!e)return null;try{let t=e.match(/Action Input:\s*({[\s\S]*?})(?:\n|$)/);if(!t)return null;let n=JSON.parse(t[1]),a=n.skill_name||"",r=n.script_file_name||"",i=n.args||{};if(!a&&!r)return null;let o=e.slice(e.indexOf(t[0])+t[0].length),s=o.trim();return{skillName:a,scriptFileName:r,args:i,outputText:s}}catch(e){return null}},eY=(e,t,n)=>{if(!e&&!t)return null;try{let a="",r="",i=null==e?void 0:e.match(/Action Input:\s*({[\s\S]*?})(?:\n|$)/);if(i)try{let e=JSON.parse(i[1]);a=e.skill_name||""}catch(e){}let o=/Skill:\s*([\w-]+)\s+(?:-|\u2014|\u2013)\s+(.+)/,s=null==e?void 0:e.match(o);if(s&&(a||(a=s[1].trim()),r=s[2].trim()),!r&&n)for(let e of n){let t="string"==typeof e.content?e.content.trim():"",n=t.match(o);if(n){a||(a=n[1].trim()),r=n[2].trim();break}}if(!a&&t){let e=t.match(/Load\s+Skill:\s*(.+)/i);e&&(a=e[1].trim())}if(!a&&!r)return null;return{skillName:a,description:r}}catch(e){return null}},eV=e=>{if(!e)return[];let t=e.match(/\/images\/[^\s"')]+/g);return t?[...new Set(t)]:[]},eq=(0,h.memo)(e=>{let{parsed:t,outputs:n}=e,a=n.filter(e=>"code"===e.output_type),r=a.length>0?a.map(e=>String(e.content)).join(""):null,s=n.filter(e=>"image"===e.output_type),l=n.filter(e=>"text"===e.output_type),c=eV(t.outputText),d=new Set(s.map(e=>{var t;return"string"==typeof e.content?e.content:(null===(t=e.content)||void 0===t?void 0:t.url)||""})),u=c.filter(e=>!d.has(e)),p=l.map(e=>{let t=String(e.content),n=t.split("\n").filter(e=>!e.match(/^\s*[-\u2013]\s*\/images\//)).join("\n").trim();return{...e,content:n}}).filter(e=>e.content),m=t.outputText.split("\n").filter(e=>!e.match(/^\s*[-\u2013]\s*\/images\//)&&!e.match(/\u5df2\u751f\u6210\u7684\u56fe\u7247URL/)).join("\n").trim(),g=t.outputText.match(/HTML[_ ]report[_ ]generated[_ ]at:\s*(.+)/i);return(0,i.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[(0,i.jsxs)("div",{className:"w-[45%] flex-shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto flex flex-col bg-[#0f172a]",children:[(0,i.jsxs)("div",{className:"px-4 py-3 border-b border-gray-700/50 bg-[#1e293b] flex-shrink-0",children:[(0,i.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:(0,i.jsx)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[11px] font-medium bg-indigo-900/40 text-indigo-300 border border-indigo-700/50",children:t.skillName})}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(X.Z,{className:"text-blue-400 text-xs"}),(0,i.jsx)("span",{className:"text-sm font-medium text-gray-200 break-all font-mono",children:t.scriptFileName})]})]}),(0,i.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:r?(0,i.jsx)(o.G,{code:r,language:"python",customStyle:{background:"#0f172a",margin:0,borderRadius:0,padding:"12px 16px"}}):(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[(0,i.jsx)(X.Z,{className:"text-2xl mb-2"}),(0,i.jsx)("span",{className:"text-xs",children:"\\u52A0\\u8F7D\\u811A\\u672C\\u4E2D..."})]})})]}),(0,i.jsxs)("div",{className:"flex-1 min-w-0 overflow-y-auto",children:[g&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 mx-3 mt-3 rounded-lg bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800",children:[(0,i.jsx)(J.Z,{className:"text-emerald-500"}),(0,i.jsx)("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-400 break-all",children:g[1].trim()})]}),p.length>0&&p.map((e,t)=>(0,i.jsx)("div",{className:"rounded-lg bg-gray-900 mx-3 mt-2 px-4 py-3 text-sm text-green-400 font-mono whitespace-pre leading-relaxed overflow-x-auto",children:String(e.content)},"text-".concat(t))),0===p.length&&m&&!g&&(0,i.jsx)("div",{className:"rounded-lg bg-gray-900 mx-3 mt-2 px-4 py-3 text-sm text-green-400 font-mono whitespace-pre leading-relaxed overflow-x-auto",children:m}),s.map((e,t)=>{var n,a;return(0,i.jsx)("div",{className:"overflow-hidden bg-gray-50 dark:bg-gray-900",children:(0,i.jsx)("img",{src:ew("string"==typeof e.content?e.content:(null===(n=e.content)||void 0===n?void 0:n.url)||(null===(a=e.content)||void 0===a?void 0:a.src)||String(e.content)),alt:"Result ".concat(t+1),className:"w-full h-auto block"})},"img-".concat(t))}),u.map((e,t)=>(0,i.jsx)("div",{className:"overflow-hidden bg-gray-50 dark:bg-gray-900",children:(0,i.jsx)("img",{src:ew(e),alt:"Generated ".concat(t+1),className:"w-full h-auto block"})},"extra-img-".concat(t))),0===s.length&&0===u.length&&0===p.length&&!m&&!g&&(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-gray-400",children:[(0,i.jsx)(Y.Z,{className:"text-2xl mb-2"}),(0,i.jsx)("span",{className:"text-xs",children:"\\u7B49\\u5F85\\u6267\\u884C\\u7ED3\\u679C..."})]})]})]})});eq.displayName="SkillScriptRenderer";let eK=(0,h.memo)(e=>{let{code:t,html:n}=e,[a,r]=(0,h.useState)("preview"),s=n.content,l="string"==typeof s?s:(null==s?void 0:s.html)||(null==s?void 0:s.content)||String(s),c=eO(l),d=t?String(t.content):l;return(0,i.jsxs)("div",{className:"rounded-xl overflow-hidden border border-gray-200 dark:border-gray-700",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0 bg-white dark:bg-[#111217] border-b border-gray-200 dark:border-gray-700",children:[(0,i.jsxs)("button",{onClick:()=>r("preview"),className:eI()("px-4 py-2 text-xs font-medium transition-colors relative","preview"===a?"text-gray-900 dark:text-gray-100":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"),children:[(0,i.jsx)(eu.Z,{className:"mr-1.5"}),"渲染结果","preview"===a&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gray-900 dark:bg-gray-100 rounded-full"})]}),(0,i.jsxs)("button",{onClick:()=>r("source"),className:eI()("px-4 py-2 text-xs font-medium transition-colors relative","source"===a?"text-gray-900 dark:text-gray-100":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"),children:[(0,i.jsx)(X.Z,{className:"mr-1.5"}),"源代码","source"===a&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gray-900 dark:bg-gray-100 rounded-full"})]})]}),"preview"===a?(0,i.jsxs)("div",{children:[(null==s?void 0:s.title)&&(0,i.jsxs)("div",{className:"px-4 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center gap-2",children:[(0,i.jsx)(J.Z,{className:"text-blue-500 text-xs"}),(0,i.jsx)("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:s.title})]}),(0,i.jsx)("iframe",{srcDoc:c,sandbox:"allow-scripts allow-same-origin",className:"w-full bg-white",style:{border:"none",minHeight:500},onLoad:e=>{try{var t;let n=e.target,a=n.contentDocument||(null===(t=n.contentWindow)||void 0===t?void 0:t.document);if(null==a?void 0:a.body){let e=Math.max(a.body.scrollHeight,500);n.style.height="".concat(Math.min(e,1200),"px")}}catch(e){}}})]}):(0,i.jsx)(o.G,{code:d,language:"html",customStyle:{background:"#0f172a",margin:0,borderRadius:0}})]})});eK.displayName="HtmlTabbedRenderer";let eX=(0,h.memo)(e=>{let{group:t}=e,n=t.images.length>0,[a,r]=(0,h.useState)(n?"chart":"code"),s=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"relative overflow-auto flex-1 min-h-[100px]",children:[(0,i.jsx)("span",{className:"sticky top-0 right-0 float-right z-10 text-[10px] text-gray-400 bg-gray-800/80 px-2 py-0.5 rounded mr-2 mt-2",children:"代码"}),(0,i.jsx)(o.G,{code:t.codes.map(e=>String(e.content)).join("").replace(/^\s*```[a-zA-Z]*\s*/m,"").replace(/```\s*$/m,""),language:"python",customStyle:{background:"#0f172a",margin:0,borderRadius:0}})]}),t.results.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"border-t border-gray-700/50 shrink-0"}),(0,i.jsxs)("div",{className:"relative overflow-auto bg-gray-900 flex-1 min-h-[60px]",children:[(0,i.jsx)("span",{className:"sticky top-0 right-0 float-right z-10 text-[10px] text-gray-400 bg-gray-800/80 px-2 py-0.5 rounded mr-2 mt-2",children:"执行结果"}),(0,i.jsx)("div",{className:"px-4 py-3 text-sm text-green-400 font-mono whitespace-pre leading-relaxed overflow-x-auto",children:t.results.map(e=>String(e.content)).join("")})]})]})]}),l=(0,i.jsx)("div",{className:"p-3 space-y-2 bg-gray-50 dark:bg-gray-900/50 flex-1 min-h-0 overflow-auto",children:t.images.map((e,t)=>{var n,a;return(0,i.jsx)("div",{className:"rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700",children:(0,i.jsx)("img",{src:ew("string"==typeof e.content?e.content:(null===(n=e.content)||void 0===n?void 0:n.url)||(null===(a=e.content)||void 0===a?void 0:a.src)||String(e.content)),alt:"Generated chart",className:"w-full h-auto object-contain",style:{maxHeight:600}})},"img-".concat(t))})});return n?(0,i.jsxs)("div",{className:"rounded-xl overflow-hidden border border-gray-200 dark:border-gray-700 flex flex-col flex-1 min-h-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0 bg-white dark:bg-[#111217] border-b border-gray-200 dark:border-gray-700 shrink-0",children:[(0,i.jsxs)("button",{onClick:()=>r("chart"),className:eI()("px-4 py-2 text-xs font-medium transition-colors relative","chart"===a?"text-gray-900 dark:text-gray-100":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"),children:[(0,i.jsx)(ei.Z,{className:"mr-1.5"}),"图表","chart"===a&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gray-900 dark:bg-gray-100 rounded-full"})]}),(0,i.jsxs)("button",{onClick:()=>r("code"),className:eI()("px-4 py-2 text-xs font-medium transition-colors relative","code"===a?"text-gray-900 dark:text-gray-100":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"),children:[(0,i.jsx)(X.Z,{className:"mr-1.5"}),"代码","code"===a&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-gray-900 dark:bg-gray-100 rounded-full"})]})]}),"chart"===a?l:s]}):(0,i.jsx)("div",{className:"rounded-xl overflow-hidden border border-gray-700/50 flex flex-col flex-1 min-h-0",children:s})});eX.displayName="CodeExecutionRenderer";let eQ=e=>{if(!e)return"";let t=e.match(/Action Input:\s*({[\s\S]*?})(?:\n|$)/);if(!t)return"";try{let e=JSON.parse(t[1]);return e.code||""}catch(e){return""}},eJ=(0,h.memo)(e=>{let{activeStep:t,outputs:n}=e,a=eQ(t.detail)||n.filter(e=>"code"===e.output_type).map(e=>String(e.content)).join(""),r=n.filter(e=>"text"===e.output_type),o=n.filter(e=>"error"===e.output_type),s=r.map(e=>String(e.content)).join(""),l=o.map(e=>String(e.content)).join(""),c="running"===t.status;"error"===t.status||o.length;let d=[a?"$ ".concat(a):"",s,l].filter(Boolean).join("\n");return(0,i.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden rounded-xl border border-gray-700/60",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#1e2030] border-b border-gray-700/50 shrink-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#ff5f57]"}),(0,i.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#febc2e]"}),(0,i.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#28c840]"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(q.Z,{className:"text-gray-400 text-xs"}),(0,i.jsx)("span",{className:"text-xs font-medium text-gray-400",children:"Terminal"})]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(eP,{status:t.status}),d&&(0,i.jsx)(N.Z,{title:"复制全部",children:(0,i.jsx)("button",{className:"flex items-center gap-1 text-[11px] text-gray-500 hover:text-gray-300 transition-colors px-2 py-1 rounded hover:bg-gray-700/50",onClick:()=>eM(d),children:(0,i.jsx)(ep.Z,{className:"text-xs"})})})]})]}),(0,i.jsxs)("div",{className:"flex-1 min-h-0 overflow-auto bg-[#0d1117] px-5 py-4 font-mono text-sm leading-relaxed",children:[a&&(0,i.jsxs)("div",{className:"whitespace-pre-wrap break-all",children:[(0,i.jsx)("span",{className:"text-[#3fb950] font-semibold",children:"dbgpt@sandbox"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:":"}),(0,i.jsx)("span",{className:"text-[#58a6ff] font-semibold",children:"~"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:"$ "}),(0,i.jsx)("span",{className:"text-[#e6edf3]",children:a})]}),s&&(0,i.jsx)("div",{className:"text-[#c9d1d9] whitespace-pre mt-1 w-fit min-w-full",children:s}),l&&(0,i.jsx)("div",{className:"text-[#f85149] whitespace-pre mt-1 w-fit min-w-full",children:l}),(s||l||a)&&(0,i.jsxs)("div",{className:"mt-1",children:[(0,i.jsx)("span",{className:"text-[#3fb950] font-semibold",children:"dbgpt@sandbox"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:":"}),(0,i.jsx)("span",{className:"text-[#58a6ff] font-semibold",children:"~"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:"$ "}),c&&(0,i.jsx)("span",{className:"inline-block w-2 h-4 bg-[#e6edf3] animate-pulse ml-0.5 align-text-bottom"})]}),!a&&!s&&!l&&c&&(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:"text-[#3fb950] font-semibold",children:"dbgpt@sandbox"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:":"}),(0,i.jsx)("span",{className:"text-[#58a6ff] font-semibold",children:"~"}),(0,i.jsx)("span",{className:"text-[#8b949e]",children:"$ "}),(0,i.jsx)("span",{className:"inline-block w-2 h-4 bg-[#e6edf3] animate-pulse ml-0.5 align-text-bottom"})]})]})]})});eJ.displayName="TerminalRenderer";let e0=e=>{var t;let{node:n,depth:a,selectedKey:r,onSelect:o}=e,[s,l]=(0,h.useState)(a<2),c=!!n.children,d=r===n.key;return(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:eI()("flex items-center gap-1.5 py-1 px-2 rounded cursor-pointer text-xs transition-colors select-none",d?"bg-indigo-50 dark:bg-indigo-900/30 text-indigo-700 dark:text-indigo-300 font-medium":"text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),style:{paddingLeft:"".concat(14*a+8,"px")},onClick:()=>{c?l(e=>!e):o(n.key)},children:[c?s?(0,i.jsx)(em.Z,{className:"text-[9px] text-gray-400"}):(0,i.jsx)(eg.Z,{className:"text-[9px] text-gray-400"}):(0,i.jsx)("span",{className:"w-[9px]"}),c?(0,i.jsx)(eh.Z,{className:"text-amber-500 text-xs"}):n.title.endsWith(".md")?(0,i.jsx)(J.Z,{className:"text-blue-500 text-xs"}):n.title.endsWith(".py")?(0,i.jsx)(X.Z,{className:"text-green-500 text-xs"}):(0,i.jsx)(ed.Z,{className:"text-gray-400 text-xs"}),(0,i.jsx)("span",{className:"truncate",children:n.title})]}),c&&s&&(null===(t=n.children)||void 0===t?void 0:t.map(e=>(0,i.jsx)(e0,{node:e,depth:a+1,selectedKey:r,onSelect:o},e.key)))]})},e1=(0,h.memo)(e=>{var t,n,a;let{skillName:r,outputs:l}=e,{t:c}=(0,eR.$G)(),[d,u]=(0,h.useState)(null),[p,m]=(0,h.useState)(!0),[g,f]=(0,h.useState)(null),[b,E]=(0,h.useState)(null),[y,T]=(0,h.useState)(""),[S,_]=(0,h.useState)(!0),[x,A]=(0,h.useState)(!1),[v,C]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=async()=>{try{m(!0);let e=await fetch("".concat("http://127.0.0.1:5670","/api/v1/skills/detail?skill_name=").concat(encodeURIComponent(r),"&file_path=").concat(encodeURIComponent(r))),t=await e.json();t.success&&t.data?(u(t.data),T(t.data.raw_content||t.data.instructions||"")):f(t.err_msg||"Failed to load skill detail")}catch(e){f("Network error")}finally{m(!1)}};e()},[r]);let I=(0,h.useCallback)(async e=>{if(E(e),"SKILL.md"===e||"."===e){T((null==d?void 0:d.raw_content)||"");return}try{let t="".concat(r,"/").concat(e),n=await fetch("".concat("http://127.0.0.1:5670","/api/v1/skills/detail?skill_name=").concat(encodeURIComponent(r),"&file_path=").concat(encodeURIComponent(t))),a=await n.json();a.success&&a.data&&T(a.data.raw_content||a.data.instructions||"(Empty file)")}catch(e){T("(Failed to load file)")}},[r,d]),R=(0,h.useCallback)(async()=>{try{A(!0);let e=await fetch("".concat("http://127.0.0.1:5670","/api/v1/agent/skills/download?skill_name=").concat(encodeURIComponent(r)));if(!e.ok)throw Error("Download failed");let t=await e.blob(),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download="".concat(r,".zip"),document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n),ek.ZP.success("下载成功")}catch(e){ek.ZP.error("下载失败")}finally{A(!1)}},[r]),w=(0,h.useCallback)(()=>{v||(C(!0),ek.ZP.success(c("skill_added_success",{skillName:r})))},[r,v]),O=(null==d?void 0:null===(t=d.metadata)||void 0===t?void 0:t.name)||(null==d?void 0:d.skill_name)||r,L=(null==d?void 0:null===(n=d.metadata)||void 0===n?void 0:n.description)||"";return p?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400",children:[(0,i.jsx)(et.Z,{className:"text-3xl text-indigo-500 mb-4"}),(0,i.jsxs)("span",{className:"text-sm",children:[c("load_skill"),"..."]})]}):g?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400",children:[(0,i.jsx)(ef.Z,{className:"text-3xl mb-4"}),(0,i.jsx)("span",{className:"text-sm",children:g})]}):S?(0,i.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden bg-white dark:bg-[#1a1b1e] flex-1 flex flex-col min-h-0",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 shrink-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,i.jsx)("button",{className:"flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onClick:()=>_(!1),children:(0,i.jsx)(eT.Z,{className:"text-xs"})}),(0,i.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-indigo-50 dark:bg-indigo-900/30 flex items-center justify-center",children:(0,i.jsx)(ef.Z,{className:"text-base text-indigo-500"})}),(0,i.jsx)("div",{className:"min-w-0",children:(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate",children:O}),(0,i.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-400 font-medium",children:c("skill_label")})]})})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,i.jsx)(N.Z,{title:"下载为 ZIP",children:(0,i.jsx)("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 text-gray-500 hover:text-indigo-600 hover:border-indigo-300 transition-colors",onClick:R,disabled:x,children:x?(0,i.jsx)(et.Z,{className:"text-sm"}):(0,i.jsx)(eb.Z,{className:"text-sm"})})}),(0,i.jsx)(k.ZP,{type:"primary",size:"small",className:"!rounded-lg !text-xs !font-medium !px-3 ".concat(v?"!bg-green-50 !text-green-600 !border-green-200 dark:!bg-green-900/20 dark:!text-green-500 dark:!border-green-800":"!bg-gray-900 !border-gray-900 dark:!bg-gray-100 dark:!border-gray-100 dark:!text-gray-900 !text-white"),icon:v?(0,i.jsx)(eE.Z,{className:"text-[10px]"}):(0,i.jsx)(ey.Z,{className:"text-[10px]"}),onClick:w,children:v?c("added"):c("add_to_my_skills")})]})]}),(0,i.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[(0,i.jsx)("div",{className:"w-[200px] flex-shrink-0 border-r border-gray-200 dark:border-gray-700 overflow-y-auto py-2 bg-gray-50 dark:bg-[#111217]",children:(null==d?void 0:d.tree)&&(0,i.jsx)(e0,{node:d.tree,depth:0,selectedKey:b,onSelect:I})}),(0,i.jsx)("div",{className:"flex-1 min-w-0 overflow-auto p-4",children:y?(0,i.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:y.startsWith("---")?(()=>{let e=y.split("---");return e.length>=3?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("pre",{className:"text-xs bg-gray-50 dark:bg-[#161719] rounded-lg px-4 py-3 text-gray-600 dark:text-gray-300 font-mono leading-relaxed mb-4 border border-gray-200 dark:border-gray-700",children:e[1].trim()}),(0,i.jsx)(W.default,{children:(0,s.CE)(e.slice(2).join("---").trim())})]}):(0,i.jsx)(W.default,{children:(0,s.CE)(y)})})():(()=>{var e;let t=null===(e=null==b?void 0:b.split(".").pop())||void 0===e?void 0:e.toLowerCase(),n=t?({py:"python",sh:"bash",bash:"bash",zsh:"bash",js:"javascript",ts:"typescript",jsx:"javascript",tsx:"typescript",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",sql:"sql",md:"markdown",html:"html",css:"css",xml:"xml",java:"java",go:"go",rs:"rust",rb:"ruby",c:"c",cpp:"cpp",h:"c",hpp:"cpp"})[t]:void 0;return n?(0,i.jsx)(o.G,{code:y,language:n}):(0,i.jsx)(W.default,{children:(0,s.CE)(y)})})()}):(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[(0,i.jsx)(J.Z,{className:"text-2xl mb-2"}),(0,i.jsx)("span",{className:"text-xs",children:"选择文件查看内容"})]})})]})]}):(0,i.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden bg-white dark:bg-[#1a1b1e]",children:[(0,i.jsx)("div",{className:"px-5 py-4",children:(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,i.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-indigo-50 dark:bg-indigo-900/30 flex items-center justify-center",children:(0,i.jsx)(ef.Z,{className:"text-lg text-indigo-500"})}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate",children:O}),(0,i.jsx)("span",{className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-indigo-100 dark:bg-indigo-900/40 text-indigo-600 dark:text-indigo-400 font-medium",children:c("skill_label")})]}),L&&(0,i.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:L})]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[(0,i.jsx)(N.Z,{title:"下载为 ZIP",children:(0,i.jsx)("button",{className:"flex items-center justify-center w-8 h-8 rounded-lg border border-gray-200 dark:border-gray-600 text-gray-500 hover:text-indigo-600 hover:border-indigo-300 dark:hover:border-indigo-500 transition-colors",onClick:R,disabled:x,children:x?(0,i.jsx)(et.Z,{className:"text-sm"}):(0,i.jsx)(eb.Z,{className:"text-sm"})})}),(0,i.jsx)(k.ZP,{type:"primary",size:"small",className:"!rounded-lg !text-xs !font-medium !px-3 ".concat(v?"!bg-green-50 !text-green-600 !border-green-200 dark:!bg-green-900/20 dark:!text-green-500 dark:!border-green-800":"!bg-gray-900 !border-gray-900 dark:!bg-gray-100 dark:!border-gray-100 dark:!text-gray-900 !text-white"),icon:v?(0,i.jsx)(eE.Z,{className:"text-[10px]"}):(0,i.jsx)(ey.Z,{className:"text-[10px]"}),onClick:w,children:v?c("added"):c("add_to_my_skills")})]})]})}),(0,i.jsxs)("div",{className:"border-t border-gray-100 dark:border-gray-800 px-5 py-3 cursor-pointer hover:bg-gray-50 dark:hover:bg-[#1f2025] transition-colors flex items-center justify-between",onClick:()=>_(!0),children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[(0,i.jsx)(eh.Z,{className:"text-amber-500"}),(0,i.jsx)("span",{children:c("view_skill_files")}),(null==d?void 0:null===(a=d.tree)||void 0===a?void 0:a.children)&&(0,i.jsxs)("span",{className:"text-gray-400",children:["(",d.tree.children.length," 项)"]})]}),(0,i.jsx)(eg.Z,{className:"text-[10px] text-gray-400"})]})]})});e1.displayName="SkillCardRenderer";var e2=(0,h.memo)(e=>{var t,n;let{activeStep:a,outputs:r,isRunning:o,onRerun:s,onShare:l,terminalTitle:c,onCollapse:d,artifacts:u,onArtifactClick:p,panelView:m,onPanelViewChange:g,previewArtifact:f,databaseType:b,databaseName:E,skillName:y,summaryContent:T,isSummaryStreaming:S}=e,{t:_}=(0,eR.$G)(),[x,A]=(0,h.useState)(!1),[v,C]=(0,h.useState)("execution"),[I,R]=(0,h.useState)("all"),w=(0,h.useRef)(null),O=null!=m?m:v,L=e=>{C(e),null==g||g(e)};(0,h.useEffect)(()=>{void 0!==m&&C(m)},[m]);let D=(0,h.useMemo)(()=>r.filter(e=>"thought"!==e.output_type),[r]),P=(0,h.useMemo)(()=>u?"all"===I?u:u.filter(e=>eG(e).includes(I)):[],[u,I]),M=(0,h.useMemo)(()=>{let e=[],t=new Map;for(let e of P){let n=eH(e.createdAt);t.has(n)||t.set(n,[]),t.get(n).push(e)}return t.forEach((t,n)=>e.push({label:n,items:t})),e},[P]),F=(0,h.useMemo)(()=>{let e=[],t=0;for(;t