1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7526],{27526:function(e,t,s){s.d(t,{SessionProvider:function(){return es},zB:function(){return et},kP:function(){return Q}});var n=s(57437),r=s(2265);class a extends Error{constructor(e,t){e instanceof Error?super(void 0,{cause:{err:e,...e.cause,...t}}):"string"==typeof e?(t instanceof Error&&(t={err:t,...t.cause}),super(e,t)):super(void 0,e),this.name=this.constructor.name,this.type=this.constructor.type??"AuthError",this.kind=this.constructor.kind??"error",Error.captureStackTrace?.(this,this.constructor);let s=`https://errors.authjs.dev#${this.type.toLowerCase()}`;this.message+=`${this.message?". ":""}Read more at ${s}`}}class i extends a{}i.kind="signIn";class o extends a{}o.type="AdapterError";class c extends a{}c.type="AccessDenied";class l extends a{}l.type="CallbackRouteError";class d extends a{}d.type="ErrorPageLoop";class u extends a{}u.type="EventError";class p extends a{}p.type="InvalidCallbackUrl";class h extends Error{constructor(){super(...arguments),this.code="credentials"}}h.type="CredentialsSignin";class f extends a{}f.type="InvalidEndpoints";class v extends a{}v.type="InvalidCheck";class y extends a{}y.type="JWTSessionError";class g extends a{}g.type="MissingAdapter";class w extends a{}w.type="MissingAdapterMethods";class E extends a{}E.type="MissingAuthorize";class S extends a{}S.type="MissingSecret";class x extends i{}x.type="OAuthAccountNotLinked";class _ extends i{}_.type="OAuthCallbackError";class m extends a{}m.type="OAuthProfileParseError";class b extends a{}b.type="SessionTokenError";class L extends i{}L.type="OAuthSignInError";class U extends i{}U.type="EmailSignInError";class k extends a{}k.type="SignOutError";class R extends a{}R.type="UnknownAction";class A extends a{}A.type="UnsupportedStrategy";class C extends a{}C.type="InvalidProvider";class T extends a{}T.type="UntrustedHost";class $ extends a{}$.type="Verification";class P extends i{}P.type="MissingCSRF";class N extends a{}N.type="DuplicateConditionalUI";class I extends a{}I.type="MissingWebAuthnAutocomplete";class M extends a{}M.type="WebAuthnVerificationError";class O extends i{}O.type="AccountNotLinked";class H extends a{}H.type="ExperimentalFeatureNotEnabled";class X extends a{}class j extends a{}async function W(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=`${V(t)}/${e}`;try{let e={headers:{"Content-Type":"application/json",...n?.headers?.cookie?{cookie:n.headers.cookie}:{}}};n?.body&&(e.body=JSON.stringify(n.body),e.method="POST");let t=await fetch(r,e),s=await t.json();if(!t.ok)throw s;return s}catch(e){return s.error(new X(e.message,e)),null}}function V(e){return"undefined"==typeof window?`${e.baseUrlServer}${e.basePathServer}`:e.basePath}function B(){return Math.floor(Date.now()/1e3)}function D(e){let t=new URL("http://localhost:3000/api/auth");e&&!e.startsWith("http")&&(e=`https://${e}`);let s=new URL(e||t),n=("/"===s.pathname?t.pathname:s.pathname).replace(/\/$/,""),r=`${s.origin}${n}`;return{origin:s.origin,host:s.host,path:n,base:r,toString:()=>r}}var F=s(25566);let z={baseUrl:D(F.env.NEXTAUTH_URL??F.env.VERCEL_URL).origin,basePath:D(F.env.NEXTAUTH_URL).path,baseUrlServer:D(F.env.NEXTAUTH_URL_INTERNAL??F.env.NEXTAUTH_URL??F.env.VERCEL_URL).origin,basePathServer:D(F.env.NEXTAUTH_URL_INTERNAL??F.env.NEXTAUTH_URL).path,_lastSync:0,_session:void 0,_getSession:()=>{}},J=null;function q(){return"undefined"==typeof BroadcastChannel?{postMessage:()=>{},addEventListener:()=>{},removeEventListener:()=>{}}:(null===J&&(J=new BroadcastChannel("next-auth")),J)}let G={debug:console.debug,error:console.error,warn:console.warn},K=r.createContext?.(void 0);function Q(e){if(!K)throw Error("React Context is unavailable in Server Components");let t=r.useContext(K),{required:s,onUnauthenticated:n}=e??{},a=s&&"unauthenticated"===t.status;return(r.useEffect(()=>{if(a){let e=`${z.basePath}/signin?${new URLSearchParams({error:"SessionRequired",callbackUrl:window.location.href})}`;n?n():window.location.href=e}},[a,n]),a)?{data:t.data,update:t.update,status:"loading"}:t}async function Y(e){let t=await W("session",z,G,e);return(e?.broadcast??!0)&&q().postMessage({event:"session",data:{trigger:"getSession"}}),t}async function Z(){let e=await W("csrf",z,G);return e?.csrfToken??""}async function ee(){return W("providers",z,G)}async function et(e,t,s){let{callbackUrl:n=window.location.href,redirect:r=!0}=t??{},a=V(z),i=await ee();if(!i){window.location.href=`${a}/error`;return}if(!e||!(e in i)){window.location.href=`${a}/signin?${new URLSearchParams({callbackUrl:n})}`;return}let o="credentials"===i[e].type,c="email"===i[e].type,l=`${a}/${o?"callback":"signin"}/${e}`,d=await Z(),u=await fetch(`${l}?${new URLSearchParams(s)}`,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"}
1,body:new URLSearchParams({...t,csrfToken:d,callbackUrl:n})}),p=await u.json();if(r||!(o||c)){let e=p.url??n;window.location.href=e,e.includes("#")&&window.location.reload();return}let h=new URL(p.url).searchParams.get("error"),f=new URL(p.url).searchParams.get("code");return u.ok&&await z._getSession({event:"storage"}),{error:h,code:f,status:u.status,ok:u.ok,url:h?null:p.url}}function es(e){if(!K)throw Error("React Context is unavailable in Server Components");let{children:t,basePath:s,refetchInterval:a,refetchWhenOffline:i}=e;s&&(z.basePath=s);let o=void 0!==e.session;z._lastSync=o?B():0;let[c,l]=r.useState(()=>(o&&(z._session=e.session),e.session)),[d,u]=r.useState(!o);r.useEffect(()=>(z._getSession=async function(){let{event:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t="storage"===e;if(t||void 0===z._session){z._lastSync=B(),z._session=await Y({broadcast:!t}),l(z._session);return}if(!e||null===z._session||B()<z._lastSync)return;z._lastSync=B(),z._session=await Y(),l(z._session)}catch(e){G.error(new j(e.message,e))}finally{u(!1)}},z._getSession(),()=>{z._lastSync=0,z._session=void 0,z._getSession=()=>{}}),[]),r.useEffect(()=>{let e=()=>z._getSession({event:"storage"});return q().addEventListener("message",e),()=>q().removeEventListener("message",e)},[]),r.useEffect(()=>{let{refetchOnWindowFocus:t=!0}=e,s=()=>{t&&"visible"===document.visibilityState&&z._getSession({event:"visibilitychange"})};return document.addEventListener("visibilitychange",s,!1),()=>document.removeEventListener("visibilitychange",s,!1)},[e.refetchOnWindowFocus]);let p=function(){let[e,t]=r.useState("undefined"!=typeof navigator&&navigator.onLine),s=()=>t(!0),n=()=>t(!1);return r.useEffect(()=>(window.addEventListener("online",s),window.addEventListener("offline",n),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",n)}),[]),e}(),h=!1!==i||p;r.useEffect(()=>{if(a&&h){let e=setInterval(()=>{z._session&&z._getSession({event:"poll"})},1e3*a);return()=>clearInterval(e)}},[a,h]);let f=r.useMemo(()=>({data:c,status:d?"loading":c?"authenticated":"unauthenticated",async update(e){if(d||!c)return;u(!0);let t=await W("session",z,G,void 0===e?void 0:{body:{csrfToken:await Z(),data:e}});return u(!1),t&&(l(t),q().postMessage({event:"session",data:{trigger:"getSession"}})),t}}),[c,d]);return(0,n.jsx)(K.Provider,{value:f,children:t})}}}]);
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.