import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{i as t,t as n}from"./OptimizationStudio-HPYBabc3.js";import{Gy as r,Hy as i,lh as a}from"./index-DDwwBb9e.js";import{n as o,t as s}from"./useWorkflowStore-BxQNoHq3.js";import{t as c}from"./next-error-B29kz4JN.js";var l=e(r()),u=i();function d(){let{workflow:e}=t(),{reset:r,setWorkflow:i,setAutosavedWorkflow:d,setLastCommittedWorkflow:f,setCurrentVersionId:p}=o(({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})=>({reset:e,setWorkflow:t,setAutosavedWorkflow:n,setLastCommittedWorkflow:r,setCurrentVersionId:i})),{clear:m}=s.temporal.getState(),h=a.useContext();return(0,l.useEffect)(()=>()=>{h.workflow.getById.invalidate()},[]),(0,l.useEffect)(()=>{let t=e.data?.currentVersion?.dsl;t?(d(void 0),i({...t,workflow_id:e.data?.id,nodes:(t.nodes??[]).map(e=>({...e,selected:!1}))}),f(t),p(e.data?.currentVersion?.id)):(r(),m())},[!!e.data]),e.isFetched&&!e.data?(0,u.jsx)(c,{statusCode:404}):(0,u.jsx)(n,{})}export{d as default};
//# sourceMappingURL=_workflow_-BEJ9shi5.js.map