"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[1819],{870198:(e,t,S)=>{S.r(t),S.d(t,{default:()=>A});var s=S(296540),i=S(469733),n=S(429252),a=S.n(n),u=S(669715),E=S(439141),r=S(490454),o=S(522373),c=S(867609);const A=(0,s.memo)(()=>{const e=(0,i.useDispatch)(),t=(0,i.useSelector)(r.AF),[S,n]=(0,s.useState)(t),A=(0,s.useRef)(),T=(0,s.useCallback)(async()=>{A.current&&clearTimeout(A.current),S!==t&&(await e((0,E.ln)(void 0,{resolveWithExisting:!1})),setTimeout(()=>{T()},2e3))},[e,t,S]),{addSubscriptionStateListener:O,removeSubscriptionStateListener:l,subscriptionState:_}=(0,i.useSelector)(o.N),I=(0,s.useCallback)(S=>{const s=S?.status===c.xN.SUBSCRIBED;a()(S,_)||s!==t&&T(),e((0,u.n5)(S)),n(s)},[e,t,_,T]);return(0,s.useEffect)(()=>{const e=A.current;return O(I),()=>{clearTimeout(e),l(I)}},[O,l,I]),null})},867609:(e,t,S)=>{var s,i,n;S.d(t,{Ov:()=>n,mE:()=>s,xN:()=>i}),function(e){e.STATUS="status",e.MESSAGE="message"}(s||(s={})),function(e){e.AVAILABLE="available",e.NOT_AVAILABLE="not_available",e.SUBSCRIBED="subscribed"}(i||(i={})),function(e){e.SUBSCRIPTION_STATE="subscriptionState",e.ADD_SUBSCRIPTION_STATE_LISTENER="addSubscriptionStateListener",e.REMOVE_SUBSCRIPTION_STATE_LISTENER="removeSubscriptionStateListener",e.OPEN_MODAL="openModal",e.CLOSE_MODAL="closeModal"}(n||(n={}))},522373:(e,t,S)=>{S.d(t,{N:()=>E});var s=S(801081),i=S(874807),n=S(448547),a=S(187483),u=S(867609);const E=(0,s.Mz)(a.nx,e=>e[n.Y7.WAN_MAGIC_ADAPTER]||{[u.Ov.SUBSCRIPTION_STATE]:{[u.mE.STATUS]:void 0,[u.mE.MESSAGE]:void 0},[u.Ov.ADD_SUBSCRIPTION_STATE_LISTENER]:i.A,[u.Ov.REMOVE_SUBSCRIPTION_STATE_LISTENER]:i.A,[u.Ov.OPEN_MODAL]:i.A,[u.Ov.CLOSE_MODAL]:i.A})}}]);