import{d as v,S as D,v as h,j as g,g as s,h as w,c as C,a as b,o as k,i as l,k as r,m as c,c7 as S,c8 as x,J as p,c9 as m,bg as E,Y as I}from"./index-CWv_Pcr2.js";import{u as j}from"./usePageTitle-DY9DP8zZ.js";const V=v({__name:"DeploymentDuplicate",setup(B){const a=D(),u=h("deploymentId"),d=g(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(E.deployment(n.id))}catch(n){const o=I(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 j(_),(t,n)=>{const o=w("p-layout-default");return e.value?(k(),C(o,{key:0,class:"deployment-edit"},{header:l(()=>[r(c(x),{deployment:e.value},null,8,["deployment"])]),default:l(()=>[r(c(S),{deployment:e.value,mode:"duplicate",onCancel:f,onSubmit:y},null,8,["deployment"])]),_:1})):b("",!0)}}});export{V as default};
//# sourceMappingURL=DeploymentDuplicate-2A4fucef.js.map
