import{d as l,r as p,Q as j,j as e,c7 as m,cv as E,dj as _,dk as b,dl as g,dm as i,ah as I,a3 as C,c2 as D}from"./index-66XtK6kJ.js";import{F as n}from"./FormMenuItem-DRWC8EpE.js";import{h as S,a as B,S as N}from"./NetworkDevicePanel-CFETAerX.js";import{A as O}from"./AutoExpandingTextArea-BdkUE9YB.js";import{S as P}from"./ScrollableForm-DnwqOi93.js";const R="Main configuration",M="Disk",T="Network",y="GPU",A="Proxy",F="Other",U="Resource limits",f="Security policies",G="Snapshots",L="Migration",V="Boot",w="Cloud init",Q="YAML configuration",W=({active:a,setActive:r,isDisabled:c,formik:s})=>{const d=l.useNotify(),[o,x]=p.useState(!0),{hasMetadataConfiguration:v}=j(),u=c?"Please enter a name before adding custom configuration":void 0,t={active:a,setActive:r,disableReason:u},h=()=>{I("form-navigation","p-bottom-controls")};return p.useEffect(h,[d.notification?.message]),l.useListener(window,h,"resize",!0),e.jsx("div",{className:"p-side-navigation--accordion form-navigation",children:e.jsx("nav",{"aria-label":"Profile form navigation",children:e.jsxs("ul",{className:"p-side-navigation__list",children:[e.jsx(n,{label:R,...t,isBold:!0}),e.jsxs("li",{className:"p-side-navigation__item",children:[e.jsx(l.Button,{type:"button",className:"p-side-navigation__accordion-button","aria-expanded":o?"true":"false",onClick:()=>{c||x(!o)},disabled:c,title:u,children:s.values.devices.length>0?e.jsx("strong",{children:"Devices"}):"Devices"}),e.jsxs("ul",{className:"p-side-navigation__list","aria-expanded":o?"true":"false",children:[e.jsx(n,{label:M,hasError:S(s),...t,isBold:s.values.devices.some(m)}),e.jsx(n,{label:T,hasError:B(s),...t,isBold:s.values.devices.some(E)}),e.jsx(n,{label:y,...t,isBold:s.values.devices.some(_)}),e.jsx(n,{label:A,...t,isBold:s.values.devices.some(b)}),v&&e.jsx(n,{label:F,...t,isBold:s.values.devices.some(g)})]})]}),e.jsx(n,{label:U,...t,isBold:i(s,"limits_")}),e.jsx(n,{label:f,...t,isBold:i(s,"security_")}),e.jsx(n,{label:G,...t,isBold:i(s,"snapshots_")}),e.jsx(n,{label:L,...t,isBold:i(s,"migration_")||i(s,"cluster_")}),e.jsx(n,{label:V,...t,isBold:i(s,"boot_")}),e.jsx(n,{label:w,...t,isBold:i(s,"cloud_init_","cloud_init_ssh_keys")})]})})})},X=({formik:a,isEdit:r,project:c})=>{const s=a.values.name==="default";C();const d=s?"Default profile cannot be renamed.":"Click the name in the header to rename the profile.";return e.jsx(P,{children:e.jsx(l.Row,{children:e.jsxs(l.Col,{size:12,children:[r?e.jsx(l.OutputField,{id:"name",label:"Profile name",value:a.values.name,help:d}):e.jsx(l.Input,{id:"name",name:"name",type:"text",label:"Profile name",placeholder:"Enter name",onBlur:a.handleBlur,onChange:a.handleChange,value:a.values.name,error:a.touched.name?a.errors.name:null,required:!0}),e.jsx(O,{id:"description",name:"description",label:"Description",placeholder:"Enter description",onBlur:a.handleBlur,onChange:o=>{r&&D(a),a.handleChange(o)},value:a.values.description,disabled:!!a.values.editRestriction,title:a.values.editRestriction}),e.jsx(N,{formik:a})]})})})};export{V as B,w as C,M as D,y as G,R as M,T as N,F as O,W as P,U as R,f as S,Q as Y,X as a,A as b,G as c,L as d};
