"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[52070],{446863(e,i,n){n.d(i,{H5:()=>o,Lq:()=>r,n0:()=>l});var t=n(909924),a=n(573534),s=n(172205);const l=e=>e[s.U.SHARED][a.N.PROPERTY_PANEL]?.[t.Io.TAB_GET_DATA_FUNCTION]||{},r=e=>e[s.U.SHARED][a.N.PROPERTY_PANEL]?.[t.Io.TAB_SUBMIT_FUNCTION]||{},o=e=>e[s.U.SHARED][a.N.PROPERTY_PANEL]?.[t.Io.TAB_RESET_FUNCTION]||{}},535322(e,i,n){n.d(i,{A:()=>c,I:()=>t});var t,a=n(274934),s=n(505817),l=n(753583),r=n(247816),o=n(565527),d=n(309130),_=n(100978),m=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(t||(t={}));const A=(0,r.A)(_.A,(0,m.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:i,theme:{themeName:n}})=>e||s.Ay[n===o.S.DARK?`desktop-color-neutral-${i?"00":"01"}-${o.S.DARK}`:`desktop-color-neutral-${i?"01":"00"}-${o.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:i}})=>e?`border: ${s.Ay[`desktop-border-divider-${i}`]};`:""}
  padding: ${({isButtonList:e,padding:i})=>i||(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}})=>s.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,u=(0,r.A)(l.A,(0,m.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:i,theme:{themeName:n}})=>e||s.Ay[n===o.S.DARK?`desktop-color-neutral-${i?"00":"01"}-${o.S.DARK}`:`desktop-color-neutral-${i?"01":"00"}-${o.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:i}})=>e?`border: ${s.Ay[`desktop-border-divider-${i}`]};`:""}
  margin-bottom: ${({theme:e,marginBottom:i})=>i||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,nested:i,theme:{themeName:n}})=>e||s.Ay[n===o.S.DARK?`desktop-color-neutral-${i?"00":"01"}-${o.S.DARK}`:`desktop-color-neutral-${i?"01":"00"}-${o.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${d.Ln} ${d.Ln};
      }
    }
  }
`,c=({type:e,marginBottom:i,margin:n,padding:s,flex:l,width:r,nested:o,...d})=>"items"in d?(0,a.jsx)(u,{marginBottom:i,margin:n,padding:s,flex:l,nested:o,...d}):(0,a.jsx)(A,{nested:o,width:r,marginBottom:i,margin:n,padding:s,flex:l,isButtonList:e===t.BUTTON_LIST,...d,children:d.children})},250266(e,i,n){n.d(i,{A:()=>_});var t=n(274934),a=n(602086),s=n(13790),l=n(409844),r=n(521376),o=n(309130),d=n(470070);const _=({children:e=null,title:i,titleValues:n,message:_,messageValues:m,handleConfirm:A=()=>null,handleClose:u=()=>null,handleCancel:c,isOpen:E,buttonVariant:I="primary",cancelButtonVariant:p="tertiary",cancelButtonMessage:O="COMMON_ACTION_CANCEL",buttonMessage:N="COMMON_ACTION_CONFIRM",buttonDisabled:b=!1,position:h="top",offset:C,showHeaderClose:T=!1,contentClassName:x="",body:R,titleBody:g,className:f,rootClose:M=!1,footerActions:D})=>{const L=(0,a.useCallback)(e=>{E&&(e.stopPropagation(),e.key===r.U.ENTER?A():e.key===r.U.ESCAPE&&u(!1))},[E,A,u]);(0,a.useEffect)(()=>(window.addEventListener("keydown",L,!0),()=>{window.removeEventListener("keydown",L,!0)}),[L]);const P=(0,a.useCallback)(()=>{u(!1),c?.()},[u,c]),j=(0,a.useCallback)(()=>{u(!1),A()},[u,A]),v=(0,a.useMemo)(()=>[{text:(0,t.jsx)(d.sA,{id:O}),variant:p,onClick:P},{text:(0,t.jsx)(d.sA,{id:N}),disabled:b,variant:I,onClick:j}],[N,I,O,p,P,j,b]),S=(0,a.useCallback)(()=>{u(!1)},[u]),w=l.AH`
    ${i?"":`margin-top: ${o.xO}`}
  `;return(0,t.jsx)(s.A,{title:i?(0,t.jsx)(d.sA,{id:i,values:n}):g||null,..._?{body:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.sA,{id:_,values:m}),R]})}:{body:R},position:h,portal:!0,offset:C,actions:D||v,showHeaderClose:T,contentClassName:l.AH`
        ${w}
        ${x}
      `,onRequestClose:S,isOpen:E,allowOverflow:!0,rootClose:M,className:f,children:e})}},290298(e,i,n){n.d(i,{A:()=>x,I:()=>h});var t=n(274934),a=n(977872),s=n(602086),l=n(843871),r=n(70582),o=n(179102),d=n(830990),_=n(950804),m=n(309130),A=n(120197),u=n(796091),c=n(100978),E=n(205521),I=n(470070),p=n(333015),O=n(419151),N=n(171056),b=n(570866);const h="cellular",C=[...new Array(N.Ay.SOFT_LIMIT_MAX_GB)].map((e,i)=>({value:i+1,label:`${i+1} GB`})),T={[O.eX.Pap]:"COMMON_PAP",[O.eX.Chap]:"COMMON_CHAP",[O.eX.PapChap]:"COMMON_PAP_CHAP",[O.eX.None]:"COMMON_NONE"},x=(0,l.bk)({enableReinitialize:!0,mapPropsToValues:({limited:e,apn:i="",sim_pin:n,is_sim_pin_required:t,sim_pin_tries_left:a,username:s,password:l,auth_type:o,roaming:d,data_limit_enabled:_=!1,soft_limit:m=(e?C[0].value:0),data_warning_enabled:A=!1,hard_limit:u=0})=>({apn:i,is_sim_pin_required:t,sim_pin_tries_left:a,sim_pin:n,username:s,password:l,auth_type:o,roaming:d,data_limit_enabled:e||_,soft_limit:new r.Un(m,"bytes","IEC",3).value,data_warning_enabled:A,hard_limit:new r.Un(u,"bytes","IEC",3).value}),validationSchema:({limited:e=!1})=>_.A.lazy(()=>_.A.object().shape({apn:_.A.string().when("is_sim_pin_required",{is:!1,then:_.A.string().label("COMMON_APN_ADDRESS").matches(b._j,{message:(0,t.jsx)(I.sA,{id:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_VALID_APN_ADDRESS"})}).required()}),sim_pin:_.A.string().when("is_sim_pin_required",{is:!0,then:_.A.string().label("DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_PIN").matches(b.mw,{message:(0,t.jsx)(I.sA,{id:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_VALID_PIN"})}).required()}),username:_.A.string().label("COMMON_LABEL_USERNAME"),password:_.A.string().label("COMMON_PASSWORD"),auth_type:_.A.string().label("COMMON_AUTH_TYPE").oneOf([O.eX.Pap,O.eX.Chap,O.eX.PapChap,O.eX.None]),roaming:_.A.boolean().label("COMMON_ROAMING").optional(),data_limit_enabled:_.A.boolean().label("COMMON_LTE_DATA_LIMIT"),soft_limit:_.A.number().integer((0,t.jsx)(I.sA,{id:"COMMON_VALIDATION_WHOLE_NUMBER"})).max(N.Ay.MAX_DATA_LIMIT_GB).when("data_limit_enabled",{is:!0,then:e?_.A.number().label("DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_WARNING").oneOf(C.map(({value:e})=>e)).required():_.A.number().label("DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_WARNING").min(0).required()}),data_warning_enabled:_.A.boolean().label("COMMON_LTE_DATA_WARNING"),hard_limit:_.A.number().max(N.Ay.MAX_DATA_LIMIT_GB).when("data_limit_enabled",{is:!0,then:_.A.number().label("DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_LIMIT").min(0).required().integer((0,t.jsx)(I.sA,{id:"COMMON_VALIDATION_WHOLE_NUMBER"}))}).when(["soft_limit"],(i,n)=>n.min(e?0:i>=0&&i,(0,t.jsx)(I.sA,{id:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_LIMIT_ERROR"})))})),handleSubmit:()=>null})(({mac:e,limited:i,values:n,dirty:l,isValid:r,errors:_,touched:N,resetForm:b,setFormDirty:x,setFormInvalid:R,setFieldTouched:g,setFieldValue:f,formName:M=h,isDirty:D,validateField:L,submitPayloadConverter:P,hideRoaming:j,onFormSubmit:v})=>{const S=(0,a.wA)(),{formatMessage:w}=(0,I.tz)(),y=(0,s.useMemo)(()=>Object.values(O.eX).map(e=>({label:w({id:T[e]||"COMMON_FALLBACK"}),value:e})),[w]);return(0,s.useEffect)(()=>{S((0,E.uo)({[M]:()=>{if(n.is_sim_pin_required)return null;const e={...n,soft_limit:(0,p.$C)(n.soft_limit),hard_limit:(0,p.$C)(i?(n.soft_limit||0)+2:n.hard_limit),data_warning_enabled:n.data_limit_enabled};return n.data_limit_enabled||(e.soft_limit=0,e.hard_limit=0),P(e)}})),S((0,E.Oo)({[M]:()=>{v?.(n),b({values:n})}})),S((0,E.rW)({[M]:b}))},[S,b,n,e,M,i,P,v]),(0,s.useEffect)(()=>{x(M,l),R(M,!r)},[l,x,R,r,M]),(0,s.useEffect)(()=>{D&&L("apn")},[D,L]),(0,t.jsx)(c.A,{flexDirection:"column",gap:m.Ln,children:(0,t.jsxs)(t.Fragment,i?{children:[(0,t.jsx)(c.A,{children:(0,t.jsx)(o.A,{color:"text-1",size:"medium",children:(0,t.jsx)(I.sA,{id:"COMMON_LTE_DATA_LIMIT"})})}),(0,t.jsxs)(c.A,{flexDirection:"column",gap:m.Ln,children:[(0,t.jsx)(A.A,{label:"COMMON_DATA_LIMIT",translateLabel:!0,full:!0,validated:!0,options:C,type:"dropdown",variant:"secondary",name:"soft_limit"}),(0,t.jsx)(o.A,{color:"text-2",size:"small",children:(0,t.jsx)(I.sA,{id:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_LIMIT_DESCRIPTION"})})]})]}:{children:[n.is_sim_pin_required?(0,t.jsxs)(c.A,{flexDirection:"column",gap:m.YC,children:[(0,t.jsx)(A.A,{label:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_PIN",name:"sim_pin",type:"password",variant:"secondary",autoComplete:"new-password",full:!0,passwordToggle:!0,invalid:N?.sim_pin&&_?.sim_pin}),_.sim_pin?null:(0,t.jsxs)(c.A,{alignItems:"center",gap:m.YC,children:[(0,t.jsx)(d.A,{isActive:!0,size:"original"}),(0,t.jsx)(o.A,{color:"text-2",size:"small",children:(0,t.jsx)(I.sA,{id:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_SIM_CARD_TRIES",values:{count:n.sim_pin_tries_left}})})]})]}):null,(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{label:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_APN_ADDRESS",variant:"secondary",name:"apn",full:!0,autoComplete:"off",invalid:D&&_?.apn?_?.apn:void 0,disabled:n.is_sim_pin_required})}),(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{label:"COMMON_LABEL_USERNAME",name:"username",variant:"secondary",full:!0,disabled:n.is_sim_pin_required})}),(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{label:"COMMON_PASSWORD",name:"password",type:"password",variant:"secondary",autoComplete:"new-password",passwordToggle:!0,full:!0,disabled:n.is_sim_pin_required})}),(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{name:"auth_type",type:"dropdown",variant:"secondary",label:"COMMON_AUTH_TYPE",options:y,validated:!0,translateLabel:!0,full:!0,disabled:n.is_sim_pin_required})}),j?null:(0,t.jsx)(u.A,{children:(0,t.jsx)(A.A,{type:"realCheckbox",name:"roaming",disabled:n.is_sim_pin_required,children:(0,t.jsx)(o.A,{color:"text-1",size:"medium",children:(0,t.jsx)(I.sA,{id:"COMMON_ROAMING"})})})}),(0,t.jsx)(u.A,{children:(0,t.jsx)(A.A,{type:"realCheckbox",name:"data_limit_enabled",disabled:n.is_sim_pin_required,children:(0,t.jsx)(o.A,{color:"text-1",size:"medium",children:(0,t.jsx)(I.sA,{id:"COMMON_DATA_LIMIT"})})})}),n.data_limit_enabled?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{name:"hard_limit",label:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_LIMIT",type:"number",variant:"secondary",full:!0,disabled:n.is_sim_pin_required})}),(0,t.jsx)(c.A,{justifyContent:"space-between",children:(0,t.jsx)(o.A,{color:"text-1",size:"medium",children:(0,t.jsx)(I.sA,{id:"COMMON_LTE_DATA_WARNING"})})}),(0,t.jsx)(c.A,{flexDirection:"column",children:(0,t.jsx)(A.A,{name:"soft_limit",label:"DEVICE_PROPERTIES_CONFIGURE_UNIFI_LTE_DATA_WARNING",type:"number",variant:"secondary",full:!0,onChange:e=>{f("soft_limit",e.target.value),g("hard_limit")},disabled:n.is_sim_pin_required})})]}):null]})})})},521376(e,i,n){var t;n.d(i,{U:()=>t}),function(e){e.ARROW_LEFT="ArrowLeft",e.ARROW_RIGHT="ArrowRight",e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.ESCAPE="Escape",e.BACKSPACE="Backspace",e.DELETE="Delete",e.TAB="Tab"}(t||(t={}))},478961(e,i,n){n.d(i,{A:()=>s});var t=n(274934),a=n(602086);const s=function(e){return i=>n=>{const[s,l]=(0,a.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[r,o]=(0,a.useState)(Object.fromEntries(e.map(e=>[e,!1]))),d=(0,a.useCallback)((e,i)=>{l(n=>({...n,[e]:i}))},[]),_=(0,a.useCallback)((e,i)=>{o(n=>({...n,[e]:i}))},[]),m=!!Object.values(s).find(e=>e),A=!!Object.values(r).find(e=>e);return(0,t.jsx)(i,{isDirty:m,isInvalid:A,formStates:s,setFormDirty:d,setFormInvalid:_,...n})}}}}]);