PageSourceSearch

https://auth.maxmove.com/_next/static/chunks/0eh1126x_108r.js?dpl=…od-21caee532e35abdf39941f013bd14771d1ed6ab7

js maxmove.com collected 2026-10-02 00:19:36 UTC 72,378 bytes, 2 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,10957,e=>{"use strict";var t=e.i(58735);e.i(56046);var r=e.i(37584);let n=r.LOCAL_DEV_AUTH_API_BASE_URL;function o(e){let t=e?.trim();return t?t.replace(/\/$/,""):null}e.s(["resolveAuthBaseURL",0,function(e){let i,a=o(e?.envBase);if(a)return(0,r.resolveBrowserAuthApiBaseUrl)(a);let s=e?.host||"",l=e?.proto||"https";if(s&&((i=s.toLowerCase()).includes("localhost")||i.startsWith("127.")||i.endsWith(".local")||i.startsWith("10.")||i.startsWith("192.168.")||/^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(i)))return n;if(s){let e;return e=`${"http"===l||"https"===l?l:"https"}://${s}`.replace("://auth.","://api.").replace("://dashboard.","://api.").replace("://web.","://api."),`${e.replace(/\/$/,"")}/auth/api`}let u=o("https://api.maxmove.com/auth/api")||o(t.default.env.AUTH_BASE_URL);return u?(0,r.resolveBrowserAuthApiBaseUrl)(u):n}])},35125,e=>{"use strict";let t,r,n,o,i,a;var s,l=e.i(38646),u=e.i(96637),c=e.i(82283),d=e.i(97800),E=e.i(13389),_=e.i(38983),f=e.i(61661),O=e.i(76992),h=e.i(78739);e.i(46230);var p=e.i(92743),T=e.i(29997);let R=(0,e.i(87951).createAccessControl)({user:["create","list","set-role","ban","impersonate","impersonate-admins","delete","set-password","set-email","get","update"],session:["list","revoke","delete"]}),A=R.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","set-email","get","update"],session:["list","revoke","delete"]}),m=R.newRole({user:[],session:[]}),g={admin:A,user:m};var I=e.i(66808);let S=(0,I.defineErrorCodes)({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",YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL:"You are not allowed to update users email",PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER:"Password cannot be updated through update-user. Use the set-user-password endpoint instead"}),N=(0,I.defineErrorCodes)({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",FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS:"Failed to delete anonymous user sessions",USER_IS_NOT_ANONYMOUS:"User is not anonymous",DELETE_ANONYMOUS_USER_DISABLED:"Deleting anonymous users is disabled"}),b=(0,I.defineErrorCodes)({OTP_EXPIRED:"OTP expired",INVALID_OTP:"Invalid OTP",TOO_MANY_ATTEMPTS:"Too many attempts"});var v=e.i(48197),y=e.i(39134);let L=(0,I.defineErrorCodes)({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",EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION:"Email verification required to view or list invitations for the session email",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",INVALID_TEAM_ID:"Team id contains a reserved character"});var w=e.i(61687);let U=(0,I.defineErrorCodes)({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"});var D=e.i(58735),C=e.i(29603),P=e.i(16166);function M(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function Y(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new P.BetterAuthError(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof P.BetterAuthError)throw t;throw new P.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(M(new URL(e).pathname)||"/")}catch{throw new P.BetterAuthError(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=M(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}let x={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*$/,F={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},H=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,k=["javascript:","data:","vbscript:"],V={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&function(e){let t;try{t=new URL(e)}catch{return!0}return!k.includes(t.protocol)}(e.data.url)&&"u">typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};var G=e.i(3601);let $=Symbol.for("better-auth:broadcast-channel");var W=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 j(e="better-auth.message"){return globalThis[$]||(globalThis[$]=new W(e)),globalThis[$]}let z=Symbol.for("better-auth:focus-manager");var q=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 K(){return globalThis[z]||(globalThis[z]=new q),globalThis[z]}let X=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)}}
1setOnline(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 Q(){return globalThis[X]||(globalThis[X]=new J),globalThis[X]}let Z=()=>Math.floor(Date.now()/1e3);var ee=e.i(67654);let et=ee.STORE_UNMOUNT_DELAY;function er(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function en(e,t){return(0,G.isJsonEqual)(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function eo(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 ei(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,n=".",o){if(!eo(r))return e(t,{},n,o);let i={...r};for(let r of Object.keys(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]]:eo(a)&&eo(i[r])?i[r]=e(a,i[r],(n?`${n}.`:"")+r.toString(),o):i[r]=a))}return i})(t,r,"",e),{})}let ea=ei();ei((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),ei((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0});var es=Object.defineProperty,el=Object.defineProperties,eu=Object.getOwnPropertyDescriptors,ec=Object.getOwnPropertySymbols,ed=Object.prototype.hasOwnProperty,eE=Object.prototype.propertyIsEnumerable,e_=(e,t,r)=>t in e?es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ef=(e,t)=>{for(var r in t||(t={}))ed.call(t,r)&&e_(e,r,t[r]);if(ec)for(var r of ec(t))eE.call(t,r)&&e_(e,r,t[r]);return e},eO=(e,t)=>el(e,eu(t)),eh=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)}},ep=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}},eT=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}},eR=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)}},eA=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},em=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function eg(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 eI(e){try{return JSON.parse(e)}catch(t){return e}}function eS(e){return"function"==typeof e}function eN(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((e,r)=>{t[r]=e});else for(let[e,n]of Array.isArray(r)?r:Object.entries(r))null!=n&&(t[e]=n);return t}async function eb(e){let t=new Headers(eN(null==e?void 0:e.headers,await eA(e)));if(!t.has("content-type")){let r=eg(null==e?void 0:e.body)?"application/json":null;r&&t.set("content-type",r)}return t}
1var ev=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function ey(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new ev(r.issues);return r.value}var eL=["get","post","put","patch","delete"],ew=async(e,t)=>{var r,n,o,i,a,s,l,u;let c,{hooks:d,url:E,options:_}=await ep(e,t),f=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&eS(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&eS(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(_),O=new AbortController,h=null!=(r=_.signal)?r:O.signal,p=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];eL.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)}}let u=new Map;if(n)if(Array.isArray(n))for(let[e,t]of a.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];u.set(t,String(r))}else for(let[e,t]of Object.entries(n))u.set(`:${e}`,String(t));a=(a=a.split("/").map(e=>(function(e,t){let r,n=e;for(let[e,r]of t)n=n.replace(e,r);if("."===(r=n)||".."===r)throw TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(n)})(e,u)).join("/")).replace(/^\/+/,"");let c=l.toString();return(c=c.length>0?`?${c}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${a}${c}`,i):`${i}${a}${c}`}(E,_),T=await eb(_),R=function(e,t){let r,{body:n}=e;return n?eg(n)&&"string"!=typeof n?"application/x-www-form-urlencoded"===((r=t.get("content-type"))?r.split(";")[0].trim().toLowerCase():null)?new URLSearchParams(n).toString():JSON.stringify(n):n:null}(_,T),A=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 eL.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(E,_),m=eO(ef({},_),{url:p,headers:T,body:R,method:A,signal:h});for(let e of d.onRequest)if(e){let t=await e(m);"object"==typeof t&&null!==t&&Object.assign(m,t)}("pipeTo"in m&&"function"==typeof m.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pipe))&&!("duplex"in m)&&(m.duplex="half");let{clearTimeout:g}=(!(null==_?void 0:_.signal)&&(null==_?void 0:_.timeout)&&(c=setTimeout(()=>null==O?void 0:O.abort(),null==_?void 0:_.timeout)),{abortTimeout:c,clearTimeout:()=>{c&&clearTimeout(c)}}),I=await f(m.url,m);g();let S={response:I,request:m};for(let e of d.onResponse)if(e){let r=await e(eO(ef({},S),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?I.clone():I}));r instanceof Response?I=r:"object"==typeof r&&null!==r&&(I=r.response)}if(I.ok){if("HEAD"===m.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 em.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}(I),r={data:null,response:I,request:m};if("json"===e||"text"===e){let e=await I.text(),t=null!=(i=m.jsonParser)?i:eI;r.data=await t(e)}else r.data=await I[e]();for(let e of((null==m?void 0:m.output)&&m.output&&!m.disableValidation&&(r.data=await ey(m.output,r.data)),d.onSuccess))e&&await e(eO(ef({},r),{response:(null==(a=null==t?void 0:t.hookOptions)?void 0:a.cloneResponse)?I.clone():I}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let N=null!=(s=null==t?void 0:t.jsonParser)?s:eI,b=await I.text(),v=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(b),y=v?await N(b):null,L={response:I,responseText:b,request:m,error:eO(ef({},y),{status:I.status,statusText:I.statusText})};for(let e of d.onError)e&&await e(eO(ef({},L),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?I.clone():I}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new eT({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new eT(e);case"exponential":return new eR(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;
1if(await r.shouldAttemptRetry(n,I)){for(let e of d.onRetry)e&&await e(S);let o=r.getDelay(n);return await new Promise(e=>setTimeout(e,o)),await ew(e,eO(ef({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new eh(I.status,I.statusText,v?y:b);return{data:null,error:eO(ef({},y),{status:I.status,statusText:I.statusText})}};let eU=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,eD=/['\u2019]/g;function eC(e){return(e.replace(eD,"").match(eU)??[]).map(e=>e.toLowerCase()).join("-")}var eP=e.i(2593),eM=e.i(10957);let eY={host:window.location.hostname,proto:window.location.protocol.replace(":","")},ex=(0,l.createPhoneOtpProtectedFetch)((...e)=>fetch(...e),u.requestBrowserPhoneOtpChallenge),eB=function(e){var t;let{pluginPathMethods:r,pluginsActions:n,pluginsAtoms:o,hydrateSession:i,$fetch:a,$store:s,atomListeners:l}=(e=>{var t;let r,n,o,i,a,s,l,u,c,d="credentials"in Request.prototype,E=function(e,t,r,n){if(e)return Y(e,t);if(!1!==n){let e=C.env.BETTER_AUTH_URL||C.env.NEXT_PUBLIC_BETTER_AUTH_URL||C.env.PUBLIC_BETTER_AUTH_URL||C.env.NUXT_PUBLIC_BETTER_AUTH_URL||C.env.NUXT_PUBLIC_AUTH_URL||("/"!==C.env.BASE_URL?C.env.BASE_URL:void 0);if(e)return Y(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 P.BetterAuthError("Could not get origin from request. Please provide a valid base URL.");return Y(e,t)}if("u">typeof window&&window.location)return Y(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==D.default){if(D.default.env.NEXT_PUBLIC_AUTH_URL)return D.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(D.default.env.NEXTAUTH_URL)try{return D.default.env.NEXTAUTH_URL}catch{}if(D.default.env.VERCEL_URL)try{let t=D.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${D.default.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",_=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],f={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:O,onError:h,onRequest:p,onResponse:T,...R}=e?.fetchOptions||{},A=(t={baseURL:E,...d?{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(),s=a.toLowerCase();if(s.length<=9&&s in F)return F[s];if(!B.test(a)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(x).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=H.exec(e);if(!t)return null;let[,r,n,o,i,a,s,l,u,c,d]=t,E=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(d,10))*("+"===u?-1:1);E.setUTCMinutes(E.getUTCMinutes()+e)}return E instanceof Date&&!isNaN(E.getTime())?E: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,...R,plugins:[f,...R.plugins||[],...e?.disableDefaultFetchPlugins?[]:[V],..._]},async function(e,r){let n,o=eO(ef(ef({},t),r),{headers:eN(null==t?void 0:t.headers,null==r?void 0:r.headers),plugins:[...(null==t?void 0:t.plugins)||[],(n=t||{},{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,"")),r.startsWith("/")&&"@"===r.charAt(1)&&(r=r.substring(1));let n=s.schema[r];if(n){let r=null==t?void 0:t.headers;if(n.headers&&!(null==t?void 0:t.disableValidation)){let e={};if(null==t?void 0:t.headers){if(t.headers instanceof Headers)t.headers.forEac
1h((t,r)=>{e[r.toLowerCase()]=t});else if("object"==typeof t.headers)for(let[r,n]of Object.entries(t.headers))null!=n&&(e[r.toLowerCase()]=n)}let o=await ey(n.headers,e),i={};for(let[e,t]of Object.entries(o))i[e.toLowerCase()]=t;r=i}let o=eO(ef({},t),{method:n.method,output:n.output,headers:r});return(null==t?void 0:t.disableValidation)||(o=eO(ef({},o),{body:n.input?await ey(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await ey(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await ey(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:o}}}return{url:e,options:t}}}),...(null==r?void 0:r.plugins)||[]]});if(null==t?void 0:t.catchAllError)try{return await ew(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 ew(e,o)}),{$sessionSignal:m,session:g,broadcastSessionUpdate:I}=(n=(0,w.atom)(!1),o=0,i=0,n.listen(()=>{i++,o=0}),a=e=>u(e),s=(0,w.atom)({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a}),(0,G.withEquality)(s,en),l=async(e,t)=>{let r=s.value;if(s.set({...r,isPending:null===r.data,isRefetching:!0,error:null,refetch:a}),e.aborted)return"aborted";try{var n;let r=await A("/get-session",{method:"GET",query:t?.query,signal:e});if(e.aborted)return"aborted";let{data:o,error:i}=er(r),l="fresh";if(o?.needsRefresh)try{let t=await A("/get-session",{method:"POST",signal:e});if(e.aborted)return"aborted";({data:o,error:i}=er(t))}catch{if(e.aborted)return"aborted";l="stale"}if(i){let e=s.value,t=i?.status===401;return s.set({data:t?null:e.data,error:i,isPending:!1,isRefetching:!1,refetch:a}),"failed"}let u=(n=o)&&(null!==n.session||null!==n.user)?n:null,c=s.value,d=null!=c.data&&null!=u&&(0,G.isJsonEqual)(c.data,u)?c.data:u;return s.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:a}),l}catch(r){if(e.aborted)return"aborted";let t=s.value;return s.set({data:t.data,error:r,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},u=e=>{o=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?"aborted":l(t.signal,e)),revision:i};r=n;let a=e=>{if(r===n){let t,a;r=void 0,"fresh"===e&&n.revision===i&&(a=(t=s.value.data?.session?.expiresAt)instanceof Date?t.getTime():1/0,o=Math.min(Date.now()+et,a))}};return n.promise.then(a,()=>a("failed")),n.promise.then(()=>void 0)},c=()=>{},(0,ee.onMount)(s,()=>{let t;"u"<typeof window||(t=setTimeout(()=>{r?.revision===i?r.promise.then(()=>void 0):Date.now()<o?Promise.resolve():u()},0));let a=function(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,s=o.sessionOptions?.refetchWhenOffline??!1,l={isInitialized:!1,lastSessionRequest:0},u=e=>{if(s||Q().isOnline){if(e?.event==="storage")return void t();if(e?.event==="poll"){l.lastSessionRequest=Z(),t();return}if(e?.event==="visibilitychange"){if(Z()-l.lastSessionRequest<5)return;l.lastSessionRequest=Z(),t();return}t()}};return{init:()=>{l.isInitialized||(l.isInitialized=!0,i&&i>0&&(l.pollInterval=setInterval(()=>{r()&&u({event:"poll"})},1e3*i)),l.unsubscribeBroadcast=j().subscribe(()=>{u({event:"storage"})}),a&&(l.unsubscribeFocus=K().subscribe(()=>{u({event:"visibilitychange"})})),l.unsubscribeOnline=Q().subscribe(e=>{e&&u({event:"visibilitychange"})}),l.unsubscribeSignal=n.listen(()=>{t()}),l.cleanupBroadcastSetup=j().setup(),l.cleanupFocusSetup=K().setup(),l.cleanupOnlineSetup=Q().setup())},cleanup:()=>{l.isInitialized&&(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.unsubscribeSignal&&(l.unsubscribeSignal(),l.unsubscribeSignal=void 0),l.cleanupBroadcastSetup&&(l.cleanupBroadcastSetup(),l.cleanupBroadcastSetup=void 0),l.cleanupFocusSetup&&(l.cleanupFocusSetup(),l.cleanupFocusSetup=void 0),l.cleanupOnlineSetup&&(l.cleanupOnlineSetup(),l.cleanupOnlineSetup=void 0),l.isInitialized=!1,l.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:e=>{j().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({fetchSession:u,shouldPollSession:()=>null!=s.value.data,sessionSignal:n,options:e});return a.init(),c=a.broadcastSessionUpdate,()=>{t&&clearTimeout(t),a.cleanup()}}),{session:s,$sessionSignal:n,broadcastSessionUpdate:e=>c(e)}),S=!1,N=e?.plugins||[],b={},v={$sessionSignal:m,session:g}
1,y={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},L=[{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||"/revoke-other-sessions"===e||"/change-email"===e||"/change-password"===e,callback(e){"/sign-out"===e?I("signout"):("/update-user"===e||"/update-session"===e)&&I("updateUser")}}];for(let e of N)e.getAtoms&&Object.assign(v,e.getAtoms?.(A)),e.pathMethods&&Object.assign(y,e.pathMethods),e.atomListeners&&L.push(...e.atomListeners);let U={notify:e=>{v[e].set(!v[e].get())},listen:(e,t)=>{v[e].subscribe(t)},atoms:v};for(let t of N)t.getActions&&(b=ea(t.getActions?.(A,U,e)??{},b));return{get baseURL(){return E},pluginsActions:b,pluginsAtoms:v,pluginPathMethods:y,atomListeners:L,hydrateSession:e=>{S||null===e||(S=!0,function(e,t){if("u"<typeof window)return;let r=e.get();null===r.data&&null!==t&&e.set({...r,data:t,error:null,isPending:!1})}(g,e))},$fetch:A,$store:U}})(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 r=(0,eP.useRef)(e.get()),{keys:n,deps:o=[e,n]}=t,i=(0,eP.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),e.listen((e,r,i)=>{(void 0===i?n.some(t=>e[t]!==r[t]):t.has(i)||t.has(i.split(/\.|\[/)[0]))&&o(e)})}return e.listen(o)},o),a=()=>r.current;return(0,eP.useSyncExternalStore)(i,a,a)})(t);return t={...n,...u,hydrateSession:i,$fetch:a,$store:s},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,i)=>{let s="/"+n.map(eC).join("/"),u=i[0]||{},c=i[1]||{},{query:d,fetchOptions:E,..._}=u,f={...c,...E},O=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")}(s,r,u);return await a(s,{...f,body:"GET"===O?void 0:{..._,...f?.body||{}},query:d||f?.query,method:O,async onSuccess(e){if(await f?.onSuccess?.(e),!l||f.disableSignal)return;let t=l.filter(e=>e.matcher(s));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?.(s)}}})}})}()}({baseURL:(0,eM.resolveAuthBaseURL)(eY),fetchOptions:{credentials:"include",customFetchImpl:async(e,t)=>{let r=new Headers(t?.headers),n=(0,h.resolveRuntimeBrowserAuthLocale)({supportedLocales:(0,p.configuredLocales)()});return(0,h.applyAuthLocaleHeaders)(r,n),ex(e,{...t,headers:r})}},plugins:[(0,c.electronProxyClient)((0,f.buildDesktopAuthProxyOptions)()),{id:"additional-fields-client",version:T.PACKAGE_VERSION,$InferServerPlugin:{}},(s={ac:_.ac,roles:_.roles,schema:(O.organizationSchema,{})},t=(0,w.atom)(!1),r=(0,w.atom)(!1),n=(0,w.atom)(!1),o=(0,w.atom)(!1),i={admin:y.adminAc,member:y.memberAc,owner:y.ownerAc,...s?.roles},{id:"organization",version:T.PACKAGE_VERSION,$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:s?.ac,roles:i},permissions:e.permissions},t.options.roles||y.defaultRoles)}}}),getAtoms:e=>{let i=(0,v.useAuthQuery)(t,"/organization/list",e,{method:"GET"});return{$listOrg:t,$activeOrgSignal:r,$activeMemberSignal:n,$activeMemberRoleSignal:o,activeOrganization:(0,v.useAuthQuery)([r],"/organization/get-full-organization",e,()=>({method:"GET"})),listOrganizations:i,activeMember:(0,v.useAuthQuery)([r,n],"/organization/get-active-member",e,{method:"GET"}),activeMemberRole:(0,v.useAuthQuery)([r,o],"/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=>"/sign-out"===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:L}),(a={admin:A,user:m,...void 0},{id:"admin-client",version:T.PACKAGE_VERSION,$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:e=>(e=>
1{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||g;for(let n of t)if(r[n]?.authorize(e.permissions)?.success)return!0;return!1})({role:e.role,options:{ac:void 0,roles:a},permissions:e.permissions})}}),pathMethods:{"/admin/list-users":"GET","/admin/impersonate-user":"POST","/admin/stop-impersonating":"POST"},atomListeners:[{matcher:e=>"/admin/impersonate-user"===e||"/admin/stop-impersonating"===e,signal:"$sessionSignal"}],$ERROR_CODES:S}),{id:"anonymous",version:T.PACKAGE_VERSION,$InferServerPlugin:{},pathMethods:{"/sign-in/anonymous":"POST","/delete-anonymous-user":"POST"},atomListeners:[{matcher:e=>"/sign-in/anonymous"===e,signal:"$sessionSignal"}],$ERROR_CODES:N},{id:"email-otp",version:T.PACKAGE_VERSION,$InferServerPlugin:{},atomListeners:[{matcher:e=>"/email-otp/verify-email"===e||"/sign-in/email-otp"===e||"/email-otp/request-email-change"===e,signal:"$sessionSignal"}],$ERROR_CODES:b},{id:"magic-link",version:T.PACKAGE_VERSION,$InferServerPlugin:{}},{id:"phoneNumber",version:T.PACKAGE_VERSION,$InferServerPlugin:{},atomListeners:[{matcher:e=>"/phone-number/update"===e||"/phone-number/verify"===e||"/sign-in/phone-number"===e,signal:"$sessionSignal"}],$ERROR_CODES:U},(0,d.oauthProviderClient)(),(0,E.passkeyClient)()]}),{useSession:eF}=eB;e.s(["authClient",0,eB,"useSession",0,eF],35125)},66808,e=>{"use strict";e.s(["defineErrorCodes",0,function(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}])},82283,29603,29997,97800,e=>{"use strict";let t,r;var n=e.i(58735);let o=/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E\x5F\x60\x61-\x7A\x7C\x7E]+$/,i=/^[\x20\x21\x23-\x3A\x3C-\x5B\x5D-\x7E]*$/;function a(e){let t=0,r=e.length;for(;t<r;){let r=e.charCodeAt(t);if(32!==r&&9!==r)break;t++}for(;r>t;){let t=e.charCodeAt(r-1);if(32!==t&&9!==t)break;r--}return 0===t&&r===e.length?e:e.slice(t,r)}e.s(["electronProxyClient",0,e=>{var t;let r={clientID:"electron",cookiePrefix:"better-auth",callbackPath:"/auth/callback",...e},n=`${r.cookiePrefix}.${r.clientID}`,{scheme:s}="string"==typeof(t=r.protocol)?{scheme:t,privileges:{}}:{scheme:t.scheme,privileges:t.privileges||{}};return{id:"electron-proxy",version:"1.7.2",getActions:()=>{let e=()=>"u"<typeof document?null:(function(e){let t=new Map;if(e.length<2)return t;for(let n of e.split(";")){var r;let e=n.indexOf("=");if(-1===e)continue;let s=a(n.slice(0,e)),l=!((r=a(n.slice(e+1))).length<2)&&r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r;o.test(s)&&i.test(l)&&t.set(s,function(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}(l))}return t})(document.cookie).get(n)??null;return{electron:{getAuthorizationCode:e},ensureElectronRedirect:t=>{let o=t?.timeout||1e4,i=t?.interval||100,a=Date.now(),l=setInterval(()=>{let t;((t=e())&&(document.cookie=`${n}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`,window.location.replace(`${s}:/${r.callbackPath}#token=${t}`),1)||Date.now()-a>o)&&clearInterval(l)},i);return l}}},pathMethods:{"/electron/transfer-user":"POST"},$InferServerPlugin:{}}}],82283);let s="ba_param",l=Symbol.for("better-auth:global"),u=null,c={},d="1.7.2",E=Object.create(null),_=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?E:globalThis),f=new Proxy(E,{get:(e,t)=>_()[t]??E[t],has:(e,t)=>t in _()||t in E,set:(e,t,r)=>(_(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=_(!0);return delete r[t],!0},ownKeys:()=>Object.keys(_(!0))});function O(e,t){return void 0!==n.default&&n.default.env?n.default.env[e]??t:"u">typeof Deno?Deno.env.get(e)??t:"u">typeof Bun?Bun.env[e]??t:t}f.NODE_ENV,Object.freeze({get BETTER_AUTH_SECRET(){return O("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return O("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return O("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return O("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return O("NODE_ENV","development")},get PACKAGE_VERSION(){return O("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return O("BETTER_AUTH_TELEMETRY_ENDPOINT","")}}),e.s(["env",0,f,"getEnvVar",0,O],29603);let h={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},p=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),T=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],R="\x1b[0m",A="\x1b[31m",m="\x1b[32m",g="\x1b[33m",I="\x1b[34m",S="\x1b[35m",N=["debug","info","success","warn","error"],b={info:I,success:m,warn:g,error:A,debug:S},v=(t=(void 0)??"warn",r=1!==function(){if(void 0!==O("FORCE_COLOR"))switch(O("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==O("NODE_DISABLE_COLORS")&&""!==O("NODE_DISABLE_COLORS")||void 0!==O("NO_COLOR")&&""!==O("NO_COLOR")||"dumb"===O("TERM"))return 1;if(O("TMUX"))return 24;if("TF_BUILD"in f&&"AGENT_NAME"in f)return 4;if("CI"in f){for(let{0:e,1:t}of p)if(e in f)return t;return"codeship"===O("CI_NAME")?8:1}if("TEAMCITY_VERSION"in f)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(O("TEAMCITY_VERSION"))?4:1;switch(O("TERM_PROGRAM")){case"iTerm.app":if(!O("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(O("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===O("COLORTERM")||"24bit"===O("COLORTERM"))return 24;if(O("TERM")){if(null!==/truecolor/.exec(O("TERM")))return 24;if(null!==/^xterm-256/.exec(O("TERM")))return 8;let e=O("TERM").toLowerCase();if(h[e])return h[e];if(T.some(t=>null!==t.exec(e)))return 4}return O("COLORTERM")?4:1}(),{...Object.fromEntries(N.map(e=>[e,(...[n,...o])=>((e,n,o=[])=>{let i;if(!(N.indexOf(e)>=N.indexOf(t)))return;let a=(i=new Date().toISOString(),r?`\x1b[2m${i}${R} ${b[e]}${e.toUpperCase()}${R} \x1b[1m[Better Auth]:${R} ${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)])),get level(){return t}}),y=()=>{let e=(!globalThis[l]&&(globalThis[l]={version:d,epoch:1,context:c},u=globalThis[l]),(u=globalThis[l]).version!==d&&(u.version=d,u.epoch++),globalThis[l]).context.endpointContextAsyncStorage?.getStore()?.context.logger;return e&&e!==L?e:v},L={debug:(...e)=>y().debug(...e),info:(...e)=>y().info(...e),success:(...e)=>y().success(...e),warn:(...e)=>y().warn(...e),error:(...e)=>y().error(...e),get level(){return y().level}},w=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;function U(e){if("string"==typeof e&&w.test(e)){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}e.s(["PACKAGE_VERSION",0,"1.7.2"],29997),e.s(["oauthProviderClient",0,()=>({id:"oauth-provider-client",version:"1.7.2",fetchPlugins:[{id:"oauth-provider-signin",name:"oauth-provider-signin",de
1scription:"Adds the current page query to oauth requests",hooks:{async onRequest(e){let t=e.headers,r="string"==typeof e.body?"application/x-www-form-urlencoded"===t.get("content-type")?Object.fromEntries(new URLSearchParams(e.body)):function(e){try{if("string"!=typeof e){if(null==e)return null;return function e(t){if(null==t)return t;if("string"==typeof t)return U(t);if(t instanceof Date)return t;if(Array.isArray(t))return t.map(e);if("object"==typeof t){let r={};for(let n of Object.keys(t))r[n]=e(t[n]);return r}return t}(e)}return JSON.parse(e,(e,t)=>U(t))}catch(e){return L.error("Error parsing JSON",{error:e}),null}}(e.body??"{}"):e.body;!r?.oauth_query&&"u">typeof window&&window?.location?.search&&"GET"!==e.method&&"DELETE"!==e.method&&(e.body=JSON.stringify({...r,oauth_query:function(e){let t=new URLSearchParams(e);if(!t.has("sig"))return;let r=function(e){let t=e.getAll(s);if(t.length)return new Set(t)}(t);if(!r)return;let n=new URLSearchParams;for(let[e,o]of t.entries())("sig"===e||e===s||r.has(e))&&n.append(e,o);return n.toString()}(window.location.search)}))}}}],$InferServerPlugin:{}})],97800)},13389,67654,3601,61687,48197,e=>{"use strict";let t=(0,e.i(66808).defineErrorCodes)({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",USER_NOT_FOUND:"User not found",FAILED_TO_UPDATE_PASSKEY:"Failed to update passkey",PREVIOUSLY_REGISTERED:"Previously registered",REGISTRATION_CANCELLED:"Registration cancelled",AUTH_CANCELLED:"Auth cancelled",UNKNOWN_ERROR:"Unknown error",SESSION_REQUIRED:"Passkey registration requires an authenticated session",RESOLVE_USER_REQUIRED:"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false",RESOLVED_USER_INVALID:"Resolved user is invalid"});function r(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 n(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 i.stubThis(globalThis?.PublicKeyCredential!==void 0&&"function"==typeof globalThis.PublicKeyCredential)}let i={stubThis:e=>e};function a(e){let{id:t}=e;return{...e,id:n(t),transports:e.transports}}function s(e){return"localhost"===e||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class l 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 u=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}}},c=["cross-platform","platform"];function d(e){if(e&&!(0>c.indexOf(e)))return e}async function E(e){let t,i,c,E,f;!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:O,useAutoRegister:h=!1}=e;if(!o())throw Error("WebAuthn is not supported in this browser");let p={...O,challenge:n(O.challenge),user:{...O.user,id:n(O.user.id)},excludeCredentials:O.excludeCredentials?.map(a)},T={};h&&(T.mediation="conditional"),T.publicKey=p,T.signal=u.createNewAbortSignal();try{t=await navigator.credentials.create(T)}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 l({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 l({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 l({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 l({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 l({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new l({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new l(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(!s(t))return new l({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rp.id!==t)return new l({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 l({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 l({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:T})}if(!t)throw Error("Registration was not completed");let{id:R,rawId:A,response:m,type:g}=t;if("function"==typeof m.getTransports&&(c=m.getTransports()),"function"==typeof m.getPublicKeyAlgorithm)try{E=m.getPublicKeyAlgorithm()}catch(e){_("getPublicKeyAlgorithm()",e)}if("function"==typeof m.getPublicKey)try{let e=m.getPublicKey();null!==e&&(f=r(e))}catch(e){_("getPublicKey()",e)}if("function"==typeof m.getAuthenticatorData)try{i=r(m.getAuthenticatorData())}catch(e){_("getAuthenticatorData()",e)}return{id:R,rawId:r(A),response:{attestationObject:r(m.attestationObject),clientDataJSON:r(m.clientDataJSON),transports:c,publicKeyAlgorithm:E,publicKey:f,authenticatorData:i},type:g,clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:d(t.authenticatorAttachment)}}function _(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 f=e=>e;async function O(e){let t,i,c;!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:E,useBrowserAutofill:_=!1,verifyBrowserAutofillInput:O=!0}=e;if(!o())throw Error("WebAuthn is not supported in this browser");E.allowCredentials?.length!==0&&(t=E.allowCredentials?.map(a));let h={...E,challenge:n(E.challenge),allowCredentials:t},p={};if(_){if(!await function(){if(!o())return f(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?f(new Promise(e=>e(!1))):f(e.isConditionalMediationAvailable())}())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&O)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');p.mediation="conditional",h.allowCredentials=[]}p.publicKey=h,p.signal=u.createNewAbortSignal();try{i=await navigator.credentials.get(p)}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 l({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new l({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!s(t))return new l({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new l({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 l({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:p})}if(!i)throw Error("Authentication was not completed");let{id:T,rawId:R,response:A,type:m}=i;return A.userHandle&&(c=r(A.userHandle)),{id:T,rawId:r(R),response:{authenticatorData:r(A.authenticatorData),clientDataJSON:r(A.clientDataJSON),signature:r(A.signature),userHandle:c},type:m,clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:d(i.authenticatorAttachment)}}let h=(e,t,r,n)=>(e.events=e.events||{},e.events[r+10]||(e.events[r+10]=n(t=>{e.events[r].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let n=e.events[r],o=n.indexOf(t);n.splice(o,1),n.length||(delete e.events[r],e.events[r+10](),delete e.events[r+10])}),p=(e,t)=>h(e,t,2,t=>{let r=e.set,n=e.setKey;return e.setKey&&(e.setKey=(r,o)=>{let i;if(t({abort:()=>{i=!0},changed:r,newValue:{...e.value,[r]:o}}),!i)return n(r,o)}),e.set=e=>{let n;if(t({abort:()=>{n=!0},newValue:e}),!n)return r(e)},()=>{e.set=r,e.setKey=n}}),T=(e,t)=>
2h(e,r=>{let n=t(r);n&&e.events[6].push(n)},5,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}});function R(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function A(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!A(e[r],t[r]))return!1;return!0}if(R(e)&&R(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!(n in t)||!A(e[n],t[n]))return!1;return!0}return!1}function m(e,t){return p(e,({newValue:r,abort:n})=>{t(e.value,r)&&n()})}e.s(["STORE_UNMOUNT_DELAY",0,1e3,"onMount",0,T,"onSet",0,p],67654),e.s(["isJsonEqual",0,A,"withEquality",0,m],3601);let g=[],I=0,S=globalThis.nanostoresGlobal||={epoch:0},N=e=>{let t=[],r={get:()=>(r.lc||r.listen(()=>{})(),r.value),init:e,lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=I+4;t<g.length;)g[t]===e?g.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--r.lc||r.off())}),notify(e,n){S.epoch++;let o=!g.length;for(let o of t)g.push(o,r,e,n);o&&(()=>{for(I=0;I<g.length;I+=4)g[I](g[I+1].value,g[I+2],g[I+3]);g.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};function b(e,t){return A(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}e.s(["atom",0,N],61687);let v=(e,t,r,n)=>{let o=N({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>i(e)});T(o,()=>m(o,b));let 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){let t=o.get(),r=null!=t.data&&null!=e.data&&A(t.data,e.data)?t.data:e.data;o.set({data:r,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;if(r&&n<r)return;let i=401===e.error.status;o.set({error:e.error,data:i?null:o.get().data,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:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{i(void 0)})});e=Array.isArray(e)?e:[e];let a=!1,s=!1,l=!1,u=()=>{if(a){l=!0;return}a=!0,i().finally(()=>{a=!1;let e=l&&s;l=!1,e&&u()})};return T(o,()=>{let t;if("u"<typeof window)return;s=!0;let r=!1,n=e.map(e=>e.listen(()=>{r?i():(r=!0,clearTimeout(t),u())}));return t=setTimeout(()=>{r=!0,u()},0),()=>{for(let e of(s=!1,n))e();clearTimeout(t)}}),o};e.s(["useAuthQuery",0,v],48197),e.s(["passkeyClient",0,()=>{let e=N();return{id:"passkey",version:"1.7.2",$InferServerPlugin:{},getActions:(r,n)=>((e,{$listPasskeys:r,$store:n})=>({signIn:{passkey:async(o,i)=>{let a,s=await e("/passkey/generate-authenticate-options",{method:"GET",throw:!1});if(!s.data)return s;let u=s.data.extensions||o?.extensions?{...s.data.extensions||{},...o?.extensions||{}}:void 0;try{a=await O({optionsJSON:{...s.data,extensions:u},useBrowserAutofill:o?.autoFill})}catch(e){return{data:null,error:{code:e instanceof l?e.code:"AUTH_CANCELLED",message:t.AUTH_CANCELLED.message,status:400,statusText:"BAD_REQUEST"}}}try{let{clientExtensionResults:t,...s}=a,l=await e("/passkey/verify-authentication",{body:{response:s},...o?.fetchOptions,...i,method:"POST",throw:!1});if(r.set(Math.random()),n.notify("$sessionSignal"),o?.returnWebAuthnResponse)return{...l,webauthn:{response:a,clientExtensionResults:t}};return l}catch(e){return console.error("[Better Auth] Error verifying passkey",e),{data:null,error:{code:"AUTH_CANCELLED",message:t.AUTH_CANCELLED.message,status:400,statusText:"BAD_REQUEST"}}}}},passkey:{addPasskey:async(o,i)=>{let a=await e("/passkey/generate-register-options",{method:"GET",query:{...o?.authenticatorAttachment&&{authenticatorAttachment:o.authenticatorAttachment},...o?.name&&{name:o.name},...o?.context&&{context:o.context}},throw:!1});if(!a.data)return a;try{let t=a.data.extensions||o?.extensions?{...a.data.extensions||{},...o?.extensions||{}}:void 0,s=await E({optionsJSON:{...a.data,extensions:t},useAutoRegister:o?.useAutoRegister}),{clientExtensionResults:l,...u}=s,c=await e("/passkey/verify-registration",{...o?.fetchOptions,...i,body:{response:u,name:o?.name,...o?.createSession&&{createSession:!0}},method:"POST",throw:!1});if(!c.data)return c;if(r.set(Math.random()),c.data.session&&n.notify("$sessionSignal"),o?.returnWebAuthnResponse)return{...c,webauthn:{response:s,clientExtensionResults:l}};return c}catch(e){if(e instanceof l){if("ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"===e.code)return{data:null,error:{code:e.code,message:t.PREVIOUSLY_REGISTERED.message,status:400,statusText:"BAD_REQUEST"}};if("ERROR_CEREMONY_ABORTED"===e.code)return{data:null,error:{code:e.code,message:t.REGISTRATION_CANCELLED.message,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:t.UNKNOWN_ERROR.message,status:500,statusText:"INTERNAL_SERVER_ERROR"}}}}},$Infer:{}}))(r,{$listPasskeys:e,$store:n}),getAtoms:t=>({listPasskeys:v(e,"/passkey/list-user-passkeys",t,{method:"GET"}),$listPasskeys:e}),pathMethods:{"/passkey/register":"POST","/passkey/authenticate":"POST"},atomListeners:[{matcher:e=>
2"/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:t}}],13389)},76992,78739,e=>{"use strict";function t(e){if(!e)return null;let t=e.trim();if(!t)return null;let r=t.indexOf(",");r>=0&&(t=t.slice(0,r));let n=t.indexOf(";");return(n>=0&&(t=t.slice(0,n)),t=t.trim().toLowerCase())&&t.split(/[-_]/)[0]?.trim()||null}function r(e){let r=new Map;for(let n of e){let e=t(n);e&&(r.has(e)||r.set(e,n))}return r}function n(e,r){let n=t(e);return n?r.get(n)??null:null}function o(e,t){if(!e)return null;let o=r(t);if(0===o.size)return null;let i=e,a=i.indexOf("#");a>=0&&(i=i.slice(0,a));let s=i.indexOf("?");s>=0&&(i=i.slice(0,s));let l=i.split("/").filter(Boolean).map(e=>{try{return decodeURIComponent(e)}catch{return e}})[0];return l?n(l,o):null}function i(e){if(!e)return null;let t=e.trim();if(!t)return null;let r=t.indexOf(",");r>=0&&(t=t.slice(0,r));let n=t.indexOf(";");return(n>=0&&(t=t.slice(0,n)),t=t.trim().toLowerCase())&&t.split(/[-_]/)[0]?.trim()||null}e.s(["organizationSchema",0,{organization:{additionalFields:{type:{type:"string"},tenantPurpose:{type:"string"},systemOwned:{type:"boolean"}}}}],76992),e.s(["applyAuthLocaleHeaders",0,function(e,t){e.has("X-Locale")||e.set("X-Locale",t),e.has("Accept-Language")||e.set("Accept-Language",t)},"resolveRuntimeBrowserAuthLocale",0,function({cookieName:e="NEXT_LOCALE",fallback:a="en",supportedLocales:s}){let l=globalThis;return l.location&&l.document&&l.navigator?function({pathname:e,htmlLang:a,navigatorLanguages:s,navigatorLanguage:l,cookieLocale:u,supportedLocales:c,fallback:d="en"}){let E=o(e,c);if(E)return E;let _=function(e,t){let r=i(e);if(!r)return null;for(let e of t)if(i(e)===r)return e;return null}(u,c);return _||function({pathname:e,htmlLang:i,navigatorLanguages:a,navigatorLanguage:s,supportedLocales:l,fallback:u="en"}){let c=r(l),d=o(e,l);if(d)return d;let E=n(i,c);if(E)return E;let _=n(a?.[0],c);if(_)return _;let f=n(s,c);if(f)return f;let O=n(u,c);return O||t(u)||"en"}({pathname:null,htmlLang:a,navigatorLanguages:s,navigatorLanguage:l,supportedLocales:c,fallback:d})}({pathname:l.location.pathname,htmlLang:l.document.documentElement?.lang,navigatorLanguages:l.navigator.languages,navigatorLanguage:l.navigator.language,cookieLocale:function(e,t="NEXT_LOCALE"){if(!e)return null;for(let r of e.split(";")){let e=r.trim();if(!e)continue;let n=e.indexOf("=");if(n<=0||e.slice(0,n).trim()!==t)continue;let o=e.slice(n+1).trim();if(!o)break;try{return decodeURIComponent(o)}catch{return o}}return null}(l.document.cookie,e),supportedLocales:s,fallback:a}):a}],78739)},38983,16166,87951,39134,e=>{"use strict";(0,e.i(66808).defineErrorCodes)({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",CHANGE_EMAIL_DISABLED:"Change email is disabled",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_
2NAVIGATION_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 t={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 r,n,o=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",r,n={},o="number"==typeof e?e:t[e]){super(r?.message,r?.cause?{cause:r.cause}:void 0),this.status=e,this.body=r,this.headers=n,this.statusCode=o,this.name="APIError",this.status=e,this.headers=n,this.statusCode=o,this.body=r}};Symbol.for("better-call:api-error-headers"),r=o,n=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:()=>n,enumerable:!1,configurable:!0});var i=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};function a(e){return"OR"===e?"OR":"AND"}function s(e){return Array.isArray(e)}function l(e,t){return"string"==typeof t&&e.includes(t)}function u(e){return{newRole:e=>{var t;return{authorize(e,r="AND"){let n=!1;for(let[o,u]of Object.entries(e)){let e=t[o];if(!e){if("AND"===r)return{success:!1,error:`You are not allowed to access resource: ${o}`};continue}let c=function(e,{actions:t,connector:r}){return 0!==t.length&&("OR"===r?t.some(t=>l(e,t)):t.every(t=>l(e,t)))}(e,function(e){if(s(e))return{actions:e,connector:"AND"};if(!e||"object"!=typeof e)throw new i("Invalid access control request");let{actions:t,connector:r}=e;return s(t)?{actions:t,connector:a(r)}:{actions:[],connector:a(r)}}(u));if(c&&(n=!0),c&&"OR"===r)return{success:!0};if(!c&&"AND"===r)return{success:!1,error:`unauthorized to access resource "${o}"`}}return n?{success:!0}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}e.s(["BetterAuthError",0,i],16166),e.s(["createAccessControl",0,u],87951);let c={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}
2,d=u(c),E=d.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),_=d.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),f=d.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]});e.s(["adminAc",0,E,"defaultRoles",0,{admin:E,owner:_,member:f},"defaultStatements",0,c,"memberAc",0,f,"ownerAc",0,_],39134);let O=u({...c}),h=O.newRole({..._.statements,member:["create","update","delete"],invitation:["create","cancel"]}),p=O.newRole({...E.statements,member:["create","update","delete"],invitation:["create","cancel"]}),T=O.newRole({...f.statements}),R=O.newRole({...f.statements}),A=O.newRole({...f.statements,organization:["update"],member:["create","update"],invitation:["create","cancel"]}),m=O.newRole({...f.statements,invitation:["create","cancel"]}),g=O.newRole({...f.statements}),I=O.newRole({...f.statements}),S=O.newRole({});e.s(["ac",0,O,"roleKeysByAccountType",0,{personal:["owner"],business:["owner","admin","business_manager","facility_operator","member"],fleet:["owner","admin","fleet_manager","fleet_dispatcher","member","driver"],driver:["owner","driver"]},"roles",0,{owner:h,admin:p,member:T,operator:R,business_manager:g,facility_operator:I,fleet_manager:A,fleet_dispatcher:m,driver:S}],38983)},38646,96637,e=>{"use strict";let t;e.s(["PHONE_OTP_CHALLENGE_PATH",0,"/auth/phone-challenge","createPhoneOtpProtectedFetch",0,function(e,t){return async(r,n)=>{let o,i=new Request(r,n),a=i.clone(),s=await e(i),l=new URL(i.url).pathname.replace(/\/+$/,"");if("POST"!==i.method||403!==s.status||!["/auth/api/phone-number/send-otp","/auth/api/phone-number/request-password-reset","/auth/api/sign-in/phone-number"].includes(l))return s;let u=await s.clone().json().catch(()=>null);if(!u||"OTP_BOT_CHALLENGE_REQUIRED"!==u.code)return s;try{o=await t(new URL(i.url).origin,i.signal)}catch{return s}if(!o||i.signal.aborted)return s;let c=new Headers(a.headers);return c.set("X-Phone-OTP-Challenge",o),e(new Request(a,{headers:c}))}},"readPhoneOtpChallengeToken",0,function(e,t){if(!e||"object"!=typeof e||"maxmove-phone-challenge"!==Reflect.get(e,"type")||Reflect.get(e,"id")!==t)return null;let r=Reflect.get(e,"token");return"string"==typeof r&&r.length>0&&r.length<=2048?r:null}],38646),e.s(["registerPhoneOtpChallengeHandler",0,function(e){return t=e,()=>{t===e&&(t=void 0)}},"requestBrowserPhoneOtpChallenge",0,function(e,r){return t?.(e,r)??Promise.resolve(null)}],96637)},46230,92743,e=>{"use strict";let t=Object.freeze(["en",...Object.freeze(["de","tr","pl","ro","bg","uk","ru","ar","hr","sr-Latn","bs","lt","lv","et"])]);Object.freeze(["shared","web","auth","dashboard","admin","mobile-customer","mobile-driver","mobile-ops"]);let r=Object.freeze(t.slice().sort());e.s(["SOURCE_LOCALE",0,"en","configuredLocales",0,function(){return r}],92743),e.s([],46230)}]);

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.