import{cb as g,d as C,S as h,v as S,u as b,al as k,cc as J,ae as F,g as N,h as x,c as D,a as I,m as t,o as B,i as u,k as m,cd as O,ce as T,cf as P,cg as U,bg as d,J as p,Y as V}from"./index-CWv_Pcr2.js";import{u as Y}from"./usePageTitle-DY9DP8zZ.js";class z extends g{parse(a){return JSON.parse(decodeURIComponent(a??""))}format(a){return encodeURIComponent(JSON.stringify(a))}}const j=C({__name:"FlowRunCreate",setup(i){const a=h(),r=S("deploymentId"),l=b(),f=k("parameters",z,void 0),{deployment:o}=J(r),n=F(!1),y=async c=>{if(!n.value)try{n.value=!0;const s=await a.deployments.createDeploymentFlowRun(r.value,c),e=c.state?.stateDetails?.scheduledTime??void 0,w=!e,R=P(U,{flowRun:s,flowRunRoute:d.flowRun,router:l,immediate:w,startTime:e});p(R,"success"),l.push(d.deployment(r.value))}catch(s){const e=V(s,"Something went wrong trying to create a flow run");p(e,"error"),console.error(s)}finally{n.value=!1}},_=()=>{l.back()},v=N(()=>o.value?`Create Flow Run for Deployment: ${o.value.name}`:"Create Flow Run for Deployment");return Y(v),(c,s)=>{const e=x("p-layout-default");return t(o)?(B(),D(e,{key:0},{header:u(()=>[m(t(T),{deployment:t(o)},null,8,["deployment"])]),default:u(()=>[m(t(O),{deployment:t(o),parameters:t(f),disabled:n.value,onSubmit:y,onCancel:_},null,8,["deployment","parameters","disabled"])]),_:1})):I("",!0)}}});export{j as default};
//# sourceMappingURL=FlowRunCreate-Tlhxds0R.js.map
