import{as as u,at as l,au as d,r as f,av as m,al as p}from"./index-ktJf6c6X.js";import{p as I}from"./notificationSound-XZEPjESV.js";const y=()=>{var i;const c=u(),n=l(e=>{var t,r;return(r=(t=e==null?void 0:e.user)==null?void 0:t.data)==null?void 0:r.userId}),{data:a}=d({}),s=((i=a==null?void 0:a.userProfileDTO)==null?void 0:i.userReferenceId)??n;f.useEffect(()=>{if(!s)return;const e=`${m}/erp-crm/v1/notifications/stream?userId=${s}`;let t=null;try{t=new EventSource(e)}catch{return}return t.onmessage=r=>{try{const o=JSON.parse(r.data);if((o==null?void 0:o.type)==="PING")return}catch{}c(p.util.invalidateTags(["Notification","SalesTask"])),I()},t.onerror=()=>{},()=>{t==null||t.close()}},[s,c])};export{y as u};
