import{R as f,N as m,r as s,u as j,eL as y,a5 as E,e,B as n,cV as S,aq as b,aR as v,S as I,eu as D,T as c,f6 as P}from"./index-_6SmYgWK.js";const C=()=>{const{id:o}=f(),i=m(),[l,x]=s.useState(null),[r,d]=s.useState({}),[u,h]=s.useState(!0),t=j(y.getExecutionByIdPublic);return s.useEffect(()=>{t.request(o)},[]),s.useEffect(()=>{if(t.data){const a=t.data,p=typeof a.executionData=="string"?JSON.parse(a.executionData):a.executionData;x(p);const g={...E.omit(a,["executionData"]),agentflow:{...r.agentflow}};d(g)}},[t.data]),s.useEffect(()=>{h(t.loading)},[t.loading]),e.jsx(e.Fragment,{children:u?e.jsx(n,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"80vh"},children:e.jsx(S,{size:60})}):e.jsx(e.Fragment,{children:t.error?e.jsx(n,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"80vh"},children:e.jsx(n,{sx:{maxWidth:"500px",width:"100%"},children:e.jsx(b,{variant:"outlined",sx:{border:`1px solid ${i.palette.error.main}`,borderRadius:2,padding:"20px",boxShadow:`0 4px 8px ${v(i.palette.error.main,.15)}`},children:e.jsxs(I,{spacing:2,alignItems:"center",children:[e.jsx(D,{size:50,color:i.palette.error.main}),e.jsx(c,{variant:"h3",color:"error.main",align:"center",children:"Invalid Execution"}),e.jsx(c,{variant:"body1",color:"text.secondary",align:"center",children:"The execution you're looking for doesn't exist or you don't have permission to view it."})]})})})}):e.jsx(P,{isPublic:!0,execution:l,metadata:r,onProceedSuccess:()=>{t.request(o)},onRefresh:a=>{t.request(a)}})})})};export{C as default};
