"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[82824],{595778(e,t,r){r.d(t,{I:()=>o,U:()=>s});var i=r(241365);const o=(0,r(419284).Wj)(i.Ay["blue-0"]),s=100},446863(e,t,r){r.d(t,{H5:()=>d,Lq:()=>l,n0:()=>n});var i=r(909924),o=r(573534),s=r(172205);const n=e=>e[s.U.SHARED][o.N.PROPERTY_PANEL]?.[i.Io.TAB_GET_DATA_FUNCTION]||{},l=e=>e[s.U.SHARED][o.N.PROPERTY_PANEL]?.[i.Io.TAB_SUBMIT_FUNCTION]||{},d=e=>e[s.U.SHARED][o.N.PROPERTY_PANEL]?.[i.Io.TAB_RESET_FUNCTION]||{}},637084(e,t,r){r.d(t,{A:()=>O});var i=r(274934),o=r(602086),s=r(843871),n=r(977872),l=r(418398),d=r(205521),a=r(232410),c=r(1469),u=r(260288),m=r(619619),_=r(876809),A=r(113454),v=r(621309);const p=(0,s.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:t})=>({powerSupervisor:(0,m.f)(e,(0,A.lD)(t,e))}),handleSubmit:(e,{resetForm:t})=>t({values:e}),validationSchema:_.A}),O=(0,l.Zz)((0,n.Ng)((e,{device:{mac:t}})=>({powerSupervisor:(0,a.x0)(t)(e)})))(p(({powerSupervisor:e,device:t,setFormDirty:r,setFormInvalid:s,validateForm:l,values:a,resetForm:m,dirty:_,isValid:A,formName:p=u.r8})=>{const O=(0,n.wA)();return(0,o.useEffect)(()=>(O((0,d.uo)({[p]:()=>({})})),O((0,d.Oo)({[p]:()=>{l().then(t=>{Object.keys(t).length||O((0,v.A)(e?.id,a.powerSupervisor))})}})),O((0,d.rW)({[p]:m})),()=>{O((0,d.uo)({[p]:null})),O((0,d.Oo)({[p]:null})),O((0,d.rW)({[p]:null}))}),[O,m,a.powerSupervisor,p,l,e?.id]),(0,o.useEffect)(()=>{r?.(p,_),s?.(p,!A)},[r,_,s,A,p]),(0,i.jsx)(c.A,{device:t})}))},876809(e,t,r){r.d(t,{A:()=>s,q:()=>o});var i=r(950804);const o=i.A.object().shape({power_sources:i.A.array().transform(e=>e.filter(e=>e.power_source_mac)).of(i.A.object().shape({client_psu_index:i.A.number().required(),power_source_mac:i.A.string().label("COMMON_POWER_SOURCE").required(),power_source_index:i.A.string().label("COMMON_OUTLET").required()})).label("COMMON_POWER_SOURCE").min(1)}).optional(),s=i.A.object().shape({powerSupervisor:o})},377764(e,t,r){r.d(t,{A:()=>E,R:()=>I});var i=r(274934),o=r(418398),s=r(977872),n=r(602086),l=r(843871),d=r(938984),a=r(925845),c=r(762705),u=r(60927),m=r(419284),_=r(586566),A=r(309130),v=r(100978),p=r(205521),O=r(470070),x=r(291935),h=r(857780),j=r(595778);const I="led",b=(0,l.bk)({enableReinitialize:!0,mapPropsToValues:({activeItem:{led_override:e,led_override_color:t=j.I,led_override_color_brightness:r=j.U}={},mgmtSettings:i})=>({led_override:e||(!1===i.led_enabled?h.c_.OFF:h.c_.ON),led_override_color:t,led_override_color_brightness:r}),handleSubmit:(e,{resetForm:t})=>{t({values:e})}}),f=e=>(0,i.jsxs)("span",{children:[e,"%"]}),E=(0,o.Zz)((0,s.Ng)(e=>({mgmtSettings:(0,x.$5)(e)})))(b(({activeItem:e,setFormDirty:t,setFormInvalid:r,dirty:o,isValid:l,values:x,resetForm:b,setFieldValue:E,formName:g=I,mgmtSettings:{led_enabled:C}})=>{const N=(0,s.wA)(),y=(0,_.lp)(e),R=(C&&e.led_override!==h.c_.OFF||e.led_override===h.c_.ON)&&y;(0,n.useEffect)(()=>(N((0,p.uo)({[g]:()=>x})),N((0,p.Oo)({[g]:()=>b({values:x})})),N((0,p.rW)({[g]:b})),()=>{N((0,p.uo)({[g]:null})),N((0,p.Oo)({[g]:null})),N((0,p.rW)({[g]:null}))}),[N,b,x,g]),(0,n.useEffect)(()=>{t(g,o),r(g,!l)},[t,r,o,l,g]);const S=(0,n.useCallback)(e=>{E("led_override_color",(0,m.E6)(e.toString())||j.I)},[E]);return(0,i.jsxs)(v.A,{gap:A.Ln,flexDirection:"column",children:[(0,i.jsx)(v.A,{width:"100%",justifyContent:"space-between",children:(0,i.jsx)(c.A,{id:"led_override",checked:h.c_.ON===x.led_override,onChange:()=>{E("led_override",x.led_override===h.c_.ON?h.c_.OFF:h.c_.ON)},children:(0,i.jsx)(d.A,{size:"medium",color:"text-2",children:(0,i.jsx)(O.sA,{id:"COMMON_LED"})})})}),R?(0,i.jsxs)(v.A,{flexDirection:"column",gap:12,children:[(0,i.jsx)(d.A,{size:"medium",children:(0,i.jsx)(O.sA,{id:"COMMON_BRIGHTNESS"})}),(0,i.jsx)(a.A,{size:"large",value:+x.led_override_color_brightness||100,withValueIndicator:!0,valueIndicatorPosition:"right",formatValueIndicatorContent:f,onChange:({target:{value:e}})=>{E("led_override_color_brightness",e)}}),(0,i.jsx)(d.A,{size:"medium",color:"text-1",weight:"bold",children:(0,i.jsx)(O.sA,{id:"COMMON_COLOR"})}),(0,i.jsx)(u.A,{value:x?.led_override_color||j.I,onChange:S,sliders:[{id:"hue",channel:"hue"}],colorSpace:"hex",children:(0,i.jsx)("span",{children:(0,i.jsx)(O.sA,{id:"DEVICE_PROPERTIES_LABEL_HEX"})})})]}):null]})}))},773351(e,t,r){r.d(t,{A:()=>f});var i=r(274934),o=r(602086),s=r(938984),n=r(814557),l=r(600191),d=r(343954),a=r(247816),c=r(309130),u=r(100978),m=r(470070),_=r(708861),A=r(956978),v=r(434521),p=r(251323),O=r(332522),x=r(713053);const h=(0,a.A)("div")`
  display: flex;
  flex-direction: column;
`,j=(0,a.A)("div")`
  margin-top: ${c.Ln};
  padding-top: ${c.Ln};
  border-top: ${({theme:{themeName:e}})=>n.Ay[`desktop-border-divider-${e}`]};

  div:first-child {
    margin-bottom: ${c.xO};
  }
`,I=(0,a.A)(l.A)`
  color: ${({theme:{themeName:e}})=>n.Ay[`desktop-color-orange-06-${e}`]};
  height: 18px;
  width: 18px;
  margin-right: 10px;
`,b=(0,a.A)(d.A)`
  color: ${({theme:{themeName:e}})=>n.Ay[`desktop-color-green-06-${e}`]};
  height: 18px;
  width: 18px;
  margin-right: 10px;
`,f=({activeItem:e,activeItem:{outlet_table:t,outlet_ac_power_budget:r,outlet_ac_power_consumption:n,port_table:l},hidePorts:d,noDivider:a,gap:f=c.xO,legend:E,verticalLegend:g,tooltipPlacement:C="bottom end"})=>{const{usedPower:N,maxPower:y}=(0,o.useMemo)(()=>(0,_.hf)({outlet_table:t,outlet_ac_power_budget:r,outlet_ac_power_consumption:n}),[t,r,n]),R=(0,A.Tl7)(e)||(0,A.kYz)(e);return(0,i.jsxs)(h,{children:[(0,i.jsxs)(u.A,{justifyContent:"center",gap:f,alignItems:g?"center":void 0,children:[(0,i.jsx)(u.A,{flexDirection:"column",children:(0,i.jsx)(O.A,{disableOnPortClick:!0,activeItem:e,tooltipPlacement:C,isEU:(0,A.goQ)(e),offline:(0,A.aK8)((0,v.S9)(e))})}),l&&!d?(0,i.jsx)("div",{children:(0,i.jsx)(p.A,{activeItem:e,portSizeOverride:"19px",disableOnPortClick:R})}):null,g]}),g?null:E||(0,i.jsx)(x.Ay,{activeItem:e,noTopBorder:a}),N>y?(0,i.jsxs)(j,{children:[(0,i.jsxs)(u.A,{justifyContent:"space-between",children:[(0,i.jsx)(I,{}),(0,i.jsx)(s.A,{size:"small",children:(0,i.jsx)(m.sA,{id:"DEVICE_PROPERTIES_OUTLET_POWER_OVERLOAD_WARNING"})})]}),(0,i.jsxs)(u.A,{justifyContent:"space-between",children:[(0,i.jsx)(b,{}),(0,i.jsx)(s.A,{size:"small",children:(0,i.jsx)(m.sA,{id:"DEVICE_PROPERTIES_OUTLET_POWER_OVERLOAD_INFO"})})]})]}):null]})}},582824(e,t,r){r.r(t),r.d(t,{default:()=>b});var i=r(274934),o=r(418398),s=r(977872),n=r(135469),l=r(409844),d=r(478961),a=r(630849),c=r(376892),u=r(535322),m=r(446863),_=r(795206),A=r(637084),v=r(773351),p=r(115114),O=r(392184),x=r(148561),h=r(532635),j=r(377764),I=r(795928);const b=(0,o.Zz)((0,d.A)([I.UH,j.R,x.g,h.f]))(({activeItem:e,setFormDirty:t,setFormInvalid:r,isDirty:o,isInvalid:d})=>{const b=(0,s.d4)(m.n0),f=(0,s.d4)(m.Lq),E=(0,s.d4)(m.H5),g=(0,s.wA)(),C=(0,a.I)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.A,{className:l.AH`
          margin-bottom: 16px;
        `,children:(0,i.jsx)(v.A,{activeItem:e,hidePorts:!0})}),(0,i.jsx)(I.Ay,{activeItem:e,setFormDirty:t,setFormInvalid:r}),(0,i.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:"outlets",openByDefault:!0,label:(0,i.jsx)(c.A,{id:"COMMON_OUTLETS"}),renderContent:()=>(0,i.jsx)(O.A,{hidePorts:!0,activeItem:e})}]}),(0,i.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:j.R,openByDefault:!0,label:(0,i.jsx)(c.A,{id:"COMMON_LED"}),renderContent:()=>(0,i.jsx)(j.A,{activeItem:e,setFormDirty:t,setFormInvalid:r})}]}),(0,i.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:x.g,openByDefault:!0,label:(0,i.jsx)(c.A,{id:"COMMON_IP_SETTINGS"}),renderContent:()=>(0,i.jsx)(x.A,{activeItem:e,setFormDirty:t,setFormInvalid:r})}]}),(0,i.jsx)(A.A,{device:e,setFormDirty:t,setFormInvalid:r}),(0,i.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:h.f,openByDefault:!0,label:(0,i.jsx)(c.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,i.jsx)(h.A,{activeItem:e})}]}),(0,i.jsx)(p.A,{isDirty:o,isInvalid:d,onFormSubmit:()=>{const t=Object.entries(b).reduce((e,[t,r])=>{if("function"==typeof r){const t=r();if("object"==typeof t&&t&&Object.keys(t).length)return{...e,...t}}return e},{});g((0,_.ex)(t,e._id,e.mac,{extend:!0})).then(()=>{Object.values(f).forEach(e=>{"function"==typeof e&&e()})}).catch(C)},onFormCancel:()=>{Object.values(E).forEach(e=>{"function"==typeof e&&e()})}})]})})},478961(e,t,r){r.d(t,{A:()=>s});var i=r(274934),o=r(602086);const s=function(e){return t=>r=>{const[s,n]=(0,o.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[l,d]=(0,o.useState)(Object.fromEntries(e.map(e=>[e,!1]))),a=(0,o.useCallback)((e,t)=>{n(r=>({...r,[e]:t}))},[]),c=(0,o.useCallback)((e,t)=>{d(r=>({...r,[e]:t}))},[]),u=!!Object.values(s).find(e=>e),m=!!Object.values(l).find(e=>e);return(0,i.jsx)(t,{isDirty:u,isInvalid:m,formStates:s,setFormDirty:a,setFormInvalid:c,...r})}}}}]);