import{u as C,r as p,n as o,e as i,f as e,g as u,F as T,H as N,B as v,j as f,t as R,k as d,h as j,w as O,T as H}from"./index-a0da86f0.js";import{g as b}from"./nodeMetadata-d183494d.js";import{_ as S}from"./_plugin-vue_export-helper-c27b6911.js";import"./vue-flow-core-379fe11a.js";import"./NodePropertyModal-29321bf4.js";import"./SchemaFormRenderer-4ebe686e.js";import"./nodes-23b691ed.js";const B={class:"execution-results"},D={class:"execution-results-body"},$={class:"execution-details"},E={class:"details-left"},J={class:"history-list"},L={key:0,class:"success-overview-card"},I={class:"overview-card-header"},V={class:"overview-info-header"},F={key:1,class:"error-overview-card"},M={class:"overview-card-header"},z={class:"overview-info-header"},A={key:2,class:"no-execution-overview-card"},W={key:3},q=["onClick"],G={class:"history-item-header"},K={class:"history-node-name"},P={class:"history-item-meta"},Q={class:"history-time"},U={key:4,class:"no-history"},X={key:0,class:"details-right"},Y={class:"node-detail-header"},Z={class:"detail-tabs"},ee={class:"node-detail-content"},te={key:0,class:"detail-panel"},se={class:"json-viewer"},oe={key:1,class:"detail-panel"},ie={class:"json-viewer"},le={key:1,class:"details-right empty"},ne={key:0,class:"copy-tip"},ae={__name:"ExecutionResults",props:{executionResult:Object,executionHistory:Array},emits:["close"],setup(n,{emit:ue}){const k=C(),l=p(null),r=p("output"),y=p(!1),g=a=>{l.value=a,r.value="output"},h=async a=>{try{const t=JSON.stringify(a,null,2);await navigator.clipboard.writeText(t),y.value=!0,setTimeout(()=>{y.value=!1},2e3)}catch{k.error("复制失败，请手动复制")}},_=a=>{if(typeof a!="object"||a===null)return a;const t={};for(const[c,s]of Object.entries(a))if(typeof s=="string"&&s.trim().startsWith("{"))try{t[c]=JSON.parse(s)}catch{t[c]=s}else t[c]=s;return t};return(a,t)=>{var c;return o(),i("div",B,[e("div",D,[e("div",$,[e("div",E,[e("div",J,[n.executionResult&&n.executionResult.success?(o(),i("div",L,[e("div",I,[t[5]||(t[5]=e("i",{class:"fa fa-check-circle text-success"},null,-1)),e("div",V,[t[4]||(t[4]=e("h5",null,"执行成功",-1)),e("p",null,"执行了 "+u(n.executionHistory.length)+" 个节点",1)])])])):n.executionResult&&!n.executionResult.success?(o(),i("div",F,[e("div",M,[t[7]||(t[7]=e("i",{class:"fa fa-exclamation-circle text-danger"},null,-1)),e("div",z,[t[6]||(t[6]=e("h5",null,"执行失败",-1)),e("p",null,u(n.executionResult.error),1)])])])):(o(),i("div",A,[...t[8]||(t[8]=[e("div",{class:"overview-card-header"},[e("i",{class:"fa fa-info-circle text-info"}),e("div",{class:"overview-info-header"},[e("h5",null,"无执行历史"),e("p",null,"请先执行流程查看结果")])],-1)])])),n.executionHistory&&n.executionHistory.length>0?(o(),i("div",W,[(o(!0),i(T,null,N(n.executionHistory,(s,w)=>{var m,x;return o(),i("div",{key:w,class:v(["history-item",[s.status,{active:((m=l.value)==null?void 0:m.nodeId)===s.nodeId}]]),onClick:re=>g(s)},[e("div",G,[e("span",K,u(s.nodeLabel||((x=f(b)(s.nodeType))==null?void 0:x.label)||s.nodeType),1),e("span",{class:v(["history-status-badge",s.status])},u(f(R)(s.status)),3)]),e("div",P,[e("span",Q,u(new Date(s.timestamp).toLocaleTimeString()),1)])],10,q)}),128))])):(o(),i("div",U,[...t[9]||(t[9]=[e("div",{class:"no-history-content"},[e("i",{class:"fa fa-history"}),e("p",null,"暂无执行历史")],-1)])]))])]),l.value?(o(),i("div",X,[e("div",Y,[e("h6",null,u(l.value.nodeLabel||((c=f(b)(l.value.nodeType))==null?void 0:c.label)||l.value.nodeType),1),e("div",Z,[e("button",{class:v(["tab-btn",{active:r.value==="input"}]),onClick:t[0]||(t[0]=s=>r.value="input")}," 输入 ",2),e("button",{class:v(["tab-btn",{active:r.value==="output"}]),onClick:t[1]||(t[1]=s=>r.value="output")}," 输出 ",2)])]),e("div",ee,[r.value==="input"?(o(),i("div",te,[l.value.inputs&&Object.keys(l.value.inputs).length>0?(o(),i("button",{key:0,class:"copy-btn-floating",onClick:t[2]||(t[2]=s=>h(l.value.inputs)),title:"复制"},[...t[10]||(t[10]=[e("i",{class:"fa fa-copy"},null,-1)])])):d("",!0),e("pre",se,u(JSON.stringify(_(l.value.inputs||{}),null,2)),1)])):d("",!0),r.value==="output"?(o(),i("div",oe,[l.value.result&&Object.keys(l.value.result).length>0?(o(),i("button",{key:0,class:"copy-btn-floating",onClick:t[3]||(t[3]=s=>h(l.value.result)),title:"复制"},[...t[11]||(t[11]=[e("i",{class:"fa fa-copy"},null,-1)])])):d("",!0),e("pre",ie,u(JSON.stringify(_(l.value.result||{}),null,2)),1)])):d("",!0)])])):(o(),i("div",le,[...t[12]||(t[12]=[e("div",{class:"empty-state"},[e("i",{class:"fa fa-mouse-pointer"}),e("p",null,"点击左侧节点查看详情")],-1)])]))])]),j(H,{name:"fade"},{default:O(()=>[y.value?(o(),i("div",ne,"已复制")):d("",!0)]),_:1})])}}},_e=S(ae,[["__scopeId","data-v-5b99f9ea"]]);export{_e as default};
