1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8369],{60931:(e,t,n)=>{n.d(t,{jo:()=>y,lR:()=>s});class s 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 n=`https://errors.authjs.dev#${this.type.toLowerCase()}`;this.message+=`${this.message?". ":""}Read more at ${n}`}}class r extends s{}r.kind="signIn";class a extends s{}a.type="AdapterError";class o extends s{}o.type="AccessDenied";class i extends s{}i.type="CallbackRouteError";class l extends s{}l.type="ErrorPageLoop";class c extends s{}c.type="EventError";class u extends s{}u.type="InvalidCallbackUrl";class d extends r{constructor(){super(...arguments),this.code="credentials"}}d.type="CredentialsSignin";class h extends s{}h.type="InvalidEndpoints";class p extends s{}p.type="InvalidCheck";class v extends s{}v.type="JWTSessionError";class f extends s{}f.type="MissingAdapter";class w extends s{}w.type="MissingAdapterMethods";class g extends s{}g.type="MissingAuthorize";class y extends s{}y.type="MissingSecret";class E extends r{}E.type="OAuthAccountNotLinked";class x extends r{}x.type="OAuthCallbackError";class S extends s{}S.type="OAuthProfileParseError";class m extends s{}m.type="SessionTokenError";class b extends r{}b.type="OAuthSignInError";class _ extends r{}_.type="EmailSignInError";class L extends s{}L.type="SignOutError";class U extends s{}U.type="UnknownAction";class k extends s{}k.type="UnsupportedStrategy";class R extends s{}R.type="InvalidProvider";class A extends s{}A.type="UntrustedHost";class T extends s{}T.type="Verification";class C extends r{}C.type="MissingCSRF";class P extends s{}P.type="DuplicateConditionalUI";class N extends s{}N.type="MissingWebAuthnAutocomplete";class I extends s{}I.type="WebAuthnVerificationError";class M extends r{}M.type="AccountNotLinked";class O extends s{}O.type="ExperimentalFeatureNotEnabled"},98369:(e,t,n)=>{n.r(t),n.d(t,{SessionContext:()=>_,SessionProvider:()=>P,__NEXTAUTH:()=>E,getCsrfToken:()=>k,getProviders:()=>R,getSession:()=>U,signIn:()=>T,signOut:()=>C,useSession:()=>L});var s,r,a,o,i,l=n(54568),c=n(7620),u=n.t(c,2),d=n(60931);class h extends d.lR{}class p extends d.lR{}async function v(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r="".concat(f(t),"/").concat(e);try{var a;let e={headers:{"Content-Type":"application/json",...(null==s||null==(a=s.headers)?void 0:a.cookie)?{cookie:s.headers.cookie}:{}}};(null==s?void 0:s.body)&&(e.body=JSON.stringify(s.body),e.method="POST");let t=await fetch(r,e),n=await t.json();if(!t.ok)throw n;return n}catch(e){return n.error(new h(e.message,e)),null}}function f(e){return e.basePath}function w(){return Math.floor(Date.now()/1e3)}function g(e){let t=new URL("http://localhost:3000/api/auth");e&&!e.startsWith("http")&&(e="https://".concat(e));let n=new URL(e||t),s=("/"===n.pathname?t.pathname:n.pathname).replace(/\/$/,""),r="".concat(n.origin).concat(s);return{origin:n.origin,host:n.host,path:s,base:r,toString:()=>r}}var y=n(40459);let E={baseUrl:g(null!=(r=y.env.NEXTAUTH_URL)?r:y.env.VERCEL_URL).origin,basePath:g(y.env.NEXTAUTH_URL).path,baseUrlServer:g(null!=(o=null!=(a=y.env.NEXTAUTH_URL_INTERNAL)?a:y.env.NEXTAUTH_URL)?o:y.env.VERCEL_URL).origin,basePathServer:g(null!=(i=y.env.NEXTAUTH_URL_INTERNAL)?i:y.env.NEXTAUTH_URL).path,_lastSync:0,_session:void 0,_getSession:()=>{}},x=null;function S(){return"undefined"==typeof BroadcastChannel?{postMessage:()=>{},addEventListener:()=>{},removeEventListener:()=>{},name:"next-auth",onmessage:null,onmessageerror:null,close:()=>{},dispatchEvent:()=>!1}:new BroadcastChannel("next-auth")}function m(){return null===x&&(x=S()),x}let b={debug:console.debug,error:console.error,warn:console.warn},_=null==(s=c.createContext)?void 0:s.call(u,void 0);function L(e){if(!_)throw Error("React Context is unavailable in Server Components");let t=c.useContext(_),{required:n,onUnauthenticated:s}=null!=e?e:{},r=n&&"unauthenticated"===t.status;return(c.useEffect(()=>
1{if(r){let e="".concat(E.basePath,"/signin?").concat(new URLSearchParams({error:"SessionRequired",callbackUrl:window.location.href}));s?s():window.location.href=e}},[r,s]),r)?{data:t.data,update:t.update,status:"loading"}:t}async function U(e){var t;let n=await v("session",E,b,e);return(null==(t=null==e?void 0:e.broadcast)||t)&&S().postMessage({event:"session",data:{trigger:"getSession"}}),n}async function k(){var e;let t=await v("csrf",E,b);return null!=(e=null==t?void 0:t.csrfToken)?e:""}async function R(){return v("providers",E,b)}function A(){return{error:"NetworkError",code:void 0,status:0,ok:!1,url:null}}async function T(e,t,n){var s,r,a;let o,i,{callbackUrl:l,...c}=null!=t?t:{},{redirect:u=!0,redirectTo:d=null!=l?l:window.location.href,...h}=c,p=f(E),v=await R();if(!v)return u?void(window.location.href="".concat(p,"/error")):A();if(!e||!v[e]){let e="".concat(p,"/signin?").concat(new URLSearchParams({callbackUrl:d}));window.location.href=e;return}let w=v[e].type;if("webauthn"===w)throw TypeError(['Provider id "'.concat(e,'" refers to a WebAuthn provider.'),'Please use `import { signIn } from "next-auth/webauthn"` instead.'].join("\n"));let g="".concat(p,"/").concat("credentials"===w?"callback":"signin","/").concat(e),y=await k();try{o=await fetch("".concat(g,"?").concat(new URLSearchParams(n)),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({...h,csrfToken:y,callbackUrl:d})})}catch(e){if(u)throw e;return A()}try{i=await o.json()}catch(e){if(u)throw e;return A()}if(u){let e=null!=(s=i.url)?s:d;window.location.href=e,e.includes("#")&&window.location.reload();return}if("string"!=typeof(null==i?void 0:i.url))return A();let x=null!=(r=new URL(i.url).searchParams.get("error"))?r:void 0,S=null!=(a=new URL(i.url).searchParams.get("code"))?a:void 0;return o.ok&&await E._getSession({event:"storage"}),{error:x,code:S,status:o.status,ok:o.ok,url:x?null:i.url}}async function C(e){var t,n;let{redirect:s=!0,redirectTo:r=null!=(t=null==e?void 0:e.callbackUrl)?t:window.location.href}=null!=e?e:{},a=f(E),o=await k(),i=await fetch("".concat(a,"/signout"),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({csrfToken:o,callbackUrl:r})}),l=await i.json();if(m().postMessage({event:"session",data:{trigger:"signout"}}),s){let e=null!=(n=l.url)?n:r;window.location.href=e,e.includes("#")&&window.location.reload();return}return await E._getSession({event:"storage"}),l}function P(e){if(!_)throw Error("React Context is unavailable in Server Components");let{children:t,basePath:n,refetchInterval:s,refetchWhenOffline:r}=e;n&&(E.basePath=n);let a=void 0!==e.session;E._lastSync=a?w():0;let[o,i]=c.useState(()=>(a&&(E._session=e.session),e.session)),[u,d]=c.useState(!a);c.useEffect(()=>(E._getSession=async function(){let{event:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t="storage"===e;if(t||void 0===E._session){E._lastSync=w(),E._session=await U({broadcast:!t}),i(E._session);return}if(!e||null===E._session||w()<E._lastSync)return;E._lastSync=w(),E._session=await U(),i(E._session)}catch(e){b.error(new p(e.message,e))}finally{d(!1)}},E._getSession(),()=>{E._lastSync=0,E._session=void 0,E._getSession=()=>{}}),[]),c.useEffect(()=>{let e=()=>E._getSession({event:"storage"});return m().addEventListener("message",e),()=>m().removeEventListener("message",e)},[]),c.useEffect(()=>{let{refetchOnWindowFocus:t=!0}=e,n=()=>{t&&"visible"===document.visibilityState&&E._getSession({event:"visibilitychange"})};return document.addEventListener("visibilitychange",n,!1),()=>document.removeEventListener("visibilitychange",n,!1)},[e.refetchOnWindowFocus]);let h=function(){let[e,t]=c.useState("undefined"!=typeof navigator&&navigator.onLine),n=()=>t(!0),s=()=>t(!1);return c.useEffect(()=>(window.addEventListener("online",n),window.addEventListener("offline",s),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}),[]),e}(),f=!1!==r||h;c.useEffect(()=>{if(s&&f){let e=setInterval(()=>{E._session&&E._getSession({event:"poll"})},1e3*s);return()=>clearInterval(e)}},[s,f]);let g=c.useMemo(()=>({data:o,status:u?"loading":o?"authenticated":"unauthenticated",async update(e){if(u)return;d(!0);let t=await v("session",E,b,void 0===e?void 0:{body:{csrfToken:await k(),data:e}});return d(!1),t&&(i(t),m().postMessage({event:"session",data:{trigger:"getSession"}})),t}}),[o,u]);return(0,l.jsx)(_.Provider,{value:g,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.