1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,861509,e=>{"use strict";let t,o,n;var r,i,s=e.i(247167);let a=Object.create(null),l=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?a:globalThis),u=new Proxy(a,{get:(e,t)=>l()[t]??a[t],has:(e,t)=>t in l()||t in a,set:(e,t,o)=>(l(!0)[t]=o,!0),deleteProperty(e,t){if(!t)return!1;let o=l(!0);return delete o[t],!0},ownKeys:()=>Object.keys(l(!0))});function _(e,t){return void 0!==s.default&&s.default.env?s.default.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}void 0!==s.default&&s.default.env,Object.freeze({get BETTER_AUTH_SECRET(){return _("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return _("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return _("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return _("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return _("NODE_ENV","development")},get PACKAGE_VERSION(){return _("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return _("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});let c={eterm:4,cons25:4,console:4,cygwin:4,dtterm:4,gnome:4,hurd:4,jfbterm:4,konsole:4,kterm:4,mlterm:4,mosh:24,putty:4,st:4,"rxvt-unicode-24bit":24,terminator:24,"xterm-kitty":24},E=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),d=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],O="\x1b[0m",T="\x1b[31m",A="\x1b[32m",p="\x1b[33m",R="\x1b[34m",f="\x1b[35m",I=["debug","info","success","warn","error"],N={info:R,success:A,warn:p,error:T,debug:f};function h(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}t=(void 0)??"warn",o=1!==function(){if(void 0!==_("FORCE_COLOR"))switch(_("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==_("NODE_DISABLE_COLORS")&&""!==_("NODE_DISABLE_COLORS")||void 0!==_("NO_COLOR")&&""!==_("NO_COLOR")||"dumb"===_("TERM"))return 1;if(_("TMUX"))return 24;if("TF_BUILD"in u&&"AGENT_NAME"in u)return 4;if("CI"in u){for(let{0:e,1:t}of E)if(e in u)return t;return"codeship"===_("CI_NAME")?8:1}if("TEAMCITY_VERSION"in u)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(_("TEAMCITY_VERSION"))?4:1;switch(_("TERM_PROGRAM")){case"iTerm.app":if(!_("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(_("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===_("COLORTERM")||"24bit"===_("COLORTERM"))return 24;if(_("TERM")){if(null!==/truecolor/.exec(_("TERM")))return 24;if(null!==/^xterm-256/.exec(_("TERM")))return 8;let e=_("TERM").toLowerCase();if(c[e])return c[e];if(d.some(t=>null!==t.exec(e)))return 4}return _("COLORTERM")?4:1}(),Object.fromEntries(I.map(e=>[e,(...[n,...r])=>((e,n,r=[])=>{let i;if(!(I.indexOf(e)>=I.indexOf(t)))return;let s=(i=new Date().toISOString(),o?`\x1b[2m${i}${O} ${N[e]}${e.toUpperCase()}${O} \x1b[1m[Better Auth]:${O} ${n}`:`${i} ${e.toUpperCase()} [Better Auth]: ${n}`);"error"===e?console.error(s,...r):"warn"===e?console.warn(s,...r):console.log(s,...r)})(e,n,r)])),h({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account.",CROSS_SITE_
1NAVIGATION_LOGIN_BLOCKED:"Cross-site navigation login blocked. This request appears to be a CSRF attack.",VERIFICATION_EMAIL_NOT_ENABLED:"Verification email isn't enabled",EMAIL_ALREADY_VERIFIED:"Email is already verified",EMAIL_MISMATCH:"Email mismatch",SESSION_NOT_FRESH:"Session is not fresh",LINKED_ACCOUNT_ALREADY_EXISTS:"Linked account already exists",INVALID_ORIGIN:"Invalid origin",INVALID_CALLBACK_URL:"Invalid callbackURL",INVALID_REDIRECT_URL:"Invalid redirectURL",INVALID_ERROR_CALLBACK_URL:"Invalid errorCallbackURL",INVALID_NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"});let S={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};var m=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,o={},n="number"==typeof e?e:S[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=o,this.statusCode=n,this.name="APIError",this.status=e,this.headers=o,this.statusCode=n,this.body=t}};Symbol.for("better-call:api-error-headers"),r=m,i=Error,Object.defineProperty((class e extends r{#e;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){const t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);const t=Error().stack;t&&(this.#e=function(e){let t=e.split("\n at ");return t.length<=1?e:(t.splice(1,1),t.join("\n at "))}(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}).prototype,"constructor",{get:()=>i,enumerable:!1,configurable:!0});var L=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function v(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new L(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof L)throw t;throw new L(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(new URL(e).pathname.replace(/\/+$/,"")||"/")}catch{throw new L(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let o=e.replace(/\/+$/,"");return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${o}${t}`):o}let U={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},g=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,y={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},b=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,w={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&"u">typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},D=[],C=0,P=globalThis.nanostoresGlobal||={epoch:0},M=e=>{let t=[],o={get:()=>(o.lc||o.listen(()=>{})(),o.value),init:e,lc:0,listen:e=>(o.lc=t.push(e),()=>{for(let t=C+4;t<D.length;)D[t]===e?D.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--o.lc||o.off())}),notify(e,n){P.epoch++;let r=!D.length;for(let r of t)D.push(r,o.value,e,n);if(r){for(C=0;C<D.length;C+=4)D[C](D[C+1],D[C+2],D[C+3]);D.length=0}},off(){},set(e){let t=o.value;t!==e&&(o.value=e,o.notify(t))},subscribe(e){let t=o.listen(e);return e(o.value),t},value:e};return o},Y=(e,t)=>
1{var o,n;return o=o=>{let n=t(o);n&&e.events[6].push(n)},n=t=>{let o=e.listen;e.listen=(...n)=>(e.lc||e.active||(e.active=!0,t()),o(...n));let n=e.off;return e.events[6]=[],e.off=()=>{n(),setTimeout(()=>{if(e.active&&!e.lc){for(let t of(e.active=!1,e.events[6]))t();e.events[6]=[]}},1e3)},()=>{e.listen=o,e.off=n}},e.events=e.events||{},e.events[15]||(e.events[15]=n(t=>{e.events[5].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[5]=e.events[5]||[],e.events[5].push(o),()=>{let t=e.events[5],n=t.indexOf(o);t.splice(n,1),t.length||(delete e.events[5],e.events[15](),delete e.events[15])}},F=()=>"u"<typeof window,B=Symbol.for("better-auth:broadcast-channel");var x=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if("u">typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??"{}");t?.event==="session"&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function H(e="better-auth.message"){return globalThis[B]||(globalThis[B]=new x(e)),globalThis[B]}let V=Symbol.for("better-auth:focus-manager");var k=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||"u"<typeof document||void 0===window.addEventListener)return()=>{};let e=()=>{"visible"===document.visibilityState&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function G(){return globalThis[V]||(globalThis[V]=new k),globalThis[V]}let W=Symbol.for("better-auth:online-manager");var j=class{listeners=new Set;isOnline="u"<typeof navigator||navigator.onLine;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function $(){return globalThis[W]||(globalThis[W]=new j),globalThis[W]}let q=()=>Math.floor(Date.now()/1e3);function z(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e))}function X(e){return(...t)=>t.reduce((t,o)=>(function e(t,o,n=".",r){if(!z(o))return e(t,{},n,r);let i={...o};for(let o of Object.keys(t)){if("__proto__"===o||"constructor"===o)continue;let s=t[o];null!=s&&(r&&r(i,o,s,n)||(Array.isArray(s)&&Array.isArray(i[o])?i[o]=[...s,...i[o]]:z(s)&&z(i[o])?i[o]=e(s,i[o],(n?`${n}.`:"")+o.toString(),r):i[o]=s))}return i})(t,o,"",e),{})}let K=X();X((e,t,o)=>{if(void 0!==e[t]&&"function"==typeof o)return e[t]=o(e[t]),!0}),X((e,t,o)=>{if(Array.isArray(e[t])&&"function"==typeof o)return e[t]=o(e[t]),!0});var Z=Object.defineProperty,Q=Object.defineProperties,J=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable,en=(e,t,o)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,er=(e,t)=>{for(var o in t||(t={}))et.call(t,o)&&en(e,o,t[o]);if(ee)for(var o of ee(t))eo.call(t,o)&&en(e,o,t[o]);return e},ei=(e,t)=>Q(e,J(t)),es=class extends Error{constructor(e,t,o){super(t||e.toString(),{cause:o}),this.status=e,this.statusText=t,this.error=o,Error.captureStackTrace(this,this.constructor)}},ea=async(e,t)=>{var o,n,r,i,s,a;let l=t||{},u={onRequest:[null==t?void 0:t.onRequest],onResponse:[null==t?void 0:t.onResponse],onSuccess:[null==t?void 0:t.onSuccess],onError:[null==t?void 0:t.onError],onRetry:[null==t?void 0:t.onRetry]};if(!t||!(null==t?void 0:t.plugins))return{url:e,options:l,hooks:u};for(let _ of(null==t?void 0:t.plugins)||[]){if(_.init){let n=await (null==(o=_.init)?void 0:o.call(_,e.toString(),t));l=n.options||l,e=n.url}u.onRequest.push(null==(n=_.hooks)?void 0:n.onRequest),u.onResponse.push(null==(r=_.hooks)?void 0:r.onResponse),u.onSuccess.push(null==(i=_.hooks)?void 0:i.onSuccess),u.onError.push(null==(s=_.hooks)?void 0:s.onError),u.onRetry.push(null==(a=_.hooks)?void 0:a.onRetry)}return{url:e,options:l,hooks:u}},el=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},eu=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}},e_=async e=>{let t={},o=async e=>"function"==typeof e?await e():e;
1if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let n=await o(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if("Basic"===e.auth.type){let[n,r]=await Promise.all([o(e.auth.username),o(e.auth.password)]);if(!n||!r)return t;t.authorization=`Basic ${btoa(`${n}:${r}`)}`}else if("Custom"===e.auth.type){let[n,r]=await Promise.all([o(e.auth.prefix),o(e.auth.value)]);if(!r)return t;t.authorization=`${null!=n?n:""} ${r}`}}return t},ec=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function eE(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!e.buffer&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}function ed(e){try{return JSON.parse(e)}catch(t){return e}}function eO(e){return"function"==typeof e}async function eT(e){let t=new Headers(null==e?void 0:e.headers);for(let[o,n]of Object.entries(await e_(e)||{}))t.set(o,n);if(!t.has("content-type")){let o=eE(null==e?void 0:e.body)?"application/json":null;o&&t.set("content-type",o)}return t}var eA=class e extends Error{constructor(t,o){super(o||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function ep(e,t){let o=await e["~standard"].validate(t);if(o.issues)throw new eA(o.issues);return o.value}var eR=["get","post","put","patch","delete"],ef=async(e,t)=>{var o,n,r,i,s,a,l,u;let _,{hooks:c,url:E,options:d}=await ea(e,t),O=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&eO(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&eO(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(d),T=new AbortController,A=null!=(o=d.signal)?o:T.signal,p=function(e,t){let{baseURL:o,params:n,query:r}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):o||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];eR.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[s,a]=e.replace(i,"").split("?"),l=new URLSearchParams(a);for(let[e,t]of Object.entries(r||{})){let o;if(null!=t){if("string"==typeof t)o=t;else if(Array.isArray(t)){for(let o of t)l.append(e,o);continue}else o=JSON.stringify(t);l.set(e,o)}}if(n)if(Array.isArray(n))for(let[e,t]of s.split("/").filter(e=>e.startsWith(":")).entries()){let o=n[e];s=s.replace(t,o)}else for(let[e,t]of Object.entries(n))s=s.replace(`:${e}`,String(t));(s=s.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(s=s.slice(1));let u=l.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${s}${u}`,i):`${i}${s}${u}`}(E,d),R=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(eE(e.body)&&!t.has("content-type")){for(let[t,o]of Object.entries(null==e?void 0:e.body))o instanceof Date&&(e.body[t]=o.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&"application/x-www-form-urlencoded"===t.get("content-type")&&eE(e.body)?new URLSearchParams(e.body).toString():e.body}(d),f=await eT(d),I=function(e,t){var o;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=null==(o=e.split("@")[1])?void 0:o.split("/")[0];return eR.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(E,d),N=ei(er({},d),{url:p,headers:f,body:R,method:I,signal:A});for(let e of c.onRequest)if(e){let t=await e(N);"object"==typeof t&&null!==t&&(N=t)}("pipeTo"in N&&"function"==typeof N.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pipe))&&!("duplex"in N)&&(N.duplex="half");let{clearTimeout:h}=(!(null==d?void 0:d.signal)&&(null==d?void 0:d.timeout)&&(_=setTimeout(()=>null==T?void 0:T.abort(),null==d?void 0:d.timeout)),{abortTimeout:_,clearTimeout:()=>{_&&clearTimeout(_)}}),S=await O(N.url,N);h();let m={response:S,request:N};for(let e of c.onResponse)if(e){let o=await e(ei(er({},m),{response:(null==(r=null==t?void 0:t.hookOptions)?void 0:r.cloneResponse)?S.clone():S}));o instanceof Response?S=o:"object"==typeof o&&null!==o&&(S=o.response)}if(S.ok){if("HEAD"===N.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),o=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return ec.test(n)?"json":o.has(n)||n.startsWith("text/")?"text":"blob"}(S),o={data:null,response:S,request:N};if("json"===e||"text"===e){let e=await S.text(),t=null!=(i=N.jsonParser)?i:ed;o.data=await t(e)}else o.data=await S[e]();for(let e of((null==N?void 0:N.output)&&N.output&&!N.disableValidation&&(o.data=await ep(N.output,o.data)),c.onSuccess))e&&await e(ei(er({},o),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?S.clone():S}));return(null==t?void 0:t.throw)?o.data:{data:o.data,error:null}}let L=null!=(a=null==t?void 0:t.jsonParser)?a:ed,v=await S.text(),U=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(v),g=U?await L(v):null,y={response:S,responseText:v,request:N,error:ei(er({},g),{status:S.status,statusText:S.statusText})};for(let e of c.onError)e&&await e(ei(er({},y),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?S.clone():S}));if(null==t?void 0:t.retry){let o=function(e){if("number"==typeof e)return new el({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new el(e);case"exponential":return new eu(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;
1if(await o.shouldAttemptRetry(n,S)){for(let e of c.onRetry)e&&await e(m);let r=o.getDelay(n);return await new Promise(e=>setTimeout(e,r)),await ef(e,ei(er({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new es(S.status,S.statusText,U?g:v);return{data:null,error:ei(er({},g),{status:S.status,statusText:S.statusText})}},eI=e.i(271645);function eN(e){return{newRole:e=>{var t;return{authorize(e,o="AND"){let n=!1;for(let[r,i]of Object.entries(e)){let e=t[r];if(!e)return{success:!1,error:`You are not allowed to access resource: ${r}`};if(Array.isArray(i))n=i.every(t=>e.includes(t));else if("object"==typeof i)n="OR"===i.connector?i.actions.some(t=>e.includes(t)):i.actions.every(t=>e.includes(t));else throw new L("Invalid access control request");if(n&&"OR"===o)return{success:n};if(!n&&"AND"===o)return{success:!1,error:`unauthorized to access resource "${r}"`}}return n?{success:n}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}h({FAILED_TO_CREATE_USER:"Failed to create user",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",YOU_CANNOT_BAN_YOURSELF:"You cannot ban yourself",YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:"You are not allowed to change users role",YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:"You are not allowed to create users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:"You are not allowed to list users",YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:"You are not allowed to list users sessions",YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:"You are not allowed to ban users",YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:"You are not allowed to impersonate users",YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:"You are not allowed to revoke users sessions",YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:"You are not allowed to delete users",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:"You are not allowed to set users password",BANNED_USER:"You have been banned from this application",YOU_ARE_NOT_ALLOWED_TO_GET_USER:"You are not allowed to get user",NO_DATA_TO_UPDATE:"No data to update",YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:"You are not allowed to update users",YOU_CANNOT_REMOVE_YOURSELF:"You cannot remove yourself",YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:"You are not allowed to set a non-existent role value",YOU_CANNOT_IMPERSONATE_ADMINS:"You cannot impersonate admins",INVALID_ROLE_TYPE:"Invalid role type"});let eh=eN({user:["create","list","set-role","ban","impersonate","impersonate-admins","delete","set-password","get","update"],session:["list","revoke","delete"]});eh.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),eh.newRole({user:[],session:[]}),h({INVALID_EMAIL_FORMAT:"Email was not generated in a valid format",FAILED_TO_CREATE_USER:"Failed to create user",COULD_NOT_CREATE_SESSION:"Could not create session",ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:"Anonymous users cannot sign in again anonymously",FAILED_TO_DELETE_ANONYMOUS_USER:"Failed to delete anonymous user",USER_IS_NOT_ANONYMOUS:"User is not anonymous",DELETE_ANONYMOUS_USER_DISABLED:"Deleting anonymous users is disabled"}),h({OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",TOO_MANY_ATTEMPTS:"Too many attempts"}),h({INVALID_OAUTH_CONFIGURATION:"Invalid OAuth configuration",TOKEN_URL_NOT_FOUND:"Invalid OAuth configuration. Token URL not found.",PROVIDER_CONFIG_NOT_FOUND:"No config found for provider",PROVIDER_ID_REQUIRED:"Provider ID is required",INVALID_OAUTH_CONFIG:"Invalid OAuth configuration.",SESSION_REQUIRED:"Session is required",ISSUER_MISMATCH:"OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).",ISSUER_MISSING:"OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207)."}),h({INVALID_SESSION_TOKEN:"Invalid session token"});let eS=!1,em=["credential_returned","cancel_called"],eL=["user_cancel","tap_outside"],ev=()=>new Promise((e,t)=>{if(window.googleScriptInitialized)return void e();let o=document.createElement("script");o.src="https://accounts.google.com/gsi/client",o.async=!0,o.defer=!0,o.onload=()=>{window.googleScriptInitialized=!0,e()},o.onerror=()=>{t(Error("Failed to load Google Identity Services script"))},document.head.appendChild(o)});h({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:"You are not allowed to create a new organization",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:"You have reached the maximum number of organizations",ORGANIZATION_ALREADY_EXISTS:"Organization already exists",ORGANIZATION_SLUG_ALREADY_TAKEN:"Organization slug already taken",ORGANIZATION_NOT_FOUND:"Organization not found",USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:"User is not a member of the organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:"You are not allowed to update this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:"You are not allowed to delete this organization",NO_ACTIVE_ORGANIZATION:"No active organization",USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:"User is already a member of this organization",MEMBER_NOT_FOUND:"Member not found",ROLE_NOT_FOUND:"Role not found",YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:"You are not allowed to create a new team",TEAM_ALREADY_EXISTS:"Team already exists",TEAM_NOT_FOUND:"Team not found",YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:"You cannot leave the organization as the only owner",YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:"You cannot leave the organization without an owner",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:"You are not allowed to delete this member",YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:"You are not allowed to invite users to this organization",USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:"User is already invited to this organization",INVITATION_NOT_FOUND:"Invitation not found",YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:"You are not the recipient of the invitation",EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:"Email verification required before accepting or rejecting invitation",YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:"You are not allowed to cancel this invitation",INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:"Inviter is no longer a member of the organization",YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:"You are not allowed to invite a user with this role",FAILED_TO_RETRIEVE_INVITATION:"Failed to retrieve invitation",YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:"You have reached the maximum number of teams",UNABLE_TO_REMOVE_LAST_TEAM:"Unable to remove last team",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:"You are not allowed to update this member",ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:"Organization membership limit reached",YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to create teams in this organization",YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:"You are not allowed to delete teams in this organization",YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:"You are not allowed to update this team",YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:"You are not allowed to delete this team",INVITATION_LIMIT_REACHED:"Invitation limit reached",TEAM_MEMBER_LIMIT_REACHED:"Team member limit reached",USER_IS_NOT_A_MEMBER_OF_THE_TEAM:"User is not a member of the team",YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:"You are not allowed to list the members of this team",YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:"You do not have an active team",YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:"You are not allowed to create a new member",YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:"You are not allowed to remove a team member",YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:"You are not allowed to access this organization as an owner",YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:"You are not a member of this organization",MISSING_AC_INSTANCE:"Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information",YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:"You must be in an organization to create a role",YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:"You are not allowed to create a role",YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:"You are not allowed to update a role",YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:"You are not allowed to delete a role",YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:"You are not allowed to read a role",YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:"You are not allowed to list a role",YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:"You are not allowed to get a role",TOO_MANY_ROLES:"This organization has too many roles",INVALID_RESOURCE:"The provided permission includes an invali
1d resource",ROLE_NAME_IS_ALREADY_TAKEN:"That role name is already taken",CANNOT_DELETE_A_PRE_DEFINED_ROLE:"Cannot delete a pre-defined role",ROLE_IS_ASSIGNED_TO_MEMBERS:"Cannot delete a role that is assigned to members. Please reassign the members to a different role first"});let eU=eN({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]});eU.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eU.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eU.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]}),h({INVALID_PHONE_NUMBER:"Invalid phone number",PHONE_NUMBER_EXIST:"Phone number already exists",PHONE_NUMBER_NOT_EXIST:"phone number isn't registered",INVALID_PHONE_NUMBER_OR_PASSWORD:"Invalid phone number or password",UNEXPECTED_ERROR:"Unexpected error",OTP_NOT_FOUND:"OTP not found",OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",PHONE_NUMBER_NOT_VERIFIED:"Phone number not verified",PHONE_NUMBER_CANNOT_BE_UPDATED:"Phone number cannot be updated",SEND_OTP_NOT_IMPLEMENTED:"sendOTP not implemented",TOO_MANY_ATTEMPTS:"Too many attempts"}),h({OTP_NOT_ENABLED:"OTP not enabled",OTP_HAS_EXPIRED:"OTP has expired",TOTP_NOT_ENABLED:"TOTP not enabled",TWO_FACTOR_NOT_ENABLED:"Two factor isn't enabled",BACKUP_CODES_NOT_ENABLED:"Backup codes aren't enabled",INVALID_BACKUP_CODE:"Invalid backup code",INVALID_CODE:"Invalid code",TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:"Too many attempts. Please request a new code.",INVALID_TWO_FACTOR_COOKIE:"Invalid two factor cookie"}),h({INVALID_USERNAME_OR_PASSWORD:"Invalid username or password",EMAIL_NOT_VERIFIED:"Email not verified",UNEXPECTED_ERROR:"Unexpected error",USERNAME_IS_ALREADY_TAKEN:"Username is already taken. Please try another.",USERNAME_TOO_SHORT:"Username is too short",USERNAME_TOO_LONG:"Username is too long",INVALID_USERNAME:"Username is invalid",INVALID_DISPLAY_USERNAME:"Display username is invalid"});let eg=function(e){var t;let{pluginPathMethods:o,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:l}=(e=>{var t;let o,n,r,i="credentials"in Request.prototype,a=function(e,t,o,n){if(e)return v(e,t);if(!1!==n){let e=u.BETTER_AUTH_URL||u.NEXT_PUBLIC_BETTER_AUTH_URL||u.PUBLIC_BETTER_AUTH_URL||u.NUXT_PUBLIC_BETTER_AUTH_URL||u.NUXT_PUBLIC_AUTH_URL||("/"!==u.BASE_URL?u.BASE_URL:void 0);if(e)return v(e,t)}o?.headers.get("x-forwarded-host"),o?.headers.get("x-forwarded-proto");if(o){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(o.url);if(!e)throw new L("Could not get origin from request. Please provide a valid base URL.");return v(e,t)}if("u">typeof window&&window.location)return v(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==s.default){if(s.default.env.NEXT_PUBLIC_AUTH_URL)return s.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(s.default.env.NEXTAUTH_URL)try{return s.default.env.NEXTAUTH_URL}catch{}if(s.default.env.VERCEL_URL)try{let t=s.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${s.default.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",l=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],_={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:c,onError:E,onRequest:d,onResponse:O,...T}=e?.fetchOptions||{},A=(t={baseURL:a,...i?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:o=!1,warnings:n=!1,reviver:r,parseDates:i=!0}=t;if("string"!=typeof e)return e;let s=e.trim();if(s.length>0&&'"'===s[0]&&s.endsWith('"')&&!s.slice(1,-1).includes('"'))return s.slice(1,-1);let a=s.toLowerCase();if(a.length<=9&&a in y)return y[a];
1if(!g.test(s)){if(o)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(U).some(([e,t])=>{let o=t.test(s);return o&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),o})&&o)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(s,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){n&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(i&&"string"==typeof t){let e=function(e){let t=b.exec(e);if(!t)return null;let[,o,n,r,i,s,a,l,u,_,c]=t,E=new Date(Date.UTC(parseInt(o,10),parseInt(n,10)-1,parseInt(r,10),parseInt(i,10),parseInt(s,10),parseInt(a,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(_,10)+parseInt(c,10))*("+"===u?-1:1);E.setUTCMinutes(E.getUTCMinutes()+e)}return E instanceof Date&&!isNaN(E.getTime())?E:null}(t);if(e)return e}return r?r(e,t):t})}catch(t){if(o)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...T,plugins:[_,...T.plugins||[],...e?.disableDefaultFetchPlugins?[]:[w],...l]},async function(e,o){let n,r=ei(er(er({},t),o),{plugins:[...(null==t?void 0:t.plugins)||[],(n=t||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var o,r,i,s;let a=(null==(r=null==(o=n.plugins)?void 0:o.find(t=>{var o;return null!=(o=t.schema)&&!!o.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:r.schema)||n.schema;if(a){let o=e;(null==(i=a.config)?void 0:i.prefix)&&o.startsWith(a.config.prefix)&&(o=o.replace(a.config.prefix,""),a.config.baseURL&&(e=e.replace(a.config.prefix,a.config.baseURL))),(null==(s=a.config)?void 0:s.baseURL)&&o.startsWith(a.config.baseURL)&&(o=o.replace(a.config.baseURL,""));let n=a.schema[o];if(n){let o=ei(er({},t),{method:n.method,output:n.output});return(null==t?void 0:t.disableValidation)||(o=ei(er({},o),{body:n.input?await ep(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await ep(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await ep(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:o}}}return{url:e,options:t}}}),...(null==o?void 0:o.plugins)||[]]});if(null==t?void 0:t.catchAllError)try{return await ef(e,r)}catch(e){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:e}}}return await ef(e,r)}),{$sessionSignal:p,session:R,broadcastSessionUpdate:f}=(n=((e,t,o,n)=>{let r=M({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>i(e)}),i=async e=>new Promise(i=>{let s="function"==typeof n?n({data:r.get().data,error:r.get().error,isPending:r.get().isPending}):n;o(t,{...s,query:{...s?.query,...e?.query},async onSuccess(e){r.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:r.value.refetch}),await s?.onSuccess?.(e)},async onError(e){let{request:t}=e,o="number"==typeof t.retry?t.retry:t.retry?.attempts,n=t.retryAttempt||0;o&&n<o||(r.set({error:e.error,data:null,isPending:!1,isRefetching:!1,refetch:r.value.refetch}),await s?.onError?.(e))},async onRequest(e){let t=r.get();r.set({isPending:null===t.data,data:t.data,error:null,isRefetching:!0,refetch:r.value.refetch}),await s?.onRequest?.(e)}}).catch(e=>{r.set({error:e,data:null,isPending:!1,isRefetching:!1,refetch:r.value.refetch})}).finally(()=>{i(void 0)})});e=Array.isArray(e)?e:[e];let s=!1;for(let t of e)t.subscribe(async()=>{F()||(s?await i():Y(r,()=>{let e=setTimeout(async()=>{s||(await i(),s=!0)},0);return()=>{r.off(),t.off(),clearTimeout(e)}}))});return r})(o=M(!1),"/get-session",A,{method:"GET"}),r=()=>{},Y(n,()=>{let t=function(e){let{sessionAtom:t,sessionSignal:o,$fetch:n,options:r={}}=e,i=r.sessionOptions?.refetchInterval??0,s=r.sessionOptions?.refetchOnWindowFocus??!0,a=r.sessionOptions?.refetchWhenOffline??!1,l={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=e=>{if(!(a||$().isOnline))return;if(e?.event==="storage"){l.lastSync=q(),o.set(!o.get());return}let r=t.get(),i=()=>{l.lastSessionRequest=q(),n("/get-session").then(async e=>{let i=e.data,s=e.error||null;if(i?.needsRefresh)try{let e=await n("/get-session",{method:"POST"});i=e.data,s=e.error||null}catch{}let a=i?.session&&i?.user?{session:i.session,user:i.user}:null;t.set({...r,data:a,error:s}),l.lastSync=q(),o.set(!o.get())}).catch(()=>{})};if(e?.event==="poll")return void i();if(e?.event==="visibilitychange"){if(q()-l.lastSessionRequest<5)return;l.lastSessionRequest=q()}e?.event==="visibilitychange"?i():(r?.data===null||r?.data===void 0)&&(l.lastSync=q(),o.set(!o.get()))};return{init:()=>{i&&i>0&&(l.pollInterval=setInterval(()=>{t.get()?.data&&u({event:"poll"})},1e3*i)),l.unsubscribeBroadcast=H().subscribe(()=>{u({event:"storage"})}),s&&(l.unsubscribeFocus=G().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=$().subscribe(e=>{e&&u({event:"visibilitychange"})}),H().setup(),G().setup(),$().setup()},cleanup:()=>{l.pollInterval&&(clearInterval(l.pollInterval),l.pollInterval=void 0),l.unsubscribeBroadcast&&(l.unsubscribeBroadcast(),l.unsubscribeBroadcast=void 0),l.unsubscribeFocus&&(l.unsubscribeFocus(),l.unsubscribeFocus=void 0),l.unsubscribeOnline&&(l.unsubscribeOnline(),l.unsubscribeOnline=void 0),l.lastSync=0,l.lastSessionRequest=0,l.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:e=>{H().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({sessionAtom:n,sessionSignal:o,$fetch:A,options:e});return t.init(),r=t.broadcastSessionUpdate,()=>{t.cleanup()}}),{session:n,$sessionSignal:o,broadcastSessionUpdate:e=>r(e)}),I=e?.plugins||[],N={},h={$sessionSignal:p,session:R}
1,S={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},m=[{signal:"$sessionSignal",matcher:e=>"/sign-out"===e||"/update-user"===e||"/update-session"===e||"/sign-up/email"===e||"/sign-in/email"===e||"/delete-user"===e||"/verify-email"===e||"/revoke-sessions"===e||"/revoke-session"===e||"/change-email"===e,callback(e){"/sign-out"===e?f("signout"):("/update-user"===e||"/update-session"===e)&&f("updateUser")}}];for(let e of I)e.getAtoms&&Object.assign(h,e.getAtoms?.(A)),e.pathMethods&&Object.assign(S,e.pathMethods),e.atomListeners&&m.push(...e.atomListeners);let D={notify:e=>{h[e].set(!h[e].get())},listen:(e,t)=>{h[e].subscribe(t)},atoms:h};for(let t of I)t.getActions&&(N=K(t.getActions?.(A,D,e)??{},N));return{get baseURL(){return a},pluginsActions:N,pluginsAtoms:h,pluginPathMethods:S,atomListeners:m,$fetch:A,$store:D}})(e),_={};for(let[e,t]of Object.entries(r))_[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let o=(0,eI.useRef)(e.get()),{keys:n,deps:r=[e,n]}=t,i=(0,eI.useCallback)(t=>{let r=e=>{o.current!==e&&(o.current=e,t())};if(r(e.value),n?.length){let t;return t=new Set(n).add(void 0),e.listen((e,o,n)=>{t.has(n)&&r(e,o,n)})}return e.listen(r)},r),s=()=>o.current;return(0,eI.useSyncExternalStore)(i,s,s)})(t);return t={...n,..._,$fetch:i,$store:a},function e(n=[]){return new Proxy(function(){},{get(o,r){var i;if("string"!=typeof r||"then"===r||"catch"===r||"finally"===r)return;let s=[...n,r],a=t;for(let e of s)if(a&&"object"==typeof a&&e in a)a=a[e];else{a=void 0;break}return"function"==typeof a?a:"object"==typeof(i=a)&&null!==i&&"get"in i&&"function"==typeof i.get&&"lc"in i&&"number"==typeof i.lc?a:e(s)},apply:async(e,t,s)=>{let a="/"+n.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),u=s[0]||{},_=s[1]||{},{query:c,fetchOptions:E,...d}=u,O={..._,...E},T=function(e,t,o){let n=t[e],{fetchOptions:r,query:i,...s}=o||{};return n||(r?.method?r.method:s&&Object.keys(s).length>0?"POST":"GET")}(a,o,u);return await i(a,{...O,body:"GET"===T?void 0:{...d,...O?.body||{}},query:c||O?.query,method:T,async onSuccess(e){if(await O?.onSuccess?.(e),!l||O.disableSignal)return;let t=l.filter(e=>e.matcher(a));if(!t.length)return;let o=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(o.has(e.signal))continue;o.add(e.signal);let n=t.get();setTimeout(()=>{t.set(!n)},10),e.callback?.(a)}}})}})}()}({plugins:[(n={clientId:s.default.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,autoSelect:!1,cancelOnTapOutside:!0,context:"signin",promptOptions:{baseDelay:1e3,maxAttempts:5}},{id:"one-tap",fetchPlugins:[{id:"fedcm-signout-handle",name:"FedCM Sign-Out Handler",hooks:{async onResponse(e){!e.request.url.toString().includes("/sign-out")||n.promptOptions?.fedCM!==!1&&"u">typeof window&&"IdentityCredential"in window&&navigator.credentials.preventSilentAccess()}}}],getActions:(e,t)=>({oneTap:async(t,o)=>{if(eS)return void console.warn("A Google One Tap request is already in progress. Please wait.");if("u"<typeof window||!window.document)return void console.warn("Google One Tap is only available in browser environments");if(t?.button){await ev();let i="string"==typeof t.button.container?document.querySelector(t.button.container):t.button.container;if(!i)return void console.error("Google One Tap: Button container not found",t.button.container);async function r(n){await e("/one-tap/callback",{method:"POST",body:{idToken:n},...t?.fetchOptions,...o}),(!t?.fetchOptions&&!o||t?.callbackURL)&&(window.location.href=t?.callbackURL??"/")}let{autoSelect:s,cancelOnTapOutside:a,context:l}=t??{},u=l??n.context??"signin";return window.google?.accounts.id.initialize({client_id:n.clientId,callback:async e=>{try{await r(e.credential)}catch(e){console.error("Error during button callback:",e)}},auto_select:s,cancel_on_tap_outside:a,context:u,ux_mode:t?.uxMode||"popup",nonce:t?.nonce,itp_support:!0,...n.additionalOptions}),void window.google?.accounts.id.renderButton(i,t.button.config??{type:"icon"})}async function i(n){await e("/one-tap/callback",{method:"POST",body:{idToken:n},...t?.fetchOptions,...o}),(!t?.fetchOptions&&!o||t?.callbackURL)&&(window.location.href=t?.callbackURL??"/")}let{autoSelect:s,cancelOnTapOutside:a,context:l}=t??{},u=l??n.context??"signin";eS=!0;try{await ev(),await new Promise((e,o)=>{let r=!1,l=n.promptOptions?.baseDelay??1e3,_=n.promptOptions?.maxAttempts??5;window.google?.accounts.id.initialize({client_id:n.clientId,callback:async t=>{r=!0;try{await i(t.credential),e()}catch(e){console.error("Error during One Tap callback:",e),o(e)}}
1,auto_select:s,cancel_on_tap_outside:a,context:u,ux_mode:t?.uxMode||"popup",nonce:t?.nonce,itp_support:!0,...n.additionalOptions});let c=o=>{r||window.google?.accounts.id.prompt(n=>{if(!r)if(n.isDismissedMoment&&n.isDismissedMoment()){let r=n.getDismissedReason?.();if(em.includes(r)){t?.onPromptNotification?.(n),e();return}if(o<_){let e=Math.pow(2,o)*l;setTimeout(()=>c(o+1),e)}else t?.onPromptNotification?.(n),e()}else if(n.isSkippedMoment&&n.isSkippedMoment()){let r=n.getSkippedReason?.();if(!r||eL.includes(r)){t?.onPromptNotification?.(n),e();return}if(o<_){let e=Math.pow(2,o)*l;setTimeout(()=>c(o+1),e)}else t?.onPromptNotification?.(n),e()}else n.isNotDisplayed&&n.isNotDisplayed()&&(t?.onPromptNotification?.(n),e())})};c(0)})}catch(e){throw console.error("Error during Google One Tap flow:",e),e}finally{eS=!1}}}),getAtoms:e=>({})})]}),{useSession:ey,oneTap:eb}=eg,ew=async e=>await eg.signIn.social({provider:e,callbackURL:window.location.href}),eD=async()=>{let e=await eg.signOut();if(e.error)throw Error(e.error.message||"Failed to sign out.");return e},eC=async e=>eg.getAccessToken({providerId:"google",...e?{userId:e}:{}});e.s(["getGoogleAccessToken",0,eC,"oneTap",0,eb,"signIn",0,ew,"signOut",0,eD,"useSession",0,ey],861509)},865161,e=>{"use strict";var t=e.i(915379),o=e.i(209165),n=e.i(931124),r=e.i(635021),i=e.i(621427),s=e.i(572098);async function a(e){let r=e.trim();if(!r)throw Error("Invalid invite code.");let s=(0,o.createApi)(),a=await s.post(t.Urls.USER.redBind,{inviteCode:r});if(!a.success||!a.data)throw Error(a.message||"Invalid invite code.");i.useUserStore.getState().setUserData({redInviteCode:r}),await (0,n.refreshCurrentUser)({silent:!0})}async function l(){try{let{isLogin:e,redInviteCode:n}=i.useUserStore.getState();if(!e||n?.trim()||(0,s.getInviteCodeFromCookie)())return;let a=(0,o.createApi)(),l=await a.get(t.Urls.USER.redPop,{noCache:!0});if(!l.success||l.data)return;let{closeLoginDialog:u,openInvitationDialog:_}=r.useDialogStore.getState();u(),_()}catch(e){}}e.s(["bindRedInviteCode",0,a,"maybeOpenRedInviteDialogAfterLogin",0,l])}]);
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.