import{r}from"./index-BtyHvDgk.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:"8bd8bc3153d70a1c10ccde8d38796bd67282553d"}}catch{}})();const l=r.createContext(new Map);l.Provider;function p(t,{event:n="message",init:u,enabled:c=!0}={}){let o=r.useContext(l),[f,a]=r.useState(null);return r.useEffect(()=>{if(!c)return;let d=[t.toString(),u?.withCredentials].join("::"),e=o.get(d)??{count:0,source:new EventSource(t,u)};++e.count,o.set(d,e),e.source.addEventListener(n,s),a(null);function s(i){a(i.data||"UNKNOWN_EVENT_DATA")}return()=>{e.source.removeEventListener(n,s),--e.count,e.count<=0&&(e.source.close(),o.delete(d))}},[t,n,u,o,c]),f}export{p as u};
//# sourceMappingURL=use-event-source-vbj9YzRu.js.map
