import{b4 as g,d as h,M as k,U as v,I,ak as N,g as S,u as e,c as x,j as m,a as D,l as F,a2 as T,o as U,n as p,b5 as B,b6 as J,b7 as M,af as d,b8 as O,b2 as i}from"./index-bJiZR03d.js";import{u as j}from"./usePageTitle-wT6f1BZv.js";class z extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const H=h({__name:"FlowRunCreate",setup(f){const t=k(),n=v("deploymentId"),s=T(),y=I("parameters",z,void 0),{deployment:o}=N(n),_=async r=>{var l,a;try{const u=await t.deployments.createDeploymentFlowRun(n.value,r),c=((a=(l=r.state)==null?void 0:l.stateDetails)==null?void 0:a.scheduledTime)??void 0,C=!c,b=O(M,{flowRun:u,flowRunRoute:d.flowRun,router:s,immediate:C,startTime:c});i(b,"success"),s.push(d.deployment(n.value))}catch(u){i("Something went wrong trying to create a flow run","error"),console.error(u)}},w=()=>{s.back()},R=S(()=>o.value?`Create Flow Run for Deployment: ${o.value.name}`:"Create Flow Run for Deployment");return j(R),(r,l)=>{const a=F("p-layout-default");return e(o)?(U(),x(a,{key:0},{header:m(()=>[p(e(B),{deployment:e(o)},null,8,["deployment"])]),default:m(()=>[p(e(J),{deployment:e(o),parameters:e(y),onSubmit:_,onCancel:w},null,8,["deployment","parameters"])]),_:1})):D("",!0)}}});export{H as default};
