/opt/canhelp/apps/web/.next/static/chunks
Edit: /opt/canhelp/apps/web/.next/static/chunks/1516-8fa03da2e85f0346.js (32036B)
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1516],{6504:(e,t,n)=>{n.d(t,{M:()=>eE});var r=n(7011);let o=Object.create(null),s=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?o:globalThis),i=new Proxy(o,{get:(e,t)=>s()[t]??o[t],has:(e,t)=>t in s()||t in o,set:(e,t,n)=>(s(!0)[t]=n,!0),deleteProperty(e,t){if(!t)return!1;let n=s(!0);return delete n[t],!0},ownKeys:()=>Object.keys(s(!0))});function a(e,t){return void 0!==r&&r.env?r.env[e]??t:"undefined"!=typeof Deno?Deno.env.get(e)??t:"undefined"!=typeof Bun?Bun.env[e]??t:t}void 0!==r&&r.env,Object.freeze({get BETTER_AUTH_SECRET(){return a("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return a("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return a("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return a("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return a("NODE_ENV","development")},get PACKAGE_VERSION(){return a("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return a("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});let l={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},u=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),c=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],d={reset:"\x1b[0m",bright:"\x1b[1m",dim:"\x1b[2m",fg:{black:"\x1b[30m",red:"\x1b[31m",green:"\x1b[32m",yellow:"\x1b[33m",blue:"\x1b[34m",magenta:"\x1b[35m",cyan:"\x1b[36m",white:"\x1b[37m"}},f=["debug","info","success","warn","error"],p={info:d.fg.blue,success:d.fg.green,warn:d.fg.yellow,error:d.fg.red,debug:d.fg.magenta};(e=>{let t=(void 0)??"warn",n=e?.disableColors!==void 0?!e.disableColors:1!==function(){if(void 0!==a("FORCE_COLOR"))switch(a("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==a("NODE_DISABLE_COLORS")&&""!==a("NODE_DISABLE_COLORS")||void 0!==a("NO_COLOR")&&""!==a("NO_COLOR")||"dumb"===a("TERM"))return 1;if(a("TMUX"))return 24;if("TF_BUILD"in i&&"AGENT_NAME"in i)return 4;if("CI"in i){for(let{0:e,1:t}of u)if(e in i)return t;return"codeship"===a("CI_NAME")?8:1}if("TEAMCITY_VERSION"in i)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(a("TEAMCITY_VERSION"))?4:1;switch(a("TERM_PROGRAM")){case"iTerm.app":if(!a("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(a("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===a("COLORTERM")||"24bit"===a("COLORTERM"))return 24;if(a("TERM")){if(null!==/truecolor/.exec(a("TERM")))return 24;if(null!==/^xterm-256/.exec(a("TERM")))return 8;let e=a("TERM").toLowerCase();if(l[e])return l[e];if(c.some(t=>null!==t.exec(e)))return 4}return a("COLORTERM")?4:1}();return{...Object.fromEntries(f.map(r=>[r,(...[o,...s])=>((r,o,s=[])=>{if(!(f.indexOf(r)>=f.indexOf(t)))return;let i=((e,t,n)=>{let r=new Date().toISOString();return n?`${d.dim}${r}${d.reset} ${p[e]}${e.toUpperCase()}${d.reset} ${d.bright}[Better Auth]:${d.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`})(r,o,n);if(!e||"function"!=typeof e.log)return void("error"===r?console.error(i,...s):"warn"===r?console.warn(i,...s):console.log(i,...s));e.log("success"===r?"info":r,o,...s)})(r,o,s)])),get level(){return t}}})(),Object.fromEntries(Object.entries({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_NAVIGATION_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"}).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]));let E={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 h=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,n={},r="number"==typeof e?e:E[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name="APIError",this.status=e,this.headers=n,this.statusCode=r,this.body=t}};Symbol.for("better-call:api-error-headers"),function(e,t){class n extends e{#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}()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let 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}}Object.defineProperty(n.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0})}(h,Error);var T=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function R(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new T(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof T)throw t;throw new T(`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 T(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let n=e.replace(/\/+$/,"");return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${n}${t}`):n}let _={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*:/},O=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,v={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},y=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,b={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&"undefined"!=typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},g=[],A=0,I=0,S=e=>{let t=[],n={get:()=>(n.lc||n.listen(()=>{})(),n.value),init:e,lc:0,listen:e=>(n.lc=t.push(e),()=>{for(let t=A+4;t
((e,t,n,r)=>(e.events=e.events||{},e.events[15]||(e.events[15]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],o=r.indexOf(t);r.splice(o,1),r.length||(delete e.events[n],e.events[n+10](),delete e.events[n+10])}))(e,n=>{let r=t(n);r&&e.events[6].push(r)},5,t=>{let n=e.listen;e.listen=(...r)=>(e.lc||e.active||(e.active=!0,t()),n(...r));let r=e.off;return e.events[6]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){for(let t of(e.active=!1,e.events[6]))t();e.events[6]=[]}},1e3)},()=>{e.listen=n,e.off=r}}),L=()=>"undefined"==typeof window,w=Symbol.for("better-auth:broadcast-channel");var N=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("undefined"!=typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("undefined"==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 U(e="better-auth.message"){return globalThis[w]||(globalThis[w]=new N(e)),globalThis[w]}let D=Symbol.for("better-auth:focus-manager");var C=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("undefined"==typeof window||"undefined"==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 P(){return globalThis[D]||(globalThis[D]=new C),globalThis[D]}let x=Symbol.for("better-auth:online-manager");var M=class{listeners=new Set;isOnline="undefined"==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("undefined"==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 F(){return globalThis[x]||(globalThis[x]=new M),globalThis[x]}let j=()=>Math.floor(Date.now()/1e3);function k(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function B(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 $(e){return(...t)=>t.reduce((t,n)=>(function e(t,n,r=".",o){if(!B(n))return e(t,{},r,o);let s={...n};for(let n of Object.keys(t)){if("__proto__"===n||"constructor"===n)continue;let i=t[n];null!=i&&(o&&o(s,n,i,r)||(Array.isArray(i)&&Array.isArray(s[n])?s[n]=[...i,...s[n]]:B(i)&&B(s[n])?s[n]=e(i,s[n],(r?`${r}.`:"")+n.toString(),o):s[n]=i))}return s})(t,n,"",e),{})}let V=$();$((e,t,n)=>{if(void 0!==e[t]&&"function"==typeof n)return e[t]=n(e[t]),!0}),$((e,t,n)=>{if(Array.isArray(e[t])&&"function"==typeof n)return e[t]=n(e[t]),!0});var H=Object.defineProperty,q=Object.defineProperties,G=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,X=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||(t={}))W.call(t,n)&&X(e,n,t[n]);if(Y)for(var n of Y(t))K.call(t,n)&&X(e,n,t[n]);return e},J=(e,t)=>q(e,G(t)),z=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},Z=async(e,t)=>{var n,r,o,s,i,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 c of(null==t?void 0:t.plugins)||[]){if(c.init){let r=await (null==(n=c.init)?void 0:n.call(c,e.toString(),t));l=r.options||l,e=r.url}u.onRequest.push(null==(r=c.hooks)?void 0:r.onRequest),u.onResponse.push(null==(o=c.hooks)?void 0:o.onResponse),u.onSuccess.push(null==(s=c.hooks)?void 0:s.onSuccess),u.onError.push(null==(i=c.hooks)?void 0:i.onError),u.onRetry.push(null==(a=c.hooks)?void 0:a.onRetry)}return{url:e,options:l,hooks:u}},ee=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e{let t={},n=async e=>"function"==typeof e?await e():e;if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if("Basic"===e.auth.type){let[r,o]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!o)return t;t.authorization=`Basic ${btoa(`${r}:${o}`)}`}else if("Custom"===e.auth.type){let[r,o]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!o)return t;t.authorization=`${null!=r?r:""} ${o}`}}return t},er=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function eo(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 es(e){try{return JSON.parse(e)}catch(t){return e}}function ei(e){return"function"==typeof e}async function ea(e){let t=new Headers(null==e?void 0:e.headers);for(let[n,r]of Object.entries(await en(e)||{}))t.set(n,r);if(!t.has("content-type")){let n=eo(null==e?void 0:e.body)?"application/json":null;n&&t.set("content-type",n)}return t}var el=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function eu(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new el(n.issues);return n.value}var ec=["get","post","put","patch","delete"],ed=async(e,t)=>{var n,r,o,s,i,a,l,u;let{hooks:c,url:d,options:f}=await Z(e,t),p=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&ei(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&ei(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(f),E=new AbortController,h=null!=(n=f.signal)?n:E.signal,T=function(e,t){let{baseURL:n,params:r,query:o}=t||{query:{},params:{},baseURL:""},s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];ec.includes(t)&&(e=e.replace(`@${t}/`,"/"))}s.endsWith("/")||(s+="/");let[i,a]=e.replace(s,"").split("?"),l=new URLSearchParams(a);for(let[e,t]of Object.entries(o||{})){let n;if(null!=t){if("string"==typeof t)n=t;else if(Array.isArray(t)){for(let n of t)l.append(e,n);continue}else n=JSON.stringify(t);l.set(e,n)}}if(r)if(Array.isArray(r))for(let[e,t]of i.split("/").filter(e=>e.startsWith(":")).entries()){let n=r[e];i=i.replace(t,n)}else for(let[e,t]of Object.entries(r))i=i.replace(`:${e}`,String(t));(i=i.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(i=i.slice(1));let u=l.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",s.startsWith("http"))?new URL(`${i}${u}`,s):`${s}${i}${u}`}(d,f),R=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(eo(e.body)&&!t.has("content-type")){for(let[t,n]of Object.entries(null==e?void 0:e.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&"application/x-www-form-urlencoded"===t.get("content-type")&&eo(e.body)?new URLSearchParams(e.body).toString():e.body}(f),_=await ea(f),O=function(e,t){var n;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let r=null==(n=e.split("@")[1])?void 0:n.split("/")[0];return ec.includes(r)?r.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(d,f),v=J(Q({},f),{url:T,headers:_,body:R,method:O,signal:h});for(let e of c.onRequest)if(e){let t=await e(v);"object"==typeof t&&null!==t&&(v=t)}("pipeTo"in v&&"function"==typeof v.pipeTo||"function"==typeof(null==(r=null==t?void 0:t.body)?void 0:r.pipe))&&!("duplex"in v)&&(v.duplex="half");let{clearTimeout:y}=function(e,t){let n;return!(null==e?void 0:e.signal)&&(null==e?void 0:e.timeout)&&(n=setTimeout(()=>null==t?void 0:t.abort(),null==e?void 0:e.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}(f,E),b=await p(v.url,v);y();let g={response:b,request:v};for(let e of c.onResponse)if(e){let n=await e(J(Q({},g),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?b.clone():b}));n instanceof Response?b=n:"object"==typeof n&&null!==n&&(b=n.response)}if(b.ok){if("HEAD"===v.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let r=t.split(";").shift()||"";return er.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}(b),n={data:null,response:b,request:v};if("json"===e||"text"===e){let e=await b.text(),t=null!=(s=v.jsonParser)?s:es;n.data=await t(e)}else n.data=await b[e]();for(let e of((null==v?void 0:v.output)&&v.output&&!v.disableValidation&&(n.data=await eu(v.output,n.data)),c.onSuccess))e&&await e(J(Q({},n),{response:(null==(i=null==t?void 0:t.hookOptions)?void 0:i.cloneResponse)?b.clone():b}));return(null==t?void 0:t.throw)?n.data:{data:n.data,error:null}}let A=null!=(a=null==t?void 0:t.jsonParser)?a:es,I=await b.text(),S=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(I),m=S?await A(I):null,L={response:b,responseText:I,request:v,error:J(Q({},m),{status:b.status,statusText:b.statusText})};for(let e of c.onError)e&&await e(J(Q({},L),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?b.clone():b}));if(null==t?void 0:t.retry){let n=function(e){if("number"==typeof e)return new ee({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new ee(e);case"exponential":return new et(e);default:throw Error("Invalid retry strategy")}}(t.retry),r=null!=(u=t.retryAttempt)?u:0;if(await n.shouldAttemptRetry(r,b)){for(let e of c.onRetry)e&&await e(g);let o=n.getDelay(r);return await new Promise(e=>setTimeout(e,o)),await ed(e,J(Q({},t),{retryAttempt:r+1}))}}if(null==t?void 0:t.throw)throw new z(b.status,b.statusText,S?m:I);return{data:null,error:J(Q({},m),{status:b.status,statusText:b.statusText})}},ef=n(7011),ep=n(7620);function eE(e){var t;let{pluginPathMethods:n,pluginsActions:r,pluginsAtoms:o,$fetch:s,$store:a,atomListeners:l}=((e,t)=>{let n,r="credentials"in Request.prototype,o=function(e,t,n,r,o){if(e)return R(e,t);if(!1!==r){let e=i.BETTER_AUTH_URL||i.NEXT_PUBLIC_BETTER_AUTH_URL||i.PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_BETTER_AUTH_URL||i.NUXT_PUBLIC_AUTH_URL||("/"!==i.BASE_URL?i.BASE_URL:void 0);if(e)return R(e,t)}n?.headers.get("x-forwarded-host"),n?.headers.get("x-forwarded-proto");if(n){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(n.url);if(!e)throw new T("Could not get origin from request. Please provide a valid base URL.");return R(e,t)}if("undefined"!=typeof window&&window.location)return R(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==ef){if(ef.env.NEXT_PUBLIC_AUTH_URL)return ef.env.NEXT_PUBLIC_AUTH_URL;if("undefined"==typeof window){if(ef.env.NEXTAUTH_URL)try{return ef.env.NEXTAUTH_URL}catch{}if(ef.env.VERCEL_URL)try{let t=ef.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${ef.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",s=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],a={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:l,onError:u,onRequest:c,onResponse:d,...f}=e?.fetchOptions||{},p=(n={baseURL:o,...r?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:o,parseDates:s=!0}=t;if("string"!=typeof e)return e;let i=e.trim();if(i.length>0&&'"'===i[0]&&i.endsWith('"')&&!i.slice(1,-1).includes('"'))return i.slice(1,-1);let a=i.toLowerCase();if(a.length<=9&&a in v)return v[a];if(!O.test(i)){if(n)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(_).some(([e,t])=>{let n=t.test(i);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(i,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(s&&"string"==typeof t){let e=function(e){let t=y.exec(e);if(!t)return null;let[,n,r,o,s,i,a,l,u,c,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(o,10),parseInt(s,10),parseInt(i,10),parseInt(a,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(d,10))*("+"===u?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return f instanceof Date&&!isNaN(f.getTime())?f:null}(t);if(e)return e}return o?o(e,t):t})}catch(t){if(n)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...f,plugins:[a,...f.plugins||[],...e?.disableDefaultFetchPlugins?[]:[b],...s]},async function(e,t){let r,o=J(Q(Q({},n),t),{plugins:[...(null==n?void 0:n.plugins)||[],(r=n||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var n,o,s,i;let a=(null==(o=null==(n=r.plugins)?void 0:n.find(t=>{var n;return null!=(n=t.schema)&&!!n.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:o.schema)||r.schema;if(a){let n=e;(null==(s=a.config)?void 0:s.prefix)&&n.startsWith(a.config.prefix)&&(n=n.replace(a.config.prefix,""),a.config.baseURL&&(e=e.replace(a.config.prefix,a.config.baseURL))),(null==(i=a.config)?void 0:i.baseURL)&&n.startsWith(a.config.baseURL)&&(n=n.replace(a.config.baseURL,""));let r=a.schema[n];if(r){let n=J(Q({},t),{method:r.method,output:r.output});return(null==t?void 0:t.disableValidation)||(n=J(Q({},n),{body:r.input?await eu(r.input,null==t?void 0:t.body):null==t?void 0:t.body,params:r.params?await eu(r.params,null==t?void 0:t.params):null==t?void 0:t.params,query:r.query?await eu(r.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:n}}}return{url:e,options:t}}}),...(null==t?void 0:t.plugins)||[]]});if(null==n?void 0:n.catchAllError)try{return await ed(e,o)}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 ed(e,o)}),{$sessionSignal:E,session:h,broadcastSessionUpdate:g}=function(e,t){let n=S(!1),r=((e,t,n,r)=>{let o=S({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>s(e)}),s=async e=>new Promise(s=>{let i="function"==typeof r?r({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):r;n(t,{...i,query:{...i?.query,...e?.query},async onSuccess(e){o.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await i?.onSuccess?.(e)},async onError(e){let{request:t}=e,n="number"==typeof t.retry?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r{o.set({error:e,data:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{s(void 0)})});e=Array.isArray(e)?e:[e];let i=!1;for(let t of e)t.subscribe(async()=>{L()||(i?await s():m(o,()=>{let e=setTimeout(async()=>{i||(await s(),i=!0)},0);return()=>{o.off(),t.off(),clearTimeout(e)}}))});return o})(n,"/get-session",e,{method:"GET"}),o=()=>{};return m(r,()=>{let s=function(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:o={}}=e,s=o.sessionOptions?.refetchInterval??0,i=o.sessionOptions?.refetchOnWindowFocus??!0,a=o.sessionOptions?.refetchWhenOffline??!1,l={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=e=>{if(!(a||F().isOnline))return;if(e?.event==="storage"){l.lastSync=j(),n.set(!n.get());return}let o=t.get(),s=()=>{l.lastSessionRequest=j(),r("/get-session").then(async e=>{let{data:s,error:i}=k(e);if(s?.needsRefresh)try{let e=await r("/get-session",{method:"POST"});({data:s,error:i}=k(e))}catch{}let a=s?.session&&s?.user?s:null;t.set({...o,data:a,error:i}),l.lastSync=j(),n.set(!n.get())}).catch(()=>{})};if(e?.event==="poll")return void s();if(e?.event==="visibilitychange"){if(j()-l.lastSessionRequest<5)return;l.lastSessionRequest=j()}if(e?.event==="visibilitychange")return void s();(o?.data===null||o?.data===void 0)&&(l.lastSync=j(),n.set(!n.get()))};return{init:()=>{s&&s>0&&(l.pollInterval=setInterval(()=>{t.get()?.data&&u({event:"poll"})},1e3*s)),l.unsubscribeBroadcast=U().subscribe(()=>{u({event:"storage"})}),i&&(l.unsubscribeFocus=P().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=F().subscribe(e=>{e&&u({event:"visibilitychange"})}),U().setup(),P().setup(),F().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=>{U().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return s.init(),o=s.broadcastSessionUpdate,()=>{s.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>o(e)}}(p,e),A=e?.plugins||[],I={},w={$sessionSignal:E,session:h},N={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},D=[{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?g("signout"):("/update-user"===e||"/update-session"===e)&&g("updateUser")}}];for(let e of A)e.getAtoms&&Object.assign(w,e.getAtoms?.(p)),e.pathMethods&&Object.assign(N,e.pathMethods),e.atomListeners&&D.push(...e.atomListeners);let C={notify:e=>{w[e].set(!w[e].get())},listen:(e,t)=>{w[e].subscribe(t)},atoms:w};for(let t of A)t.getActions&&(I=V(t.getActions?.(p,C,e)??{},I));return{get baseURL(){return o},pluginsActions:I,pluginsAtoms:w,pluginPathMethods:N,atomListeners:D,$fetch:p,$store:C}})(e),u={};for(let[e,t]of Object.entries(o))u[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let n=(0,ep.useRef)(e.get()),{keys:r,deps:o=[e,r]}=t,s=(0,ep.useCallback)(t=>{let o=e=>{n.current!==e&&(n.current=e,t())};if(o(e.value),r?.length){let t;return t=new Set(r).add(void 0),e.listen((e,n,r)=>{t.has(r)&&o(e,n,r)})}return e.listen(o)},o),i=()=>n.current;return(0,ep.useSyncExternalStore)(s,i,i)})(t);return t={...r,...u,$fetch:s,$store:a},function e(r=[]){return new Proxy(function(){},{get(n,o){var s;if("string"!=typeof o||"then"===o||"catch"===o||"finally"===o)return;let i=[...r,o],a=t;for(let e of i)if(a&&"object"==typeof a&&e in a)a=a[e];else{a=void 0;break}return"function"==typeof a?a:"object"==typeof(s=a)&&null!==s&&"get"in s&&"function"==typeof s.get&&"lc"in s&&"number"==typeof s.lc?a:e(i)},apply:async(e,t,i)=>{let a="/"+r.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),u=i[0]||{},c=i[1]||{},{query:d,fetchOptions:f,...p}=u,E={...c,...f},h=function(e,t,n){let r=t[e],{fetchOptions:o,query:s,...i}=n||{};return r||(o?.method?o.method:i&&Object.keys(i).length>0?"POST":"GET")}(a,n,u);return await s(a,{...E,body:"GET"===h?void 0:{...p,...E?.body||{}},query:d||E?.query,method:h,async onSuccess(e){if(await E?.onSuccess?.(e),!l||E.disableSignal)return;let t=l.filter(e=>e.matcher(a));if(!t.length)return;let n=new Set;for(let e of t){let t=o[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let r=t.get();setTimeout(()=>{t.set(!r)},10),e.callback?.(a)}}})}})}()}},7541:(e,t,n)=>{var r=n(3041);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})}}]);