import{r}from"./index-BDZD4X5K.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"3ea6c863933c57219be78eb06addfb47859d8df2"}}catch{}})();const f=r.createContext(new Map);f.Provider;function p(t,{event:n="message",init:u,enabled:d=!0}={}){let o=r.useContext(f),[l,s]=r.useState(null);return r.useEffect(()=>{if(!d)return;let a=[t.toString(),u?.withCredentials].join("::"),e=o.get(a)??{count:0,source:new EventSource(t,u)};++e.count,o.set(a,e),e.source.addEventListener(n,c),s(null);function c(i){s(i.data||"UNKNOWN_EVENT_DATA")}return()=>{e.source.removeEventListener(n,c),--e.count,e.count<=0&&(e.source.close(),o.delete(a))}},[t,n,u,o,d]),l}export{p as u};
//# sourceMappingURL=use-event-source-CuGNSRa_.js.map
