import{r as o,j as n,A as h}from"./vendor-react-loeotUMb.js";import{d as f,e as k}from"./use-auth-BpnYKcp5.js";import{S as s}from"./storage-DaZGhURt.js";const v=({children:c})=>{const{pageData:u}=f(),{returnTo:l}=u?.props||{},[d,m]=o.useState({returnTo:""}),t=k(!0);return n.jsx(i.Provider,{value:d,children:n.jsx(h,{domain:t.domain,clientId:t.clientId,cacheLocation:s.isAvailable()?"localstorage":"memory",useRefreshTokens:!0,authorizationParams:{audience:t.apiAudience,scope:"openid profile email",redirect_uri:(typeof window<"u"&&window.location.origin||"/static/")+"/callback/"},useRefreshTokensFallback:!0,onRedirectCallback:(r,p)=>{const{pathname:a}=window.location;s.setItem("sa_auth_event",1),window.history.replaceState({},document.title,a);const e=r?.returnTo||l?.path;m({appState:r,user:p,returnTo:e}),a!=="/callback/"&&(!e||e===a||setTimeout(()=>{window.location.href=e},5*1e3))},children:c})})},i=o.createContext({appState:void 0,user:void 0,returnTo:""}),x=()=>o.useContext(i);export{v as P,x as u}; //# sourceMappingURL=provider-Clg3ybSk.js.map