import{c9 as h,d as b,g as k,W as N,u as F,al as S,ca as x,ae as D,i as I,j as J,c as B,a as O,n as e,o as T,k as d,l as p,cb as P,cc as Q,cd as U,ce as V,be as i,J as f,K as W}from"./index-DHPxdPUs.js";import{u as Z}from"./usePageTitle-N_Vwn3MG.js";class j extends h{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const M=b({__name:"FlowRunCreate",setup(y){const t=k(),l=N("deploymentId"),c=F(),w=S("parameters",j,void 0),{deployment:a}=x(l),o=D(!1),R=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,C=!r,g=U(V,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:C,startTime:r});f(g,"success"),c.push(i.deployment(l.value))}catch(n){const r=W(n,"Something went wrong trying to create a flow run");f(r,"error"),console.error(n)}finally{o.value=!1}},_=()=>{c.back()},v=I(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return Z(v),(u,m)=>{const s=J("p-layout-default");return e(a)?(T(),B(s,{key:0},{header:d(()=>[p(e(Q),{deployment:e(a)},null,8,["deployment"])]),default:d(()=>[p(e(P),{deployment:e(a),parameters:e(w),disabled:o.value,onSubmit:R,onCancel:_},null,8,["deployment","parameters","disabled"])]),_:1})):O("",!0)}}});export{M as default};
//# sourceMappingURL=FlowRunCreate-DmfiynHW.js.map
