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