import{r as a,j as e,O as p,B as g,a as u,H as f,v as y,I as w}from"./index-DWaKf7-t.js";import{L as F}from"./index-Bdd9AuZi.js";import{C as b,T as k}from"./index-FZ8AkgCd.js";import{T as v}from"./index-DXS1j8KM.js";import{I as _}from"./index-C8BxaXP_.js";import{F as C}from"./Table-DdQ_sLHU.js";const S=({data:t,url:s})=>{const{Search:r}=w,[d,x]=a.useState([]),m=n=>Object.keys(n).map(i=>({title:i,dataIndex:i,key:i,ellipsis:!0,width:150}));return a.useEffect(()=>{if(t){const n=t.map((i,o)=>({...i,key:o}));x(n)}},[t]),e.jsx(e.Fragment,{children:Array.isArray(d)&&e.jsx(e.Fragment,{children:e.jsx(C,{size:"small",title:()=>e.jsxs(e.Fragment,{children:[e.jsx(r,{placeholder:"input search text",allowClear:!0,onSearch:n=>{const i=t.filter(o=>Object.values(o).some(l=>typeof l=="string"&&l.includes(n)));x(i)},style:{width:304}}),s&&e.jsx(f,{title:`${window.location.origin}${s}`,children:e.jsx(g,{onClick:()=>{window.open(s,"_blank")},style:{marginLeft:"1rem"},type:"primary",children:"下载"})})]}),scroll:{x:"max-content",y:55*5},dataSource:d,pagination:!1,virtual:!0,columns:m(t[0]),footer:()=>`一共${t.length}条记录`})})})},j=({data:t,url:s})=>e.jsx("div",{children:e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx(_,{src:t,style:{maxWidth:"20rem",marginRight:"0.5rem"}}),s&&e.jsx("div",{children:e.jsx(f,{title:`${window.location.origin}${s}`,children:e.jsx(g,{onClick:()=>{window.open(s,"_blank")},type:"primary",children:"下载"})})})]})}),{Paragraph:T}=y,I=({data:t})=>e.jsx(e.Fragment,{children:e.jsx(T,{style:{background:"#13c2c2",padding:"1rem",border:"1px solid #1677ff"},children:t})}),R=({data:t})=>e.jsx(e.Fragment,{children:t&&t.startsWith("/brave")?e.jsx(e.Fragment,{children:e.jsx("iframe",{src:t,width:"100%",style:{height:"80vh",border:"none"}})}):e.jsx(e.Fragment,{children:t})}),$={table:S,string:I,html:R},E=({type:t,...s})=>{const r=$[t]||(()=>e.jsxs("div",{children:["未知类型 ",t]}));return e.jsx(r,{...s})},W=a.forwardRef(({params:t,visible:s,currentAnalysis:r},d)=>{const[x,m]=a.useState(!1),[n,i]=a.useState(null),{output_dir:o}=t||{},l=async()=>{if(s){m(!0);const c=await u.get(`/file-operation/visualization-results?path=${o}`);i(c.data),m(!1)}};return a.useEffect(()=>{s&&l()},[s,t==null?void 0:t.output_dir]),a.useImperativeHandle(d,()=>({relaod:l})),s?e.jsx(e.Fragment,{children:e.jsx(b,{title:t==null?void 0:t.analysis_id,children:e.jsx(k,{items:[{label:"分析结果",key:"analysis_result",children:e.jsx(e.Fragment,{children:(r==null?void 0:r.analysis_status)=="running"?e.jsx(p,{active:!0}):e.jsxs(e.Fragment,{children:[e.jsx(g,{size:"small",color:"cyan",variant:"solid",onClick:()=>{l()},children:"刷新"}),(r==null?void 0:r.analysis_status)=="failed"&&e.jsx("div",{style:{textAlign:"center"},children:e.jsx(v,{color:"red",children:"分析失败"})}),n&&e.jsxs(e.Fragment,{children:[n.images&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-start"},children:Array.isArray(n.images)?e.jsx(e.Fragment,{children:n.images.map((c,h)=>e.jsx(e.Fragment,{children:a.createElement(j,{...c,key:h})}))}):e.jsx(e.Fragment,{children:e.jsx(j,{...n.images})})}),n.tables&&Array.isArray(n.tables)&&e.jsx(e.Fragment,{children:n.tables.map((c,h)=>e.jsx(E,{...c},h))})]})]})})},{label:"分析日志",key:"analysis_log",children:e.jsx(F,{file_path:r==null?void 0:r.command_log_path})}]})})}):null});export{W as A};
