"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[76696],{637084(e,r,t){t.d(r,{A:()=>f});var i=t(274934),o=t(602086),s=t(843871),n=t(977872),a=t(418398),c=t(205521),l=t(232410),u=t(1469),d=t(260288),A=t(619619),m=t(876809),p=t(113454),v=t(621309);const O=(0,s.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:r})=>({powerSupervisor:(0,A.f)(e,(0,p.lD)(r,e))}),handleSubmit:(e,{resetForm:r})=>r({values:e}),validationSchema:m.A}),f=(0,a.Zz)((0,n.Ng)((e,{device:{mac:r}})=>({powerSupervisor:(0,l.x0)(r)(e)})))(O(({powerSupervisor:e,device:r,setFormDirty:t,setFormInvalid:s,validateForm:a,values:l,resetForm:A,dirty:m,isValid:p,formName:O=d.r8})=>{const f=(0,n.wA)();return(0,o.useEffect)(()=>(f((0,c.uo)({[O]:()=>({})})),f((0,c.Oo)({[O]:()=>{a().then(r=>{Object.keys(r).length||f((0,v.A)(e?.id,l.powerSupervisor))})}})),f((0,c.rW)({[O]:A})),()=>{f((0,c.uo)({[O]:null})),f((0,c.Oo)({[O]:null})),f((0,c.rW)({[O]:null}))}),[f,A,l.powerSupervisor,O,a,e?.id]),(0,o.useEffect)(()=>{t?.(O,m),s?.(O,!p)},[t,m,s,p,O]),(0,i.jsx)(u.A,{device:r})}))},876809(e,r,t){t.d(r,{A:()=>s,q:()=>o});var i=t(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})},476696(e,r,t){t.r(r),t.d(r,{default:()=>j});var i,o=t(274934),s=t(418398),n=t(977872),a=t(478961),c=t(630849),l=t(376892),u=t(535322),d=t(446863),A=t(795206),m=t(637084),p=t(115114),v=t(322784),O=t(532635),f=t(269935),y=t(795928);!function(e){e.NAME="name",e.PORTS="ports",e.MANAGE="manage"}(i||(i={}));const j=(0,s.Zz)((0,a.A)([i.NAME,f.h,v.q,i.MANAGE]))(({activeItem:e,setFormDirty:r,setFormInvalid:t,isDirty:s,isInvalid:a})=>{const j=(0,n.d4)(d.Lq),N=(0,n.d4)(d.H5),b=(0,n.d4)(d.n0),C=(0,n.wA)(),I=(0,c.I)();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(y.Ay,{activeItem:e,setFormDirty:r,setFormInvalid:t,formName:i.NAME}),(0,o.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:f.h,openByDefault:!0,label:(0,o.jsx)(l.A,{id:"COMMON_LED"}),renderContent:()=>(0,o.jsx)(f.A,{activeItem:e,setFormDirty:r,setFormInvalid:t})}]}),(0,o.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:v.q,openByDefault:!0,label:(0,o.jsx)(l.A,{id:"COMMON_ADVANCED"}),renderContent:()=>(0,o.jsx)(v.A,{activeItem:e,setFormDirty:r,setFormInvalid:t})}]}),(0,o.jsx)(m.A,{device:e,setFormDirty:r,setFormInvalid:t}),(0,o.jsx)(u.A,{type:u.I.ACCORDION,items:[{id:i.MANAGE,openByDefault:!0,label:(0,o.jsx)(l.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,o.jsx)(O.A,{activeItem:e})}]}),(0,o.jsx)(p.A,{isDirty:s,isInvalid:a,onFormSubmit:async()=>{const r=Object.entries(b).reduce((e,[r,t])=>{if("function"==typeof t){const r=t();if("object"==typeof r&&r&&Object.keys(r).length)return{...e,...r}}return e},{});C((0,A.ex)(r,e._id,e.mac,{extend:!0})).then(()=>{Object.values(j).forEach(e=>{"function"==typeof e&&e()})}).catch(I)},onFormCancel:()=>{Object.values(N).forEach(e=>{"function"==typeof e&&e()})}})]})})}}]);