"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[98456],{323019(e,t,i){i.d(t,{A3:()=>u,Fw:()=>m,RA:()=>c,XH:()=>A,lp:()=>h});var s=i(222102),n=i(586566),o=i(291935),r=i(197571),a=i(147433),l=i(754924);const d=(0,s.Mz)(l.U$,e=>new Set((e.ethernet_overrides??[]).filter(({disabled:e,networkgroup:t})=>!e&&!!t).map(({networkgroup:e})=>e))),c=(0,s.Mz)(r.a3,d,(e,t)=>e.find(e=>!!e.wan_smartq_enabled&&((e,t)=>!!e.ifname||!!e.wan_networkgroup&&t.has(e.wan_networkgroup))(e,t))),A=(0,s.Mz)(o.bL,c,(e,t)=>e&&!t),u=(0,s.Mz)(l.U$,e=>(0,n.$F)(e)),h=(0,s.Mz)(l.U$,e=>(0,n.$F)(e)&&(e.hardware_offload??!0)),m=(0,s.Mz)(l.U$,e=>(0,n.WM)(e.fw2_caps,a.A.HWOFFLOAD_QOS_AND_SMART_QUEUE))},446863(e,t,i){i.d(t,{H5:()=>l,Lq:()=>a,n0:()=>r});var s=i(909924),n=i(573534),o=i(172205);const r=e=>e[o.U.SHARED][n.N.PROPERTY_PANEL]?.[s.Io.TAB_GET_DATA_FUNCTION]||{},a=e=>e[o.U.SHARED][n.N.PROPERTY_PANEL]?.[s.Io.TAB_SUBMIT_FUNCTION]||{},l=e=>e[o.U.SHARED][n.N.PROPERTY_PANEL]?.[s.Io.TAB_RESET_FUNCTION]||{}},680598(e,t,i){var s;i.d(t,{K:()=>s}),function(e){e.ALL="all",e.ACL_RULES="acl-rules",e.DNS_RECORDS="dns-records",e.FIREWALL="firewall",e.NAT_RULES="nat-rules",e.POLICY_BASED_ROUTES="policy-based-routes",e.PORT_FORWARDING="port-forwarding",e.QOS_RULES="qos-rules",e.STATIC_ROUTES="static-routes"}(s||(s={}))},535322(e,t,i){i.d(t,{A:()=>m,I:()=>s});var s,n=i(274934),o=i(505817),r=i(753583),a=i(247816),l=i(565527),d=i(309130),c=i(100978),A=i(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(s||(s={}));const u=(0,a.A)(c.A,(0,A.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:i}})=>e||o.Ay[i===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:t}})=>e?`border: ${o.Ay[`desktop-border-divider-${t}`]};`:""}
  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}})=>o.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,h=(0,a.A)(r.A,(0,A.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:i}})=>e||o.Ay[i===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${l.S.LIGHT}`]};
  ${({nested:e,theme:{themeName:t}})=>e?`border: ${o.Ay[`desktop-border-divider-${t}`]};`:""}
  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,nested:t,theme:{themeName:i}})=>e||o.Ay[i===l.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${l.S.DARK}`:`desktop-color-neutral-${t?"01":"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};
      }
    }
  }
`,m=({type:e,marginBottom:t,margin:i,padding:o,flex:r,width:a,nested:l,...d})=>"items"in d?(0,n.jsx)(h,{marginBottom:t,margin:i,padding:o,flex:r,nested:l,...d}):(0,n.jsx)(u,{nested:l,width:a,marginBottom:t,margin:i,padding:o,flex:r,isButtonList:e===s.BUTTON_LIST,...d,children:d.children})},250266(e,t,i){i.d(t,{A:()=>c});var s=i(274934),n=i(602086),o=i(13790),r=i(409844),a=i(521376),l=i(309130),d=i(470070);const c=({children:e=null,title:t,titleValues:i,message:c,messageValues:A,handleConfirm:u=()=>null,handleClose:h=()=>null,handleCancel:m,isOpen:C,buttonVariant:g="primary",cancelButtonVariant:E="tertiary",cancelButtonMessage:b="COMMON_ACTION_CANCEL",buttonMessage:_="COMMON_ACTION_CONFIRM",buttonDisabled:x=!1,position:O="top",offset:p,showHeaderClose:S=!1,contentClassName:f="",body:v,titleBody:w,className:I,rootClose:R=!1,footerActions:N})=>{const j=(0,n.useCallback)(e=>{C&&(e.stopPropagation(),e.key===a.U.ENTER?u():e.key===a.U.ESCAPE&&h(!1))},[C,u,h]);(0,n.useEffect)(()=>(window.addEventListener("keydown",j,!0),()=>{window.removeEventListener("keydown",j,!0)}),[j]);const T=(0,n.useCallback)(()=>{h(!1),m?.()},[h,m]),$=(0,n.useCallback)(()=>{h(!1),u()},[h,u]),k=(0,n.useMemo)(()=>[{text:(0,s.jsx)(d.sA,{id:b}),variant:E,onClick:T},{text:(0,s.jsx)(d.sA,{id:_}),disabled:x,variant:g,onClick:$}],[_,g,b,E,T,$,x]),y=(0,n.useCallback)(()=>{h(!1)},[h]),D=r.AH`
    ${t?"":`margin-top: ${l.xO}`}
  `;return(0,s.jsx)(o.A,{title:t?(0,s.jsx)(d.sA,{id:t,values:i}):w||null,...c?{body:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.sA,{id:c,values:A}),v]})}:{body:v},position:O,portal:!0,offset:p,actions:N||k,showHeaderClose:S,contentClassName:r.AH`
        ${D}
        ${f}
      `,onRequestClose:y,isOpen:C,allowOverflow:!0,rootClose:R,className:I,children:e})}},341699(e,t,i){i.d(t,{HV:()=>o,pm:()=>r,vF:()=>n});var s=i(726831);const n=e=>`${s.A.fabricsOrchestration}?orchestrationId=${e?.template_id||""}&orgId=${e?.organization_id||""}`,o=e=>`${s.A.fabricsDeviceTemplates}/${e?.template_id||""}?orgId=${e?.organization_id||""}`,r=()=>`${s.A.fabricsOrchestration}`},637084(e,t,i){i.d(t,{A:()=>_});var s=i(274934),n=i(602086),o=i(843871),r=i(977872),a=i(418398),l=i(396489),d=i.n(l),c=i(205521),A=i(232410),u=i(933671),h=i(260288),m=i(619619),C=i(702147),g=i(507792),E=i(621309);const b=(0,o.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:t})=>({powerSupervisor:(0,m.f)(e,(0,g.lD)(t,e))}),handleSubmit:(e,{resetForm:t})=>t({values:e}),validationSchema:C.Ay}),_=(0,a.Zz)((0,r.Ng)((e,{device:{mac:t}})=>({powerSupervisor:(0,A.x0)(t)(e)})))(b(({powerSupervisor:e,device:t,setFormDirty:i,setFormInvalid:o,validateForm:a,values:l,resetForm:A,initialValues:m,dirty:C,isValid:g,formName:b=h.r8})=>{const _=(0,r.wA)();return(0,n.useEffect)(()=>(_((0,c.uo)({[b]:()=>({})})),_((0,c.Oo)({[b]:()=>{d()(l,m)||a().then(t=>{Object.keys(t).length||_((0,E.A)(e?.id,l.powerSupervisor))})}})),_((0,c.rW)({[b]:A})),()=>{_((0,c.uo)({[b]:null})),_((0,c.Oo)({[b]:null})),_((0,c.rW)({[b]:null}))}),[_,A,l.powerSupervisor,b,a,e?.id,l,m]),(0,n.useEffect)(()=>{i?.(b,C),o?.(b,!g)},[i,C,o,g,b]),(0,s.jsx)(u.A,{device:t})}))},419685(e,t,i){i.d(t,{A:()=>S});var s=i(274934),n=i(602086),o=i(262356),r=i(179102),a=i(221835),l=i(266824),d=i(247816),c=i(977872),A=i(669439),u=i(309130),h=i(793442),m=i(100978),C=i(470070),g=i(291935),E=i(598990),b=i(6276),_=i(341699);const x=(0,d.A)("div")`
  width: 100%;
  margin-bottom: ${u.Ln};
`,O=()=>{const e=(0,c.d4)(g.zu);return{isOrchestrated:(0,n.useMemo)(()=>(0,b.A)(e),[e]),globalSwitchSettings:e}},p=({globalSwitchSettings:e,children:t})=>{const i=(0,c.wA)(),o=(0,n.useCallback)(()=>{i((0,E.Np)("global_network")).then(e=>{(e?.data?.setting_keys||[]).length>0&&i((0,E.Uc)(void 0,{resolveWithExisting:!1}))})},[i]);return(0,s.jsx)(A.A,{placement:"top start",description:(0,s.jsxs)(m.A,{flexDirection:"column",width:"100%",children:[(0,s.jsx)(C.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS_MANAGED_BY_FABRIC"}),(0,s.jsxs)(m.A,{gap:u.YC,alignItems:"baseline",children:[(0,s.jsx)(h.A,{id:"COMMON_VIEW_IN_SITE_MANAGER",href:(0,_.vF)(e.cloud_template)}),(0,s.jsx)(r.A,{style:{textTransform:"lowercase"},size:"small",children:(0,s.jsx)(C.sA,{id:"COMMON_OR"})}),(0,s.jsx)(l.A,{variant:"destructive",fontSize:"inherit",onClick:o,children:(0,s.jsx)(C.sA,{id:"COMMON_DETACH"})})]})]}),children:(0,s.jsx)("div",{children:t})})},S={Toggle:({isGlobalSwitchSettingsEnabled:e,setGlobalSwitchSettingsEnabled:t,noStyledRow:i})=>{const{isOrchestrated:a,globalSwitchSettings:l}=O(),d=(0,n.useCallback)(({target:{checked:e}})=>{t(e)},[t]),c=(0,s.jsx)(o.A,{full:!0,checked:e,onChange:d,disabled:a,children:(0,s.jsx)(m.A,{width:"100%",alignItems:"center",children:(0,s.jsx)(r.A,{size:"medium",color:a?"disabled":void 0,children:(0,s.jsx)(C.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS"})})})}),A=i?c:(0,s.jsx)(x,{children:c});return a?(0,s.jsx)(p,{globalSwitchSettings:l,children:A}):A},Checkbox:({isGlobalSwitchSettingsEnabled:e,setGlobalSwitchSettingsEnabled:t,onChange:i,noStyledRow:o})=>{const{isOrchestrated:l,globalSwitchSettings:d}=O(),c=(0,n.useCallback)(({target:{checked:e}})=>{t(e),i?.(e)},[i,t]),A=(0,s.jsx)(a.A,{id:"global-switch-settings-checkbox",checked:e,onChange:c,disabled:l,children:(0,s.jsx)(r.A,{size:"medium",color:l?"disabled":void 0,children:(0,s.jsx)(C.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS"})})}),u=o?A:(0,s.jsx)(x,{children:A});return l?(0,s.jsx)(p,{globalSwitchSettings:d,children:u}):u}}},604355(e,t,i){i.d(t,{A:()=>D});var s=i(274934),n=i(977872),o=i(602086),r=i(843871),a=i(526744),l=i(590979),d=i(669439),c=i(244081),A=i(724081),u=i(449339),h=i(927728),m=i(250266),C=i(120197),g=i(376527),E=i(100978),b=i(205521),_=i(470070),x=i(680598),O=i(291935),p=i(598990),S=i(179890),f=i(77157),v=i(553732),w=i(615019),I=i(818028),R=i(62749),N=i(323019),j=i(969288);const T="hardware_offload",$=(0,r.bk)({enableReinitialize:!0,mapPropsToValues:({hardware_offload:e=!0})=>({[T]:e}),handleSubmit:(e,{resetForm:t})=>{t({values:e})}}),k=({disabled:e})=>{const[t,i]=(0,o.useState)(!1),{setFieldValue:n,values:a}=(0,r.j7)();return(0,s.jsx)(m.A,{title:"DEVICE_HARDWARE_ACCELERATION_PROMPT_TITLE",message:"DEVICE_HARDWARE_ACCELERATION_PROMPT_DESCRIPTION",buttonMessage:"COMMON_ACTION_PROCEED",buttonVariant:"danger",showHeaderClose:!0,rootClose:!0,handleCancel:()=>{i(!1)},handleClose:()=>{i(!1)},handleConfirm:()=>{i(!1),n(T,!1)},isOpen:t,children:(0,s.jsx)(C.A,{name:T,type:"realCheckbox",tooltipMessage:(0,s.jsx)(_.sA,{id:"DEVICE_HARDWARE_ACCELERATION_TOOLTIP"}),value:a[T],onChange:({target:{checked:e}})=>{e?n(T,!0):i(!0)},disabled:e,children:(0,s.jsx)(_.sA,{id:"COMMON_HARDWARE_ACCELERATION"})})})},y=()=>{const e=(0,n.wA)(),t=(0,n.d4)(O.Dd),i=(0,n.d4)(S.l),r=(0,n.d4)(N.Fw),m=(0,n.d4)(I.K2),C=(0,n.d4)(N.RA);(0,o.useEffect)(()=>{e((0,R.uL)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}))},[e]);const T=!!C&&!r,$=i.some(e=>e.enabled)&&!r,y=t.enabled,D=(0,o.useMemo)(()=>m.some(e=>e.ip_version===w.hz.IPV6),[m]),L=T||$||y||D;return(0,A.A)([(0,f.X6)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}),(0,p.Uc)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}),(0,v.Sk)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})],(0,s.jsx)(d.A,{description:L?(0,s.jsxs)(E.A,{flexDirection:"column",children:[(0,s.jsx)(_.sA,{id:"DEVICE_HARDWARE_ACCELERATION_DISABLED_BY"}),(0,s.jsxs)(h.A,{children:[T?(0,s.jsx)("li",{children:(0,s.jsx)(a.A,{variant:"inline",onClick:()=>{e((0,b.XP)({type:u.H.WAN,id:C?._id}))},...l.A.addDataTestId(l.A.TestId.SIDE_PANEL_TRIGGER),children:(0,s.jsx)(_.sA,{id:"COMMON_SMART_QUEUES"})})}):null,$?(0,s.jsx)("li",{children:(0,s.jsx)(g.A,{size:"inherit",to:`${j.E0}?${j.XU}=${x.K.QOS_RULES}`,children:(0,s.jsx)(_.sA,{id:"COMMON_QOS"})})}):null,y?(0,s.jsx)("li",{children:(0,s.jsx)(g.A,{size:"inherit",to:`${j.bB}/${j.Uy.TRAFFIC_LOGGING}`,children:(0,s.jsx)(_.sA,{id:"COMMON_NETFLOW"})})}):null,D?(0,s.jsx)("li",{children:(0,s.jsx)(g.A,{size:"inherit",to:`${j.E0}?${j.XU}=${x.K.NAT_RULES}`,children:(0,s.jsx)(_.sA,{id:"COMMON_IPV6_NAT"})})}):null]})]}):null,children:(0,s.jsx)("span",{children:(0,s.jsx)(k,{disabled:L})})}))},D=$(({dirty:e,isValid:t,values:i,setFormDirty:r,setFormInvalid:a,resetForm:l,formName:d="hardwareAcceleration"})=>{const c=(0,n.wA)();return(0,o.useEffect)(()=>(c((0,b.uo)({[d]:()=>i})),c((0,b.Oo)({[d]:()=>l({values:i})})),c((0,b.rW)({[d]:l})),()=>{c((0,b.uo)({[d]:null})),c((0,b.Oo)({[d]:null})),c((0,b.rW)({[d]:null}))}),[c,l,i,d]),(0,o.useEffect)(()=>{r(d,e),a(d,!t)},[r,e,a,t,d]),(0,s.jsx)(y,{})})},998456(e,t,i){i.r(t),i.d(t,{default:()=>R});var s=i(274934),n=i(418398),o=i(977872),r=i(602086),a=i(244081),l=i(159469),d=i(478961),c=i(630849),A=i(586566),u=i(309130),h=i(376892),m=i(100978),C=i(535322),g=i(700444),E=i(291935),b=i(598990),_=i(446863),x=i(795206),O=i(637084),p=i(115114),S=i(604355),f=i(419685),v=i(322784),w=i(532635),I=i(795928);const R=(0,n.Zz)((0,d.A)([I.UH,v.q]))(({activeItem:e,setFormDirty:t,setFormInvalid:i,isDirty:n,isInvalid:d})=>{const R=(0,o.d4)(_.n0),N=(0,o.d4)(_.Lq),j=(0,o.d4)(_.H5),T=(0,o.d4)(E.zu),{_id:$,mac:k}=e,[y,D]=(0,r.useState)(!T.switch_exclusions?.includes(k)),L=(0,o.wA)(),M=n||y!==!T.switch_exclusions?.includes(k),F=(0,c.I)();(0,r.useEffect)(()=>{L((0,b.Uc)(void 0,{crudCacheStrategy:{type:a.e.CACHE}}))},[L]);const U=(0,r.useCallback)(async()=>{const e=Object.entries(R).reduce((e,[t,i])=>{if("function"==typeof i){const t=i();if("object"==typeof t&&t&&Object.keys(t).length)return{...e,...t}}return e},{});y&&delete e.jumboframe_enabled;try{const e=[];if(y!==!T.switch_exclusions?.includes(k)){const t=T.switch_exclusions.filter(e=>e!==k);y||t.push(k),e.push({...T,switch_exclusions:t})}e.length&&await L((0,b.h3)(e))}catch{return void L((0,g.ox)({icon:l.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"}))}L((0,x.ex)(e,$,k,{extend:!0})).then(({data:t=[e]})=>{Object.values(N).forEach(e=>{"function"==typeof e&&e(t[0])})}).catch(F)},[R,y,L,$,k,F,T,N]),B=(0,r.useCallback)(()=>{D(!T.switch_exclusions?.includes(k)),Object.values(j).forEach(e=>{"function"==typeof e&&e()})},[k,T.switch_exclusions,j]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(I.Ay,{activeItem:e,setFormDirty:t,setFormInvalid:i}),(0,s.jsx)(C.A,{type:C.I.ACCORDION,items:[{id:v.q,openByDefault:!0,label:(0,s.jsx)(h.A,{id:"COMMON_SERVICES"}),renderContent:()=>(0,s.jsxs)(m.A,{flexDirection:"column",gap:u.Ln,children:[(0,A.$F)(e)?(0,s.jsx)(S.A,{hardware_offload:e.hardware_offload,setFormDirty:t,setFormInvalid:i}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)(f.A.Checkbox,{isGlobalSwitchSettingsEnabled:y,setGlobalSwitchSettingsEnabled:D}),(0,s.jsx)(v.A,{activeItem:e,setFormDirty:t,setFormInvalid:i,isGlobalSwitchSettingsEnabled:y})]})]})}]}),(0,s.jsx)(O.A,{device:e,setFormDirty:t,setFormInvalid:i}),(0,s.jsx)(C.A,{type:C.I.ACCORDION,items:[{id:w.f,openByDefault:!0,label:(0,s.jsx)(h.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,s.jsx)(w.A,{activeItem:e,hideRemove:!0})}]}),(0,s.jsx)(p.A,{isDirty:M,isInvalid:d,onFormSubmit:U,onFormCancel:B})]})})},521376(e,t,i){var s;i.d(t,{U:()=>s}),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"}(s||(s={}))},478961(e,t,i){i.d(t,{A:()=>o});var s=i(274934),n=i(602086);const o=function(e){return t=>i=>{const[o,r]=(0,n.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[a,l]=(0,n.useState)(Object.fromEntries(e.map(e=>[e,!1]))),d=(0,n.useCallback)((e,t)=>{r(i=>({...i,[e]:t}))},[]),c=(0,n.useCallback)((e,t)=>{l(i=>({...i,[e]:t}))},[]),A=!!Object.values(o).find(e=>e),u=!!Object.values(a).find(e=>e);return(0,s.jsx)(t,{isDirty:A,isInvalid:u,formStates:o,setFormDirty:d,setFormInvalid:c,...i})}}}}]);