"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[85653],{923515(e,t,l){l.d(t,{A:()=>i});var a=l(296540),r=l(916537),n=l(180524);const i=({isMeshing:e,isNotReady:t,children:l,hidden:i})=>a.createElement(n.A,{description:i?void 0:t?a.createElement(r.sA,{id:"COMMON_SUPERVISOR_DEVICE_STATE_NOT_AVAILABLE"}):e?a.createElement(r.sA,{id:"COMMON_DEVICE_SUPERVISOR_MESHING_DISABLED_TOOLTIP"}):void 0},a.createElement("span",null,l))},124229(e,t,l){l.d(t,{D:()=>R});var a=l(296540),r=l(592563),n=l(951272),i=l(429252),o=l.n(i),c=l(916537),m=l(816260),s=l(284428),E=l(100946),d=l(438628),_=l(294303),A=l(566723),u=l(945132);const O={heartbeat_interval:"COMMON_HEARTBEAT",silence_threshold:"COMMON_SILENCE_THRESHOLD",power_off_duration:"COMMON_POWER_OFF_DURATION"},T={heartbeat_interval:"COMMON_HEARTBEAT_TOOLTIP",silence_threshold:"COMMON_SILENCE_THRESHOLD_TOOLTIP",power_off_duration:"COMMON_POWER_OFF_DURATION_TOOLTIP"},p=(0,a.memo)(({field:e})=>{const{values:t,setFieldValue:l}=(0,n.j7)(),r=(0,s.mQ)(),i=e.split(".").pop(),o=t.powerSupervisor.settings[i]/u.gG,p=m.KP[i]/u.gG,R=m.Av[i]/u.gG;return a.createElement(_.A,{gap:A.kc,width:"100%"},a.createElement(_.A,{width:"100%"},a.createElement(E.A,{style:{width:"100%"},value:o,onChange:t=>l(e,Number(t)*u.gG),minValue:p,maxValue:R,label:a.createElement(c.sA,{id:O[i]}),labelProps:{tooltipMessage:a.createElement(c.sA,{id:T[i]}),isTooltipDisabled:r},isDisabled:r})),a.createElement(_.A,{style:{maxWidth:"105px"}},a.createElement(d.A,{type:"number",value:o,variant:"secondary",contentAfter:a.createElement(c.sA,{id:"COMMON_UNIT_MIN"}),onChange:t=>{l(e,Number(t.target.value)*u.gG)},min:p,max:R,disabled:r})))}),R=()=>{const{values:e,setFieldValue:t}=(0,n.j7)(),l=(0,a.useMemo)(()=>o()((0,n.O6)(e,"powerSupervisor.settings"),m.R4),[e]),i=(0,s.mQ)();return a.createElement(_.A,{flexDirection:"column",gap:A.kc,alignItems:"flex-start"},a.createElement(p,{field:"powerSupervisor.settings.heartbeat_interval"}),a.createElement(p,{field:"powerSupervisor.settings.silence_threshold"}),a.createElement(r.A,{onClick:()=>{t("powerSupervisor.settings.heartbeat_interval",m.R4.heartbeat_interval),t("powerSupervisor.settings.silence_threshold",m.R4.silence_threshold),t("powerSupervisor.settings.power_off_duration",m.R4.power_off_duration)},fontSize:"medium",isDisabled:l||i},a.createElement(c.sA,{id:"COMMON_ACTION_RESET_TO_DEFAULT"})))}},92069(e,t,l){l.d(t,{be:()=>i,i3:()=>n,r8:()=>r});var a=l(816260);const r="powerForm",n="new",i={id:n,site_id:"",enabled:!1,client_mac:"",power_sources:[],settings:a.R4}},690198(e,t,l){l.r(t),l.d(t,{default:()=>D});var a=l(82960),r=l(469733),n=l(296540),i=l(951272),o=l(271856),c=l(217439),m=l(392659),s=l(162420),E=l(350312),d=l(132196),_=l(742920),A=l(870443),u=l(960407),O=l(398300),T=l(566723),p=l(551753),R=l(143811),C=l(294303),I=l(734707),v=l(689965),b=l(845030),P=l(916537),S=l(170163),g=l(56437),M=l(171073),h=l(373229);const N=d.AH`
  padding: 0 !important;
  gap: ${T.kc};
`,y=(0,i.bk)({enableReinitialize:!0,mapPropsToValues:({outletInfo:{name:e,port_mode:t}})=>({name:e||"",portModeAuto:t===g.c.AUTO}),validationSchema:A.A.object().shape({name:A.A.string().label("COMMON_NAME").max(32),portModeAuto:A.A.boolean()}),handleSubmit:({portModeAuto:e,...t},{props:{outletInfo:l,updateDeviceWithIdEndpoint:a,activeItem:{rps_override:r,mac:n,_id:i},propertyPanelActiveItemTab:o,showPropertyPanel:c}})=>{a({rps_override:{...r,rps_port_table:[{port_idx:l.port_idx,port_mode:e?g.c.AUTO:g.c.DISABLED,...t},...(r?.rps_port_table||[]).filter(e=>e.port_idx!==l.port_idx)||[]]}},i,n,{failureToast:{icon:_.C.danger,message:"DEVICE_OUTLET_FORM_SAVE_ERROR"},mergeAndOverrideKeys:["rps_override"],extend:!0}).then(()=>c({type:O.H.DEVICE,id:n,tab:o}))}}),D=(0,a.Zz)((0,r.connect)((e,{activeItem:t,isInSection:l,subId:a})=>({outletInfo:(0,S.Z4)(t,l?+a:+(0,u.Oh)(e)),propertyPanelActiveItemTab:(0,u.oI)(e)}),{updateDeviceWithIdEndpoint:M.ex,showPropertyPanel:b.XP}),y)(({activeItem:e,dirty:t,submitForm:l,outletInfo:a,resetForm:i,isInSection:d,goBack:_})=>{const A=(0,r.useDispatch)(),S=(0,r.useSelector)(u.oI),g=(0,n.useCallback)(()=>{i(),d?_():A((0,b.XP)({type:O.H.DEVICE,id:e.mac,tab:S}))},[A,i,e.mac,S,_,d]);return n.createElement(v.A,{padding:d?"0":void 0,marginBottom:d?"0":void 0},n.createElement(C.A,{alignItems:"center",marginBottom:T.Ln,gap:T.kc},n.createElement(E.A,{onClick:g,style:{cursor:"pointer"}}),n.createElement(c.A,{weight:"bold",color:"text-1"},a.name)),n.createElement(C.A,{marginBottom:T.Ln},n.createElement(R.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_NAME"})),n.createElement(C.A,{marginBottom:T.Ln,alignItems:"center"},n.createElement(R.A,{type:"realCheckbox",name:"portModeAuto"},n.createElement(P.sA,{id:"COMMON_OUTLET_POWER"})),n.createElement(o.A,{style:{marginLeft:T.YC},width:208,description:n.createElement(P.sA,{id:"DEVICE_PROPERTIES_OUTLET_RELAY_STATE_LABEL_DESCRIPTION"})},n.createElement(s.A,{isActive:!0,size:"original"}))),n.createElement(p.A,{variant:"info",nested:!0,padding:T.kc,margin:"0"},n.createElement(c.A,{weight:"bold"},n.createElement(P.sA,{id:"DEVICE_PROPERTIES_RPS_PORT_RECOVERY"}),". "),n.createElement(P.sA,{id:"DEVICE_PROPERTIES_RPS_PORT_RECOVERY_DESCRIPTION"})),n.createElement(C.A,{marginTop:T.Ln,justifyContent:"space-between",alignItems:"center"},n.createElement(I.Ay,{variant:"link",disabled:!a.port_error_disabled,onClick:()=>A((0,M.C4)(e,a)),Icon:n.createElement(m.A,null)},n.createElement(P.sA,{id:"DEVICE_ACTIONS_PORT_RECOVERY"})),n.createElement(h.A,{isDirty:t,onFormSubmit:l,onFormCancel:g,allowCancel:!0,className:N})))})},34662(e,t,l){l.d(t,{A:()=>S});var a=l(469733),r=l(296540),n=l(217439),i=l(705145),o=l(963070),c=l(897547),m=l(71479),s=l(960407),E=l(398300),d=l(855019),_=l(294303),A=l(955161),u=l(689965),O=l(845030),T=l(916537),p=l(170163),R=l(56437),C=l(436953),I=l(325530);const v=(0,m.A)(c.A)`
  position: absolute;
  right: 8px;
  color: inherit;
`,b=(0,m.A)("div")`
  table {
    tr {
      cursor: pointer;
    }
  }
`,P=e=>r.createElement(u.A,null,e),S=({activeItem:e,onRowClick:t,isInSection:l})=>{const c=(0,a.useDispatch)(),m=(0,a.useSelector)(s.oI),u=e.rps?.rps_port_table?.map(({port_idx:t})=>({id:t,...(0,p.Z4)(e,t)})),S=(0,r.useCallback)(({id:l})=>{u.some(({port_state:e})=>e)&&(t?t(String(l)):c((0,O.XP)({type:E.H.DEVICE,id:e.mac,tab:m,subPanel:d.uY.RPS_OUTLETS,subId:String(l)})))},[e.mac,m,c,u,t]),g=(0,r.useMemo)(()=>{return t=e.mac,[{id:"name",label:r.createElement(T.sA,{id:"COMMON_NAME"}),renderCell:({name:e})=>r.createElement(i.A,{color:"inherit",size:"medium",isTruncated:!0},e)},{id:"outletStatus",label:r.createElement(T.sA,{id:"COMMON_STATUS"}),width:45,renderCell:e=>{let l;return e.port_mode===R.c.DISABLED&&(l="COMMON_DISABLED"),e.port_state&&(l=(0,I.x)(e.port_state)),r.createElement(r.Fragment,null,r.createElement(_.A,{alignItems:"center"},r.createElement(C.A,{activeItemMac:t,cellData:e,isTableItem:!0}),r.createElement(n.A,{color:"inherit",size:"medium"},r.createElement(T.sA,{id:l||"COMMON_INITIALIZING"}),l?null:r.createElement(n.A,{color:"inherit",size:"medium"},"..."))),r.createElement(v,{size:"small"}))}}];var t},[e.mac]);return u?.length?r.createElement(A.A,{condition:!l,wrapper:P},r.createElement(b,null,r.createElement(o.A,{columns:g,items:u,disableColumnFilters:!0,hideCellOverflow:!1,onRowClick:S,truncateHeaderCells:!0}))):null}},325530(e,t,l){l.d(t,{x:()=>r});var a=l(56437);const r=e=>{switch(e){case a.e.INITIALIZING:return"COMMON_INITIALIZING";case a.e.DISCONNECTED:return"COMMON_DISCONNECTED";case a.e.SEARCHING:return"COMMON_SEARCHING";case a.e.BOUND:return"DEVICE_PROPERTIES_RPS_TOOLTIP_VALUE_STATE_BOUND";case a.e.STANDBY:return"COMMON_ENABLED";case a.e.POWER_DELIVERING:return"DEVICE_PROPERTIES_RPS_TOOLTIP_VALUE_STATE_POWER_DELIVERING";case a.e.OUT_OF_POWER_BUDGET:return"DEVICE_PROPERTIES_RPS_TOOLTIP_VALUE_STATE_OUT_OF_POWER_BUDGET";case a.e.POWER_OVERLOAD:return"DEVICE_PROPERTIES_RPS_TOOLTIP_VALUE_STATE_POWER_OVERLOAD";case a.e.BLOCKED:return"COMMON_BLOCKED";default:return"COMMON_UNKNOWN"}}},15532(e,t,l){l.d(t,{A:()=>o});var a=l(296540),r=l(217439),n=l(916537),i=l(360113);const o=({has_fan:e,fan_level:t})=>e&&Number.isFinite(t)?a.createElement(i.A,null,a.createElement(r.A,{color:"text-2",size:"medium"},a.createElement(n.sA,{id:"DEVICE_PROPERTY_OVERVIEW_FAN_LEVEL"})),a.createElement(r.A,{color:"text-3",size:"medium"},t)):null},205830(e,t,l){l.d(t,{A:()=>E});var a=l(296540),r=l(217439),n=l(83438),i=l(566723),o=l(294303),c=l(916537),m=l(780811),s=l(360113);const E=({sys_stats:e,flexProps:t,withTooltip:l,compact:E=!1})=>{const d=(0,m.eiG)(e);return d?a.createElement(s.A,{flexProps:t,compact:E},a.createElement(r.A,{color:"text-2",size:"medium"},a.createElement(c.sA,{id:"COMMON_LOAD_AVERAGE"})),l?a.createElement(o.A,{alignItems:"center",gap:i.YC},a.createElement(r.A,{color:"text-3",size:"medium"},d),a.createElement(n.A,{description:a.createElement(c.sA,{id:"DEVICE_PROPERTY_OVERVIEW_LOAD_AVERAGE_TOOLTIP"}),placement:"top start"})):a.createElement(r.A,{color:"text-3",size:"medium"},d)):null}},32753(e,t,l){l.d(t,{A:()=>c});var a=l(296540),r=l(217439),n=l(916537),i=l(780811),o=l(360113);const c=({systemStatsMem:e,compact:t=!1})=>{const l=(0,i.HBQ)(e);return l?a.createElement(o.A,{compact:t},a.createElement(r.A,{color:"text-2",size:"medium"},a.createElement(n.sA,{id:"DEVICE_PROPERTY_OVERVIEW_MEMORY_USAGE"})),a.createElement(r.A,{color:"text-3",size:"medium"},l,"%")):null}},436953(e,t,l){l.d(t,{A:()=>y});var a=l(296540),r=l(469733),n=l(271856),i=l(217439),o=l(705145),c=l(71479),m=l(273299),s=l(6510),E=l(968906),d=l(960407),_=l(398300),A=l(566723),u=l(855019),O=l(213601),T=l(294303),p=l(845030),R=l(916537),C=l(170163),I=l(56437),v=l(532419),b=l(167579),P=l(325530),S=l(311785);const g=(0,c.A)(n.A,(0,S.A)("color","isTableItem"))`
  width: ${({isTableItem:e})=>e?"20px":"90px"};
  height: ${({isTableItem:e})=>e?"20px":"18px"};
  align-items: center;
  background-color: ${({color:e,theme:{motifPalette:t}})=>t[e]};
  border-radius: 2px;
  color: #fff;
  justify-content: center;
  display: flex;
  position: relative;
  ${({isTableItem:e})=>e&&"margin-right: 8px;"}

  border: ${({theme:{motifPalette:e},borderColor:t})=>t?`1px solid ${e[t]}`:"none"};

  &:not(:first-child) {
    margin-left: ${A.YC};
  }
`,M=(0,c.A)("div")`
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;

  svg {
    max-width: 70%;
    max-height: 70%;
  }
`,h=(0,c.A)("div")`
  width: initial;
  position: relative;
  height: 100%;

  > div {
    position: initial;
    width: 18px;
  }
`,N=(0,c.A)(i.A)`
  max-width: 140px;
`,y=({activeItemMac:e,cellData:t,isTableItem:l=!1,multiIcon:n,disableOnPortClick:c})=>{const S=(0,r.useDispatch)(),y=(0,r.useSelector)(d.oI),D=(0,r.useSelector)(v.ID).find(e=>e.mac===t.peer?.mac),x=(0,s.Q)(D),w=(0,s.Lm)(D?.model)||t.peer?.model,f=(0,C.Yf)(t),L=(0,C.Yk)(t),G=(0,C.AD)(t),V=(0,C.y$)(t),B=(0,a.useCallback)(l=>{l?.preventDefault?.(),l?.stopPropagation?.(),c||S((0,p.XP)({type:_.H.DEVICE,id:e,tab:y,subPanel:u.uY.RPS_OUTLETS,subId:String(t.port_idx)}))},[S,y,e,t.port_idx,c]);return a.createElement(g,{color:G,borderColor:V,onClick:B,width:D?240:200,isTableItem:l,...E.A.addDataTestId(E.A.TestId.SIDE_PANEL_TRIGGER),description:a.createElement(T.A,{flexDirection:"column",justifyContent:"space-between",width:"100%"},t?.port_state===I.e.OUT_OF_POWER_BUDGET?a.createElement(T.A,{marginBottom:A.kc},a.createElement(i.A,{size:"small",weight:"bold"},a.createElement(R.sA,{id:"DEVICE_PROPERTIES_RPS_TOOLTIP_VALUE_STATE_OUT_OF_POWER_BUDGET_DESCRIPTION",values:{peer:x||a.createElement(R.sA,{id:"COMMON_DEVICE"})}}))):null,a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_PORT"})),a.createElement(i.A,{size:"small",color:"text-2"},t.port_idx)),a.createElement(T.A,{justifyContent:"space-between",alignItems:"center",gap:A.YC},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_NAME"})),a.createElement(o.A,{size:"small",color:"text-2",isTruncated:!0},t?.name)),t?.port_mode?a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_MODE"})),a.createElement(i.A,{size:"small",color:"text-2"},(0,m.Z)(t.port_mode))):null,t?.port_state?a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_STATE"})),a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:(0,P.x)(t.port_state)}))):null,t?.up?b.A.map(e=>a.createElement("div",{key:e},a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2",weight:"bold"},a.createElement(R.sA,{id:"COMMON_UNIT_VOLTAGE_SHORT",values:{value:e}}))),a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_CURRENT"})),a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_UNIT_AMPERES_SHORT",values:{value:t[`power_${e}v_current`]}}))),a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_VOLTAGE"})),a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_UNIT_VOLTAGE_SHORT",values:{value:t[`power_${e}v_voltage`]}}))),a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_POWER"})),a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:t[`power_${e}v_power`]}}))))):null,t.peer||D?a.createElement(a.Fragment,null,a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2",weight:"bold"},a.createElement(R.sA,{id:"DEVICE_PROPERTIES_RPS_TOOLTIP_PEER"}))),x||t.peer?.hostname?a.createElement(T.A,{justifyContent:"space-between",gap:A.YC},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_NAME"})),a.createElement(N,{size:"small",color:"text-2",isTruncated:!0},x||t.peer?.hostname)):null,t.peer.mac?a.createElement(T.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_MAC"})),a.createElement(i.A,{size:"small",color:"text-2"},t.peer.mac)):null,w?a.createElement(T.A,{justifyContent:"space-between",gap:A.YC},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_MODEL"})),a.createElement(N,{size:"small",color:"text-2",isTruncated:!0},w)):null,b.A.map(e=>a.createElement(T.A,{key:e,justifyContent:"space-between"},a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"DEVICE_PROPERTIES_RPS_TOOLTIP_PEER_POWER_REQUIRED",values:{voltage:e}})),a.createElement(i.A,{size:"small",color:"text-2"},a.createElement(R.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:t.peer?.[`power_required_${e}v`]}}))))):null),portal:!0},n?a.createElement(a.Fragment,null,L.map(e=>a.createElement(h,{key:e},a.createElement(O.A,{icon:e,smallerIcons:!0})))):a.createElement(M,null,t.port_mode!==I.c.DISABLED?a.createElement(O.A,{icon:f,smallerIcons:!0}):null))}},175734(e,t,l){l.d(t,{A:()=>O});var a=l(296540),r=l(162420),n=l(71479),i=l(566723),o=l(294303),c=l(916537),m=l(170163),s=l(237628),E=l(436953);const d=(0,n.A)(o.A)`
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
`,_=(0,n.A)(o.A)`
  &:not(:first-child) {
    margin-top: ${i.YC};
  }
`,A=(0,n.A)(r.A)`
  margin-right: ${i.xO};
`,u=(0,n.A)("div")`
  width: 5px;
`,O=({activeItem:e,activeItem:{model:t,mac:l},multiIcon:r,disableOnPortClick:n})=>{const{rps:{diagram:i,primaryPortGroupCount:o}}=(0,s.j)(t),O=i.length?(0,m.FP)(i,e.model):(0,m.ST)(o,e.model);return O&&0!==O.length?a.createElement(a.Fragment,null,O.map((t,i)=>a.createElement(_,{justifyContent:"center",width:"100%",key:`RpsOutletLayoutRow-${i+1}`},t.map((t,o)=>t?a.createElement(E.A,{activeItemMac:l,cellData:(0,m.Z4)(e,t.outletNumber),key:`RpsOutlet-${i+1}-${o+1}`,multiIcon:r,disableOnPortClick:n}):a.createElement(u,{key:`RpsOutletSpacer-${i+1}-${o+1}`}))))):a.createElement(d,null,a.createElement(A,{isActive:!0}),a.createElement(c.sA,{id:"DEVICE_DIAGRAM_MISSING"}))}},794751(e,t,l){l.r(t),l.d(t,{default:()=>Rt});var a=l(296540),r=l(566723),n=l(294303),i=l(837612),o=l(175734),c=l(799552),m=l(377588),s=l(406816),E=l(812454),d=l(86571),_=l(916537),A=l(822336),u=l(956347),O=l(469733),T=l(217439),p=l(963070),R=l(758649),C=l(176484),I=l(141979),v=l(948177),b=l(71479),P=l(382389),S=l(311785),g=l(960407),M=l(860631),h=l(398300),N=l(855019),y=l(845030),D=l(854726),x=l(366188),w=l(780811),f=l(532419),L=l(319826),G=l(705145),V=l(897547);const B=(0,b.A)(V.A)`
  margin-right: ${r.kc};
  color: inherit;
`,U=e=>[{id:"portName",label:a.createElement(_.sA,{id:"DEVICE_PROPERTIES_LABEL_ETHERNET_PORT"}),renderCell:({portName:e})=>a.createElement(G.A,{size:"medium",color:"inherit",isTruncated:!0},e)},{id:"portStatus",width:45,label:a.createElement(_.sA,{id:"COMMON_STATUS"}),renderCell:({portStatus:t,isInternalPort:l})=>a.createElement(n.A,{justifyContent:"space-between",width:"100%",alignItems:"center"},a.createElement(G.A,{color:"inherit",size:"medium",isTruncated:!0},t),e||l?null:a.createElement(B,{size:"small"}))}];var k=l(271856),W=l(773412),F=l(396660),Y=l(903216),z=l(137298),$=l(501103),X=l(445772),H=l(962669),j=l(431247),K=l(552020),Z=l(987552);const Q=({id:e})=>a.createElement(T.A,{size:"medium",color:"inherit",weight:"bold"},a.createElement(_.sA,{id:e})),q=({value:e,color:t})=>a.createElement(G.A,{size:"medium",color:"inherit",style:{color:t},isTruncated:!0},e),J=({formatMessage:e,portConfig:t,txColor:l,rxColor:i})=>[{id:Z.yG.PORT_SYMBOL,minWidth:85,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_SYMBOL]}),renderCell:({portSymbol:e})=>a.createElement(q,{value:e}),sortable:!0,compare:(0,F.l0)(e=>e?.port_idx)},{id:Z.yG.PORT_NAME,minWidth:140,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_NAME]}),renderCell:({portName:e})=>a.createElement(q,{value:e}),sortable:!0,compare:(0,F.l0)(e=>e?.name)},{id:Z.yG.PORT_UPLINK_ITEM_NAME,minWidth:180,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_UPLINK_ITEM_NAME]}),renderCell:({portUplinkItemName:e})=>a.createElement(q,{value:e})},{id:Z.yG.PORT_POE_MODE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_MODE]}),renderCell:e=>{const t=(0,K.Ki)(e);return t?a.createElement(_.sA,{id:t,values:{power:e.poe_power}}):""}},{id:Z.yG.PORT_POE_DETECTION,minWidth:130,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_DETECTION]}),renderCell:e=>a.createElement(q,{value:(0,K.bK)(e)})},{id:Z.yG.PORT_POE_CLASS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_CLASS]}),renderCell:({poe_class:e,...t})=>(0,K.Gl)(t)?a.createElement(q,{value:e}):null,sortable:!0,compare:(0,F.l0)(e=>e?.poe_class)},{id:Z.yG.PORT_POE_POWER,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_POWER]}),renderCell:({poe_power:e,...t})=>(0,K.Gl)(t)?a.createElement(q,{value:a.createElement(_.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:e}})}):null,sortable:!0,compare:(0,F.l0)(e=>e?.poe_power)},{id:Z.yG.PORT_POE_VOLTAGE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_VOLTAGE]}),renderCell:({poe_voltage:e,...t})=>(0,K.Gl)(t)||(0,H.sz)(t)?a.createElement(q,{value:a.createElement(_.sA,{id:"COMMON_UNIT_VOLTAGE_SHORT",values:{value:e}})}):null,sortable:!0,compare:(0,F.l0)(e=>e?.poe_voltage)},{id:Z.yG.PORT_POE_CURRENT,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_POE_CURRENT]}),renderCell:({poe_current:e,...t})=>(0,K.Gl)(t)?a.createElement(q,{value:a.createElement(_.sA,{id:"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_CURRENT",values:{current:e}})}):null,sortable:!0,compare:(0,F.l0)(e=>e?.poe_current)},{id:Z.yG.PORT_OPERATION_MODE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_OPERATION_MODE]}),renderCell:t=>a.createElement(q,{value:(0,H.WR)(t,e)})},{id:Z.yG.PORT_PROFILE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_PROFILE]}),renderCell:e=>a.createElement(q,{value:(0,j.Hn)(e,t)})},{id:Z.yG.SPEED,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.SPEED]}),renderCell:({autoneg:e,speed:t,up:l})=>!t||!l&&e?null:a.createElement(q,{value:(0,Y.ir)(t)}),sortable:!0,compare:(0,F.l0)(e=>e?.speed)},{id:Z.yG.PORT_LINK_STATUS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_LINK_STATUS]}),renderCell:t=>a.createElement(q,{value:(0,H.m3)(t,e)}),sortable:!0,compare:(0,F.l0)(e=>e?.speed)},{id:"portStp",minWidth:110,label:a.createElement(Q,{id:"DEVICE_PROPERTIES_LABEL_STP"}),renderCell:e=>a.createElement(q,{value:(0,H.tx)(e)})},{id:Z.yG.PORT_ACTIVITY,minWidth:160,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_ACTIVITY]}),renderCell:e=>{const t=(0,j.m0)(e);return e.up?a.createElement(n.A,{flexDirection:"column",flex:1,paddingRight:r.xO},a.createElement(k.A,{width:112,portal:!0,description:a.createElement(n.A,{flexDirection:"column"},a.createElement(n.A,{justifyContent:"space-between"},a.createElement(n.A,{alignItems:"center",gap:r.YC},a.createElement($.A.Box,null),a.createElement(_.sA,{id:"COMMON_TX"})),(0,j.V4)(t),"%"),a.createElement(n.A,{justifyContent:"space-between"},a.createElement(n.A,{alignItems:"center",gap:r.YC},a.createElement(X.A.Box,null),a.createElement(_.sA,{id:"COMMON_RX"})),(0,j.V4)(t),"%"))},a.createElement(W.A,{items:[{color:l,value:(0,j.hb)((0,j.Sz)(e))}],height:4,style:{borderRadius:"2px"}}),a.createElement(W.A,{items:[{color:i,value:(0,j.hb)(t)}],height:4,style:{borderRadius:"2px"}}))):null}},{id:Z.yG.PORT_TX,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX]}),renderCell:({tx_bytes:e})=>a.createElement(q,{value:(0,z.z3)(e,3),color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_bytes)},{id:Z.yG.PORT_RX,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX]}),renderCell:({rx_bytes:e})=>a.createElement(q,{value:(0,z.z3)(e,3),color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_bytes)},{id:Z.yG.PORT_TX_BYTES,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_BYTES]}),renderCell:({tx_bytes:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_bytes)},{id:Z.yG.PORT_RX_BYTES,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_BYTES]}),renderCell:({rx_bytes:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_bytes)},{id:Z.yG.PORT_TX_PACKETS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_PACKETS]}),renderCell:({tx_packets:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_packets)},{id:Z.yG.PORT_RX_PACKETS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_PACKETS]}),renderCell:({rx_packets:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_packets)},{id:Z.yG.PORT_TX_MULTICAST,minWidth:120,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_MULTICAST]}),renderCell:({tx_multicast:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_multicast)},{id:Z.yG.PORT_RX_MULTICAST,minWidth:120,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_MULTICAST]}),renderCell:({rx_multicast:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_multicast)},{id:Z.yG.PORT_TX_BROADCAST,minWidth:120,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_BROADCAST]}),renderCell:({tx_broadcast:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_broadcast)},{id:Z.yG.PORT_RX_BROADCAST,minWidth:120,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_BROADCAST]}),renderCell:({rx_broadcast:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_broadcast)},{id:Z.yG.PORT_TX_ERRORS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_ERRORS]}),renderCell:({tx_errors:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_errors)},{id:Z.yG.PORT_RX_ERRORS,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_ERRORS]}),renderCell:({rx_errors:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_errors)},{id:Z.yG.PORT_TX_DROPPED,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_DROPPED]}),renderCell:({tx_dropped:e})=>a.createElement(q,{value:e,color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.tx_dropped)},{id:Z.yG.PORT_RX_DROPPED,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_DROPPED]}),renderCell:({rx_dropped:e})=>a.createElement(q,{value:e,color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.rx_dropped)},{id:Z.yG.PORT_TX_RATE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_TX_RATE]}),renderCell:({"tx_bytes-r":e})=>a.createElement(q,{value:(0,z.zX)(e),color:l}),sortable:!0,compare:(0,F.l0)(e=>e?.["tx_bytes-r"])},{id:Z.yG.PORT_RX_RATE,minWidth:110,label:a.createElement(Q,{id:Z.sF[Z.yG.PORT_RX_RATE]}),renderCell:({"rx_bytes-r":e})=>a.createElement(q,{value:(0,z.zX)(e),color:i}),sortable:!0,compare:(0,F.l0)(e=>e?.["rx_bytes-r"])}],ee=(0,b.A)("div")`
  width: 100%;
  height: 100%;
  overflow-x: auto;

  ::-webkit-scrollbar-thumb {
    min-height: 3em;
  }

  .selectedRowClassName {
    background: ${({theme:{themeName:e}})=>A.Ay[`desktop-color-neutral-01-${e}`]};
  }

  .headerRowHidden {
    display: none;
  }
`,te=(0,b.A)(R.A)`
  font-size: ${({theme:{fontSizes:e}})=>e[2]}px;
  margin-top: 16px;
  justify-content: flex-end;
  svg {
    height: 14px;
    width: 13px;
  }
`,le=(0,b.A)("div")`
  margin-bottom: 32px;
`,ae=(0,b.A)(n.A,(0,S.A)("fullData"))`
  position: sticky;
  left: 0;
  align-items: center;
  margin-bottom: ${({fullData:e})=>e?16:0}px;
`,re=(0,b.A)(T.A)`
  margin-left: ${({theme:{spacing:e}})=>e["spacing-s"]};
`,ne=({activeItem:e,deviceInsightsPorts:t=[],portManagementSearch:l=[],isPortManagementVariant:r=!1,columnOverride:n=[],onPortOpen:i,onPortsSelect:o})=>{const c=(0,O.useDispatch)(),m=(0,u.W6)(),{params:s,path:E}=(0,u.W5)(),{formatMessage:d}=(0,_.tz)(),T=(0,M.jP)(e),R=(0,w.moU)(e),b=(0,w.m_j)(e),S=(0,O.useSelector)(x.LV),G=(0,O.useSelector)(D.wD),V=(0,O.useSelector)(g.oI),B=(0,O.useSelector)((0,f.jf)(e)),{themeName:k,motifPalette:{purple06:W}}=(0,P.u)(),F=(0,a.useMemo)(()=>({txColor:W,rxColor:A.Ay[`desktop-color-aqua-06-${k}`]}),[W,k]),Y=(0,a.useMemo)(()=>r&&!!o,[r,o]),[z,$]=(0,a.useState)([]),[X,H]=(0,a.useState)([]);(0,a.useEffect)(()=>{Y&&o([...z,...X])},[Y,o,z,X]);const j=({port_idx:t,masked:l,isInternalPort:a})=>{i?i(t,!0):Y||!l&&!a&&c((0,y.XP)({type:h.H.DEVICE,id:e.mac,tab:V,subPanel:N.uY.PORTS,subId:String(t)}))},K=({port_idx:e})=>{i?i(e,!0):Y||m.push((0,u.tW)(E,{site:s.site,page:s.page,id:s.id,panel:s.panel,subPanel:"ports",subPanelId:N.uj.WAN}))},Z=(0,a.useMemo)(()=>r?J({formatMessage:d,portConfig:G,...F}):U(),[r,d,G,F]),Q=(0,a.useMemo)(()=>(0,L.nR)((0,L.$3)({activeItem:e,networkGroups:S,rest:{uplinkItems:B,portSizeOverride:"20px"}}),t).filter(e=>!l.length||l.includes(e.portIdx)),[e,S,t,l,B]),q=(0,a.useMemo)(()=>Q.filter(L.yz),[Q]),ne=(0,a.useMemo)(()=>Q.filter(L.b5),[Q]),ie=(0,a.useMemo)(()=>(0,L.sD)(Q),[Q]),oe=(0,a.useMemo)(()=>(0,L.sD)(q),[q]),ce=(0,a.useMemo)(()=>(0,L.sD)(ne),[ne]);if((0,a.useEffect)(()=>{b?H(ce):R?($(oe),H(ce)):$(ie)},[]),R){const e=r?J({formatMessage:d,portConfig:G,...F}):U(T);return a.createElement(ee,null,r?null:a.createElement(le,null),q.length?a.createElement(a.Fragment,null,a.createElement(ae,{fullData:r},a.createElement(v.A,{omitSvgMargin:!0}),a.createElement(re,{weight:"bold",color:"text-1",size:"medium"},a.createElement(_.sA,{id:"DEVICE_PORTS_TABLE_LAN_PORTS"}))),a.createElement(p.A,{hideCellOverflow:!1,columns:Z,columnOverride:n,disableColumnFilters:!0,items:q,onRowClick:j,multiSelectMode:Y,rowSelectedClassName:"selectedRowClassName",onChangeSelection:$,initialSelectedIds:oe})):null,q.length&&ne.length?a.createElement(le,null):null,ne.length?a.createElement(a.Fragment,null,a.createElement(ae,{fullData:r},a.createElement(C.A,{omitSvgMargin:!0}),a.createElement(re,{weight:"bold",color:"text-1",size:"medium"},a.createElement(_.sA,{id:"DEVICE_PORTS_TABLE_WAN_PORTS"}))),a.createElement(p.A,{hideCellOverflow:!1,columns:e,columnOverride:n,headerRowClassName:q.length?"headerRowHidden":"",disableColumnFilters:!0,disableTextPointer:T,items:ne,onRowClick:!T||r?K:null,multiSelectMode:Y,rowSelectedClassName:"selectedRowClassName",disableSelection:!Y&&T,onChangeSelection:H,initialSelectedIds:ce})):null,T&&!r?a.createElement(te,{variant:"link",onClick:K,Icon:a.createElement(I.A,{isActive:!0})},a.createElement(_.sA,{id:"DEVICE_PORTS_TABLE_CONFIGURE_INTERFACES"})):null)}return a.createElement(ee,null,a.createElement(p.A,{hideCellOverflow:!1,columns:Z,columnOverride:n,disableColumnFilters:!0,items:Q,onRowClick:b?void 0:j,multiSelectMode:Y,rowSelectedClassName:"selectedRowClassName",onChangeSelection:b?H:$,initialSelectedIds:ie}))},ie=({activeItem:e,onPortOpen:t})=>a.createElement(ne,{activeItem:e,onPortOpen:t});var oe,ce=l(360694),me=l(34662),se=l(690198),Ee=l(519564),de=l(943089),_e=l(689965);!function(e){e.Outlet="outlet",e.Power="power",e.EthernetPort="ethernetPort"}(oe||(oe={}));const Ae=({activeItem:e})=>{const{formatMessage:t}=(0,_.tz)(),[l,n]=(0,a.useState)(null),[i,o]=(0,a.useState)(""),c=(0,a.useCallback)(()=>{n(null),o("")},[]);return a.createElement(_e.A,{type:_e.I.ACCORDION,items:[{id:"ports",label:a.createElement(d.A,{id:"COMMON_PORTS"}),openByDefault:!0,renderContent:()=>a.createElement(a.Fragment,null,l?null:a.createElement(a.Fragment,null,a.createElement(me.A,{isInSection:!0,activeItem:e,onRowClick:e=>{n(oe.Outlet),o(e)}}),a.createElement("div",{style:{marginTop:r.Ln}},a.createElement(ie,{activeItem:e,onPortOpen:e=>{n(oe.EthernetPort),o(String(e))}})),a.createElement("div",{style:{marginTop:r.Ln}},a.createElement(de.A,{hidePorts:!0,activeItem:e,overrideNameHeader:t({id:"COMMON_OUTLETS"}),onRowClick:e=>{n(oe.Power),o(e)}}))),l?a.createElement(a.Fragment,null,l===oe.Outlet?a.createElement(se.default,{activeItem:e,goBack:c,subId:i,isInSection:!0}):null,l===oe.EthernetPort?a.createElement(ce.default,{activeItem:e,goBack:c,subId:i,isInSection:!0}):null,l===oe.Power?a.createElement(Ee.default,{activeItem:e,goBack:c,subId:i,isInSection:!0}):null):null)}]})};var ue=l(999063),Oe=l(32753),Te=l(723544),pe=l(205830),Re=l(400242),Ce=l(15532),Ie=l(57759),ve=l(146784);const be=({name:e,model:t,ip:l,lan_ip:r,ipv6:n,mac:i,displayable_version:o,uptime:c,has_fan:m,fan_level:s,sys_stats:E,systemStatsMem:d,type:_,deviceState:A,ethernet_overrides:u,port_table:O})=>a.createElement(_e.A,null,a.createElement(Re.A,{ip:l,lan_ip:r,type:_,ethernet_overrides:u,port_table:O}),a.createElement(ve.A,{ipv6_address:n}),a.createElement(Te.A,{mac:i}),a.createElement(Ie.A,{name:e,model:t,mac:i,type:_,displayable_version:o,uptime:c,deviceState:A}),a.createElement(ue.A,{uptime:c}),a.createElement(Oe.A,{systemStatsMem:d}),a.createElement(Ce.A,{has_fan:m,fan_level:s}),a.createElement(pe.A,{sys_stats:E}));var Pe=l(962926),Se=l(194912),ge=l(423646),Me=l(709690),he=l(400374),Ne=l(27075),ye=l(574137),De=l(885414),xe=l(90757),we=l(524803),fe=l(551753),Le=l(955161);const Ge=(0,b.A)(Pe.A)`
  margin-bottom: ${r.Ln};

  div[class^='triggerContent'] {
    padding-right: 0;
  }
`,Ve=(0,b.A)(Se.A)`
  width: 16px;
  height: 16px;
`,Be=(0,b.A)(Ne.A)`
  margin-right: 2px;
`,Ue=({battpool:e,noBattery:t})=>{const l=(0,xe.Ay)(e.timeToRemain,[xe.Au.DAYS,xe.Au.HOURS,xe.Au.MINUTES]).join("");return t?a.createElement(_.sA,{id:"COMMON_DISCONNECTED"}):e.ischarging&&100===e.batteryLevel?a.createElement(a.Fragment,null,a.createElement(Be,{variant:"fill",color:ye.PA.success}),a.createElement(_.sA,{id:"COMMON_READY"})):e.ischarging?a.createElement(_.sA,{id:"RPS_BATTERY_DURATION_UNTIL_FULLY_CHARGED",values:{duration:l}}):a.createElement(a.Fragment,null,a.createElement(_.sA,{id:"RPS_BATTERY_TIME_UNITE_EMPTY",values:{duration:l}}),": ",l)},ke=(0,b.A)("div",(0,S.A)("color"))`
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: ${({color:e})=>e};
  margin-right: ${r.YC};
`,We=({color:e,label:t,value:l})=>{const{formatMessage:r}=(0,_.tz)();return a.createElement(n.A,{alignItems:"center"},a.createElement(ke,{color:e}),a.createElement(T.A,{color:"text-3",size:"small"},t," ",r({id:"COMMON_UNIT_WATTS_SHORT"},{value:l})))},Fe=({items:e,percentage:t,percentageColor:l})=>a.createElement(n.A,{alignItems:"center",marginBottom:r.kc},a.createElement(W.A,{items:e,rounded:!0}),a.createElement(n.A,{width:52,justifyContent:"flex-end",flexShrink:0},a.createElement(k.A,{description:a.createElement(_.sA,{id:"DEVICE_PROPERTY_OVERVIEW_BATTERY_CAPACITY"}),width:120},a.createElement(T.A,{color:l},t,"%")))),Ye=()=>a.createElement(a.Fragment,null,a.createElement(Fe,{percentage:0,percentageColor:"text-3",items:[{value:0,variant:"primary"}]}),a.createElement(T.A,{color:"text-2"},a.createElement(_.sA,{id:"RPS_BATTERY_WARNING_NO_BATTERY"}))),ze=({activeItem:{vbms_table:e}})=>{const{colors:t,themeName:l,motifPalette:{purple06:i}}=(0,P.u)(),{battpool:o,bms_run_anomaly:c}=e||{battpool:{},bms_run_anomaly:0},m=0===o.readycnt,{barVariant:s,textColor:E}=(0,a.useMemo)(()=>o.batteryLevel>=o.batteryLevelLow?{barVariant:"success",textColor:"positive"}:o.batteryLevel>=o.batteryLevelLowest?{barVariant:"warning",textColor:"notice"}:{barVariant:"danger",textColor:"destructive"},[o.batteryLevel,o.batteryLevelLow,o.batteryLevelLowest]),d=(0,a.useMemo)(()=>{const e={color:i,value:o.device_total_power_output/o.device_total_power_budget*100},t={variant:"primary",value:o.batt_available_power/o.device_total_power_budget*100};return o.device_total_power_output>o.batt_available_power?[t,{...e,value:e.value-t.value}]:o.device_total_power_output<o.batt_available_power?[e,{...t,value:t.value-e.value}]:[t,{...e,value:e.value+1}]},[o.device_total_power_output,o.batt_available_power,o.device_total_power_budget,i]),u=(0,a.useMemo)(()=>{const e=[];return(0,De.Qx)(c)&&e.push("RPS_BATTERY_WARNING_BMS_ANOMALY_CELL_BALANCE"),(0,De.eM)(c)&&e.push("RPS_BATTERY_WARNING_BMS_ANOMALY_POWER_BUDGET"),((0,De.lR)(c)||(0,De.g$)(c))&&e.push("RPS_BATTERY_WARNING_BMS_ANOMALY_BATT_SOH_OR_BAD"),o.batteryLevel<o.batteryLevelLowest?e.push("RPS_BATTERY_WARNING_ALMOST_NO_BATTERY_LEVEL"):o.batteryLevel<o.batteryLevelLow&&e.push("RPS_BATTERY_WARNING_LOW_BATTERY_LEVEL"),e},[c,o.batteryLevel,o.batteryLevelLow,o.batteryLevelLowest]);return e?a.createElement(Ge,{header:a.createElement(n.A,{justifyContent:"space-between"},a.createElement(n.A,{alignItems:"center",gap:r.YC},a.createElement(_.sA,{id:"DEVICE_BATTERY_TYPE_EXTERNAL"}),o.ischarging&&o.batteryLevel<100?a.createElement(Ve,{variant:"success"},a.createElement(ge.A,{color:"white"})):null,m?a.createElement(he.A,{variant:"fill",color:A.Ay[`desktop-color-red-06-${l}`],size:"original"}):null),a.createElement(T.A,{color:"text-3"},a.createElement(Ue,{battpool:o,noBattery:m}))),sections:[m?a.createElement(Ye,null):a.createElement(a.Fragment,null,a.createElement(Fe,{items:[{variant:s,value:o.batteryLevel}],percentage:o.batteryLevel,percentageColor:E}),a.createElement(n.A,{alignItems:"center"},a.createElement(W.A,{items:d,rounded:!0}),a.createElement(n.A,{width:52,justifyContent:"flex-end",flexShrink:0},a.createElement(_.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:o.device_total_power_budget}}))),a.createElement(n.A,{gap:r.kc},a.createElement(Le.A,{condition:!!o.device_system_power_csum,wrapper:(0,we.rR)("RPS_BATTERY_BACK_UP_POWER_TOOLTIP",void 0,{portal:!0},{watt:o.device_system_power_csum})},a.createElement(n.A,{gap:r.YC},a.createElement(We,{color:i,label:a.createElement(_.sA,{id:"RPS_BATTERY_BACK_UP_POWER"}),value:o.device_total_power_output}),o.device_system_power_csum?a.createElement(Me.A,{isActive:!0,size:"original"}):null)),a.createElement(We,{color:t.blue,label:a.createElement(_.sA,{id:"RPS_BATTERY_POWER"}),value:o.batt_available_power})),u.map(e=>a.createElement(fe.A,{variant:"warning",padding:"0",margin:`${r.kc} 0 0`,key:e},a.createElement(_.sA,{id:e}))))],isCollapsible:!1}):null};var $e,Xe=l(54227),He=l(362412),je=l(137625),Ke=l(734707),Ze=l(126457);!function(e){e.SET_LOCATE="set-locate",e.UNSET_LOCATE="unset-locate",e.REBOOT="reboot"}($e||($e={}));var Qe=l(516693),qe=l(691189),Je=l(887831),et=l(771805);const tt=`${et.w}/device/:mac/battery/update`,lt=`${et.w}/device/:mac/battery/action`,at=(e,t,l="")=>(0,qe.vB)(Qe.aC,null,null,Je.A.POST,tt.replace(":mac",e),{},{macs:t,action:"upgrade",url:l},{}),rt=(e,t,l)=>(0,qe.vB)(Qe.aC,null,null,Je.A.POST,lt.replace(":mac",t),{},{macs:[l],action:e},{});var nt,it=l(757167);!function(e){e.INIT="init",e.CONNECT="connect",e.DISCONNECT="disconnect",e.FOUND="found",e.BIND="bind",e.READY="ready",e.UPDATE="update",e.UNKNOWN="unknown"}(nt||(nt={}));var ot=l(171073),ct=l(360113);const mt=({isPoweredByExternalPower:e,areTooManyBatteries:t,children:l})=>{const r=(0,a.useMemo)(()=>e?"DEVICE_ACTIONS_CUSTOM_UPGRADE_EXTERNAL_BATTERY_WARNING":t?"DEVICE_ACTIONS_CUSTOM_UPGRADE_EXCESS_BATTERY_WARNING":"",[e,t]);return a.createElement(Le.A,{condition:e||t,wrapper:(0,we.rR)(r,void 0,{portal:!0})},l)},st=(0,b.A)(T.A,(0,S.A)("disabled"))`
  color: ${({theme:{themeName:e},disabled:t})=>t?A.Ay[`desktop-color-link-primary-disabled-${e}`]:A.Ay[`desktop-color-link-primary-enabled-${e}`]};
`,Et=({deviceMac:e,batteryMacs:t,toVersion:l,isSingleBatteryUpdate:r,isPoweredByExternalPower:n,areTooManyBatteries:i})=>{const o=(0,P.u)(),{formatMessage:c}=(0,_.tz)(),m=(0,O.useDispatch)(),[s,E]=(0,a.useState)(!1);return a.createElement(mt,{isPoweredByExternalPower:n,areTooManyBatteries:i},a.createElement(Ke.Ay,{className:(0,Ke.sC)(o),onClick:()=>{m((0,ot.xv)({titleValues:{deviceName:r?t[0]:`${t.length} ${c({id:"COMMON_BATTERIES"})}`},messageValues:{deviceName:r?t[0]:`${t.length} ${c({id:"COMMON_BATTERIES"})}`,toVersion:l},onConfirm:()=>{m(at(e,t)),E(!0)},onCancel:()=>{m((0,Ze.AS)())}}))},disabled:s||n||i},a.createElement(st,{disabled:n||i,color:"inherit"},a.createElement(_.sA,r?{id:"COMMON_ACTION_UPDATE"}:{id:"DEVICE_ACTIONS_UPDATE_ALL_BATTERIES"}))))},dt={[nt.UPDATE]:"COMMON_UPDATING",[nt.READY]:"COMMON_READY"},_t=(0,b.A)("div")`
  margin-top: ${r.Ln};
`,At=(0,b.A)("div")`
  background-color: ${({theme:{themeName:e}})=>A.Ay[`desktop-color-neutral-03-${e}`]};
  width: 1px;
  height: 16px;
`,ut="update",Ot="manualUpdate",Tt=({activeItem:e})=>{const{battery_table:t=[],bms_run_anomaly:l}=e?.vbms_table||{battery_table:[],bms_run_anomaly:0},[i,o]=(0,a.useState)(t[0]||{}),[c,m]=(0,a.useState)(!1),[s,E]=(0,a.useState)(!1),[A,u]=(0,a.useState)(i.upgradable?ut:Ot),p=(0,O.useDispatch)(),{formatMessage:C}=(0,_.tz)(),I=i.client_state===nt.READY,v=t.filter(e=>e.upgradable)||[],b=v.map(e=>e.id),P=t.map(e=>({label:e.id,value:e.id})),S=(0,a.useMemo)(()=>(0,it.Pi)(e?.psu_table)?.online,[e?.psu_table]),g=!!(0,De.Zd)(l),M=()=>{p(rt(i.isLocating?$e.UNSET_LOCATE:$e.SET_LOCATE,e.mac,i.id))},h=()=>{p(rt($e.REBOOT,e.mac,i.id))},N=({target:{value:e}})=>{u(e)};return(0,a.useEffect)(()=>{if(t?.length>0){const e=t.find(e=>e.id===i.id)||t[0];o(e)}},[t,i.id]),t?.length>0?a.createElement(_e.A,{type:_e.I.ACCORDION,items:[{id:"battery",label:a.createElement(d.A,{id:"DEVICE_PROPERTY_OVERVIEW_BATTERY_COUNT",values:{count:t.length}}),openByDefault:!0,renderContent:()=>a.createElement(a.Fragment,null,a.createElement(n.A,{marginBottom:r.Ln},a.createElement(He.A.Sorted,{options:P,variant:"secondary",value:i.id,width:240,onChange:(e,l)=>{const a=t.find(e=>e.id===l);o(a),u(a.upgradable?ut:Ot)}})),a.createElement(ct.A,null,a.createElement(T.A,null,a.createElement(_.sA,{id:"COMMON_DEVICE_VERSION"})),a.createElement(T.A,{color:"text-3"},i.fwv)),a.createElement(ct.A,null,a.createElement(T.A,null,a.createElement(_.sA,{id:"DEVICE_PROPERTY_OVERVIEW_BATTERY_HEALTH"})),i.isBadBattery?a.createElement(T.A,{color:"text-3"},a.createElement(_.sA,{id:"COMMON_BAD"})):a.createElement(T.A,{color:"positive"},a.createElement(_.sA,{id:"COMMON_GOOD"}))),a.createElement(ct.A,null,a.createElement(T.A,null,a.createElement(_.sA,{id:"DEVICE_PROPERTY_OVERVIEW_BATTERY_STATE"})),a.createElement(T.A,{color:"text-3"},a.createElement(_.sA,{id:dt[i.client_state]||"COMMON_NOT_READY"}))),a.createElement(n.A,{gap:r.kc,alignItems:"center"},a.createElement(je.A,{title:"COMMON_ACTION_MANAGE_BATTERY",message:"RPS_BATTERY_MANAGE_MESSAGE",messageValues:{time:C({id:"COMMON_MINUTES"},{minutes:Math.ceil(i.upgradeDuration/60)})},body:a.createElement(n.A,{marginTop:r.kc,gap:r.Ln},a.createElement(Xe.A,{id:ut,value:ut,checked:A===ut,onChange:N,disabled:!i.upgradable},a.createElement(_.sA,{id:"COMMON_ACTION_UPDATE"})),a.createElement(Xe.A,{id:Ot,value:Ot,checked:A===Ot,onChange:N},a.createElement(_.sA,{id:"DEVICE_ACTIONS_CUSTOM_UPGRADE_CONFIRM_TITLE"}))),isOpen:c,handleClose:()=>m(!1),handleConfirm:()=>{p(A===ut?(0,ot.xv)({titleValues:{deviceName:i.id},messageValues:{deviceName:i.id,toVersion:i.upgrade_to_firmware},onConfirm:()=>{p(at(e.mac,[i.id])),p((0,Ze.AS)())},onCancel:()=>{p((0,Ze.AS)())}}):(0,ot.IK)({onConfirm:t=>{p(at(e.mac,[i.id],t)),p((0,Ze.AS)())},onCancel:()=>{p((0,Ze.AS)())}}))}},a.createElement(mt,{isPoweredByExternalPower:S,areTooManyBatteries:g},a.createElement(Ke.Ay,{variant:"inline",size:"medium",disabled:!I||S||g,onClick:()=>m(!0)},a.createElement(_.sA,{id:"COMMON_ACTION_MANUAL_UPDATE"})))),a.createElement(At,null),a.createElement(R.A,{variant:"inline",size:"medium",onClick:M,disabled:!I},a.createElement(_.sA,i.isLocating?{id:"DEVICE_ACTIONS_LOCATE_STOP"}:{id:"DEVICE_ACTIONS_LOCATE"})),a.createElement(At,null),a.createElement(je.A,{isOpen:s,title:"DEVICE_ACTIONS_RESTART_CONFIRM_TITLE",titleValues:{deviceName:i.id},message:"DEVICE_ACTIONS_RESTART_CONFIRM_MESSAGE",messageValues:{deviceName:i.id},buttonMessage:"DEVICE_ACTIONS_RESTART",buttonVariant:"danger",handleConfirm:h,handleClose:()=>{E(!1)}},a.createElement(R.A,{variant:"inline",size:"medium",disabled:!I,onClick:()=>{E(!0)}},a.createElement(_.sA,{id:"DEVICE_ACTIONS_RESTART"})))),0!==b.length&&I?1===b.length?a.createElement(_t,null,a.createElement(Et,{deviceMac:e.mac,batteryMacs:b,toVersion:i.upgrade_to_firmware,isSingleBatteryUpdate:!0,isPoweredByExternalPower:S,areTooManyBatteries:g})):a.createElement(_t,null,S||g?null:a.createElement(fe.A,{variant:"info",padding:"0"},a.createElement(_.sA,{id:"RPS_BATTERY_UPDATE_INFO",values:{time:C({id:"COMMON_MINUTES"},{minutes:Math.ceil((v?.[0].upgradeDuration||0)/60)})}})),a.createElement(Et,{deviceMac:e.mac,batteryMacs:b,toVersion:i.upgrade_to_firmware,isPoweredByExternalPower:S,areTooManyBatteries:g})):null)}]}):null};var pt=l(78853);const Rt=({activeItem:e,activeItem:{name:t,type:l,model:d,ip:_,lan_ip:A,ipv6:u,mac:O,displayable_version:T,uptime:p,has_fan:R,fan_level:C,sys_stats:I,"system-stats":v,vbms_table:b,port_table:P,shortname:S,ethernet_overrides:g}})=>{const M=(0,a.useMemo)(()=>(b?.battery_table?.length||0)>0,[b?.battery_table?.length]);return a.createElement(a.Fragment,null,a.createElement(E.A,{activeItem:e},(0,i.YP)(e)?a.createElement("div",{style:{marginTop:r.Ln}},a.createElement(n.A,{justifyContent:"center",gap:r.Er},a.createElement(n.A,{flexDirection:"column",alignItems:"center"},a.createElement(o.A,{activeItem:e,multiIcon:!0,disableOnPortClick:!0})),a.createElement(n.A,{justifyContent:"center",gap:r.YC,alignItems:"flex-end"},a.createElement(m.A,{activeItem:e,disableOnPortClick:!0,sizeOverride:"large",tooltipPlacement:"bottom end"}),P?a.createElement(c.A,{activeItem:e,portSizeOverride:"18px",disableOnPortClick:!0}):null)),a.createElement(s.Ay,{activeItem:e,noTopBorder:!0})):null),(0,i.YP)(e)?a.createElement(a.Fragment,null,M?a.createElement(ze,{activeItem:e}):null,a.createElement(be,{name:t,ethernet_overrides:g,port_table:P,type:l,model:d,ip:_,lan_ip:A,ipv6:u,mac:O,displayable_version:T,uptime:p,has_fan:R,fan_level:C,sys_stats:I,systemStatsMem:v?.mem}),a.createElement(Ae,{activeItem:e}),M?a.createElement(Tt,{activeItem:e}):null,a.createElement(pt.A,{shortname:S})):null)}}}]);