import{d as D,v,W as b,b as h,e as s,c as w,g as l,a as C,h as g,o as k,j as c,k as r,ca as I,cb as x,L as p,cc as m,bo as B,Y as E}from"./index-Bp1Bhxow.js";import{u as N}from"./usePageTitle-CccNdtFw.js";const Y=D({__name:"DeploymentDuplicate",setup(S){const a=v(),u=b("deploymentId"),d=h(a.deployments.getDeployment,[u.value],{}),e=s(()=>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(B.deployment(n.id))}catch(n){const o=E(n,"Error creating deployment");p(o,"error"),console.warn(n)}}function f(){m.back()}const _=s(()=>e.value?`Duplicate Deployment: ${e.value.name}`:"Duplicate Deployment");return N(_),(t,n)=>{const o=g("p-layout-default");return e.value?(k(),w(o,{key:0,class:"deployment-edit"},{header:l(()=>[c(r(I),{deployment:e.value},null,8,["deployment"])]),default:l(()=>[c(r(x),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):C("",!0)}}});export{Y as default};
//# sourceMappingURL=DeploymentDuplicate-CrNBxlCc.js.map
