"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[49005],{17441:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(296540),l=r(713769),n=r(264863);const o=({children:e})=>a.createElement(n.A,null,a.createElement(l.y,null,e))},43130:(e,t,r)=>{r.d(t,{E:()=>d,Np:()=>m,SH:()=>u});var a=r(325752),l=r(966784),n=r(936621),o=r(431247),c=r(768195),s=r(288006),i=r(871666);const d=(e,t,r)=>{let a=e.port_table?.find(e=>e.port_idx===t),l=a?.portconf_id&&r.find(e=>e._id===a?.portconf_id);const n=a?.name;let o=t;return a?.masked&&a?.aggregated_by&&(o=Number(a.aggregated_by),a=e.port_table?.find(e=>e.port_idx===o),l=a?.portconf_id&&r.find(e=>e._id===a?.portconf_id)),{profile:l,portData:a,adjustedPortNumber:o,originalPortName:n}},u=(e,t)=>`${e?.vlan||(t||e&&e?.networkgroup!==c.vj.LAN?i.$:1)}`,m=(e,t,r,i)=>(e.port_table||[]).reduce((m,E)=>{const{profile:A,portData:p,adjustedPortNumber:_}=d(e,E.port_idx,t),S=A?A.native_networkconf_id:p?.native_networkconf_id,h=A?A.excluded_networkconf_ids:p?.excluded_networkconf_ids,g=A?A.tagged_vlan_mgmt:p?.tagged_vlan_mgmt,C=S===n.F,O=r.find(e=>e._id===S),f=(0,l.Ue)(p?.ifname,e)||(0,l.m)(e,E.port_idx),N=(0,l.Xq)(p?.ifname,e),M=g===c.sg.BLOCK_ALL,v=g===c.sg.AUTO,b=(0,l.$k)(p?.ifname,e),T=p&&(b.includes(a.Vd.INTERFACE_DISABLED)||(0,o.Rj)(p));m.nativeNetwork[E.port_idx]={excluded_networkconf_ids:h,native_networkconf_id:S??i,tagged_vlan_mgmt:g??c.sg.AUTO,[s.dv.DISPLAYED_VLAN_ID]:u(O,C),[s.dv.IS_WAN_PORT]:f,[s.dv.ADJUSTED_PORT_NUMBER]:_,[s.dv.IS_MANAGED_BY_PORT_PROFILE]:!!A,[s.dv.IS_DISABLED]:T};const I=r.reduce((e,t)=>{const r=(S??i)===t?._id&&N,a=!h?.includes(t._id),l=!r&&!M&&N&&(a||v);return e[t._id]={port_idx:E.port_idx,excluded_networkconf_ids:h,[s.at.IS_TAGGED]:l,[s.at.IS_NETWORK_NATIVE_ON_PORT]:r,[s.at.ADJUSTED_PORT_NUMBER]:_,[s.at.IS_WAN_PORT]:f,[s.at.IS_MANAGED_BY_PORT_PROFILE]:!!A,[s.at.IS_DISABLED]:T},e},{});return m.taggedNetworks[E.port_idx]=I,m},{nativeNetwork:{},taggedNetworks:{}})},151061:(e,t,r)=>{r.d(t,{m:()=>A});var a=r(469733),l=r(296540),n=r(217439),o=r(90757),c=r(398300),s=r(340813),i=r(413146),d=r(845030),u=r(699784),m=r(532419),E=r(675845);const A=({last_uplink_mac:e,last_uplink_name:t,last_uplink_remote_port:r,disconnected_at:A,disabled:p,textSize:_,maxWidth:S})=>{const{formatMessage:h}=(0,u.tz)(),g=(0,a.useDispatch)(),C=(0,a.useSelector)(m.CC),O=(0,E.Z)(e,C),f=(0,E.z)(t,r,O,h);return l.createElement(l.Fragment,null,O?l.createElement("div",null,l.createElement(n.A,{color:"text-3",size:_},l.createElement(u.sA,{id:"COMMON_DEVICE_LAST_CONNECTED_TO",values:{deviceWithPort:l.createElement(s.A,{isFullWidth:!1,disabled:p,maxWidth:S||200,onClick:()=>{p||g((0,d.XP)({type:c.H.DEVICE,id:e}))},size:_},f)}}))):null,A?l.createElement("div",null,l.createElement(n.A,{color:"text-3",size:_},l.createElement(i.A,{date:(0,o.gH)(A)}))):null)}},177500:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Yn});var a=r(296540),l=r(71479),n=r(592510),o=r(834959),c=r(604482),s=r(413357),i=r(582724),d=r(566723),u=r(860923),m=r(105540),E=r(294303),A=r(627440),p=r(540883),_=r(745667),S=r(274174),h=r(457311),g=r(96121),C=r(920377),O=r(634229),f=r(37e3),N=r(896291),M=r(171073),v=r(984652),b=r(469733),T=r(935780),I=r(200619),P=r(840279),D=r(212178),k=r(431247),y=r(994791),x=r(497470);var w=r(758649),R=r(749177),L=r(363370),$=r(699784),U=r(959341),F=r(293016),V=r(649413),H=r(822336),z=r(217439),G=r(823858),W=r(368928),B=r(89603),K=r(998837),Y=r(366702),j=r(311785),X=r(855019),Z=r(142207),q=r(845030),Q=r(804396),J=r(889256),ee=r(572112),te=r(398300),re=r(75346);const ae=(0,l.A)(E.A,(0,j.A)("isVisible"))`
  background-color: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-01-${e}`]};
  gap: ${d.kc};
  padding: 6px ${d.kc};
  display: ${({isVisible:e})=>e?"flex":"none"};
`,le=(0,l.A)(E.A,(0,j.A)("elementWidth"))`
  position: absolute;
  border-radius: ${d.YC};
  width: fit-content;
  max-width: ${325}px;
  top: 0;
  max-height: ${320}px;
  overflow-y: auto;
  background-color: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-01-${e}`]};
  box-shadow: ${({theme:{themeName:e}})=>H.Ay[`desktop-shadow-low-${e}`]};
  z-index: 1;

  /* 
  Horizontal placement of this element is done through "right" property.
  1. Move element to middle of the page.
  2. Subtract half of the element width to center it.
  3. SPACE_16 is an extra constant to align with the page tabs.
  4. There is a constant relevant to scrollbar width - we dont want the element to jump left and right when scrollbar appears. This compentates the element& scrollbar widths movements.
  */
  right: ${({elementWidth:e,isOverflowing:t})=>`calc(50% + ${d.Ln} - ${e/2}px - ${t?16:0}px)`};
  @media ${ee.A.VIEWPORT_M_DOWN} {
    right: 0;
  }

  opacity: ${({elementWidth:e})=>e>0?1:0};
`,ne=(0,l.A)(E.A)`
  flex-direction: column;
  width: 100%;
`,oe=()=>a.createElement(G.A,{variant:"fill",size:"original",color:H.Ay[`desktop-color-red-06-${(0,K.u)().themeName}`]}),ce=()=>a.createElement(G.A,{variant:"fill",size:"original",color:H.Ay[`desktop-color-orange-06-${(0,K.u)().themeName}`]}),se=({issue:e,onClick:t})=>a.createElement(a.Fragment,null,J.g[e.anomaly]===Q.Q.CRITICAL?a.createElement(oe,null):a.createElement(ce,null),a.createElement(z.A,{size:"medium",color:"text-2",style:{cursor:t?"pointer":"default"},onClick:t?()=>t(e.port_idx):void 0},a.createElement($.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e.port_idx}}),": ",a.createElement($.sA,{id:Z.l3[e.anomaly]}))),ie=({deviceIssues:e,isExpanded:t,setIsExpanded:r,onPortClick:l})=>{const n=e.some(e=>J.g[e.anomaly]===Q.Q.CRITICAL);return a.createElement(ne,null,a.createElement(ae,{cursor:"pointer",onClick:()=>{r(!t)},isVisible:!0},n?a.createElement(oe,null):a.createElement(ce,null),a.createElement(z.A,{size:"medium",color:"text-2"},a.createElement($.sA,{id:"DEVICE_PORT_STATE_ISSUES_TITLE"})),t?a.createElement(W.A,{size:"original"}):a.createElement(B.A,{size:"original"})),t?e.map(e=>a.createElement(ae,{key:e.port_idx+e.anomaly,isVisible:t},a.createElement(se,{issue:e,onClick:l}))):null)},de=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.I_),r=(0,b.useSelector)(y.tI),l=(0,a.useRef)(null),{width:n}=(0,Y.A)(l.current),[o,c]=(0,a.useState)(!1),s=t=>{if(!r)return;const a=(0,k.FS)(r,t);e((0,x.Ao)([a])),e((0,q.XP)({type:te.H.PORTS,id:re.PANEL_PORTS_SIDE_PANEL_ID,tab:X.BC.INSIGHTS,onClose:()=>e((0,x.Ao)([])),preventReopen:!0}))};return t.length?a.createElement(le,{elementWidth:n,ref:l,isOverflowing:o&&t.length+1>10},1===t.length?a.createElement(ae,{isVisible:!0},a.createElement(se,{issue:t[0],onClick:s})):a.createElement(ie,{deviceIssues:t,isExpanded:o,setIsExpanded:c,onPortClick:s})):null},ue=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.OA),r=(0,V.Se)(t).type===F.F7.MC_LAG,l=(0,V.Se)(t).type===F.F7.STACKING_GROUP,n=(0,b.useSelector)(y.Hd),o=(0,b.useSelector)(y.hb),s=(0,b.useSelector)(y.UH),i=(0,b.useSelector)(y.XS),u=(0,R.A)(c.g1.PORT_MANAGEMENT),m=(0,b.useSelector)(y.w2),A=(0,a.useCallback)(()=>{e((0,x.Ao)([]))},[e]),p=(0,a.useCallback)(()=>{e((0,x.Ao)([s,o.selectablePortsBulkSelection].flat()))},[e,o.selectablePortsBulkSelection,s]),_=!o.selectablePortsBulkSelection.length,S=(0,a.useCallback)(()=>{e((0,x.xj)(!n))},[e,n]);return a.createElement(a.Fragment,null,a.createElement(E.A,{alignItems:"start",minHeight:30,marginTop:2,position:"relative",paddingLeft:u?0:d.kc},a.createElement(E.A,{gap:d.kc},r?a.createElement(L.A,{to:U.Rm,size:"small"},a.createElement($.sA,{id:"PORTS_EDIT_MC_LAG"})):null,l?a.createElement(L.A,{to:U.vc,size:"small"},a.createElement($.sA,{id:"PORTS_EDIT_STACKING"})):null,s.length?a.createElement(w.A,{size:"small",type:"button",variant:"inline",onClick:A},a.createElement($.sA,{id:"COMMON_ACTION_DESELECT_ALL"})):null,_||i?null:a.createElement(w.A,{size:"small",type:"button",variant:"inline",onClick:p},a.createElement($.sA,{id:"COMMON_ACTION_SELECT_ALL"})),m.length>1?a.createElement(w.A,{size:"small",type:"button",variant:"inline",onClick:S},a.createElement($.sA,{id:n?"PORTS_SHOW_CONNECTED_DEVICES":"PORTS_HIDE_CONNECTED_DEVICES"})):null),a.createElement(de,null)))};var me=r(271856),Ee=r(705145),Ae=r(162420),pe=r(6510),_e=r(962669),Se=r(780811),he=r(532419),ge=r(108199),Ce=r(635102),Oe=r(490551),fe=r(435325),Ne=r(951106),Me=r(975397),ve=r(118818),be=r(825032),Te=r(697490);const Ie=(0,l.A)(E.A,(0,j.A)("hide"))`
  align-items: center;
  justify-content: center;
  width: ${Z.Dq}px;
  height: ${Z.Dq}px;
  border-radius: ${d.YC};
  padding: ${d.YC};
  background: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-01-${e}`]};
  cursor: pointer;
  position: relative;
  ${(0,Me.g)(Z.Dq)}
`,Pe=(0,l.A)(ve.A)`
  width: ${d.YC};
  height: ${d.YC};
  position: absolute;
  background-color: ${({theme:{themeName:e}})=>e===be.S.DARK?H.Ay[`desktop-color-neutral-04-${e}`]:H.Ay[`desktop-color-neutral-08-${e}`]};
  top: ${d.YC};
  left: ${d.YC};
`,De=({connectedDevice:e,connectedClient:t,hide:r,wanProviderName:l,onClick:n,isActive:o})=>e||t||l?a.createElement(Ie,{hide:r,onClick:n},o?null:a.createElement(Pe,null),a.createElement(E.A,{opacity:o?void 0:ge.q},a.createElement(Te.A,{size:32,connectedClient:t,connectedDevice:e,wanProviderName:l}))):null;var ke=r(17437),ye=r(939703),xe=r(548212),we=r(691108),Re=r(213601),Le=r(966784);const $e=(0,xe.xn)(10),Ue=(0,l.A)(E.A,{shouldForwardProp:e=>!["color","isDisabled","isLocating","disableSelectionEvents"].includes(e)})`
  align-items: center;
  color: ${({theme:{themeName:e},color:t})=>H.Ay[`desktop-color-${t}-${e}`]};
  justify-content: center;
  position: relative;
  pointer-events: auto;
  border-radius: ${H.Ay["desktop-radius-base"]};
  cursor: ${({disableSelectionEvents:e})=>e?"default":"pointer"};
  ${({isDisabled:e})=>e?"\n    pointer-events: none;\n    opacity: 0.4;\n  ":""}
  ${({isLocating:e})=>e?ke.AH`
          animation: ${$e} 1s cubic-bezier(0.5, 1, 0, 1) infinite alternate;
        `:""}
`,Fe=(0,l.A)("div",{shouldForwardProp:e=>"stacked"!==e})`
  position: relative;
  width: ${Z.Dq}px;
  height: ${Z.Dq}px;
`,Ve={0:{top:0,left:0,topSelected:0,leftSelected:0,topHovered:0,leftHovered:0,height:Z.Dq,width:Z.Dq,heightSelected:Z.Dq,widthSelected:Z.Dq,heightHovered:Z.Dq,widthHovered:Z.Dq},1:{top:-1.75,left:3,topSelected:-6,leftSelected:3.22,topHovered:-2.75,leftHovered:4,height:37,width:37,heightSelected:40,widthSelected:41,heightHovered:37,widthHovered:37},2:{top:-3.75,left:8,topSelected:-9,leftSelected:7.22,topHovered:-5.75,leftHovered:10,height:36,width:34,heightSelected:40,widthSelected:40,heightHovered:36,widthHovered:34}},He=(0,l.A)("div",{shouldForwardProp:e=>!["background","border","order","isSelected","isHovered","isStacked"].includes(e)})`
  position: absolute;
  transform: translate(
    ${({order:e,isSelected:t,isHovered:r})=>Ve[e][t?"leftSelected":r?"leftHovered":"left"]}px,
    ${({order:e,isSelected:t,isHovered:r})=>Ve[e][t?"topSelected":r?"topHovered":"top"]}px
  );

  width: ${({order:e,isSelected:t,isHovered:r})=>Ve[e][t?"widthSelected":r?"widthHovered":"width"]}px;
  height: ${({order:e,isSelected:t,isHovered:r})=>Ve[e][t?"heightSelected":r?"heightHovered":"height"]}px;

  border: ${({order:e})=>0!==e?"none":"1px solid"} ${({border:e})=>e};
  border-radius: ${d.YC};
  background: ${({background:e})=>e};
  z-index: ${({order:e})=>3-e};
  transition:
    all 0.2s ease-out,
    outline 0s,
    outline-offset 0s;

  filter: ${({isHovered:e,order:t})=>e&&0===t?"brightness(0.9)":"none"};
  ${({isSelected:e,order:t,theme:{themeName:r}})=>e&&0===t?`\n      outline: 2px solid ${H.Ay[`desktop-color-ublue-06-${r}`]}; \n      outline-offset: 1px;\n      `:""}
`,ze=(0,l.A)("div")`
  position: absolute;
  right: 2px;
  top: 2px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: ${4};
`,Ge=(0,l.A)(z.A)`
  position: absolute;
  text-align: left;
  bottom: 0px;
  left: 4px;
  pointer-events: none;
  z-index: 4;
`,We=(0,l.A)("div")`
  position: absolute;
  width: ${2*Z.Dq+16}px;
  height: ${Z.Dq+8}px;
  top: -${d.YC};
  left: -${d.YC};
  z-index: -1;
  background: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-ublue-01-${e}`]};
  border-radius: ${d.kc};
  border: 1px solid ${({theme:{themeName:e}})=>H.Ay[`desktop-color-ublue-04-${e}`]};
`,Be=(0,a.memo)(({port:e,isFirstPortInMcLagLinks:t,isFirstPortWan:r,isFirstPortManagement:l,isFirstRow:n})=>{const o=(0,b.useDispatch)(),c=(0,b.useSelector)(y.x$),s=(0,b.useSelector)(y.UH),i=(0,b.useSelector)(y.O2),d=(0,b.useSelector)(y.pN),u=(0,b.useSelector)(y.XS),[m,E]=(0,a.useState)(!1),A=(0,b.useSelector)(y.QR),p=u,_=(0,b.useSelector)((0,a.useMemo)(()=>(0,y.JX)(e.port_idx||0,e.device.mac),[e.port_idx,e.device.mac])),{background:S,border:h,text:g,stackBackground:C=S,stackBackgroundDark:O=S}=(0,a.useMemo)(()=>(0,xe.PI)(e),[e]),f=Boolean(e.isInTargetDevice||e.isInMcLink),N=u?Boolean(e.port_idx&&d.includes(e.port_idx)):Boolean(e.port_idx&&i.has((0,k.FS)(e.device.mac,e.port_idx))),M=!(0,Me.s)(e,s,r,l,N,t,f,A,u,d),v=(0,a.useCallback)(t=>{if(t.stopPropagation(),!p&&!M&&e.port_idx){const r=(0,k.FS)(e.device.mac,e.port_idx),a=t.metaKey||t.ctrlKey;o(a?(0,x.Ao)((0,Le.QP)(r,s)):(0,x.Ao)((0,Le.Um)(r)))}},[o,p,M,e.device.mac,e.port_idx,s]),T=Boolean(e.aggregationGroup),I=m||Boolean(e.lag_idx)&&e.lag_idx===c,P=(0,a.useCallback)(()=>{p||(e.lag_idx&&o((0,x.L$)(e.lag_idx)),E(!0))},[o,p,e.lag_idx]),D=(0,a.useCallback)(()=>{p||(o((0,x.L$)(null)),E(!1))},[o,p]),w=(0,K.u)(),{card1Background:R,card2Background:L}=(0,a.useMemo)(()=>{const e=(0,ye.YR)((0,ye.wQ)((0,Le.oX)(S,w.themeName)),"dark"===w.themeName?(0,ye.wQ)((0,Le.oX)(O,w.themeName)):(0,ye.wQ)((0,Le.oX)(C,w.themeName)),50),t=(0,ye.YR)((0,ye.wQ)((0,Le.oX)(S,w.themeName)),"dark"===w.themeName?(0,ye.wQ)((0,Le.oX)(O,w.themeName)):(0,ye.wQ)((0,Le.oX)(C,w.themeName)),100);return{card1Background:(0,ye.qi)(e),card2Background:(0,ye.qi)(t)}},[S,C,O,w.themeName]);return a.createElement(we.A,{port:e,position:n?"top":"bottom"},a.createElement(Ue,{onClick:v,color:g,isDisabled:M,isLocating:_,disableSelectionEvents:p,onMouseEnter:P,onMouseLeave:D},a.createElement(Fe,{stacked:T},a.createElement(He,{order:0,background:(0,Le.oX)(S,w.themeName),border:(0,Le.oX)(h,w.themeName),isSelected:N,isHovered:I}),T&&a.createElement(a.Fragment,null,a.createElement(He,{order:1,background:R,border:(0,Le.oX)(h,w.themeName),isSelected:N,isHovered:I}),a.createElement(He,{order:2,background:L,border:(0,Le.oX)(h,w.themeName),isSelected:N,isHovered:I}))),a.createElement(ze,null,a.createElement(Re.A,{icon:e.icon})),a.createElement(Ge,{size:"small",color:"inherit"},(0,_e.LS)(e,e.device?.model)),(0,k.s_)(e.port_idx,e.device?.model)?a.createElement(We,null):null))});var Ke=r(927099);const Ye=(0,l.A)(E.A,(0,j.A)("hide"))`
  ${(0,Me.g)(20)};
`,je=({poe_enable:e,poe_power:t,hide:r})=>{const l=(0,_e.lG)({poe_enable:e,poe_power:t});return l?a.createElement(Ye,{hide:r},a.createElement(Ke.A,{color:"tertiary",size:"label"},l)):null},Xe=(0,l.A)(Ee.A)`
  text-align: center;
  cursor: pointer;
  max-width: ${Z.Dq}px;
`,Ze=(0,l.A)(E.A,(0,j.A)("hide","isActive"))`
  ${(0,Me.g)(20)};
  cursor: pointer;
  opacity: ${({isActive:e})=>e?1:ge.q};
`,qe=({onClick:e,hide:t,label:r,isActive:l})=>a.createElement(Ze,{hide:t,onClick:e,isActive:l},a.createElement(Xe,{isTruncated:!0,size:"xsmall",weight:"bold",color:"text-2"},r)),Qe=(0,l.A)(E.A,(0,j.A)("isFirstRow","disableGap"))`
  flex-direction: ${({isFirstRow:e})=>e?"column-reverse":"column"};
  justify-content: flex-start;
  align-items: center;
  gap: ${({disableGap:e})=>e?0:d.YC};
  position: relative;
  max-width: ${Z.Dq}px;
`,Je=(0,l.A)(E.A,(0,j.A)("hide","isActive"))`
  width: 1px;
  height: ${8}px;
  opacity: ${({isActive:e})=>e?1:0};
  background: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-04-${e}`]};
  ${(0,Me.g)(8)}
`,et=(0,a.memo)(({isFirstRow:e,port:t,hideOptionalElements:r,topConnectionMac:l,setTopConnectionMac:n,topConnectionMacWithPoe:o,setTopConnectionMacWithPoe:c,isFirstSelectedPortWan:s,isFirstSelectedPortManagement:i,isFirstSelectedPortInMcLag:d})=>{const u=(0,b.useDispatch)(),{connectedClient:m,connectedDevice:A,connectedMac:p,wanConfiguration:_,wanProviderName:S}=(0,Ce.A)(t),{lastConnectionClient:h,lastConnectionDevice:g}=(0,ge.A)(t),C=h?.mac||g?.mac,O=p||C,f=(0,a.useMemo)(()=>O?(0,fe.r)(O):()=>{},[O]),N=(0,b.useSelector)(f),M=(0,a.useMemo)(()=>_?te.H.ISP_DETAILS:A||g?te.H.DEVICE:N?te.H.UNIFI_DEVICE_CLIENT:m||h?te.H.CLIENT:void 0,[A,g,m,h,N,_]),T=(0,a.useCallback)(e=>{e.stopPropagation();const t=_?.configuration?.wan_networkgroup||p||C;t&&(h&&M===te.H.CLIENT&&!p&&u((0,v.W6)(t,!0)),u((0,q.XP)({type:M,id:t})))},[p,u,h,C,M,_?.configuration?.wan_networkgroup]),I=!(!p&&!_||!t.up),P=Boolean(h||g),D=S||(0,pe.Q)(A||g)||(0,Ne.tn)(m||h),k=I?void 0:h?.last_seen||g?.last_seen,y=!e,x=k?"text-3":"text-2",w=Boolean((0,_e.lG)({poe_enable:t.poe_enable,poe_power:t.poe_power}));return(0,a.useEffect)(()=>{l!==t.device.mac&&e&&(I||P)&&(n(t.device.mac),w&&o!==t.device.mac&&c(t.device.mac))},[t.device.mac,l,n,o,c,I,P,e,w]),a.createElement(Qe,{isFirstRow:e,disableGap:r},a.createElement(E.A,null,a.createElement(Be,{port:t,isFirstPortInMcLagLinks:d,isFirstPortWan:s,isFirstPortManagement:i,isFirstRow:e})),I||P?a.createElement(Oe.A,{label:D,lastSeen:k,isUpsideDown:y,isTooltipAllowed:Boolean(D)},a.createElement(Qe,{isFirstRow:e,disableGap:r},a.createElement(Je,{hide:r,isActive:I}),a.createElement(De,{connectedDevice:A||g,connectedClient:m||h,wanProviderName:S,hide:r,onClick:T,isActive:I}),a.createElement(qe,{label:D,onClick:T,hide:r,textColor:x,isActive:I}),a.createElement(je,{poe_enable:t.poe_enable,poe_power:t.poe_power,hide:r}))):null)}),tt=(0,l.A)(E.A)`
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: ${d.kc};
`,rt=(0,l.A)(E.A)`
  gap: ${d.kc};
`,at=(0,l.A)("div")`
  width: ${38}px;
`,lt=(0,l.A)(E.A,(0,j.A)("scale"))`
  transform: scale(${({scale:e})=>e});
  justify-content: center;
  align-self: center;
`,nt=(0,l.A)(E.A)`
  flex-direction: column;
  gap: ${d.kc};
`,ot=(0,l.A)(E.A)`
  min-height: 32px;
`,ct=(0,l.A)(E.A)`
  gap: ${d.YC};
  align-items: center;
`;var st=r(340936),it=r(960407);const dt=({children:e,cachedScaleRef:t})=>{const{spaceOffset:r,containerRef:l,contentRef:n,scale:o}=(e=>{const t=(0,a.useRef)(null),r=(0,a.useRef)(null),l=Boolean(t.current)&&Boolean(r.current),{width:n=0}=(0,st.A)({ref:r}),{width:o=0}=(0,st.A)({ref:t}),[c,s]=(0,a.useState)(0),i=n>0&&o>0?Math.min((n-16)/o,1):e.current,d=window.innerWidth-(t.current?.getBoundingClientRect().right||0),u=d-(window.innerWidth-(r.current?.getBoundingClientRect().right||0)),m=(0,a.useRef)(u);m.current=u;const E=(0,a.useRef)(416-d);E.current=416-d;const A=(0,b.useSelector)(y.UH),p=(0,b.useSelector)(it.WS),_=Boolean(A.length)||p,S=(0,b.useSelector)(y.QR),h=(0,b.useSelector)(y.kq);return(0,a.useEffect)(()=>{n>0&&o>0&&(e.current=i)},[i,n,o,e]),(0,a.useEffect)(()=>{if(_&&!S&&E.current>0){const e=Math.min(E.current,m.current),t=2*e,r=E.current-e;s(r+t)}else s(0)},[_,S,l,h]),{spaceOffset:c,scale:i,containerRef:r,contentRef:t}})(t);return a.createElement("div",{ref:l,style:{marginRight:r,transitionDuration:"0.2s",alignItems:"center"}},a.createElement(E.A,{gap:d.kc,flexDirection:"column",overflow:"visible"},a.createElement(lt,{scale:o,ref:n},e)))},ut=(0,l.A)(E.A)`
  flex-direction: column;
  justify-content: start;
  gap: ${d.kc};
`,mt=(0,l.A)(E.A)`
  gap: ${d.kc};
`,Et=(0,l.A)("div")`
  width: ${Z.Dq}px;
`,At=(0,l.A)(E.A,(0,j.A)("isDiagramTopRowExpanded","hasPoeLabel"))`
  align-items: start;
  padding-top: ${({isDiagramTopRowExpanded:e,hasPoeLabel:t})=>(e?100:40)+(t?24:0)}px;
`,pt=(0,l.A)(Ee.A)`
  transform: rotate(-90deg) translate(-50%, 0);
  transform-origin: left center;
  position: absolute;
  left: -${d.xO};
  width: max-content;
  max-width: 95px;
`,_t=(0,a.memo)(({deviceMac:e,cachedScaleRef:t,showDeviceName:r})=>{const l=(0,b.useSelector)(he.Kh).get(e),n=(0,b.useSelector)(y.OF),o=(0,a.useMemo)(()=>n.filter(t=>t.device.mac===e),[n,e]),c=(0,b.useSelector)(y.Hd),s=(0,b.useSelector)(y.pZ),i=(0,b.useSelector)(y.IP),u=(0,b.useSelector)(y.uq),[m,A]=(0,a.useState)(""),[p,_]=(0,a.useState)(""),S=(0,a.useMemo)(()=>{if(!l?.model)return!1;const{diagram:e}=(0,Se.joB)(l.model);return!!e},[l?.model]),h=(0,a.useMemo)(()=>{if(!l?.model)return(0,P.A)();const{diagram:e}=(0,Se.joB)(l.model);if(!e)return(0,P.A)();const t=e.length?(0,_e.sT)(e,l):(0,_e.oJ)(l);if(!t)return(0,P.A)();const r=new Map(o.map(e=>[e.port_idx,e]));return t.map((e,t)=>a.createElement(mt,{key:`PortDiagramLayoutRow-${t+1}`},e.map((e,l)=>{const n=`PortDiagramLayoutCell-${t+1}-${l+1}`,o=r.get(e?.portNumber);return o?a.createElement(et,{port:o,key:n,isFirstRow:0===t,hideOptionalElements:c,setTopConnectionMac:A,topConnectionMac:m,setTopConnectionMacWithPoe:_,topConnectionMacWithPoe:p,isFirstSelectedPortWan:s,isFirstSelectedPortManagement:i,isFirstSelectedPortInMcLag:u}):a.createElement(Et,{key:n})})))},[o,l,c,m,p,s,i,u]);if(!S)return a.createElement(E.A,{gap:d.kc},a.createElement(Ae.A,{isActive:!0}),a.createElement(z.A,{size:"small"},a.createElement($.sA,{id:"DEVICE_DIAGRAM_MISSING"})));if(0===o.length)return null;if(!h||0===h.length)return null;const g=(0,pe.Q)({name:l?.name,model:l?.model,mac:l?.mac});return a.createElement(dt,{cachedScaleRef:t},a.createElement(E.A,null,r?a.createElement(At,{isDiagramTopRowExpanded:m===e&&!c,hasPoeLabel:p===e&&!c},a.createElement(me.A,{portal:!0,description:g,position:"top",noWrap:!0},a.createElement(pt,{size:"small",color:"text-3",isTruncated:!0},g))):null,a.createElement(ut,null,h)))});var St=r(601021);const ht=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.OA),r=(0,b.useSelector)(y.Jm);(0,a.useEffect)(()=>{e((0,x.U)(t))},[e]),(0,a.useEffect)(()=>r?(e((0,x.gU)(!1)),()=>null):()=>{e((0,St.p)(!1)),e((0,x.Ao)([]))},[e])};var gt=r(953048);const Ct=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.$X),r=(0,b.useSelector)(y.wJ),l=(0,Le.Ki)(r);(0,a.useEffect)(()=>{!l&&t&&e((0,x.JL)(!1))},[l,t,e])};var Ot=r(523275),ft=r(854726),Nt=r(366188),Mt=r(43130),vt=r(105925),bt=r(766624),Tt=r(596176),It=r(524936),Pt=r(226712),Dt=r(264752),kt=r(288006),yt=r(718073),xt=r(907011),wt=r(538535),Rt=r(156472),Lt=r(944373),$t=r(792072);const Ut=(0,l.A)(Ee.A)`
  max-width: 120px;
`,Ft=({portNumber:e})=>{const t=(0,b.useSelector)(y.aq),r=(0,b.useSelector)(ft.wD),l=(0,b.useSelector)(Lt.D),n=(0,b.useSelector)(wt.D5),{portData:o,originalPortName:c}=(0,Mt.E)(t,e,r),s=(0,b.useSelector)(Nt.wf),i=(0,b.useSelector)($t.pB),u=(0,b.useSelector)(Rt.G),m=(0,Le.vT)(o,t,l,n,s,i,u),{connectedClient:A,connectedDevice:p,connectedMac:_,wanConfiguration:S,wanProviderName:h}=(0,Ce.A)(m);return a.createElement(E.A,{flexDirection:"column",gap:d.YC},a.createElement(E.A,{gap:d.kc,alignItems:"center",width:"100%"},a.createElement(Ee.A,{color:"inherit",weight:"bold",size:"inherit",isTruncated:!0},e,c?` | ${c}`:"")),(_||S)&&m.up?a.createElement(E.A,{justifyContent:"space-between",gap:d.fS,alignItems:"center"},a.createElement(Ee.A,{color:"inherit",size:"small"},a.createElement($.sA,{id:"COMMON_CONNECTED_TO"})),a.createElement(E.A,{alignItems:"center",gap:d.YC},a.createElement(Te.A,{size:20,connectedClient:A,connectedDevice:p,wanProviderName:h}),a.createElement(Ut,{color:"inherit",size:"small",isTruncated:!0},h??(p?(0,pe.Q)(p):(0,Ne.tn)(A))))):null)};var Vt=r(871666);const Ht=(0,l.A)(E.A,{shouldForwardProp:e=>!["background","border"].includes(e)})`
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${d.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,zt=(0,a.memo)(({isTagged:e,isWanPort:t,isNative:r,portNumber:l,networkId:n,rowIndex:o,isDisabled:c})=>{const{themeName:s}=(0,K.u)(),{background:i,border:d,text:u}=(0,a.useMemo)(()=>{let a;switch(!0){case t:a=kt.vL.WAN;break;case c:a=kt.vL.DISABLED;break;case r:a=kt.vL.UNTAGGED_NATIVE;break;case e:a=kt.vL.TAGGED;break;default:a=kt.vL.BLOCKED}const{background:l,border:n,text:o}=Vt.k[a];return{background:l,border:n,text:o}},[t,c,r,e]);return a.createElement(yt.A,{key:`${l}-${n}`,description:a.createElement(Ft,{portNumber:l}),placement:0===o?"top":"bottom",delay:0,closeDelay:0},a.createElement(Ht,{background:(0,Le.oX)(i,s),border:(0,Le.oX)(d,s),color:(0,Le.oX)(u,s)},t?a.createElement(xt.A,{size:"original",color:(0,Le.oX)(u,s)}):null))}),Gt=(0,l.A)(E.A)`
  & > *:not(:last-child) {
    border-bottom: ${({theme:{themeName:e}})=>H.Ay[`desktop-border-divider-${e}`]};
  }
`,Wt=(0,l.A)(E.A)`
  &:not(:last-child) {
    padding-bottom: ${d.kc};
  }
  &:not(:first-child) {
    padding-top: ${d.kc};
  }
`,Bt=({network:e,rowLayouts:t,model:r,values:l,cachedScaleRef:n})=>a.createElement(dt,{cachedScaleRef:n},a.createElement(tt,null,(t||[]).map((t,n)=>a.createElement(rt,{key:`PortDiagramLayoutRow-${n+1}`},t.map((t,o)=>{const c=`PortDiagramLayoutCell-${n+1}-${o+1}`,s=+(0,_e.Cu)({port_idx:t?.portNumber},r),i=l.taggedNetworks[s]?.[e._id];return t&&i?a.createElement(zt,{key:c,isNative:i[kt.at.IS_NETWORK_NATIVE_ON_PORT],isWanPort:i[kt.at.IS_WAN_PORT],isTagged:i[kt.at.IS_TAGGED],isDisabled:i[kt.at.IS_DISABLED],portNumber:s,rowIndex:n,networkId:e._id}):a.createElement(at,{key:c})}))))),Kt=({rowLayouts:e,model:t,values:r,cachedScaleRef:l})=>{const{formatMessage:n}=(0,$.tz)(),o=(0,b.useSelector)(Nt.Tn).sort((e,t)=>e.vlan-t.vlan),[c,s]=(0,a.useState)(""),[i,u]=(0,a.useState)([]),m=(0,a.useMemo)(()=>o.map(e=>({id:e._id,vlan:e.vlan,name:e.name,subnet:(0,It.mC)(e),label:e.name})),[o]),A=(0,a.useMemo)(()=>m.filter(({id:e,name:t,subnet:r,vlan:a})=>(t?.toLowerCase().includes(c.toLowerCase())||r?.toLowerCase().includes(c.toLowerCase())||a?.toString().toLowerCase().includes(c.toLowerCase()))&&!i.some(t=>t.id===e)),[m,i,c]),p=(0,a.useCallback)(e=>{if(i.some(({id:t})=>t===e))return;const t=m.find(({id:t})=>t===e);t&&u(e=>e.concat([{id:t.id,label:t.label}]))},[m,i]),_=(0,a.useCallback)(e=>{u(t=>t.filter(({id:t})=>t!==e))},[]);return a.createElement(E.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},a.createElement(ot,null,a.createElement(E.A,{gap:d.kc,width:"100%",flexWrap:"wrap",alignItems:"center"},a.createElement(ct,null,a.createElement(Ke.A,{size:"body",weight:"bold",color:"primary",style:{whiteSpace:"nowrap"}},a.createElement($.sA,{id:"PORTS_VLANS_SECTION_TITLE"})),a.createElement(bt.A,{description:a.createElement(Tt.A,{messages:[["PORTS_VLANS_SECTION_TITLE_DESC_1"],["PORTS_VLANS_SECTION_TITLE_DESC_2"],["PORTS_VLANS_SECTION_TITLE_DESC_3"]]})})),a.createElement(Dt.A,{description:a.createElement($.sA,{id:"COMMON_TAGGED"}),indicator:a.createElement(Pt.j,{background:Vt.k.TAGGED.background})}),a.createElement(Dt.A,{description:a.createElement($.sA,{id:"COMMON_BLOCKED"}),indicator:a.createElement(Pt.j,{background:Vt.k.BLOCKED.background})}),a.createElement(Dt.A,{description:a.createElement($.sA,{id:"COMMON_NATIVE"}),indicator:a.createElement(Pt.j,{background:Vt.k.UNTAGGED_NATIVE.background})}),a.createElement(E.A,{flexGrow:1}),a.createElement(vt.A,{selectOnEnter:!0,value:c,tags:i,searchResults:A,onClear:(e,t)=>{s("")},onReset:()=>{s(""),u([])},onChange:(e,t)=>{s(t)},onAddTag:p,onRemoveTag:_,placeholder:i.length?"":n({id:"PORTS_VLANS_SECTION_SEARCH"}),maxResultsHeight:300}))),a.createElement(nt,null,a.createElement(Gt,{flexDirection:"column"},o.filter(e=>!i.length||i.map(e=>e.id).includes(e._id)).map(n=>a.createElement(Wt,{flexDirection:"column",gap:d.YC,key:n._id},a.createElement(E.A,{justifyContent:"space-between",alignItems:"center"},a.createElement(Ke.A,{size:"body",color:"secondary"},(0,It.gm)(n)),a.createElement(Ke.A,{size:"body",color:"tertiary"},(0,It.mC)(n))),a.createElement(Bt,{network:n,rowLayouts:e,model:t,values:r,cachedScaleRef:l}))))))},Yt=(0,l.A)(E.A,{shouldForwardProp:e=>!["background","border"].includes(e)})`
  position: relative;
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${d.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,jt=(0,a.memo)(({nativeNetworkVlanId:e,isWanPort:t,portNumber:r,rowIndex:l})=>{const{themeName:n}=(0,K.u)(),{background:o,border:c,text:s}=t?Vt.k[kt.vL.WAN]:Vt.k[kt.vL.NATIVE];return a.createElement(yt.A,{key:`${r}-${l}`,description:a.createElement(Ft,{portNumber:r}),placement:0===l?"top":"bottom",delay:0,closeDelay:0},a.createElement(Yt,{background:(0,Le.oX)(o,n),border:(0,Le.oX)(c,n)},t?a.createElement(xt.A,{size:"original",color:(0,Le.oX)(s,n)}):a.createElement(Ke.A,{size:"caption",color:"primary"},e)))}),Xt=({rowLayouts:e,model:t,values:r,cachedScaleRef:l})=>a.createElement(E.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},a.createElement(ot,null,a.createElement(ct,null,a.createElement(Ke.A,{size:"body",weight:"bold",color:"primary",style:{whiteSpace:"nowrap"}},a.createElement($.sA,{id:"PORTS_VLANS_NATIVE_TITLE"})),a.createElement(bt.A,{description:a.createElement(Tt.A,{messages:[["PORTS_VLANS_NATIVE_TITLE_DESC_1"],["PORTS_VLANS_NATIVE_TITLE_DESC_2"]]})}))),a.createElement(nt,null,a.createElement(dt,{cachedScaleRef:l},a.createElement(tt,null,(e||[]).map((e,l)=>a.createElement(rt,{key:`PortDiagramLayoutRow-${l+1}`},e.map((e,n)=>{const o=`PortDiagramLayoutCell-${l+1}-${n+1}`,c=+(0,_e.Cu)({port_idx:e?.portNumber},t),s=r.nativeNetwork[c];return e&&s?a.createElement(jt,{key:o,isWanPort:s[kt.dv.IS_WAN_PORT],nativeNetworkVlanId:s[kt.dv.DISPLAYED_VLAN_ID],isDisabled:s[kt.dv.IS_DISABLED],portNumber:c,rowIndex:l}):a.createElement(at,{key:o})}))))))),Zt=(0,l.A)(E.A)`
  flex-direction: column;
  gap: ${d.kc};
  padding-bottom: 3px;
  min-width: ${440}px;
  width: 100%;
  align-items: center;
  align-self: ${({isNarrow:e})=>e?"start":"center"};
`,qt=()=>{const[e,t]=(0,a.useState)(!1),r=(0,a.useRef)(null),l=(0,a.useRef)(1),n=(0,b.useSelector)(y.w2),o=(0,b.useSelector)(he.ID),c=(0,a.useMemo)(()=>n[0]?o.find(e=>e.mac===n[0]):(0,Ot.A)(),[n,o]),{diagram:s}=(0,Se.joB)(c?.model),i=(0,b.useSelector)(ft.wD),d=(0,b.useSelector)(Nt.Tn),u=(0,b.useSelector)(Nt.nT)?._id,m=(0,a.useMemo)(()=>(0,Mt.Np)(c,i,d,u),[u,c,d,i]),E=s.length?(0,_e.sT)(s,c):(0,_e.oJ)(c);return(0,a.useEffect)(()=>{const e=r.current;if(!e)return;const a=new ResizeObserver(e=>{const[r]=e,{width:a}=r.contentRect;t(a<=440)});return a.observe(e),()=>{a.disconnect()}},[]),a.createElement(Zt,{ref:r,isNarrow:e,flexDirection:"column",paddingBottom:3,minWidth:440,width:"100%",alignItems:"center"},c?a.createElement(a.Fragment,null,a.createElement(Xt,{rowLayouts:E,model:c?.model,values:m,cachedScaleRef:l}),a.createElement(Kt,{rowLayouts:E,model:c?.model,values:m,cachedScaleRef:l})):null)};var Qt=r(795342),Jt=r(132196),er=r(249304),tr=r(318787),rr=r(29896),ar=r(984297),lr=r(905410),nr=r(440503),or=r(368476),cr=r(602021),sr=r(200826),ir=r(415246),dr=r(305988),ur=r(489391),mr=r(346010),Er=r(546391),Ar=r(584916);const pr=["","k","M","G","T","P","E","Z","Y"],_r=e=>e>=ee.A.XXL.TO?25:e>=ee.A.L.TO?13:e>=ee.A.M.TO?7:4,Sr={[Ar.l.ONE_DAY]:{frequency:_r,label:({index:e,value:t,selfUse24HourTime:r,selfHourCycle:a,documentWidth:l,siteTimezone:n,language:o,formatMessage:c})=>e!==_r(l)-1?new Intl.DateTimeFormat(o,{hourCycle:a,hour:"numeric",timeZone:n,...r&&{minute:"numeric"}}).format(t).toUpperCase():c({id:"COMMON_NOW"})},[Ar.l.ONE_WEEK]:{frequency:()=>7,label:({value:e,language:t})=>new Intl.DateTimeFormat(t,{weekday:"short"}).format(e)},[Ar.l.ONE_MONTH]:{frequency:(e,t)=>Math.ceil(t/(e>=ee.A.XL.TO?1:e>=ee.A.M.TO?2:4)),label:({value:e,language:t})=>new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(e)},[Ar.j]:{frequency:()=>10,label:({value:e,selfHourCycle:t,siteTimezone:r,language:a})=>new Intl.DateTimeFormat(a,{hourCycle:t,month:"short",day:"numeric",hour:"numeric",minute:"numeric",timeZone:r}).format(e).replace(Er.sO,e=>e.toUpperCase())}};class hr extends ur.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${pr[this.power]}W`}toString(){return Number.isFinite(this.bytes)?((e,t)=>{const r=Math.abs(e);return r<10?`${e.toFixed(2)} ${t}`:r<100?`${e.toFixed(1)} ${t}`:`${e.toFixed(0)} ${t}`})(this.value,this.unit):""}}class gr extends ur.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${pr[this.power]}Pkts`}}class Cr extends ur.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${pr[this.power]}Wh`}}const Or=e=>(t,r)=>{const{source:a,usage:l}=e;switch(a){case or.I0.PACKETS:case or.I0.ERRORS:case or.I0.DROPPED:return new gr(t,r);case or.I0.POE:return new hr(t,r);case or.I0.USAGE:return l===or.AM.BPS?(0,ur.cS)(t,"bitrate","SI",r):(0,ur.cS)(t,void 0,void 0,r);default:return(0,ur.cS)(t,void 0,void 0,r)}},fr=e=>{const t=(e=>{let t="";return e.source===or.I0.USAGE&&(e.usage===or.AM.BPS&&(t="rate"),e.usage===or.AM.BYTES&&(t="bytes")),e.source===or.I0.PACKETS&&(e.packets===or.uO.ALL&&(t="packets"),e.packets===or.uO.BROADCAST&&(t="broadcast"),e.packets===or.uO.MULTICAST&&(t="multicast")),t})(e);return(r,a,l)=>{const n="number"==typeof a?`port_${a}`:`wan${a}`;if(e.source===or.I0.USAGE&&e.usage===or.AM.BPS){const t=r[`${n}-tx_bytes`]||0,a=r[`${n}-rx_bytes`]||0;if(!l)return 0;if(e.direction===or.O_.ALL)return(0,mr.tI)(t+a,l);if(e.direction===or.O_.UPLINK)return(0,mr.tI)(t,l);if(e.direction===or.O_.DOWNLINK)return(0,mr.tI)(a,l)}if(e.source===or.I0.POE)return r[`${n}-poe_power`]||0;if(e.source===or.I0.ERRORS){const t=r[`${n}-tx_errors`]||0,a=r[`${n}-rx_errors`]||0;if(e.direction===or.O_.ALL)return t+a;if(e.direction===or.O_.UPLINK)return t;if(e.direction===or.O_.DOWNLINK)return a}if(e.source===or.I0.DROPPED){const t=r[`${n}-tx_dropped`]||0,a=r[`${n}-rx_dropped`]||0;if(e.direction===or.O_.ALL)return t+a;if(e.direction===or.O_.UPLINK)return t;if(e.direction===or.O_.DOWNLINK)return a}const o=r[`${n}-tx_${t}`]||0,c=r[`${n}-rx_${t}`]||0;return e.direction===or.O_.ALL?o+c:e.direction===or.O_.UPLINK?o:e.direction===or.O_.DOWNLINK?c:0}},Nr=()=>{const e=(0,b.useDispatch)(),{themeName:t}=(0,K.u)(),r=(0,b.useSelector)(y.zD),l=(0,a.useMemo)(()=>(e=>[H.Ay[`desktop-color-navy-06-${e}`],H.Ay[`desktop-color-navy-04-${e}`],H.Ay[`desktop-color-aqua-04-${e}`],H.Ay[`desktop-color-green-04-${e}`],H.Ay[`desktop-color-green-06-${e}`],H.Ay[`desktop-color-green-08-${e}`],H.Ay[`desktop-color-lime-06-${e}`],H.Ay[`desktop-color-yellow-06-${e}`],H.Ay[`desktop-color-purple-06-${e}`],H.Ay[`desktop-color-yellow-09-${e}`],H.Ay[`desktop-color-lime-07-${e}`],H.Ay[`desktop-color-aqua-06-${e}`],H.Ay[`desktop-color-green-09-${e}`],H.Ay[`desktop-color-navy-05-${e}`],H.Ay[`desktop-color-green-05-${e}`],H.Ay[`desktop-color-lime-09-${e}`],H.Ay[`desktop-color-ublue-05-${e}`],H.Ay[`desktop-color-purple-04-${e}`],H.Ay[`desktop-color-yellow-07-${e}`],H.Ay[`desktop-color-ublue-04-${e}`],H.Ay[`desktop-color-ublue-06-${e}`],H.Ay[`desktop-color-lime-05-${e}`],H.Ay[`desktop-color-ublue-09-${e}`],H.Ay[`desktop-color-lime-04-${e}`],H.Ay[`desktop-color-navy-09-${e}`],H.Ay[`desktop-color-orange-07-${e}`],H.Ay[`desktop-color-green-10-${e}`],H.Ay[`desktop-color-yellow-04-${e}`],H.Ay[`desktop-color-ublue-08-${e}`],H.Ay[`desktop-color-purple-05-${e}`],H.Ay[`desktop-color-orange-09-${e}`],H.Ay[`desktop-color-lime-08-${e}`],H.Ay[`desktop-color-ublue-10-${e}`],H.Ay[`desktop-color-orange-06-${e}`],H.Ay[`desktop-color-aqua-09-${e}`],H.Ay[`desktop-color-yellow-05-${e}`],H.Ay[`desktop-color-orange-05-${e}`],H.Ay[`desktop-color-purple-07-${e}`],H.Ay[`desktop-color-navy-08-${e}`],H.Ay[`desktop-color-purple-08-${e}`],H.Ay[`desktop-color-aqua-08-${e}`],H.Ay[`desktop-color-orange-08-${e}`],H.Ay[`desktop-color-orange-10-${e}`],H.Ay[`desktop-color-green-07-${e}`],H.Ay[`desktop-color-navy-07-${e}`],H.Ay[`desktop-color-aqua-07-${e}`],H.Ay[`desktop-color-navy-10-${e}`],H.Ay[`desktop-color-orange-04-${e}`],H.Ay[`desktop-color-aqua-05-${e}`],H.Ay[`desktop-color-aqua-10-${e}`],H.Ay[`desktop-color-ublue-07-${e}`],H.Ay[`desktop-color-yellow-08-${e}`],H.Ay[`desktop-color-yellow-10-${e}`]])(t),[t]),n=(0,a.useCallback)(t=>{const a={...r};t.forEach(e=>{a[e]=(0,Le.O)(e,t,a,l),Object.keys(a).forEach(t=>{a[t]===a[e]&&t!==e&&delete a[t]})}),e((0,x.Ao)(t)),e((0,x.hl)(a))},[r,e,l]);return(0,a.useMemo)(()=>({setSelectedPortsAndAssignColors:n}),[n])};var Mr=r(396660),vr=r(936621),br=r(754363),Tr=r(803676),Ir=r(206683),Pr=r(544755),Dr=r(5243),kr=r(278473),yr=r(77768);const xr=e=>{if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"==typeof e){const t=parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)?t:null}return null};var wr=r(110966),Rr=r(282556);const Lr=({sfp_voltage:e})=>{const t=(0,b.useSelector)(Rr.zi),r=xr(e),l=(0,wr.L)(r||0,t,3);return a.createElement(yr.c,{value:a.createElement($.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_VOLTAGE":"COMMON_FALLBACK",values:{voltage:l}})})},$r=["UBNT","Ubiquiti","UbiquitiNetworks"],Ur=({sfp_vendor:e})=>{const t=(r=e,$r.includes(r)?"Ubiquiti Inc.":r);var r;return a.createElement(yr.c,{value:t})},Fr=({sfp_temperature:e})=>{const t=(0,b.useSelector)(Rr.zi),r=xr(e),l=(0,wr.L)(r||0,t,3);return a.createElement(yr.c,{value:a.createElement($.sA,{id:r?"DEVICE_PROPERTY_OVERVIEW_TEMPERATURE_VALUE":"COMMON_FALLBACK",values:{temperature:l}})})},Vr=({io_power:e})=>{const t=(0,b.useSelector)(Rr.zi),r=xr(e),l=(0,wr.L)(r||0,t,3);return a.createElement(yr.c,{value:a.createElement($.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_IO_POWER":"COMMON_FALLBACK",values:{power:l}})})},Hr=({sfp_current:e})=>{const t=(0,b.useSelector)(Rr.zi),r=xr(e),l=(0,wr.L)(r||0,t,3);return a.createElement(yr.c,{value:a.createElement($.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_CURRENT":"COMMON_FALLBACK",values:{current:l}})})},zr=['No SFP Inserted"',"Unknown"],Gr=e=>zr.includes(e)?void 0:e,Wr=({sfp_compliance:e})=>a.createElement(yr.c,{value:Gr(e)}),Br=e=>[{id:br.d1.PORT,accessorFn:Mr.Fo,maxSize:e?null:Tr.ve,...e?br.sP[br.d1.PORT]:{size:Tr.ve},header:()=>a.createElement($.sA,{id:br.Cz[br.d1.PORT]}),cell:({row:{original:t}})=>a.createElement(Dr.A,{port:t,isInteractive:!1,showDevice:e}),compare:kr.o$},{id:br.d1.NAME,accessorFn:Mr.Fo,...br.sP[br.d1.NAME],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.NAME]}),cell:({row:{original:e}})=>a.createElement(yr.c,{value:e.name,color:e.color}),compare:(0,Mr.l0)(({name:e})=>e)},kr.QW,{id:br.d1.NATIVE_VLAN,accessorFn:Mr.Fo,...br.sP[br.d1.NATIVE_VLAN],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.NATIVE_VLAN]}),cell:({row:{original:e}})=>a.createElement(Pr.A,{nativeNetworkConfIdSubstituted:e.nativeNetworkConfIdSubstituted}),compare:(0,Mr.l0)(({nativeNetworkConfIdSubstituted:e})=>e===vr.F?-1/0:e)},{id:br.d1.SPEED,accessorFn:Mr.Fo,...br.sP[br.d1.SPEED],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.SPEED]}),cell:({row:{original:e}})=>a.createElement(Ir.A,{speed:e.speed,autoneg:e.autoneg,up:e.up}),compare:(0,Mr.l0)(({speed:e})=>e)},{id:br.d1.VENDOR,accessorFn:Mr.Fo,...br.sP[br.d1.VENDOR],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.VENDOR]}),cell:({row:{original:e}})=>a.createElement(Ur,{sfp_vendor:e.sfp_vendor||void 0}),compare:(0,Mr.l0)(({sfp_vendor:e})=>e)},{id:br.d1.SERIAL,accessorFn:Mr.Fo,...br.sP[br.d1.SERIAL],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.SERIAL]}),cell:({row:{original:e}})=>a.createElement(yr.c,{value:e.sfp_serial||void 0}),compare:(0,Mr.l0)(({sfp_serial:e})=>e)},{id:br.d1.PART_NUMBER,accessorFn:Mr.Fo,...br.sP[br.d1.PART_NUMBER],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.PART_NUMBER]}),cell:({row:{original:e}})=>a.createElement(yr.c,{value:e.sfp_part||void 0}),compare:(0,Mr.l0)(({sfp_part:e})=>e)},{id:br.d1.COMPLIANCE,accessorFn:Mr.Fo,...br.sP[br.d1.COMPLIANCE],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.COMPLIANCE]}),cell:({row:{original:e}})=>a.createElement(Wr,{sfp_compliance:e.sfp_compliance||void 0}),compare:(0,Mr.l0)(({sfp_compliance:e})=>Gr(e||void 0))},{id:br.d1.TEMPERATURE,accessorFn:Mr.Fo,...br.sP[br.d1.TEMPERATURE],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.TEMPERATURE]}),cell:({row:{original:e}})=>a.createElement(Fr,{sfp_temperature:e.sfp_temperature}),compare:(0,Mr.l0)(({sfp_temperature:e})=>e)},{id:br.d1.OUTPUT_POWER,accessorFn:Mr.Fo,...br.sP[br.d1.OUTPUT_POWER],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.OUTPUT_POWER]}),cell:({row:{original:e}})=>a.createElement(Vr,{io_power:e.sfp_txpower}),compare:(0,Mr.l0)(({sfp_txpower:e})=>e)},{id:br.d1.INPUT_POWER,accessorFn:Mr.Fo,...br.sP[br.d1.INPUT_POWER],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.INPUT_POWER]}),cell:({row:{original:e}})=>a.createElement(Vr,{io_power:e.sfp_rxpower}),compare:(0,Mr.l0)(({sfp_rxpower:e})=>e)},{id:br.d1.VOLTAGE,accessorFn:Mr.Fo,...br.sP[br.d1.VOLTAGE],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.VOLTAGE]}),cell:({row:{original:e}})=>a.createElement(Lr,{sfp_voltage:e.sfp_voltage}),compare:(0,Mr.l0)(({sfp_voltage:e})=>e)},{id:br.d1.CURRENT,accessorFn:Mr.Fo,...br.sP[br.d1.CURRENT],header:()=>a.createElement($.sA,{id:br.Cz[br.d1.CURRENT]}),cell:({row:{original:e}})=>a.createElement(Hr,{sfp_current:e.sfp_current}),compare:(0,Mr.l0)(({sfp_current:e})=>e)}];var Kr=r(137625),Yr=r(774482);const jr=(0,l.A)("div")`
  position: absolute;
  top: -${d.xO};
  bottom: -${d.xO};
  left: calc(100% - 400px); /* The restart confirm dialog width */
  right: 0;
`,Xr=(0,l.A)("div")`
  z-index: 1;
`,Zr=(0,a.memo)(({port:e})=>{const{port_idx:t,device:r}=e,{mac:l,name:n}=r,o=(0,b.useDispatch)(),c=(0,b.useSelector)(y.KK),{resetPortStatistics:s}=(0,Yr.X)(),i=c.some(e=>e.deviceProperties?.mac===l),u=(0,Le.cd)(r.switch_caps?.feature_caps,r.deviceState),m=(0,Le.ug)(e),A=(0,Le.CQ)(e),[p,_]=(0,a.useState)(!1),S=(0,b.useSelector)((0,y.JX)(t,l)),[h,g]=(0,a.useState)(S),C=(0,a.useCallback)(()=>{o((0,M.Fx)({mac:l,name:n},t))},[o,l,n,t]),O=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),g(!h),o((0,M.cj)({mac:l,name:r.name},[t],h))},[r.name,o,h,l,t]),f=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),_(!0)},[]),N=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),s(l,t,A)},[l,t,s,A]);return(0,a.useEffect)(()=>{g(S)},[S]),u||m||i?a.createElement(E.A,{padding:d.YC,gap:d.kc,position:"relative",onMouseLeave:p?()=>_(!1):void 0},m?a.createElement(Xr,null,a.createElement(Kr.A,{title:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_TITLE",titleValues:{portId:t},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:_,handleConfirm:C,isOpen:p,rootClose:!0,body:a.createElement(z.A,{size:"inherit"},a.createElement($.sA,{id:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_BODY",values:{portId:t}}))},a.createElement(E.A,{alignItems:"center"},a.createElement(w.A,{variant:"inline",onClick:f,type:"button",size:"medium"},a.createElement($.sA,{id:"DEVICE_ACTIONS_POWER_CYCLE"}))))):null,u?a.createElement(Xr,null,a.createElement(w.A,{variant:"inline",onClick:O,type:"button",size:"medium"},a.createElement($.sA,{id:h?"DEVICE_ACTIONS_LOCATE_STOP":"DEVICE_ACTIONS_LOCATE"}))):null,i?a.createElement(Xr,null,a.createElement(w.A,{variant:"inline",onClick:N,type:"button",size:"medium"},a.createElement($.sA,{id:"COMMON_RESET_STATISTICS"}))):null,p?a.createElement(jr,null):null):null}),qr=e=>({rowId:t})=>a.createElement(Zr,{port:e});var Qr;!function(e){e.CLASSIC="CLASSIC",e.SFP_ANALYZER="SFP_ANALYZER"}(Qr||(Qr={}));var Jr=r(733712),ea=r(720903),ta=r(750103);const ra=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.t),r=(0,b.useSelector)(y.EW),l=(0,a.useCallback)(()=>{e((0,x.Ao)([]));const t=(0,ea.A)(gt.Fs);e((0,x.Ff)(t))},[e]),n=(0,a.useMemo)(()=>(0,ta.Kn)(t),[t]),o=(0,a.useMemo)(()=>(0,V.Ac)(r),[r]),c=(0,a.useMemo)(()=>n&&o,[n,o]);return(0,a.useMemo)(()=>({areFiltersInitial:c,resetPortsFilters:l}),[c,l])},aa=({allPortsCount:e})=>{const{resetPortsFilters:t}=ra(),r=(0,a.useMemo)(()=>e?a.createElement(Jr.A,{title:a.createElement($.sA,{id:"COMMON_NO_MATCH"}),description:a.createElement($.sA,{id:"PORTS_EMPTY_FILTER_NO_PORTS_DETAILS",values:{button:a.createElement(w.A,{type:"button",variant:"inline",onClick:t},a.createElement($.sA,{id:"COMMON_RESET_THEM_BUTTON_TEXT"}))}})}):a.createElement(Jr.A,{title:a.createElement($.sA,{id:"PORTS_TABLE_EMPTY_HEADER"})}),[e,t]);return a.createElement(E.A,{width:"100%",flexDirection:"column"},r)},la=Jt.AH`
  div:has(> * > * > .${nr.k}) {
    overflow: visible;
  }
`,na=(0,l.A)(E.A)`
  height: 100%;
  min-height: 400px;
  width: 100%;
  overflow: hidden;
  flex-direction: column;
  flex-grow: 1;
`,oa=Jt.AH`
  overflow-x: scroll;
`,ca={height:"unset",padding:"0",overflow:"unset"},sa=dr.W2[ir.xz.TABLES][er.l.PORTS].columns,ia=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),t=(0,K.u)(),{formatMessage:r}=(0,$.tz)(),l=(0,b.useSelector)(y.ZN),n=(0,b.useSelector)(y.vR),o=(0,b.useSelector)(y.UH),c=(0,b.useSelector)(y.O2),s=(0,b.useSelector)(y.cW),i=(0,b.useSelector)(y.hb),{initialColumns:u}=(0,sr.A)(er.l.PORTS),m=(0,b.useSelector)(y.TP),E=(0,b.useSelector)(y.X5),A=(0,b.useSelector)(y.zD),p=(0,b.useSelector)(cr.EL),_=(0,b.useSelector)(y.XS),S=(0,b.useSelector)(y.QR),h=(0,b.useSelector)((0,y.IS)([])),{setSelectedPortsAndAssignColors:g}=Nr(),C=(0,b.useSelector)(y.oE),O=C?Qr.SFP_ANALYZER:Qr.CLASSIC,f=(0,b.useSelector)(y.x4),N=(0,b.useSelector)(Lt.D),M=(0,a.useMemo)(()=>{const e=N.find(e=>e.stacking&&e.peers.bottom===f||e.stacking&&e.peers.top===f);return e?.peers.top===f?e?.peers.bottom:e?.peers.top},[N,f]),[v,T]=(0,rr.A)(O===Qr.CLASSIC?er.l.PORTS:er.l.SFP_PORTS),[I,P]=(0,tr.A)(C?er.l.SFP_PORTS:er.l.PORTS),D=(0,a.useMemo)(()=>{if(S)return h.map(e=>({...e,color:E.mode===or.Mz.BY_PORT&&c.has(e.id)?A[e.id]:null,disabled:!1,_rowHoverContent:p?void 0:qr(e)}));const e=new Set(i.selectablePortsSingleSelection||[]);return h.map(t=>{const r=c.has(t.id),a=e.has(t.id),l=t.device.mac===f,n=t.device.mac===M,o=!l&&!n&&Boolean(f);return{...t,disabled:!r&&!a||o||_,_rowHoverContent:p?void 0:qr(t)}})},[S,h,E.mode,c,A,f,p,i.selectablePortsSingleSelection,M,_]),k=(0,a.useCallback)(t=>{S?g(t):e((0,x.Ao)(t))},[S,g,e]),w=(0,a.useCallback)(t=>{t.disabled||(S?g([t.id]):e((0,x.Ao)((0,Le.Um)(t.id))))},[S,g,e]),R=(0,a.useMemo)(()=>{const e=sa.reduce((e,t)=>(e[t]=u.includes(t),e),{});return s||Tr.lj.forEach(t=>{e[t]=!1}),e},[s,u]),L=(0,a.useCallback)(t=>{e((0,x.DE)(t))},[e]),U=(0,a.useMemo)(()=>(0,kr.oE)(t,r,m),[t,r,m]),F=(0,a.useMemo)(()=>Br(m),[m]),V=(0,a.useRef)(null),H=(0,a.useCallback)(({rowsPerPage:e,pageNumber:t})=>a.createElement(Qt.A,{ref:V,columns:O===Qr.CLASSIC?U:F,columnVisibility:O===Qr.CLASSIC?R:void 0,data:u?.length?D:[],initialColumnSize:v,onColumnSizingChange:T,multiSelectMode:!0,onChangeSelection:k,onRowClick:w,enableRowSelection:e=>!e.disabled,selection:o,isSelectAllVisible:S,rowStyle:d.gc,onSort:P,sorting:I,rowDisabledClassName:"",pageIndex:t,pageSize:e,className:`${ar.E} ${la}`,withOverflow:!0,virtualizeColumn:!0,overscanColumn:1}),[O,U,F,R,u?.length,D,v,T,k,w,o,S,P,I]);return Boolean(h.length&&u?.length)?a.createElement(lr.A,{itemCount:h.length,tableType:er.l.SFP_PORTS,onRenderTable:H,onPageChanged:L,rowOptions:Tr.j8,pageNumber:n,wrapperFlexProps:ca,paginationTableContainerClassName:oa}):a.createElement(na,null,a.createElement(Qt.A,{data:[],columns:U,columnVisibility:R,tableHeight:"auto",className:ar.E,multiSelectMode:!0,isSelectAllVisible:!1}),a.createElement(aa,{allPortsCount:l}))});var da=r(801081),ua=r(189601),ma=r(25553),Ea=r(594827),Aa=r(945132),pa=r(460176),_a=r(559639),Sa=r(87485),ha=r(212401),ga=r(656372),Ca=r(511999);const Oa=(0,da.Mz)(y._h,cr.vc,(e,t)=>e.includes(t)),fa=(0,ua.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,da.Mz)(ha.Od,y.Ky,y._h,(e,t,r)=>{const a={data:{attrs:ga.$r,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:r}};return(0,ma.JC)(ha.Pd,e,a)}),e=>e),Na=(0,ua.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,da.Mz)(ha.yN,y.Ky,y._h,(e,t,r)=>{const a={data:{attrs:ga.Tj,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:r}};return(0,ma.JC)(ha.Zk,e,a)}),e=>e),Ma=(0,da.Mz)(fa,Sa.kh),va=(0,da.Mz)(Na,Sa.kh),ba=/(\d+)-(.+)/,Ta=(0,da.Mz)(Ma,va,y.UH,Oa,_a.BG,y.QR,(e,t,r,a,l,n)=>{if(!r||0===r.length||!n)return[];const o=new Set(r),c=a?l.filter(e=>e.port_info?.port_idx).sort((e,t)=>e.id.localeCompare(t.id)):[],s=new Map;a&&t.length>0&&t.forEach((t,r)=>{if(!t)return;const a=e[r]?.oid;if(!a)return;const l={};c.forEach(({id:e,port_info:{port_idx:r}})=>{const n=(0,k.FS)(a,r);if(!o.has(n))return;const c=(0,pa.X)(e);Ca.M6.forEach(e=>{const r=t[`${c}-${e}`];null!=r&&(l[e]=(l[e]||0)+r)})}),s.set(r,l)});const i=new Map,d=new Map;e.forEach((e,t)=>{const r=e.oid,a=e.time;d.has(a)||d.set(a,e.duration);let l=i.get(a);l||(l={timestamp:a,tx_bytes:0,rx_bytes:0,tx_rate:0,rx_rate:0,tx_packets:0,rx_packets:0,tx_broadcast:0,rx_broadcast:0,tx_multicast:0,rx_multicast:0,tx_dropped:0,rx_dropped:0,tx_errors:0,rx_errors:0,poe_power:0,poe_energy:0},i.set(a,l)),Object.keys(e).forEach(t=>{const a=t.match(ba);if(a){const[,n,c]=a,s=(0,k.FS)(r,+n);o.has(s)&&void 0!==l[c]&&(l[c]+=e[t])}});const n=s.get(t);n&&Ca.M6.forEach(e=>{void 0!==n[e]&&(l[e]+=n[e])})});const u=[];return i.forEach((e,t)=>{const r=d.get(t)||0;u.push({...e,tx_rate:(0,mr.tI)(e.tx_bytes,r),rx_rate:(0,mr.tI)(e.rx_bytes,r),poe_energy:e.poe_power*r/Aa.$_})}),u.sort((e,t)=>e.timestamp-t.timestamp),u}),Ia=(0,da.Mz)(Ta,e=>{const t=(e,t)=>e.reduce((e,r)=>(r[t]||0)+e,0);return{tx_bytes:t(e,"tx_bytes"),rx_bytes:t(e,"rx_bytes"),tx_rate:t(e,"tx_rate")/(e.length||1),rx_rate:t(e,"rx_rate")/(e.length||1),tx_packets:t(e,"tx_packets"),rx_packets:t(e,"rx_packets"),tx_broadcast:t(e,"tx_broadcast"),rx_broadcast:t(e,"rx_broadcast"),tx_multicast:t(e,"tx_multicast"),rx_multicast:t(e,"rx_multicast"),poe_power:t(e,"poe_power")/(e.length||1),poe_energy:t(e,"poe_energy"),tx_errors:t(e,"tx_errors"),rx_errors:t(e,"rx_errors"),tx_dropped:t(e,"tx_dropped"),rx_dropped:t(e,"rx_dropped")}}),Pa=(0,da.Mz)(Ma,va,y.UH,y.X5,Oa,_a.nB,y.QR,(e,t,r,a,l,n,o)=>{if(!r||0===r.length||!o)return[];const c=fr(a),s=new Map;e.forEach((e,a)=>{const{duration:o,oid:i}=e,d=e.time,u=t[a];let m=s.get(d);m||(m={timestamp:d,duration:o,portsData:{}},s.set(d,m));for(let t=0;t<r.length;t+=1){const a=r[t],{deviceMac:s,portIdx:d}=(0,k.q9)(a);if(s===i){const t=n[d];if(l&&u&&t){const e=(0,Ea.si)(t.id);m.portsData[a]=c(u,e<2?"":e.toString(),o)}else m.portsData[a]=c(e,d,o)}}});const i=[];return s.forEach(({timestamp:e,duration:t,portsData:r})=>{i.push({timestamp:e,duration:t,...r})}),i.sort((e,t)=>e.timestamp-t.timestamp),i}),Da=(0,da.Mz)(Pa,y.X5,(e,t)=>{const r=Or(t),a=Object.keys(e[0]||{}).filter(e=>"timestamp"!==e&&"duration"!==e);let l=e.reduce((e,r)=>{const l=a.reduce((e,a)=>{let l=r[a];return t.source===or.I0.POE&&(l=l*r.duration/Aa.$_),e+l},0);return e+l},0);return t.source===or.I0.USAGE&&t.usage===or.AM.BPS&&(l/=e.length||1),t.source===or.I0.POE?{total:new Cr(l)}:{total:r(l)}});var ka=r(543678),ya=r(53509);const xa=(0,l.A)(Ke.A)`
  white-space: nowrap;
`,wa=({summary:e})=>{const t=(0,K.u)();return a.createElement(E.A,{gap:d.kc,alignItems:"center",justifyContent:"end"},e.rx?a.createElement(xa,{size:"body",style:{color:(0,ye.gB)(t)}},a.createElement(ya.A,null),e.rx.toString()):null,e.tx?a.createElement(xa,{size:"body",style:{color:(0,ye.mN)(t)}},a.createElement(ka.A,null),e.tx.toString()):null,e.total?a.createElement(xa,{size:"body",color:"primary"},e.total.toString()):null)};var Ra=r(979106);const La=[{id:or.AM.BPS,label:a.createElement($.sA,{id:"COMMON_BPS"})},{id:or.AM.BYTES,label:a.createElement($.sA,{id:"COMMON_BYTES"})}],$a=()=>{const e=(0,b.useDispatch)(),{usage:t}=(0,b.useSelector)(y.X5);return a.createElement(Ra.A,{className:Wa,tabs:La,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,x.H4)({usage:t}))})(t),variant:"filter"})},Ua=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.cW),{source:r}=(0,b.useSelector)(y.X5);((e,t)=>{const r=(0,b.useDispatch)();(0,a.useEffect)(()=>{e||t!==or.I0.POE||r((0,x.H4)({source:Ca.ON}))},[e,r])})(t,r);const l=(0,a.useMemo)(()=>[{id:or.I0.PACKETS,label:a.createElement($.sA,{id:"COMMON_PACKETS"})},{id:or.I0.USAGE,label:a.createElement($.sA,{id:"COMMON_USAGE"})},{id:or.I0.POE,label:a.createElement($.sA,{id:"COMMON_DEVICE_POE_MODE_POE"}),disabled:!t},{id:or.I0.ERRORS,label:a.createElement($.sA,{id:"COMMON_ERRORS"})},{id:or.I0.DROPPED,label:a.createElement($.sA,{id:"COMMON_DROPPED"})}],[t]);return a.createElement(Ra.A,{className:Wa,tabs:l,selectedTab:r,onSelectTab:({id:t})=>(t=>{e((0,x.H4)({source:t}))})(t),variant:"filter"})},Fa=[{id:or.uO.ALL,label:a.createElement($.sA,{id:"COMMON_ALL"})},{id:or.uO.BROADCAST,label:a.createElement($.sA,{id:"COMMON_STATUS_BROADCAST"})},{id:or.uO.MULTICAST,label:a.createElement($.sA,{id:"COMMON_STATUS_MULTICAST"})}],Va=()=>{const e=(0,b.useDispatch)(),{packets:t}=(0,b.useSelector)(y.X5);return a.createElement(Ra.A,{className:Wa,tabs:Fa,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,x.H4)({packets:t}))})(t),variant:"filter"})},Ha=[{id:or.Mz.AVERAGE,label:a.createElement($.sA,{id:"COMMON_TOTAL"})},{id:or.Mz.BY_PORT,label:a.createElement($.sA,{id:"PORTS_BY_PORT"})}],za=()=>{const e=(0,b.useDispatch)(),{mode:t}=(0,b.useSelector)(y.X5);return a.createElement(Ra.A,{className:Wa,tabs:Ha,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,x.H4)({mode:t}))})(t),variant:"filter"})},Ga=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.X5),{direction:r,source:l}=t,n=(0,a.useMemo)(()=>{const e=l===or.I0.ERRORS||l===or.I0.DROPPED;return[{id:or.O_.ALL,label:a.createElement($.sA,{id:"COMMON_ALL"})},{id:or.O_.DOWNLINK,label:a.createElement($.sA,{id:e?"COMMON_RECEIVE":"COMMON_DOWNLOAD"})},{id:or.O_.UPLINK,label:a.createElement($.sA,{id:e?"COMMON_TRANSMIT":"COMMON_UPLOAD"})}]},[l]);return a.createElement(Ra.A,{className:Wa,tabs:n,selectedTab:r,onSelectTab:({id:t})=>(t=>{e((0,x.H4)({direction:t}))})(t),variant:"filter"})},Wa=Jt.AH`
  flex: unset;
  width: auto;
  flex-shrink: 0;
`,Ba=({summary:e})=>{const{source:t}=(0,b.useSelector)(y.X5);return a.createElement(E.A,{gap:d.kc,overflow:"auto"},a.createElement(za,null),a.createElement(Ua,null),t===or.I0.PACKETS&&a.createElement(Va,null),t===or.I0.USAGE&&a.createElement($a,null),t!==or.I0.POE&&a.createElement(Ga,null),a.createElement(E.A,{flexGrow:1}),a.createElement(wa,{summary:e}))};var Ka=r(936344),Ya=r(853699),ja=r(195462),Xa=r(198494),Za=r(66706),qa=r(112142),Qa=r(438369),Ja=r(670);const el={Bytes:(0,l.A)(z.A)`
    color: ${({theme:{motifPalette:{aqua06:e}}})=>e};
  `,Icon:void 0},tl=(0,l.A)(E.A)`
  flex-direction: column;
  padding-bottom: ${d.kc};
  border-bottom: 1px solid ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-10-${e}`]};
`,rl=(0,l.A)(E.A)`
  g {
    transition: unset;
  }
`,al=(0,l.A)("div")`
  width: ${d.kc};
  height: ${d.kc};
  background: ${({color:e})=>e};
`,ll=(0,l.A)(E.A,{shouldForwardProp:e=>"columnCount"!==e})`
  display: grid;
  grid-template-columns: repeat(${({columnCount:e})=>e}, 1fr);
  column-gap: ${d.S2};
  width: 100%;
`,nl=({portIdx:e,value:t,graphDataSeries:r,color:l})=>{const n=r.getFormattedValue(t);return a.createElement(E.A,{justifyContent:"space-between",alignItems:"baseline",width:"100%",gap:d.YC},a.createElement(E.A,{gap:d.YC,alignItems:"center"},a.createElement(al,{color:l}),a.createElement(Ke.A,{size:"caption",color:"secondary"},a.createElement($.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e}}))),a.createElement(Ke.A,{size:"caption"},n.toString()))},ol=({value:e,direction:t,source:r,graphDataSeries:l})=>{const n=(0,a.useMemo)(()=>((e,t)=>e===or.I0.POE?el:t===or.O_.UPLINK?Qa.A:Ja.A)(r,t),[t,r]),o=(0,a.useMemo)(()=>((e,t)=>e===or.I0.POE?"COMMON_POWER":e===or.I0.ERRORS||e===or.I0.DROPPED?t===or.O_.UPLINK?"COMMON_TRANSMIT":"COMMON_RECEIVE":t===or.O_.UPLINK?"COMMON_UPLOAD":"COMMON_DOWNLOAD")(r,t),[t,r]),c=l.getFormattedValue(e);return a.createElement(E.A,{justifyContent:"space-between",width:"100%"},a.createElement(Ke.A,{size:"caption",color:"secondary"},a.createElement($.sA,{id:o})),a.createElement(E.A,null,n.Icon&&a.createElement(n.Icon,null),a.createElement(n.Bytes,{size:"small"},c.toString())))},cl=({hidden:e,top:t,left:r,x:l,chartWidth:n,chartHeight:o,selfHourCycle:c,tooltipPropsCollection:s,showDateWithTime:i,language:u,graphDataSeries:m,settings:A,gradientColor:p,graphDataCollection:_,seriesIndex:S,duration:h})=>{const{mode:g}=A,{themeName:C}=(0,K.u)(),O=(0,b.useSelector)(y.zD),f=(0,a.useMemo)(()=>(e=>{switch(e){case or.I0.POE:return a.createElement($.sA,{id:"COMMON_POWER"});case or.I0.PACKETS:return a.createElement($.sA,{id:"COMMON_PACKETS"});case or.I0.USAGE:return a.createElement($.sA,{id:"COMMON_USAGE"});case or.I0.ERRORS:return a.createElement($.sA,{id:"COMMON_ERRORS"});case or.I0.DROPPED:return a.createElement($.sA,{id:"COMMON_DROPPED"});default:return null}})(A.source),[A.source]),N=(0,a.useMemo)(()=>Object.values(_).find(e=>e.timestamp===l),[_,l]),M=(0,a.useMemo)(()=>{const e=r<Math.round(n/2);return{left:Math.round(r+(e?8:-8)),top:Math.round(t),position:e?"rightTop":"leftTop"}},[r,t,n]),v=(0,a.useMemo)(()=>((e,t,r,a,l)=>{const n=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",...r&&{hour:"numeric",minute:"numeric",hourCycle:a}}).format(e);return l?`${n} - ${new Intl.DateTimeFormat(t,r?{hour:"numeric",minute:"numeric",hourCycle:a}:{day:"numeric",month:"short",year:"numeric"}).format(l)}`:n})(l,u,i,c,l+Number(h||0)),[l,u,i,c,h]),T=(0,a.useMemo)(()=>N?g===or.Mz.BY_PORT?((e,t,r,l)=>a.createElement(ll,{columnCount:Math.ceil(Object.values(e.data).length/l)},Object.values(e.data).sort((e,t)=>(0,k.q9)(e.key).portIdx-(0,k.q9)(t.key).portIdx).map(l=>{const n=t[l.key],o=r[l.key],{portIdx:c}=(0,k.q9)(l.key);return a.createElement(nl,{key:l.key,value:n,color:o,graphDataSeries:e,portIdx:c})})))(m,N,O,18):((e,t,r)=>{const l=e.data.series1,n=e.data.series2,o=l&&t[l.key],c=n&&t[n.key];return a.createElement(E.A,{flexDirection:"column",gap:d.YC},l&&a.createElement(ol,{direction:or.O_.UPLINK,graphDataSeries:e,value:o,source:r}),n&&a.createElement(ol,{direction:or.O_.DOWNLINK,graphDataSeries:e,value:c,source:r}))})(m,N,A.source):null,[N,m,g,A.source,O]),I=(0,a.useMemo)(()=>a.createElement(rl,{position:"absolute",top:0,left:0},a.createElement("svg",{width:n,height:o},r&&t&&a.createElement(Za.A,{hasAnimation:!1,x:r,y:Math.round(t),color:p,innerRadius:4,outterRadius:8}))),[o,n,p,r,t]),P=(0,a.useMemo)(()=>{const e=Math.min(t,s.min);return{top:e,height:Math.max(t,s.max)-e,left:r-1}},[t,s,r]);return 0===S?a.createElement(a.Fragment,null,a.createElement(qa.A,{hidden:e,left:M.left,top:M.top,topMargin:4,width:"auto",tooltipProps:{maxWidth:"auto",position:M.position},description:a.createElement(E.A,{flexDirection:"column",gap:d.kc,whiteSpace:"nowrap"},a.createElement(tl,null,a.createElement(Ke.A,{color:"primary",weight:"bold",size:"body"},f),a.createElement(Ke.A,{color:"tertiary",size:"caption"},v)),a.createElement(E.A,{flexDirection:"column"},T))}),a.createElement(E.A,{zIndex:1,width:1,borderLeft:`2px dashed ${H.Ay[`desktop-color-neutral-04-${C}`]}`,top:P.top,height:P.height,left:P.left,position:"absolute"}),I):I};var sl=r(964238);const il=({graphDataCollection:e,graphDataKey:t,getCoordinates:r,mouseData:l,maxY:n,tooltipContainer:o,seriesIndex:c,renderTooltip:s})=>{const i=(0,K.u)(),{mode:d}=(0,b.useSelector)(y.X5),u=(0,b.useSelector)(y.zD),m=(e=>`${e}GradientId`)(t),E=d===or.Mz.AVERAGE?((e,t)=>e.includes("rx")||e.includes("poe_power")?(0,ye.gB)(t):(0,ye.mN)(t))(t,i):u[t]||(0,ye.mN)(i),A=(0,a.useMemo)(()=>e.map(({timestamp:e,...r})=>({x:e,y:r[t]})),[e,t]),p=(0,a.useCallback)(()=>a.createElement("defs",null,a.createElement("linearGradient",{id:m,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},a.createElement("stop",{offset:"0%",stopColor:E,stopOpacity:.5}),a.createElement("stop",{offset:"100%",stopColor:E,stopOpacity:.1}))),[m,E]),_=(0,a.useCallback)(e=>s?s(e,E,c):void 0,[s,E,c]);return a.createElement(sl.A,{data:A,maxY:n,mouseData:l,getCoordinates:r,lineColor:E,variant:d===or.Mz.AVERAGE?"gradientArea":"line",interpolation:"linear",allowCustomDots:!0,tooltipPortal:o?o.current:void 0,customGradientId:m,renderCustomGradient:p,renderTooltip:_})},dl=(0,l.A)(E.A,{shouldForwardProp:e=>"chartWidth"!==e&&"preset"!==e})`
  #x-labels > g:last-child {
    ${({preset:e,chartWidth:t})=>!e&&`transform: translateX(${t-45}px) !important;`}
  }
`,ul=({graphDataCollection:e=[],graphDataSeries:t,graphContainerHeight:r})=>{const{formatMessage:l}=(0,$.tz)(),{width:n}=(0,Y.A)(),o=(0,a.useRef)(null),c=(0,a.useRef)({min:0,max:0,left:0}),{ref:s,width:i=0}=(0,st.A)(),{startDate:d,endDate:u,preset:m}=(0,b.useSelector)(y.Ky),A=(0,b.useSelector)(Xa.jc),p=(0,b.useSelector)(Xa.BQ),_=(0,b.useSelector)(cr.hq),S=(0,b.useSelector)(Rr.zi),h=(0,b.useSelector)(y.X5),g=(0,b.useSelector)(y.UH),C=(0,a.useMemo)(()=>(0,Ya.$V)(d,u,!0,!0),[u,d]),O=(0,a.useMemo)(()=>(0,ga.Io)(d,u),[u,d]),f=(0,Ya.Vi)(O,l),N=(0,a.useMemo)(()=>Math.floor(Math.abs(new Date(u).getTime()-new Date(d).getTime())/Aa.jU),[d,u]),M=r<400,v=(0,a.useMemo)(()=>{let r=1;const a=Object.values(t.data).map(e=>e.key);return e.forEach(e=>{Object.keys(e).forEach(t=>{"timestamp"!==t&&"number"==typeof e[t]&&a.includes(t)&&(r=Math.max(r,e[t]))})}),t.getFormattedValue(r)},[e,t]),T=(0,a.useMemo)(()=>!(h.source===or.I0.USAGE&&h.usage===or.AM.BPS)&&h.source!==or.I0.POE&&h.source!==or.I0.ERRORS&&h.source!==or.I0.DROPPED,[h.usage,h.source]),I=(0,a.useCallback)(({hidden:l,left:n=0,top:o=0,x:s=0,y:d},u,m)=>(c.current={min:c.current.left===n?Math.min(o,c.current.min):o,max:c.current.left===n?Math.max(o,c.current.max):o,left:n},a.createElement(cl,{hidden:l,left:n,top:o,tooltipPropsCollection:c.current,x:s,y:d,duration:C.grain,chartHeight:r,chartWidth:i,selfHourCycle:p,settings:h,showDateWithTime:N<=7,language:S,graphDataSeries:t,gradientColor:u,graphDataCollection:e,seriesIndex:m})),[C.grain,r,i,p,h,N,S,t,e]),P=(0,a.useMemo)(()=>((e,t)=>{const r=Math.ceil((t-e)/36e5),a=r/24;return(r=>(0,ja.v)([e,t],Sr[r].frequency(n,N)).map((e,t)=>({label:Sr[r].label({index:t,value:e,selfHourCycle:p,selfUse24HourTime:A,documentWidth:n,siteTimezone:_,language:S,formatMessage:l}),value:e})))(null===m||m===Ar.l.ONE_DAY&&r<13||m===Ar.l.ONE_WEEK&&a<5||m===Ar.l.ONE_MONTH&&a<10?Ar.j:m)})(e[0]?.timestamp||d.getTime(),e.length>1&&e[e.length-1]?.timestamp||u.getTime()),[e,p,A,d,u,m,_,S,n,N,l]),D=(0,a.useMemo)(()=>{return e=v.bytes,(0,ja.Y)(Math.ceil(e+1/(M?5:10)*e),M?6:11);var e},[v.bytes,M]),k=(0,a.useCallback)(({value:e},r)=>{if(r!==(M?5:10)){return`${t.getFormattedValue(+e,v.power).value.toFixed(1)}`}},[v.power,t,M]),x=(0,a.useCallback)((r,l,n)=>a.createElement(a.Fragment,null,Object.keys(t.data).map((c,s)=>{const{key:i,label:d}=t.data[c];return a.createElement(il,{key:i,graphDataCollection:e,graphDataKey:i,graphDataLabel:d,getCoordinates:r,mouseData:l,maxY:n,tooltipContainer:o,renderTooltip:I,seriesIndex:s})})),[t.data,e,I]);return a.createElement(dl,{width:"100%",position:"relative",preset:m,chartWidth:i},a.createElement(E.A,{width:"100%",position:"relative",ref:s},a.createElement(Ka.A,{xAxis:P,yAxis:D,width:i,yAxisTitle:T?`${v.unit} / ${f}`:v.unit,height:r,renderYLabel:k},g.length?x:void 0)),a.createElement("div",{ref:o}))},ml=({settings:e})=>{const t=(0,b.useSelector)(y.UH),r=(0,b.useSelector)(Pa),l=(0,b.useSelector)(Da),n=((e,t)=>{const r={getFormattedValue:Or(t),data:{}};return e.forEach(e=>{r.data[e]={key:e,label:`COMMON_PORT ${e}`}}),r})(t,e);return a.createElement(a.Fragment,null,a.createElement(Ba,{summary:l}),a.createElement(ul,{graphDataCollection:r,graphDataSeries:n,graphContainerHeight:Ca.F$}))},El=({settings:e})=>{const t=(0,b.useSelector)(Ia),r=(0,b.useSelector)(Ta),l=((e,t)=>{const{DOWNLINK:r,UPLINK:a,ALL:l}=or.O_,n=Or(t),o={getFormattedValue:n,data:{}},{rx_broadcast:c,rx_bytes:s,rx_multicast:i,rx_packets:d,rx_rate:u,tx_broadcast:m,tx_bytes:E,tx_multicast:A,tx_packets:p,tx_rate:_,tx_errors:S,rx_errors:h,tx_dropped:g,rx_dropped:C,poe_energy:O}=e;return t.source===or.I0.ERRORS&&(o.summary={tx:n(S),rx:n(h),total:n(S+h)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_errors",label:"COMMON_ERRORS"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_errors",label:"COMMON_ERRORS"})),t.source===or.I0.DROPPED&&(o.summary={tx:n(g),rx:n(C),total:n(g+C)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_dropped",label:"COMMON_DROPPED"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_dropped",label:"COMMON_DROPPED"})),t.source===or.I0.USAGE&&(t.usage===or.AM.BPS&&(o.summary={tx:n(_),rx:n(u),total:n((_+u)/2)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_rate",label:"COMMON_RATE"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_rate",label:"COMMON_RATE"})),t.usage===or.AM.BYTES&&(o.summary={tx:n(E),rx:n(s),total:n(E+s)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_bytes",label:"COMMON_USAGE"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_bytes",label:"COMMON_USAGE"}))),t.source===or.I0.PACKETS&&(t.packets===or.uO.ALL&&(o.summary={tx:n(p),rx:n(d),total:n(p+d)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_packets",label:"COMMON_PACKETS"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_packets",label:"COMMON_PACKETS"})),t.packets===or.uO.BROADCAST&&(o.summary={tx:n(m),rx:n(c),total:n(m+c)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_broadcast",label:"COMMON_PACKETS"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_broadcast",label:"COMMON_PACKETS"})),t.packets===or.uO.MULTICAST&&(o.summary={tx:n(A),rx:n(i),total:n(A+i)},[a,l].includes(t.direction)&&(o.data.series1={key:"tx_multicast",label:"COMMON_PACKETS"}),[r,l].includes(t.direction)&&(o.data.series2={key:"rx_multicast",label:"COMMON_PACKETS"}))),t.source===or.I0.POE&&(o.summary={total:new Cr(O)},o.data.series1={key:"poe_power",label:"COMMON_POE_USAGE"}),o})(t,e);return a.createElement(a.Fragment,null,a.createElement(Ba,{summary:l.summary}),a.createElement(ul,{graphDataCollection:r,graphDataSeries:l,graphContainerHeight:Ca.F$}))},Al=(0,l.A)(E.A)`
  flex-direction: column;
  width: 100%;
  border-radius: ${d.YC};
`,pl=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y._h),r=(0,b.useSelector)(y.Ky),l=(0,b.useSelector)(y.X5),n=(0,b.useSelector)(Oa),[o,c]=(0,a.useState)([]),[s,i]=(0,a.useState)(null),[d,u]=(0,a.useState)(null),{startDate:m,endDate:E}=r,A=(0,a.useMemo)(()=>!!t.length&&!((0,I.L)(o,t)&&m===s&&E===d),[o,t,m,s,E,d]);return(0,a.useEffect)(()=>{A&&(c(t),i(m),u(E),e((0,x.qV)({deviceMacs:t,dateRange:{startDate:m,endDate:E,preset:r.preset},isGatewaySelected:n})))},[A,e,m,E,t,n,r.preset]),a.createElement(Al,null,l.mode===or.Mz.AVERAGE?a.createElement(El,{settings:l}):a.createElement(ml,{settings:l}))}),_l=(0,a.memo)(()=>{const e=(0,a.useRef)(1),t=(0,b.useSelector)(y.w2),r=(0,b.useSelector)(y.tI),l=(0,b.useSelector)(y.OA),n=(0,b.useSelector)(y.Mi),o=(0,b.useSelector)(y.QR),c=(0,b.useSelector)(y.$X),s=(0,b.useSelector)(y.kq);(()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.QR),r=(0,b.useSelector)(y.Bt)||(0,P.A)(),l=(0,b.useSelector)(y.Fk),n=(0,b.useSelector)(y.UH),o=(0,D.A)(n);(0,a.useEffect)(()=>{if(!(0,I.L)(n,o)&&!t){const t=n.filter(e=>!o?.includes(e))||[],a=o?.filter(e=>!n.includes(e))||[],c=new Set,s=new Set;t.forEach(e=>{const{aggregationGroup:t,device:a}=r.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(l){const t=r.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==a.mac);t&&c.add({...t.aggregationGroup,deviceMac:t.device.mac})}c.add({...t,deviceMac:a.mac})}}),a.forEach(e=>{const{aggregationGroup:t,device:a}=r.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(l){const t=r.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==a.mac);t&&s.add({...t.aggregationGroup,deviceMac:t.device.mac})}s.add({...t,deviceMac:a.mac})}});const i=Array.from(c).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,k.FS)(t.deviceMac,e))],[]),d=Array.from(s).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,k.FS)(t.deviceMac,e))],[]);let u=[...n].filter(e=>!d.includes(e));u=new Array(...new Set([...u,...i])),(0,I.L)(u,n)||e((0,x.Ao)(u))}},[n,o,e,t,l,r])})(),(0,T.A)(r),ht(),Ct(),((e,t)=>{const r=(0,b.useDispatch)();(0,a.useEffect)(()=>{if(e.length>0&&t&&t!==gt.Zt&&!e.find(e=>e.value===t)){const{deviceMacs:a}=(0,V.Se)(t),l=e.find(e=>a.some(t=>e.includeDevices?.includes(t)));l?(r((0,x.U)(l.value)),r((0,x.gU)(!0))):r((0,x.U)(gt.Zt))}},[e,t,r])})(n,l),(()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(it.WS),r=(0,b.useSelector)(it.it),l=(0,b.useSelector)(y.QR);(0,a.useEffect)(()=>{t&&r!==te.H.PORTS&&!l&&e((0,x.Ao)([]))},[e,t,r,l])})();const i=r&&s;return a.createElement(a.Fragment,null,i?a.createElement(E.A,{flexDirection:"column"},c?a.createElement(E.A,{minHeight:d.fS}):a.createElement(ue,null),a.createElement(E.A,{flexDirection:"column",gap:d.kc},t.map(r=>a.createElement(_t,{key:r,deviceMac:r,cachedScaleRef:e,showDeviceName:t.length>1})),a.createElement(E.A,{justifyContent:"center"},a.createElement(Pt.A,{isSingleLine:!0,deviceMac:r})))):null,o?a.createElement(pl,null):null,c?a.createElement(qt,null):null,c?null:a.createElement(ia,null))});var Sl=r(231755),hl=r(736388),gl=r(264863),Cl=r(436017),Ol=r(191568);const fl=()=>{const{handleVlansChange:e}=(0,Ol.x)(),t=(0,b.useSelector)(y.$X),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Cl.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement($.sA,{id:"PORTS_VLANS_DIAGRAM"}))},Nl=()=>{const{handleStatsChange:e}=(0,Ol.x)(),t=(0,b.useSelector)(y.QR),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Cl.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement(E.A,{gap:d.YC,alignItems:"center"},a.createElement($.sA,{id:"COMMON_STATS"})))},Ml=()=>{const{handleDeviceDiagramChange:e}=(0,Ol.x)(),t=(0,b.useSelector)(y.kq),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Cl.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement($.sA,{id:"PORTS_PORT_DIAGRAM"}))};var vl=r(829092),bl=r(861878),Tl=r(17441),Il=r(9535),Pl=r(445054),Dl=r(580176),kl=r(318195),yl=r(629318);const xl=(0,r(51946).w)(e=>(0,a.createElement)("svg",(0,yl.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,a.createElement)("path",{d:"M13 8.25a.501.501 0 0 0-.332.126L10 10.75l-.02-.02-2.648-2.353a.5.5 0 1 0-.665.747l2.638 2.346a1.001 1.001 0 0 0 1.39 0l2.637-2.345A.5.5 0 0 0 13 8.25Z",fill:"currentColor",className:e.baseclassname}),(0,a.createElement)("path",{d:"M13 8a.743.743 0 0 0-.498.19L10 10.414 7.498 8.19a.75.75 0 0 0-.997 1.121l2.634 2.342c.234.224.54.347.865.347.325 0 .631-.123.865-.347l2.633-2.343A.75.75 0 0 0 13 8Z",fill:"currentColor",className:e.fillclassname}))),wl=Jt.AH`
  display: none;
`,Rl=a.createElement(E.A,{alignItems:"center"},a.createElement(Ee.A,{size:"medium",color:"inherit"},a.createElement($.sA,{id:"COMMON_RESET_STATISTICS"})),a.createElement(xl,null)),Ll=()=>{const{formatMessage:e}=(0,$.tz)(),t=(0,b.useSelector)(y.aq),{mac:r,port_table:l}=t||{},[n,o]=(0,a.useState)([]),{resetPortStatistics:c}=(0,Yr.X)(),s=(0,a.useCallback)(e=>{const t=e.map(e=>c(r,Number(e),(0,Le.CQ)(l?.find(t=>t.port_idx===Number(e)))));Promise.all(t),o([])},[r,l,c]),i=(0,a.useMemo)(()=>l.map(e=>({label:e.name,value:e.port_idx,id:e.port_idx})),[l]),d=(0,a.useCallback)(e=>{e&&o(i.map(({value:e})=>e))},[i]),u=(0,a.useCallback)((e,t)=>{o(e?[...n,t]:n.filter(e=>e!==t))},[n]),m=(0,a.useCallback)(e=>{o(e?i.map(({value:e})=>e):[])},[i]);return a.createElement(kl.A.Popover,{options:i,onSave:s,value:n,onOpenChange:d,searchPlaceholder:e({id:"COMMON_SEARCH"}),saveButtonText:e({id:"COMMON_ACTION_RESET"}),cancelButtonText:e({id:"COMMON_ACTION_CANCEL"}),onOptionCheck:u,onChangeSelectAll:m,saveButtonProps:{disabled:0===n.length},renderToggle:()=>a.createElement(kl.A.Trigger,{options:i,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:Rl,chipContainerClassName:wl})})},$l=({options:e})=>{const[t,r]=(0,a.useState)([]),l=(0,b.useSelector)(he.ID),n=(0,a.useRef)(l),{resetSwitchStatistics:o}=(0,Yr.X)(),c=(0,a.useCallback)(t=>{const a=[];t.forEach(t=>{const r=e.find(e=>e.value===t);if(!r)return;const{includeDevices:l}=r;l.forEach(e=>{const t=n.current?.find(t=>t.mac===e);if(!t)return;const{name:r}=t;a.push(o(`${e}`,r,t.port_table||[]))})}),Promise.all(a),r([])},[e,o]),{formatMessage:s}=(0,$.tz)(),i=(0,a.useCallback)(t=>{t&&r(e.map(e=>e.value))},[e]),d=(0,a.useCallback)((e,a)=>{r(e?[...t,a]:t.filter(e=>e!==a))},[t]),u=(0,a.useCallback)(t=>{r(t?e.map(({value:e})=>e):[])},[e]);return a.createElement(kl.A.Popover,{options:e,onSave:c,onOpenChange:i,value:t,onOptionCheck:d,onChangeSelectAll:u,searchPlaceholder:s({id:"COMMON_SEARCH"}),saveButtonText:s({id:"COMMON_ACTION_RESET"}),cancelButtonText:s({id:"COMMON_ACTION_CANCEL"}),saveButtonProps:{disabled:0===t.length},renderToggle:()=>a.createElement(kl.A.Trigger,{options:e,value:t,onChange:c,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:Rl,chipContainerClassName:wl})})},Ul=()=>{const e=(0,b.useSelector)(y.tI),t=(0,b.useSelector)(y.KK);return e&&0!==t.length?t.some(({includeDevices:t})=>t.includes(e))?a.createElement(Ll,null):a.createElement($l,{options:t}):null},Fl=()=>{const e=(0,b.useDispatch)(),{formatList:t}=(0,$.tz)(),r=(0,b.useSelector)((0,y.IS)([])),l=(0,a.useMemo)(()=>{const e={};return r.forEach(t=>{const{mac:r}=t.device;e[r]||(e[r]=!0)}),Object.keys(e)},[r]),n=(0,b.useSelector)((0,he.nH)(l)).map(({mac:e,name:t,locating_ports:a})=>({mac:e,name:t,locatingPorts:a?.filter(t=>r.find(r=>r.device.mac===e&&r.port_idx===t))||[]})).filter(({locatingPorts:e})=>e.length>0),o=(0,a.useCallback)(()=>{const r=n.map(({mac:r,locatingPorts:a,name:l})=>e((0,M.cj)({mac:r,name:l},a,!0,t(a))));Promise.all(r)},[e,t,n]);return 0===n.length?null:a.createElement(w.A,{type:"button",size:"medium",variant:"inline",onClick:o},a.createElement($.sA,{id:"DEVICE_ACTIONS_LOCATE_STOP"}))},Vl=()=>a.createElement(E.A,{width:"100%",alignItems:"center",gap:d.kc},a.createElement(Ul,null),a.createElement(Fl,null));var Hl;!function(e){e.PORTS="ports"}(Hl||(Hl={}));const zl=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{areFiltersInitial:t,resetPortsFilters:r}=ra(),l=(0,b.useSelector)(y.oE),n=(0,Pl.A)({leftFilterPageId:c.g1.PORT_MANAGEMENT,leftFilterColumnsId:Hl.PORTS}),o=(0,a.useCallback)(()=>{e((0,Dl.GD)({leftFilterPageId:c.g1.PORT_MANAGEMENT,leftFilterColumnsId:Hl.PORTS}))},[e]);return a.createElement(Tl.A,null,a.createElement(Vl,null),a.createElement(Il.A,{onClear:r,disabled:t}),l?null:a.createElement(bl.A,{onPress:o,labelId:"COMMON_CUSTOMIZE_COLUMNS",disabled:n}))});var Gl=r(149188),Wl=r(664967),Bl=r(857828);const Kl=[Wl.E[Ar.l.ONE_DAY],Wl.E[Ar.l.ONE_WEEK],Wl.E[Ar.l.ONE_MONTH]],Yl=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.Ky),r=(0,a.useCallback)(t=>{e((0,x.m$)(t))},[e]),[l,n]=(0,a.useState)({startDate:t.startDate,endDate:t.endDate}),o=(0,a.useCallback)(({id:e})=>{const t=Kl.find(t=>t.id===e);t?r({...t.getRange(new Date),preset:e}):l&&r({...l,preset:Ar.j})},[l,r]),c=(0,a.useMemo)(()=>Kl.map(({id:e,message:t,messageValues:r})=>({id:e,label:a.createElement($.sA,{id:t,values:r})})).concat({id:Ar.j,label:a.createElement(Gl.A,null)}),[]),s=(0,a.useCallback)(e=>{n(e),r({...e,preset:Ar.j})},[r]);return a.createElement(Bl.A,{presets:c,selectedPreset:t.preset,range:l,onSelectTab:o,onSelectCustomRange:s,showCalendar:t.preset===Ar.j})};var jl=r(312583);const Xl=(0,a.memo)(()=>a.createElement(jl.A,{leftFilterPageId:c.g1.PORT_MANAGEMENT,columns:Object.values(Tr.YH),columnLabels:Tr.Cz,tableType:er.l.PORTS}));var Zl,ql=r(156870),Ql=r(773033),Jl=r(727678);!function(e){e.COUNT="count",e.NAME="name",e.ID="id",e.VLAN_ID="vlan_id"}(Zl||(Zl={}));const en="__NONE__",tn=(0,ua.WY)()((0,da.Mz)(y.xP,(0,y.IS)([F.s9.PORTS_MEDIA]),(0,y.IS)([F.s9.PORTS_POE]),(0,y.IS)([F.s9.PORTS_NATIVE_VLAN]),(0,y.IS)([F.s9.PORTS_STATUS]),Nt.Ct,(e,t,r,a,l,n)=>{const o={},c={},s={},i={},d=e.length;for(let t=0;t<d;t+=1){const r=e[t],a=r.filterMedia;a.length&&a.forEach(e=>{o[e]||(o[e]={[Zl.ID]:e,[Zl.NAME]:e,[Zl.COUNT]:0})});const l=r.filterPoe;c[l]||(c[l]={[Zl.ID]:l,[Zl.NAME]:l,[Zl.COUNT]:0});const d=r?.nativeNetworkConfIdSubstituted;if(void 0!==d){const e=""===d,t=e?en:d;if(!s[t]){const r=d?n.find(({_id:e})=>e===d):void 0;s[t]={[Zl.ID]:t,[Zl.NAME]:e?en:r?.name,[Zl.COUNT]:0,[Zl.VLAN_ID]:r?.vlan??1}}}const u=r.filterStatus;u.length&&u.forEach(e=>{i[e]||(i[e]={[Zl.ID]:e,[Zl.NAME]:e,[Zl.COUNT]:0})})}const u=t.length;for(let e=0;e<u;e+=1){const r=t[e].filterMedia;r.length&&r.forEach(e=>{o[e]&&(o[e]={...o[e],[Zl.COUNT]:o[e][Zl.COUNT]+1})})}const m=r.length;for(let e=0;e<m;e+=1){const t=r[e].filterPoe;c[t]&&(c[t]={...c[t],[Zl.COUNT]:c[t][Zl.COUNT]+1})}const E=a.length;for(let e=0;e<E;e+=1){const t=a[e].nativeNetworkConfIdSubstituted;if(void 0!==t){const e=""===t?en:t;s[e]&&(s[e]={...s[e],[Zl.COUNT]:s[e][Zl.COUNT]+1})}}const A=l.length;for(let e=0;e<A;e+=1){const t=l[e].filterStatus;t.length&&t.forEach(e=>{i[e]&&(i[e]={...i[e],[Zl.COUNT]:i[e][Zl.COUNT]+1})})}return{media:o,poe:c,nativeVlan:s,status:i}}),e=>e),rn={[F.fA.AVAILABLE]:"COMMON_NOT_CONNECTED",[F.fA.IN_USE]:"COMMON_IN_USE",[F.fA.CRITICAL]:"COMMON_CRITICAL",[F.fA.WARNING]:"COMMON_WARNING"},an={[F.fA.IN_USE]:1,[F.fA.AVAILABLE]:2,[F.fA.CRITICAL]:3,[F.fA.WARNING]:4},ln=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{formatMessage:t,formatNumber:r}=(0,$.tz)(),l=(0,b.useSelector)(e=>tn(e).status),n=(0,b.useSelector)(y.ji),o=(0,a.useMemo)(()=>Object.values(l),[l]),c=(0,a.useMemo)(()=>o.map(e=>e[Zl.ID]),[o]),s=(0,a.useCallback)(t=>{e((0,x.HF)(Array.from(t)))},[e]),i=(0,a.useCallback)(t=>{e((0,x.HF)(Array.from(t)))},[e]),d=(0,a.useCallback)(()=>{e((0,x.HF)([]))},[e]),u=(0,a.useMemo)(()=>o.sort((e,t)=>an[e[Zl.ID]]-an[t[Zl.ID]]).map(e=>({id:e[Zl.ID],type:"CHECKBOX",title:`${t({id:rn[e[Zl.ID]]})} (${r(e[Zl.COUNT])})`,children:[]})),[o,t,r]),m=(0,a.useMemo)(()=>n.length===o.length?"all":new Set(n),[n,o.length]),E=(0,a.useMemo)(()=>new Set(o.filter(e=>!n.includes(e[Zl.ID])&&!l[e[Zl.ID]][Zl.COUNT]).map(e=>e[Zl.ID])),[o,l,n]);return(0,Ql.A)(n,c,x.HF),o.length?a.createElement(Jl.A,{label:a.createElement($.sA,{id:"COMMON_STATUS"}),isSingleColumn:!0},a.createElement(ql.A,{items:u,selectedKeys:m,disabledKeys:E,onSelectionChange:s,onSelectAll:i,onDeselectAll:d,shouldAlwaysUseSimplifiedPicker:!0})):null}),nn={[F.rW.NONE]:"COMMON_NONE",[F.rW.POE]:"COMMON_DEVICE_POE_MODE_POE",[F.rW.POE_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS",[F.rW.POE_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS",[F.rW.POE_PLUS_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS",[F.rW.POE_PASSTHROUGH]:"COMMON_DEVICE_POE_MODE_PASSTHROUGH",[F.rW.POE_PASSIVE_24V]:"COMMON_DEVICE_POE_MODE_PASSIVE"},on={[F.rW.NONE]:1,[F.rW.POE]:2,[F.rW.POE_PLUS]:3,[F.rW.POE_PLUS_PLUS]:4,[F.rW.POE_PLUS_PLUS_PLUS]:5,[F.rW.POE_PASSTHROUGH]:5,[F.rW.POE_PASSIVE_24V]:6},cn=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{formatNumber:t,formatMessage:r}=(0,$.tz)(),l=(0,b.useSelector)(e=>tn(e).poe),n=(0,b.useSelector)(y.px),o=(0,a.useMemo)(()=>Object.values(l),[l]),c=(0,a.useMemo)(()=>o.map(e=>e[Zl.ID]),[o]),s=(0,a.useCallback)(t=>{e((0,x.PJ)(Array.from(t)))},[e]),i=(0,a.useCallback)(t=>{e((0,x.PJ)(Array.from(t)))},[e]),d=(0,a.useCallback)(()=>{e((0,x.PJ)([]))},[e]),u=(0,a.useMemo)(()=>o.sort((e,t)=>on[e[Zl.ID]]-on[t[Zl.ID]]).map(e=>({id:e[Zl.ID],type:"CHECKBOX",title:`${r({id:nn[e[Zl.ID]]})} (${t(e[Zl.COUNT])})`,children:[]})),[o,t,r]),m=(0,a.useMemo)(()=>n.length===o.length?"all":new Set(n),[n,o.length]),E=(0,a.useMemo)(()=>new Set(o.filter(e=>!n.includes(e[Zl.ID])&&!l[e[Zl.ID]][Zl.COUNT]).map(e=>e[Zl.ID])),[o,l,n]);return(0,Ql.A)(n,c,x.PJ),o.length?a.createElement(Jl.A,{label:a.createElement($.sA,{id:"COMMON_DEVICE_POE_MODE_POE"}),isSingleColumn:!0},a.createElement(ql.A,{items:u,selectedKeys:m,disabledKeys:E,onSelectionChange:s,onSelectAll:i,shouldAlwaysUseSimplifiedPicker:!0,onDeselectAll:d})):null});var sn=r(445535),dn=r(888964);const un=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{formatNumber:t,formatMessage:r}=(0,$.tz)(),l=(0,b.useSelector)(e=>tn(e).nativeVlan),n=(0,b.useSelector)(y.l9),o=(0,a.useMemo)(()=>Object.values(l),[l]),c=(0,a.useMemo)(()=>o.map(e=>e[Zl.ID]),[o]),s=(0,a.useCallback)(t=>{e((0,x.t4)(Array.from(t)))},[e]),i=(0,a.useCallback)(t=>{e((0,x.t4)(Array.from(t)))},[e]),d=(0,a.useCallback)(()=>{e((0,x.t4)([]))},[e]),u=(0,a.useMemo)(()=>o.sort((e,t)=>{const r=e[Zl.ID]===en,a=t[Zl.ID]===en;if(r)return 1;if(a)return-1;return(e[Zl.VLAN_ID]??1)-(t[Zl.VLAN_ID]??1)}).map(e=>{const a=e[Zl.NAME],l=a===en?r({id:"COMMON_NONE"}):a;return{id:e[Zl.ID],type:"CHECKBOX",title:`${l} (${t(e[Zl.COUNT])})`,children:[]}}),[o,t,r]),m=(0,a.useMemo)(()=>n.length===o.length?"all":new Set(n),[n,o.length]),E=(0,a.useMemo)(()=>new Set(o.filter(e=>!n.includes(e[Zl.ID])&&!l[e[Zl.ID]][Zl.COUNT]).map(e=>e[Zl.ID])),[o,l,n]);return(0,Ql.A)(n,c,x.t4),o.length?a.createElement(sn.A,{id:dn.R.PORTS_NATIVE_VLAN,label:a.createElement($.sA,{id:"COMMON_PORTS_NATIVE_VLAN"})},a.createElement(ql.A,{id:dn.R.PORTS_NATIVE_VLAN,items:u,selectedKeys:m,disabledKeys:E,onSelectionChange:s,onSelectAll:i,onDeselectAll:d})):null}),mn=[F.f4.SFP,F.f4.SFPPLUS,F.f4.SFP28,F.f4.QSFP28],En={[F.f4.FE]:"COMMON_MEDIA_FE",[F.f4.GE]:"COMMON_MEDIA_GE",[F.f4.GE_2P5]:"COMMON_MEDIA_2P5GE",[F.f4.GE_10]:"COMMON_MEDIA_10GE",[F.f4.GE_25]:"COMMON_MEDIA_25GE",[F.f4.GE_40]:"COMMON_MEDIA_40GE",[F.f4.GE_100]:"COMMON_MEDIA_100GE",[F.f4.SFP]:"COMMON_MEDIA_SFP",[F.f4.SFPPLUS]:"COMMON_MEDIA_SFPPLUS",[F.f4.SFP28]:"COMMON_MEDIA_SFP28",[F.f4.QSFP28]:"COMMON_MEDIA_QSFP28"},An={[F.f4.FE]:1,[F.f4.GE]:2,[F.f4.GE_2P5]:3,[F.f4.GE_10]:4,[F.f4.GE_25]:5,[F.f4.GE_40]:6,[F.f4.GE_100]:7,[F.f4.SFP]:8,[F.f4.SFPPLUS]:9,[F.f4.SFP28]:10,[F.f4.QSFP28]:11},pn=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{formatNumber:t,formatMessage:r}=(0,$.tz)(),l=(0,b.useSelector)(e=>tn(e).media),n=(0,b.useSelector)(y.T4),o=(0,a.useMemo)(()=>Object.values(l),[l]),c=(0,b.useSelector)(y.oE),s=(0,a.useMemo)(()=>o.map(e=>e[Zl.ID]),[o]),i=(0,a.useCallback)(t=>{e((0,x.Vw)(Array.from(t)))},[e]),d=(0,a.useCallback)(t=>{e((0,x.Vw)(Array.from(t)))},[e]),u=(0,a.useCallback)(()=>{e((0,x.Vw)([]))},[e]),m=(0,a.useMemo)(()=>o.filter(e=>!c||mn.includes(e[Zl.ID])).sort((e,t)=>An[e[Zl.ID]]-An[t[Zl.ID]]).map(e=>({id:e[Zl.ID],type:"CHECKBOX",title:`${r({id:En[e[Zl.ID]]})} (${t(e[Zl.COUNT])})`,children:[]})),[o,c,r,t]),E=(0,a.useMemo)(()=>n.length===o.length?"all":new Set(n),[n,o.length]),A=(0,a.useMemo)(()=>new Set(o.filter(e=>!n.includes(e[Zl.ID])&&!l[e[Zl.ID]][Zl.COUNT]).map(e=>e[Zl.ID])),[o,l,n]);return(0,Ql.A)(n,s,x.Vw),o.length?a.createElement(Jl.A,{label:a.createElement($.sA,{id:"COMMON_LINK_SPEED"}),isSingleColumn:!0},a.createElement(ql.A,{shouldAlwaysUseSimplifiedPicker:!0,items:m,selectedKeys:E,disabledKeys:A,onSelectionChange:i,onSelectAll:d,onDeselectAll:u})):null});var _n=r(574022),Sn=r(1758),hn=r(548165);const gn=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.uC),r=(0,hn.xO)(t)||(0,hn.fX)(),[l,n]=(0,a.useState)([r.min,r.max]),o=(0,a.useMemo)(()=>(0,_n.A)(t=>{const r=(0,hn.N1)({min:t[0],max:t[1]});e((0,x.uN)(r))},500),[e]);(0,a.useEffect)(()=>{n([r.min,r.max])},[r.min,r.max]);const c=(0,a.useCallback)(e=>{Array.isArray(e)&&2===e.length&&(n([e[0],e[1]]),o([e[0],e[1]]))},[o]);(0,a.useEffect)(()=>()=>{o.cancel()},[o]);const s=(0,a.useMemo)(()=>a.createElement($.sA,{id:"COMMON_GENERIC_FROM_TO",values:{from:l[0],to:l[1]}}),[l]);return a.createElement(sn.A,{label:a.createElement($.sA,{id:"PORTS_AI_ANOMALY_SCORE"})},a.createElement(E.A,{flex:1,width:"100%",paddingLeft:d.kc},a.createElement(Sn.A,{defaultValue:[r.min,r.max],value:l,onChange:c,caption:0,captionEnd:100,labelEnd:s,style:{width:"100%"}})))},Cn=(0,a.memo)(()=>{const e=(0,b.useDispatch)(),{formatMessage:t}=(0,$.tz)(),r=(0,b.useSelector)(y.N0),l=(0,b.useSelector)(y.K6),n=(0,b.useSelector)(y.$X),o=(0,b.useSelector)(y.UH),c=(0,a.useMemo)(()=>r.map(e=>({id:e.mac,type:"CHECKBOX",title:(0,pe.Q)(e)+(e.isOffline?` (${t({id:"COMMON_OFFLINE"})})`:""),checkboxProps:{isTruncated:!0},children:[]})),[r,t]),s=(0,a.useMemo)(()=>new Set(l),[l]),i=(0,a.useCallback)(t=>{const r=Array.from(t);if(!(n&&0===r.length&&l.length>0)&&(e((0,x.is)(r)),0!==r.length)){const t=o.filter(e=>{const t=(0,k.q9)(e).deviceMac;return r.includes(t)});t.length!==o.length&&e((0,x.Ao)(t))}},[e,n,l.length,o]),d=(0,a.useCallback)(t=>{e((0,x.is)(Array.from(t)))},[e]),u=(0,a.useCallback)(()=>{n&&l.length>0||e((0,x.is)([]))},[e,n,l]);return r.length>1?a.createElement(sn.A,{id:dn.R.PORTS_NATIVE_VLAN,label:a.createElement($.sA,{id:"COMMON_SWITCHES"})},a.createElement(ql.A,{id:dn.R.PORTS_NATIVE_VLAN,items:c,selectedKeys:s,onSelectionChange:i,onSelectAll:d,onDeselectAll:u,shouldAlwaysUseSimplifiedPicker:!0,selectionMode:n?"single":"multiple"})):null});var On=r(888170),fn=r(805837),Nn=r(618025),Mn=r(362412),vn=r(814680),bn=r(6176),Tn=r(999589),In=r(478211),Pn=r(309447),Dn=r(463477),kn=r(734707),yn=r(188912),xn=r(392699),wn=r(281884),Rn=r(837612),Ln=r(613141);const $n=(0,l.A)("div")`
  height: ${({connectionStatus:e})=>e===xn.v.OFFLINE?"unset":d.S2};
  flex-wrap: ${({connectionStatus:e})=>e===xn.v.OFFLINE?"wrap":"unset"};
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: ${({connectionStatus:e})=>e===xn.v.OFFLINE?"unset":d.YC};
  * {
    line-height: ${d.Er} !important;
    font-size: 13px !important;
    flex-flow: nowrap !important;
    }
  {/* Target "Connected To" */}
  div > span {
    color: ${({theme:{themeName:e}})=>H.Ay[`desktop-color-neutral-10-${e}`]} !important;
  }
  {/* Target flex container */}
  & > div {
    justify-content: space-between;
    width: ${({connectionStatus:e})=>e===xn.v.OFFLINE?"unset":"100%"};
    min-height: 24px;
  }
`,Un=({device:e,stackingGroupModelName:t})=>{const r=(0,b.useSelector)(y.gR),l=(0,b.useSelector)(y.tI),n=(0,b.useSelector)(y.w2),o=(0,b.useSelector)(y.OA),c=(0,b.useDispatch)(),s=t||(0,pe.Lm)(e?.model),{type:i}=(0,V.Se)(o),u=i===F.F7.MC_LAG&&n.length>1,m=(0,a.useCallback)(()=>{r?c((0,q.XP)({type:te.H.STACKING,id:r})):l&&c((0,q.XP)({type:te.H.DEVICE,id:l,tab:X.BC.SETTINGS}))},[r,l,c]);return e&&e.model?a.createElement(E.A,{alignItems:"center",gap:d.kc,height:d.S2,justifyContent:"space-between"},a.createElement(z.A,{size:"medium",color:"text-2"},a.createElement($.sA,{id:"COMMON_MODEL"})),a.createElement(E.A,{alignItems:"center",gap:d.YC},a.createElement(z.A,{size:"medium",color:"text-3"},s),a.createElement(yt.A,{description:u?a.createElement($.sA,{id:"PORTS_FIRST_SELECT_SWITCH"}):null},a.createElement(Pn.A,{size:"small",variant:"neutral",onPress:m,isDisabled:u},a.createElement(In.A,null))))):null},Fn=({firstSelectedDeviceMac:e})=>{const t=(0,b.useSelector)((0,he.tG)(e)),r=(0,b.useSelector)(y._h),{onUpgradeDevice:l,showButton:n,isPending:o}=(0,Dn.S)(t),c=n&&1===r.length;if(!t.displayable_version)return null;const s=(0,Tn.coerce)(t.upgrade_to_firmware)?.version;return a.createElement(E.A,{gap:d.kc,alignItems:"center",justifyContent:"space-between",height:d.S2},a.createElement(z.A,{size:"medium",color:"text-2"},a.createElement($.sA,{id:"COMMON_VERSION"})),a.createElement(E.A,{gap:d.kc},a.createElement(z.A,{size:"medium",color:"text-3"},t.displayable_version),c?a.createElement(Ln.A,{fromVersion:t.displayable_version,toVersion:t.upgrade_to_firmware,model:t.model},a.createElement(kn.Ay,{variant:"inline",onClick:l,disabled:o,size:"medium"},a.createElement($.sA,{id:"COMMON_ACTION_UPDATE_TO",values:{version:s}}))):null))},Vn=({firstSelectedDeviceMac:e})=>{const t=(0,b.useSelector)((0,he.tG)(e)),{uplink:r}=t,l=(0,a.useMemo)(()=>(0,wn.H)((0,Rn.S9)(t),r?.type),[t,r?.type]),n=Boolean(t.wan_networkgroup)||Boolean(r?.uplink_device_name),o=(0,Rn.YP)(t);return n&&o?a.createElement($n,{connectionStatus:l},a.createElement(yn.A,{activeItem:{...t,deviceState:(0,Rn.S9)(t)},connectionStatus:l,uplinkNameMaxWidth:l===xn.v.CONNECTED?142:110,key:t.mac})):null},Hn=()=>{const e=(0,b.useSelector)(y.IY),t=(0,b.useSelector)(y.w2),r=(0,b.useSelector)(y.OA),l=t[0],n=(0,b.useSelector)(y._h),o=(0,a.useMemo)(()=>{const{type:e}=(0,V.Se)(r);return e},[r]),c=(0,a.useMemo)(()=>o===F.F7.MC_LAG,[o]),s=(0,a.useMemo)(()=>o===F.F7.STACKING_GROUP,[o]),i=(0,b.useSelector)((0,a.useMemo)(()=>(0,he.nH)(t),[t])),u=(0,b.useSelector)((0,a.useMemo)(()=>(0,he.nH)(n),[n])),{formatMessage:m}=(0,$.tz)(),A=m({id:"PORTS_STACKING_MODEL_POE_SUFFIX"}),p=(0,a.useMemo)(()=>s&&0!==u.length?((e,t)=>{if(0===e.length)return null;const r=e.map(e=>(0,pe.Lm)(e.model)),a=Array.from(new Set(r));if(1===a.length)return a[0];const l=a.some(e=>e.toLowerCase().includes("poe")),n=a.some(e=>!e.toLowerCase().includes("poe"));if(l&&n){const e=a.find(e=>!e.toLowerCase().includes("poe"));if(e)return`${e} ${t}`}return a[0]})(u,A):null,[s,u,A]),_=(0,a.useMemo)(()=>c&&i[0]?i[0]:s&&u.length>0&&u[0]?u[0]:e?.device?e.device:null,[c,s,i,u,e]);return a.createElement(E.A,{flexDirection:"column",paddingLeft:d.kc,paddingRight:d.kc,gap:d.kc},a.createElement(E.A,{flexDirection:"column"},a.createElement(Un,{device:_,stackingGroupModelName:p}),a.createElement(Fn,{firstSelectedDeviceMac:l}),a.createElement(Vn,{firstSelectedDeviceMac:l})),a.createElement(Sl.A,{orientation:"horizontal"}))},zn=(0,l.A)(Mn.A)`
  z-index: ${On.Ay["z-index-side-panel"]-1};
`,Gn=l.A.div`
  ${({isOffline:e,themeName:t})=>e?`\n    color: ${On.Ay.motifs[t].text03} !important;\n  `:""}
`,Wn=()=>{const e=(0,b.useDispatch)(),t=(0,b.useSelector)(y.OA),r=(0,b.useSelector)(y.Mi),l=(0,b.useSelector)(y.$X),{formatMessage:n}=(0,$.tz)(),{themeName:o}=(0,K.u)(),c=(0,a.useCallback)(t=>{if(e((0,x.Ao)([])),e((0,x.U)(t)),e((0,x.E1)(t!==gt.Zt)),t===gt.Zt)return e((0,x.IU)(!1)),void e((0,x.JL)(!1));if(l){const a=r.find(e=>e.value===t);if(a?.includeDevices?.length)return void e((0,x.is)([a?.includeDevices?.[0]]))}e((0,x.is)([]))},[e,l,r]),s=[{value:(0,V.HN)(F.F7.ALL,[]),label:n({id:"COMMON_ALL_PORTS"}),image:a.createElement(Nn.A,null)},...r.map(e=>({value:e.value,label:e.label+(e.isOffline?` (${n({id:"COMMON_OFFLINE"})})`:""),isOffline:e.isOffline,image:e.hasError?a.createElement(G.A,{size:"original",variant:"fill",color:H.Ay[`desktop-color-red-06-${o}`],fill:H.Ay[`desktop-color-neutral-00-${o}`]}):e.hasWarning?a.createElement(G.A,{size:"original",variant:"fill",color:H.Ay[`desktop-color-orange-06-${o}`],fill:H.Ay[`desktop-color-neutral-00-${o}`]}):a.createElement(bn.A,{width:gt.NK,height:gt.NK,model:e.deviceProperties?.model})}))],i=(0,a.useCallback)(e=>{const t=e.option.isOffline??!1;return a.createElement(Gn,{isOffline:t,themeName:o},a.createElement(fn.q,{...e}))},[o]),u=(0,a.useCallback)(e=>{c(e.value)},[c]);return a.createElement(E.A,{flexDirection:"column",gap:d.kc},a.createElement(zn,{variant:"secondary",searchable:!0,portal:!0,width:"full",onChange:u,options:s,renderOption:i,value:t,maxHeight:vn.W}),t!==gt.Zt?a.createElement(Hn,null):null)},Bn=(0,a.memo)(()=>{const e=(0,b.useSelector)(y.QR),t=(0,b.useSelector)(y.OA)===gt.Zt,r=(0,b.useSelector)(y.$X),l=(0,b.useSelector)(y.oE),n=(0,b.useSelector)(y.wJ),o=(0,Le.Ki)(n),s=(0,b.useSelector)(y.oE),i=!r,u=!t&&!l&&o,m=!s,A=!t,p=m||u||A;return a.createElement(hl.A,{columns:l?null:a.createElement(Xl,null),leftFilterColumnsId:Hl.PORTS,footer:a.createElement(zl,{leftFilterPageId:c.g1.PORT_MANAGEMENT}),leftFilterPageId:c.g1.PORT_MANAGEMENT,tabs:a.createElement(vl.Ay,{selectedTab:s?vl.al.SFP:vl.al.MAIN})},a.createElement(E.A,{flexDirection:"column"},a.createElement(gl.A,null,l?null:a.createElement(Wn,null),l?null:a.createElement(Cn,null),p?a.createElement(E.A,{flexDirection:"column",gap:d.kc,padding:d.kc},a.createElement(E.A,{flexDirection:"column"},A?a.createElement(Ml,null):null,m?a.createElement(Nl,null):null,u?a.createElement(fl,null):null),a.createElement(Sl.A,{orientation:"horizontal"})):null,i?a.createElement(gn,null):null,e?a.createElement(Yl,null):null),i?a.createElement(a.Fragment,null,l?null:a.createElement(un,null),a.createElement(gl.A,null,a.createElement(ln,null),l?null:a.createElement(cn,null),a.createElement(pn,null))):null))}),Kn=(0,l.A)(E.A)`
  flex-direction: column;
  gap: ${d.kc};
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  padding: ${d.Ln} 0 ${d.Ln} ${d.Ln};
`,Yn=()=>(0,i.A)([(0,s.Zi)(o.B.PORTS),(0,s.Zi)(o.B.DEVICES),(0,f.J4)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,S.d9)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,v.$3)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,_.hh)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,p.F)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,M.Uc)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,h.Uc)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,C.kE)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,O.Sk)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,N.N)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}),(0,g.G)(void 0,{crudCacheStrategy:{type:n.e.CACHE}})],a.createElement(u.A,{mainPanelProps:{gap:d.Ln}},a.createElement(m.A,{leftFilterPageId:c.g1.PORT_MANAGEMENT,content:a.createElement(Bn,null),overflow:"hidden",paddingBottom:d.Ln},a.createElement(Kn,null,a.createElement(_l,null)))),{trackingName:A.VO.PORTS})},188912:(e,t,r)=>{r.d(t,{A:()=>u});var a=r(296540),l=r(370969),n=r(243322),o=r(294303),c=r(699784),s=r(151061),i=r(770804),d=r(392699);const u=({connectionStatus:e,activeItem:t,disabled:r,uplinkNameMaxWidth:u=195})=>{const{type:m,last_uplink:E,uplink:A,state:p,name:_,mac:S,disconnected_at:h}=t;switch(e){case d.v.OFFLINE:return a.createElement(s.m,{last_uplink_mac:E?.uplink_mac,last_uplink_name:E?.uplink_device_name,last_uplink_remote_port:E?.uplink_remote_port,disconnected_at:h,disabled:r,maxWidth:u});case d.v.MESHING:return a.createElement(i.A,{type:m,name:_,mac:S,uplink:A,state:p,alignLeft:!0,disabled:r});case d.v.CONNECTED:return a.createElement(o.A,{alignItems:"flex-bottom",flexWrap:"wrap"},a.createElement(n.A,{color:"text-3"},a.createElement(c.sA,{id:"COMMON_CONNECTED_TO"}))," ",a.createElement(l.E,{device:t,maxWidth:u,disabled:r,separatePortNumber:!0}));default:return null}}},191568:(e,t,r)=>{r.d(t,{x:()=>E});var a=r(469733),l=r(296540),n=r(720903),o=r(604482),c=r(845030),s=r(580176),i=r(994791),d=r(497470),u=r(953048),m=r(829092);const E=()=>{const e=(0,a.useDispatch)(),t=(0,a.useSelector)(i.Mi),r=(0,a.useSelector)(i.OA),E=(0,a.useSelector)(i.N0),A=(0,a.useSelector)(i.K6),p=(0,l.useMemo)(()=>E?.[0],[E]),_=(0,l.useCallback)(()=>{e((0,d.JL)(!1)),e((0,d.IU)(!1)),e((0,d.E1)(!0)),e((0,d.Ao)([]))},[e]),S=(0,l.useCallback)(t=>{e((0,d.JL)(t)),t&&(1===A.length?e((0,d.is)([A[0]])):p&&e((0,d.is)([p.mac])))},[e,p,A]),h=(0,l.useCallback)(t=>{e((0,d.E1)(t))},[e]),g=(0,l.useCallback)(a=>{if(a&&r===u.Zt){const r=t[0]?.value;e((0,d.U)(r))}e((0,d.IU)(a)),a||e((0,d.Ao)([])),e((0,c.K5)())},[t,e,r]),C=(0,l.useCallback)(t=>{switch(e((0,d.Ao)([])),e((0,s.Zi)(o.g1.PORT_MANAGEMENT)),e((0,d.Ff)((0,n.A)(u.Fs))),t){case m.al.SFP:e((0,d.EZ)(!0)),e((0,d.U)(u.Zt)),e((0,d.JL)(!1)),e((0,d.IU)(!1));break;case m.al.MAIN:e((0,d.EZ)(!1))}},[e]);return(0,l.useMemo)(()=>({handleReturnToPortsView:_,handleStatsChange:g,handleVlansChange:S,handleDeviceDiagramChange:h,handleSectionChange:C}),[_,g,S,h,C])}},201384:(e,t,r)=>{r.d(t,{A:()=>n});var a=r(296540),l=r(152632);const n=({children:e})=>{const[t,r]=a.useState(null),n=null!==t,o=a.useCallback(e=>{r(e)},[]),c=a.useCallback(e=>{r(e)},[]),s=a.useCallback(()=>{r(null)},[]),i=a.useMemo(()=>({isMaximized:n,maximizedId:t,maximize:c,minimize:s}),[n,t,c,s]),d="function"==typeof e?e({isMaximized:n,maximizedId:t,maximize:c,minimize:s}):e;return a.createElement(l.zX.Provider,{value:i},a.createElement(l.YC.Provider,{value:o},d))}},226712:(e,t,r)=>{r.d(t,{A:()=>y,j:()=>D});var a=r(469733),l=r(296540),n=r(927099),o=r(822336),c=r(118818),s=r(934846),i=r(95918),d=r(455806),u=r(383704),m=r(363334),E=r(794993),A=r(71479),p=r(998837),_=r(903216),S=r(566723),h=r(294303),g=r(699784),C=r(966784),O=r(962669),f=r(578819),N=r(780811),M=r(532419),v=r(376272),b=r(60687),T=r(264752);const I=(0,A.A)("div")`
  display: grid;
  grid-template-columns: repeat(3, minmax(min-content, 1fr));
  gap: ${S.YC};
  margin-top: ${S.kc};
`,P=(0,A.A)(h.A)`
  gap: ${S.kc};
  row-gap: ${S.YC};
  flex-wrap: wrap;
`,D=(0,A.A)(c.A,{shouldForwardProp:e=>!["background","color"].includes(e)})`
  background-color: ${({background:e,theme:{themeName:t}})=>(0,C.oX)(e,t)};
  border-radius: 0;
  border: ${({color:e,theme:{themeName:t}})=>e&&`1px solid ${(0,C.oX)(e,t)}`};
`,k=(e,t)=>e===b.s.PASSTHROUGH?1:e===b.s.PASSIVE?2:e===b.s.POE?3:e===b.s.POE_PLUS?4:e===b.s.POE_PLUS_PLUS?5:(b.s.POE_PLUS_PLUS_PLUS,6),y=({deviceMac:e,isSingleLine:t=!1,hidePoe:r=!1,hideDisabled:c=!1,hideDisconnected:A=!1,displayedSpeedList:S})=>{const{themeName:h}=(0,p.u)(),C=(0,a.useSelector)((0,l.useMemo)(()=>(0,M.tG)(e),[e])),{type:y,model:x}=C;return(0,l.useMemo)(()=>{const e=(0,O.MB)(C),a=(0,N.NuO)(C),p=(0,f._L)(C,a),M=c||(0,N.m_j)(C)||(0,N.Syn)(C)||(0,N.Fp0)(C),x=t?P:I,w=Array.from(p).sort(k).map(e=>{switch(!0){case e===b.s.POE_PLUS_PLUS_PLUS:return l.createElement(T.A,{key:e,description:l.createElement(g.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS"}),indicator:l.createElement(s.A,{color:o.Ay[`desktop-color-neutral-08-${h}`]})});case e===b.s.POE_PLUS_PLUS:return l.createElement(T.A,{key:e,description:l.createElement(g.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS"}),indicator:l.createElement(i.A,{color:o.Ay[`desktop-color-neutral-08-${h}`]})});case e===b.s.POE_PLUS:return l.createElement(T.A,{key:e,description:l.createElement(g.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS"}),indicator:l.createElement(d.A,{color:o.Ay[`desktop-color-neutral-08-${h}`]})});case e===b.s.PASSTHROUGH||e===b.s.PASSIVE||e===b.s.POE:return l.createElement(T.A,{key:e,description:l.createElement(g.sA,{id:e===b.s.PASSIVE?"COMMON_DEVICE_POE_MODE_PASSIVE":"COMMON_DEVICE_POE_MODE_POE"}),indicator:l.createElement(u.A,{color:o.Ay[`desktop-color-neutral-08-${h}`]})});default:return null}});return l.createElement(x,null,e.filter(e=>!S||S.includes(e)).sort((e,t)=>e-t).map(e=>l.createElement(T.A,{key:e,description:(0,_.ir)(e),indicator:l.createElement(D,{background:v.A[e]?.background||"transparent"})})),A?null:l.createElement(T.A,{key:"disconnected",description:l.createElement(g.sA,{id:"COMMON_DISCONNECTED"}),indicator:l.createElement(D,{background:v.A.DEFAULT.background})}),M?null:l.createElement(T.A,{key:"disabled",description:l.createElement(g.sA,{id:"COMMON_DISABLED"}),indicator:l.createElement(D,{background:"transparent",color:v.A.DEFAULT.background}),isSingleLine:t}),r?null:w,!(0,N.Tbi)({type:y})||(0,N.Syn)(C)||(0,N.Fp0)(C)?null:l.createElement(l.Fragment,null,l.createElement(T.A,{key:"aggregating",description:l.createElement(g.sA,{id:"COMMON_AGGREGATING"}),indicator:l.createElement(E.A,{color:o.Ay[`desktop-color-neutral-08-${h}`]})}),l.createElement(T.A,{key:"mirror",indicator:l.createElement(m.A,null),description:l.createElement(g.sA,{id:"DEVICE_PORT_STATE_MIRROR"}),tooltipDescription:l.createElement(n.A,null,l.createElement(g.sA,{id:"DEVICE_PORT_STATE_MIRROR_TOOLTIP"}))})))},[x,r,c,S,h])}},243322:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(217439);const l=(0,r(71479).A)(a.A)`
  white-space: nowrap;
`},264752:(e,t,r)=>{r.d(t,{A:()=>m});var a=r(296540),l=r(927099),n=r(71479),o=r(566723),c=r(766624),s=r(294303);const i=(0,n.A)(l.A)`
  white-space: nowrap;
`,d=(0,n.A)(s.A)`
  align-items: center;
`,u=(0,n.A)(s.A)`
  width: ${o.Ln};
  justify-content: flex-start;
`,m=({indicator:e,description:t,isSingleLine:r,tooltipDescription:l})=>a.createElement(d,{marginRight:r?o.kc:0},a.createElement(u,null,e),a.createElement(i,{size:"caption",color:"tertiary"},t),l?a.createElement(c.A,{description:l}):null)},264863:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(296540),l=r(113851),n=r(362584),o=r(528552);const c=({children:e})=>{const{[n.A.IS_MAXIMIZED]:t}=(0,a.useContext)(o.A);return a.createElement(l.A,{isHidden:t},e)}},269611:(e,t,r)=>{r.d(t,{n:()=>c});var a=r(469733),l=r(602197),n=r(532419),o=r(211368);const c=(e,t)=>{const r=(0,a.useSelector)(n.CC),c=t.uplink_mac?r.find(({mac:e})=>e===t.uplink_mac):void 0,s=Boolean(t.signal);return o.q[e]===l.g.CONNECTED&&c&&s?c:void 0}},281884:(e,t,r)=>{r.d(t,{H:()=>o});var a=r(780811),l=r(768195),n=r(392699);const o=(e,t)=>(0,a.aK8)(e)?n.v.OFFLINE:t===l.au.WIRELESS?n.v.MESHING:n.v.CONNECTED},288006:(e,t,r)=>{var a,l,n;r.d(t,{at:()=>l,dv:()=>a,vL:()=>n}),function(e){e.DISPLAYED_VLAN_ID="nativeVlanId",e.IS_WAN_PORT="isWanPort",e.ADJUSTED_PORT_NUMBER="adjustedPortNumber",e.IS_MANAGED_BY_PORT_PROFILE="isManagedByPortProfile",e.IS_DISABLED="isDisabled"}(a||(a={})),function(e){e.IS_TAGGED="isTagged",e.IS_NETWORK_NATIVE_ON_PORT="isNetworkNativeOnPort",e.ADJUSTED_PORT_NUMBER="adjustedPortNumber",e.IS_WAN_PORT="isWanPort",e.IS_MANAGED_BY_PORT_PROFILE="isManagedByPortProfile",e.IS_DISABLED="isDisabled"}(l||(l={})),function(e){e.BLOCKED="BLOCKED",e.TAGGED="TAGGED",e.DISABLED="DISABLED",e.NATIVE="NATIVE",e.WAN="WAN",e.UNTAGGED_NATIVE="UNTAGGED_NATIVE"}(n||(n={}))},312583:(e,t,r)=>{r.d(t,{A:()=>O});var a=r(469733),l=r(296540),n=r(429252),o=r.n(n),c=r(217439),s=r(592563),i=r(249304),d=r(77247),u=r(684342),m=r(225269),E=r(580176),A=r(699784),p=r(198494),_=r(200826),S=r(305988),h=r(789768),g=r(67716),C=r(518089);const O=({leftFilterPageId:e,...t})=>{const r=(0,a.useDispatch)(),n=(0,l.useRef)(null),O=(0,d.A)(n),f=u.l[t.tableType],N=Boolean(f),M=(0,_.A)(t.tableType),v=(0,a.useSelector)(p.Bm),b=(0,l.useCallback)(()=>{const e=S.W2.tables?.[t.tableType],a=[...e?.initialColumns||[]],l=e?.columnOrder,n={[t.tableType]:{initialColumns:a,...l?{columnOrder:l}:{},initialColumnSnapshot:a.reduce((e,t)=>(e[String(t)]=!0,e),{...e?.initialColumnSnapshot||{}})}};N&&(n[t.tableType].columnSize=f,t.tableType===i.l.UNIFI_DEVICE&&u.t.forEach(e=>{n[e]={columnSize:f}})),r((0,h.zF)(n))},[r,t.tableType,N,f]),T=(0,l.useCallback)(()=>{r((0,E.Zi)(e))},[r,e]),I=(0,l.useMemo)(()=>{const e=o()([...S.W2.tables?.[t.tableType]?.initialColumns||[]].sort(),[...M?.initialColumns||[]].sort()),r=o()(S.W2.tables?.[t.tableType]?.columnOrder,M?.columnOrder);if(N){let a=!M?.columnSize||o()(f,M?.columnSize);if(t.tableType===i.l.UNIFI_DEVICE){const e=u.t.every(e=>!v[e]?.columnSize||o()(f,v[e]?.columnSize));a=a&&e}return e&&r&&a}return e&&r},[t.tableType,M,N,v,f]);return l.createElement(C.CW,{hasOverflow:O},l.createElement(C.kp,{ref:n},l.createElement(c.A,{size:"small",color:"text-1"},l.createElement(A.sA,{id:"COMMON_CUSTOMIZE_COLUMNS"})),l.createElement(m.A,{...t}),l.createElement(C.Ot,null,l.createElement(g.d$,null),l.createElement(s.A,{type:"button",onPress:b,isDisabled:I},l.createElement(c.A,{size:"medium",color:"inherit"},l.createElement(A.sA,{id:"COMMON_ACTION_RESTORE"}))),l.createElement(s.A,{type:"button",onPress:T},l.createElement(c.A,{size:"medium",color:"inherit"},l.createElement(A.sA,{id:"COMMON_ACTION_DONE"}))))))}},363370:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(296540),l=r(928085),n=r(876773);const o=e=>{const t=(0,l.A)(e.to);return a.createElement(n.A,{...e,to:t})}},392699:(e,t,r)=>{var a;r.d(t,{v:()=>a}),function(e){e.OFFLINE="offline",e.MESHING="meshing",e.CONNECTED_INTERRUPTED="connected-interrupted",e.CONNECTED="connected"}(a||(a={}))},460176:(e,t,r)=>{r.d(t,{X:()=>a});const a=e=>e?.toLowerCase()||""},514625:(e,t,r)=>{r.d(t,{A:()=>n});var a=r(296540),l=r(629318);const n=(0,r(51946).w)(e=>(0,a.createElement)("svg",(0,l.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,a.createElement)("path",{d:"M4 3.5a.5.5 0 0 0-1 0v13a.5.5 0 0 0 1 0v-13Z",fill:"currentColor",className:e.baseclassname}),(0,a.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m11.708 15.5 4.793-4.794.354-.353a.5.5 0 0 0 0-.707l-5.138-5.138-.009-.008a.5.5 0 0 0-.707.707l.009.008 4.284 4.284H6.5a.501.501 0 0 0-.002 1.003l2.013.008h6.77L11 14.793a.5.5 0 0 0 .707.707Z",fill:"currentColor",className:e.baseclassname}),(0,a.createElement)("path",{d:"M4.5 3.75a.75.75 0 1 0-1.5 0v12.5a.75.75 0 0 0 1.5 0V3.75Zm7.03.778a.751.751 0 0 0-.53 1.28l3.411 3.413H6.75a.75.75 0 1 0 0 1.5h7.718L11 14.188a.75.75 0 0 0 1.06 1.06l4.72-4.719a.75.75 0 0 0 0-1.061l-4.72-4.72a.745.745 0 0 0-.53-.22Z",fill:"currentColor",className:e.fillclassname})))},596176:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(296540),l=r(217439),n=r(566723),o=r(699784),c=r(294303);const s=({messages:e=[]})=>e.length?a.createElement(c.A,{flexDirection:"column",gap:n.kc},e.map(([e,t={}])=>a.createElement(l.A,{key:e,color:"inherit",size:"inherit"},a.createElement(o.sA,{id:e,values:t})))):null},675845:(e,t,r)=>{r.d(t,{Z:()=>l,z:()=>n});var a=r(6510);const l=(e,t)=>e?t.find(({mac:t})=>t===e):void 0,n=(e,t,r,l)=>{const n=t?` ${l({id:"DEVICE_PROPERTIES_PORT_WITH_NUMBER"},{port:t})}`:"";return e?`${e}${n}`:r?`${(0,a.Q)(r)}${n}`:l({id:"COMMON_FALLBACK"})}},697490:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(296540),l=r(568777),n=r(294303),o=r(6176),c=r(703447);const s=({connectedClient:e,connectedDevice:t,size:r,wanProviderAsn:s,wanProviderName:i})=>a.createElement(a.Fragment,null,i?a.createElement(l.A,{asn:s,name:i,style:{userSelect:"none",display:"block",height:"20px",width:"20px",objectFit:"contain",margin:"0 auto"},useFallback:!0}):null,!i&&t?a.createElement(o.A,{model:t.model,width:r,height:r}):null,i||t||!e?null:a.createElement(n.A,{height:r,minWidth:r,maxWidth:r,justifyContent:"center",alignItems:"center"},a.createElement(c.A,{client:e})))},713769:(e,t,r)=>{r.d(t,{y:()=>o});var a=r(71479),l=r(566723),n=r(294303);const o=(0,a.A)(n.A)`
  flex-direction: column;
  gap: ${l.kc};
  margin: 0 0 ${l.Ln} ${l.kc};
`},727678:(e,t,r)=>{r.d(t,{A:()=>d});var a=r(296540),l=r(445535),n=r(71479),o=r(566723),c=r(294303);const s=(0,n.A)(c.A)`
  display: grid;
  grid-template-columns: ${({columns:e=2})=>`repeat(${e}, calc((100% - ${e-1} * ${o.kc}) / ${e}))`};
  user-select: none;
  column-gap: ${o.kc};
  max-width: 100%;
`,i=(0,n.A)(c.A)`
  display: flex;
  flex-direction: column;
  user-select: none;
  max-width: 100%;
`,d=({label:e,height:t,isSingleColumn:r=!1,columns:n,isEditorOpen:o=!1,initialExpanded:c=!0,isStatic:d=!1,children:u,hasPaddedContent:m=!1})=>{const E=r?i:s;return a.createElement(l.A,{label:e,initialExpanded:c,isStatic:d,hasPaddedContent:m,isEditorOpen:o},a.createElement(E,{height:t,columns:n},u))}},770804:(e,t,r)=>{r.d(t,{A:()=>p});var a=r(296540),l=r(217439),n=r(71479),o=r(132196),c=r(566723),s=r(370969),i=r(294303),d=r(699784),u=r(269611);const m=(0,n.A)(i.A,{shouldForwardProp:e=>"alignLeft"!==e})`
  ${({alignLeft:e})=>e?"max-width: 288px;":"max-width: 100%; justify-content: center;"}
  gap: ${c.kc};
  align-items: center;
`,E=o.AH`
  max-width: 50%;
`,A=o.AH`
  flex: 0 1 auto;
  min-width: 0;
`,p=({type:e,name:t,mac:r,uplink:n,state:o,alignLeft:c,smallText:p,disabled:_})=>(0,u.n)(o,n)?a.createElement(m,{alignLeft:c},a.createElement(l.A,{size:p?"small":"medium",color:"text-2"},a.createElement(d.sA,{id:"DEVICE_MESHING_TO"})),a.createElement(i.A,{className:c?A:E},a.createElement(s.E,{device:{type:e,name:t,mac:r,uplink:n},size:p?"small":"medium",disabled:_,maxWidth:120}))):null},773033:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(469733),l=r(296540),n=r(212178);const o=(e,t,r)=>{const o=(0,a.useDispatch)(),c=[JSON.stringify(e),JSON.stringify(t)].join(),s=(0,n.A)(c);return(0,l.useEffect)(()=>{if(c!==s){const a=[],l=e.length;for(let r=0;r<l;r+=1){const l=e[r];t.includes(l)||a.push(l)}a.length&&o(r(e.filter(e=>!a.includes(e))))}},[c,s,e,t,r,o]),null}},809536:(e,t,r)=>{r.d(t,{A:()=>E});var a=r(296540),l=r(338992),n=r(246463),o=r(522225),c=r(722860),s=r(325898);const i=(0,c.c)(o.A),d=a.forwardRef((e,t)=>{const{className:r,motif:l,...n}=e,{motif:o}=(0,s.A)(l);return a.createElement("div",{ref:t,slot:"header","data-uic-component":"Disclosure.StaticHeader",className:i.concat(r)("header",`header-${o}`),...n})});d.displayName="DisclosureStaticHeader";var u=r(811130),m=r(231755);const E=a.forwardRef((e,t)=>{const{label:r,caption:o,symbol:c,tooltipProps:s,children:i,size:E,isDisabled:A,hasDivider:p=!0,hasPaddedContent:_=!0,...S}=e;return a.createElement(l.A,{ref:t,isDisabled:A,isExpanded:!0,"data-uic-component":"Disclosure_Static",...S},a.createElement(a.Fragment,null,a.createElement(d,null,a.createElement(u.A,{label:r,caption:o,symbol:c,tooltipProps:s,isDisabled:A,size:E,width:"auto"})),i&&a.createElement(n.A,{hasPaddedContent:_,hasDivider:p},i),p&&a.createElement(m.A,null)))});E.displayName="Disclosure_Static"},814680:(e,t,r)=>{r.d(t,{W:()=>l,k:()=>a});const a=34,l=12*a},829092:(e,t,r)=>{r.d(t,{al:()=>d,Ay:()=>f});var a=r(956347),l=r(469733),n=r(296540),o=r(629318),c=r(51946);const s=(0,c.w)(e=>(0,n.createElement)("svg",(0,o.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5h14v9h-2v2H5v-2H3V5Zm3.5 9a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Z",fill:"currentColor",className:e.twotonedclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 14h2V5H3v9h2v2h10v-2Zm2 1a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-1h1Z",fill:"currentColor",className:e.baseclassname}),(0,n.createElement)("path",{d:"M6 14.5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Z",fill:"currentColor",className:e.baseclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 14h2V5H3v9h2v2h10v-2Zm2 1a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-1h1Z",fill:"currentColor",className:e.fillclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5h14v9h-2v2H5v-2H3V5Zm3.5 9a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Z",fill:"currentColor",className:e.fillclassname}))),i=(0,c.w)(e=>(0,n.createElement)("svg",(0,o.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,n.createElement)("path",{d:"M2 5a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5Z",fill:"currentColor",className:e.twotonedclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 5H3v8h12V5ZM3 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H3Zm4.765 2.559a.5.5 0 0 1 .514.026l3 2.02a.5.5 0 0 1-.004.833l-3 1.98A.5.5 0 0 1 7.5 11V7a.5.5 0 0 1 .265-.441Zm.735 1.38v2.132l1.599-1.055L8.5 7.939ZM17 6a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1h13V6Z",fill:"currentColor",className:e.baseclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5Zm6.28 1.585A.5.5 0 0 0 7.5 7v4a.5.5 0 0 0 .775.417l3-1.98a.5.5 0 0 0 .004-.832l-3-2.02ZM17 6a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1h13V6Z",fill:"currentColor",className:e.fillclassname})));var d,u=r(15153),m=r(15095),E=r(900752),A=r(808294),p=r(24699),_=r(627440),S=r(596731),h=r(699784),g=r(994791),C=r(191568);!function(e){e.MAIN="MAIN",e.SFP="SFP",e.AV_MANAGER="AV_MANAGER"}(d||(d={}));const O=[{icon:n.createElement(u.A,{size:"original"}),label:n.createElement(h.sA,{id:"COMMON_MAIN"}),id:d.MAIN},{icon:n.createElement(s,{size:"original"}),label:n.createElement(h.sA,{id:"COMMON_MEDIA_SFP"}),id:d.SFP},{icon:n.createElement(i,{size:"original"}),label:n.createElement(h.sA,{id:"COMMON_AV_MANAGER"}),id:d.AV_MANAGER}],f=(0,n.memo)(({selectedTab:e})=>{const{handleSectionChange:t}=(0,C.x)(),r=(()=>{const e=(0,m.A)(`${_.VO.PORTS}/:${S.On}`),{params:t}=(0,a.W5)(e)||{},r=(0,a.W6)();return(0,n.useCallback)(l=>{r.push((0,a.tW)(e,{...t||{},[S.On]:l}))},[r,e,t])})(),o=(()=>{const e=(0,l.useSelector)(g.oE),{upSfpCount:t}=(0,l.useSelector)(g.Dj),r=(0,l.useSelector)(g.CQ),a=(0,l.useSelector)(g.eu),o=(0,l.useSelector)(A.nZ),[c,s]=(0,n.useState)(a);(0,n.useEffect)(()=>{(t||e)&&s(!0)},[t,e]);const i=(0,n.useMemo)(()=>({[d.MAIN]:r,[d.SFP]:c,[d.AV_MANAGER]:o}),[r,c,o]);return(0,n.useMemo)(()=>O.filter(({id:e})=>i[e]),[i])})(),c=(0,n.useCallback)(a=>{a.id!==d.AV_MANAGER?(t(a.id),e!==d.MAIN&&e!==d.SFP&&r(p.o.PORTS)):r(p.o.AV_MANAGER)},[t,r,e]);return o.length>1?n.createElement(E.A,{tabs:o,selectedTab:e,onSelectTab:c}):null})},853699:(e,t,r)=>{r.d(t,{$V:()=>c,UE:()=>o,Vi:()=>s});var a=r(741494),l=r.n(a),n=r(874734);const o={NONE:{url:null,grain:null,grainInSeconds:null,translationKey:null},MINUTES:{url:n.FE.MINUTES,grain:3e5,grainInSeconds:300,translationKey:"GRANULARITY_5_MINUTES"},HOURLY:{url:n.FE.HOURLY,grain:36e5,grainInSeconds:3600,translationKey:"GRANULARITY_HOURLY"},DAILY:{url:n.FE.DAILY,grain:864e5,grainInSeconds:86400,translationKey:"GRANULARITY_DAILY"},MONTHLY:{url:n.FE.MONTHLY,grain:2592e6,grainInSeconds:2592e3,translationKey:"GRANULARITY_MONTHLY"}},c=(e,t,r,a)=>{const n=l()(t,e);return r&&(n<1||a&&n<=1)?o.MINUTES:n<=7?o.HOURLY:n<120?o.DAILY:o.MONTHLY},s=(e,t)=>{switch(e){case n.FE.DAILY:return`1${t({id:"COMMON_UNIT_D"})}`;case n.FE.HOURLY:return`1${t({id:"COMMON_UNIT_H"})}`;case n.FE.MINUTES:return`5${t({id:"COMMON_UNIT_MIN"})}`;default:return""}}},857828:(e,t,r)=>{r.d(t,{A:()=>A});var a=r(469733),l=r(296540),n=r(979106),o=r(540277);var c=r(208288),s=r(874807),i=r(566723),d=r(294303),u=r(602021),m=r(778085);const E=(0,r(71479).A)(m.A)`
  [data-uic-component='RangeCalendar.Container'] {
    padding: 0;
  }
`,A=({presets:e=[],selectedPreset:t,range:r,onSelectTab:m=s.P1,onSelectCustomRange:A=s.P1,showCalendar:p=!1})=>{const _=(0,a.useSelector)(u.hq),S=(0,l.useMemo)(()=>(0,c.A)(new Date,"ZonedDateTime",_),[_]),h=(0,l.useMemo)(()=>{return(e={start:(0,c.A)(r?.startDate,"ZonedDateTime",_),end:(0,c.A)(r?.endDate,"ZonedDateTime",_)}).start&&e.end?{start:(0,o.gw)(e.start),end:(0,o.gw)(e.end)}:null;var e},[r,_]),g=(0,l.useCallback)(({start:e,end:t})=>{A({startDate:e.toDate(_),endDate:t.toDate(_)})},[A,_]);return l.createElement("div",null,e.length?l.createElement(n.A,{variant:"filter",tabs:e,selectedTab:t,onSelectTab:m,stretched:!0}):null,p?l.createElement(d.A,{marginTop:i.xO},l.createElement(E,{value:h,onChange:g,maxValue:S})):null)}},871666:(e,t,r)=>{r.d(t,{$:()=>n,k:()=>l});var a=r(288006);const l={[a.vL.DISABLED]:{background:"neutral-01",border:"neutral-04",text:"neutral-07"},[a.vL.NATIVE]:{background:"neutral-01",border:"neutral-04",text:"neutral-07"},[a.vL.TAGGED]:{background:"green-06",border:"green-06",text:"neutral-00"},[a.vL.BLOCKED]:{background:"neutral-05",border:"neutral-05",text:"neutral-00"},[a.vL.WAN]:{background:"neutral-00",border:"neutral-04",text:"neutral-07"},[a.vL.UNTAGGED_NATIVE]:{background:"ublue-04",border:"ublue-04",text:"neutral-00"}},n="-"},876773:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(296540),l=r(758649),n=r(196010);const o=e=>a.createElement(l.A,{component:n.A,variant:"inline",size:"medium",...e})},900752:(e,t,r)=>{r.d(t,{A:()=>E});var a=r(296540),l=r(979106),n=r(67716),o=r(71479),c=r(566723);const s=(0,o.A)("div")`
  > nav > button {
    display: flex;
    flex-direction: row;
    gap: ${c.YC};
  }
`;var i=r(132196);const d=i.AH`
  height: 32px;
`,u=i.AH`
  padding: ${c.YC} !important;
`,m=i.AH`
  padding: ${c.YC} ${c.Ln} !important;
`,E=({selectedTab:e,tabs:t,...r})=>{const o=(0,a.useMemo)(()=>t.map(t=>e===t.id?t:{...t,label:void 0}),[t,e]);return o.length>1?a.createElement(n.T_,null,a.createElement(s,null,a.createElement(l.A,{variant:"capsule",stretched:!0,className:d,tabsClassName:d,tabClassName:u,selectedTabClassName:m,tabs:o,selectedTab:e,...r}))):null}},935780:(e,t,r)=>{r.d(t,{A:()=>f});var a=r(469733),l=r(296540),n=r(592510),o=r(525512),c=r(413914),s=r(687573),i=r(648092),d=r(906593),u=r(171073);const m=new Map,E="device-watch-mode-listener";var A=r(801081),p=r(189601),_=r(602021),S=r(602197),h=r(532419),g=r(960987);var C,O;!function(e){e.DEVICE_MAC="device_mac",e.IS_WATCHED="is_watched",e.WATCHED_TIMEOUT="watched_timeout",e.UPDATE_INTERVAL_SECONDS="update_interval_seconds"}(C||(C={})),function(e){e.INSTANCES="instances",e.TIMEOUT="timeout"}(O||(O={}));const f=e=>{const t=(0,a.useDispatch)(),r=(0,a.useSelector)((0,l.useMemo)(()=>{return t=e,(0,p.WY)()((0,A.Mz)((0,h.tG)(t),_.vc,({mac:e,state:t},r)=>e&&r&&e!==r&&t===g.A[S.g.CONNECTED]),e=>e);var t},[e])),f=(0,a.useSelector)(i.a),N=(0,l.useMemo)(()=>f[d.Uz],[f]),M=(0,l.useCallback)(e=>{N.send({type:c.E.WATCH_DEVICE,device_mac:e})},[N]),v=(0,l.useCallback)(e=>{if(e[C.IS_WATCHED]){const t=1e3*e[C.WATCHED_TIMEOUT];if(t>Date.now()){const r=m.get(e[C.DEVICE_MAC]);r&&(r[O.TIMEOUT]=setTimeout(()=>{M(e[C.DEVICE_MAC])},(e=>Math.max(e-Date.now()-5e3,5e3))(t)))}}},[M]),b=(0,l.useCallback)(e=>(0,o.K6)(e,v,!1,(e=>`${E}::${e}`)(e)),[v]);(0,l.useEffect)(()=>{if(r){Object.keys((0,o.WM)()).some(e=>e.startsWith(E))||s._[c.E.WATCH_DEVICE].map(b);const t=m.get(e);t?t[O.INSTANCES]+=1:(M(e),m.set(e,{[O.INSTANCES]:1,[O.TIMEOUT]:void 0}))}return()=>{const t=m.get(e);t&&(t[O.INSTANCES]>1?t[O.INSTANCES]-=1:(clearTimeout(t[O.TIMEOUT]),m.delete(e)),m.size||Object.keys((0,o.WM)()).filter(e=>e.startsWith(E)).forEach(o.$N))}},[M,b,e,r]),(0,l.useEffect)(()=>{t((0,u.Uc)(void 0,{crudCacheStrategy:{type:n.e.CACHE}}))},[t])}}}]);