"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[43089],{319826(e,t,r){r.d(t,{$3:()=>C,SD:()=>k,b5:()=>w,nR:()=>O,sD:()=>P,yz:()=>g});var o=r(296540),i=r(566401),n=r(217439),a=r(71479),l=r(316144),c=r(137298),s=r(6510),d=r(721332),m=r(294303),u=r(6176),p=r(703447),E=r(916537),_=r(768941),h=r(962669),A=r(757167),S=r(552020),I=r(780811),b=(r(154828),r(951106)),v=r(237628);const x=(0,a.A)(n.A)`
  padding-left: 10px;
  color: inherit;
  font-size: inherit;
`,C=({activeItem:e,networkGroups:t,rest:r,hideStatus:n=!1})=>{const{diagram:a}=(0,v.j)(e.model),_=[(0,I.D6h)(e),(0,I.bf1)(e),(0,I.Bh_)(e)],{uplinkItems:C,...w}=r||{},g=(0,I.Tl7)(e)||(0,I.kYz)(e)||(0,I.vqp)(e),P=a.length?(0,h.sT)(a,e):(0,h.oJ)(e);return P?P.flat().reduce((r,a)=>{if(!a)return r;const h=(0,I.NF$)(a.portNumber,e);if((0,i.A)(h))return r;const v=o.createElement(m.A,{alignItems:"center"},o.createElement(d.A,{cellData:h,activeItem:e,style:{minWidth:20},...w}),o.createElement(x,{isTruncated:!0},h.port_idx)),P=o.createElement(m.A,{alignItems:"center"},o.createElement(d.A,{cellData:h,activeItem:e,style:{minWidth:20},disableOnPortClick:g,portSizeOverride:"20px",...w}),o.createElement(x,{isTruncated:!0},n?h.port_idx:((e,t)=>{if(t.poe_caps&&!(0,I.C6C)(e)){const e=(0,S.Ki)(t);return e?o.createElement(E.sA,{id:e,values:{power:t.poe_power}}):""}return t.up?(0,c.ap)(t?.speed||0)||o.createElement(E.sA,{id:"DEVICE_PORT_STATE_CONNECTED"}):o.createElement(E.sA,t.enable?{id:"COMMON_DISCONNECTED"}:{id:"COMMON_DISABLED"})})(e,h))),O=(0,l.nL)(h.ifname,e,t),k="Internal"===O?.label,y=O?.id?.startsWith("LAN")||k,f=C?.find(e=>e.portIdx===h.port_idx)?.connected[0];let N=o.createElement(m.A,null);if(f){const e="device_id"in f?(0,s.Q)(f):(0,b.tn)(f),t="device_id"in f?o.createElement(u.A,{model:f.model,width:18,height:22}):o.createElement(m.A,{height:26,minWidth:22,maxWidth:22,justifyContent:"center",alignItems:"center"},o.createElement(p.A,{client:f}));N=o.createElement(m.A,{alignItems:"center"},o.createElement(m.A,{alignItems:"center",marginRight:"14px"},t),o.createElement(m.A,{alignItems:"center",flex:1},e))}const D={...h,id:h.port_idx?.toString()||h.ifname,defaultNetworkGroupLabel:(0,I.Xq1)(e,h),disabled:h.masked||(0,A.dC)(h.ifname),isInternalPort:k,isLanPort:y,isWanPort:!y,networkGroup:O?.id,portUplinkItemName:N,portStatus:P,portSymbol:v};return _.every(e=>!e)&&(D.macFilters=h.port_security_mac_address?.length),r.push(D),r},[]).sort(({port_idx:e},{port_idx:t})=>e-t):[]},w=e=>e.isWanPort,g=e=>e.isLanPort,P=e=>e.filter(({disabled:e})=>!e).map(({port_idx:e})=>String(e)),O=(e,t)=>e.map(e=>{const r=t.find(t=>e.port_idx===t.portIdx);if(!r)return e;const{rx_broadcast:o,rx_bytes:i,rx_dropped:n,rx_errors:a,rx_multicast:l,rx_packets:c,tx_broadcast:s,tx_bytes:d,tx_dropped:m,tx_errors:u,tx_multicast:p,tx_packets:E}=r;return{...e,rx_broadcast:o,rx_bytes:i,rx_dropped:n,rx_errors:a,rx_multicast:l,rx_packets:c,tx_broadcast:s,tx_bytes:d,tx_dropped:m,tx_errors:u,tx_multicast:p,tx_packets:E}}),k=e=>{const{isPoeOffSupported:t,isPoePassthroughSupported:r,isPoePassive24Supported:o,isPoeAutoSupported:i}=e,n=[];return t&&n.push(_.Gu.OFF),r&&n.push(_.Gu.PASSTHROUGH),!r&&o&&n.push(_.Gu.PASSIVE_24V),!r&&i&&n.push(_.Gu.AUTO),n}},943089(e,t,r){r.d(t,{A:()=>T});var o=r(296540),i=r(469733),n=r(71479),a=r(822336),l=r(217439),c=r(294303),s=r(916537),d=r(319826),m=r(170163),u=r(237628),p=r(953394),E=r(416381),_=r(566723),h=r(592510),A=r(678419),S=r(223792),I=r(703447),b=r(6176),v=r(6510),x=r(115829),C=r(239417),w=r(951106),g=r(532419),P=r(519564),O=r(405639);const k=(0,n.A)("div")`
  table {
    tr {
      cursor: pointer;
    }
  }
`,y=(0,n.A)("div")`
  display: grid;
  width: 100%;
  grid-template-columns: 52px 1fr 84px; // status, name, power
  gap: ${_.kc};
  text-align: left;
  padding: ${_.YC};
  border-bottom: ${({theme:{themeName:e}})=>a.Ay[`desktop-border-divider-${e}`]};
  &.active {
    background-color: ${({theme:{themeName:e}})=>a.Ay[`desktop-color-ublue-01-${e}`]};
  }
  &:not(:first-child) {
    cursor: pointer;
    &:hover {
      background-color: ${({theme:{themeName:e}})=>a.Ay[`desktop-color-neutral-01-${e}`]};
    }
  }
`,f=(0,n.A)(c.A)`
  overflow: hidden;
  align-items: center;
`,N=(0,n.A)("div")`
  margin-top: ${_.kc};
  margin-bottom: ${_.kc};
  border-radius: 8px;
  border: ${({theme:{themeName:e}})=>a.Ay[`desktop-border-divider-${e}`]};
  padding: ${_.Ln};
`,D=(0,o.memo)(({activeItem:e,hidePorts:t,onRowClick:r})=>{const n=(0,m.Ib)(e.model),{outletsDiagram:a,primaryOutletGroupCount:D}=(0,u.j)(e.model),[T,R]=(0,o.useState)(void 0),z=(0,o.useRef)(new Map),M=(0,i.useDispatch)(),L=(0,o.useMemo)(()=>(0,A.Lm)(e.mac),[e.mac]),$=(0,i.useSelector)(L),G=(0,i.useSelector)(C.Cx),V=(0,i.useSelector)(g.Kh),F=a?.length?(0,m.FP)(a,e.model):(0,m.ST)(D||0,e.model),B=(0,d.$3)({activeItem:e,networkGroups:[],rest:{position:"topRight",portSizeOverride:"20px"},hideStatus:!0});(0,o.useEffect)(()=>{M((0,E.pX)(void 0,{crudCacheStrategy:{type:h.e.CACHE}}))},[M]);const W=(0,o.useMemo)(()=>[...F.flat().filter(e=>!!e&&[p.s.STANDARD,p.s.USB].includes(e.outletType)).sort(({outletNumber:e},{outletNumber:t})=>e-t),...t?[]:B],[t,B,F]).map(t=>{const r=(0,m.o3)(e,void 0,t.outletNumber),o=(i=t.outletNumber,$.find(e=>e.power_sources.some(e=>e.power_source_type===S.F.OUTLET&&e.power_source_index===i)));var i;const a=o?(e=>{const t=V.get(e),r=t?(0,v.Q)(t):null;if(r)return r;const o=G.get(e);return(o?(0,w.tn)(o):null)||e})(o.client_mac):t.portStatus?t.name:r.name;return{...t.portStatus?t:r,id:t.portStatus?`port-${t.id}`:t.outletNumber,outletType:t.portStatus?null:void 0!==t.outletNumber?(0,m.I)(n,t.outletNumber):null,iconRotation:t?.iconRotation,name:a,powerSupervisor:o,portStatus:t.portStatus,showBatteryPowered:t?.showBatteryPowered}});return o.createElement(k,null,o.createElement(y,null,o.createElement(c.A,null),o.createElement(f,null,o.createElement(l.A,{color:"inherit",size:"medium",weight:"bold"},o.createElement(s.sA,{id:"COMMON_NAME"}))),o.createElement(c.A,null,o.createElement(l.A,{color:"inherit",size:"medium",weight:"bold"},o.createElement(s.sA,{id:"DEVICE_PROPERTIES_LABEL_POWER"})))),W.map(t=>{const i=t.index,n=t.id;return void 0===n?null:o.createElement(o.Fragment,null,o.createElement(y,{key:n,ref:e=>{e?z.current.set(n,e):z.current.delete(n)},onClick:()=>(e=>{if(e===T)return void R(void 0);R(e);const t=z.current.get(e);t&&setTimeout(()=>{t.scrollIntoView({behavior:"smooth",block:"center"})},10),r&&r(String(e))})(n),className:T===n?"active":""},o.createElement(c.A,null,o.createElement(c.A,{alignItems:"center",gap:_.kc},t.powerSupervisor?V.has(t.powerSupervisor.client_mac)?o.createElement(b.A,{model:V.get(t.powerSupervisor.client_mac).model,width:20,height:20}):G.has(t.powerSupervisor.client_mac)?o.createElement(I.A,{client:G.get(t.powerSupervisor.client_mac),width:20,height:20}):null:t.portStatus?o.createElement(l.A,{color:"inherit",size:"medium"},t.portStatus):o.createElement(o.Fragment,null,o.createElement(O.A,{iconSize:20,activeItemMac:e.mac,cellData:t,iconRotation:t.iconRotation,tooltipPlacement:"top end",showBatteryPowered:t.showBatteryPowered}),o.createElement(l.A,{color:"inherit",size:"medium"},t.index)))),o.createElement(f,null,o.createElement(x.A,{color:"inherit",size:"medium"},t.name)),o.createElement(c.A,null,o.createElement(l.A,{color:"inherit",size:"medium"},t.outlet_power?Number(t.outlet_power).toFixed(2):o.createElement(s.sA,{id:"COMMON_FALLBACK"})))),T===n?o.createElement(N,null,o.createElement(P.default,{activeItem:e,subId:String(i),onFormCancel:()=>R(void 0),onSubmitSuccess:()=>R(void 0),isInSection:!0})):null)}))},({activeItem:e},{activeItem:t})=>e.model===t.model&&e.outlet_table===t.outlet_table&&e.outlet_overrides===t.outlet_overrides),T=({activeItem:e,hidePorts:t,overrideNameHeader:r,onRowClick:i})=>o.createElement(D,{activeItem:e,hidePorts:t,overrideNameHeader:r,onRowClick:i})},721332(e,t,r){r.d(t,{A:()=>N});var o=r(296540),i=r(469733),n=r(217439),a=r(180524),l=r(968906),c=r(960407),s=r(398300),d=r(855019),m=r(548212),u=r(213601),p=r(137625),E=r(955161),_=r(845030),h=r(916537),A=r(966784),S=r(538535),I=r(768941),b=r(366188),v=r(944373),x=r(792072),C=r(962669),w=r(431247),g=r(780811),P=r(171073),O=r(460680),k=r(842235),y=r(85570);const f=({cellData:e,activeItem:t,activeItem:{mac:r,name:f,model:N},keyValue:D,portSize:T,portSizeOverride:R,disableOnPortClick:z=!1,centerIcon:M,tooltipPlacement:L="bottom"})=>{const $=(0,i.useDispatch)(),G=(0,i.useSelector)(v.D),V=(0,i.useSelector)(c.oI),F=(0,i.useSelector)(S.D5),B=e||{},W=(0,i.useSelector)(b.wf),H=(0,i.useSelector)(x.pB),Y=(0,i.useSelector)(O.qS),U=(0,A.vT)(B,t,G,F,W,H,[],Y),[j,K]=(0,o.useState)(!1),X=(0,o.useCallback)(()=>{$((0,P.Fx)({mac:r,name:f},e.port_idx)),K(!1)},[r,f,e.port_idx,$]),q=Boolean(e.poe_enable&&!(0,g.ioy)({type:t.type}));return o.createElement(E.A,{condition:q,wrapper:t=>o.createElement(p.A,{title:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_TITLE",titleValues:{portId:e.port_idx},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:K,handleConfirm:X,isOpen:j,rootClose:!0,body:o.createElement(n.A,{size:"inherit"},o.createElement(h.sA,{id:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_BODY",values:{portId:e.port_idx}}))},t)},o.createElement(a.A,{description:o.createElement(k.A,{portData:B,showPowerCycleHeader:q,portName:B.name,device:t}),delay:0,closeDelay:0,isDisabled:j,key:D,placement:L,className:y.K5},o.createElement(y.Dn,{onClick:o=>q?(K(!0),null):z||e.masked?null:(o.preventDefault(),o.stopPropagation(),(0,g.Cyy)(t)||(0,g.oWO)(t)?$((0,_.XP)({type:s.H.DEVICE,id:r,tab:V,subPanel:d.uY.PORTS,subId:B?.ifname})):$((0,_.XP)("wan"===B?.network_name||"wan2"===B?.network_name?{type:s.H.DEVICE,id:r,tab:V,subPanel:d.uY.PORTS,subId:d.uj.WAN}:B?.dns?{type:s.H.DEVICE,id:r,tab:V,subPanel:d.uY.PORTS,subId:d.uj.ALL}:{type:s.H.DEVICE,id:r,tab:V,subPanel:d.uY.PORTS,subId:B.op_mode===I.RC.AGGREGATE?B.portIdx||B.port_idx||B.ifname:(0,C.Cu)(B)}))),...l.A.addDataTestId(l.A.TestId.SIDE_PANEL_TRIGGER)},o.createElement(y.MM,{centerIcon:M,colorInfo:(0,m.PI)(U),portSize:T,portSizeOverride:R,hasTransparentBorder:(0,w._R)(e.port_idx,N)},o.createElement(u.A,{icon:U.icon,smallerIcons:!0})),(0,w.jw)(e.port_idx,N)?o.createElement(y.lh,null):null)))},N=({cellData:e,activeItem:t,keyValue:r,portSize:i,portSizeOverride:n,...a})=>e?o.createElement(f,{cellData:e,activeItem:t,keyValue:r,portSize:i,portSizeOverride:n,...a}):(0,g.ez9)(t)||(0,g.gE3)(t)?null:o.createElement(y.hK,{key:r,portSize:i,portSizeOverride:n})}}]);