"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[43912],{369264(e,t,o){o.d(t,{A:()=>f});var i=o(602086),a=o(977872),r=o(660375),n=o(890932),s=o(53049),u=o(470070),c=o(570801),l=o(228502),d=o(974390);const f=()=>{const{formatMessage:e}=(0,u.tz)(),{createNotification:t,removeNotification:o}=(0,a.d4)(s.o),f=(0,a.d4)(s.v),p=(0,i.useRef)(new Set(Object.keys(f))),m=(0,a.d4)(n.p),y=(0,a.d4)(l.A),b=(0,a.d4)(c.ay);return(0,i.useEffect)(()=>{Object.keys(f).filter(e=>!p.current.has(e)).forEach(o=>{const{toastProps:{details:i,errorMessage:a,errorValues:n,message:s="COMMON_UNKNOWN_ERROR",primaryButton:u,secondaryButton:c,values:l,title:m,titleValues:b,translateTitle:g,notificationType:v,icon:N,...k},option:h={}}=f[o];t({details:i&&"function"==typeof i?i(e):i??(0,r.L)(e,{message:s,values:l,errorValues:n,errorMessage:a}),id:String(o),primaryButton:u&&u.label?u:(0,r.I)(e,{button:u}),secondaryButton:c&&c.label?c:(0,r.I)(e,{button:c}),title:g?e({id:m},b):m,notificationType:v,icon:N,iconUrl:h.deviceModel?d.C.getRemoteImagePath(y[h.deviceModel]):void 0,...k}),p.current.add(o)}),p.current.forEach(e=>{f[e]||(o(e),p.current.delete(e))})},[m,t,e,b,y,f,o]),null}},294627(e,t,o){o.r(t),o.d(t,{default:()=>l});var i=o(274934),a=o(602086),r=o(977872),n=o(369264),s=o(700444),u=o(976458);const c=e=>null==e||"boolean"==typeof e?"":"string"==typeof e?e:"number"==typeof e?String(e):Array.isArray(e)?e.map(c).join(""):(0,a.isValidElement)(e)?c(e.props.children):"",l=()=>{const{createNotification:e,updateNotification:t,removeNotification:o}=(0,r.d4)(u.i9),l=(0,r.wA)(),d=(0,a.useRef)(new Map).current,f=(0,a.useCallback)((e,t)=>{Number.isInteger(e)&&0!==e&&(d.has(t)&&(clearTimeout(d.get(t)),d.delete(t)),d.set(t,setTimeout(()=>{o(t),l((0,s.uU)(t))},e)))},[l,o]),p=(0,a.useCallback)(t=>{const o="string"==typeof t.details?t:{...t,details:c(t.details)},i=e(o);return f(void 0!==t?.duration||"DownloadsToast"===t?.notificationType?t?.duration:5e3,i),i},[e,f]),m=(0,a.useCallback)(e=>{e.id&&(t(e),f(void 0!==e?.duration||"DownloadsToast"===e?.notificationType?e?.duration:5e3,e.id))},[t,f]);return(0,a.useEffect)(()=>{l((0,s.Ez)({createNotification:p,updateNotification:m,removeNotification:o}))},[l,p,m,o]),(0,i.jsx)(n.A,{})}},660375(e,t,o){o.d(t,{I:()=>i,L:()=>a});const i=(e,{button:t})=>t?{...t,label:e({id:t.message},t.values)}:void 0,a=(e,{message:t,values:o,errorMessage:i,errorValues:a})=>{const r=i&&e({id:i},a);return`${e({id:t},o)}${r?`. ${r}`:""}`}}}]);