import{j as e,d as l,ej as g,r as p,D as N,a2 as v,L as I,R as k}from"./index-C88DWJny.js";const S=({values:t})=>{const r=t.Egress,a=t.Ingress;return e.jsxs("div",{className:"u-sv1",children:["When no ACL rule matches:",e.jsx("br",{}),e.jsx(l.Icon,{name:"arrow-left",className:"network-default-acl-icon"}),"Egress traffic is:"," ",e.jsx("code",{children:g(r||"reject")}),e.jsx("br",{}),e.jsx(l.Icon,{name:"arrow-right",className:"network-default-acl-icon"}),"Ingress traffic is:"," ",e.jsx("code",{children:g(a||"reject")})]})},A=t=>!!localStorage.getItem(`yamlNotificationClosed${t}`),b=t=>{localStorage.setItem(`yamlNotificationClosed${t}`,"yes")},D=({entity:t,docPath:r})=>{const[a,n]=p.useState(A(t));if(a)return null;const c=()=>{b(t),n(!0),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},250)};return e.jsxs(l.Notification,{severity:"information",title:"YAML Configuration",onDismiss:c,actions:[e.jsxs(N,{docPath:r,children:["Learn more about ",v(t,2)]},"learn-more-link")],children:["This is the YAML representation of the ",t,"."]})},T=({project:t,setSelectedAcls:r,selectedAcls:a,availableAcls:n,id:c="network-acl-selector",inheritedAcls:h,help:j,canSelectManualAcls:i=!0,label:s})=>{const d=(o,f)=>o.map(m=>({label:f?.includes(m)?`${m} (from network)`:m,value:m})),u=n.length>0,w=i&&u,x=o=>e.jsx(I,{to:`${k}/ui/project/${t}/network-acls`,target:"_blank",children:o}),C=n.length>0?e.jsxs(e.Fragment,{children:["Manage ",x("ACLs")," for this project."]}):e.jsxs(e.Fragment,{children:["Create an ",x("ACL")," to control network access."]}),L=()=>{if(!i)return"-";if(!u)return"No ACLs available";if(u)return"Select ACLs"};return e.jsxs(e.Fragment,{children:[s&&e.jsx("label",{htmlFor:c,children:s}),e.jsx(l.MultiSelect,{label:s,items:d(n.map(o=>o.name),h),disabled:!w,selectedItems:d(a),variant:u?"condensed":"search",placeholder:L(),onItemsUpdate:o=>{r(o.map(f=>f.value))},showDropdownFooter:!1,id:c,disabledItems:h?.map(o=>({label:o,value:o})),help:j??C})]})},F=({values:t,onChange:r,disabled:a,directionField:n})=>{const c=["Egress","Ingress"],j=[{label:"Select option",value:""},...["allow","drop","reject"].map(s=>({label:g(s),value:s}))],i=s=>`${s.toLowerCase()}-default-action`;return e.jsxs("div",{children:[e.jsx("div",{className:"u-sv2",children:"When no ACL rule matches:"}),e.jsx("div",{className:"network-default-acl-selector u-sv1",children:c.map(s=>e.jsxs(p.Fragment,{children:[e.jsxs(l.Label,{forId:i(s),children:[e.jsx(l.Icon,{name:s==="Egress"?"arrow-left":"arrow-right",className:"network-default-acl-icon"}),s," traffic is"," "]}),e.jsx("div",{children:e.jsx(l.Select,{className:"u-no-margin--bottom",options:j,onChange:d=>{r(n[s],d.target.value)},value:t?.[s],disabled:a,id:i(s)})})]},s))})]})};export{T as N,D as Y,S as a,F as b};
