PageSourceSearch

https://www.fixelo.com.uy/_next/static/chunks/40ut4m707-xyx.js?dpl=dpl_ut7iKm9QxVfy7uEBXJi4Q5bNu7nH

js fixelo.com.uy collected 2026-10-03 20:09:52 UTC 118,611 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,317211,841588,e=>{"use strict";let t,r,n,i,s;var o,a=e.i(768489),c=e.i(84638),l=e.i(667900);let u=Object.create(null),d=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?u:globalThis),f=new Proxy(u,{get:(e,t)=>d()[t]??u[t],has:(e,t)=>t in d()||t in u,set:(e,t,r)=>(d(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=d(!0);return delete r[t],!0},ownKeys:()=>Object.keys(d(!0))});function p(e,t){return void 0!==l.default&&l.default.env?l.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 p("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return p("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return p("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return p("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return p("NODE_ENV","development")},get PACKAGE_VERSION(){return p("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return p("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});let h=Object.fromEntries(Object.entries({USER_NOT_FOUND:"User not found",FAILED_TO_CREATE_USER:"Failed to create user",FAILED_TO_CREATE_SESSION:"Failed to create session",FAILED_TO_UPDATE_USER:"Failed to update user",FAILED_TO_GET_SESSION:"Failed to get session",INVALID_PASSWORD:"Invalid password",INVALID_EMAIL:"Invalid email",INVALID_EMAIL_OR_PASSWORD:"Invalid email or password",INVALID_USER:"Invalid user",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",TOKEN_EXPIRED:"Token expired",ID_TOKEN_NOT_SUPPORTED:"id_token not supported",FAILED_TO_GET_USER_INFO:"Failed to get user info",USER_EMAIL_NOT_FOUND:"User email not found",EMAIL_NOT_VERIFIED:"Email not verified",PASSWORD_TOO_SHORT:"Password too short",PASSWORD_TOO_LONG:"Password too long",USER_ALREADY_EXISTS:"User already exists.",USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:"User already exists. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",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_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_
1NEW_USER_CALLBACK_URL:"Invalid newUserCallbackURL",MISSING_OR_NULL_ORIGIN:"Missing or null Origin",CALLBACK_URL_REQUIRED:"callbackURL is required",FAILED_TO_CREATE_VERIFICATION:"Unable to create verification",FIELD_NOT_ALLOWED:"Field not allowed to be set",ASYNC_VALIDATION_NOT_SUPPORTED:"Async validation is not supported",VALIDATION_ERROR:"Validation Error",MISSING_FIELD:"Field is required",METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:"POST method requires deferSessionRefresh to be enabled in session config",BODY_MUST_BE_AN_OBJECT:"Body must be an object",PASSWORD_ALREADY_SET:"User already has a password set"}).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}])),y={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 g=class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:y[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}},m=class extends g{constructor(e,t){super(400,{message:e,code:"VALIDATION_ERROR"}),this.message=e,this.issues=t,this.issues=t}},w=class extends Error{constructor(e){super(e),this.name="BetterCallError"}};let b=Symbol.for("better-call:api-error-headers"),E=function(e,t){class r extends e{#e;constructor(...e){if(function(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return void 0===e?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:void 0!==e.set}()){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}}return Object.defineProperty(r.prototype,"constructor",{get:()=>t,enumerable:!1,configurable:!0}),r}(g,Error);var A=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}},x=class e extends E{constructor(...e){super(...e)}static fromStatus(t,r){return new e(t,r)}static from(t,r){return new e(t,{message:r.message,code:r.code})}};function v(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t--;return t===e.length?e:e.slice(0,t)}function S(e,t="/api/auth"){try{let t=new URL(e);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new A(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){if(t instanceof A)throw t;throw new A(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}if(function(e){try{return"/"!==(v(new URL(e).pathname)||"/")}catch{throw new A(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e))return e;let r=v(e);return t&&"/"!==t?(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`):r}let T={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*:/},R=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,O={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},_=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,I=["javascript:","data:","vbscript:"],C={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!I.includes(t.protocol)}(e.data.url)&&"u">typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},k=(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],i=n.indexOf(t);n.splice(i,1),n.length||(delete e.events[r],e.events[r+10](),delete e.events[r+10])});function U(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function D(e,t){if(e===t)return!0;
1if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!D(e[r],t[r]))return!1;return!0}if(U(e)&&U(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)||!D(e[n],t[n]))return!1;return!0}return!1}let N=Symbol.for("better-auth:broadcast-channel");var L=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if("u">typeof window)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Math.floor(Date.now()/1e3)}))}catch{}}setup(){if("u"<typeof window||void 0===window.addEventListener)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??"{}");t?.event==="session"&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function H(e="better-auth.message"){return globalThis[N]||(globalThis[N]=new L(e)),globalThis[N]}let P=Symbol.for("better-auth:focus-manager");var j=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 M(){return globalThis[P]||(globalThis[P]=new j),globalThis[P]}let K=Symbol.for("better-auth:online-manager");var $=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 W(){return globalThis[K]||(globalThis[K]=new $),globalThis[K]}let B=()=>Math.floor(Date.now()/1e3),q=[],J=0,F=globalThis.nanostoresGlobal||={epoch:0},V=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=J+4;t<q.length;)q[t]===e?q.splice(t,4):t+=4;let n=t.indexOf(e);~n&&(t.splice(n,1),--r.lc||r.off())}),notify(e,n){F.epoch++;let i=!q.length;for(let i of t)q.push(i,r,e,n);i&&(()=>{for(J=0;J<q.length;J+=4)q[J](q[J+1].value,q[J+2],q[J+3]);q.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 G(e){return"object"==typeof e&&null!==e&&"data"in e&&"error"in e?e:{data:e,error:null}}function z(e,t){return D(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Y(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e))}function X(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,n=".",i){if(!Y(r))return e(t,{},n,i);let s={...r};for(let r of Object.keys(t)){if("__proto__"===r||"constructor"===r)continue;let o=t[r];null!=o&&(i&&i(s,r,o,n)||(Array.isArray(o)&&Array.isArray(s[r])?s[r]=[...o,...s[r]]:Y(o)&&Y(s[r])?s[r]=e(o,s[r],(n?`${n}.`:"")+r.toString(),i):s[r]=o))}return s})(t,r,"",e),{})}let Q=X();X((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),X((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0});var Z=Object.defineProperty,ee=Object.defineProperties,et=Object.getOwnPropertyDescriptors,er=Object.getOwnPropertySymbols,en=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable,es=(e,t,r)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eo=(e,t)=>{for(var r in t||(t={}))en.call(t,r)&&es(e,r,t[r]);if(er)for(var r of er(t))ei.call(t,r)&&es(e,r,t[r]);return e},ea=(e,t)=>
1ee(e,et(t)),ec=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)}},el=async(e,t)=>{var r,n,i,s,o,a;let c=t||{},l={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:c,hooks:l};for(let u of(null==t?void 0:t.plugins)||[]){if(u.init){let n=await (null==(r=u.init)?void 0:r.call(u,e.toString(),t));c=n.options||c,e=n.url}l.onRequest.push(null==(n=u.hooks)?void 0:n.onRequest),l.onResponse.push(null==(i=u.hooks)?void 0:i.onResponse),l.onSuccess.push(null==(s=u.hooks)?void 0:s.onSuccess),l.onError.push(null==(o=u.hooks)?void 0:o.onError),l.onRetry.push(null==(a=u.hooks)?void 0:a.onRetry)}return{url:e,options:c,hooks:l}},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(){return this.options.delay}},ed=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)}},ef=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,i]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!i)return t;t.authorization=`Basic ${btoa(`${n}:${i}`)}`}else if("Custom"===e.auth.type){let[n,i]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!i)return t;t.authorization=`${null!=n?n:""} ${i}`}}return t},ep=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function eh(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 ey(e){try{return JSON.parse(e)}catch(t){return e}}function eg(e){return"function"==typeof e}function em(...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 ew(e){let t=new Headers(em(null==e?void 0:e.headers,await ef(e)));if(!t.has("content-type")){let r=eh(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 eE(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new eb(r.issues);return r.value}var eA=["get","post","put","patch","delete"],ex=async(e,t)=>{var r,n,i,s,o,a,c,l;let u,{hooks:d,url:f,options:p}=await el(e,t),h=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("u">typeof globalThis&&eg(globalThis.fetch))return globalThis.fetch;if("u">typeof window&&eg(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(p),y=new AbortController,g=null!=(r=p.signal)?r:y.signal,m=function(e,t){let{baseURL:r,params:n,query:i}=t||{query:{},params:{},baseURL:""},s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];eA.includes(t)&&(e=e.replace(`@${t}/`,"/"))}s.endsWith("/")||(s+="/");let[o,a]=e.replace(s,"").split("?"),c=new URLSearchParams(a);for(let[e,t]of Object.entries(i||{})){let r;if(null!=t){if("string"==typeof t)r=t;else if(Array.isArray(t)){for(let r of t)c.append(e,r);continue}else r=JSON.stringify(t);c.set(e,r)}}let l=new Map;if(n)if(Array.isArray(n))for(let[e,t]of o.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];l.set(t,String(r))}else for(let[e,t]of Object.entries(n))l.set(`:${e}`,String(t));o=(o=o.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,l)).join("/")).replace(/^\/+/,"");let u=c.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",s.startsWith("http"))?new URL(`${o}${u}`,s):`${s}${o}${u}`}(f,p),w=await ew(p),b=function(e,t){let r,{body:n}=e;return n?eh(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}(p,w),E=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 eA.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(f,p),A=ea(eo({},p),{url:m,headers:w,body:b,method:E,signal:g});for(let e of d.onRequest)if(e){let t=await e(A);"object"==typeof t&&null!==t&&Object.assign(A,t)}("pipeTo"in A&&"function"==typeof A.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pi
1pe))&&!("duplex"in A)&&(A.duplex="half");let{clearTimeout:x}=(!(null==p?void 0:p.signal)&&(null==p?void 0:p.timeout)&&(u=setTimeout(()=>null==y?void 0:y.abort(),null==p?void 0:p.timeout)),{abortTimeout:u,clearTimeout:()=>{u&&clearTimeout(u)}}),v=await h(A.url,A);x();let S={response:v,request:A};for(let e of d.onResponse)if(e){let r=await e(ea(eo({},S),{response:(null==(i=null==t?void 0:t.hookOptions)?void 0:i.cloneResponse)?v.clone():v}));r instanceof Response?v=r:"object"==typeof r&&null!==r&&(v=r.response)}if(v.ok){if("HEAD"===A.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"}(v),r={data:null,response:v,request:A};if("json"===e||"text"===e){let e=await v.text(),t=null!=(s=A.jsonParser)?s:ey;r.data=await t(e)}else r.data=await v[e]();for(let e of((null==A?void 0:A.output)&&A.output&&!A.disableValidation&&(r.data=await eE(A.output,r.data)),d.onSuccess))e&&await e(ea(eo({},r),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?v.clone():v}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let T=null!=(a=null==t?void 0:t.jsonParser)?a:ey,R=await v.text(),O=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(R),_=O?await T(R):null,I={response:v,responseText:R,request:A,error:ea(eo({},_),{status:v.status,statusText:v.statusText})};for(let e of d.onError)e&&await e(ea(eo({},I),{response:(null==(c=null==t?void 0:t.hookOptions)?void 0:c.cloneResponse)?v.clone():v}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new eu({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new eu(e);case"exponential":return new ed(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(l=t.retryAttempt)?l:0;if(await r.shouldAttemptRetry(n,v)){for(let e of d.onRetry)e&&await e(S);let i=r.getDelay(n);return await new Promise(e=>setTimeout(e,i)),await ex(e,ea(eo({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new ec(v.status,v.statusText,O?_:R);return{data:null,error:ea(eo({},_),{status:v.status,statusText:v.statusText})}};let ev=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,eS=/['\u2019]/g;function eT(e){return(e.replace(eS,"").match(ev)??[]).map(e=>e.toLowerCase()).join("-")}e.i(927405),e.i(141019),e.i(126118),e.i(407659),e.i(350085),e.i(96742),e.i(233295),e.i(394632),e.i(807004);let eR=Symbol.for("better-auth:global"),eO=null,e_={},eI="1.6.25";function eC(){return globalThis[eR]||(globalThis[eR]={version:eI,epoch:1,context:e_},eO=globalThis[eR]),(eO=globalThis[eR]).version!==eI&&(eO.version=eI,eO.epoch++),globalThis[eR]}var ek=class{#t=void 0;run(e,t){let r=this.#t;this.#t=e;let n=t();return n instanceof Promise?n.finally(()=>{this.#t=r}):(this.#t=r,n)}getStore(){return this.#t}};let eU=Promise.resolve().then(()=>"AsyncLocalStorage"in globalThis?globalThis.AsyncLocalStorage:ek);async function eD(){let e=await eU;if(null!==e)return e;throw Error("getAsyncLocalStorage is only available in server code")}let eN=async()=>{let e=eC();if(!e.context.endpointContextAsyncStorage){let t=await eD();e.context.endpointContextAsyncStorage=new t}return e.context.endpointContextAsyncStorage};async function eL(e,t){return(await eN()).run(e,t)}function eH(e){return e instanceof E||e?.name==="APIError"}async function eP(e){try{return{data:await e,error:null}}catch(e){return{data:null,error:e}}}let ej=new Set(["host","user-agent","referer","from","expect","authorization","proxy-authorization","cookie","origin","accept-charset","accept-encoding","accept-language","if-match","if-none-match","if-modified-since","if-unmodified-since","if-range","range","max-forwards","connection","keep-alive","transfer-encoding","te","upgrade","trailer","proxy-connection","content-length"]);function eM(e){for(let t of ej)e.delete(t)}function eK(e,t){if(t)for(let[r,n]of new Headers(t).entries())"set-cookie"===r.toLowerCase()?e.append(r,n):e.set(r,n)}function e$(){let e="u">typeof globalThis&&globalThis.crypto;if(e&&"object"==typeof e.subtle&&null!=e.subtle)return e.subtle;throw Error("crypto.subtle must be defined")}let eW={name:"HMAC",hash:"SHA-256"},eB=async e=>{let t="string"==typeof e?new TextEncoder().encode(e):e;return await e$().importKey("raw",t,eW,!1,["sign","verify"])},eq=async(e,t,r)=>{try{let n=atob(e),i=new Uint8Array(n.length);for(let e=0,t=n.length;e<t;e++)i[e]=n.charCodeAt(e);return await e$().verify(eW,r,i,new TextEncoder().encode(t))}catch(e){return!1}},eJ=async(e,t)=>{let r=await eB(t);return btoa(String.fromCharCode(...new Uint8Array(await e$().sign(eW.name,r,new TextEncoder().encode(e)))))},eF=async(e,t)=>{let r=await eJ(e,t);return encodeURIComponent(e=`${e}.${r}`)},eV=(e,t)=>{let r=e;if(t)if("secure"===t)r="__Secure-"+e;else{if("host"!==t)return;r="__Host-"+e}return r},eG=(e,t,r={})=>{let n;if(n=r?.prefix==="secure"?`__Secure-${e}=${t}`:r?.prefix==="host"?`__Host-${e}=${t}`:`${e}=${t}`,e.startsWith("__Secure-")&&!r.secure&&(r.secure=!0),e.startsWith("__Host-")&&(r.secure||(r.secure=!0),"/"!==r.path&&(r.path="/"),r.domain&&(r.domain=void 0)),r&&"number"==typeof r.maxAge&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");n+=`; Max-Age=${Math.floor(r.maxAge)}`}if(r.domain&&"host"!==r.prefix&&(n+=`; Domain=${r.domain}`),r.path&&(n+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");n+=`; Expires=${r.expires.toUTCString()}`}return r.httpOnly&&(n+="; HttpOnly"),r.secure&&(n+="; Secure"),r.sameSite&&(n+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.partitioned&&(r.secure||(r.secure=!0),n+="; Partitioned"),n},ez=(e,t,r)=>eG(e,t=encodeURIComponent(t),r),eY=async(e,t,r,n)=>eG(e,t=await eF(t,r),n);async function eX(e,t={}){let r={body:t.body,query:t.query};if(e.body){let n=await e.body["~standard"].validate(t.body);if(n.issues)return{data:null,error:eQ(n.issues,"body")};r.body=n.value}if(e.query){let n=await e.query["~standard"].validate(t.query);if(n.issues)return{data:null,error:eQ(n.issues,"query")};r.query=n.value}return e.requireHeaders&&!t.headers?{data:null,error:{message:"Headers is required",issues:[]}}:e.requireRequest&&!t.request?{data:null,error:{message:"Request is required",issues:[]}}:{data:r,error:null}}function eQ(e,t){return{message:e.map(e=>`[${e.path?.length?`${t}.`+e.path.map(e=>"object"==typeof e?e.key:e).join("."):t}] ${e.message}`).join("; "),issues:e}}let eZ=async(e,{options:t,path:r})=>{var n;let i,s=new Headers,{data:o,error:a}=await eX(t,e);
1if(a)throw new m(a.message,a.issues);let c="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&((n=e.request)instanceof Request||"[object Request]"===Object.prototype.toString.call(n))?e.request.headers:null,l=c?.get("cookie"),u=l?function(e){if("string"!=typeof e)throw TypeError("argument str must be a string");let t=new Map,r=0;for(;r<e.length;){let n=e.indexOf("=",r);if(-1===n)break;let i=e.indexOf(";",r);if(-1===i)i=e.length;else if(i<n){r=e.lastIndexOf(";",n-1)+1;continue}let s=e.slice(r,n).trim();if(!t.has(s)){let r=e.slice(n+1,i).trim();34===r.codePointAt(0)&&(r=r.slice(1,-1)),t.set(s,function(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}(r))}r=i+1}return t}(l):void 0,d={...e,body:o.body,query:o.query,path:e.path||r||"virtual:",context:"context"in e&&e.context?e.context:{},returned:void 0,headers:e?.headers,request:e?.request,params:"params"in e?e.params:void 0,method:e.method??(Array.isArray(t.method)?t.method[0]:"*"===t.method?"GET":t.method),setHeader:(e,t)=>{s.set(e,t)},getHeader:e=>c?c.get(e):null,getCookie:(e,t)=>{let r=eV(e,t);return r&&u?.get(r)||null},getSignedCookie:async(e,t,r)=>{let n=eV(e,r);if(!n)return null;let i=u?.get(n);if(!i)return null;let s=i.lastIndexOf(".");if(s<1)return null;let o=i.substring(0,s),a=i.substring(s+1);return 44===a.length&&a.endsWith("=")?!!await eq(a,o,await eB(t))&&o:null},setCookie:(e,t,r)=>{let n=ez(e,t,r);return s.append("set-cookie",n),n},setSignedCookie:async(e,t,r,n)=>{let i=await eY(e,t,r,n);return s.append("set-cookie",i),i},redirect:e=>(s.set("location",e),new E("FOUND",void 0,s)),error:(e,t,r)=>new E(e,t,r),setStatus:e=>{i=e},json:(t,r)=>e.asResponse?{body:r?.body||t,routerResponse:r,_flag:"json"}:t,responseHeaders:s,get responseStatus(){return i}};for(let e of t.use||[]){let t=await e({...d,returnHeaders:!0,asResponse:!1});t.response&&Object.assign(d.context,t.response),t.headers&&t.headers.forEach((e,t)=>{d.responseHeaders.set(t,e)})}return d};function e0(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,s="function"==typeof t?t:r;if(("GET"===i.method||"HEAD"===i.method)&&i.body)throw new w("Body is not allowed with GET or HEAD methods");if(n&&/\/{2,}/.test(n))throw new w("Path cannot contain consecutive slashes");let o=async(...e)=>{let t=e[0]||{},{data:r,error:o}=await eP(eZ(t,{options:i,path:n}));if(o){if(!(o instanceof m))throw o;throw i.onValidationError&&await i.onValidationError({message:o.message,issues:o.issues}),new E(400,{message:o.message,code:"VALIDATION_ERROR"})}let a=await s(r).catch(async e=>{if(eH(e)){let r=i.onAPIError;if(r&&await r(e),t.asResponse)return e}throw e}),c=r.responseHeaders,l=r.responseStatus;return t.asResponse?function e(t,r){if(t instanceof Response){if(r?.headers){let e=new Headers(r.headers);eM(e),eK(t.headers,e)}return t}if(t&&"object"==typeof t&&"_flag"in t&&"json"===t._flag){let e=t.body,n=t.routerResponse;if(n instanceof Response)return n;let i=new Headers;if(eK(i,n?.headers),eK(i,t.headers),r?.headers){let e=new Headers(r.headers);eM(e),eK(i,e)}return i.set("Content-Type","application/json"),new Response(JSON.stringify(e),{...n,headers:i,status:t.status??r?.status??n?.status,statusText:r?.statusText??n?.statusText})}if(eH(t))return e(t.body,{status:r?.status??t.statusCode,statusText:t.status.toString(),headers:r?.headers||t.headers});let n=t,i=new Headers(r?.headers);if(eM(i),t){if("string"==typeof t)n=t,i.set("Content-Type","text/plain");else if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))n=t,i.set("Content-Type","application/octet-stream");else if(t instanceof Blob)n=t,i.set("Content-Type",t.type||"application/octet-stream");else if(t instanceof FormData)n=t;else if(t instanceof URLSearchParams)n=t,i.set("Content-Type","application/x-www-form-urlencoded");else if(t instanceof ReadableStream)n=t,i.set("Content-Type","application/octet-stream");else if(function(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))}(t)){let e,r,s;e=new WeakMap,r=new WeakMap,s=0,n=JSON.stringify(t,function(t,n){if("bigint"==typeof n)return n.toString();if("object"==typeof n&&null!==n){if(((t,r)=>{let n=r;for(;n;){if(n===t)return!0;n=e.get(n)}return!1})(n,this))return`[Circular ref-${r.get(n)}]`;e.set(n,this),r.has(n)||r.set(n,s++)}return n}),i.set("Content-Type","application/json")}}else null===t&&(n=JSON.stringify(null)),i.set("content-type","application/json");return new Response(n,{...r,headers:i})}(a,{headers:c,status:l}):t.returnHeaders?t.returnStatus?{headers:c,response:a,status:l}:{headers:c,response:a}:t.returnStatus?{response:a,status:l}:a};return o.options=i,o.path=n,o}function e1(e,t){let r=async r=>{let n="function"==typeof e?e:t,i=await eZ(r,{options:"function"==typeof e?{}:e,path:"/"});if(!n)throw Error("handler must be defined");try{let e=await n(i),t=i.responseHeaders;return r.returnHeaders?{headers:t,response:e}:e}
1catch(e){throw eH(e)&&Object.defineProperty(e,b,{enumerable:!1,configurable:!0,get:()=>i.responseHeaders}),e}};return r.options="function"==typeof e?{}:e,r}e0.create=e=>(t,r,n)=>e0(t,{...r,use:[...r?.use||[],...e?.use||[]]},n),e1.create=e=>function(t,r){if("function"==typeof t)return e1({use:e?.use},t);if(!r)throw Error("Middleware handler is required");return e1({...t,method:"*",use:[...e?.use||[],...t.use||[]]},r)};var e2=e.i(703573);function e4(e){return e instanceof E||e instanceof x||e?.name==="APIError"}let e8=e1(async()=>({})),e6=e1.create({use:[e8,e1(async()=>({}))]}),e5=[e8];function e3(e,t,r){let n="string"==typeof e?e:void 0,i="object"==typeof t?t:e,s="function"==typeof t?t:r,o=async e=>{try{return await eL(e,()=>s(e))}catch(r){var t;throw t=e.responseHeaders,e4(r)&&t&&Object.defineProperty(r,b,{enumerable:!1,configurable:!0,value:t,writable:!1}),r}};return n?e0(n,{...i,use:[...i?.use||[],...e5]},o):e0({...i,use:[...i?.use||[],...e5]},o)}function e7(e,t=""){if("number"!=typeof e){let r=t&&`"${t}" `;throw TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw RangeError(`${r}expected integer >= 0, got ${e}`)}}function e9(e,t,r=""){let n=e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT,i=e?.length,s=void 0!==t;if(!n||s&&i!==t){let o=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${t}`:"")+", got "+(n?`length=${i}`:`type=${typeof e}`);if(!n)throw TypeError(o);throw RangeError(o)}return e}function te(e){if("function"!=typeof e||"function"!=typeof e.create)throw TypeError("Hash must wrapped by utils.createHasher");if(e7(e.outputLen),e7(e.blockLen),e.outputLen<1)throw Error('"outputLen" must be >= 1');if(e.blockLen<1)throw Error('"blockLen" must be >= 1')}function tt(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function tr(e,t){e9(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw RangeError('"digestInto() output" expected to be of length >='+r)}function tn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ti(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ts(e,t){return e<<32-t|e>>>t}e3.serverOnly=(e,t)=>e3({...e,metadata:{...e.metadata,SERVER_ONLY:!0}},t);class to{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(te(e),e9(t,void 0,"key"),this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),tn(n)}update(e){return tt(this),this.iHash.update(e),this}digestInto(e){tt(this),tr(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let ta=((r=(e,t,r)=>new to(e,t).update(r).digest()).create=(e,t)=>new to(e,t),r),tc=Uint8Array.of(0),tl=Uint8Array.of();class tu{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ti(this.buffer)}update(e){tt(this),e9(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(n-this.pos,i-s);if(o===n){let t=ti(e);for(;n<=i-s;
1s+=n)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){tt(this),tr(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,tn(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let e=s;e<n;e++)t[e]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);let o=ti(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen must be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){(e||=new this.constructor).set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let td=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),tf=Uint32Array.from([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]),tp=Uint32Array.from([0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]),th=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),ty=BigInt(0x100000000-1),tg=BigInt(32),tm=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),tw=new Uint32Array(64);class tb extends tu{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)tw[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=tw[e-15],r=tw[e-2],n=ts(t,7)^ts(t,18)^t>>>3,i=ts(r,17)^ts(r,19)^r>>>10;tw[e]=i+tw[e-7]+n+tw[e-16]|0}let{A:r,B:n,C:i,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var u,d,f,p;let t=l+(ts(o,6)^ts(o,11)^ts(o,25))+((u=o)&a^~u&c)+tm[e]+tw[e]|0,h=(ts(r,2)^ts(r,13)^ts(r,22))+((d=r)&(f=n)^d&(p=i)^f&p)|0;l=c,c=a,a=o,o=s+t|0,s=i,i=n,n=r,r=t+h|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,s,o,a,c,l)}roundClean(){tn(tw)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),tn(this.buffer)}}class tE extends tb{A=0|td[0];B=0|td[1];C=0|td[2];D=0|td[3];E=0|td[4];F=0|td[5];G=0|td[6];H=0|td[7];constructor(){super(32)}}let tA=function(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:o}=function(e,t=!1){return t?{h:Number(e&ty),l:Number(e>>tg&ty)}:{h:0|Number(e>>tg&ty),l:0|Number(e&ty)}}(e[s],t);[n[s],i[s]]=[r,o]}return[n,i]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0
1x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),tx=tA[0],tv=tA[1],tS=new Uint32Array(80),tT=new Uint32Array(80),tR=function(e,t={}){let r=(t,r)=>e(r).update(t).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}(()=>new tE,{oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,1])}),tO=new TextEncoder,t_=new TextDecoder,tI=new TextDecoder("utf-8",{fatal:!0});function tC(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function tk(e,t,r){if(t<0||t>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function tU(e){let t=Math.floor(e/0x100000000),r=new Uint8Array(8);return tk(r,t,0),tk(r,e%0x100000000,4),r}function tD(e){let t=new Uint8Array(4);return tk(t,e),t}function tN(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}let tL="The input to be decoded is not correctly encoded.";function tH(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:t_.decode(e),{alphabet:"base64url"})}catch(e){throw TypeError(tL,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=t_.decode(t)),t.includes("+")||t.includes("/"))throw TypeError(tL);t=t.replace(/-/g,"+").replace(/_/g,"/");try{var r=t;if(Uint8Array.fromBase64)return Uint8Array.fromBase64(r);let e=atob(r),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}catch{throw TypeError(tL)}}function tP(e){let t=e;return("string"==typeof t&&(t=tO.encode(t)),Uint8Array.prototype.toBase64)?t.toBase64({alphabet:"base64url",omitPadding:!0}):(function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return btoa(t.join(""))})(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function tj(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);if(null===t)return!0;let r=t;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return t===r}function tM(...e){let t=new Set;for(let r of e)if(r)for(let e of Object.keys(r)){if(t.has(e))return!1;t.add(e)}return!0}e.s(["decode",0,tH,"encode",0,tP],764531);let tK=e=>tj(e)&&"string"==typeof e.kty,t$=Symbol();function tW(e,t){if(e)throw TypeError(`${t} can only be called once`)}function tB(e,t,r){try{return tH(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}function tq(e,t,r){try{return tN(e)}catch{throw new r(`The ${t} is not a valid base64url string`)}}async function tJ(e,t){let r=`SHA-${e.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,t))}function tF(e,t,r){let n;try{n=JSON.parse(tI.decode(tH(e)))}catch{throw new t(r)}if(!tj(n))throw new t(r);return n}
1class tV extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class tG extends tV{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class tz extends tV{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.claim=r,this.reason=n,this.payload=t}}class tY extends tV{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class tX extends tV{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class tQ extends tV{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",t){super(e,t)}}class tZ extends tV{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}class t0 extends tV{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class t1 extends tV{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class t2 extends tV{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"}class t4 extends tV{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t)}}class t8 extends tV{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",t){super(e,t)}}let t6=(e,t="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);function t5(e,t){if(t&&!e.usages.includes(t))throw TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function t3(e,t){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function t7(e,t,r){let n=e.algorithm;if(n.name!==t.name)throw t6(t.name);if(t.hash&&n.hash?.name!==t.hash)throw t6(t.hash,"algorithm.hash");if(t.namedCurve&&n.namedCurve!==t.namedCurve)throw t6(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&n.length!==t.length)throw t6(t.length,"algorithm.length");t5(e,r)}function t9(e,t,...r){if(r.length>2){let t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}let re=(e,...t)=>t9("Key must be ",e,...t),rt=(e,t,...r)=>t9(`Key for the ${e} algorithm must be `,t,...r);function rr(e){if(!rn(e))throw Error("CryptoKey instance expected")}let rn=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},ri=e=>e?.[Symbol.toStringTag]==="KeyObject",rs=e=>rn(e)||ri(e),ro=e=>crypto.getRandomValues(new Uint8Array(e.cekBits>>3));function ra(e,t){let r=e.byteLength<<3;if(r!==t)throw new tZ(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)}function rc(e,t){if(t.length<<3!==e.ivBits)throw new tZ("Invalid Initialization Vector length")}async function rl(e,t,r){if(!(t instanceof Uint8Array))throw TypeError(re(t,"Uint8Array"));let n=e.cekBits>>1;return[await crypto.subtle.importKey("raw",t.subarray(n>>3),"AES-CBC",!1,[r]),await crypto.subtle.importKey("raw",t.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]),n]}async function ru(e,t,r){return new Uint8Array((await crypto.subtle.sign("HMAC",e,t)).slice(0,r>>3))}async function rd(e,t,r,n,i){let[s,o,a]=await rl(e,r,"encrypt"),c=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},s,t)),l=tC(i,n,c,tU(8*i.length));return{ciphertext:c,tag:await ru(o,l,a),iv:n}}async function rf(e,t){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),i=await crypto.subtle.sign(r,n,e);return crypto.subtle.verify(r,n,i,t)}async function rp(e,t,r,n,i,s){let o,a,[c,l,u]=await rl(e,t,"decrypt"),d=tC(s,n,r,tU(8*s.length)),f=await ru(l,d,u);try{o=await rf(i,f)}catch{}if(!o)throw new tQ;try{a=new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},c,r))}catch{}if(!a)throw new tQ;return a}
1async function rh(e,t,r,n,i){let s=r instanceof Uint8Array?await crypto.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(t7(r,e.subtle,"encrypt"),r),o=new Uint8Array(await crypto.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},s,t)),a=o.slice(-16);return{ciphertext:o.slice(0,-16),tag:a,iv:n}}async function ry(e,t,r,n,i,s){let o=t instanceof Uint8Array?await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["decrypt"]):(t7(t,e.subtle,"decrypt"),t);try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:s,iv:n,name:"AES-GCM",tagLength:128},o,tC(r,i)))}catch{throw new tQ}}async function rg(e,t,r,n,i){if(!rn(r)&&!(r instanceof Uint8Array))throw TypeError(re(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n)rc(e,n);else n=crypto.getRandomValues(new Uint8Array(e.ivBits>>3));return r instanceof Uint8Array&&ra(r,e.cekBits),e.cbc?rd(e,t,r,n,i):rh(e,t,r,n,i)}async function rm(e,t,r,n,i,s){if(!rn(t)&&!(t instanceof Uint8Array))throw TypeError(re(t,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new tZ("JWE Initialization Vector missing");if(!i)throw new tZ("JWE Authentication Tag missing");return rc(e,n),t instanceof Uint8Array&&ra(t,e.cekBits),e.cbc?rp(e,t,r,n,i,s):ry(e,t,r,n,i,s)}async function rw(e,t){if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new tX('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new tX('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let r=e.resolve?.({kty:t.kty,crv:t.crv})??e.subtle,n=!!(t.d||t.priv),i={...t};return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,t.ext??!n,t.key_ops??e.usages[+!!n])}let rb=e=>e[Symbol.toStringTag],rE={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function rA(e,r,n){let i=(t||=new WeakMap).get(e);return n&&(i?i[r]=n:t.set(e,{__proto__:null,[r]:n})),n??i?.[r]}let rx=async(e,t,r)=>rA(e,r.alg)??rA(e,r.alg,await rw(r,{...t,alg:r.alg}));async function rv(e,t,r){let n=function(e,t,r){let{alg:n,secret:i}=e,s="decrypt"===r||"sign"===r;if(i&&t instanceof Uint8Array)return[0,t];if(tK(t)){if(i?"oct"!==t.kty||"string"!=typeof t.k:!(s?"oct"!==t.kty&&("AKP"===t.kty&&"string"==typeof t.priv||"string"==typeof t.d):"oct"!==t.kty&&void 0===t.d&&void 0===t.priv))throw TypeError(i?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${s?"private":"public"} JWK`);return((e,t,r)=>{let{alg:n}=e;if(void 0!==t.use){let e="sign"===r||"verify"===r?"sig":"enc";if(t.use!==e)throw TypeError(`Invalid key for this operation, its "use" must be "${e}" when present`)}if(void 0!==t.alg&&t.alg!==n)throw TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(t.key_ops)){let n="encrypt"===r||"decrypt"===r?e.ops?.[+("encrypt"!==r)]:r;if(n&&!t.key_ops.includes(n))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}})(e,t,r),[3,t]}if(!rs(t))throw TypeError(i?rt(n,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):rt(n,t,"CryptoKey","KeyObject","JSON Web Key"));if(i){if("secret"!==t.type)throw TypeError(`${rb(t)} instances for symmetric algorithms must be of type "secret"`)}else{if("secret"===t.type)throw TypeError(`${rb(t)} instances for asymmetric algorithms must not be of type "secret"`);let e=s?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){let n="sign"===r?"signing":"verify"===r?"verifying":`${r.slice(0,-1)}tion`;throw TypeError(`${rb(t)} instances for asymmetric algorithm ${n} must be of type "${e}"`)}}return rn(t)?[1,t]:[2,t]}(e,t,r);switch(n[0]){case 0:case 1:return n[1];case 3:{let t=n[1];if(t.k)return tH(t.k);if(!Object.isFrozen(t)){let{key_ops:e}=t;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return rx(t,t,e)}case 2:{let t=n[1];if("secret"===t.type)return t.export();if("toCryptoKey"in t&&"function"==typeof t.toCryptoKey)return((e,t)=>{let r=rA(e,t.alg);if(r)return r;let n="public"===e.type,i=t.usages[+!n],{asymmetricKeyType:s}=e,o=rE[e.asymmetricKeyDetails?.namedCurve],a=t.resolve?.({crv:o,asymmetricKeyType:s})??t.subtle;return rA(e,t.alg,e.toCryptoKey(a,n,i))})(t,e);return rx(t,t.export({format:"jwk"}),e)}}}function rS(e){let t={__proto__:null};for(let r in e)t[r]={...e[r],alg:r};return t}let rT=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],rR=[[],["deriveBits"]],rO=[[],[]];function r_(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:`SHA-${e}`},usages:rT,ops:["wrapKey","unwrapKey"]}}function rI(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:({kty:e,crv:t,asymmetricKeyType:r})=>{if("X25519"===t||"x25519"===r)return{name:"X25519"};
1if("OKP"===e)throw new tX('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:t}},usages:rR,ops:[void 0,"deriveBits"]}}function rC(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:rO,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function rk(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:rO,ops:["deriveBits","deriveBits"]}}let rU=rS({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:rO,ops:["encrypt","decrypt"]},"RSA-OAEP":r_(1),"RSA-OAEP-256":r_(256),"RSA-OAEP-384":r_(384),"RSA-OAEP-512":r_(512),"ECDH-ES":rI(),"ECDH-ES+A128KW":rI(),"ECDH-ES+A192KW":rI(),"ECDH-ES+A256KW":rI(),A128KW:rC(128),A192KW:rC(192),A256KW:rC(256),A128GCMKW:rC(128,!0),A192GCMKW:rC(192,!0),A256GCMKW:rC(256,!0),"PBES2-HS256+A128KW":rk(),"PBES2-HS384+A192KW":rk(),"PBES2-HS512+A256KW":rk()}),rD=["encrypt","decrypt"];function rN(e,t=!1){return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:rO,ops:rD,cekBits:e,ivBits:t?128:96,cbc:t}}let rL=rS({A128GCM:rN(128),A192GCM:rN(192),A256GCM:rN(256),"A128CBC-HS256":rN(256,!0),"A192CBC-HS384":rN(384,!0),"A256CBC-HS512":rN(512,!0)});function rH(e,t){throw new tX(`Invalid or unsupported "${e}" (JWE ${t}) header value`)}function rP(e){return("string"==typeof e?rU[e]:void 0)??rH("alg","Algorithm")}function rj(e){return("string"==typeof e?rL[e]:void 0)??rH("enc","Encryption Algorithm")}function rM(e,t){if("ECDH"!==e.algorithm.name&&"X25519"!==e.algorithm.name)throw TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");t5(e,t)}async function rK(e,t,r){let n=rP(t).subtle,i=e instanceof Uint8Array?await crypto.subtle.importKey("raw",e,"AES-KW",!0,[r]):e;return t7(i,n,r),i}async function r$(e,t,r){let n=await rK(t,e,"wrapKey"),i=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",i,n,"AES-KW"))}async function rW(e,t,r){let n=await rK(t,e,"unwrapKey"),i=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",i))}function rB(e,t,r){t7(t,rP(e).subtle,r),t3(e,t)}async function rq(e,t,r,n){if(!(e instanceof Uint8Array)||e.length<8)throw new tZ("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||1!==Math.sign(r))throw new tZ("PBES2 Count Input must be a positive integer");let i=tC(tN(t),Uint8Array.of(0),e),s=parseInt(t.slice(13,16),10),o={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},a=await (n instanceof Uint8Array?crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits"]):(t7(n,rP(t).subtle,"deriveBits"),n));return new Uint8Array(await crypto.subtle.deriveBits(o,a,s))}function rJ(e){return tC(tD(e.length),e)}async function rF(e,t,r){let n=t>>3,i=Math.ceil(n/32),s=new Uint8Array(32*i);for(let t=1;t<=i;t++){let n=await tJ("sha256",tC(tD(t),e,r));s.set(n,(t-1)*32)}return s.slice(0,n)}async function rV(e,t,r,n,i=new Uint8Array,s=new Uint8Array){rM(e),rM(t,"deriveBits");let o=tC(rJ(tN(r)),rJ(i),rJ(s),tD(n));return rF(new Uint8Array(await crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,"X25519"===e.algorithm.name?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3)),n,o)}function rG(e){rr(e);let t=e.algorithm.namedCurve;if("P-256"!==t&&"P-384"!==t&&"P-521"!==t&&"X25519"!==e.algorithm.name)throw new tX("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function rz(e){if(void 0===e)throw new tZ("JWE Encrypted Key missing")}function rY(e){if(void 0!==e)throw new tZ("Encountered unexpected JWE Encrypted Key")}async function rX(e,t,r,n,i,s){let o=rP(e);if("dir"===e)return rY(n),r;switch(o.subtle.name){case"ECDH":{let s,a;if("ECDH-ES"===e&&rY(n),!tj(i.epk))throw new tZ('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');rG(r);let c=await rw(o,i.epk);if(void 0!==i.apu){if("string"!=typeof i.apu)throw new tZ('JOSE Header "apu" (Agreement PartyUInfo) invalid');s=tB(i.apu,"apu",tZ)}if(void 0!==i.apv){if("string"!=typeof i.apv)throw new tZ('JOSE Header "apv" (Agreement PartyVInfo) invalid');a=tB(i.apv,"apv",tZ)}let l=await rV(c,r,"ECDH-ES"===e?t.alg:e,"ECDH-ES"===e?t.cekBits:parseInt(e.slice(-5,-2),10),s,a);if("ECDH-ES"===e)return l;return rz(n),rW(e.slice(-6),l,n)}case"RSA-OAEP":return rz(n),rr(r),rB(e,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(rz(n),"number"!=typeof i.p2c)throw new tZ('JOSE Header "p2c" (PBES2 Count) missing or invalid');let t=s?.maxPBES2Count||1e4;if(i.p2c>t)throw new tZ('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof i.p2s)throw new tZ('JOSE Header "p2s" (PBES2 Salt) missing or invalid');
1let o=tB(i.p2s,"p2s",tZ),a=await rq(o,e,i.p2c,r);return rW(e.slice(-6),a,n)}case"AES-KW":return rz(n),rW(e,r,n);case"AES-GCM":{let t,s;if(rz(n),"string"!=typeof i.iv)throw new tZ('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof i.tag)throw new tZ('JOSE Header "tag" (Authentication Tag) missing or invalid');return t=tB(i.iv,"iv",tZ),s=tB(i.tag,"tag",tZ),rm(rj(e.slice(0,-2)),r,n,t,s,new Uint8Array)}}}async function rQ(e,t,r,n,i={}){let s,o,a,c=rP(e);if("dir"===e)return[r,void 0,void 0];switch(c.subtle.name){case"ECDH":{let l;rG(r);let{apu:u,apv:d}=i;l=i.epk?await rv(c,i.epk,"decrypt"):(await crypto.subtle.generateKey(r.algorithm,!0,["deriveBits"])).privateKey;let f=crypto.subtle,p=l;if(!p.extractable){if("function"!=typeof f.getPublicKey)throw TypeError('CryptoKey for "epk" must be extractable');p=await f.getPublicKey(l,[])}let{x:h,y,crv:g,kty:m}=await f.exportKey("jwk",p),w=await rV(r,l,"ECDH-ES"===e?t.alg:e,"ECDH-ES"===e?t.cekBits:parseInt(e.slice(-5,-2),10),u,d);if(o={epk:{x:h,crv:g,kty:m}},"EC"===m&&(o.epk.y=y),u&&(o.apu=tP(u)),d&&(o.apv=tP(d)),"ECDH-ES"===e){a=w;break}a=n||ro(t);let b=e.slice(-6);s=await r$(b,w,a);break}case"RSA-OAEP":a=n||ro(t),rr(r),rB(e,r,"encrypt"),s=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",r,a));break;case"PBKDF2":{a=n||ro(t);let{p2c:c=2048,p2s:l=crypto.getRandomValues(new Uint8Array(16))}=i,u=await rq(l,e,c,r);s=await r$(e.slice(-6),u,a),o={p2c:c,p2s:tP(l)};break}case"AES-KW":a=n||ro(t),s=await r$(e,r,a);break;case"AES-GCM":{a=n||ro(t);let{iv:c}=i,l=await rg(rj(e.slice(0,-2)),a,r,c,new Uint8Array);s=l.ciphertext,o={iv:tP(l.iv),tag:tP(l.tag)}}}return[a,s,o]}let rZ={__proto__:null,b64:!0},r0={__proto__:null};function r1(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}function r2(e,t){let{crit:r}=t??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function r4(e,t,r,n,i){if(void 0!==i.crit&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return[];if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s=void 0===r?t:{__proto__:null,...r,...t};for(let t of n.crit){if(!(t in s))throw new tX(`Extension Header Parameter "${t}" is not recognized`);if(!Object.hasOwn(i,t)||void 0===i[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(s[t]&&(!Object.hasOwn(n,t)||void 0===n[t]))throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return n.crit}function r8(e){if(void 0===globalThis[e])throw new tX(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}async function r6(e){r8("CompressionStream");let t=new CompressionStream("deflate-raw"),r=t.writable.getWriter();r.write(e).catch(()=>{}),r.close().catch(()=>{});let n=[],i=t.readable.getReader();for(;;){let{value:e,done:t}=await i.read();if(t)break;n.push(e)}return tC(...n)}async function r5(e,t){r8("DecompressionStream");let r=new DecompressionStream("deflate-raw"),n=r.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let i=[],s=0,o=r.readable.getReader();for(;;){let{value:e,done:r}=await o.read();if(r)break;if(i.push(e),s+=e.byteLength,t!==1/0&&s>t)throw new tZ("Decompressed plaintext exceeded the configured limit")}return tC(...i)}async function r3(e,t,r){let n,i,s,o,[a,c,,l]=t,[u,d,f,p,h,y,g,m,,w]=e,b=d,E=f;if(y&&("dir"===c||"ECDH-ES"===c))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${c}`);let A=rP(c),x=await rv("dir"===c?l:A,r,"encrypt"),[v,S,T]=await rQ(c,l,x,y,m);T&&(w?E=E?{...E,...T}:T:b=b?{...b,...T}:T),b?i=tN(n=tP(JSON.stringify(b))):(n="",i=new Uint8Array),h?.byteLength?(o=tP(h),s=tC(i,tN("."),tN(o))):s=i;let R=u;"DEF"===a.zip&&(R=await r6(R).catch(e=>{throw new tZ("Failed to compress plaintext",{cause:e})}));let{ciphertext:O,tag:_,iv:I}
1=await rg(l,R,v,g,s),C={ciphertext:tP(O)};return I&&(C.iv=tP(I)),_&&(C.tag=tP(_)),S&&(C.encrypted_key=tP(S)),o&&(C.aad=o),b&&(C.protected=n),p&&(C.unprotected=p),E&&(C.header=E),C}async function r7(e,t){return r3(e,function(e){let[,t,r,n,,,,,i]=e;if(!tM(t,r,n))throw new tZ("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let s={...t,...r,...n};if(r4(tZ,r0,i,t,s),void 0!==s.zip&&"DEF"!==s.zip)throw new tX('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==s.zip&&!t?.zip)throw new tZ('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:o,enc:a}=s;if("string"!=typeof o||!o)throw new tZ('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof a||!a)throw new tZ('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[s,o,a,rj(a)]}(e),t)}class r9{#r;#n;#i;#s;#o;#a;#c;#l;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("plaintext must be an instance of Uint8Array");this.#r=e}setKeyManagementParameters(e){return tW(this.#l,"setKeyManagementParameters"),this.#l=e,this}setProtectedHeader(e){return tW(this.#n,"setProtectedHeader"),this.#n=e,this}setSharedUnprotectedHeader(e){return tW(this.#i,"setSharedUnprotectedHeader"),this.#i=e,this}setUnprotectedHeader(e){return tW(this.#s,"setUnprotectedHeader"),this.#s=e,this}setAdditionalAuthenticatedData(e){return this.#o=e,this}setContentEncryptionKey(e){return tW(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return tW(this.#c,"setInitializationVector"),this.#c=e,this}async encrypt(e,t){if(!this.#n&&!this.#s&&!this.#i)throw new tZ("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");return r2(tZ,this.#n),r7([this.#r,this.#n,this.#s,this.#i,this.#o,this.#a,this.#c,this.#l,t?.crit,!!t&&t$ in t],e)}}class ne{#u;constructor(e){this.#u=new r9(e)}setContentEncryptionKey(e){return this.#u.setContentEncryptionKey(e),this}setInitializationVector(e){return this.#u.setInitializationVector(e),this}setProtectedHeader(e){return this.#u.setProtectedHeader(e),this}setKeyManagementParameters(e){return this.#u.setKeyManagementParameters(e),this}async encrypt(e,t){let r=await this.#u.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}}let nt=e=>Math.floor(e.getTime()/1e3),nr={s:1,m:60,h:3600,d:86400,w:604800,y:0x1e187e0},nn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,ni="check_failed";function ns(e){let t=nn.exec(e);if(!t||t[4]&&t[1])throw TypeError("Invalid time period format");let r=Math.round(parseFloat(t[2])*nr[t[3][0].toLowerCase()]);return"-"===t[1]||"ago"===t[4]?-r:r}function no(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}function na(e,t){return"number"==typeof e?no(t,e):e instanceof Date?no(t,nt(e)):nt(new Date)+ns(e)}let nc=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`;function nl(e,t,r=!1){let n=e[t];if(void 0!==n||r){if("number"!=typeof n)throw new tG(`"${t}
1" claim must be a number`,e,t,"invalid");return n}}function nu(e,t){throw new tG(`unexpected "${t}" claim value`,e,t,ni)}function nd(e,t,r={}){var n,i;let s;try{s=JSON.parse(tI.decode(t))}catch{}if(!tj(s))throw new t1("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o&&("string"!=typeof e.typ||nc(e.typ)!==nc(o)))throw new tG('unexpected "typ" JWT header value',s,"typ",ni);let{requiredClaims:a=[],issuer:c,subject:l,audience:u,maxTokenAge:d}=r,f=[...a];for(let e of(void 0!==d&&f.push("iat"),void 0!==u&&f.push("aud"),void 0!==l&&f.push("sub"),void 0!==c&&f.push("iss"),new Set(f.reverse())))if(!Object.hasOwn(s,e))throw new tG(`missing required "${e}" claim`,s,e,"missing");void 0===c||(Array.isArray(c)?c:[c]).includes(s.iss)||nu(s,"iss"),void 0!==l&&s.sub!==l&&nu(s,"sub"),void 0===u||(n=s.aud,i="string"==typeof u?[u]:u,"string"==typeof n?i.includes(n):!!Array.isArray(n)&&i.some(e=>n.includes(e)))||nu(s,"aud");let{clockTolerance:p}=r,h=0;if("string"==typeof p)h=ns(p);else if(void 0!==p){if("number"!=typeof p)throw TypeError("Invalid clockTolerance option type");h=p}no("clockTolerance option",h);let{currentDate:y}=r,g=no("currentDate option",nt(y||new Date)),m=nl(s,"iat",void 0!==d),w=nl(s,"nbf");if(void 0!==w&&w>g+h)throw new tG('"nbf" claim timestamp check failed',s,"nbf",ni);let b=nl(s,"exp");if(void 0!==b&&b<=g-h)throw new tz('"exp" claim timestamp check failed',s,"exp",ni);if(void 0!==d){let e=g-m;if(e-h>("number"==typeof d?d:ns(d)))throw new tz('"iat" claim timestamp check failed (too far in the past)',s,"iat",ni);if(e<0-h)throw new tG('"iat" claim timestamp check failed (it should be in the past)',s,"iat",ni)}return s}class nf{#d;constructor(e){if(!tj(e))throw TypeError("JWT Claims Set MUST be an object");this.#d=structuredClone(e)}data(){return tO.encode(JSON.stringify(this.#d))}get iss(){return this.#d.iss}set iss(e){this.#d.iss=e}get sub(){return this.#d.sub}set sub(e){this.#d.sub=e}get aud(){return this.#d.aud}set aud(e){this.#d.aud=e}set jti(e){this.#d.jti=e}set nbf(e){this.#d.nbf=na(e,"setNotBefore")}set exp(e){this.#d.exp=na(e,"setExpirationTime")}set iat(e){void 0===e?this.#d.iat=nt(new Date):"string"==typeof e?this.#d.iat=no("setIssuedAt",nt(new Date)+ns(e)):this.#d.iat=na(e,"setIssuedAt")}}class np{#a;#c;#l;#n;#f;#p;#h;#y;constructor(e={}){this.#y=new nf(e)}setIssuer(e){return this.#y.iss=e,this}setSubject(e){return this.#y.sub=e,this}setAudience(e){return this.#y.aud=e,this}setJti(e){return this.#y.jti=e,this}setNotBefore(e){return this.#y.nbf=e,this}setExpirationTime(e){return this.#y.exp=e,this}setIssuedAt(e){return this.#y.iat=e,this}setProtectedHeader(e){return tW(this.#n,"setProtectedHeader"),this.#n=e,this}setKeyManagementParameters(e){return tW(this.#l,"setKeyManagementParameters"),this.#l=e,this}setContentEncryptionKey(e){return tW(this.#a,"setContentEncryptionKey"),this.#a=e,this}setInitializationVector(e){return tW(this.#c,"setInitializationVector"),this.#c=e,this}replicateIssuerAsHeader(){return this.#f=!0,this}replicateSubjectAsHeader(){return this.#p=!0,this}replicateAudienceAsHeader(){return this.#h=!0,this}async encrypt(e,t){let r=new ne(this.#y.data());return this.#n&&(this.#f||this.#p||this.#h)&&(this.#n={...this.#n,iss:this.#f?this.#y.iss:void 0,sub:this.#p?this.#y.sub:void 0,aud:this.#h?this.#y.aud:void 0}),r.setProtectedHeader(this.#n),this.#c&&r.setInitializationVector(this.#c),this.#a&&r.setContentEncryptionKey(this.#a),this.#l&&r.setKeyManagementParameters(this.#l),r.encrypt(e,t)}}async function nh(e,t,r){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[r]):(t7(t,e.subtle,r),e.minRsaBits&&t3(e.alg,t),t)}async function ny(e,t,r){let n=await nh(e,t,"sign");return new Uint8Array(await crypto.subtle.sign(e.signing,n,r))}async function ng(e,t,r,n){let i=await nh(e,t,"verify");try{return await crypto.subtle.verify(e.signing,i,r,n)}catch{return!1}}let nm=[["verify"],["sign"]];function nw(e){let t={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:nm}}function nb(e,t){let r={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:r,signing:t?{...r,saltLength:t}:r,usages:nm,minRsaBits:2048}}function nE(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${t}`},usages:nm}}function nA(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:nm}}function nx(e){let t={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:t,signing:t,usages:nm}}let nv=rS({HS256:nw(256),HS384:nw(384),HS512:nw(512),RS256:nb(256),RS384:nb(384),RS512:nb(512),PS256:nb(256,32),PS384:nb(384,48),PS512:nb(512,64),ES256:nE("P-256",256),ES384:nE("P-384",384),ES512:nE("P-521",512),EdDSA:nA(),Ed25519:nA(),"ML-DSA-44":nx(44),"ML-DSA-65":nx(65),"ML-DSA-87":nx(87)});function nS(e){let t="string"==typeof e?nv[e]:void 0;if(!t)throw new tX(`alg ${e} is not supported either by JOSE or your javascript runtime`);return t}function nT(e){return e?.b64===!1&&Array.isArray(e.crit)&&e.crit.includes("b64")}async function nR(e,t){let r,n,i,s,{protectedHeader:o,unprotectedHeader:a}=e;if(!o&&!a)throw new t0("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!tM(o,a))throw new t0("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...o,...a};r2(t0,o);let l=r4(t0,rZ,e.crit,o,c),u=!0;if(l.includes("b64")&&"boolean"!=typeof(u=o.b64))throw new t0('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:d}=c;if("string"!=typeof d||!d)throw new t0('JWS "alg" (Algorithm) Header Parameter missing or invalid');let f=nS(d);if(u){let t=e.encoded??=[];t[0]??=tP(e.payload),t[1]??=tN(t[0]),r=t[0],n=t[1]}else n=e.payload,r="";o?s=tN(i=tP(JSON.stringify(o))):(i="",s=new Uint8Array);let p=tC(s,tN("."),n),h=await rv(f,t,"sign"),y={signature:tP(await ny(f,h,p)),payload:r};return o&&(y.protected=i),a&&(y.header=a),y}class nO{#d;#n;#s;constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this.#d=e}setProtectedHeader(e){return tW(this.#n,"setProtectedHeader"),this.#n=e,this}setUnprotectedHeader(e){return tW(this.#s,"setUnprotectedHeader"),this.#s=e,this}async sign(e,t){return nR({payload:this.#d,protectedHeader:this.#n,unprotectedHeader:this.#s,crit:t?.crit},e)}}class n_{#u;#n;constructor(e){this.#u=new nO(e)}setProtectedHeader(e){return this.#u.setProtectedHeader(e),this.#n=e,this}async sign(e,t){if(nT(this.#n))throw TypeError("use the flattened module for creating JWS with b64: false");let r=await this.#u.sign(e,t);return`${r.protected}.${r.payload}.${r.signature}`}}class nI{#n;#y;constructor(e={}){this.#y=new nf(e)}setIssuer(e){return this.#y.iss=e,this}setSubject(e){return this.#y.sub=e,this}setAudience(e){return this.#y.aud=e,this}setJti(e){return this.#y.jti=e,this}setNotBefore(e){return this.#y.nbf=e,this}setExpirationTime(e){return this.#y.exp=e,this}setIssuedAt(e){return this.#y.iat=e,this}setProtectedHeader(e){return this.#n=e,this}async sign(e,t){let r=new n_(this.#y.data());if(r.setProtectedHeader(this.#n),nT(this.#n))throw new t1("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}var nC=e.i(764531),nC=nC;async function nk(e){if(ri(e))if("secret"!==e.type)return e.export({format:"jwk"});
1else e=e.export();if(e instanceof Uint8Array)return{kty:"oct",k:tP(e)};if(!rn(e))throw TypeError(re(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:t,key_ops:r,alg:n,use:i,...s}=Object.fromEntries(Object.entries(await crypto.subtle.exportKey("jwk",e)).filter(([,e])=>void 0!==e));return"AKP"===s.kty&&(s.alg=n),s}let nU=(e,t)=>{if("string"!=typeof e||!e)throw new t2(`${t} missing or invalid`)};async function nD(e,t){let r,n;if(tK(e))r=e;else if(rs(e))r=await nk(e);else throw TypeError(re(e,"CryptoKey","KeyObject","JSON Web Key"));if("sha256"!==(t??="sha256")&&"sha384"!==t&&"sha512"!==t)throw TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');switch(r.kty){case"AKP":nU(r.alg,'"alg" (Algorithm) Parameter'),nU(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":nU(r.crv,'"crv" (Curve) Parameter'),nU(r.x,'"x" (X Coordinate) Parameter'),nU(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":nU(r.crv,'"crv" (Subtype of Key Pair) Parameter'),nU(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":nU(r.e,'"e" (Exponent) Parameter'),nU(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":nU(r.k,'"k" (Key Value) Parameter'),n={k:r.k,kty:r.kty};break;default:throw new tX('"kty" (Key Type) Parameter missing or unsupported')}let i=tN(JSON.stringify(n));return tP(await tJ(t,i))}async function nN(e,t,r,n){let i,s,o,[a,c,l]=r,[u,d,f,p,h]=t,{encrypted_key:y,header:g,unprotected:m}=e;if(void 0!==g||void 0!==m){if(!tM(u,g,m))throw new tZ("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");i={...u,...g,...m}}else i=u??{};if(r4(tZ,r0,l?.crit,u,i),void 0!==i.zip&&"DEF"!==i.zip)throw new tX('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(void 0!==i.zip&&!u?.zip)throw new tZ('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:w,enc:b}=i;if("string"!=typeof w||!w)throw new tZ("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof b||!b)throw new tZ("missing JWE Encryption Algorithm (enc) in JWE Header");if(a&&!a.has(w)||!a&&w.startsWith("PBES2"))throw new tY('"alg" (Algorithm) Header Parameter value not allowed');if(c&&!c.has(b))throw new tY('"enc" (Encryption Algorithm) Header Parameter value not allowed');let E=rj(b);void 0!==y&&(s=tB(y,"encrypted_key",tZ));let A=!1;"function"==typeof n&&(n=await n(u,e),A=!0);let x=rP(w),v=await rv("dir"===w?E:x,n,"decrypt");try{o=await rX(w,E,v,s,i,l)}catch(e){if(e instanceof TypeError||e instanceof tZ||e instanceof tX)throw e;o=ro(E)}let S=await rm(E,o,d,f,p,h);if("DEF"===i.zip){let e=l?.maxDecompressedLength??25e4;if(0===e)throw new tX('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(e!==1/0&&(!Number.isSafeInteger(e)||e<1))throw TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");S=await r5(S,e).catch(e=>{if(e instanceof tZ)throw e;throw new tZ("Failed to decompress plaintext",{cause:e})})}return[S,u,v,A]}async function nL(e,t,r){return nN(e,function(e){let t,{protected:r,ciphertext:n,iv:i,tag:s,aad:o}=e;r&&(t=tF(r,tZ,"JWE Protected Header is invalid"));let a=void 0!==r?tN(r):new Uint8Array;return[t,tB(n,"ciphertext",tZ),void 0!==i?tB(i,"iv",tZ):void 0,void 0!==s?tB(s,"tag",tZ):void 0,void 0!==o?tC(a,tN("."),tq(o,"aad",tZ)):a]}(e),t,r)}async function nH(e,t,r){if(e instanceof Uint8Array&&(e=t_.decode(e)),"string"!=typeof e)throw new tZ("Compact JWE must be a string or Uint8Array");let{0:n,1:i,2:s,3:o,4:a,length:c}=e.split(".");if(5!==c)throw new tZ("Invalid Compact JWE");return nL({ciphertext:o,iv:s||void 0,protected:n,tag:a||void 0,encrypted_key:i||void 0},t,r)}async function nP(e,t,r){let n=await nH(e,[r&&r1("keyManagementAlgorithms",r.keyManagementAlgorithms),r&&r1("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms),r],t),i=n[1],s=nd(i,n[0],r);if(void 0!==i.iss&&i.iss!==s.iss)throw new tG('replicated "iss" claim header parameter mismatch',s,"iss","mismatch");if(void 0!==i.sub&&i.sub!==s.sub)throw new tG('replicated "sub" claim header parameter mismatch',s,"sub","mismatch");if(void 0!==i.aud&&JSON.stringify(i.aud)!==JSON.stringify(s.aud))throw new tG('replicated "aud" claim header parameter mismatch',s,"aud","mismatch");let o={payload:s,protectedHeader:i};return"function"==typeof t?{...o,key:n[2]}:o}async function nj(e,t,r){let n,{protected:i,header:s,payload:o}=e,a={};
1if(i&&(a=tF(i,t0,"JWS Protected Header is invalid")),void 0!==s){if(!tM(a,s))throw new t0("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");n={...a,...s}}else n=a;let c=r4(t0,rZ,t[1],a,n),l=!0;if(c.includes("b64")&&"boolean"!=typeof(l=a.b64))throw new t0('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:u}=n;if("string"!=typeof u||!u)throw new t0('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(t[0]&&!t[0].has(u))throw new tY('"alg" (Algorithm) Header Parameter value not allowed');if(l){if("string"!=typeof o)throw new t0("JWS Payload must be a string")}else if("string"!=typeof o&&!(o instanceof Uint8Array))throw new t0("JWS Payload must be a string or an Uint8Array instance");let d=!1;"function"==typeof r&&(r=await r(a,e),d=!0);let f=nS(u),p=tC(void 0!==i?tN(i):new Uint8Array,tN("."),"string"==typeof o?l?t[2]??=tq(o,"payload",t0):tO.encode(o):o),h=tB(e.signature,"signature",t0),y=await rv(f,r,"verify");if(!await ng(f,y,h,p))throw new t8;return[l?tB(o,"payload",t0):"string"==typeof o?tO.encode(o):o,a,l,y,d]}async function nM(e,t,r){if(e instanceof Uint8Array&&(e=t_.decode(e)),"string"!=typeof e)throw new t0("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:s,length:o}=e.split(".");if(3!==o)throw new t0("Invalid Compact JWS");return nj({payload:i,protected:n,signature:s},t,r)}async function nK(e,t,r){let n=await nM(e,[r&&r1("algorithms",r.algorithms),r?.crit],t);if(!n[2])throw new t1("JWTs MUST NOT use unencoded payload");let i={payload:nd(n[1],n[0],r),protectedHeader:n[1]};return"function"==typeof t?{...i,key:n[3]}:i}async function n$(e,t,r=3600){return await new nI(e).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+r).sign(new TextEncoder().encode(t))}async function nW(e,t){try{return(await nK(e,new TextEncoder().encode(t))).payload}catch{return null}}
1let nB=new Uint8Array([66,101,116,116,101,114,65,117,116,104,46,106,115,32,71,101,110,101,114,97,116,101,100,32,69,110,99,114,121,112,116,105,111,110,32,75,101,121]),nq="A256CBC-HS512";function nJ(e,t){var r,n,i;return r=new TextEncoder().encode(e),n=new TextEncoder().encode(t),function(e,t,r,n=32){te(e),e7(n,"length"),e9(t,void 0,"prk");let i=e.outputLen;if(t.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let s=Math.ceil(n/i);void 0===r?r=tl:e9(r,void 0,"info");let o=new Uint8Array(s*i),a=ta.create(e,t),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let e=0;e<s;e++)tc[0]=e+1,c.update(0===e?tl:l).update(r).update(tc).digestInto(l),o.set(l,i*e),a._cloneInto(c);return a.destroy(),c.destroy(),tn(l,tc),o.slice(0,n)}(tR,(i=n,te(tR),void 0===i&&(i=new Uint8Array(tR.outputLen)),ta(tR,i,r)),nB,64)}function nF(e){if("string"==typeof e)return[{version:0,value:e}];let t=[];for(let[r,n]of e.keys)t.push({version:r,value:n});return e.legacySecret&&!t.some(t=>t.value===e.legacySecret)&&t.push({version:-1,value:e.legacySecret}),t}async function nV(e,t,r,n=3600){let i=nJ(function(e){if("string"==typeof e)return e;let t=e.keys.get(e.currentVersion);if(!t)throw Error(`Secret version ${e.currentVersion} not found in keys`);return t}(t),r),s=await nD({kty:"oct",k:nC.encode(i)},"sha256");return await new np(e).setProtectedHeader({alg:"dir",enc:nq,kid:s}).setIssuedAt().setExpirationTime((Date.now()/1e3|0)+n).setJti(crypto.randomUUID()).encrypt(i)}let nG={clockTolerance:15,keyManagementAlgorithms:["dir"],contentEncryptionAlgorithms:[nq,"A256GCM"]};async function nz(e,t,r){if(!e)return null;let n=!1;try{n=void 0!==function(e){let t;if("string"==typeof e){let r=e.split(".");(3===r.length||5===r.length)&&([t]=r)}else if("object"==typeof e&&e)if("protected"in e)t=e.protected;else throw TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if("string"!=typeof t||!t)throw TypeError(r);return tF(t,TypeError,r)}(e).kid}catch{return null}try{let n=nF(t),{payload:i}=await nP(e,async e=>{let t=e.kid;if(void 0!==t){for(let e of n){let n=nJ(e.value,r);if(t===await nD({kty:"oct",k:nC.encode(n)},"sha256"))return n}throw Error("no matching decryption secret")}return n.length,nJ(n[0].value,r)},nG);return i}catch{if(n)return null;let i=nF(t);if(i.length<=1)return null;for(let t=1;t<i.length;t++)try{let n=i[t],{payload:s}=await nP(e,nJ(n.value,r),nG);return s}catch{continue}return null}}function nY(e,t){if(!e||!t)return e;let r=Object.entries(t).filter(([,{returned:e}])=>!1===e).map(([e])=>e);return Object.entries(structuredClone(e)).filter(([e])=>!r.includes(e)).reduce((e,[t,r])=>({...e,[t]:r}),{})}let nX=new WeakMap;function nQ(e,t,r){let n=`${t}:${r}`;nX.has(e)||nX.set(e,new Map);let i=nX.get(e);if(i.has(n))return i.get(n);let s="output"===r?(e=>{let t=(e.plugins??[]).reduce((e,t)=>{let r=t.schema;if(!r)return e;for(let[t,n]of Object.entries(r))e[t]={fields:{...e[t]?.fields,...n.fields},modelName:n.modelName||t,disableMigrations:n.disableMigration??e[t]?.disableMigrations};return e},{}),r=e.rateLimit?.storage==="database",n={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",unique:!0,required:!0,fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",required:!0,fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",bigint:!0,required:!0,fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest",defaultValue:()=>Date.now()}}}},{user:i,session:s,account:o,verification:a,...c}=t,l={verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier",index:!0},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!0,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,defaultValue:()=>new Date,onUpdate:()=>
1new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"},...a?.fields,...e.verification?.additionalFields},order:4}},u={session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:"user",field:"id",onDelete:"cascade"},required:!0,index:!0},...s?.fields,...e.session?.additionalFields},order:2}};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name",sortable:!0},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email",sortable:!0},emailVerified:{type:"boolean",defaultValue:!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified",input:!1},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,onUpdate:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...i?.fields,...e.user?.additionalFields},order:1},...!e.secondaryStorage||e.session?.storeSessionInDatabase?u:{},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId",index:!0},accessToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,returned:!1,fieldName:e.account?.fields?.refreshTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,returned:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt",defaultValue:()=>new Date},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt",onUpdate:()=>new Date},...o?.fields,...e.account?.additionalFields},order:3},...!e.secondaryStorage||e.verification?.storeInDatabase?l:{},...c,...r?n:{}}})(e)[t]?.fields??{}:{},o="user"===t||"session"===t||"account"===t?e[t]?.additionalFields:void 0,a={...s,...o??{}};for(let r of e.plugins||[])r.schema&&r.schema[t]&&(a={...a,...r.schema[t].fields});return i.set(n,a),a}function nZ(e,t){return nY(t,nQ(e,"user","output"))}function n0(e,t){return nY(t,nQ(e,"session","output"))}let n1=(e,t="ms")=>new Date(Date.now()+("sec"===t?1e3*e:e));function n2(e){if(!e)return[];let t=[],r=0,n=0;for(;n<e.length;){if(","===e[n]){let i=n+1;for(;i<e.length&&" "===e[i];)i++;for(;i<e.length&&"="!==e[i]&&";"!==e[i]&&","!==e[i];)i++;if(i<e.length&&"="===e[i]){let i=e.slice(r,n).trim();for(i&&t.push(i),r=n+1;r<e.length&&" "===e[r];)r++;n=r;continue}}n++}let i=e.slice(r).trim();return i&&t.push(i),t}let n4=/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E\x5F\x60\x61-\x7A\x7C\x7E]+$/,n8=/^[\x20\x21\x23-\x3A\x3C-\x
15B\x5D-\x7E]*$/;function n6(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)}function n5(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 i=n6(n.slice(0,e)),s=!((r=n6(n.slice(e+1))).length<2)&&r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r;n4.test(i)&&n8.test(s)&&t.set(i,function(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch{return e}}(s))}return t}let n3={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},n7=new Map(Object.entries({APPVEYOR:8,BUILDKITE:8,CIRCLECI:24,DRONE:8,GITEA_ACTIONS:24,GITHUB_ACTIONS:24,GITLAB_CI:8,TRAVIS:8})),n9=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/],ie="\x1b[0m",it="\x1b[31m",ir="\x1b[32m",ii="\x1b[33m",is="\x1b[34m",io="\x1b[35m",ia=["debug","info","success","warn","error"],ic={info:is,success:ir,warn:ii,error:it,debug:io},il=(n=(void 0)??"warn",i=1!==function(){if(void 0!==p("FORCE_COLOR"))switch(p("FORCE_COLOR")){case"":case"1":case"true":return 4;case"2":return 8;case"3":return 24;default:return 1}if(void 0!==p("NODE_DISABLE_COLORS")&&""!==p("NODE_DISABLE_COLORS")||void 0!==p("NO_COLOR")&&""!==p("NO_COLOR")||"dumb"===p("TERM"))return 1;if(p("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 n7)if(e in f)return t;return"codeship"===p("CI_NAME")?8:1}if("TEAMCITY_VERSION"in f)return null!==/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(p("TEAMCITY_VERSION"))?4:1;switch(p("TERM_PROGRAM")){case"iTerm.app":if(!p("TERM_PROGRAM_VERSION")||null!==/^[0-2]\./.exec(p("TERM_PROGRAM_VERSION")))return 8;return 24;case"HyperTerm":case"MacTerm":return 24;case"Apple_Terminal":return 8}if("truecolor"===p("COLORTERM")||"24bit"===p("COLORTERM"))return 24;if(p("TERM")){if(null!==/truecolor/.exec(p("TERM")))return 24;if(null!==/^xterm-256/.exec(p("TERM")))return 8;let e=p("TERM").toLowerCase();if(n3[e])return n3[e];if(n9.some(t=>null!==t.exec(e)))return 4}return p("COLORTERM")?4:1}(),{...Object.fromEntries(ia.map(e=>[e,(...[t,...r])=>((e,t,r=[])=>{let s;if(!(ia.indexOf(e)>=ia.indexOf(n)))return;let o=(s=new Date().toISOString(),i?`\x1b[2m${s}${ie} ${ic[e]}${e.toUpperCase()}${ie} \x1b[1m[Better Auth]:${ie} ${t}`:`${s} ${e.toUpperCase()} [Better Auth]: ${t}`);"error"===e?console.error(o,...r):"warn"===e?console.warn(o,...r):console.log(o,...r)})(e,t,r)])),get level(){return n}}),iu=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;function id(e){if("string"==typeof e&&iu.test(e)){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}function ip(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 id(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)=>id(t))}catch(e){return il.error("Error parsing JSON",{error:e}),null}}var ih=e.i(946056),ih=ih;let iy=e=>(t,r,n)=>{let i=function(e,t){let r={};for(let[n,i]of n5(t.headers?.get("cookie")||""))n.startsWith(e)&&(r[n]=i);return r}(t,n),s=n.context.logger,o=()=>{let e=function(e,t){let r={};for(let n in e)r[n]={name:n,value:"",attributes:{...t,maxAge:0}};return r}(i,r);for(let e in i)delete i[e];return e};return{chunk(n,a){let c=o();for(let o of function(e,t,r,n){let i=4050-ez(`${t.name}.99`,"",{...t.attributes}).length,s=i>0?Math.ceil(t.value.length/i):1/0;if(s<=1)return r[t.name]=t.value,[t];if(s>100)return n.warn(`${e} cookie is too large to store even after chunking, so the cache was skipped. Reduce the cached data or use a database session.`),[];let o=[];for(let e=0;e<s;e++){let n=`${t.name}.${e}`,s=e*i,a=t.value.substring(s,s+i);o.push({...t,name:n,value:a}),r[n]=a}return n.debug(`CHUNKING_${e.toUpperCase()}_COOKIE`,{message:`${e} cookie exceeds the 4050 byte limit and was split into ${s} chunks.`,valueSize:t.value.length,chunkCount:s,chunkSizes:o.map(e=>e.value.length)}),o}(e,{name:t,value:n,attributes:{...r,...a}},i,s))c[o.name]=o;return Object.values(c)},clean:()=>Object.values(o()),setCookies(e){for(let t of e)n.setCookie(t.name,t.value,t.attributes)}}},ig=iy("Session"),im=iy("Account");function iw(e,t){let r=e.getCookie(t);if(r)return r;let n=[],i=e.headers?.get("cookie");if(!i)return null;for(let[e,r]of n5(i))if(e.startsWith(t+".")){let t=parseInt(e.split(".").at(-1)||"0",10);isNaN(t)||n.push({index:t,value:r})}return n.length>0?(n.sort((e,t)=>
1e.index-t.index),n.map(e=>e.value).join("")):null}async function ib(e,t){let r=e.context.authCookies.accountData,n={maxAge:300,...r.attributes},i=await nV(t,e.context.secretConfig,"better-auth-account",n.maxAge),s=im(r.name,n,e);s.setCookies(s.chunk(i,n))}async function iE(e){let t=iw(e,e.context.authCookies.accountData.name);if(t){let r=ip(await nz(t,e.context.secretConfig,"better-auth-account"));if(r)return r}return null}let iA=e2.optional(e2.object({disableCookieCache:ih.boolean().meta({description:"Disable cookie cache and fetch session from database"}).optional(),disableRefresh:ih.boolean().meta({description:"Disable session refresh. Useful for checking session status, without updating the session"}).optional()}));function ix(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}function iv(e,t,r){let n="",i=0,s=0;for(let r of e)for(i=i<<8|r,s+=8;s>=6;)s-=6,n+=t[i>>s&63];if(s>0&&(n+=t[i<<6-s&63]),r){let e=(4-n.length%4)%4;n+="=".repeat(e)}return n}function iS(e,t){let r=new Map;for(let e=0;e<t.length;e++)r.set(t[e],e);let n=[],i=0,s=0;for(let t of e){if("="===t)break;let e=r.get(t);if(void 0===e)throw Error(`Invalid Base64 character: ${t}`);i=i<<6|e,(s+=6)>=8&&(s-=8,n.push(i>>s&255))}return Uint8Array.from(n)}let iT={encode(e,t={}){let r=ix(!1);return iv("string"==typeof e?new TextEncoder().encode(e):new Uint8Array(e),r,t.padding??!0)},decode(e){"string"!=typeof e&&(e=new TextDecoder().decode(e));let t=ix(e.includes("-")||e.includes("_"));return iS(e,t)}},iR={encode(e,t={}){let r=ix(!0);return iv("string"==typeof e?new TextEncoder().encode(e):new Uint8Array(e),r,t.padding??!0)},decode(e){let t=ix(e.includes("-")||e.includes("_"));return iS(e,t)}},iO=new Map,i_={decode:(e,t="utf-8")=>(iO.has(t)||iO.set(t,new TextDecoder(t)),iO.get(t).decode(e)),encode:new TextEncoder().encode},iI=(e="SHA-256",t="none")=>{let r={importKey:async(t,r)=>e$().importKey("raw","string"==typeof t?new TextEncoder().encode(t):t,{name:"HMAC",hash:{name:e}},!1,[r]),sign:async(e,n)=>{"string"==typeof e&&(e=await r.importKey(e,"sign"));let i=await e$().sign("HMAC",e,"string"==typeof n?new TextEncoder().encode(n):n);return"hex"===t?(e=>{if("string"==typeof e&&(e=new TextEncoder().encode(e)),0===e.byteLength)return"";let t=new Uint8Array(e),r="";for(let e of t)r+=e.toString(16).padStart(2,"0");return r})(i):"base64"===t||"base64url"===t||"base64urlnopad"===t?iR.encode(i,{padding:"base64urlnopad"!==t}):i},verify:async(e,n,i)=>("string"==typeof e&&(e=await r.importKey(e,"verify")),"hex"===t&&(i=(e=>{if(!e)return"";if("string"==typeof e){if(e.length%2!=0||!RegExp("^[0123456789abcdef]+$").test(e))throw Error("Invalid hexadecimal string");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.slice(r,r+2),16);return new TextDecoder().decode(t)}return new TextDecoder().decode(e)})(i)),("base64"===t||"base64url"===t||"base64urlnopad"===t)&&(i=await iT.decode(i)),e$().verify("HMAC",e,"string"==typeof i?new TextEncoder().encode(i):i,"string"==typeof n?new TextEncoder().encode(n):n))};return r};async function iC(e,t,r){let n;if(!e.context.options.session?.cookieCache?.enabled)return;let i=nY(t.session,e.context.options.session?.additionalFields),s=nZ(e.context.options,t.user),o=e.context.options.session?.cookieCache?.version,a="1";if(o){if("string"==typeof o)a=o;else if("function"==typeof o){let e=o(t.session,t.user);a=e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then?await e:e}}let c={session:i,user:s,updatedAt:Date.now(),version:a},l={...e.context.authCookies.sessionData.attributes,maxAge:r?void 0:e.context.authCookies.sessionData.attributes.maxAge},u=n1(l.maxAge||60,"sec").getTime(),d=e.context.options.session?.cookieCache?.strategy||"compact";n="jwe"===d?await nV(c,e.context.secretConfig,"better-auth-session",l.maxAge||300):"jwt"===d?await n$(c,e.context.secret,l.maxAge||300):iR.encode(JSON.stringify({session:c,expiresAt:u,signature:await iI("SHA-256","base64urlnopad").sign(e.context.secret,JSON.stringify({...c,expiresAt:u}))}),{padding:!1});let f=ig(e.context.authCookies.sessionData.name,l,e);if(f.setCookies(f.chunk(n,l)),e.context.options.account?.storeAccountCookie&&!function(e,t){let r=new Set;e.responseHeaders&&r.add(e.responseHeaders),e.context?.responseHeaders&&r.add(e.context.responseHeaders);let n=`${t}=`,i=`${t}.`;for(let e of r)if(("function"==typeof e.getSetCookie?e.getSetCookie():n2(e.get("set-cookie")||"")).some(e=>e.startsWith(n)||e.startsWith(i)))return!0;return!1}(e,e.context.authCookies.accountData.name)){let r=await iE(e);if(r)if(e.context.options.database&&r.userId!==t.user.id){iU(e,e.context.authCookies.accountData);let t=im(e.context.authCookies.accountData.name,e.context.authCookies.accountData.attributes,e);t.setCookies(t.clean())}else await ib(e,r)}}async function ik(e,t,r,n){let i=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);r=void 0!==r?r:!!i;let s=e.context.authCookies.sessionToken.attributes,o=r?void 0:e.context.sessionConfig.expires
1In;await e.setSignedCookie(e.context.authCookies.sessionToken.name,t.session.token,e.context.secret,{...s,maxAge:o,...n}),r&&await e.setSignedCookie(e.context.authCookies.dontRememberToken.name,"true",e.context.secret,e.context.authCookies.dontRememberToken.attributes),await iC(e,t,r),e.context.setNewSession(t)}function iU(e,t){!function(e,t){let r=new Set;e.responseHeaders&&r.add(e.responseHeaders),e.context?.responseHeaders&&r.add(e.context.responseHeaders);let n=`${t}=`,i=`${t}.`;for(let e of r){let t="function"==typeof e.getSetCookie?e.getSetCookie():n2(e.get("set-cookie")||"");if(!t.length)continue;let r=t.filter(e=>!e.startsWith(n)&&!e.startsWith(i));if(r.length!==t.length)for(let t of(e.delete("set-cookie"),r))e.append("set-cookie",t)}}(e,t.name),e.setCookie(t.name,"",{...t.attributes,maxAge:0})}function iD(e,t){if(iU(e,e.context.authCookies.sessionToken),iU(e,e.context.authCookies.sessionData),e.context.options.account?.storeAccountCookie){iU(e,e.context.authCookies.accountData);let t=im(e.context.authCookie
1s.accountData.name,e.context.authCookies.accountData.attributes,e),r=t.clean();t.setCookies(r)}"cookie"===e.context.oauthConfig.storeStateStrategy&&iU(e,e.context.createAuthCookie("oauth_state"));let r=ig(e.context.authCookies.sessionData.name,e.context.authCookies.sessionData.attributes,e),n=r.clean();r.setCookies(n),t||iU(e,e.context.authCookies.dontRememberToken)}let iN=null,iL=async()=>{let e=eC(),t=e.context.requestStateAsyncStorage;return t||(iN||(iN=eD().then(t=>(e.context.requestStateAsyncStorage??=new t,e.context.requestStateAsyncStorage))),iN)};async function iH(){let e=(await iL()).getStore();if(!e)throw Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");return e}let{get:iP,set:ij}=(o=()=>!1,s=Object.freeze({}),{get ref(){return s},async get(){let e=await iH();if(!e.has(s)){let t=await o();return e.set(s,t),t}return e.get(s)},async set(e){(await iH()).set(s,e)}}),iM=async(e,t)=>{if(e.context.session)return e.context.session;let r=await e3("/get-session",{method:["GET","POST"],operationId:"getSession",query:iA,requireHeaders:!0,metadata:{openapi:{operationId:"getSession",description:"Get the current session",responses:{200:{description:"Success",content:{"application/json":{schema:{type:["object","null"],properties:{session:{$ref:"#/components/schemas/Session"},user:{$ref:"#/components/schemas/User"}},required:["session","user"]}}}}}}}},async e=>{e.setHeader("cache-control","no-store"),e.setHeader("pragma","no-cache");let t=e.context.options.session?.deferSessionRefresh,r="POST"===e.method;if(r&&!t)throw x.from("METHOD_NOT_ALLOWED",h.METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED);try{let n=await e.getSignedCookie(e.context.authCookies.sessionToken.name,e.context.secret);if(!n)return null;let i=iw(e,e.context.authCookies.sessionData.name),s=null;if(i){let t=e.context.options.session?.cookieCache?.strategy||"compact";if("jwe"===t){let t=await nz(i,e.context.secretConfig,"better-auth-session");t&&t.session&&t.user?s={session:{session:t.session,user:t.user,updatedAt:t.updatedAt,version:t.version},expiresAt:t.exp?1e3*t.exp:Date.now()}:iU(e,e.context.authCookies.sessionData)}else if("jwt"===t){let t=await nW(i,e.context.secret);t&&t.session&&t.user?s={session:{session:t.session,user:t.user,updatedAt:t.updatedAt,version:t.version},expiresAt:t.exp?1e3*t.exp:Date.now()}:iU(e,e.context.authCookies.sessionData)}else{let t=ip(i_.decode(iR.decode(i)));t&&(await iI("SHA-256","base64urlnopad").verify(e.context.secret,JSON.stringify({...t.session,expiresAt:t.expiresAt}),t.signature)?s=t:iU(e,e.context.authCookies.sessionData))}}let o=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);if(s?.session&&e.context.options.session?.cookieCache?.enabled&&!e.query?.disableCookieCache){let t=s.session,r=e.context.options.session?.cookieCache?.version,n="1";if(r){if("string"==typeof r)n=r;else if("function"==typeof r){let e=r(t.session,t.user);n=e instanceof Promise?await e:e}}if((t.version||"1")!==n)iU(e,e.context.authCookies.sessionData);else{let r=new Date(t.session.expiresAt);if(s.expiresAt<Date.now()||r<new Date)iU(e,e.context.authCookies.sessionData);else{let r=e.context.sessionConfig.cookieRefreshCache;if(!1===r){e.context.session=t;let r=n0(e.context.options,{...t.session,expiresAt:new Date(t.session.expiresAt),createdAt:new Date(t.session.createdAt),updatedAt:new Date(t.session.updatedAt)}),n=nZ(e.context.options,{...t.user,createdAt:new Date(t.user.createdAt),updatedAt:new Date(t.user.updatedAt)});return e.json({session:r,user:n})}let n=s.expiresAt-Date.now(),i=1e3*r.updateAge,a=await iP();if(n<i&&!a){let r={session:{...t.session},user:t.user,updatedAt:Date.now()};await iC(e,r,!1);let n=e.context.authCookies.sessionToken.attributes,i=o?void 0:e.context.sessionConfig.expiresIn;await e.setSignedCookie(e.context.authCookies.sessionToken.name,t.session.token,e.context.secret,{...n,maxAge:i});let s=n0(e.context.options,{...r.session,expiresAt:new Date(r.session.expiresAt),createdAt:new Date(r.session.createdAt),updatedAt:new Date(r.session.updatedAt)}),a=nZ(e.context.options,{...r.user,createdAt:new Date(r.user.createdAt),updatedAt:new Date(r.user.updatedAt)});return e.context.session={session:s,user:a},e.json({session:s,user:a})}let c=n0(e.context.options,{...t.session,expiresAt:new Date(t.session.expiresAt),createdAt:new Date(t.session.createdAt),updatedAt:new Date(t.session.updatedAt)}),l=nZ(e.context.options,{...t.user,createdAt:new Date(t.user.createdAt),updatedAt:new Date(t.user.updatedAt)});return e.context.session={session:c,user:l},e.json({session:c,user:l})}}}
1let a=await e.context.internalAdapter.findSession(n);if(e.context.session=a,!a||a.session.expiresAt<new Date)return iD(e),a&&(!t||r)&&await e.context.internalAdapter.deleteSession(a.session.token),e.json(null);if(o||e.query?.disableRefresh){let t=n0(e.context.options,a.session),r=nZ(e.context.options,a.user);return e.json({session:t,user:r})}let c=e.context.sessionConfig.expiresIn,l=e.context.sessionConfig.updateAge,u=a.session.expiresAt.valueOf()-1e3*c+1e3*l<=Date.now(),d=e.query?.disableRefresh||e.context.options.session?.disableSessionRefresh,f=await iP(),p=u&&!d&&!f;if(t&&!r){await iC(e,a,!!o);let t=n0(e.context.options,a.session),r=nZ(e.context.options,a.user);return e.json({session:t,user:r,needsRefresh:p})}if(p){let t=await e.context.internalAdapter.updateSession(a.session.token,{expiresAt:n1(e.context.sessionConfig.expiresIn,"sec"),updatedAt:new Date});if(!t)throw iD(e),x.from("UNAUTHORIZED",h.FAILED_TO_GET_SESSION);let r=e.context.sessionConfig.expiresIn;await ik(e,{session:t,user:a.user},!1,{maxAge:r});let n=n0(e.context.options,t),i=nZ(e.context.options,a.user);return e.json({session:n,user:i})}await iC(e,a,!!o);let y=n0(e.context.options,a.session),g=nZ(e.context.options,a.user);return e.json({session:y,user:g})}catch(t){if(e4(t))throw t;throw e.context.logger.error("INTERNAL_SERVER_ERROR",t),x.from("INTERNAL_SERVER_ERROR",h.FAILED_TO_GET_SESSION)}})({...e,method:"GET",asResponse:!1,headers:e.headers,returnHeaders:!0,returnStatus:!1,query:{...t,...e.query,disableCookieCache:t?.disableCookieCache||e.query?.disableCookieCache,disableRefresh:t?.disableRefresh||e.query?.disableRefresh}}).catch(()=>null);return r?(r.headers&&r.headers.forEach((t,r)=>{let n=r.toLowerCase();"cache-control"!==n&&"pragma"!==n&&(e.context.responseHeaders?"set-cookie"===n?e.context.responseHeaders.append(r,t):e.context.responseHeaders.set(r,t):e.context.responseHeaders=new Headers({[r]:t}))}),e.context.session=r.response,r.response):(e.context.session=null,null)},iK=async e=>{var t;return(t=e.context.options).database||t.secondaryStorage?(e.context.session=null,iM(e,{disableCookieCache:!0})):iM(e)};e6(async e=>{let t=await iM(e);if(!t?.session)throw x.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:t}});let i$=e6(async e=>{let t=await iK(e);if(!t?.session)throw x.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:t}});e6(async e=>{let t=await iM(e);if(!t?.session&&(e.request||e.headers))throw x.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});return{session:t}}),e6(async e=>{let t=await iM(e);if(!t?.session)throw x.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});if(0!==e.context.sessionConfig.freshAge){let r=new Date(t.session.createdAt).getTime(),n=1e3*e.context.sessionConfig.freshAge;if(Date.now()-r>=n)throw x.from("FORBIDDEN",h.SESSION_NOT_FRESH)}return{session:t}}),e3("/revoke-session",{method:"POST",body:e2.object({token:e2.string().meta({description:"The token to revoke"})}),use:[i$],requireHeaders:!0,metadata:{openapi:{description:"Revoke a single session",requestBody:{content:{"application/json":{schema:{type:"object",properties:{token:{type:"string",description:"The token to revoke"}},required:["token"]}}}},responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if the session was revoked successfully"}},required:["status"]}}}}}}}},async e=>{let t=e.body.token;if((await e.context.internalAdapter.findSession(t))?.session.userId===e.context.session.user.id)try{await e.context.internalAdapter.deleteSession(t)}catch(t){throw e.context.logger.error(t&&"object"==typeof t&&"name"in t?t.name:"",t),x.from("INTERNAL_SERVER_ERROR",{message:"Internal Server Error",code:"INTERNAL_SERVER_ERROR"})}return e.json({status:!0})}),e3("/revoke-sessions",{method:"POST",use:[i$],requireHeaders:!0,metadata:{openapi:{description:"Revoke all sessions for the user",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if all sessions were revoked successfully"}},required:["status"]}}}}}}}},async e=>
1{try{await e.context.internalAdapter.deleteUserSessions(e.context.session.user.id)}catch(t){throw e.context.logger.error(t&&"object"==typeof t&&"name"in t?t.name:"",t),x.from("INTERNAL_SERVER_ERROR",{message:"Internal Server Error",code:"INTERNAL_SERVER_ERROR"})}return e.json({status:!0})}),e3("/revoke-other-sessions",{method:"POST",requireHeaders:!0,use:[i$],metadata:{openapi:{description:"Revoke all other sessions for the user except the current one",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{status:{type:"boolean",description:"Indicates if all other sessions were revoked successfully"}},required:["status"]}}}}}}}},async e=>{let t=e.context.session;if(!t.user)throw x.from("UNAUTHORIZED",{message:"Unauthorized",code:"UNAUTHORIZED"});let r=(await e.context.internalAdapter.listSessions(t.user.id)).filter(e=>e.expiresAt>new Date).filter(t=>t.token!==e.context.session.session.token);return await Promise.all(r.map(t=>e.context.internalAdapter.deleteSession(t.token))),e.json({status:!0})});let iW=function(e){var t;let{pluginPathMethods:r,pluginsActions:n,pluginsAtoms:i,$fetch:s,$store:o,atomListeners:a}=(e=>{var t,r;let n,i,s,o,a,c,u,d="credentials"in Request.prototype,p=function(e,t,r,n){if(e)return S(e,t);if(!1!==n){let e=f.BETTER_AUTH_URL||f.NEXT_PUBLIC_BETTER_AUTH_URL||f.PUBLIC_BETTER_AUTH_URL||f.NUXT_PUBLIC_BETTER_AUTH_URL||f.NUXT_PUBLIC_AUTH_URL||("/"!==f.BASE_URL?f.BASE_URL:void 0);if(e)return S(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 A("Could not get origin from request. Please provide a valid base URL.");return S(e,t)}if("u">typeof window&&window.location)return S(window.location.origin,t)}(e?.baseURL,e?.basePath,void 0,void 0)??(e=>{if(void 0!==l.default){if(l.default.env.NEXT_PUBLIC_AUTH_URL)return l.default.env.NEXT_PUBLIC_AUTH_URL;if("u"<typeof window){if(l.default.env.NEXTAUTH_URL)try{return l.default.env.NEXTAUTH_URL}catch{}if(l.default.env.VERCEL_URL)try{let t=l.default.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${t}${l.default.env.VERCEL_URL}`).origin}${e??"/api/auth"}`}catch{}}}})(e?.basePath)??"/api/auth",h=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],y={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:g,onError:m,onRequest:w,onResponse:b,...E}=e?.fetchOptions||{},x=(t={baseURL:p,...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:i,parseDates:s=!0}=t;if("string"!=typeof e)return e;let o=e.trim(),a=o.toLowerCase();if(a.length<=9&&a in O)return O[a];if(!R.test(o)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(T).some(([e,t])=>{let r=t.test(o);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(o,(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(s&&"string"==typeof t){let e=function(e){let t=_.exec(e);if(!t)return null;let[,r,n,i,s,o,a,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(i,10),parseInt(s,10),parseInt(o,10),parseInt(a,10),c?parseInt(c.padEnd(3,"0"),10):0));if(l){let e=(60*parseInt(u,10)+parseInt(d,10))*("+"===l?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return f instanceof Date&&!isNaN(f.getTime())?f:null}(t);if(e)return e}return i?i(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...E,plugins:[y,...E.plugins||[],...e?.disableDefaultFetchPlugins?[]:[C],...h]},async function(e,r){let n,i=ea(eo(eo({},t),r),{headers:em(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,i,s,o;let a=(null==(i=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:i.schema)||n.schema;if(a){let r=e;(null==(s=a.config)?void 0:s.prefix)&&r.startsWith(a.config.prefix)&&(r=r.replace(a.config.prefix,""),a.config.baseURL&&(e=e.replace(a.config.prefix,a.config.baseURL))),(null==(o=a.config)?void 0:o.baseURL)&&r.startsWith(a.config.baseURL)&&(r=r.replace(a.config.baseURL,"")),r.startsWith("/")&&"@"===r.charAt(1)&&(r=r.substring(1));let n=a.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 i=await eE(n.headers,e),s={};for(let[e,t]of Object.entries(i))s[e.toLowerCase()]=t;r=s}let i=ea(eo({},t),{method:n.method,output:n.output,headers:r});return(null==t?void 0:t.disableValidation)||(i=ea(eo({},i),{body:n.input?await eE(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await eE(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await eE(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:i}}}return{url:e,options:t}}}),...(null==r?void 0:r.plugins)||[]]});if(null==t?void 0:t.catchAllError)try{return await ex(e,i)}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 ex(e,i)}),{$sessionSignal:v,session:I,broadcastSessionUpdate:U}=(i=V(!1),o=V({data:null,error:null,isPending:!0,isRefetching:!1,refetch:s=e=>c(e)}),k(o,({newValue:e,abort:t})=>{z(o.value,e)&&t()},2,e=>{let t=o.set,r=o.setKey;return o.setKey&&(o.setKey=(t,n)=>{let i;if(e({abort:()=>{i=!0},changed:t,newValue:{...o.value,[t]:n}}),!i)return r(t,n)}),o.set=r=>{let n;if(e({abort:()=>{n=!0},newValue:r}),!n)return t(r)},()=>{o.set=t,o.setKey=r}}),a=e=>{if(n!==e)return;let t=o.get();n=void 0,(t.isPending||t.isRefetching)&&o.set({...t,isPending:!1,isRefetching:!1,refetch:s})},c=async e=>{n?.abort();let t=new AbortController;n=t;let r=o.get();o.set({...r,isPending:null===r.data,isRefetching:!0,error:null,refetch:s});try{var i;let r=await x("/get-session",{method:"GET",query:e?.query,signal:t.signal});if(t.signal.aborted)return void a(t);let{data:n,error:c}=G(r);if(n?.needsRefresh)try{let e=await x("/get-session",{method:"POST",signal:t.signal});if(t.signal.aborted)return void a(t);({data:n,error:c}=G(e))}catch{if(t.signal.aborted)return void a(t)}if(c){let e=o.get(),t=c?.status===401;o.set({data:t?null:e.data,error:c,isPending:!1,isRefetching:!1,refetch:s});return}let l=(i=n)&&(null!==i.session||null!==i.user)?i:null,u=o.get(),d=null!=u.data&&null!=l&&D(u.data,l)?u.data:l;o.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:s})}catch(r){if(t.signal.aborted)return void a(t);let e=o.get();o.set({data:e.data,error:r,isPending:!1,isRefetching:!1,refetch:s})}},u=()=>{},r=()=>{let t;"u"<typeof window||(t=setTimeout(()=>{c()},0));let r=function(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:i={}}=e,s=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,a=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=e=>{if(a||W().isOnline){if(e?.event==="storage")return void t();if(e?.event==="poll"){c.lastSessionRequest=B(),t();return}if(e?.event==="visibilitychange"){if(B()-c.lastSessionRequest<5)return;c.lastSessionRequest=B(),t();return}t()}};return{init:()=>{c.isInitialized||(c.isInitialized=!0,s&&s>0&&(c.pollInterval=setInterval(()=>{r()&&l({event:"poll"})},1e3*s)),c.unsubscribeBroadcast=H().subscribe(()=>{l({event:"storage"})}),o&&(c.unsubscribeFocus=M().subscribe(()=>{l({event:"visibilitychange"})})),c.unsubscribeOnline=W().subscribe(e=>{e&&l({event:"visibilitychange"})}),c.unsubscribeSignal=n.listen(()=>{t()}),c.cleanupBroadcastSetup=H().setup(),c.cleanupFocusSetup=M().setup(),c.cleanupOnlineSetup=W().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&(clearInterval(c.pollInterval),c.pollInterval=void 0),c.unsubscribeBroadcast&&(c.unsubscribeBroadcast(),c.unsubscribeBroadcast=void 0),c.unsubscribeFocus&&(c.unsubscribeFocus(),c.unsubscribeFocus=void 0),c.unsubscribeOnline&&(c.unsubscribeOnline(),c.unsubscribeOnline=void 0),c.unsubscribeSignal&&(c.unsubscribeSignal(),c.unsubscribeSignal=void 0),c.cleanupBroadcastSetup&&(c.cleanupBroadcastSetup(),c.cleanupBroadcastSetup=void 0),c.cleanupFocusSetup&&(c.cleanupFocusSetup(),c.cleanupFocusSetup=void 0),c.cleanupOnlineSetup&&(c.cleanupOnlineSetup(),c.cleanupOnlineSetup=void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:l,broadcastSessionUpdate:e=>{H().post({event:"session",data:{trigger:e},clientId:Math.random().toString(36).substring(7)})}}}({fetchSession:c,shouldPollSession:()=>null!=o.get().data,sessionSignal:i,options:e});return r.init(),u=r.broadcastSessionUpdate,()=>{t&&clearTimeout(t);let e=n;e?.abort(),e&&a(e),r.cleanup()}},k(o,e=>{let t=r(e);t&&o.events[6].push(t)},5,e=>
1{let t=o.listen;o.listen=(...r)=>(o.lc||o.active||(o.active=!0,e()),t(...r));let r=o.off;return o.events[6]=[],o.off=()=>{r(),setTimeout(()=>{if(o.active&&!o.lc){for(let e of(o.active=!1,o.events[6]))e();o.events[6]=[]}},1e3)},()=>{o.listen=t,o.off=r}}),{session:o,$sessionSignal:i,broadcastSessionUpdate:e=>u(e)}),N=e?.plugins||[],L={},P={$sessionSignal:v,session:I},j={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},K=[{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?U("signout"):("/update-user"===e||"/update-session"===e)&&U("updateUser")}}];for(let e of N)e.getAtoms&&Object.assign(P,e.getAtoms?.(x)),e.pathMethods&&Object.assign(j,e.pathMethods),e.atomListeners&&K.push(...e.atomListeners);let $={notify:e=>{P[e].set(!P[e].get())},listen:(e,t)=>{P[e].subscribe(t)},atoms:P};for(let t of N)t.getActions&&(L=Q(t.getActions?.(x,$,e)??{},L));return{get baseURL(){return p},pluginsActions:L,pluginsAtoms:P,pluginPathMethods:j,atomListeners:K,$fetch:x,$store:$}})(e),u={};for(let[e,t]of Object.entries(i))u[function(e){return`use${e.charAt(0).toUpperCase()+e.slice(1)}`}(e)]=()=>(function(e,t={}){let r=(0,c.useRef)(e.get()),{keys:n,deps:i=[e,n]}=t,s=(0,c.useCallback)(t=>{let i=e=>{r.current!==e&&(r.current=e,t())};if(i(e.value),n?.length){let t;return t=new Set(n),e.listen((e,r,s)=>{(void 0===s?n.some(t=>e[t]!==r[t]):t.has(s)||t.has(s.split(/\.|\[/)[0]))&&i(e,r,s)})}return e.listen(i)},i),o=()=>r.current;return(0,c.useSyncExternalStore)(s,o,o)})(t);return t={...n,...u,$fetch:s,$store:o},function e(n=[]){return new Proxy(function(){},{get(r,i){var s;if("string"!=typeof i||"then"===i||"catch"===i||"finally"===i)return;let o=[...n,i],a=t;for(let e of o)if(a&&"object"==typeof a&&e in a)a=a[e];else{a=void 0;break}return"function"==typeof a?a:"object"==typeof(s=a)&&null!==s&&"get"in s&&"function"==typeof s.get&&"lc"in s&&"number"==typeof s.lc?a:e(o)},apply:async(e,t,o)=>{let c="/"+n.map(eT).join("/"),l=o[0]||{},u=o[1]||{},{query:d,fetchOptions:f,...p}=l,h={...u,...f},y=function(e,t,r){let n=t[e],{fetchOptions:i,query:s,...o}=r||{};return n||(i?.method?i.method:o&&Object.keys(o).length>0?"POST":"GET")}(c,r,l);return await s(c,{...h,body:"GET"===y?void 0:{...p,...h?.body||{}},query:d||h?.query,method:y,async onSuccess(e){if(await h?.onSuccess?.(e),!a||h.disableSignal)return;let t=a.filter(e=>e.matcher(c));if(!t.length)return;let r=new Set;for(let e of t){let t=i[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?.(c)}}})}})}()}({plugins:[{id:"additional-fields-client",version:"1.6.25",$InferServerPlugin:{}},{id:"fixelo-auth",$InferServerPlugin:{}}]}),{useSession:iB,signOut:iq}=iW;e.s(["authClient",0,iW,"signOut",0,iq],841588);let iJ=(0,c.createContext)(null);e.s(["SessionProvider",0,function({initialSession:e,children:t}){let{data:r,isPending:n,isRefetching:i,error:s,refetch:o}=iW.useSession(),[l,u]=(0,c.useState)(e);return(0,c.useEffect)(()=>{u(r??e)},[r,e]),(0,a.jsx)(iJ.Provider,{value:{session:l,isPending:n,isRefetching:i,error:s,refetch:o},children:t})},"useSession",0,function(){let e=(0,c.useContext)(iJ);if(!e)throw Error("useSession must be used within SessionProvider");return e}],317211)}]);

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.