"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[36793,89965],{86571:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(296540),i=n(217439),o=n(699784);const r=({id:e,children:t,values:n})=>a.createElement(i.A,{color:"text-1",weight:"bold",size:"medium"},e?a.createElement(o.sA,{id:e,values:n}):null,t)},137625:(e,t,n)=>{n.d(t,{A:()=>d});var a=n(296540),i=n(353899),o=n(132196),r=n(372737),l=n(566723),s=n(699784);const d=({children:e=null,title:t,titleValues:n,message:d,messageValues:c,handleConfirm:m=()=>null,handleClose:u=()=>null,handleCancel:A,isOpen:E,buttonVariant:_="primary",cancelButtonVariant:g="tertiary",cancelButtonMessage:p="COMMON_ACTION_CANCEL",buttonMessage:b="COMMON_ACTION_CONFIRM",buttonDisabled:N=!1,position:h="top",showHeaderClose:C=!1,contentClassName:f="",body:I,titleBody:v,className:k,rootClose:O=!1,footerActions:w})=>{const y=(0,a.useCallback)(e=>{E&&(e.stopPropagation(),e.key===r.U.ENTER?m():e.key===r.U.ESCAPE&&u(!1))},[E,m,u]);(0,a.useEffect)(()=>(window.addEventListener("keydown",y,!0),()=>{window.removeEventListener("keydown",y,!0)}),[y]);const T=(0,a.useCallback)(()=>{u(!1),A?.()},[u,A]),D=(0,a.useCallback)(()=>{u(!1),m()},[u,m]),S=(0,a.useMemo)(()=>[{text:a.createElement(s.sA,{id:p}),variant:g,onClick:T},{text:a.createElement(s.sA,{id:b}),disabled:N,variant:_,onClick:D}],[b,_,p,g,T,D,N]),M=(0,a.useCallback)(()=>{u(!1)},[u]),x=o.AH`
    ${t?"":`margin-top: ${l.xO}`}
  `;return a.createElement(i.A,{title:t?a.createElement(s.sA,{id:t,values:n}):v||null,...d?{body:a.createElement(a.Fragment,null,a.createElement(s.sA,{id:d,values:c}),I)}:{body:I},position:h,portal:!0,actions:w||S,showHeaderClose:C,contentClassName:o.AH`
        ${x}
        ${f}
      `,onRequestClose:M,isOpen:E,allowOverflow:!0,rootClose:O,className:k},e)}},263262:(e,t,n)=>{n.d(t,{A:()=>k,g:()=>I});var a=n(868238),i=n(469733),o=n(296540),r=n(951272),l=n(927099),s=n(870443),d=n(566723),c=n(855019),m=n(62227),u=n(143811),A=n(294303),E=n(845030),_=n(699784),g=n(302167),p=n(366188),b=n(780811),N=n(239417),h=n(785146),C=n(31208),f=n(726317);const I="network",v=(0,r.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({activeItem:{config_network:e,model:t,ip:n,switch_vlan_enabled:a,lte_limit_enabled:i,lte_limit:o,mgmt_network_id:r,connection_network_id:l},nativeNetworks:s})=>{const d=(0,b.U$e)(s,l);return{config_network:{type:e?.type||c.NL.DHCP,ip:e?.ip||n||"",netmask:e?.netmask||d?.netmask||"",gateway:e?.gateway||d?.ip||"",dns1:e?.dns1||d?.dns1||"",dns2:e?.dns2||d?.dns2||"",dnssuffix:e?.dnssuffix||"",bonding_enabled:e?.bonding_enabled||!1},mgmt_network_id:(0,b.ewD)(s,r),switch_vlan_enabled:a||!1,...((0,b.C6C)({model:t}),{})}},handleSubmit:(e,{resetForm:t})=>{t({values:e})},validationSchema:({honeypotNetworksIps:e,clients:t})=>s.A.object().shape({config_network:(0,m.d)(e,t),mgmt_network_id:s.A.string(),lte_limit_enabled:s.A.boolean().label("COMMON_LTE_DATA_LIMIT"),lte_limit:s.A.number().integer().label("COMMON_DATA_LIMIT").when("lte_limit_enabled",{is:!0,then:s.A.number().min(1).required().label("COMMON_DATA_LIMIT")})})}),k=(0,a.Zz)((0,i.connect)(e=>({nativeNetworks:(0,p.Tn)(e),honeypotNetworksIps:(0,g.Yk)(e),clients:(0,N.A8)(e)})),v)(({setFormDirty:e,setFormInvalid:t,dirty:n,values:a,resetForm:r,isValid:s,initialValues:m,activeItem:g,nativeNetworks:p,hideNetworkOverride:N,formName:v=I})=>{const k=(0,i.useDispatch)(),O=(0,b.iQS)(g.model),w=(0,b.C6C)(g);(0,o.useEffect)(()=>{e(I,n),t(I,!s)},[e,t,n,s]);const y=(0,b.moU)(g);(0,o.useEffect)(()=>(k((0,E.uo)({[v]:()=>{const e={config_network:a.config_network?.type===c.NL.STATIC?a.config_network:{type:c.NL.DHCP,bonding_enabled:a.config_network?.bonding_enabled},mgmt_network_id:a.mgmt_network_id};return O&&(e.switch_vlan_enabled=a.switch_vlan_enabled,m.switch_vlan_enabled&&!a.switch_vlan_enabled&&g.port_overrides?.length&&(e.port_overrides=(g.port_overrides||[]).map(({portconf_id:e,...t})=>t))),e}})),k((0,E.Oo)({[v]:()=>r({values:a})})),k((0,E.rW)({[v]:r})),()=>{k((0,E.uo)({[v]:null})),k((0,E.Oo)({[v]:null})),k((0,E.rW)({[v]:null}))}),[k,r,a,v,g.port_overrides,m.switch_vlan_enabled,O,w]);const T=!N&&!y&&p.length>1&&!(0,b.q82)({model:g.model})&&!(0,b.xQi)({model:g.model});return o.createElement(A.A,{flexDirection:"column",gap:d.S2},T?o.createElement(h.A,{nativeNetworks:p,activeItemMac:g.mac}):null,o.createElement(f.A,null),a.config_network?.type===c.NL.STATIC?o.createElement(C.A,null):null,(0,b.xyH)(g)||(0,b.Eyk)(g)||(0,b._iI)(g)||(0,b.W46)(g)?o.createElement(A.A,null,o.createElement(u.A,{name:"config_network.bonding_enabled",type:"realCheckbox"},o.createElement(_.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_AGGREGATION"}))):null,O?o.createElement(A.A,{flexDirection:"column",gap:d.kc},o.createElement(l.A,{weight:"bold",size:"body"},o.createElement(_.sA,{id:"COMMON_VLAN"})),o.createElement(A.A,{justifyContent:"space-between"},o.createElement(l.A,{size:"body"},o.createElement(_.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_VLAN"})),o.createElement(u.A,{type:"checkbox",name:"switch_vlan_enabled"}))):null,null)})},349665:(e,t,n)=>{n.d(t,{A:()=>r});var a=n(296540),i=n(705228),o=n(294303);const r=({maxWidth:e,...t})=>a.createElement(o.A,{flexDirection:"column",width:"100%",maxWidth:"settingsGridContent"===e?i.ng:e,...t})},372737:(e,t,n)=>{var a;n.d(t,{U:()=>a}),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.ESCAPE="Escape"}(a||(a={}))},449688:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(296540);const i=function(e){return t=>n=>{const[i,o]=(0,a.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[r,l]=(0,a.useState)(Object.fromEntries(e.map(e=>[e,!1]))),s=(0,a.useCallback)((e,t)=>{o(n=>({...n,[e]:t}))},[]),d=(0,a.useCallback)((e,t)=>{l(n=>({...n,[e]:t}))},[]),c=!!Object.values(i).find(e=>e),m=!!Object.values(r).find(e=>e);return a.createElement(t,{isDirty:c,isInvalid:m,formStates:i,setFormDirty:s,setFormInvalid:d,...n})}}},553432:(e,t,n)=>{n.d(t,{A:()=>l});var a=n(296540),i=n(454195),o=n(566723),r=n(294303);const l=e=>a.createElement(r.A,{paddingTop:o.YC,paddingBottom:o.YC,gap:o.Ln,rowGap:o.YC,flexWrap:"wrap",minHeight:i.b,alignItems:"center",...e})},689965:(e,t,n)=>{n.d(t,{A:()=>A,I:()=>a});var a,i=n(296540),o=n(822336),r=n(427853),l=n(71479),s=n(825032),d=n(566723),c=n(294303);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(a||(a={}));const m=(0,l.A)(c.A,{shouldForwardProp:e=>!["marginBottom","isButtonList","margin","flex","width","padding","nested","background"].includes(e)})`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||o.Ay[n===s.S.DARK?`desktop-color-neutral-${t?"00":"01"}-dark`:`desktop-color-neutral-${t?"01":"00"}-light`]};
  padding: ${({theme:e,isButtonList:t,padding:n})=>n||(t?`0 ${e.spacing["spacing-l"]}`:e.spacing["spacing-l"])};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({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}})=>o.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,u=(0,l.A)(r.A,{shouldForwardProp:e=>!["marginBottom","margin","flex","padding","nested","background"].includes(e)})`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||o.Ay[n===s.S.DARK?`desktop-color-neutral-${t?"00":"01"}-dark`:`desktop-color-neutral-${t?"01":"00"}-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||o.Ay[t===s.S.DARK?"desktop-color-neutral-01-dark":"desktop-color-neutral-00-light"]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0 ${d.Ln} ${d.Ln};
      > div {
        padding: 0;
      }
    }
  }
`,A=({type:e,marginBottom:t,margin:n,padding:o,flex:r,width:l,nested:s,...d})=>"items"in d?i.createElement(u,{marginBottom:t,margin:n,padding:o,flex:r,nested:s,...d}):i.createElement(m,{nested:s,width:l,marginBottom:t,margin:n,padding:o,flex:r,isButtonList:e===a.BUTTON_LIST,...d},d.children)},726317:(e,t,n)=>{n.d(t,{A:()=>m});var a=n(296540),i=n(927099),o=n(454195),r=n(566723),l=n(855019),s=n(143811),d=n(294303),c=n(699784);const m=(0,a.memo)(()=>a.createElement(d.A,{flexDirection:"column"},a.createElement(i.A,{color:"tertiary",size:"caption"},a.createElement(c.sA,{id:"COMMON_IP_CONFIGURATION"})),a.createElement(d.A,{height:o.b,alignItems:"center",gap:r.Ln},a.createElement(s.A,{name:"config_network.type",type:"radio",value:l.NL.DHCP},a.createElement(c.sA,{id:"COMMON_DHCP"})),a.createElement(s.A,{name:"config_network.type",type:"radio",value:l.NL.STATIC},a.createElement(c.sA,{id:"COMMON_STATIC"})))))},889764:(e,t,n)=>{n.d(t,{H5:()=>s,Lq:()=>l,n0:()=>r});var a=n(849513),i=n(276907),o=n(919952);const r=e=>e[o.U.SHARED][i.N.PROPERTY_PANEL]?.[a.Io.TAB_GET_DATA_FUNCTION]||{},l=e=>e[o.U.SHARED][i.N.PROPERTY_PANEL]?.[a.Io.TAB_SUBMIT_FUNCTION]||{},s=e=>e[o.U.SHARED][i.N.PROPERTY_PANEL]?.[a.Io.TAB_RESET_FUNCTION]||{}},952754:(e,t,n)=>{n.r(t),n.d(t,{default:()=>N});var a,i=n(868238),o=n(469733),r=n(296540),l=n(637364),s=n(449688),d=n(96512),c=n(86571),m=n(689965),u=n(889764),A=n(171073),E=n(329109),_=n(263262),g=n(956619),p=n(89124);!function(e){e.NAME="name",e.NETWORK="network",e.SIM_SETTINGS="sim",e.MANAGE_DEVICE="manage-device"}(a||(a={}));var b=n(137662);const N=(0,i.Zz)((0,s.A)([a.NAME,a.SIM_SETTINGS,a.NETWORK,a.MANAGE_DEVICE]))(({activeItem:e,setFormDirty:t,setFormInvalid:n,isDirty:i,isInvalid:s})=>{const N=(0,o.useSelector)(u.Lq),h=(0,o.useSelector)(u.H5),C=(0,o.useSelector)(u.n0),f=(0,o.useDispatch)(),I=(0,d.I)(),[v,k]=(0,r.useState)(!1);return r.createElement(r.Fragment,null,r.createElement(p.Ay,{activeItem:e,setFormDirty:t,setFormInvalid:n,formName:a.NAME}),e.mbb?r.createElement(m.A,{type:m.I.ACCORDION,items:[{id:a.SIM_SETTINGS,openByDefault:!0,label:r.createElement(c.A,{id:"DEVICE_CELLULAR"}),renderContent:()=>r.createElement(b.A,{mac:e.mac,_id:e._id,mbb:e.mbb,mbb_overrides:e.mbb_overrides,can_activate_esim:e.can_activate_esim,isWanAdopted:Boolean(e.wan_networkgroup),setFormDirty:t,setFormInvalid:n,formName:a.SIM_SETTINGS,isDirty:i})}]}):null,r.createElement(m.A,{type:m.I.ACCORDION,items:[{id:a.NETWORK,openByDefault:!0,label:r.createElement(c.A,{id:"COMMON_IP_SETTINGS"}),renderContent:()=>r.createElement(_.A,{activeItem:e,setFormDirty:t,setFormInvalid:n,formName:a.NETWORK})}]}),r.createElement(m.A,{type:m.I.ACCORDION,items:[{id:a.MANAGE_DEVICE,openByDefault:!0,label:r.createElement(c.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>r.createElement(g.A,{activeItem:e})}]}),r.createElement(E.A,{isDirty:i,isInvalid:s,isSubmitting:v,onFormSubmit:async()=>{k(!0);const t=Object.entries(C).reduce((e,[t,n])=>{if("function"==typeof n){const t=n();if("object"==typeof t&&t&&Object.keys(t).length)return(0,l.A)(e,t)}return e},{});f((0,A.ex)(t,e._id,e.mac,{extend:!0})).then(()=>{Object.values(N).forEach(e=>{"function"==typeof e&&e()})}).catch(I).finally(()=>{k(!1)})},onFormCancel:()=>{Object.values(h).forEach(e=>{"function"==typeof e&&e()})}}))})}}]);