PageSourceSearch

https://gqv.ai/_next/static/chunks/7078e6adf367a715.js

js gqv.ai collected 2026-10-05 12:05:31 UTC 55,587 bytes, 2 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,444470,e=>{"use strict";let t,r,n,o,i,a,s,l,u;function c(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}let E=c({CHALLENGE_NOT_FOUND:"Challenge not found",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:"You are not allowed to register this passkey",FAILED_TO_VERIFY_REGISTRATION:"Failed to verify registration",PASSKEY_NOT_FOUND:"Passkey not found",AUTHENTICATION_FAILED:"Authentication failed",UNABLE_TO_CREATE_SESSION:"Unable to create session",FAILED_TO_UPDATE_PASSKEY:"Failed to update passkey"});function _(e){let t=new Uint8Array(e),r="";for(let e of t)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function d(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,n=atob(t.padEnd(t.length+r,"=")),o=new ArrayBuffer(n.length),i=new Uint8Array(o);for(let e=0;e<n.length;e++)i[e]=n.charCodeAt(e);return o}function O(){return T.stubThis(globalThis?.PublicKeyCredential!==void 0&&"function"==typeof globalThis.PublicKeyCredential)}let T={stubThis:e=>e};function R(e){let{id:t}=e;return{...e,id:d(t),transports:e.transports}}function A(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}class f extends Error{constructor({message:e,code:t,cause:r,name:n}){super(e,{cause:r}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n??r.name,this.code=t}}let p=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}},h=["cross-platform","platform"];function I(e){if(e&&!(0>h.indexOf(e)))return e}async function N(e){let t,r,n,o,i;!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:a,useAutoRegister:s=!1}=e;if(!O())throw Error("WebAuthn is not supported in this browser");let l={...a,challenge:d(a.challenge),user:{...a.user,id:d(a.user.id)},excludeCredentials:a.excludeCredentials?.map(R)},u={};s&&(u.mediation="conditional"),u.publicKey=l,u.signal=p.createNewAbortSignal();try{t=await navigator.credentials.create(u)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new f({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(r.authenticatorSelection?.requireResidentKey===!0)return new f({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&r.authenticatorSelection?.userVerification==="required")return new f({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if(r.authenticatorSelection?.userVerification==="required")return new f({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new f({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new f({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new f(0===r.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!A(t))return new f({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rp.id!==t)return new f({message:`The RP ID "${r.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new f({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new f({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:u})}if(!t)throw Error("Registration was not completed");let{id:c,rawId:E,response:T,type:h}=t;if("function"==typeof T.getTransports&&(n=T.getTransports()),"function"==typeof T.getPublicKeyAlgorithm)try{o=T.getPublicKeyAlgorithm()}catch(e){m("getPublicKeyAlgorithm()",e)}if("function"==typeof T.getPublicKey)try{let e=T.getPublicKey();null!==e&&(i=_(e))}catch(e){m("getPublicKey()",e)}if("function"==typeof T.getAuthenticatorData)try{r=_(T.getAuthenticatorData())}catch(e){m("getAuthenticatorData()",e)}return{id:c,rawId:_(E),response:{attestationObject:_(T.attestationObject),clientDataJSON:_(T.clientDataJSON),transports:n,publicKeyAlgorithm:o,publicKey:i,authenticatorData:r},type:h,clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:I(t.authenticatorAttachment)}}function m(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
2`,t)}let S=e=>e;async function g(e){let t,r,n;!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:o,useBrowserAutofill:i=!1,verifyBrowserAutofillInput:a=!0}=e;if(!O())throw Error("WebAuthn is not supported in this browser");o.allowCredentials?.length!==0&&(t=o.allowCredentials?.map(R));let s={...o,challenge:d(o.challenge),allowCredentials:t},l={};if(i){if(!await function(){if(!O())return S(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?S(new Promise(e=>e(!1))):S(e.isConditionalMediationAvailable())}())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&a)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');l.mediation="conditional",s.allowCredentials=[]}l.publicKey=s,l.signal=p.createNewAbortSignal();try{r=await navigator.credentials.get(l)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new f({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new f({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!A(t))return new f({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new f({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new f({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:l})}if(!r)throw Error("Authentication was not completed");let{id:u,rawId:c,response:E,type:T}=r;return E.userHandle&&(n=_(E.userHandle)),{id:u,rawId:_(c),response:{authenticatorData:_(E.authenticatorData),clientDataJSON:_(E.clientDataJSON),signature:_(E.signature),userHandle:n},type:T,clientExtensionResults:r.getClientExtensionResults(),authenticatorAttachment:I(r.authenticatorAttachment)}}let b=Symbol.for("better-auth:broadcast-channel");var y,L,v=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??"{}");
2t?.event==="session"&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function w(e="better-auth.message"){return globalThis[b]||(globalThis[b]=new v(e)),globalThis[b]}let U=Symbol.for("better-auth:focus-manager");var D=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 P(){return globalThis[U]||(globalThis[U]=new D),globalThis[U]}let C=Symbol.for("better-auth:online-manager");var M=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 Y(){return globalThis[C]||(globalThis[C]=new M),globalThis[C]}let F={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*:/},B=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,H={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},V=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;var k=e.i(607316);let x=[],G=0,W=0,$=e=>{let t=[],r={get:()=>(r.lc||r.listen(()=>{})(),r.value),lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=G+4;t<x.length;)x[t]===e?x.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--r.lc||r.off())}),notify(e,n){W++;let o=!x.length;for(let o of t)x.push(o,r.value,e,n);if(o){for(G=0;G<x.length;G+=4)x[G](x[G+1],x[G+2],x[G+3]);x.length=0}},off(){},set(e){let t=r.value;t!==e&&(r.value=e,r.notify(t))},subscribe(e){let t=r.listen(e);return e(r.value),t},value:e};return r},j=(e,t)=>{var r,n;return r=r=>{let n=t(r);n&&e.events[6].push(n)},n=t=>{let r=e.listen;e.listen=(...n)=>(e.lc||e.active||(e.active=!0,t()),r(...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=r,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(r),()=>{let t=e.events[5],n=t.indexOf(r);t.splice(n,1),t.length||(delete e.events[5],e.events[15](),delete e.events[15])}},z=()=>"u"<typeof window,K=(e,t,r,n)=>{let o=$({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>i(e)}),i=async e=>new Promise(i=>{let a="function"==typeof n?n({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):n;r(t,{...a,query:{...a?.query,...e?.query},async onSuccess(e){o.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await a?.onSuccess?.(e)},async onError(e){let{request:t}=e,r="number"==typeof t.retry?t.retry:t.retry?.attempts,n=t.retryAttempt||0;r&&n<r||(o.set({error:e.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await a?.onError?.(e))},async onRequest(e){let t=o.get();o.set({isPending:null===t.data,data:t.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await a?.onRequest?.(e)}}).catch(e=>{o.set({error:e,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{i(void 0)})});e=Array.isArray(e)?e:[e];let a=!1;for(let t of e)t.subscribe(async()=>{z()||(a?await i():j(o,()=>{let e=setTimeout(async()=>{a||(await i(),a=!0)},0);return()=>{o.off(),t.off(),clearTimeout(e)}}))});return o},q=()=>Math.floor(Date.now()/1e3),X=Object.create(null),Z=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?X:globalThis),J=new Proxy(X,{get:(e,t)=>Z()[t]??X[t],has:(e,t)=>t in Z()||t in X,set:(e,t,r)=>(Z(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=Z(!0);return delete r[t],!0},ownKeys:()=>Object.keys(Z(!0))});function Q(e,t){return void 0!==k.default&&k.default.env?k.default.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}void 0!==k.default&&k.default.env,Object.freeze({get BETTER_AUTH_SECRET(){return Q("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return Q("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return Q("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return Q("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return Q("NODE_ENV","development")}
2,get PACKAGE_VERSION(){return Q("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return Q("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});let ee={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},et=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),er=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],en="\x1b[0m",eo="\x1b[31m",ei="\x1b[32m",ea="\x1b[33m",es="\x1b[34m",el="\x1b[35m",eu=["debug","info","success","warn","error"],ec={info:es,success:ei,warn:ea,error:eo,debug:el};t=(void 0)??"warn",r=1!==function(){if(void 0!==Q("FORCE_COLOR"))switch(Q("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==Q("NODE_DISABLE_COLORS")&&""!==Q("NODE_DISABLE_COLORS")||void 0!==Q("NO_COLOR")&&""!==Q("NO_COLOR")||"dumb"===Q("TERM"))return 1;if(Q("TMUX"))return 24;if("TF_BUILD"in J&&"AGENT_NAME"in J)return 4;if("CI"in J){for(let{0:e,1:t}of et)if(e in J)return t;return"codeship"===Q("CI_NAME")?8:1}if("TEAMCITY_VERSION"in J)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(Q("TEAMCITY_VERSION"))?4:1;switch(Q("TERM_PROGRAM")){case"iTerm.app":if(!Q("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(Q("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===Q("COLORTERM")||"24bit"===Q("COLORTERM"))return 24;if(Q("TERM")){if(null!==/truecolor/.exec(Q("TERM")))return 24;if(null!==/^xterm-256/.exec(Q("TERM")))return 8;let e=Q("TERM").toLowerCase();if(ee[e])return ee[e];if(er.some(t=>null!==t.exec(e)))return 4}return Q("COLORTERM")?4:1}(),Object.fromEntries(eu.map(e=>[e,(...[n,...o])=>((e,n,o=[])=>{let i;if(!(eu.indexOf(e)>=eu.indexOf(t)))return;let a=(i=new Date().toISOString(),r?`\x1b[2m${i}${en} ${ec[e]}${e.toUpperCase()}${en} \x1b[1m[Better Auth]:${en} ${n}`:`${i} ${e.toUpperCase()} [Better Auth]: ${n}`);"error"===e?console.error(a,...o):"warn"===e?console.warn(a,...o):console.log(a,...o)})(e,n,o)])),c({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_
2NEW_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 eE={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 e_=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:eE[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};Symbol.for("better-call:api-error-headers"),y=e_,L=Error,Object.defineProperty((class e extends y{#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:()=>L,enumerable:!1,configurable:!0});var ed=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function eO(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new ed(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof ed)throw t;throw new ed(`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 ed(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=e.replace(/\/+$/,"");return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}let eT={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{}}}};function eR(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 eA(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,n=".",o){if(!eR(r))return e(t,{},n,o);let i=Object.assign({},r);for(let r in t){if("__proto__"===r||"constructor"===r)continue;let a=t[r];null!=a&&(o&&o(i,r,a,n)||(Array.isArray(a)&&Array.isArray(i[r])?i[r]=[...a,...i[r]]:eR(a)&&eR(i[r])?i[r]=e(a,i[r],(n?`${n}.`:"")+r.toString(),o):i[r]=a))}return i})(t,r,"",e),{})}let ef=eA();eA((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),eA((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0});var ep=Object.defineProperty,eh=Object.defineProperties,eI=Object.getOwnPropertyDescriptors,eN=Object.getOwnPropertySymbols,em=Object.prototype.hasOwnProperty,eS=Object.prototype.propertyIsEnumerable,eg=(e,t,r)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eb=(e,t)=>{for(var r in t||(t={}))em.call(t,r)&&eg(e,r,t[r]);if(eN)for(var r of eN(t))eS.call(t,r)&&eg(e,r,t[r]);return e},ey=(e,t)=>
2eh(e,eI(t)),eL=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},ev=async(e,t)=>{var r,n,o,i,a,s;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 n=await (null==(r=c.init)?void 0:r.call(c,e.toString(),t));l=n.options||l,e=n.url}u.onRequest.push(null==(n=c.hooks)?void 0:n.onRequest),u.onResponse.push(null==(o=c.hooks)?void 0:o.onResponse),u.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),u.onError.push(null==(a=c.hooks)?void 0:a.onError),u.onRetry.push(null==(s=c.hooks)?void 0:s.onRetry)}return{url:e,options:l,hooks:u}},ew=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)}},eD=async e=>{let t={},r=async e=>"function"==typeof e?await e():e;if(null==e?void 0:e.auth){if("Bearer"===e.auth.type){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if("Basic"===e.auth.type){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if("Custom"===e.auth.type){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${null!=n?n:""} ${o}`}}return t},eP=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function eC(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 eM(e){try{return JSON.parse(e)}catch(t){return e}}function eY(e){return"function"==typeof e}async function eF(e){let t=new Headers(null==e?void 0:e.headers);for(let[r,n]of Object.entries(await eD(e)||{}))t.set(r,n);if(!t.has("content-type")){let r=eC(null==e?void 0:e.body)?"application/json":null;r&&t.set("content-type",r)}return t}var eB=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function eH(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new eB(r.issues);return r.value}var eV=["get","post","put","patch","delete"],ek=async(e,t)=>{var r,n,o,i,a,s,l,u;let c,{hooks:E,url:_,options:d}=await ev(e,t),O=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&eY(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&eY(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(d),T=new AbortController,R=null!=(r=d.signal)?r:T.signal,A=function(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];eV.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[a,s]=e.replace(i,"").split("?"),l=new URLSearchParams(s);for(let[e,t]of Object.entries(o||{})){let r;if(null!=t){if("string"==typeof t)r=t;else if(Array.isArray(t)){for(let r of t)l.append(e,r);continue}else r=JSON.stringify(t);l.set(e,r)}}if(n)if(Array.isArray(n))for(let[e,t]of a.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];a=a.replace(t,r)}else for(let[e,t]of Object.entries(n))a=a.replace(`:${e}`,String(t));(a=a.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(a=a.slice(1));let u=l.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${a}${u}`,i):`${i}${a}${u}`}(_,d),f=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(eC(e.body)&&!t.has("content-type")){for(let[t,r]of Object.entries(null==e?void 0:e.body))r instanceof Date&&(e.body[t]=r.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&"application/x-www-form-urlencoded"===t.get("content-type")&&eC(e.body)?new URLSearchParams(e.body).toString():e.body}(d),p=await eF(d),h=function(e,t){var r;if(null==t?void 0:t.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=null==(r=e.split("@")[1])?void 0:r.split("/")[0];return eV.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(_,d),I=ey(eb({},d),{url:A,headers:p,body:f,method:h,signal:R});for(let e of E.onRequest)if(e){let t=await e(I);"object"==typeof t&&null!==t&&(I=t)}("pipeTo"in I&&"function"==typeof I.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pi
2pe))&&!("duplex"in I)&&(I.duplex="half");let{clearTimeout:N}=(!(null==d?void 0:d.signal)&&(null==d?void 0:d.timeout)&&(c=setTimeout(()=>null==T?void 0:T.abort(),null==d?void 0:d.timeout)),{abortTimeout:c,clearTimeout:()=>{c&&clearTimeout(c)}}),m=await O(I.url,I);N();let S={response:m,request:I};for(let e of E.onResponse)if(e){let r=await e(ey(eb({},S),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?m.clone():m}));r instanceof Response?m=r:"object"==typeof r&&null!==r&&(m=r.response)}if(m.ok){if("HEAD"===I.method)return{data:"",error:null};let e=function(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return eP.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}(m),r={data:null,response:m,request:I};if("json"===e||"text"===e){let e=await m.text(),t=null!=(i=I.jsonParser)?i:eM;r.data=await t(e)}else r.data=await m[e]();for(let e of((null==I?void 0:I.output)&&I.output&&!I.disableValidation&&(r.data=await eH(I.output,r.data)),E.onSuccess))e&&await e(ey(eb({},r),{response:(null==(a=null==t?void 0:t.hookOptions)?void 0:a.cloneResponse)?m.clone():m}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let g=null!=(s=null==t?void 0:t.jsonParser)?s:eM,b=await m.text(),y=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(b),L=y?await g(b):null,v={response:m,responseText:b,request:I,error:ey(eb({},L),{status:m.status,statusText:m.statusText})};for(let e of E.onError)e&&await e(ey(eb({},v),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?m.clone():m}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new ew({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new ew(e);case"exponential":return new eU(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;if(await r.shouldAttemptRetry(n,m)){for(let e of E.onRetry)e&&await e(S);let o=r.getDelay(n);return await new Promise(e=>setTimeout(e,o)),await ek(e,ey(eb({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new eL(m.status,m.statusText,y?L:b);return{data:null,error:ey(eb({},L),{status:m.status,statusText:m.statusText})}};let ex=c({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"});function eG(e){return{newRole:e=>{var t;return{authorize(e,r="AND"){let n=!1;for(let[o,i]of Object.entries(e)){let e=t[o];if(!e)return{success:!1,error:`You are not allowed to access resource: ${o}`};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 ed("Invalid access control request");
2if(n&&"OR"===r)return{success:n};if(!n&&"AND"===r)return{success:!1,error:`unauthorized to access resource "${o}"`}}return n?{success:n}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}let eW=eG({user:["create","list","set-role","ban","impersonate","impersonate-admins","delete","set-password","get","update"],session:["list","revoke","delete"]}),e$=eW.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),ej=eW.newRole({user:[],session:[]}),ez={admin:e$,user:ej};c({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"}),c({OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",TOO_MANY_ATTEMPTS:"Too many attempts"}),c({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)."}),c({INVALID_SESSION_TOKEN:"Invalid session token"});let eK=c({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
2d 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"}),eq=eG({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eX=eq.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eZ=eq.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),eJ=eq.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]}),eQ={admin:eX,owner:eZ,member:eJ};c({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"});let e0=c({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"});c({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"});var e1=e.i(247313);let e4=function(e){var t;let{pluginPathMethods:r,pluginsActions:n,pluginsAtoms:o,$fetch:i,$store:a,atomListeners:s}=((e,t)=>{var r;let n,o,i,a="credentials"in Request.prototype,s=function(e,t,r,n,o){if(e)return eO(e,t);if(!1!==n){let e=J.BETTER_AUTH_URL||J.NEXT_PUBLIC_BETTER_AUTH_URL||J.PUBLIC_BETTER_AUTH_URL||J.NUXT_PUBLIC_BETTER_AUTH_URL||J.NUXT_PUBLIC_AUTH_URL||("/"!==J.BASE_URL?J.BASE_URL:void 0);if(e)return eO(e,t)}r?.headers.get("x-forwarded-host"),r?.headers.get("x-forwarded-proto");if(r){let e=function(e){try{let t=new URL(e);return"null"===t.origin?null:t.origin}catch{return null}}(r.url);if(!e)throw new ed("Could not get origin from request. Please provide a valid base URL.");return eO(e,t)}if("u">typeof window&&window.location)return eO(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==k.default){if(k.default.env.NEXT_PUBLIC_AUTH_URL)return k.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(k.default.env.NEXTAUTH_URL)try{return k.default.env.NEXTAUTH_URL}catch{}if(k.default.env.VERCEL_URL)try{let t=k.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${k.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)||[],u={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:_,onResponse:d,...O}=e?.fetchOptions||{},T=(r={baseURL:s,...a?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if("string"!=typeof e)return e;let a=e.trim();if(a.length>0&&'"'===a[0]&&a.endsWith('"')&&!a.slice(1,-1).includes('"'))return a.slice(1,-1);let s=a.toLowerCase();if(s.length<=9&&s in H)return H[s];if(!B.test(a)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(F).some(([e,t])=>{let r=t.test(a);return r&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),r})&&r)throw Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(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=V.exec(e);if(!t)return null;let[,r,n,o,i,a,s,l,u,c,E]=t,_=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(a,10),parseInt(s,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(E,10))*("+"===u?-1:1);_.setUTCMinutes(_.getUTCMinutes()+e)}return _ instanceof Date&&!isNaN(_.getTime())?_:null}(t);if(e)return e}return o?o(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...O,plugins:[u,...O.plugins||[],...e?.disableDefaultFetchPlugins?[]:[eT],...l]},async function(e,t){let n,o=ey(eb(eb({},r),t),{plugins:[...(null==r?void 0:r.plugins)||[],(n=r||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var r,o,i,a;let s=(null==(o=null==(r=n.plugins)?void 0:r.find(t=>{var r;return null!=(r=t.schema)&&!!r.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:o.schema)||n.schema;if(s){let r=e;(null==(i=s.config)?void 0:i.prefix)&&r.startsWith(s.config.prefix)&&(r=r.replace(s.config.prefix,""),s.config.baseURL&&(e=e.replace(s.config.prefix,s.config.baseURL))),(null==(a=s.config)?void 0:a.baseURL)&&r.startsWith(s.config.baseURL)&&(r=r.replace(s.config.baseURL,""));let n=s.schema[r];if(n){let r=ey(eb({},t),{method:n.method,output:n.output});return(null==t?void 0:t.disableValidation)||(r=ey(eb({},r),{body:n.input?await eH(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await eH(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await eH(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:r}}}return{url:e,options:t}}}),...(null==t?void 0:t.plugins)||[]]});if(null==r?void 0:r.catchAllError)try{return await ek(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 ek(e,o)}),{$sessionSignal:R,session:A,broadcastSessionUpdate:f}=(o=K(n=$(!1),"/get-session",T,{method:"GET"}),i=()=>{},j(o,()=>{let t=function(e){let{sessionAtom:t,sessionSignal:r,$fetch:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,s=o.sessionOptions?.refetchWhenOffline??!1,l={lastSync:0,lastSessionRequest:0,cachedSession:void 0},u=e=>{if(!(s||Y().isOnline))return;if(e?.event==="storage"){l.lastSync=q(),r.set(!r.get());return}let o=t.get(),i=()=>{l.lastSessionRequest=q(),n("/get-session").then(async e=>{let i=e.data,a=e.error||null;if(i?.needsRefresh)try{let e=await n("/get-session",{method:"POST"});i=e.data,a=e.error||null}catch{}let s=i?.session&&i?.user?{session:i.session,user:i.user}:null;t.set({...o,data:s,error:a}),l.lastSync=q(),r.set(!r.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():(o?.data===null||o?.data===void 0)&&(l.lastSync=q(),r.set(!r.get()))};return{init:()=>{i&&i>0&&(l.pollInterval=setInterval(()=>{t.get()?.data&&u({event:"poll"})},1e3*i)),l.unsubscribeBroadcast=w().subscribe(()=>{u({event:"storage"})}),a&&(l.unsubscribeFocus=P().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=Y().subscribe(e=>{e&&u({event:"visibilitychange"})}),w().setup(),P().setup(),Y().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=>{w().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({sessionAtom:o,sessionSignal:n,$fetch:T,options:e});return t.init(),i=t.broadcastSessionUpdate,()=>{t.cleanup()}}),{session:o,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}),p=e?.plugins||[],h={},I={$sessionSignal:R,session:A}
2,N={"/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 p)e.getAtoms&&Object.assign(I,e.getAtoms?.(T)),e.pathMethods&&Object.assign(N,e.pathMethods),e.atomListeners&&m.push(...e.atomListeners);let S={notify:e=>{I[e].set(!I[e].get())},listen:(e,t)=>{I[e].subscribe(t)},atoms:I};for(let t of p)t.getActions&&(h=ef(t.getActions?.(T,S,e)??{},h));return{get baseURL(){return s},pluginsActions:h,pluginsAtoms:I,pluginPathMethods:N,atomListeners:m,$fetch:T,$store:S}})(e),l={};for(let[e,t]of Object.entries(o))l[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let r=(0,e1.useRef)(e.get()),{keys:n,deps:o=[e,n]}=t,i=(0,e1.useCallback)(t=>{let o=e=>{r.current!==e&&(r.current=e,t())};if(o(e.value),n?.length){let t;return t=new Set(n).add(void 0),e.listen((e,r,n)=>{t.has(n)&&o(e,r,n)})}return e.listen(o)},o),a=()=>r.current;return(0,e1.useSyncExternalStore)(i,a,a)})(t);return t={...n,...l,$fetch:i,$store:a},function e(n=[]){return new Proxy(function(){},{get(r,o){var i;if("string"!=typeof o||"then"===o||"catch"===o||"finally"===o)return;let a=[...n,o],s=t;for(let e of a)if(s&&"object"==typeof s&&e in s)s=s[e];else{s=void 0;break}return"function"==typeof s?s:"object"==typeof(i=s)&&null!==i&&"get"in i&&"function"==typeof i.get&&"lc"in i&&"number"==typeof i.lc?s:e(a)},apply:async(e,t,a)=>{let l="/"+n.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),u=a[0]||{},c=a[1]||{},{query:E,fetchOptions:_,...d}=u,O={...c,..._},T=function(e,t,r){let n=t[e],{fetchOptions:o,query:i,...a}=r||{};return n||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}(l,r,u);return await i(l,{...O,body:"GET"===T?void 0:{...d,...O?.body||{}},query:E||O?.query,method:T,async onSuccess(e){if(await O?.onSuccess?.(e),!s||O.disableSignal)return;let t=s.filter(e=>e.matcher(l));if(!t.length)return;let r=new Set;for(let e of t){let t=o[e.signal];if(!t)return;if(r.has(e.signal))continue;r.add(e.signal);let n=t.get();setTimeout(()=>{t.set(!n)},10),e.callback?.(l)}}})}})}()}({plugins:[{id:"additional-fields-client",$InferServerPlugin:{}},{id:"magic-link",$InferServerPlugin:{}},(n=$(!1),o=$(!1),i=$(!1),a=$(!1),s={admin:eX,member:eJ,owner:eZ,...void 0},{id:"organization",$InferServerPlugin:{},getActions:(e,t,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:e=>{let t;return((e,t)=>{if(!e.permissions)return!1;let r=e.role.split(","),n=e.options.creatorRole||"owner",o=r.includes(n),i=e.allowCreatorAllPermissions||!1;if(o&&i)return!0;for(let n of r)if(t[n]?.authorize(e.permissions)?.success)return!0;return!1})(t={role:e.role,options:{ac:void 0,roles:s},permissions:e.permissions},t.options.roles||eQ)}}}),getAtoms:e=>{let t=K(n,"/organization/list",e,{method:"GET"});return{$listOrg:n,$activeOrgSignal:o,$activeMemberSignal:i,$activeMemberRoleSignal:a,activeOrganization:K([o],"/organization/get-full-organization",e,()=>({method:"GET"})),listOrganizations:t,activeMember:K([o,i],"/organization/get-active-member",e,{method:"GET"}),activeMemberRole:K([o,a],"/organization/get-active-member-role",e,{method:"GET"})}},pathMethods:{"/organization/get-full-organization":"GET","/organization/list-user-teams":"GET"},atomListeners:[{matcher:e=>"/organization/create"===e||"/organization/delete"===e||"/organization/update"===e,signal:"$listOrg"},{matcher:e=>e.startsWith("/organization"),signal:"$activeOrgSignal"},{matcher:e=>e.startsWith("/organization/set-active")||"/organization/create"===e||"/organization/delete"===e||"/organization/remove-member"===e||"/organization/leave"===e||"/organization/accept-invitation"===e,signal:"$sessionSignal"},{matcher:e=>e.includes("/organization/update-member-role")||e.startsWith("/organization/set-active"),signal:"$activeMemberSignal"},{matcher:e=>e.includes("/organization/update-member-role")||e.startsWith("/organization/set-active"),signal:"$activeMemberRoleSignal"}],$ERROR_CODES:eK}),(l={admin:e$,user:ej,...void 0},{id:"admin-client",$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:e=>(e=>
2{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions)return!1;let t=(e.role||e.options?.defaultRole||"user").split(","),r=e.options?.roles||ez;for(let n of t)if(r[n]?.authorize(e.permissions)?.success)return!0;return!1})({role:e.role,options:{ac:void 0,roles:l},permissions:e.permissions})}}),pathMethods:{"/admin/list-users":"GET","/admin/stop-impersonating":"POST"},$ERROR_CODES:ex}),(u=$(),{id:"passkey",$InferServerPlugin:{},getActions:(e,t)=>((e,{$listPasskeys:t,$store:r})=>({signIn:{passkey:async(n,o)=>{let i=await e("/passkey/generate-authenticate-options",{method:"GET",throw:!1});if(!i.data)return i;try{let a=await e("/passkey/verify-authentication",{body:{response:await g({optionsJSON:i.data,useBrowserAutofill:n?.autoFill})},...n?.fetchOptions,...o,method:"POST",throw:!1});return t.set(Math.random()),r.notify("$sessionSignal"),a}catch(e){return console.error("[Better Auth] Error verifying passkey",e),{data:null,error:{code:"AUTH_CANCELLED",message:"auth cancelled",status:400,statusText:"BAD_REQUEST"}}}}},passkey:{addPasskey:async(r,n)=>{let o=await e("/passkey/generate-register-options",{method:"GET",query:{...r?.authenticatorAttachment&&{authenticatorAttachment:r.authenticatorAttachment},...r?.name&&{name:r.name}},throw:!1});if(!o.data)return o;try{let i=await N({optionsJSON:o.data,useAutoRegister:r?.useAutoRegister}),a=await e("/passkey/verify-registration",{...r?.fetchOptions,...n,body:{response:i,name:r?.name},method:"POST",throw:!1});if(!a.data)return a;return t.set(Math.random()),a}catch(e){if(e instanceof f){if("ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"===e.code)return{data:null,error:{code:e.code,message:"previously registered",status:400,statusText:"BAD_REQUEST"}};if("ERROR_CEREMONY_ABORTED"===e.code)return{data:null,error:{code:e.code,message:"registration cancelled",status:400,statusText:"BAD_REQUEST"}};return{data:null,error:{code:e.code,message:e.message,status:400,statusText:"BAD_REQUEST"}}}return{data:null,error:{code:"UNKNOWN_ERROR",message:e instanceof Error?e.message:"unknown error",status:500,statusText:"INTERNAL_SERVER_ERROR"}}}}},$Infer:{}}))(e,{$listPasskeys:u,$store:t}),getAtoms:e=>({listPasskeys:K(u,"/passkey/list-user-passkeys",e,{method:"GET"}),$listPasskeys:u}),pathMethods:{"/passkey/register":"POST","/passkey/authenticate":"POST"},atomListeners:[{matcher:e=>"/passkey/verify-registration"===e||"/passkey/delete-passkey"===e||"/passkey/update-passkey"===e||"/sign-out"===e,signal:"$listPasskeys"},{matcher:e=>"/passkey/verify-authentication"===e,signal:"$sessionSignal"}],$ERROR_CODES:E}),{id:"two-factor",$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith("/two-factor/"),signal:"$sessionSignal"}],pathMethods:{"/two-factor/disable":"POST","/two-factor/enable":"POST","/two-factor/send-otp":"POST","/two-factor/generate-backup-codes":"POST","/two-factor/get-totp-uri":"POST","/two-factor/verify-totp":"POST","/two-factor/verify-otp":"POST","/two-factor/verify-backup-code":"POST"},fetchPlugins:[{id:"two-factor",name:"two-factor",hooks:{async onSuccess(e){e.data?.twoFactorRedirect}}}],$ERROR_CODES:e0}]});e.s(["authClient",0,e4],444470)}]);

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.