import{j as x}from"./query-ATBhtd3K.js";import{r as e}from"./vendor-EnoIVk-c.js";import{G as S,H as p,I as C}from"./en-IUV4ZXKH-BjYNERUx.js";const l=e.createContext(void 0);function h({backendUrl:c,children:f}){const[t,s]=e.useState(null),[n,o]=e.useState(!0);e.useEffect(()=>{o(!0),s(null),new S({baseUrl:C(c),eventBus:new p}).getMe().then(i=>{s({token:i.token,user:i})}).catch(()=>{s(null)}).finally(()=>{o(!1)})},[]);const r=e.useCallback(a=>{s(a)},[]),u=e.useCallback(()=>{s(null)},[]),m=e.useMemo(()=>({session:t,isLoading:n,setSession:r,clearSession:u}),[t,n,r,u]);return x.jsx(l.Provider,{value:m,children:f})}const d={session:null,isLoading:!1,setSession:()=>{},clearSession:()=>{}};function k(){return e.useContext(l)??d}export{h as A,k as u};
//# sourceMappingURL=AuthContext-CYne_gJM.js.map
