"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[66222],{752104(e,t,n){n.d(t,{A:()=>i,Q:()=>a});var r=n(765567);const i="_",a=[r.ZM,r.Je]},566222(e,t,n){n.r(t),n.d(t,{default:()=>me});var r=n(274934),i=n(602086),a=n(977872),l=n(237887),s=n(100978),o=n(535322),c=n(470070),d=n(20049),A=n(95546),m=n(792929),u=n(112104),O=n(222102),C=n(656466),x=n(401042),_=n(754924),h=n(342540);const p=e=>(0,O.Mz)((0,_.tG)(e),e=>(e?.port_table||[]).map(({port_idx:e})=>e).filter(e=>Number.isInteger(e)));var j=n(244081),g=n(594005),v=n(254590),M=n(95032);const E=({entry:e})=>(0,r.jsx)(M.A,{size:"inherit",children:e.vlan});var L;!function(e){e.MAC="mac",e.VLAN="vlan",e.AGE="age"}(L||(L={}));const T={[L.MAC]:"COMMON_DEVICE",[L.VLAN]:"COMMON_VLAN",[L.AGE]:"PORTS_CONNECTED_FOR"};var y=n(409844),S=n(669439),b=n(347625),N=n(309130),V=n(974390),R=n(650632),f=n(831433),D=n(34118);const I=y.AH`
  flex-shrink: 0;
`,F=({entry:e})=>{const t=(0,a.d4)((0,D.og)(e.mac)),n=Object.keys(t).length>0,i=(0,a.d4)((0,_.tG)(e.mac)),l=Object.keys(i).length>0,o=l?(0,r.jsx)(V.A,{model:i.model,width:20,height:20,className:I}):n?(0,r.jsx)(R.A,{client:t,width:20,height:20,className:I}):null,c=l?(0,b.Q)(i):n?(0,f.tn)(t):e.mac;return n||l?(0,r.jsx)(S.A,{description:e.mac,children:(0,r.jsxs)(s.A,{gap:N.YC,alignItems:"center",maxWidth:"100%",children:[(0,r.jsx)(s.A,{height:20,minWidth:20,maxWidth:20,justifyContent:"center",alignItems:"center",children:o}),(0,r.jsx)(M.A,{color:"text-2",size:"medium",isTruncated:!0,children:c})]})}):(0,r.jsx)(M.A,{color:"text-2",size:"medium",isTruncated:!0,children:e.mac})};var H=n(898809);const P=({entry:e})=>{const t=e.age>0?(0,H.Ay)(e.age,[H.Au.DAYS,H.Au.HOURS,H.Au.MINUTES]).join(" "):null;return(0,r.jsx)(M.A,{size:"inherit",children:t||(0,r.jsx)(c.sA,{id:"COMMON_FALLBACK"})})},k=[{id:L.MAC,label:(0,r.jsx)(c.sA,{id:T[L.MAC]}),minWidth:130,renderCell:e=>(0,r.jsx)(F,{entry:e}),compare:(0,g.l0)(({mac:e})=>e||v.L),sortable:!0},{id:L.VLAN,label:(0,r.jsx)(c.sA,{id:T[L.VLAN]}),minWidth:60,renderCell:e=>(0,r.jsx)(E,{entry:e}),compare:(0,g.l0)(({vlan:e})=>e||v.L),sortable:!0},{id:L.AGE,label:(0,r.jsx)(c.sA,{id:T[L.AGE]}),minWidth:100,renderCell:e=>(0,r.jsx)(P,{entry:e}),compare:(0,g.l0)(({age:e})=>e||v.L),sortable:!0}],z=({port:e})=>{const t=(0,a.wA)(),n=(0,a.d4)((0,i.useMemo)(()=>{return n=e.port_idx,(0,O.Mz)(p(t=e.device.mac),e=>e,(e,r)=>{if(0===e.length)return;const i=(0,O.Mz)((0,C.uh)((0,h.Z)({data:[{mac:t,ports:e}]})),x.kh)(r).shift();return i?.ports.find(({port_idx:e})=>e===n)});var t,n},[e.device.mac,e.port_idx])),l=(0,a.d4)((0,i.useMemo)(()=>p(e.device.mac),[e.device.mac])),s=(0,i.useMemo)(()=>(n?.mac_table||[]).map((e,t)=>({_id:`${e.mac}-${e.vlan}-${t}`,mac:e.mac,vlan:e.vlan,age:e.age}))||[],[n]),{rowLimit:d,renderFooter:A}=(0,u.A)(s.length,{defaultCount:10,label:{singular:"COMMON_MAC_ADDRESS",plural:"COMMON_MAC_ADDRESSES"}});return(0,i.useEffect)(()=>{e.device.mac&&l.length>0&&t((0,h.Z)({data:[{mac:e.device.mac,ports:l}]},{crudCacheStrategy:{type:j.e.CACHE}}))},[t,e.device.mac,l]),s.length?(0,r.jsx)(o.A,{type:o.I.ACCORDION,items:[{id:"mac-table",label:(0,r.jsx)(c.sA,{id:"PORTS_MAC_TABLE"}),openByDefault:!0,renderContent:()=>(0,r.jsx)(m.A,{columns:k,idField:"_id",items:s,disableColumnFilters:!0,disableTextPointer:!0,rowLimit:d,renderFooter:()=>A})}]}):null};var w=n(113592),B=n(320018),$=n(412160);const W=({port:e})=>void 0!==e.port_idx&&e.device?(0,r.jsx)(B.A,{mac:e.device.mac,model:e.device.model,logType:w.F.PORT,label:"PORTS_ACTIVITY_LOG",portIdx:e.port_idx,cache:!1,ignoreActionableValues:[$.dl.DEVICE_WITH_PORT]}):null;var Y=n(526958),Q=n(314191),U=n(814557),G=n(247816),Z=n(263705),K=n(724081),J=n(684209),X=n(85908),q=n(309675),ee=n(450089),te=n(127927),ne=n(29472),re=n(120391);const ie=(e,t,n={},r={})=>(0,ne.t9)(re.A2,(0,re.Yn)(e,t),n,{...r,idField:n=>`${(0,re.OX)(e,t)}-${n.alert_event}`,payloadTransform:e=>e?.data??e}),ae=(0,G.A)(s.A)`
  align-items: center;
  gap: ${N.YC};
`,le=(0,G.A)(s.A)`
  flex-direction: column;
  gap: ${N.YC};
`,se=(0,G.A)(s.A)`
  align-items: center;
  justify-content: space-between;
`,oe=(0,G.A)(s.A)`
  flex-direction: column;
  padding-left: ${N.Ln};
  gap: 2px;
  align-items: flex-start;
`,ce=(0,G.A)(s.A)`
  align-items: start;
  gap: ${N.kc};
`,de=({category:e,severity:t,anomalyList:n})=>{const{themeName:i}=(0,Z.u)();return(0,r.jsxs)(le,{children:[(0,r.jsxs)(se,{children:[(0,r.jsx)(M.A,{size:"medium",children:(0,r.jsx)(c.sA,{id:X.HJ[e]})}),(0,r.jsx)(M.A,{size:"medium",color:X.HC[t],children:(0,r.jsx)(c.sA,{id:X.e7[t]})})]}),(0,r.jsx)(oe,{children:n.map((e,t)=>{const n=(0,J.Hr)(e.anomaly_score);return(0,r.jsxs)(ce,{children:[(0,r.jsx)(q.A,{variant:"outline",color:U.Ay[`desktop-color-${X.X2[n]}-${i}`]}),(0,r.jsx)(M.A,{size:"medium",children:(0,r.jsx)(c.sA,{id:X.l3[e.alert_event]})})]},e.alert_event+t)})})]})},Ae=({port:e})=>{const t=(0,a.d4)(((e,t)=>(0,O.Mz)(((e,t)=>(0,C.uh)(ie(e,t)))(e,t),x.kh))(e.device.mac,e.port_idx)),n=(0,i.useMemo)(()=>({[ee.V.LOOP_BROADCAST_FLOOD]:[],[ee.V.TRAFFIC_PATH_HEALTH]:[],[ee.V.CABLE_POWER]:[],[ee.V.MULTICAST_DISCOVERY]:[],...(0,Q.A)(t||[],e=>e.anomaly_category)}),[t]),l=(0,i.useMemo)(()=>Object.entries(n).reduce((e,[t,n])=>(e[t]=(e=>{const t=e.reduce((e,t)=>e+t.anomaly_score,0);return t>=X.hz?te.Q.CRITICAL:t>0?te.Q.DEGRADED:te.Q.NONE})(n),e),{[ee.V.LOOP_BROADCAST_FLOOD]:te.Q.NONE,[ee.V.TRAFFIC_PATH_HEALTH]:te.Q.NONE,[ee.V.CABLE_POWER]:te.Q.NONE,[ee.V.MULTICAST_DISCOVERY]:te.Q.NONE}),[n]);return(0,K.A)([ie(e.device.mac,e.port_idx)],(0,r.jsx)(o.A,{children:(0,r.jsxs)(s.A,{height:"100%",flexDirection:"column",gap:N.kc,children:[(0,r.jsxs)(ae,{children:[(0,r.jsx)(M.A,{size:"medium",weight:"bold",children:(0,r.jsx)(c.sA,{id:"PORTS_AI_ANOMALY_SCORE"})}),(0,r.jsx)(M.A,{color:(0,J.B9)(e.anomalyScoreCombinedValue),size:"medium",weight:"bold",children:e.anomalyScoreCombinedValue})]}),(0,r.jsx)(de,{category:ee.V.CABLE_POWER,severity:l[ee.V.CABLE_POWER],anomalyList:n[ee.V.CABLE_POWER]}),(0,r.jsx)(de,{category:ee.V.LOOP_BROADCAST_FLOOD,severity:l[ee.V.LOOP_BROADCAST_FLOOD],anomalyList:n[ee.V.LOOP_BROADCAST_FLOOD]}),(0,r.jsx)(de,{category:ee.V.MULTICAST_DISCOVERY,severity:l[ee.V.MULTICAST_DISCOVERY],anomalyList:n[ee.V.MULTICAST_DISCOVERY]}),(0,r.jsx)(de,{category:ee.V.TRAFFIC_PATH_HEALTH,severity:l[ee.V.TRAFFIC_PATH_HEALTH],anomalyList:n[ee.V.TRAFFIC_PATH_HEALTH]})]})}),{renderKey:`${e.device.mac}-${e.port_idx}`})},me=()=>{const{formatMessage:e}=(0,c.tz)(),t=(0,a.d4)(d.eK),[n,m]=(0,i.useState)(null),u=t.length>1,O=(0,i.useMemo)(()=>t.length?u?t.find(e=>e.id===n)??t.reduce((e,t)=>(t.anomalyScoreCombinedValue??0)>(e.anomalyScoreCombinedValue??0)?t:e):t[0]:null,[t,u,n]),C=(0,i.useMemo)(()=>{const n=new Set(t.map(e=>e.device.mac)).size>1;return t.map(({id:t,port_idx:r,device:i})=>{const a=e({id:"COMMON_PORT_NUMBER"},{portNumber:r});return{value:t,label:n&&i.name?`${a} — ${i.name}`:a}})},[t,e]),x=(0,i.useCallback)(({value:e})=>m(e),[]);return O?(0,r.jsxs)(s.A,{flexDirection:"column",children:[u?(0,r.jsx)(o.A,{children:(0,r.jsx)(l.A,{variant:"secondary",width:"100%",portal:!0,options:C,value:O.id,onChange:x})}):null,(0,r.jsx)(Y.A,{port:O,isOob:(0,A.NY)(O)}),(0,r.jsx)(Ae,{port:O}),(0,r.jsx)(z,{port:O}),(0,r.jsx)(W,{port:O})]}):null}},309675(e,t,n){n.d(t,{A:()=>s});var r=n(274934),i=n(814557),a=n(600191),l=n(263705);const s=e=>{const{themeName:t}=(0,l.u)();return(0,r.jsx)(a.A,{size:"original",variant:"fill",color:i.Ay[`desktop-color-orange-06-${t}`],...e})}},696049(e,t,n){n.d(t,{H:()=>r});const r=""},112104(e,t,n){n.d(t,{A:()=>d});var r=n(274934),i=n(602086),a=n(938984),l=n(599110),s=n(309130),o=n(100978),c=n(470070);const d=(e,t={})=>{const{formatMessage:n}=(0,c.tz)(),[d,A]=(0,i.useState)(!1),{defaultCount:m,label:{singular:u,plural:O}}=(0,i.useMemo)(()=>({defaultCount:t.defaultCount||6,label:{singular:n({id:t.label?.singular||"COMMON_DEVICE"}),plural:n({id:t.label?.plural||"COMMON_DEVICES"})}}),[t,n]),C=(0,i.useCallback)(()=>{A(e=>!e)},[]);return{rowLimit:e>m&&!d?m:e,renderFooter:e>m?(0,r.jsx)(o.A,{marginTop:s.kc,children:(0,r.jsxs)(a.A,{size:"medium",children:[(0,r.jsx)(c.sA,{id:"COMMON_ADV_TABLE_FOOTER",values:{length:e>m&&!d?m:e,total:e,singular:u,plural:O}}),(0,r.jsxs)(r.Fragment,{children:[" ",(0,r.jsxs)(l.A,{type:"button",variant:"inline",onClick:C,children:[(0,r.jsx)(c.sA,{id:"COMMON_SHOW"})," ",(0,r.jsx)(c.sA,{id:d?"COMMON_LESS":"COMMON_ALL"})]})]})]})}):null,setExpand:A}}},237887(e,t,n){n.d(t,{A:()=>m});var r=n(274934),i=n(602086),a=n(977872),l=n(693371),s=n(767822),o=n(820633),c=n(308111);const d=e=>(0,r.jsx)(l.A,{renderOption:s.q,...e}),A=e=>(0,r.jsx)(d,{...e});A.Sorted=e=>{const t=(0,a.d4)(o.zi),n=(0,i.useMemo)(()=>(0,c.k)(t),[t]);return(0,r.jsx)(d,{...e,sortBy:n})};const m=A},308111(e,t,n){n.d(t,{R:()=>A,k:()=>m});var r=n(696049),i=n(350068),a=n(177173),l=n(752104),s=n(64222),o=n(332530);const c=[...new Set([r.H,l.Q.join(l.A),a.Zt,s.F,i.nc,o.Vr])],d={numeric:!0,sensitivity:"base"},A=(e,t)=>{const n=[];for(let r=e;r<=t;r+=1)n.push({value:r,label:String(r)});return n},m=e=>({value:t,label:n},{value:r,label:i})=>c.includes(t?.toString())||c.includes(r?.toString())?1/0:n?.toString().localeCompare(i?.toString(),e,d)??-1},314191(e,t,n){n.d(t,{A:()=>l});var r=n(967059),i=n(24627),a=Object.prototype.hasOwnProperty;const l=(0,i.A)(function(e,t,n){a.call(e,n)?e[n].push(t):(0,r.A)(e,n,[t])})}}]);