"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[55080],{637084(e,r,t){t.d(r,{A:()=>O});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),p=t(619619),m=t(876809),v=t(113454),A=t(621309);const f=(0,s.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:r})=>({powerSupervisor:(0,p.f)(e,(0,v.lD)(r,e))}),handleSubmit:(e,{resetForm:r})=>r({values:e}),validationSchema:m.A}),O=(0,a.Zz)((0,n.Ng)((e,{device:{mac:r}})=>({powerSupervisor:(0,l.x0)(r)(e)})))(f(({powerSupervisor:e,device:r,setFormDirty:t,setFormInvalid:s,validateForm:a,values:l,resetForm:p,dirty:m,isValid:v,formName:f=d.r8})=>{const O=(0,n.wA)();return(0,o.useEffect)(()=>(O((0,c.uo)({[f]:()=>({})})),O((0,c.Oo)({[f]:()=>{a().then(r=>{Object.keys(r).length||O((0,A.A)(e?.id,l.powerSupervisor))})}})),O((0,c.rW)({[f]:p})),()=>{O((0,c.uo)({[f]:null})),O((0,c.Oo)({[f]:null})),O((0,c.rW)({[f]:null}))}),[O,p,l.powerSupervisor,f,a,e?.id]),(0,o.useEffect)(()=>{t?.(f,m),s?.(f,!v)},[t,m,s,v,f]),(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})},55080(e,r,t){t.r(r),t.d(r,{default:()=>O});var i=t(274934),o=t(418398),s=t(977872),n=t(159469),a=t(478961),c=t(376892),l=t(535322),u=t(446863),d=t(795206),p=t(637084),m=t(115114),v=t(532635),A=t(269935),f=t(795928);const O=(0,o.Zz)((0,a.A)([f.UH,A.h]))(({activeItem:e,setFormDirty:r,setFormInvalid:t,isDirty:o,isInvalid:a})=>{const O=(0,s.d4)(u.n0),_=(0,s.d4)(u.Lq),C=(0,s.d4)(u.H5),{_id:E,mac:b}=e,j=(0,s.wA)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(f.Ay,{activeItem:e,setFormDirty:r,setFormInvalid:t}),(0,i.jsx)(p.A,{device:e,setFormDirty:r,setFormInvalid:t}),(0,i.jsx)(l.A,{type:l.I.ACCORDION,items:[{id:A.h,openByDefault:!0,label:(0,i.jsx)(c.A,{id:"DEVICE_PROPERTY_HEADER_TOUCHSCREEN"}),renderContent:()=>(0,i.jsx)(A.A,{activeItem:e,setFormDirty:r,setFormInvalid:t})}]}),(0,i.jsx)(l.A,{type:l.I.ACCORDION,items:[{id:v.f,openByDefault:!0,label:(0,i.jsx)(c.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,i.jsx)(v.A,{activeItem:e,hideManualFwUpdate:!0})}]}),(0,i.jsx)(m.A,{isDirty:o,isInvalid:a,onFormSubmit:()=>{const e=Object.entries(O).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},{});j((0,d.ex)(e,E,b,{failureToast:{icon:n.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"},extend:!0})).then(()=>{Object.values(_).forEach(e=>{"function"==typeof e&&e()})})},onFormCancel:()=>{Object.values(C).forEach(e=>{"function"==typeof e&&e()})}})]})})}}]);