import{d as _,e as v,W as b,f as h,h as l,c as w,i as s,a as C,j as g,o as k,k as c,l as r,ca as x,cb as I,N as p,cc as m,bo as N,Y as B}from"./index-CibiDZQv.js";import{u as E}from"./usePageTitle-DYAZWMh1.js";const Y=_({__name:"DeploymentDuplicate",setup(S){const a=v(),u=b("deploymentId"),d=h(a.deployments.getDeployment,[u.value],{}),e=l(()=>d.response);function i(t){return"name"in t}async function y(t){try{if(!i(t))throw new Error("Invalid request");const n=await a.deployments.createDeployment(t);p("Deployment created","success"),m.push(N.deployment(n.id))}catch(n){const o=B(n,"Error creating deployment");p(o,"error"),console.warn(n)}}function f(){m.back()}const D=l(()=>e.value?`Duplicate Deployment: ${e.value.name}`:"Duplicate Deployment");return E(D),(t,n)=>{const o=g("p-layout-default");return e.value?(k(),w(o,{key:0,class:"deployment-edit"},{header:s(()=>[c(r(x),{deployment:e.value},null,8,["deployment"])]),default:s(()=>[c(r(I),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):C("",!0)}}});export{Y as default};
//# sourceMappingURL=DeploymentDuplicate-DYLSwF0X.js.map
