"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[53076],{636432(e,t,n){n.d(t,{iw:()=>A,Zb:()=>m,N0:()=>h,uE:()=>_,Je:()=>I,od:()=>g});var o=n(756275),i=n(995304),r=n(627625),s=n(260334),a=n(403263),l=n(199220);const d=(0,r.S)([l.m9,a.q],{message:(0,s.rn)("SETTINGS_IPV6_ADDRESS_OR_SUBNET_VALIDATION")});var c=n(962946),p=n(139847),u=n(277822);const m={[u.B.PORT_GROUP]:"SETTINGS_DUPLICATE_PORT_VALIDATION",[u.B.ADDRESS_GROUP]:"SETTINGS_DUPLICATE_IP_VALIDATION",[u.B.IPV6_ADDRESS_GROUP]:"SETTINGS_DUPLICATE_IP_VALIDATION"},_={[u.B.PORT_GROUP]:{id:"COMMON_PLACEHOLDER_EG",values:{value:"1-10"}},[u.B.ADDRESS_GROUP]:{id:"SETTINGS_IP_SUBNET_RANGE",values:{version:p.oi.IPV4}},[u.B.IPV6_ADDRESS_GROUP]:{id:"SETTINGS_IP_SUBNET_RANGE",values:{version:p.oi.IPV6}}},A=[u.B.PORT_GROUP,u.B.ADDRESS_GROUP,u.B.IPV6_ADDRESS_GROUP],g={[u.B.PORT_GROUP]:"COMMON_PORT",[u.B.ADDRESS_GROUP]:"SETTINGS_PROFILES_NETWORK_OBJECT_TYPE_ADDRESS_GROUP",[u.B.IPV6_ADDRESS_GROUP]:"SETTINGS_PROFILES_NETWORK_OBJECT_TYPE_IPV6_ADDRESS_GROUP"},h={[u.B.PORT_GROUP]:"COMMON_PORT",[u.B.ADDRESS_GROUP]:"COMMON_ADDRESS",[u.B.IPV6_ADDRESS_GROUP]:"COMMON_ADDRESS"},I={[u.B.PORT_GROUP]:(0,r.S)([o.L,i.i],{message:(0,s.rn)("SETTINGS_COMMON_PORT_LIST_VALIDATION_REQUIRED")}),[u.B.ADDRESS_GROUP]:c.q.refine(e=>!e.endsWith("/32"),{message:(0,s.rn)("SETTINGS_REMOVE_SUBNET_SUFFIX",{subnet:32})}),[u.B.IPV6_ADDRESS_GROUP]:d.refine(e=>!e.endsWith("/128"),{message:(0,s.rn)("SETTINGS_REMOVE_SUBNET_SUFFIX",{subnet:128})})}},277822(e,t,n){var o;n.d(t,{B:()=>o}),function(e){e.PORT_GROUP="port-group",e.ADDRESS_GROUP="address-group",e.IPV6_ADDRESS_GROUP="ipv6-address-group"}(o||(o={}))},847212(e,t,n){n.d(t,{b:()=>i});var o=n(198273);const i=(0,n(247816).A)(o.A)`
  ${({column:e})=>e?"justify-content: center;":"align-items: center;"}
`},547967(e,t,n){n.d(t,{AC:()=>m,D7:()=>_,Ie:()=>T,JL:()=>I,JX:()=>O,KY:()=>A,O2:()=>u,Op:()=>p,Rm:()=>g,e$:()=>E,t7:()=>h,yr:()=>S});var o=n(938984),i=n(814557),r=n(247816),s=n(409844),a=n(291508),l=n(61322),d=n(309130),c=n(100978);const p=(0,r.A)(c.A,(0,a.A)("inline","wrap"))`
  position: relative;
  flex: ${({inline:e})=>e?"1 1 0":"0 0 100%"};
  align-items: flex-start;
  flex-flow: ${({wrap:e})=>"row "+(e?"wrap":"nowrap")};
  gap: ${d.kc};
`,u=(0,r.A)(c.A,(0,a.A)("editMaxHeight","editFieldWrap"))`
  flex-direction: column;
  max-height: ${({editMaxHeight:e})=>`${e||300}px`};
  overflow-y: auto;
  overflow-x: hidden;
  gap: ${d.YC};

  ${({editFieldWrap:e,theme:{themeName:t}})=>e?`\n    gap: 0;\n\n    > * {\n      border-bottom: ${i.Ay[`desktop-border-divider-${t}`]};\n      padding-bottom: ${d.kc};\n      padding-top: ${d.kc};\n    }\n\n    > *:first-child {\n      padding-top: 0;\n    }\n\n    > *:last-child {\n      border-bottom: none;\n      padding-bottom: 0;\n    }\n  `:""}
`,m=(0,r.A)("div",(0,a.A)("isWindowsTable","rows","tableMaxHeight","marginTop"))`
  width: 100%;
  // windows table inherits height from parent container
  height: ${({rows:e,isWindowsTable:t})=>t&&`${l.I.ROW_HEIGHT*e+l.I.HEADER_HEIGHT}`}px;
  max-height: ${({tableMaxHeight:e})=>e?`${e}px`:"auto"};
  margin-top: ${({marginTop:e})=>e||d.Ln};

  table {
    td {
      max-width: 170px;

      span {
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
`,_=(0,r.A)(o.A)`
  margin-right: ${d.YC};
`,A=s.AH`
  :first-of-type {
    padding: 0 ${d.fS} 0 0px;
  }
`,g="drag-and-drop-table-row-placeholder",h=(0,r.A)(c.A)`
  flex-direction: column;

  /* Adjust weird padding on the right side for the ID column when right aligned (drag & drop table) */
  table > thead > tr > th:last-of-type {
    padding-right: ${d.kc};
  }

  /* Add missing border between drag and drop groups (tbody elements) */
  table > tbody {
    border-bottom: ${({theme:{themeName:e}})=>i.Ay[`desktop-border-divider-${e}`]};
  }
  /* Last cell in table is hover content which is not used in this table */
  table > tbody[data-rbd-droppable-context-id] td:not(:last-of-type),
  table > thead > tr > th {
    /* Align drag & drop table cell padding to regular table padding */
    padding-right: ${d.kc} !important;
  }
  /* Align drop zone placeholder row when a row is dragged to matched the CSS overrides for drag and drop table we use */
  table .${g} {
    display: flex;
  }
`,I=s.AH`
  /* This is default for the table rows, so we need it for the header. */
  display: flex;
  width: 100%;

  > th:first-child {
    /* Since we flex the header, we must specify this to align with the table rows. */
    width: 24px;
  }
  > th:not(:first-child) {
    /* Something inside UIC sets the padding to 8px for table header and 5px for table rows. This aligns it to make flex work. */
    padding-right: ${d.kc} !important;
  }
`,E=s.AH`
  /* Override the padding-right of the first column to align with manage + drop modes. */
  > th:first-child {
    padding-right: ${d.kc} !important;
  }
  > th:first-child:has(> label) {
    padding-right: 1px !important;
    width: 36px;
  }
`,S=s.AH`
  /* UIC already does this for some table states, like drag and drop and when in manage mode. If we just use this ALWAYS, we're avoiding many issues related to using different alignment techniques in different places. */
  display: flex;
`,O=s.AH`
  tbody {
    display: flex;
    flex-direction: column;
  }
`;function T(e,t){return s.AH`
    width: ${t.width?`${t.width}px`:"auto"};
    min-width: ${t.minWidth?`${t.minWidth}px`:"0px"};
    flex: ${t.growthFactor||0} !important;
    padding-left: ${d.kc} !important;
    padding-right: ${d.kc} !important;
  `}},256468(e,t,n){var o;n.d(t,{EE:()=>r,Uh:()=>o,Vf:()=>i}),function(e){e.SINGLE="single",e.PLURAL="plural"}(o||(o={}));const i="editActive",r=20},923898(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(843871),r=n(318087),s=n(680163);const a=function({fieldName:e,...t}){const{values:n,setFieldValue:a,errors:l,touched:d,submitCount:c}=(0,i.j7)();return(0,o.jsx)(s.A,{...t,value:(0,i.O6)(n,e),invalid:(0,r.t$)(e,l,d,c),onChange:t=>a(e,t)})}},79568(e,t,n){n.d(t,{A:()=>j});var o=n(274934),i=n(602086),r=n(977872),s=n(843871),a=n(247816),l=n(159469),d=n(826600),c=n(384783),p=n(700444),u=n(470070),m=n(694169),_=n(309100),A=n(897166),g=n(950804),h=n(260334);const I=(e,t)=>n=>{const o=e.safeParse(n);return!!o.success||(0,h.MS)(t,o.error.issues[0]?.message)};var E=n(277822),S=n(636432);const O=e=>g.A.object({name:g.A.string().label("COMMON_NAME").max(64,(0,o.jsx)(u.sA,{id:"SETTINGS_COMMON_FIELD_SHOULD_NOT_EXCEED_MAX_LENGTH",values:{name:(0,o.jsx)(u.sA,{id:"COMMON_NAME"}),limit:64}})).test("isUnique",(0,o.jsx)(u.sA,{id:"COMMON_PLEASE_ENTER_UNIQUE_NAME"}),t=>t&&!e.some(e=>e.name===t)).required(),group_type:g.A.string(),group_members:g.A.array().when("group_type",{is:E.B.PORT_GROUP,then:g.A.array().min(1,(0,o.jsx)(u.sA,{id:"SETTINGS_PROFILES_PORT_IP_GROUPS_FORM_FIELD_GROUP_MEMBERS_PORT_MIN"}))}).when("group_type",{is:E.B.ADDRESS_GROUP,then:g.A.array().min(1,(0,o.jsx)(u.sA,{id:"SETTINGS_PROFILES_PORT_IP_GROUPS_FORM_FIELD_GROUP_MEMBERS_ADDRESS_MIN"}))}).when("group_type",{is:E.B.IPV6_ADDRESS_GROUP,then:g.A.array().min(1,(0,o.jsx)(u.sA,{id:"SETTINGS_PROFILES_PORT_IP_GROUPS_FORM_FIELD_GROUP_MEMBERS_ADDRESS_MIN"}))})}),T=(e,t,n)=>{const o=S.uE[t],i=S.Je[t];return{disabled:e,fieldName:"group_members",labels:{fieldLabel:S.N0[t],modalTitle:"SETTINGS_ADD_MULTIPLE_NETWORK_LIST_VALUES",modalFieldPlaceholder:n({id:o.id},o.values)},extraFieldConfig:{placeholder:o.id,placeholderValues:o.values},fieldValidation:{validate:I(i,{formatMessage:n}),getDuplicationMessage:()=>n({id:S.Zb[t]})}}};var f=n(713804),x=n(198273),R=n(601154),N=n(277660),b=n(787481),v=n(120197),D=n(923898),P=n(847212);const M=({types:e,disabled:t})=>{const{values:n,initialValues:r}=(0,s.j7)(),{formatMessage:a}=(0,u.tz)(),l=(0,i.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),d=(0,i.useMemo)(()=>e?.length?S.iw.filter(t=>e.includes(t)):S.iw,[e]),c=(0,i.useMemo)(()=>r.group_type===n.group_type&&d.length<=1&&d.includes(n.group_type),[d,r.group_type,n.group_type]);return(0,o.jsxs)(R.A,{padding:"none",children:[(0,o.jsx)(f.A,{children:(0,o.jsx)(x.A,{column:!0,children:(0,o.jsx)(v.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_NAME",fast:!0})})}),c?null:(0,o.jsx)(f.A,{children:(0,o.jsxs)(P.b,{column:!0,style:{flex:1},children:[(0,o.jsx)(N.A,{label:(0,o.jsx)(u.sA,{id:"COMMON_TYPE"}),tooltip:(0,o.jsx)(u.sA,{id:"SETTINGS_PROFILES_NETWORK_LIST_TYPE_DESCRIPTION"})}),(0,o.jsx)(b.A,{children:d.map(e=>(0,o.jsx)(v.A,{name:"group_type",type:"radio",value:e,disabled:n.group_members.length>0,children:(0,o.jsx)(u.sA,{id:S.od[e]})},e))})]})}),(0,o.jsx)(f.A,{children:(0,o.jsx)(x.A,{children:(0,o.jsx)("form",{style:{width:"100%"},onSubmit:l,children:n.group_type?(0,o.jsx)(D.A,{...T(t,n.group_type,a)}):null},n.group_type)})})]})},C=(0,a.A)(c.A)`
  width: 400px !important;
  padding: 0 !important;
`,j=({hideModal:e,handleGroupField:t,types:n,initialValues:a={}})=>{const c=(0,r.wA)(),g=(0,r.d4)(A.EL),h=(0,r.d4)(m.O9),I=(0,i.useMemo)(()=>O(h),[h]),E=(0,i.useCallback)((n,{setSubmitting:o})=>c((0,_.Qe)({...n,group_members:(n.group_members||[]).filter(e=>!!e)})).then(e=>{t?.(e)}).then(e).catch(e=>{c((0,p.ox)({errorMessage:e.msg,errorValues:e,icon:l.C.danger,message:"SETTINGS_PROFILES_NETWORK_OBJECT_FORM_SAVE_FAILURE",values:{name:n.name}})),o(!1)}),[c,e,t]),S=(0,i.useMemo)(()=>({name:"",group_type:n?.[0],group_members:[],...a}),[a,n]);return(0,o.jsx)(s.l1,{onSubmit:E,initialValues:S,validationSchema:I,children:({handleSubmit:t,isSubmitting:i})=>(0,o.jsx)(C,{parentSelector:d.J,isOpen:!0,title:(0,o.jsx)(u.sA,{id:"SETTINGS_NEW_LIST"}),actions:[{text:(0,o.jsx)(u.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",onClick:e},{text:(0,o.jsx)(u.sA,{id:"COMMON_ACTION_CREATE"}),type:"submit",variant:"primary",disabled:g||i,loader:i?"spinner":void 0,onClick:()=>t()}],shouldFocusAfterRender:!0,allowOverflow:!0,children:(0,o.jsx)(M,{types:n,disabled:g})})})}},674871(e,t,n){n.d(t,{Jh:()=>i,ac:()=>o,o5:()=>r});const o={padding:"0"},i="policyId",r="createPolicy"},531984(e,t,n){n.d(t,{w:()=>s});var o=n(602086),i=n(977872),r=n(205521);const s=e=>{const t=(0,i.wA)();(0,o.useEffect)(()=>{t((0,r.SQ)(e))},[t,e])}},762542(e,t,n){n.d(t,{y:()=>i});var o=n(531984);const i=e=>(0,o.w)(e.formState.isDirty)},612389(e,t,n){n.d(t,{A:()=>p});var o=n(274934),i=n(814557),r=n(938984),s=n(247816),a=n(263705),l=n(309130),d=n(100978);const c=(0,s.A)(r.A)`
  line-height: 20px;
`,p=({icon:e,description:t,action:n,footer:r,background:s,...p})=>{const{themeName:u}=(0,a.u)();return(0,o.jsxs)(d.A,{flexGrow:1,borderRadius:l.YC,padding:l.kc,background:s||i.Ay[`desktop-color-neutral-01-${u}`],gap:l.kc,flexDirection:"column",...p,children:[(0,o.jsxs)(d.A,{flexGrow:1,gap:l.kc,children:[e,t?(0,o.jsx)(c,{size:"medium",children:t}):null,n?(0,o.jsx)(d.A,{marginLeft:"auto",children:(0,o.jsx)(c,{size:"medium",children:n})}):null]}),r]})}},753959(e,t,n){n.d(t,{A:()=>l});var o=n(274934),i=n(814557),r=n(853777),s=n(263705),a=n(612389);const l=({children:e,icon:t,background:n,...l})=>{const{themeName:d}=(0,s.u)();return(0,o.jsx)(a.A,{icon:t||(0,o.jsx)(r.A,{variant:"fill",size:"original",color:i.Ay[`desktop-color-ublue-06-${d}`]}),description:e,background:n,...l})}},535322(e,t,n){n.d(t,{A:()=>_,I:()=>o});var o,i=n(274934),r=n(814557),s=n(158885),a=n(247816),l=n(565527),d=n(309130),c=n(100978),p=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(o||(o={}));const u=(0,a.A)(c.A,(0,p.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||r.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${d.Ln}`:d.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||d.Ln};
  ${({margin:e})=>e?`margin: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  width: ${({width:e="100%"})=>e};
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  ${({isButtonList:e})=>e?`\n    > div {\n      display: flex;\n      height: 48px;\n      border-bottom: ${({theme:{themeName:e}})=>r.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,m=(0,a.A)(s.A,(0,p.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||r.Ay[n===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({margin:e})=>e?`margin: ${e};`:""}
  ${({padding:e})=>e?`padding: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  > li {
    > div:first-child {
      background: ${({background:e,theme:{themeName:t}})=>e||r.Ay[t===l.S.DARK?`desktop-color-neutral-01-${l.S.DARK}`:`desktop-color-neutral-00-${l.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${d.Ln} ${d.Ln};
      }
    }
  }
`,_=({type:e,marginBottom:t,margin:n,padding:r,flex:s,width:a,nested:l,...d})=>"items"in d?(0,i.jsx)(m,{marginBottom:t,margin:n,padding:r,flex:s,nested:l,...d}):(0,i.jsx)(u,{nested:l,width:a,marginBottom:t,margin:n,padding:r,flex:s,isButtonList:e===o.BUTTON_LIST,...d,children:d.children})},796091(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(833466),r=n(309130),s=n(100978);const a=e=>(0,o.jsx)(s.A,{paddingTop:r.YC,paddingBottom:r.YC,gap:r.Ln,rowGap:r.YC,flexWrap:"wrap",minHeight:i.b,alignItems:"center",...e})},199742(e,t,n){n.d(t,{A:()=>d});var o=n(274934),i=n(602086),r=n(558948),s=n(309130),a=n(100978),l=n(535322);const d=({actions:e})=>(0,o.jsx)(l.A,{marginBottom:"none",children:(0,o.jsx)(a.A,{flexDirection:"column",gap:s.kc,width:"100%",children:e.filter(Boolean).map((e,t,n)=>(0,o.jsxs)(i.Fragment,{children:[e,t<n.length-1?(0,o.jsx)(a.A,{width:"100%",flexDirection:"column",paddingTop:s.YC,paddingBottom:s.YC,children:(0,o.jsx)(r.A,{orientation:"horizontal"})}):null]},[t,e.toString()].join()))})})},963428(e,t,n){n.d(t,{A:()=>c});var o=n(274934),i=n(977872),r=n(602086),s=n(954702),a=n(669439),l=n(897166),d=n(100978);const c=(0,r.forwardRef)(({allowReadOnly:e,disabledReason:t,...n},r)=>{const c=(0,i.d4)(l.EL)&&!e;return(0,o.jsx)(d.A,{alignItems:"center",children:(0,o.jsx)(a.A,{description:t,placement:"left",children:(0,o.jsx)(s.A,{fontSize:"medium",type:"button",...n,isDisabled:c||n.isDisabled||!!t,ref:r})})})})},480562(e,t,n){n.d(t,{i:()=>s});var o=n(274934),i=n(125799),r=n(767822);const s=e=>(0,o.jsx)(i.A,{description:e.option&&"tooltipDescription"in e.option?e.option.tooltipDescription:null,position:"left",portal:!0,children:(0,o.jsx)(r.q,{...e})})},309675(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(814557),r=n(600191),s=n(263705);const a=e=>{const{themeName:t}=(0,s.u)();return(0,o.jsx)(r.A,{size:"original",variant:"fill",color:i.Ay[`desktop-color-orange-06-${t}`],...e})}},384783(e,t,n){n.d(t,{A:()=>s});var o=n(274934),i=n(832162),r=n(826600);const s=({children:e=null,hideModal:t,onRequestClose:n,portalSelector:s=r.J,forwardedRef:a=null,...l})=>(0,o.jsx)(i.A,{isOpen:!0,shouldCloseOnEsc:!0,onRequestClose:n||t,parentSelector:s,ref:a,...l,children:e})},826600(e,t,n){n.d(t,{J:()=>o,g:()=>i});const o=()=>document.getElementById("modal-container"),i=()=>document.getElementById("modal-settings-container")},277660(e,t,n){n.d(t,{A:()=>d});var o=n(274934),i=n(125799),r=n(938984),s=n(831721),a=n(309130),l=n(100978);const d=({label:e,tooltip:t,tooltipProps:n,style:d})=>(0,o.jsxs)(l.A,{alignItems:"center",gap:a.YC,style:d,children:[(0,o.jsx)(r.A,{size:"small",color:"text-3",children:e}),t?(0,o.jsx)(i.A,{description:t,portal:!0,style:{display:"flex",alignItems:"center"},...n,children:(0,o.jsx)(s.A,{size:"original",isActive:!0})}):null]})},420174(e,t,n){n.d(t,{H5:()=>s,ZS:()=>a});var o=n(274934),i=n(602086);const r=(0,i.createContext)(void 0),s=()=>{const e=(0,i.useContext)(r);return void 0===e?{sharedName:"",setSharedName:()=>{}}:e},a=({children:e})=>{const[t,n]=(0,i.useState)(""),s=(0,i.useMemo)(()=>({sharedName:t,setSharedName:n}),[t]);return(0,o.jsx)(r.Provider,{value:s,children:e})}},120698(e,t,n){n.r(t),n.d(t,{default:()=>r});var o=n(274934),i=n(949239);const r=({activeItem:e})=>(0,o.jsx)(i.A,{activeItem:e},e?._id)},638644(e,t,n){n.d(t,{A:()=>r});var o=n(274934),i=n(938984);const r=({enabled:e,color:t,children:n,...r})=>(0,o.jsx)(i.A,{color:!1===e?"disabled":t||"inherit",size:"inherit",...r,children:n})},61322(e,t,n){n.d(t,{I:()=>o});const o={HEADER_HEIGHT:32,ROW_HEIGHT:32,EDIT_FIELD_HEIGHT:36,getHeight(e,t,n,o){return Math.min((o||this.ROW_HEIGHT)*e+(n??this.HEADER_HEIGHT),(o||this.ROW_HEIGHT)*t+(n??this.HEADER_HEIGHT))},getEditContainerHeight(e,t,n){return Math.min((n||this.EDIT_FIELD_HEIGHT)*e,(n||this.EDIT_FIELD_HEIGHT)*t)}}},246798(e,t,n){n.d(t,{Ay:()=>d});var o=n(274934),i=n(42220),r=n(104669),s=n(976888),a=n(260334);const l=e=>{if(!e)return[];const t=Object.values(e).map(e=>(e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type)(e)?l(e):[]);return[e.message,...t.flat()].filter(s.z)},d=function({name:e,form:t,noMargin:n}){const s=(0,a.L_)();return(0,o.jsx)(i.xI,{name:e,control:t.control,render:({fieldState:e})=>{const t=l(e.error)[0];return(0,o.jsx)(o.Fragment,{children:e.invalid&&t?(0,o.jsx)(r.A,{isInvalid:!0,style:n?{paddingTop:0,paddingBottom:0}:void 0,label:s(t)}):null})}})}},518204(e,t,n){n.d(t,{A:()=>h});var o=n(274934),i=n(602086),r=n(977872),s=n(117948),a=n(599110),l=n(246798),d=n(689941),c=n(184931),p=n(833466),u=n(309130),m=n(100978),_=n(470070),A=n(79568),g=n(694169);const h=function({form:e,name:t,types:n,getDisabledReason:h,onAfterChange:I}){const E=(0,r.d4)(g.O9),[S,O]=(0,i.useState)(!1),T=(0,i.useMemo)(()=>(0,s.A)(E.filter(({group_type:e})=>e&&n.includes(e)),({name:e})=>e,"asc").map(({_id:e,name:t,group_type:n})=>{const o=h?.({group_type:n});return{value:e,label:t,disabled:!!o,tooltipDescription:o}}),[h,E,n]),f=(0,c.mQ)();return(0,o.jsxs)(m.A,{flexDirection:"column",width:"100%",children:[(0,o.jsxs)(m.A,{gap:u.kc,alignItems:"flex-start",children:[T.length?(0,o.jsx)(m.A,{flexDirection:"column",width:"100%",flex:1,children:(0,o.jsx)(d.A,{control:e.control,name:t,searchable:!0,options:T,onAfterChange:I})}):null,(0,o.jsx)(m.A,{height:p.b,children:(0,o.jsx)(a.A,{type:"button",variant:"inline",size:"medium",disabled:f,onClick:()=>{O(!0)},children:(0,o.jsx)(_.sA,{id:T.length?"COMMON_NEW":"COMMON_CREATE_NEW"})})})]}),T.length?null:(0,o.jsx)(l.Ay,{name:t,form:e}),S?(0,o.jsx)(A.A,{hideModal:()=>{O(!1)},handleGroupField:o=>{o&&o.group_type&&n.includes(o.group_type)&&o._id&&(e.setValue(t,o._id),I?.(o._id))},types:n}):null]})}},846294(e,t,n){n.d(t,{A:()=>d});var o=n(274934),i=n(125799),r=n(409844),s=n(184931),a=n(877840);const l=r.AH`
  width: fit-content;
`,d=({reasons:e,reason:t,children:n,isInteractive:r,noWrap:d,position:c,fitContent:p})=>{const u=(0,s.pv)(),m=[t,...e||[]].filter(Boolean)[0]||null,_=!!m;return(0,o.jsx)(a.A,{isDisabled:{fields:_,labels:_,tooltipIcons:_,tooltipPopovers:!u.fields&&_},children:(0,o.jsx)(i.A,{description:u.fields?null:m,portal:!0,isInteractive:r,noWrap:d,position:c,className:p?l:void 0,children:n})})}},877840(e,t,n){n.d(t,{A:()=>a});var o=n(274934),i=n(602086),r=n(184931),s=n(712642);const a=({isDisabled:e,isAdditive:t=!0,children:n})=>{const a=(0,r.pv)(),l=(0,i.useMemo)(()=>"boolean"==typeof e?{fields:e,labels:e,tooltipIcons:e,tooltipPopovers:!1}:e,[e]),d=(0,i.useMemo)(()=>({fields:t?l.fields||a.fields:l.fields,labels:t?l.labels||a.labels:l.labels,tooltipIcons:t?l.tooltipIcons||a.tooltipIcons:l.tooltipIcons,tooltipPopovers:t?l.tooltipPopovers||a.tooltipPopovers:l.tooltipPopovers}),[t,l.fields,l.labels,l.tooltipIcons,l.tooltipPopovers,a.fields,a.labels,a.tooltipIcons,a.tooltipPopovers]);return(0,o.jsx)(s.I.Provider,{value:d,children:n})}},625133(e,t,n){n.d(t,{A:()=>c});var o=n(274934),i=n(42220),r=n(762705),s=n(309130),a=n(304151),l=n(100978),d=n(184931);const c=function({control:e,name:t,children:n,tooltip:c,tooltipProps:p,onToggle:u,renderCheckbox:m,inputClassName:_}){const A=(0,d.mQ)();return(0,o.jsx)(i.xI,{control:e,name:t,render:({field:e})=>{const t=(0,o.jsx)(r.A,{id:e.name,onChange:({target:{checked:t}})=>{e.onChange(t),u?.(t)},checked:!!e.value,disabled:A,inputClassName:_,children:n});return(0,o.jsxs)(l.A,{gap:s.YC,alignItems:"center",children:[m?m(t,e):t,c?(0,o.jsx)(a.A,{description:c,...p}):null]})}})}},689941(e,t,n){n.d(t,{A:()=>u});var o=n(274934),i=n(693371),r=n(42220),s=n(480562),a=n(164487),l=n(597750),d=n(147045),c=n(260334),p=n(184931);const u=function({control:e,name:t,label:n,options:u,tooltip:m,tooltipProps:_,placeholder:A,renderOption:g,onChange:h,onAfterChange:I,searchable:E,searchableProps:S,portal:O,maxHeight:T,disableValidationMessage:f,isReadOnly:x,[d.L]:R}){const N=(0,p.mQ)(),b=(0,c.L_)();return(0,o.jsx)(r.xI,{control:e,name:t,render:({field:e,fieldState:d,formState:c})=>(0,o.jsxs)(l.A,{gap:2,children:[n?(0,o.jsx)(a.A,{htmlFor:t,tooltip:m,tooltipProps:{portal:!0,..._},children:n}):null,(0,o.jsx)(i.A,{variant:"secondary",width:"100%",renderOption:g??s.i,options:u,...e,readOnly:x,disabled:N,onChange:(t,n)=>{const o=h?h(n,{field:e,fieldState:d,formState:c}):e.onChange(n);return I?.(n),o},value:e.value??"",invalid:d.invalid&&!f?b((0,r.Jt)(c.errors,t)?.message)||!0:void 0,placeholder:A,searchable:E,searchableProps:S,portal:O,"data-testid":R,maxHeight:T})]})})}},482609(e,t,n){n.d(t,{A:()=>p});var o=n(274934),i=n(602086),r=n(42220),s=n(956976),a=n(309130),l=n(304151),d=n(100978),c=n(184931);const p=(0,i.forwardRef)(function({control:e,name:t,children:n,tooltip:i,tooltipProps:p,value:u,onCheck:m,..._},A){const g=(0,c.mQ)();return(0,o.jsx)(r.xI,{control:e,name:t,render:({field:e})=>(0,o.jsxs)(d.A,{gap:a.YC,alignItems:"center",ref:A,..._,children:[(0,o.jsx)(s.A,{id:e.name,onChange:({target:{checked:t}})=>{t&&(e.onChange(u),m?.())},checked:e.value===u,disabled:g,value:e.value,children:n}),i?(0,o.jsx)(l.A,{description:i,...p}):null]})})})},635891(e,t,n){n.d(t,{A:()=>c});var o=n(274934),i=n(42220),r=n(843615),s=n(95032),a=n(309130),l=n(260334),d=n(184931);const c=function({control:e,name:t,label:n,placeholder:c,tooltip:p,tooltipProps:u,autoFocus:m,motif:_,onChange:A,onBlur:g,onAfterChange:h,onPaste:I,onKeyDown:E,passwordToggle:S,type:O,helperMessage:T,autoComplete:f,contentBefore:x,contentAfter:R,onFocus:N,value:b,invalid:v}){const D=(0,d.mQ)(),P=(0,d.Im)(),M=(0,d.q)(),C=(0,l.L_)();return(0,o.jsx)(i.xI,{control:e,name:t,render:({field:e,fieldState:l,formState:d})=>(0,o.jsx)(r.A,{type:O||(S?"password":"text"),variant:"secondary",width:"100%",autoFocus:m,...e,onChange:t=>{A?A(t,e,d):e.onChange(t),h?.(t)},onBlur:t=>{g?g(t,e,d):e.onBlur()},onFocus:N,onPaste:I,disabled:D,value:b??e.value?.toString(),invalid:v||(l.invalid?(0,o.jsxs)(s.A,{variant:"inherit",style:{overflowWrap:"break-word"},children:[C((0,i.Jt)(d.errors,t)?.message)||!0," "]}):void 0),label:n,placeholder:c,labelTooltip:p,labelTooltipProps:{style:{opacity:P?a.xN:void 0,pointerEvents:M?"none":void 0,...u?.style},...u},motif:_,passwordToggle:S,helperMessage:T,autoComplete:f,onKeyDown:E,contentBefore:x,contentAfter:R})})}},149450(e,t,n){n.d(t,{B:()=>a,b:()=>s});var o=n(241792),i=n(745454),r=n(260334);const s=o.Yj({message:(0,r.rn)("COMMON_VALIDATION_VALID_IPV4")}).refine(e=>!e||(0,i.isValidIpv4)(e),{message:(0,r.rn)("COMMON_VALIDATION_VALID_IPV4")}),a=o.Yj({message:(0,r.rn)("COMMON_VALIDATION_VALID_IPV4")}).refine(e=>(0,i.isValidIpv4)(e),{message:(0,r.rn)("COMMON_VALIDATION_VALID_IPV4")})},962946(e,t,n){n.d(t,{q:()=>m});var o=n(627625),i=n(260334),r=n(847849),s=n(241792),a=n(745454),l=n(810024),d=n(570866),c=n(635187);const p=s.Yj({message:(0,i.rn)("COMMON_VALIDATION_IPV4_SUBNET")}).refine(e=>{const t=e.split(c.jr),[n,o]=t;return 2===t.length&&n&&o&&d.zF.test(n)&&d.zF.test(o)&&(0,a.isValidIpv4)(n)&&(0,a.isValidIpv4)(o)&&(0,l.GQ)(n)<(0,l.GQ)(o)},{message:(0,i.rn)("COMMON_VALIDATION_IPV4_SUBNET")});var u=n(149450);const m=(0,o.S)([u.B,r.K,p],{message:(0,i.rn)("SETTINGS_ROUTING_NAT_FORM_IP_OR_SUBNET_OR_RANGE_VALIDATION")})},847849(e,t,n){n.d(t,{K:()=>a});var o=n(241792),i=n(810024),r=n(570866),s=n(260334);const a=o.Yj({message:(0,s.rn)("COMMON_VALIDATION_IPV4_SUBNET")}).regex(r.wK,{message:(0,s.rn)("COMMON_VALIDATION_IPV4_SUBNET")}).refine(i.N7,{message:(0,s.rn)("COMMON_VALIDATION_IPV4_SUBNET")})},199220(e,t,n){n.d(t,{Jh:()=>a,XK:()=>s,m9:()=>l});var o=n(241792),i=n(640708),r=n(260334);const s=o.Yj().ip({version:"v6",message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}).refine(e=>!e||!e.includes("%"),{message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),a=o.KC([o.Yj().ip({version:"v6",message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),o.eu("")]).optional().refine(e=>!e||!e.includes("%"),{message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_INVALID")}),l=s.refine(e=>!(0,i.m0)(e),{message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_IPV4_MAPPED_IPV6_INVALID")}).refine(e=>!(0,i.aN)(e),{message:(0,r.rn)("SETTINGS_NETWORKS_IPV6_ADDRESS_MULTICAST_INVALID")})},403263(e,t,n){n.d(t,{q:()=>s});var o=n(241792),i=n(640708),r=n(260334);const s=o.Yj({message:(0,r.rn)("COMMON_VALIDATION_IPV6_SUBNET")}).refine(i.In,{message:(0,r.rn)("COMMON_VALIDATION_IPV6_SUBNET")})},995304(e,t,n){n.d(t,{i:()=>a});var o=n(241792),i=n(635187),r=n(260334),s=n(756275);const a=o.Yj().refine(e=>{const t=e.split(i.jr);return 2===t.length&&(0,s.w)(t[0])&&(0,s.w)(t[1])&&Number(t[0])<Number(t[1])},{message:(0,r.rn)("SETTINGS_COMMON_SINGLE_PORT_RANGE_VALIDATION_REQUIRED")})},756275(e,t,n){n.d(t,{L:()=>a,w:()=>s});var o=n(241792),i=n(260334);const r=/^\d+$/,s=e=>{if(!r.test(e)||e.startsWith("0"))return!1;const t=Number.parseInt(e,10);return!Number.isNaN(t)&&Number.isInteger(t)&&t>=1&&t<=65535},a=o.Yj().refine(e=>s(e),{message:(0,i.rn)("SETTINGS_COMMON_SINGLE_PORT_VALIDATION_REQUIRED")})},627625(e,t,n){n.d(t,{S:()=>i});var o=n(241792);function i(e,{message:t}){return o.Ie(t=>o.KC(e).safeParse(t).success,{message:t})}},509927(e,t,n){n.d(t,{V:()=>s});var o=n(602086),i=n(603606);const r=e=>{const t=(0,o.useRef)(e);return(0,o.useEffect)(()=>{t.current=e},[e]),(0,o.useCallback)((...e)=>t.current(...e),[])};function s(e,t){const n=(0,o.useRef)([]),[,s]=(0,o.useState)(0),[a,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{const e=setInterval(()=>{n.current.length&&t?.estimatedDurationMs&&s(e=>e+1)},1e3);return()=>clearInterval(e)},[t?.estimatedDurationMs]);const d=t?.dedupe??!1,c=r(t?.onSuccess||(()=>{})),p=r(t?.onError||(()=>{})),u=(0,o.useCallback)((...o)=>{if(d&&n.current.length)return Promise.reject();const r=(async()=>e(...o))();return n.current.push({promise:r,startedAt:Date.now()}),s(e=>e+1),r.then(e=>(c?.(e),l(e),e)).catch(async e=>{if(t?.delayOnErrorMs&&await(0,i.u)(t.delayOnErrorMs),l(null),!p)throw e;p(e)}).finally(async()=>{n.current=n.current.filter(e=>e.promise!==r),s(e=>e+1)})},[e,d,p,c,t?.delayOnErrorMs]),m=n.current.at(-1),_=m&&t?.estimatedDurationMs?Math.min((Date.now()-m.startedAt)/t.estimatedDurationMs,.9):void 0;return{execute:u,isLoading:!!n.current.length,lastData:a,estimatedProgress:_}}},292027(e,t,n){n.d(t,{A:()=>g});var o=n(274934),i=n(199742),r=n(977872),s=n(159469),a=n(464920),l=n(509927),d=n(963428),c=n(700444),p=n(470070);const u=({onResume:e,disabledReason:t})=>{const n=(0,r.wA)(),i=(0,l.V)(()=>e(),{onError:e=>{const t=(0,a.F)(e)?e:void 0;return n((0,c.ox)({icon:s.C.danger,message:"SETTINGS_POLICY_RESUME_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,o.jsx)(d.A,{onPress:i.execute,isDisabled:i.isLoading,disabledReason:t,children:(0,o.jsx)(p.sA,{id:"COMMON_ACTION_RESUME"})})};var m=n(404056),_=n(146215);const A=({name:e,onPause:t,disabledReason:n})=>{const i=(0,r.wA)(),u=(0,l.V)(()=>t(),{onError:e=>{const t=(0,a.F)(e)?e:void 0;return i((0,c.ox)({icon:s.C.danger,message:"SETTINGS_POLICY_PAUSE_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,o.jsx)(_.A,{trigger:(0,o.jsx)(d.A,{isDisabled:u.isLoading,disabledReason:n,children:(0,o.jsx)(p.sA,{id:"COMMON_ACTION_PAUSE"})}),confirmButtonVariant:"emphasis",title:(0,o.jsx)(p.sA,{id:"SETTINGS_SECURITY_PAUSE_POLICY_TITLE",values:{count:1}}),message:(0,o.jsx)(p.sA,{id:"SETTINGS_SECURITY_PAUSE_FIREWALL_POLICY_MESSAGE_SINGLE",values:{name:e}}),onConfirm:()=>u.execute()})},g=({enabled:e,name:t,onPause:n,pauseDisabledReason:r,onResume:s,resumeDisabledReason:a,onRemove:l,removeDisabledReason:d,removeAdditionalMessage:c})=>(0,o.jsx)(i.A,{actions:[e?(0,o.jsx)(A,{name:t,onPause:n,disabledReason:r}):(0,o.jsx)(u,{onResume:s,disabledReason:a}),(0,o.jsx)(m.A,{name:t,onRemove:l,disabledReason:d,additionalMessage:c})]})},404056(e,t,n){n.d(t,{A:()=>_});var o=n(274934),i=n(977872),r=n(159469),s=n(464920),a=n(509927),l=n(963428),d=n(146215),c=n(700444),p=n(470070),u=n(100978),m=n(309130);const _=({onRemove:e,name:t,disabledReason:n,additionalMessage:_})=>{const A=(0,i.wA)(),g=(0,a.V)(()=>e(),{onError:e=>{const t=(0,s.F)(e)?e:void 0;return A((0,c.ox)({icon:r.C.danger,message:"SETTINGS_POLICY_DELETE_FAILURE",values:{count:1},errorMessage:t?.msg,errorValues:t}))}});return(0,o.jsx)(d.A,{trigger:(0,o.jsx)(l.A,{variant:"destructive",disabledReason:n,children:(0,o.jsx)(p.sA,{id:"COMMON_ACTION_REMOVE"})}),title:(0,o.jsx)(p.sA,{id:"SETTINGS_SECURITY_REMOVE_POLICY_TITLE",values:{count:1}}),message:_?(0,o.jsxs)(u.A,{flexDirection:"column",gap:m.kc,children:[(0,o.jsx)(p.sA,{id:"SETTINGS_SECURITY_REMOVE_FIREWALL_POLICY_SINGLE_MESSAGE",values:{name:t}}),_]}):(0,o.jsx)(p.sA,{id:"SETTINGS_SECURITY_REMOVE_FIREWALL_POLICY_SINGLE_MESSAGE",values:{name:t}}),onConfirm:()=>g.execute()})}},603606(e,t,n){n.d(t,{u:()=>o});const o=e=>new Promise(t=>{setTimeout(t,e)})},976888(e,t,n){function o(e){return Boolean(e)}n.d(t,{z:()=>o})}}]);