"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[45944],{71265:(e,t,a)=>{a.d(t,{R:()=>m,k:()=>A});var n=a(280258),l=a(190497),r=a(953048),c=a(175522),E=a(936621),o=a(305988);const i=[...new Set([n.H,c.Q.join(c.A),r.Zt,E.F,l.nc,o.Vr])],s={numeric:!0,sensitivity:"base"},m=(e,t)=>{const a=[];for(let n=e;n<=t;n+=1)a.push({value:n,label:String(n)});return a},A=e=>({value:t,label:a},{value:n,label:l})=>i.includes(t?.toString())||i.includes(n?.toString())?1/0:a?.toString().localeCompare(l?.toString(),e,s)??-1},175522:(e,t,a)=>{a.d(t,{A:()=>l,Q:()=>r});var n=a(416348);const l="_",r=[n.ZM,n.Je]},205830:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(296540),l=a(217439),r=a(83438),c=a(566723),E=a(294303),o=a(699784),i=a(780811),s=a(360113);const m=({sys_stats:e,flexProps:t,withTooltip:a,compact:m=!1})=>{const A=(0,i.eiG)(e);return A?n.createElement(s.A,{flexProps:t,compact:m},n.createElement(l.A,{color:"text-2",size:"medium"},n.createElement(o.sA,{id:"COMMON_LOAD_AVERAGE"})),a?n.createElement(E.A,{alignItems:"center",gap:c.YC},n.createElement(l.A,{color:"text-3",size:"medium"},A),n.createElement(r.A,{description:n.createElement(o.sA,{id:"DEVICE_PROPERTY_OVERVIEW_LOAD_AVERAGE_TOOLTIP"}),placement:"top left"})):n.createElement(l.A,{color:"text-3",size:"medium"},A)):null}},211908:(e,t,a)=>{a.d(t,{A:()=>U});var n=a(469733),l=a(296540),r=a(353899),c=a(758649),E=a(742920),o=a(421130),i=a(675359),s=a(699784),m=a(801081),A=a(25553),d=a(87485),_=a(264963);const u=e=>(0,m.Mz)((e=>(0,A.uh)((0,_.lX)({queryParams:{mac:e}})))(e),e=>(0,d.i6)(e)?.devices||[]);var C,p,M=a(768195),I=a(546391);!function(e){e.EXISTING="existing",e.NEW="new"}(C||(C={})),function(e){e.MAC="mac",e.TYPE="type",e.MODEL="model"}(p||(p={}));var v,N=a(238761),D=a(271856),T=a(438628),R=a(162420),S=a(400261),O=a(874807);!function(e){e.DEVICE_REPLACEMENT_MODE="deviceReplacementMode",e.SET_DEVICE_REPLACEMENT_MODE="setDeviceReplacementMode",e.NEW_MAC="newMac",e.SET_NEW_MAC="setNewMac",e.EXISTING_MAC="existingMac",e.SET_EXISTING_MAC="setExistingMac",e.REPLACEMENT_CANDIDATES="replacementCandidates",e.ERROR="error",e.RESET_ERROR="resetError"}(v||(v={}));const P={[v.DEVICE_REPLACEMENT_MODE]:void 0,[v.SET_DEVICE_REPLACEMENT_MODE]:O.P1,[v.NEW_MAC]:void 0,[v.SET_NEW_MAC]:O.P1,[v.EXISTING_MAC]:void 0,[v.SET_EXISTING_MAC]:O.P1,[v.REPLACEMENT_CANDIDATES]:[],[v.ERROR]:void 0,[v.RESET_ERROR]:O.P1},g=(0,l.createContext)(P);const h=a(132196).AH`
  height: 54px;
`;var L=a(71479),w=a(566723),y=a(294303);const b=(0,L.A)(y.A)`
  align-items: center;
  gap: ${w.YC};
`,f=(0,l.memo)(()=>{const{newMac:e,setNewMac:t,error:a,resetError:n}=(0,l.useContext)(g),r=(0,l.useCallback)(({target:{value:e}})=>{t((0,S.Z)(e)),n()},[t,n]);return l.createElement(T.A,{className:h,value:e,onChange:r,onFocus:n,variant:"secondary",label:l.createElement(b,null,l.createElement(s.sA,{id:"COMMON_MAC_ADDRESS"}),l.createElement(D.A,{portal:!0,width:"100%",maxWidth:248,description:l.createElement(s.sA,{id:"DEVICE_REPLACEMENT_MAC_LOCATION"})},l.createElement(R.A,{isActive:!0}))),width:"100%",invalid:a})});var V=a(362412),k=a(6176);const x=(0,l.memo)(()=>{const{replacementCandidates:e,existingMac:t,setExistingMac:a,error:n,resetError:r}=(0,l.useContext)(g),c=(0,l.useMemo)(()=>e.map(({mac:e,model:t,name:a})=>({label:a,value:e,image:l.createElement(k.A,{model:t}),additionalInfo:e})),[e]),E=(0,l.useCallback)(({value:e})=>{a(String(e)),r()},[a,r]);return l.createElement(V.A.Sorted,{value:t,label:l.createElement(s.sA,{id:"COMMON_DEVICE"}),width:"100%",searchable:!0,onChange:E,onFocus:r,maxHeight:228,options:c,invalid:n})}),W=(0,L.A)(y.A)`
  flex-direction: column;
  gap: ${w.kc};
`,G=(0,l.memo)(()=>{const{replacementCandidates:e,deviceReplacementMode:t,setDeviceReplacementMode:a,resetError:n}=(0,l.useContext)(g),r=(0,l.useMemo)(()=>e.length?[{id:C.EXISTING,children:l.createElement(s.sA,{id:"COMMON_EXISTING"}),onChange:()=>{a(C.EXISTING),n()},checked:t===C.EXISTING},{id:C.NEW,children:l.createElement(s.sA,{id:"COMMON_NEW"}),onChange:()=>{a(C.NEW),n()},checked:t===C.NEW}]:[],[e.length,t,a,n]);return l.createElement(W,null,l.createElement(N.A,{direction:"row",items:r}),t===C.EXISTING?l.createElement(x,null):null,t===C.NEW?l.createElement(f,null):null)}),z=(0,L.A)(y.A)`
  align-items: center;
  gap: ${w.YC};
  width: fit-content;
`;var X=a(252093);const B={[M.gQ.INCOMPATIBLE_REPLACEMENT]:"DEVICE_REPLACEMENT_DEVICE_INCOMPATIBLE_REPLACEMENT_ERROR",[M.gQ.REPLACEMENT_ALREADY_ASSIGNED]:"DEVICE_REPLACEMENT_DEVICE_REPLACEMENT_ALREADY_ASSIGNED_ERROR"},Y=({mac:e,hideTooltip:t=!1})=>{const{formatMessage:a}=(0,s.tz)(),o=(0,n.useDispatch)(),[m,A]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),[N,D]=(0,l.useState)(C.NEW),[T,R]=(0,l.useState)(""),[S,O]=(0,l.useState)(""),[P,h]=(0,l.useState)(void 0),L=(0,n.useSelector)((0,l.useMemo)(()=>u(e),[e])),w=(0,l.useCallback)(()=>{A(!0)},[]),y=(0,l.useCallback)(()=>{A(!1),R(""),O(""),p(!1),D(C.NEW),h(void 0)},[]),b=(0,l.useCallback)(()=>{switch(N){case C.EXISTING:return S;case C.NEW:return T;default:return}},[N,S,T]),f=(0,l.useCallback)(()=>{o((0,i.ox)({icon:E.C.success,message:"DEVICE_REPLACEMENT_DEVICE_SET",duration:3e3})),y()},[o,y]),V=(0,l.useCallback)(e=>{switch(e.apiData?.replacement_state){case M.gQ.INCOMPATIBLE_REPLACEMENT:case M.gQ.REPLACEMENT_ALREADY_ASSIGNED:h(a({id:B[e.apiData.replacement_state]}));break;case M.gQ.CANNOT_REPLACE:default:o((0,i.ox)({icon:E.C.danger,message:"DEVICE_FAILED_TO_SET_REPLACEMENT_DEVICE",duration:3e3}))}},[o,a]),k=(0,l.useCallback)(()=>{p(!1)},[]),x=(0,l.useCallback)(()=>{p(!0),o((0,_.uC)(e,b())).then(f).catch(V).finally(k)},[o,f,V,e,b,k]),W=(0,l.useMemo)(()=>Boolean(b().match(I.b8)),[b]),Y=(0,l.useMemo)(()=>[{text:l.createElement(s.sA,{id:"COMMON_ACTION_CANCEL"}),variant:"tertiary",onClick:y},{text:l.createElement(s.sA,{id:"COMMON_ACTION_APPLY"}),variant:"primary",onClick:x,disabled:!W||d,loader:d?"spinner":void 0}],[y,x,W,d]),U=(0,l.useCallback)(()=>{h(void 0)},[h]),q=(0,l.useMemo)(()=>({[v.DEVICE_REPLACEMENT_MODE]:N,[v.SET_DEVICE_REPLACEMENT_MODE]:D,[v.NEW_MAC]:T,[v.SET_NEW_MAC]:R,[v.EXISTING_MAC]:S,[v.SET_EXISTING_MAC]:O,[v.REPLACEMENT_CANDIDATES]:L,[v.ERROR]:P,[v.RESET_ERROR]:U}),[N,T,S,L,P,U]);return(0,l.useEffect)(()=>{o((0,_.lX)({queryParams:{mac:e}}))},[o,e]),l.createElement(g.Provider,{value:q},l.createElement(r.A,{allowOverflow:!0,title:l.createElement(s.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"}),body:l.createElement(G,null),position:"top",portal:!0,actions:Y,isOpen:m,onRequestClose:y},l.createElement(z,null,l.createElement(c.A,{type:"button",variant:"inline",size:"medium",onClick:w},l.createElement(s.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"})),t?null:l.createElement(X.A,{messageId:"DEVICE_SET_REPLACEMENT_DEVICE_DESCRIPTION",variant:"outline"}))))},U=(0,l.memo)(({model:e,type:t,...a})=>(0,o.G)({type:t,model:e})?l.createElement(Y,{type:t,model:e,...a}):null)},212406:(e,t,a)=>{a.d(t,{A:()=>p});var n=a(296540),l=a(146784),r=a(294303),c=a(689965),E=a(768195),o=a(999063),i=a(633819),s=a(559674),m=a(329708),A=a(32753),d=a(723544),_=a(205830),u=a(400242),C=a(500045);const p=({model:e,ip:t,lan_ip:a,ipv6:p,mac:M,displayable_version:I,connection_network_name:v,uptime:N,sys_stats:D,systemStatsMem:T,total_used_power:R,device_mode_override:S})=>{const O=S===E.Yp.MANAGED_SHADOW_GATEWAY;return n.createElement(c.A,null,n.createElement(r.A,{height:"100%",flexDirection:"column"},n.createElement(m.A,{model:e}),O?null:n.createElement(u.A,{ip:t,lan_ip:a}),O?null:n.createElement(l.A,{ipv6_address:p}),n.createElement(d.A,{mac:M}),n.createElement(C.A,{displayable_version:I}),O?null:n.createElement(s.A,{connection_network_name:v}),n.createElement(o.A,{uptime:N}),O?null:n.createElement(A.A,{systemStatsMem:T}),O?null:n.createElement(_.A,{sys_stats:D}),O?null:n.createElement(i.A,{totalPower:R})))}},252093:(e,t,a)=>{a.d(t,{A:()=>E});var n=a(296540),l=a(271856),r=a(162420),c=a(699784);const E=({messageId:e,tooltipClassName:t,values:a,isInteractive:E,portal:o,variant:i="twoTone",size:s="medium"})=>n.createElement(l.A,{description:n.createElement(c.sA,{id:e,values:a}),width:210,isInteractive:E,portal:o,tooltipClassName:t},n.createElement(r.A,{isActive:!0,omitSvgMargin:!0,variant:i,size:s}))},264963:(e,t,a)=>{a.d(t,{X2:()=>d,lX:()=>m,uC:()=>A});var n=a(516693),l=a(691189),r=a(742920),c=a(887831);const E="/v2/api/site/{site}/device/:mac:",o=`${E}/replacement-candidates`,i=`${E}/replace?replacementDeviceMac=:replacement-mac:`,s=`${E}/replace`,m=(e={},t={})=>(0,l.Kd)("replacementCandidates",`${o.replace(":mac:",e.queryParams?.mac)}`,e.queryParams?.mac,e,{...t,idField:"mac"}),A=(e,t)=>a=>a((0,l.vB)(n.aC,null,null,c.A.POST,i.replace(":mac:",e).replace(":replacement-mac:",t),{},null,{})),d=e=>t=>t((0,l.vB)(n.aC,null,null,c.A.DELETE,s.replace(":mac:",e),{},null,{failureToast:()=>({icon:r.C.danger,message:"COMMON_UNKNOWN_ERROR"})}))},284428:(e,t,a)=>{a.d(t,{Im:()=>o,iL:()=>i,mQ:()=>c,pv:()=>r,q:()=>E});var n=a(296540),l=a(451449);function r(){return(0,n.useContext)(l.I)}function c(){return r().fields}function E(){return r().tooltipPopovers}function o(){return r().tooltipIcons}function i(){return r().labels}},329708:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(296540),l=a(927099),r=a(6510),c=a(699784),E=a(360113);const o=({model:e})=>n.createElement(E.A,null,n.createElement(l.A,{color:"secondary",size:"body"},n.createElement(c.sA,{id:"COMMON_MODEL"})),n.createElement(l.A,{color:"tertiary",size:"body"},(0,r.Lm)(e)))},362412:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(469733),l=a(296540),r=a(436331),c=a(805837),E=a(282556),o=a(71265);const i=e=>l.createElement(r.A,{renderOption:c.q,...e}),s=e=>l.createElement(i,{...e});s.Sorted=e=>{const t=(0,n.useSelector)(E.zi),a=(0,l.useMemo)(()=>(0,o.k)(t),[t]);return l.createElement(i,{...e,sortBy:a})};const m=s},400242:(e,t,a)=>{a.d(t,{A:()=>E});var n=a(296540),l=a(927099),r=a(699784),c=a(360113);const E=({ip:e,lan_ip:t,wan:a=!1,lan:E=!1,compact:o=!1})=>t||e?n.createElement(c.A,{compact:o},n.createElement(l.A,{color:"secondary",size:"body"},n.createElement(r.sA,{id:a?"DEVICE_PROPERTY_OVERVIEW_WAN_IP_ADDRESS":E?"DEVICE_PROPERTY_OVERVIEW_LAN_IP_ADDRESS":"COMMON_IP_ADDRESS"})),n.createElement(l.A,{color:"tertiary",size:"body"},t||e)):null},400261:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(546391);const l=e=>e?e.replace(n.SD,"").replace(n.fA,"$&:").substring(0,17).toLowerCase():e},421130:(e,t,a)=>{a.d(t,{G:()=>E});var n=a(780811),l=a(768195);const r=[l.bq.USW,l.bq.UAP],c=[l.W4.UDBA69F],E=({type:e,model:t})=>(r.includes(e)||c.includes(t))&&!(0,n.tNJ)({model:t})},451449:(e,t,a)=>{a.d(t,{I:()=>n});const n=(0,a(296540).createContext)({fields:!1,labels:!1,tooltipPopovers:!1,tooltipIcons:!1})},721321:(e,t,a)=>{a.r(t),a.d(t,{default:()=>A});var n=a(296540),l=a(889879),r=a(328787),c=a(15244),E=a(686130),o=a(442728),i=a(812454),s=a(212406),m=a(772317);const A=({activeItem:e,activeItem:{adopted:t,type:a,mac:A,ip:d,detailed_states:{device_near_power_limit:_}={device_near_power_limit:!1},total_used_power:u,total_max_power:C,config_network:p,model:M,lan_ip:I,ipv6:v,displayable_version:N,connection_network_name:D,uptime:T,sys_stats:R,"system-stats":S,shortname:O}})=>n.createElement(n.Fragment,null,n.createElement(i.A,{activeItem:e,showPortOverview:!0,hidePortsButton:!0},n.createElement(E.A,{activeItem:e,showPortsButton:!0,showCaptureButton:!0})),n.createElement(r.A,{ip:d,adopted:t,config_network:p}),n.createElement(l.A,{mac:A,type:a,model:M,device_near_power_limit:_,total_used_power:u,total_max_power:C}),n.createElement(o.A,{activeItem:e}),n.createElement(s.A,{model:M,ip:d,lan_ip:I,ipv6:v,mac:A,displayable_version:N,connection_network_name:D,uptime:T,sys_stats:R,systemStatsMem:S?.mem,total_used_power:u}),n.createElement(c.A,{activeItem:e}),n.createElement(m.A,{shortname:O}))},766624:(e,t,a)=>{a.d(t,{A:()=>o});var n=a(296540),l=a(271856),r=a(709690),c=a(284428),E=a(566723);const o=({description:e,isInteractive:t,portal:a=!0,cursorType:o,title:i,position:s,width:m,iconProps:A,disabled:d=!1})=>{const _=(0,c.Im)()||d,u=(0,c.q)();return n.createElement(l.A,{description:e,portal:a,isInteractive:t,style:{display:"flex",alignItems:"center"},cursorType:o,title:i,position:s,width:m,disableHover:u},n.createElement(r.A,{isActive:!0,size:"original",opacity:_?E.xN:void 0,...A}))}},772317:(e,t,a)=>{a.d(t,{A:()=>S});var n,l=a(592563),r=a(296540),c=a(469733),E=a(217439),o=a(187483),i=a(699784),s=a(689965),m=a(86571),A=a(801081);!function(e){e.OPEN_MODAL="openModal"}(n||(n={}));const d=(0,A.Mz)(o.zn,e=>void 0!==e[n.OPEN_MODAL]);var _=a(523275),u=a(840279),C=a(919952);const p=e=>e[C.U.UIDB]||(0,_.A)(),M=(0,A.Mz)(p,({version:e})=>Boolean(e)),I=(0,A.Mz)(p,({devices:e})=>e||(0,u.A)());var v=a(765562),N=a(79871);const D=()=>{const e=(0,c.useDispatch)(),t=(0,c.useSelector)(M);return(0,r.useEffect)(()=>{t||(async()=>{const t=await fetch(v.A.fingerprintPublicDatabasePath),a=await t.json();e((0,N.$)(a))})()},[t,e]),t},T=({uidbDevice:e})=>{const t=(0,c.useSelector)(o.zn),a=t?.[n.OPEN_MODAL];return a?r.createElement(l.A,{onClick:()=>a(e)},r.createElement(E.A,{size:"medium",color:"inherit"},r.createElement(i.sA,{id:"DEVICE_SHOW_DETAILS"}))):null},R=({shortname:e})=>{const t=(0,c.useSelector)((e=>(0,A.Mz)(I,t=>t.find(t=>t.shortnames?.includes(e))||(0,_.A)()))(e));return D(),t?.compliance?r.createElement(s.A,{type:s.I.ACCORDION,items:[{id:"compliance",label:r.createElement(m.A,{id:"COMMON_COMPLIANCE"}),renderContent:()=>r.createElement(T,{uidbDevice:t}),openByDefault:!0}]}):null},S=({shortname:e})=>(0,c.useSelector)(d)?r.createElement(R,{shortname:e}):null},776288:(e,t,a)=>{a.d(t,{A:()=>n});const n={PCAP:4194304,HWOFFLOAD_QOS_AND_SMART_QUEUE:2147483648,SUPPORT_FILE:65536}}}]);