1import{e as d,t as i,f as l}from"./index-CGxUor7o.js";import{r as s}from"./vendor-react-DKqPgjep.js";function m(f){const{redirectOnUnauthenticated:u=!1,redirectPath:n=d()}={},r=i.useUtils(),t=i.auth.me.useQuery(void 0,{retry:!1,refetchOnWindowFocus:!1}),e=i.auth.logout.useMutation({onSuccess:()=>{r.auth.me.setData(void 0,null)}}),c=s.useCallback(async()=>{try{await e.mutateAsync()}catch(o){if(o instanceof l&&o.data?.code==="UNAUTHORIZED")return;throw o}finally{r.auth.me.setData(void 0,null),await r.auth.me.invalidate()}},[e,r]),a=s.useMemo(()=>(localStorage.setItem("manus-runtime-user-info",JSON.stringify(t.data)),{user:t.data??null,loading:t.isLoading||e.isPending,error:t.error??e.error??null,isAuthenticated:!!t.data}),[t.data,t.error,t.isLoading,e.error,e.isPending]);return s.useEffect(()=>{u&&(t.isLoading||e.isPending||a.user||typeof window>"u"||window.location.pathname!==n&&(window.location.href=n))},[u,n,e.isPending,t.isLoading,a.user]),{...a,refresh:()=>t.refetch(),logout:c}}export{m as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.