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