"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[65075],{137273:(e,t,a)=>{a.d(t,{A:()=>E});var o=a(296540),n=a(618983),r=a(823858),i=a(400374),l=a(709690),c=a(793336);(0,a(349005).A)(".alert__Jo2Y1vWf{border-radius:4px;display:flex;justify-content:space-between;overflow:hidden;padding:8px;width:100%}.alert-light__Jo2Y1vWf{background-color:rgba(33,35,39,.04)}.alert-dark__Jo2Y1vWf{background-color:hsla(214,8%,98%,.04)}.alert-global__Jo2Y1vWf>:only-child{margin:0 auto}.alert__Jo2Y1vWf span{font-family:var(--desktop-font-family-default);font-size:var(--desktop-font-size-medium);font-weight:var(--desktop-font-weight-regular);line-height:20px}.alert__Jo2Y1vWf span-light{color:#50565e}.alert__Jo2Y1vWf span-dark{color:#dee0e3}.close-light__Jo2Y1vWf{color:#808893!important}.close-light__Jo2Y1vWf:hover{color:#9fa5ad!important}.close-light__Jo2Y1vWf:active{color:#676f79!important}.close-dark__Jo2Y1vWf{color:#b7bcc2!important}.close-dark__Jo2Y1vWf:hover{color:#99a0a8!important}.close-dark__Jo2Y1vWf:active{color:#cbced2!important}.content__Jo2Y1vWf{display:flex}.icon__Jo2Y1vWf{box-sizing:content-box;margin-right:8px}.icon-light-info__Jo2Y1vWf{color:#006fff}.icon-light-success__Jo2Y1vWf{color:#38cc65}.icon-light-warning__Jo2Y1vWf{color:#f5a524}.icon-light-danger__Jo2Y1vWf{color:#f0383b}.icon-dark-info__Jo2Y1vWf{color:#4797ff}.icon-dark-success__Jo2Y1vWf{color:#37be5f}.icon-dark-warning__Jo2Y1vWf{color:#e79613}.icon-dark-danger__Jo2Y1vWf{color:#ee6368}.spacer__Jo2Y1vWf{flex-shrink:100}.text-light__Jo2Y1vWf{color:#50565e}.text-dark__Jo2Y1vWf{color:#dee0e3}");var s=a(722860),_=a(325898),f=a(683121),m=a(927099),d=a(309447);const g=(0,s.c)({alert:"alert__Jo2Y1vWf","alert-light":"alert-light__Jo2Y1vWf","alert-dark":"alert-dark__Jo2Y1vWf","alert-global":"alert-global__Jo2Y1vWf","close-light":"close-light__Jo2Y1vWf","close-dark":"close-dark__Jo2Y1vWf",content:"content__Jo2Y1vWf",icon:"icon__Jo2Y1vWf","icon-light-info":"icon-light-info__Jo2Y1vWf","icon-light-success":"icon-light-success__Jo2Y1vWf","icon-light-warning":"icon-light-warning__Jo2Y1vWf","icon-light-danger":"icon-light-danger__Jo2Y1vWf","icon-dark-info":"icon-dark-info__Jo2Y1vWf","icon-dark-success":"icon-dark-success__Jo2Y1vWf","icon-dark-warning":"icon-dark-warning__Jo2Y1vWf","icon-dark-danger":"icon-dark-danger__Jo2Y1vWf",spacer:"spacer__Jo2Y1vWf","text-light":"text-light__Jo2Y1vWf","text-dark":"text-dark__Jo2Y1vWf"}),v=(0,o.memo)(({type:e,motif:t})=>{const a={className:g("icon",`icon-${t}-${e}`),size:"original",variant:"fill"};switch(e){case"success":return o.createElement(n.A,{...a});case"warning":return o.createElement(r.A,{...a});case"danger":return o.createElement(i.A,{...a});default:return o.createElement(l.A,{...a})}}),E=o.forwardRef((e,t)=>{const{type:a="info",text:n,motif:r,onClose:i,className:l,style:s,Icon:E,closeIconProps:A,variant:u="inline"}=e,{motif:h}=(0,_.A)(r);return o.createElement("div",{ref:t,className:g.concat(l)("alert",`alert-${h}`,`alert-${u}`),style:s},i&&"global"===u&&o.createElement(f.A,{className:g("spacer"),width:20,height:20}),o.createElement("div",{className:g("content")},E?o.cloneElement(E,{className:g("icon",`icon-${h}-${a}`),size:"original"}):o.createElement(v,{type:a,motif:h}),"string"==typeof n?o.createElement(m.A,{className:g("text",`text-${h}`)},n):n),i&&o.createElement(d.A,{onPress:i,variant:"tertiary-neutral",size:"small",className:g("close",`close-${h}`),style:{width:20,height:20}},o.createElement(c.A,{size:20,...A})))})},785595:(e,t,a)=>{a.r(t),a.d(t,{default:()=>O});var o=a(469733),n=a(296540),r=a(951272),i=a(927099),l=a(673582),c=a(71479),s=a(6510),_=a(742920),f=a(566723),m=a(126457),d=a(699784),g=a(84909),v=a(837612),E=a(768195),A=a(602197),u=a(171073),h=a(252093),p=a(956619),Y=a(813040),W=a(143811),J=a(294303),k=a(776309),C=a(532419),I=a(734707);const N=(0,c.A)(I.Ay)`
  padding: 0;
  white-space: nowrap;
`,b=({device:e})=>{const t=(0,o.useDispatch)(),a=(0,o.useSelector)(C.qD);return n.createElement(N,{variant:"link",onClick:()=>{t((0,m.to)({modalType:k.A.ASSIGN_SMART_BATTERY,modalProps:{activeMacs:[e.mac]}}))},disabled:a.length<2},n.createElement(d.sA,{id:"DEVICE_ACTIONS_REASSIGN"}))};var w=a(705426);const x=(0,c.A)(w.A)`
  width: 415px;
`,y=(0,c.A)(J.A)`
  background-color: ${({theme:{motifPalette:{neutral02:e}}})=>e};
  border-radius: 8px;
  height: 44px;
  padding: 9px;
`,D=({activeItem:e,isDirty:t})=>{const a=(0,o.useDispatch)(),{handleSubmit:c}=(0,r.j7)(),_=(0,n.useCallback)(()=>{a((0,m.AS)())},[a]),u=(0,v.S9)(e),k=(0,n.useMemo)(()=>u===A.g.UPGRADING||e.batteryState===E.Rv.POWER_DELIVER,[u,e.batteryState]);return n.createElement(x,{allowOverflow:!0,title:n.createElement(i.A,{weight:"bold",size:"header-xs"},n.createElement(d.sA,{id:"COMMON_ACTION_MANAGE_BATTERY"})),actions:[{text:n.createElement(d.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",onClick:_},{text:n.createElement(d.sA,{id:"COMMON_ACTION_SAVE"}),type:"submit",disabled:!t,variant:"primary",onClick:()=>{c(),_()}}],size:"small",onRequestClose:_},n.createElement(n.Fragment,null,n.createElement(W.A,{label:"COMMON_DEVICE_NAME",variant:"secondary",name:"name",full:!0}),k||(0,v.g8)(e)?n.createElement(y,{flexDirection:"row",justifyContent:"left",alignItems:"center",height:"36px"},n.createElement(J.A,{marginRight:f.kc},n.createElement(l.A,{size:"medium",isActive:!0})),n.createElement(i.A,{size:"caption"},n.createElement(d.sA,{id:k?"DEVICE_ACTIONS_UPDATE_IN_PROGRESS":e.upgrade_to_firmware?"DEVICE_ACTIONS_UPDATE_READY_DETAILED":"DEVICE_ACTIONS_UPDATE_READY",values:{deviceName:(0,s.Q)(e),version:e.upgrade_to_firmware}})),k?null:n.createElement(J.A,{marginLeft:"auto",justifyContent:"center",alignItems:"center",gap:15},n.createElement(g.A,{device:e,label:"COMMON_ACTION_UPDATE"}))):null,n.createElement(Y.R,{flexDirection:"column"},n.createElement(J.A,{justifyContent:"space-between",alignItems:"center"},n.createElement(b,{device:e}),n.createElement(h.A,{messageId:"DEVICE_ACTIONS_REASSIGN_DEVICE_DESCRIPTION",tooltipClassName:"tooltip-position-fixer"})))),n.createElement(p.A,{activeItem:e}))},O=({activeItem:e})=>{const t=(0,o.useDispatch)(),a=(0,n.useMemo)(()=>({name:e.name}),[e.name]);return n.createElement(r.l1,{initialValues:a,onSubmit:async o=>{o.name!==a.name&&(await t((0,u.c8)({name:o.name},e._id,{failureToast:{icon:_.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"}})),await t((0,u.pI)(e.mac)))}},({dirty:t})=>n.createElement(D,{isDirty:t,activeItem:e}))}}}]);