import{ce as C,d as b,v as k,W as N,ao as F,cf as S,af as x,e as D,k as e,c as I,g as d,a as B,h as J,u as O,o as T,j as p,cg as j,ch as P,ci as Q,cj as U,bo as i,L as f,Y as V}from"./index-Bp1Bhxow.js";import{u as W}from"./usePageTitle-CccNdtFw.js";class Y extends C{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const L=b({__name:"FlowRunCreate",setup(y){const t=k(),l=N("deploymentId"),c=O(),v=F("parameters",Y,void 0),{deployment:a}=S(l),o=x(!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,h=Q(U,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:g,startTime:r});f(h,"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()},_=D(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return W(_),(u,m)=>{const s=J("p-layout-default");return e(a)?(T(),I(s,{key:0},{header:d(()=>[p(e(j),{deployment:e(a)},null,8,["deployment"])]),default:d(()=>[p(e(P),{deployment:e(a),parameters:e(v),disabled:o.value,onSubmit:w,onCancel:R},null,8,["deployment","parameters","disabled"])]),_:1})):B("",!0)}}});export{L as default};
//# sourceMappingURL=FlowRunCreate-Yqq8TpKy.js.map
