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