PageSourceSearch

https://www.aibrotherwatch.com/_next/static/chunks/9512-28dabf4c13…?dpl=dpl_49raA1k2aTxzSQhYRCzvxyJw4R3g

js aibrotherwatch.com collected 2026-10-02 00:46:30 UTC 134,005 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9512],{2155:(e,t,r)=>{"use strict";r.d(t,{g:()=>o});var n=r(21071);let o=e=>(0,n.q)("a-z","A-Z","0-9")(e||32)},2551:(e,t,r)=>{"use strict";r.d(t,{u:()=>n});let n={encode: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},decode: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)}}},3055:(e,t,r)=>{"use strict";r.d(t,{M3:()=>s,W2:()=>i,ll:()=>o,t9:()=>a});var n=r(33382);function o(e){return(0,n.A)(e)&&"string"==typeof e.kty}function i(e){return"oct"!==e.kty&&"string"==typeof e.d}function s(e){return"oct"!==e.kty&&void 0===e.d}function a(e){return o(e)&&"oct"===e.kty&&"string"==typeof e.k}},5075:(e,t,r)=>{"use strict";let n,o;r.d(t,{A:()=>w});var i=r(6824);function s(e,t="algorithm.name"){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function a(e,t){return e.name===t}function u(e){return parseInt(e.name.slice(4),10)}var l=r(22424),c=r(68069),f=r(3055),d=r(22787),h=r(97493);let p=e=>(0,d.D4)(e),y=e=>e?.[Symbol.toStringTag]==="KeyObject",g=async(e,t,r,n,o=!1)=>{let i=e.get(t);if(i?.[n])return i[n];let s=await (0,h.A)({...r,alg:n});return o&&Object.freeze(t),i?i[n]=s:e.set(t,{[n]:s}),s},m={normalizePublicKey:(e,t)=>{if(y(e)){let r=e.export({format:"jwk"});return(delete r.d,delete r.dp,delete r.dq,delete r.p,delete r.q,delete r.qi,r.k)?p(r.k):(o||(o=new WeakMap),g(o,e,r,t))}return(0,f.ll)(e)?e.k?(0,d.D4)(e.k):(o||(o=new WeakMap),g(o,e,e,t,!0)):e},normalizePrivateKey:(e,t)=>{if(y(e)){let r=e.export({format:"jwk"});return r.k?p(r.k):(n||(n=new WeakMap),g(n,e,r,t))}return(0,f.ll)(e)?e.k?(0,d.D4)(e.k):(n||(n=new WeakMap),g(n,e,e,t,!0)):e}};async function w(e,t,r){if("sign"===r&&(t=await m.normalizePrivateKey(t,e)),"verify"===r&&(t=await m.normalizePublicKey(t,e)),(0,i.R)(t))return!function(e,t,...r){switch(t){case"HS256":case"HS384":case"HS512":{if(!a(e.algorithm,"HMAC"))throw s("HMAC");let r=parseInt(t.slice(2),10);if(u(e.algorithm.hash)!==r)throw s(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!a(e.algorithm,"RSASSA-PKCS1-v1_5"))throw s("RSASSA-PKCS1-v1_5");let r=parseInt(t.slice(2),10);if(u(e.algorithm.hash)!==r)throw s(`SHA-${r}`,"algorithm.hash");break}
1case"PS256":case"PS384":case"PS512":{if(!a(e.algorithm,"RSA-PSS"))throw s("RSA-PSS");let r=parseInt(t.slice(2),10);if(u(e.algorithm.hash)!==r)throw s(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw s("Ed25519 or Ed448");break;case"Ed25519":if(!a(e.algorithm,"Ed25519"))throw s("Ed25519");break;case"ES256":case"ES384":case"ES512":{if(!a(e.algorithm,"ECDSA"))throw s("ECDSA");let r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw s(r,"algorithm.namedCurve");break}default:throw TypeError("CryptoKey does not support this operation")}if(r.length&&!r.some(t=>e.usages.includes(t))){let e="CryptoKey does not support this operation, its usages must include ";if(r.length>2){let t=r.pop();e+=`one of ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of ${r[0]} or ${r[1]}.`:e+=`${r[0]}.`;throw TypeError(e)}}(t,e,r),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw TypeError((0,l.A)(t,...c.g));return i.A.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}throw TypeError((0,l.A)(t,...c.g,"Uint8Array","JSON Web Key"))}},6824:(e,t,r)=>{"use strict";r.d(t,{A:()=>n,R:()=>o});let n=crypto,o=e=>e instanceof CryptoKey},8126:(e,t,r)=>{"use strict";r.d(t,{$4:()=>y,BT:()=>p,Dm:()=>h,Dp:()=>f,Rb:()=>s,T0:()=>a,Ye:()=>c,h2:()=>m,i4:()=>n,ie:()=>o,n:()=>i,xb:()=>g});class n extends Error{constructor(e,t){super(e,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}n.code="ERR_JOSE_GENERIC";class o extends n{constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=r,this.reason=n,this.payload=t}}o.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class i extends n{constructor(e,t,r="unspecified",n="unspecified"){super(e,{cause:{claim:r,reason:n,payload:t}}),this.code="ERR_JWT_EXPIRED",this.claim=r,this.reason=n,this.payload=t}}i.code="ERR_JWT_EXPIRED";class s extends n{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}s.code="ERR_JOSE_ALG_NOT_ALLOWED";class a extends n{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}a.code="ERR_JOSE_NOT_SUPPORTED";class u extends n{constructor(e="decryption operation failed",t){super(e,t),this.code="ERR_JWE_DECRYPTION_FAILED"}}u.code="ERR_JWE_DECRYPTION_FAILED";class l extends n{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}l.code="ERR_JWE_INVALID";class c extends n{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}c.code="ERR_JWS_INVALID";class f extends n{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}f.code="ERR_JWT_INVALID";class d extends n{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}d.code="ERR_JWK_INVALID";class h extends n{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}h.code="ERR_JWKS_INVALID";class p extends n{constructor(e="no applicable key found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_NO_MATCHING_KEY"}}p.code="ERR_JWKS_NO_MATCHING_KEY";class y extends n{constructor(e="multiple matching keys found in the JSON Web Key Set",t){super(e,t),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Symbol.asyncIterator,y.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class g extends n{constructor(e="request timed out",t){super(e,t),this.code="ERR_JWKS_TIMEOUT"}}g.code="ERR_JWKS_TIMEOUT";class m extends n{constructor(e="signature verification failed",t){super(e,t),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}m.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"},8411:(e,t,r)=>{"use strict";r.d(t,{LG:()=>s,Ny:()=>b,UD:()=>E});var n=r(84411),o=Object.defineProperty,i={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_IMPLEMENT
1ED: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},s=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}()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=function(e){let t=e.split("\n    at ");return t.length<=1?e:(t.splice(1,1),t.join("\n    at "))}(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}get["constructor"](){return t}}return r}(class extends Error{constructor(e="INTERNAL_SERVER_ERROR",t,r={},n="number"==typeof e?e:i[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?{code:t?.message?.toUpperCase().replace(/ /g,"_").replace(/[^A-Z0-9_]/g,""),...t}:void 0}},Error);function a(e){return e instanceof s||e?.name==="APIError"}async function u(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:l(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:l(n.issues,"query")};r.query=n.value}return e.requireHeaders&&!t.headers?{data:null,error:{message:"Headers is required"}}:e.requireRequest&&!t.request?{data:null,error:{message:"Request is required"}}:{data:r,error:null}}function l(e,t){let r=[];for(let t of e){let e=t.message;r.push(e)}return{message:`Invalid ${t} parameters`}}var c={name:"HMAC",hash:"SHA-256"},f=async e=>{let t="string"==typeof e?new TextEncoder().encode(e):e;return await n.aK.importKey("raw",t,c,!1,["sign","verify"])},d=async(e,t,r)=>{try{let o=atob(e),i=new Uint8Array(o.length);for(let e=0,t=o.length;e<t;e++)i[e]=o.charCodeAt(e);return await n.aK.verify(c,r,i,new TextEncoder().encode(t))}catch(e){return!1}},h=async(e,t)=>{let r=await f(t);return btoa(String.fromCharCode(...new Uint8Array(await n.aK.sign(c.name,r,new TextEncoder().encode(e)))))},p=async(e,t)=>{let r=await h(e,t);return encodeURIComponent(e=`${e}.${r}`)},y=(e,t)=>{let r=e;if(t)if("secure"===t)r="__Secure-"+e;else{if("host"!==t)return;r="__Host-"+e}return r},g=(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},m=async(e,t,r,n)=>g(e,t=await p(t,r),n),w=async(e,{options:t,path:r})=>{let n=new Headers,{data:o,error:i}=await u(t,e);if(i)throw new s(400,{message:i.message,code:"VALIDATION_ERROR"});let a="headers"in e?e.headers instanceof Headers?e.headers:new Headers(e.headers):"request"in e&&e.request instanceof Request?e.request.headers:null,l=a?.get("cookie"),c=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);
1if(-1===n)break;let o=e.indexOf(";",r);if(-1===o)o=e.length;else if(o<n){r=e.lastIndexOf(";",n-1)+1;continue}let i=e.slice(r,n).trim();if(!t.has(i)){let r=e.slice(n+1,o).trim();34===r.codePointAt(0)&&(r=r.slice(1,-1)),t.set(i,function(e){try{return e.includes("%")?decodeURIComponent(e):e}catch{return e}}(r))}r=o+1}return t}(l):void 0,h={...e,body:o.body,query:o.query,path:e.path||r,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,setHeader:(e,t)=>{n.set(e,t)},getHeader:e=>a?a.get(e):null,getCookie:(e,t)=>{let r=y(e,t);return r&&c?.get(r)||null},getSignedCookie:async(e,t,r)=>{let n=y(e,r);if(!n)return null;let o=c?.get(n);if(!o)return null;let i=o.lastIndexOf(".");if(i<1)return null;let s=o.substring(0,i),a=o.substring(i+1);if(44!==a.length||!a.endsWith("="))return null;let u=await f(t);return!!await d(a,s,u)&&s},setCookie:(e,t,r)=>{let o=((e,t,r)=>g(e,t=encodeURIComponent(t),r))(e,t,r);return n.append("set-cookie",o),o},setSignedCookie:async(e,t,r,o)=>{let i=await m(e,t,r,o);return n.append("set-cookie",i),i},redirect:e=>(n.set("location",e),new s("FOUND",void 0,n)),error:(e,t,r)=>new s(e,t,r),json:(t,r)=>e.asResponse?{body:r?.body||t,routerResponse:r,_flag:"json"}:t,responseHeaders:n};for(let e of t.use||[]){let t=await e({...h,returnHeaders:!0,asResponse:!1});t.response&&Object.assign(h.context,t.response),t.headers&&t.headers.forEach((e,t)=>{h.responseHeaders.set(t,e)})}return h};function b(e,t){let r=async r=>{let n="function"==typeof e?e:t,o=await w(r,{options:"function"==typeof e?{}:e,path:"/"});if(!n)throw Error("handler must be defined");let i=await n(o),s=o.responseHeaders;return r.returnHeaders?{headers:s,response:i}:i};return r.options="function"==typeof e?{}:e,r}b.create=e=>function(t,r){if("function"==typeof t)return b({use:e?.use},t);if(!r)throw Error("Middleware handler is required");return b({...t,method:"*",use:[...e?.use||[],...t.use||[]]},r)};var E=(e,t,r)=>{let n=async(...n)=>{let o=n[0]||{},i=await w(o,{options:t,path:e}),s=await r(i).catch(async e=>{if(a(e)){let r=t.onAPIError;if(r&&await r(e),o.asResponse)return e}throw e}),u=i.responseHeaders;return o.asResponse?function e(t,r){if(t instanceof Response)return r?.headers instanceof Headers&&r.headers.forEach((e,r)=>{t.headers.set(r,e)}),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 o=new Headers({...n?.headers,...t.headers,...r?.headers,"Content-Type":"application/json"});return new Response(JSON.stringify(e),{...n,headers:o,status:t.status??r?.status??n?.status,statusText:r?.statusText??n?.statusText})}if(a(t))return e(t.body,{status:r?.status??t.statusCode,statusText:t.status.toString(),headers:r?.headers||t.headers});let n=t,o=new Headers(r?.headers);return t?"string"==typeof t?(n=t,o.set("Content-Type","text/plain")):t instanceof ArrayBuffer||ArrayBuffer.isView(t)?(n=t,o.set("Content-Type","application/octet-stream")):t instanceof Blob?(n=t,o.set("Content-Type",t.type||"application/octet-stream")):t instanceof FormData?n=t:t instanceof URLSearchParams?(n=t,o.set("Content-Type","application/x-www-form-urlencoded")):t instanceof ReadableStream?(n=t,o.set("Content-Type","application/octet-stream")):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)&&(n=function(e,t,r){let n=0,o=new WeakMap;return JSON.stringify(e,(e,t)=>{if("bigint"==typeof t)return t.toString();if("object"==typeof t&&null!==t){if(o.has(t))return`[Circular ref-${o.get(t)}]`;o.set(t,n++)}return t},void 0)}(t),o.set("Content-Type","application/json")):(null===t&&(n=JSON.stringify(null)),o.set("content-type","application/json")),new Response(n,{...r,headers:o})}(s,{headers:u}):o.returnHeaders?{headers:u,response:s}:s};return n.options=t,n.path=e,n};function A(e,t,r){function n(r,n){var o;for(let i in Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(o=r._zod).traits??(o.traits=new Set),r._zod.traits.add(e),t(r,n),s.prototype)i in r||Object.defineProperty(r,i,{value:s.prototype[i].bind(r)});r._zod.constr=s,r._zod.def=n}
1let o=r?.Parent??Object;class i extends o{}function s(e){var t;let o=r?.Parent?new i:this;for(let r of(n(o,e),(t=o._zod).deferred??(t.deferred=[]),o._zod.deferred))r();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}function v(e){return e}function S(e){return e}function R(e){}function _(e){throw Error()}function T(e){}function O(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function I(e,t="|"){return e.map(e=>Q(e)).join(t)}function x(e,t){return"bigint"==typeof t?t.toString():t}function k(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function P(e){return null==e}function U(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function C(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}function D(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function N(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function j(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function L(e){let t=Object.keys(e);return Promise.all(t.map(t=>e[t])).then(e=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return r})}function H(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function M(e){return JSON.stringify(e)}E.create=e=>(t,r,n)=>E(t,{...r,use:[...r?.use||[],...e?.use||[]]},n),Object.freeze({status:"aborted"}),Symbol("zod_brand"),((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})})({},{BIGINT_FORMAT_RANGES:()=>et,Class:()=>eg,NUMBER_FORMAT_RANGES:()=>ee,aborted:()=>eu,allowsEval:()=>W,assert:()=>T,assertEqual:()=>v,assertIs:()=>R,assertNever:()=>_,assertNotEqual:()=>S,assignProp:()=>N,cached:()=>k,captureStackTrace:()=>$,cleanEnum:()=>ey,cleanRegex:()=>U,clone:()=>G,createTransparentProxy:()=>Z,defineLazy:()=>D,esc:()=>M,escapeRegex:()=>Y,extend:()=>eo,finalizeIssue:()=>ef,floatSafeRemainder:()=>C,getElementAtPath:()=>j,getEnumValues:()=>O,getLengthableOrigin:()=>eh,getParsedType:()=>z,getSizableOrigin:()=>ed,isObject:()=>B,isPlainObject:()=>K,issue:()=>ep,joinValues:()=>I,jsonStringifyReplacer:()=>x,merge:()=>ei,normalizeParams:()=>V,nullish:()=>P,numKeys:()=>J,omit:()=>en,optionalKeys:()=>X,partial:()=>es,pick:()=>er,prefixIssues:()=>el,primitiveTypes:()=>q,promiseAllObject:()=>L,propertyKeyTypes:()=>F,randomString:()=>H,required:()=>ea,stringifyPrimitive:()=>Q,unwrapMessage:()=>ec});var $=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function B(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var W=k(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function K(e){if(!1===B(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!1!==B(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function J(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var z=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return"promise";if("undefined"!=typeof Map&&e instanceof Map)return"map";if("undefined"!=typeof Set&&e instanceof Set)return"set";if("undefined"!=typeof Date&&e instanceof Date)return"date";if("undefined"!=typeof File&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},F=new Set(["string","number","symbol"]),q=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function G(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function V(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function Z(e){let t;return new Proxy({},{get:(r,n,o)=>(t??(t=e()),Reflect.get(t,n,o)),set:(r,n,o,i)=>(t??(t=e()),Reflect.set(t,n,o,i)),has:(r,n)=>(t??(t=e()),Reflect.has(t,n)),deleteProperty:(r,n)=>(t??(t=e()),Reflect.deleteProperty(t,n)),ownKeys:r=>(t??(t=e()),Reflect.ownKeys(t)),getOwnPropertyDescriptor:(r,n)=>(t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)),defineProperty:(r,n,o)=>(t??(t=e()),Reflect.defineProperty(t,n,o))})}function Q(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}function X(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}var ee={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},et={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function er(e,t){let r={},n=e._zod.def;for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=n.shape[e])}return G(e,{...e._zod.def,shape:r,checks:[]})}function en(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return G(e,{...e._zod.def,shape:r,checks:[]})}function eo(e,t){if(!K(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return N(this,"shape",r),r},checks:[]};return G(e,r)}function ei(e,t){return G(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return N(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function es(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let t in r){if(!(t in n))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(let t in n)o[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return G(t,{...t._zod.def,shape:o,checks:[]})}function ea(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let t in r){if(!(t in o))throw Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(let t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return G(t,{...t._zod.def,shape:o,checks:[]})}function eu(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function el(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function ec(e){return"string"==typeof e?e:e?.message}function ef(e,t,r){let n={...e,path:e.path??[]};return e.message||(n.message=ec(e.inst?._zod.def?.error?.(e))??ec(t?.error?.(e))??ec(r.customError?.(e))??ec(r.localeError?.(e))??"Invalid input"),delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ed(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function eh(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ep(...e){let[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}function ey(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var eg=class{constructor(...e){}},em=(e,t)=>
1{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,x,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ew=A("$ZodError",em);A("$ZodError",em,{Parent:Error}),Symbol("ZodOutput"),Symbol("ZodInput");var eb=(e,t)=>{ew.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t){let r=t||function(e){return e.message},n={_errors:[]},o=e=>{for(let t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>o({issues:e}));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,o=0;for(;o<t.path.length;){let n=t.path[o];o===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}})(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})};A("ZodError",eb),A("ZodError",eb,{Parent:Error})},8425:(e,t,r)=>{"use strict";r.d(t,{I:()=>l});var n=r(22424),o=r(68069),i=r(3055);let s=e=>e?.[Symbol.toStringTag],a=(e,t,r)=>{if(void 0!==t.use&&"sig"!==t.use)throw TypeError("Invalid key for this operation, when present its use must be sig");if(void 0!==t.key_ops&&t.key_ops.includes?.(r)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(void 0!==t.alg&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0};function u(e,t,r,u){t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?((e,t,r,u)=>{if(!(t instanceof Uint8Array)){if(u&&i.ll(t)){if(i.t9(t)&&a(e,t,r))return;throw TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!(0,o.A)(t))throw TypeError((0,n.t)(e,t,...o.g,"Uint8Array",u?"JSON Web Key":null));if("secret"!==t.type)throw TypeError(`${s(t)} instances for symmetric algorithms must be of type "secret"`)}})(t,r,u,e):((e,t,r,u)=>{if(u&&i.ll(t))switch(r){case"sign":if(i.W2(t)&&a(e,t,r))return;throw TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(i.M3(t)&&a(e,t,r))return;throw TypeError("JSON Web Key for this operation be a public JWK")}if(!(0,o.A)(t))throw TypeError((0,n.t)(e,t,...o.g,u?"JSON Web Key":null));if("secret"===t.type)throw TypeError(`${s(t)} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw TypeError(`${s(t)} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw TypeError(`${s(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw TypeError(`${s(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw TypeError(`${s(t)} instances for asymmetric algorithm encryption must be of type "public"`)})(t,r,u,e)}u.bind(void 0,!1);let l=u.bind(void 0,!0)},11669:(e,t,r)=>{"use strict";r.d(t,{a:()=>s,b:()=>l,c:()=>u,g:()=>a});var n=r(37978),o=r(73227);function i(e,t="/api/auth"){return!function(e){try{let t=new URL(e);return"/"!==t.pathname}catch(t){throw new o.B(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e)?(t=t.startsWith("/")?t:`/${t}`,`${e.replace(/\/+$/,"")}${t}`):e}function s(e,t,r){if(e)return i(e,t);let s=n.e.BETTER_AUTH_URL||n.e.NEXT_PUBLIC_BETTER_AUTH_URL||n.e.PUBLIC_BETTER_AUTH_URL||n.e.NUXT_PUBLIC_BETTER_AUTH_URL||n.e.NUXT_PUBLIC_AUTH_URL||("/"!==n.e.BASE_URL?n.e.BASE_URL:void 0);if(s)return i(s,t);let u=r?.headers.get("x-forwarded-host"),l=r?.headers.get("x-forwarded-proto");if(u&&l)return i(`${l}://${u}`,t);if(r){let e=a(r.url);if(!e)throw new o.B("Could not get origin from request. Please provide a valid base URL.");return i(e,t)}if("undefined"!=typeof window&&window.location)return i(window.location.origin,t)}function a(e){try{return new URL(e).origin}catch(e){return null}}function u(e){try{return new URL(e).protocol}catch(e){return null}}function l(e){try{return new URL(e).host}catch(t){return e}}},12651:(e,t,r)=>{"use strict";r.d(t,{A:()=>
1o});var n=r(8126);let o=function(e,t,r,o,i){let s;if(void 0!==i.crit&&o?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||void 0===o.crit)return new Set;if(!Array.isArray(o.crit)||0===o.crit.length||o.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');for(let a of(s=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t,o.crit)){if(!s.has(a))throw new n.T0(`Extension Header Parameter "${a}" is not recognized`);if(void 0===i[a])throw new e(`Extension Header Parameter "${a}" is missing`);if(s.get(a)&&void 0===o[a])throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return new Set(o.crit)}},15666:(e,t,r)=>{"use strict";r.d(t,{e:()=>s});let n=[],o=0,i=0,s=e=>{let t=[],r={get:()=>(r.lc||r.listen(()=>{})(),r.value),lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=o+4;t<n.length;)n[t]===e?n.splice(t,4):t+=4;let i=t.indexOf(e);~i&&(t.splice(i,1),--r.lc||r.off())}),notify(e,s){i++;let a=!n.length;for(let o of t)n.push(o,r.value,e,s);if(a){for(o=0;o<n.length;o+=4)n[o](n[o+1],n[o+2],n[o+3]);n.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}},16217:(e,t,r)=>{"use strict";r.d(t,{a:()=>o});let n=new Map,o={decode:(e,t="utf-8")=>(n.has(t)||n.set(t,new TextDecoder(t)),n.get(t).decode(e)),encode:new TextEncoder().encode}},20101:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(...e)=>{let t,r=e.filter(Boolean);if(0===r.length||1===r.length)return!0;for(let e of r){let r=Object.keys(e);if(!t||0===t.size){t=new Set(r);continue}for(let e of r){if(t.has(e))return!1;t.add(e)}}return!0}},21071:(e,t,r)=>{"use strict";r.d(t,{q:()=>i});var n=r(84411);function o(e){switch(e){case"a-z":return"abcdefghijklmnopqrstuvwxyz";case"A-Z":return"ABCDEFGHIJKLMNOPQRSTUVWXYZ";case"0-9":return"0123456789";case"-_":return"-_";default:throw Error(`Unsupported alphabet: ${e}`)}}function i(...e){let t=e.map(o).join("");if(0===t.length)throw Error("No valid characters provided for random string generation.");let r=t.length;return(e,...i)=>{let s;if(e<=0)throw Error("Length must be a positive integer.");let a=t,u=r;i.length>0&&(u=(a=i.map(o).join("")).length);let l=Math.floor(256/u)*u,c=new Uint8Array(2*e),f=c.length,d="",h=f;for(;d.length<e;)h>=f&&((0,n.UY)(c),h=0),(s=c[h++])<l&&(d+=a[s%u]);return d}}},21537:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=e=>Math.floor(e.getTime()/1e3)},22279:(e,t,r)=>{"use strict";r.d(t,{a:()=>s});let n=["info","success","warn","error","debug"],o={reset:"\x1b[0m",bright:"\x1b[1m",dim:"\x1b[2m",fg:{red:"\x1b[31m",green:"\x1b[32m",yellow:"\x1b[33m",blue:"\x1b[34m",magenta:"\x1b[35m"}},i={info:o.fg.blue,success:o.fg.green,warn:o.fg.yellow,error:o.fg.red,debug:o.fg.magenta},s=(e=>{let t=e?.disabled!==!0,r=e?.level??"error";return{...Object.fromEntries(n.map(s=>[s,(...[a,...u])=>((s,a,u=[])=>{if(!t||!(n.indexOf(s)<=n.indexOf(r)))return;let l=((e,t)=>{let r=new Date().toISOString();return`${o.dim}${r}${o.reset} ${i[e]}${e.toUpperCase()}${o.reset} ${o.bright}[Better Auth]:${o.reset} ${t}`})(s,a);if(!e||"function"!=typeof e.log)return void("error"===s?console.error(l,...u):"warn"===s?console.warn(l,...u):console.log(l,...u));e.log("success"===s?"info":s,a,...u)})(s,a,u)])),get level(){return r}}})()},22424:(e,t,r)=>{"use strict";function n(e,t,...r){if((r=r.filter(Boolean)).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}r.d(t,{A:()=>o,t:()=>i});let o=(e,...t)=>n("Key must be ",e,...t);function i(e,t,...r){return n(`Key for the ${e} algorithm must be `,t,...r)}},22787:(e,t,r)=>{"use strict";r.d(t,{D4:()=>i,lF:()=>o});var n=r(52684);let o=e=>(e=>{let t=e;"string"==typeof t&&(t=n.Rd.encode(t));let r=[];for(let e=0;e<t.length;e+=32768)r.push(String.fromCharCode.apply(null,t.subarray(e,e+32768)));return btoa(r.join(""))})(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),i=e=>{let t=e;t instanceof Uint8Array&&(t=n.D0.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return(e=>{let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r})(t)}catch{throw TypeError("The input to be decoded is not correctly encoded.")}}},24403:(e,t,r)=>{"use strict";r.d(t,{b:()=>a,d:()=>l,s:()=>u});var n=r(73227),o=r(34164);r(37978);var i=r(66175),s=r(61135);async function a(e,t){if(e.context.options.session?.cookieCache?.enabled){let r={session:Object.entries(t.session).reduce((t,[r,n])=>{let o=e.context.options.session?.additionalFields?.[r];return o&&!1===o.returned||(t[r]=n),t},{}),user:t.user},a=(0,o.g)(e.context.authCookies.sessionData.options.maxAge||60,"sec").getTime(),u=i.z.encode(JSON.stringify({session:r,expiresAt:a,signature:await (0,s.s)("SHA-256","base64urlnopad").sign(e.context.secret,JSON.stringify({...r,expiresAt:a}))}),{padding:!1});if(u.length>4093)throw new n.B("Session data is too large to store in the cookie. Please disable session cookie caching or reduce the size of the session data");e.setCookie(e.context.authCookies.sessionData.name,u,e.context.authCookies.sessionData.options)}}async function u(e,t,r,n){let o=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);r=void 0!==r?r:!!o;let i=e.context.authCookies.sessionToken.options,s=r?void 0:e.context.sessionConfig.expires
1In;await e.setSignedCookie(e.context.authCookies.sessionToken.name,t.session.token,e.context.secret,{...i,maxAge:s,...n}),r&&await e.setSignedCookie(e.context.authCookies.dontRememberToken.name,"true",e.context.secret,e.context.authCookies.dontRememberToken.options),await a(e,t),e.context.setNewSession(t),e.context.options.secondaryStorage&&await e.context.secondaryStorage?.set(t.session.token,JSON.stringify({user:t.user,session:t.session}),Math.floor((new Date(t.session.expiresAt).getTime()-Date.now())/1e3))}function l(e,t){e.setCookie(e.context.authCookies.sessionToken.name,"",{...e.context.authCookies.sessionToken.options,maxAge:0}),e.setCookie(e.context.authCookies.sessionData.name,"",{...e.context.authCookies.sessionData.options,maxAge:0}),t||e.setCookie(e.context.authCookies.dontRememberToken.name,"",{...e.context.authCookies.dontRememberToken.options,maxAge:0})}r(36391),r(11669),r(16217)},25883:(e,t,r)=>{"use strict";function n(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 o(e){return(...t)=>t.reduce((t,r)=>(function e(t,r,o=".",i){if(!n(r))return e(t,{},o,i);let s=Object.assign({},r);for(let r in t){if("__proto__"===r||"constructor"===r)continue;let a=t[r];null!=a&&(i&&i(s,r,a,o)||(Array.isArray(a)&&Array.isArray(s[r])?s[r]=[...a,...s[r]]:n(a)&&n(s[r])?s[r]=e(a,s[r],(o?`${o}.`:"")+r.toString(),i):s[r]=a))}return s})(t,r,"",e),{})}r.d(t,{zG:()=>o}),o(),o((e,t,r)=>{if(void 0!==e[t]&&"function"==typeof r)return e[t]=r(e[t]),!0}),o((e,t,r)=>{if(Array.isArray(e[t])&&"function"==typeof r)return e[t]=r(e[t]),!0})},27511:(e,t,r)=>{"use strict";r.d(t,{hO:()=>u,sG:()=>a});var n=r(73482),o=r(49047),i=r(11418),s=r(40098),a=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=(0,i.TL)(`Primitive.${t}`),o=n.forwardRef((e,n)=>{let{asChild:o,...i}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(o?r:t,{...i,ref:n})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function u(e,t){e&&o.flushSync(()=>e.dispatchEvent(t))}},28291:(e,t,r)=>{"use strict";r.d(t,{u:()=>s});var n=r(15666);let o=(e,t)=>((e,t,r,n)=>(e.events=e.events||{},e.events[r+10]||(e.events[r+10]=n(t=>{e.events[r].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let n=e.events[r],o=n.indexOf(t);n.splice(o,1),n.length||(delete e.events[r],e.events[r+10](),delete e.events[r+10])}))(e,r=>{let n=t(r);n&&e.events[6].push(n)},5,t=>{let r=e.listen;e.listen=(...n)=>(e.lc||e.active||(e.active=!0,t()),r(...n));let n=e.off;return e.events[6]=[],e.off=()=>{n(),setTimeout(()=>{if(e.active&&!e.lc){for(let t of(e.active=!1,e.events[6]))t();e.events[6]=[]}},1e3)},()=>{e.listen=r,e.off=n}}),i="undefined"==typeof window,s=(e,t,r,s)=>{let a=(0,n.e)({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>u(e)}),u=e=>{let n="function"==typeof s?s({data:a.get().data,error:a.get().error,isPending:a.get().isPending}):s;r(t,{...n,query:{...n?.query,...e?.query},async onSuccess(e){a.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await n?.onSuccess?.(e)},async onError(e){let{request:t}=e,r="number"==typeof t.retry?t.retry:t.retry?.attempts,o=t.retryAttempt||0;r&&o<r||(a.set({error:e.error,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await n?.onError?.(e))},async onRequest(e){let t=a.get();a.set({isPending:null===t.data,data:t.data,error:null,isRefetching:!0,refetch:a.value.refetch}),await n?.onRequest?.(e)}}).catch(e=>{a.set({error:e,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch})})};e=Array.isArray(e)?e:[e];let l=!1;for(let t of e)t.subscribe(()=>{i||(l?u():o(a,()=>(setTimeout(()=>{u()},0),l=!0,()=>{a.off(),t.off()})))});return a}},33351:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(8126);function o(e,t){let r=`SHA-${e.slice(-3)}`;
1switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:t.name};default:throw new n.T0(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},33382:(e,t,r)=>{"use strict";function n(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}r.d(t,{A:()=>n})},34164:(e,t,r)=>{"use strict";r.d(t,{g:()=>n});let n=(e,t="ms")=>new Date(Date.now()+("sec"===t?1e3*e:e))},36391:(e,t,r)=>{"use strict";r.d(t,{s:()=>o});var n=r(22279);function o(e){try{if("string"!=typeof e)return e;return JSON.parse(e,function(e,t){if("string"==typeof t&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t)){let e=new Date(t);if(!isNaN(e.getTime()))return e}return t})}catch(e){return n.a.error("Error parsing JSON",{error:e}),null}}},37978:(e,t,r)=>{"use strict";r.d(t,{b:()=>u,e:()=>s});var n=r(70721);let o=Object.create(null),i=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?o:globalThis),s=new Proxy(o,{get:(e,t)=>i()[t]??o[t],has:(e,t)=>t in i()||t in o,set:(e,t,r)=>(i(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=i(!0);return delete r[t],!0},ownKeys:()=>Object.keys(i(!0))}),a=void 0!==n&&n.env&&"production"||"",u="dev"===a||"development"===a},46023:(e,t,r)=>{"use strict";r.d(t,{D:()=>o});var n=r(22787);n.lF;let o=n.D4},49614:(e,t,r)=>{"use strict";r.d(t,{B:()=>p,a:()=>h,c:()=>d,f:()=>w,g:()=>g,s:()=>m});var n=r(8411),o=r(34164),i=r(24403),s=r(66065),a=r(36391),u=r(61135),l=r(66175),c=r(16217);let f=(0,n.Ny)(async()=>({})),d=n.Ny.create({use:[f,(0,n.Ny)(async()=>({}))]}),h=n.UD.create({use:[f]}),p={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",SOCIAL_ACCOUNT_ALREADY_LINKED:"Social account already linked",PROVIDER_NOT_FOUND:"Provider not found",INVALID_TOKEN:"Invalid token",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. Use another email.",EMAIL_CAN_NOT_BE_UPDATED:"Email can not be updated",CREDENTIAL_ACCOUNT_NOT_FOUND:"Credential account not found",SESSION_EXPIRED:"Session expired. Re-authenticate to perform this action.",FAILED_TO_UNLINK_LAST_ACCOUNT:"You can't unlink your last account",ACCOUNT_NOT_FOUND:"Account not found",USER_ALREADY_HAS_PASSWORD:"User already has a password. Provide that to delete the account."},y=s.lqM(s.Ikc({disableCookieCache:s.auy.boolean().meta({description:"Disable cookie cache and fetch session from database"}).optional(),disableRefresh:s.auy.boolean().meta({description:"Disable session refresh. Useful for checking session status, without updating the session"}).optional()})),g=async(e,t)=>{if(e.context.session)return e.context.session;let r=await h("/get-session",{method:"GET",query:y,requireHeaders:!0,metadata:{openapi:{description:"Get the current session",responses:{200:{description:"Success",content:{"application/json":{schema:{type:"object",properties:{session:{$ref:"#/components/schemas/Session"},user:{$ref:"#/components/schemas/User"}},required:["session","user"]}}}}}}}},async e=>{try{let t=await e.getSignedCookie(e.context.authCookies.sessionToken.name,e.context.secret);if(!t)return null;let r=e.getCookie(e.context.authCookies.sessionData.name),n=r?(0,a.s)(c.a.decode(l.z.decode(r))):null;if(n&&!await (0,u.s)("SHA-256","base64urlnopad").verify(e.context.secret,JSON.stringify({...n.session,expiresAt:n.expiresAt}),n.signature)){let t=e.context.authCookies.sessionData.name;return e.setCookie(t,"",{maxAge:0}
1),e.json(null)}let s=await e.getSignedCookie(e.context.authCookies.dontRememberToken.name,e.context.secret);if(n?.session&&e.context.options.session?.cookieCache?.enabled&&!e.query?.disableCookieCache){let t=n.session;if(!(n.expiresAt<Date.now()||t.session.expiresAt<new Date))return e.context.session=t,e.json(t);{let t=e.context.authCookies.sessionData.name;e.setCookie(t,"",{maxAge:0})}}let f=await e.context.internalAdapter.findSession(t);if(e.context.session=f,!f||f.session.expiresAt<new Date)return(0,i.d)(e),f&&await e.context.internalAdapter.deleteSession(f.session.token),e.json(null);if(s||e.query?.disableRefresh)return e.json(f);let d=e.context.sessionConfig.expiresIn,h=e.context.sessionConfig.updateAge;if(f.session.expiresAt.valueOf()-1e3*d+1e3*h<=Date.now()&&(!e.query?.disableRefresh||!e.context.options.session?.disableSessionRefresh)){let t=await e.context.internalAdapter.updateSession(f.session.token,{expiresAt:(0,o.g)(e.context.sessionConfig.expiresIn,"sec"),updatedAt:new Date});if(!t)return(0,i.d)(e),e.json(null,{status:401});let r=(t.expiresAt.valueOf()-Date.now())/1e3;return await (0,i.s)(e,{session:t,user:f.user},!1,{maxAge:r}),e.json({session:t,user:f.user})}return await (0,i.b)(e,f),e.json(f)}catch(t){throw e.context.logger.error("INTERNAL_SERVER_ERROR",t),new n.LG("INTERNAL_SERVER_ERROR",{message:p.FAILED_TO_GET_SESSION})}})({...e,asResponse:!1,headers:e.headers,returnHeaders:!1,query:{...t,...e.query}}).catch(e=>null);return e.context.session=r,r},m=d(async e=>{let t=await g(e);if(!t?.session)throw new n.LG("UNAUTHORIZED");return{session:t}});d(async e=>{let t=await g(e);if(!t?.session&&(e.request||e.headers))throw new n.LG("UNAUTHORIZED");return{session:t}});let w=d(async e=>{let t=await g(e);if(!t?.session)throw new n.LG("UNAUTHORIZED");if(0===e.context.sessionConfig.freshAge)return{session:t};let r=e.context.sessionConfig.freshAge,o=t.session.updatedAt?.valueOf()||t.session.createdAt.valueOf();if(!(Date.now()-o<1e3*r))throw new n.LG("FORBIDDEN",{message:"Session is not fresh"});return{session:t}});h("/revoke-session",{method:"POST",body:s.Ikc({token:s.YjP().meta({description:"The token to revoke"})}),use:[m],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,r=await e.context.internalAdapter.findSession(t);if(!r)throw new n.LG("BAD_REQUEST",{message:"Session not found"});if(r.session.userId!==e.context.session.user.id)throw new n.LG("UNAUTHORIZED");try{await e.context.internalAdapter.deleteSession(t)}catch(t){throw e.context.logger.error(t&&"object"==typeof t&&"name"in t?t.name:"",t),new n.LG("INTERNAL_SERVER_ERROR")}return e.json({status:!0})}),h("/revoke-sessions",{method:"POST",use:[m],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=>{try{await e.context.internalAdapter.deleteSessions(e.context.session.user.id)}catch(t){throw e.context.logger.error(t&&"object"==typeof t&&"name"in t?t.name:"",t),new n.LG("INTERNAL_SERVER_ERROR")}return e.json({status:!0})}),h("/revoke-other-sessions",{method:"POST",requireHeaders:!0,use:[m],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 new n.LG("UNAUTHORIZED");
1let 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})})},52684:(e,t,r)=>{"use strict";r.d(t,{D0:()=>o,Rd:()=>n,xW:()=>i});let n=new TextEncoder,o=new TextDecoder;function i(...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}},55784:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}},58675:(e,t,r)=>{"use strict";r.d(t,{FA:()=>ef,zp:()=>eh,vX:()=>ed});var n=r(74714);function o(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function i(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function s(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function a(e,...t){if(!s(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function u(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")}let l=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([0x11223344]).buffer)[0])throw Error("Non little-endian hardware is not supported");let c=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),f={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function d(e){return e>=f._0&&e<=f._9?e-f._0:e>=f._A&&e<=f._F?e-(f._A-10):e>=f._a&&e<=f._f?e-(f._a-10):void 0}function h(e){if("string"!=typeof e)throw Error(`string expected, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function p(e){if("string"==typeof e)e=h(e);else if(s(e))e=g(e);else throw Error(`Uint8Array expected, got ${typeof e}`);return e}function y(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let o=BigInt(32),i=BigInt(0xffffffff),s=Number(r>>o&i),a=Number(r&i),u=4*!!n,l=4*!n;e.setUint32(t+u,s,n),e.setUint32(t+l,a,n)}function g(e){return Uint8Array.from(e)}function m(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let w=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),b=w("expand 16-byte k"),E=w("expand 32-byte k"),A=l(b),v=l(E);function S(e,t){return e<<t|e>>>32-t}function R(e){return e.byteOffset%4==0}v.slice();let _=0x100000000-1,T=new Uint32Array;function O(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:u,rounds:c}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return o(s),o(c),i(u),i(r),(t,i,f,d,h=0)=>{a(t),a(i),a(f);let p=f.length;if(void 0===d&&(d=new Uint8Array(p)),a(d),o(h),h<0||h>=_)throw Error("arx: counter overflow");if(d.length<p)throw Error(`arx: output (${d.length}) is shorter than data (${p})`);let y=[],w=t.length,b,E;if(32===w)y.push(b=g(t)),E=v;else if(16===w&&r)(b=new Uint8Array(32)).set(t),b.set(t,16),E=A,y.push(b);else throw Error(`arx: invalid 32-byte key, got length=${w}`);R(i)||y.push(i=g(i));let S=l(b);if(n){if(24!==i.length)throw Error("arx: extended nonce must be 24 bytes");n(E,S,l(i.subarray(0,16)),S),i=i.subarray(16)}let O=16-s;if(O!==i.length)throw Error(`arx: nonce must be ${O} or 16 bytes`);if(12!==O){let e=new Uint8Array(12);e.set(i,u?0:12-i.length),i=e,y.push(i)}return!function(e,t,r,n,o,i,s,a){let u=o.length,c=new Uint8Array(64),f=l(c),d=R(o)&&R(i),h=d?l(o):T,p=d?l(i):T;for(let l=0;l<u;s++){if(e(t,r,n,f,s,a),s>=_)throw Error("arx: counter overflow");let y=Math.min(64,u-l);if(d&&64===y){let e=l/4;if(l%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)p[r=e+t]=h[r]^f[t];l+=64;continue}for(let e=0,t;e<y;e++)i[t=l+e]=o[t]^c[e];l+=y}}(e,E,S,l(i),f,d,h,c),m(...y),d}}let I=(e,t)=>255&e[t++]|(255&e[t++])<<8;class x{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,a(e=p(e),32);let t=I(e,0),r=I(e,2),n=I(e,4),o=I(e,6),i=I(e,8),s=I(e,10),u=I(e,12),l=I(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>7|o<<9)&8191,this.r[4]=(o>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|u<<5)&8065,this.r[8]=(u>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let t=0;t<8;t++)this.pad[t]=I(e,16+2*t)}process(e,t,r=!1){let{h:n,r:o}=this,i=o[0],s=o[1],a=o[2],u=o[3],l=o[4],c=o[5],f=o[6],d=o[7],h=o[8],p=o[9],y=I(e,t+0),g=I(e,t+2),m=I(e,t+4),w=I(e,t+6),b=I(e,t+8),E=I(e,t+10),A=I(e,t+12),v=
1I(e,t+14),S=n[0]+(8191&y),R=n[1]+((y>>>13|g<<3)&8191),_=n[2]+((g>>>10|m<<6)&8191),T=n[3]+((m>>>7|w<<9)&8191),O=n[4]+((w>>>4|b<<12)&8191),x=n[5]+(b>>>1&8191),k=n[6]+((b>>>14|E<<2)&8191),P=n[7]+((E>>>11|A<<5)&8191),U=n[8]+((A>>>8|v<<8)&8191),C=n[9]+(v>>>5|2048*!r),D=0,N=0+S*i+5*p*R+5*h*_+5*d*T+5*f*O;D=N>>>13,N&=8191,N+=5*c*x+5*l*k+5*u*P+5*a*U+5*s*C,D+=N>>>13,N&=8191;let j=D+S*s+R*i+5*p*_+5*h*T+5*d*O;D=j>>>13,j&=8191,j+=5*f*x+5*c*k+5*l*P+5*u*U+5*a*C,D+=j>>>13,j&=8191;let L=D+S*a+R*s+_*i+5*p*T+5*h*O;D=L>>>13,L&=8191,L+=5*d*x+5*f*k+5*c*P+5*l*U+5*u*C,D+=L>>>13,L&=8191;let H=D+S*u+R*a+_*s+T*i+5*p*O;D=H>>>13,H&=8191,H+=5*h*x+5*d*k+5*f*P+5*c*U+5*l*C,D+=H>>>13,H&=8191;let M=D+S*l+R*u+_*a+T*s+O*i;D=M>>>13,M&=8191,M+=5*p*x+5*h*k+5*d*P+5*f*U+5*c*C,D+=M>>>13,M&=8191;let $=D+S*c+R*l+_*u+T*a+O*s;D=$>>>13,$&=8191,$+=x*i+5*p*k+5*h*P+5*d*U+5*f*C,D+=$>>>13,$&=8191;let B=D+S*f+R*c+_*l+T*u+O*a;D=B>>>13,B&=8191,B+=x*s+k*i+5*p*P+5*h*U+5*d*C,D+=B>>>13,B&=8191;let W=D+S*d+R*f+_*c+T*l+O*u;D=W>>>13,W&=8191,W+=x*a+k*s+P*i+5*p*U+5*h*C,D+=W>>>13,W&=8191;let K=D+S*h+R*d+_*f+T*c+O*l;D=K>>>13,K&=8191,K+=x*u+k*a+P*s+U*i+5*p*C,D+=K>>>13,K&=8191;let J=D+S*p+R*h+_*d+T*f+O*c;D=J>>>13,J&=8191,J+=x*l+k*u+P*a+U*s+C*i,D+=J>>>13,J&=8191,N=8191&(D=(D=(D<<2)+D|0)+N|0),D>>>=13,j+=D,n[0]=N,n[1]=j,n[2]=L,n[3]=H,n[4]=M,n[5]=$,n[6]=B,n[7]=W,n[8]=K,n[9]=J}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),n=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=n,n=e[t]>>>13,e[t]&=8191;e[0]+=5*n,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+n,n=r[t]>>>13,r[t]&=8191;r[9]-=8192;let o=(1^n)-1;for(let e=0;e<10;e++)r[e]&=o;o=~o;for(let t=0;t<10;t++)e[t]=e[t]&o|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let i=e[0]+t[0];e[0]=65535&i;for(let r=1;r<8;r++)i=(e[r]+t[r]|0)+(i>>>16)|0,e[r]=65535&i;m(r)}update(e){u(this);let{buffer:t,blockLen:r}=this,n=(e=p(e)).length;for(let o=0;o<n;){let i=Math.min(r-this.pos,n-o);if(i===r){for(;r<=n-o;o+=r)this.process(e,o);continue}t.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){m(this.h,this.r,this.buffer,this.pad)}digestInto(e){u(this);a(e);let t=this.outputLen;if(e.length<t)throw Error(`digestInto() expects output buffer of length at least ${t}`);this.finished=!0;let{buffer:r,h:n}=this,{pos:o}=this;if(o){for(r[o++]=1;o<16;o++)r[o]=0;this.process(r,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=n[t]>>>0,e[i++]=n[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let k=function(e){let t=(t,r)=>e(r).update(p(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new x(e));function P(e,t,r,n,o,i=20){let s=e[0],a=e[1],u=e[2],l=e[3],c=t[0],f=t[1],d=t[2],h=t[3],p=t[4],y=t[5],g=t[6],m=t[7],w=r[0],b=r[1],E=r[2],A=s,v=a,R=u,_=l,T=c,O=f,I=d,x=h,k=p,U=y,C=g,D=m,N=o,j=w,L=b,H=E;for(let e=0;e<i;e+=2)k=k+(N=S(N^(A=A+T|0),16))|0,A=A+(T=S(T^k,12))|0,k=k+(N=S(N^A,8))|0,T=S(T^k,7),U=U+(j=S(j^(v=v+O|0),16))|0,v=v+(O=S(O^U,12))|0,U=U+(j=S(j^v,8))|0,O=S(O^U,7),C=C+(L=S(L^(R=R+I|0),16))|0,R=R+(I=S(I^C,12))|0,C=C+(L=S(L^R,8))|0,I=S(I^C,7),D=D+(H=S(H^(_=_+x|0),16))|0,_=_+(x=S(x^D,12))|0,D=D+(H=S(H^_,8))|0,x=S(x^D,7),C=C+(H=S(H^(A=A+O|0),16))|0,A=A+(O=S(O^C,12))|0,C=C+(H=S(H^A,8))|0,O=S(O^C,7),D=D+(N=S(N^(v=v+I|0),16))|0,v=v+(I=S(I^D,12))|0,D=D+(N=S(N^v,8))|0,I=S(I^D,7),k=k+(j=S(j^(R=R+x|0),16))|0,R=R+(x=S(x^k,12))|0,k=k+(j=S(j^R,8))|0,x=S(x^k,7),U=U+(L=S(L^(_=_+T|0),16))|0,_=_+(T=S(T^U,12))|0,U=U+(L=S(L^_,8))|0,T=S(T^U,7);let M=0;n[M++]=s+A|0,n[M++]=a+v|0,n[M++]=u+R|0,n[M++]=l+_|0,n[M++]=c+T|0,n[M++]=f+O|0,n[M++]=d+I|0,n[M++]=h+x|0,n[M++]=p+k|0,n[M++]=y+U|0,n[M++]=g+C|0,n[M++]=m+D|0,n[M++]=o+N|0,n[M++]=w+j|0,n[M++]=b+L|0,n[M++]=E+H|0}let U=O(P,{counterRight:!1,counterLength:4,allowShortKeys:!1}),C=O(P,{counterRight:!1,counterLength:8,extendNonceFn:function(e,t,r,n){let o=e[0],i=e[1],s=e[2],a=e[3],u=t[0],l=t[1],c=t[2],f=t[3],d=t[4],h=t[5],p=t[6],y=t[7],g=r[0],m=r[1],w=r[2],b=r[3];for(let e=0;e<20;e+=2)d=d+(g=S(g^(o=o+u|0),16))|0,o=o+(u=S(u^d,12))|0,d=d+(g=S(g^o,8))|0,u=S(u^d,7),h=h+(m=S(m^(i=i+l|0),16))|0,i=i+(l=S(l^h,12))|0,h=h+(m=S(m^i,8))|0,l=S(l^h,7),p=
1p+(w=S(w^(s=s+c|0),16))|0,s=s+(c=S(c^p,12))|0,p=p+(w=S(w^s,8))|0,c=S(c^p,7),y=y+(b=S(b^(a=a+f|0),16))|0,a=a+(f=S(f^y,12))|0,y=y+(b=S(b^a,8))|0,f=S(f^y,7),p=p+(b=S(b^(o=o+l|0),16))|0,o=o+(l=S(l^p,12))|0,p=p+(b=S(b^o,8))|0,l=S(l^p,7),y=y+(g=S(g^(i=i+c|0),16))|0,i=i+(c=S(c^y,12))|0,y=y+(g=S(g^i,8))|0,c=S(c^y,7),d=d+(m=S(m^(s=s+f|0),16))|0,s=s+(f=S(f^d,12))|0,d=d+(m=S(m^s,8))|0,f=S(f^d,7),h=h+(w=S(w^(a=a+u|0),16))|0,a=a+(u=S(u^h,12))|0,h=h+(w=S(w^a,8))|0,u=S(u^h,7);let E=0;n[E++]=o,n[E++]=i,n[E++]=s,n[E++]=a,n[E++]=g,n[E++]=m,n[E++]=w,n[E++]=b},allowShortKeys:!1}),D=new Uint8Array(16),N=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(D.subarray(r))},j=new Uint8Array(32);function L(e,t,r,n,o){let i=e(t,r,j),s=k.create(i);o&&N(s,o),N(s,n);let a=new Uint8Array(16),u=new DataView(a.buffer,a.byteOffset,a.byteLength);y(u,0,BigInt(o?o.length:0),!0),y(u,8,BigInt(n.length),!0),s.update(a);let l=s.digest();return m(i,a),l}let H=e=>(t,r,n)=>(a(t,32),a(r),{encrypt(o,i){let s=o.length,u=s+16;i?a(i,u):i=new Uint8Array(u),e(t,r,o,i,1);let l=L(e,t,r,i.subarray(0,-16),n);return i.set(l,s),m(l),i},decrypt(o,i){let s=o.length,u=s-16;if(s<16)throw Error("encrypted data must be at least 16 bytes");i?a(i,u):i=new Uint8Array(u);let l=o.subarray(0,-16),c=o.subarray(-16),f=L(e,t,r,l,n);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}(c,f))throw Error("invalid tag");return e(t,r,l,i,1),m(f),i}});H(U);let M=((e,t)=>(Object.assign(t,e),t))({blockSize:64,nonceLength:24,tagLength:16},H(C)),$="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function B(){if($&&"object"==typeof $.subtle&&null!=$.subtle)return $.subtle;throw Error("crypto.subtle must be defined")}function W(e){return o(e.nonceLength),(t,...r)=>({encrypt(n,...o){let{nonceLength:i}=e,s=function(e=32){if($&&"function"==typeof $.getRandomValues)return $.getRandomValues(new Uint8Array(e));throw Error("crypto.getRandomValues must be defined")}(i),u=e(t,s,...r).encrypt(n,...o),l=function(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];a(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let o=e[t];r.set(o,n),n+=o.length}return r}(s,u);return u.fill(0),l},decrypt(n,...o){let{nonceLength:i}=e,s=n.subarray(0,i),a=n.subarray(i);return e(t,s,...r).decrypt(a,...o)}})}let K={async encrypt(e,t,r,n){let o=B(),i=await o.importKey("raw",e,t,!0,["encrypt"]);return new Uint8Array(await o.encrypt(r,i,n))},async decrypt(e,t,r,n){let o=B(),i=await o.importKey("raw",e,t,!0,["decrypt"]);return new Uint8Array(await o.decrypt(r,i,n))}},J={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function z(e){return(t,r,n)=>{a(t),a(r);let o={name:e,length:8*t.length},i=function(e,t,r){if(e===J.CBC)return{name:J.CBC,iv:t};if(e===J.CTR)return{name:J.CTR,counter:t,length:64};if(e===J.GCM)if(r)return{name:J.GCM,iv:t,additionalData:r};else return{name:J.GCM,iv:t};throw Error("unknown aes block mode")}(e,r,n);return{encrypt:e=>(a(e),K.encrypt(t,o,i,e)),decrypt:e=>(a(e),K.decrypt(t,o,i,e))}}}z(J.CBC),z(J.CTR),z(J.GCM),r(66175);var F=r(22787),q=r(33351),Y=r(6824),G=r(55784),V=r(5075);let Z=async(e,t,r)=>{let n=await (0,V.A)(e,t,"sign");return(0,G.A)(e,n),new Uint8Array(await Y.A.subtle.sign((0,q.A)(e,n.algorithm),n,r))};var Q=r(20101),X=r(8126),ee=r(52684),et=r(8425),er=r(12651);class en{constructor(e){if(!(e instanceof Uint8Array))throw TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){let r;if(!this._protectedHeader&&!this._unprotectedHeader)throw new X.Ye("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,Q.A)(this._protectedHeader,this._unprotectedHeader))throw new X.Ye("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...this._protectedHeader,...this._unprotectedHeader},o=(0,er.A)(X.Ye,new Map([["b64",!0]]),t?.crit,this._protectedHeader,n),i=!0;if(o.has("b64")&&"boolean"!=typeof(i=this._protectedHeader.b64))throw new X.Ye('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=n;if("string"!=typeof s||!s)throw new X.Ye('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,et.I)(s,e,"sign");let a=this._payload;i&&(a=ee.Rd.encode((0,F.lF)(a))),r=this._protectedHeader?ee.Rd.encode((0,F.lF)(JSON.stringify(this._protectedHeader))):ee.Rd.encode("");let u=(0,ee.xW)(r,ee.Rd.encode("."),a),l=await Z(s,e,u),c={signature:(0,F.lF)(l),payload:""};return i&&(c.payload=ee.D0.decode(a)),this._unprotectedHeader&&(c.header=this._unprotectedHeader),this._protectedHeader&&(c.protected=ee.D0.decode(r)),c}}class eo{constructor(e){this._flattened=new en(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let r=await this._flattened.sign(e,t);if(void 0===r.payload)throw TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}var ei=r(21537),es=r(33382),ea=r(80342);function eu(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}
1class el{constructor(e={}){if(!(0,es.A)(e))throw TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return"number"==typeof e?this._payload={...this._payload,nbf:eu("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:eu("setNotBefore",(0,ei.A)(e))}:this._payload={...this._payload,nbf:(0,ei.A)(new Date)+(0,ea.A)(e)},this}setExpirationTime(e){return"number"==typeof e?this._payload={...this._payload,exp:eu("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:eu("setExpirationTime",(0,ei.A)(e))}:this._payload={...this._payload,exp:(0,ei.A)(new Date)+(0,ea.A)(e)},this}setIssuedAt(e){return void 0===e?this._payload={...this._payload,iat:(0,ei.A)(new Date)}:e instanceof Date?this._payload={...this._payload,iat:eu("setIssuedAt",(0,ei.A)(e))}:"string"==typeof e?this._payload={...this._payload,iat:eu("setIssuedAt",(0,ei.A)(new Date)+(0,ea.A)(e))}:this._payload={...this._payload,iat:eu("setIssuedAt",e)},this}}class ec extends el{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){let r=new eo(ee.Rd.encode(JSON.stringify(this._payload)));if(r.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new X.Dp("JWTs MUST NOT use unencoded payload");return r.sign(e,t)}}async function ef(e,t,r=3600){return await new ec(e).setProtectedHeader({alg:"HS256"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1e3)+r).sign(new TextEncoder().encode(t))}r(2551),r(73227),r(96819);let ed=async({key:e,data:t})=>{let r=await (0,n.n)("SHA-256").digest(e),o=h(t);return function(e){a(e);let t="";for(let r=0;r<e.length;r++)t+=c[e[r]];return t}(W(M)(new Uint8Array(r)).encrypt(o))},eh=async({key:e,data:t})=>{let r=await (0,n.n)("SHA-256").digest(e),o=function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,o=0;t<r;t++,o+=2){let r=d(e.charCodeAt(o)),i=d(e.charCodeAt(o+1));if(void 0===r||void 0===i)throw Error('hex string expected, got non-hex character "'+(e[o]+e[o+1])+'" at index '+o);n[t]=16*r+i}return n}(t),i=W(M)(new Uint8Array(r));return new TextDecoder().decode(i.decrypt(o))}},58760:(e,t,r)=>{"use strict";var n=r(66065);r(8411);let o=n.Ikc({id:n.YjP(),createdAt:n.p6U().default(()=>new Date),updatedAt:n.p6U().default(()=>new Date)});o.extend({providerId:n.YjP(),accountId:n.YjP(),userId:n.auy.string(),accessToken:n.YjP().nullish(),refreshToken:n.YjP().nullish(),idToken:n.YjP().nullish(),accessTokenExpiresAt:n.p6U().nullish(),refreshTokenExpiresAt:n.p6U().nullish(),scope:n.YjP().nullish(),password:n.YjP().nullish()}),o.extend({email:n.YjP().transform(e=>e.toLowerCase()),emailVerified:n.zMY().default(!1),name:n.YjP(),image:n.YjP().nullish()}),o.extend({userId:n.auy.string(),expiresAt:n.p6U(),token:n.YjP(),ipAddress:n.YjP().nullish(),userAgent:n.YjP().nullish()}),o.extend({value:n.YjP(),expiresAt:n.p6U(),identifier:n.YjP()})},61135:(e,t,r)=>{"use strict";r.d(t,{s:()=>s});var n=r(84411),o=r(2551),i=r(66175);let s=(e="SHA-256",t="none")=>{let r={importKey:async(t,r)=>n.aK.importKey("raw","string"==typeof t?new TextEncoder().encode(t):t,{name:"HMAC",hash:{name:e}},!1,[r]),sign:async(e,s)=>{"string"==typeof e&&(e=await r.importKey(e,"sign"));let a=await n.aK.sign("HMAC",e,"string"==typeof s?new TextEncoder().encode(s):s);return"hex"===t?o.u.encode(a):"base64"===t||"base64url"===t||"base64urlnopad"===t?i.z.encode(a,{padding:"base64urlnopad"!==t}):a},verify:async(e,s,a)=>("string"==typeof e&&(e=await r.importKey(e,"verify")),"hex"===t&&(a=o.u.decode(a)),("base64"===t||"base64url"===t||"base64urlnopad"===t)&&(a=await i.K.decode(a)),n.aK.verify("HMAC",e,"string"==typeof a?new TextEncoder().encode(a):a,"string"==typeof s?new TextEncoder().encode(s):s))};return r}},61816:(e,t,r)=>{"use strict";r.d(t,{px:()=>H,Zn:()=>L,tT:()=>j,VY:()=>D,KM:()=>N,NA:()=>x});var n=r(15666);r(64148),r(37978);var o=r(28291),i=r(73227);function s(e){return{newRole:e=>{var t;return{authorize(e,r="AND"){let n=!1;for(let[o,s]of Object.entries(e)){let e=t[o];if(!e)return{success:!1,error:`You are not allowed to access resource: ${o}`};if(Array.isArray(s))n=s.every(t=>e.includes(t));else if("object"==typeof s)n="OR"===s.connector?s.actions.some(t=>e.includes(t)):s.actions.every(t=>e.includes(t));else throw new i.B("Invalid access control request");
1if(n&&"OR"===r)return{success:n};if(!n&&"AND"===r)return{success:!1,error:`unauthorized to access resource "${o}"`}}return n?{success:n}:{success:!1,error:"Not authorized"}},statements:t=e}},statements:e}}let a=s({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),u=a.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"],ac:["create","read","update","delete"]}),l=a.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"],ac:["create","read","update","delete"]}),c=a.newRole({organization:[],member:[],invitation:[],team:[],ac:["read"]}),f={admin:u,owner:l,member:c};r(66065),r(8411),r(77206),r(49614),r(66175),r(61135),r(22279),r(16217),r(58760);let d=async e=>{let t=e.options.roles||f;return h(e,t)},h=(e,t)=>{if(!e.permissions&&!e.permission)return!1;let r=e.role.split(","),n=e.options.creatorRole||"owner",o=r.includes(n),i=e.allowCreatorAllPermissions||!1;if(o&&i)return!0;for(let n of r){let r=t[n],o=r?.authorize(e.permissions??e.permission);if(o?.success)return!0}return!1};function p(e){let t=new Uint8Array(e),r="";for(let e of t)r+=String.fromCharCode(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function y(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,n=atob(t.padEnd(t.length+r,"=")),o=new ArrayBuffer(n.length),i=new Uint8Array(o);for(let e=0;e<n.length;e++)i[e]=n.charCodeAt(e);return o}function g(){return m.stubThis(globalThis?.PublicKeyCredential!==void 0&&"function"==typeof globalThis.PublicKeyCredential)}let m={stubThis:e=>e};function w(e){let{id:t}=e;return{...e,id:y(t),transports:e.transports}}function b(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}class E extends Error{constructor({message:e,code:t,cause:r,name:n}){super(e,{cause:r}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n??r.name,this.code=t}}class A{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}}let v=new A,S=["cross-platform","platform"];function R(e){if(e&&!(0>S.indexOf(e)))return e}async function _(e){let t,r,n,o,i;!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:s,useAutoRegister:a=!1}=e;if(!g())throw Error("WebAuthn is not supported in this browser");let u={...s,challenge:y(s.challenge),user:{...s.user,id:y(s.user.id)},excludeCredentials:s.excludeCredentials?.map(w)},l={};a&&(l.mediation="conditional"),l.publicKey=u,l.signal=v.createNewAbortSignal();try{t=await navigator.credentials.create(l)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new E({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(r.authenticatorSelection?.requireResidentKey===!0)return new E({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&r.authenticatorSelection?.userVerification==="required")return new E({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if(r.authenticatorSelection?.userVerification==="required")return new E({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new E({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new E({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new E(0===r.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!b(t))return new E({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rp.id!==t)return new E({message:`The RP ID "${r.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new E({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new E({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:l})}if(!t)throw Error("Registration was not completed");let{id:c,rawId:f,response:d,type:h}=t;if("function"==typeof d.getTransports&&(n=d.getTransports()),"function"==typeof d.getPublicKeyAlgorithm)try{o=d.getPublicKeyAlgorithm()}catch(e){T("getPublicKeyAlgorithm()",e)}if("function"==typeof d.getPublicKey)try{let e=d.getPublicKey();null!==e&&(i=p(e))}catch(e){T("getPublicKey()",e)}if("function"==typeof d.getAuthenticatorData)try{r=p(d.getAuthenticatorData())}catch(e){T("getAuthenticatorData()",e)}return{id:c,rawId:p(f),response:{attestationObject:p(d.attestationObject),clientDataJSON:p(d.clientDataJSON),transports:n,publicKeyAlgorithm:o,publicKey:i,authenticatorData:r},type:h,clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:R(t.authenticatorAttachment)}}function T(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
2`,t)}let O={stubThis:e=>e};async function I(e){let t,r,n;!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});let{optionsJSON:o,useBrowserAutofill:i=!1,verifyBrowserAutofillInput:s=!0}=e;if(!g())throw Error("WebAuthn is not supported in this browser");o.allowCredentials?.length!==0&&(t=o.allowCredentials?.map(w));let a={...o,challenge:y(o.challenge),allowCredentials:t},u={};if(i){if(!await function(){if(!g())return O.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?O.stubThis(new Promise(e=>e(!1))):O.stubThis(e.isConditionalMediationAvailable())}())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&s)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');u.mediation="conditional",a.allowCredentials=[]}u.publicKey=a,u.signal=v.createNewAbortSignal();try{r=await navigator.credentials.get(u)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new E({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new E({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!b(t))return new E({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new E({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new E({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:u})}if(!r)throw Error("Authentication was not completed");let{id:l,rawId:c,response:f,type:d}=r;return f.userHandle&&(n=p(f.userHandle)),{id:l,rawId:p(c),response:{authenticatorData:p(f.authenticatorData),clientDataJSON:p(f.clientDataJSON),signature:p(f.signature),userHandle:n},type:d,clientExtensionResults:r.getClientExtensionResults(),authenticatorAttachment:R(r.authenticatorAttachment)}}let x=e=>({id:"two-factor",$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith("/two-factor/"),signal:"$sessionSignal"}],pathMethods:{"/two-factor/disable":"POST","/two-factor/enable":"POST","/two-factor/send-otp":"PO
2ST","/two-factor/generate-backup-codes":"POST"},fetchPlugins:[{id:"two-factor",name:"two-factor",hooks:{async onSuccess(t){t.data?.twoFactorRedirect&&e?.onTwoFactorRedirect&&await e.onTwoFactorRedirect()}}}]}),k=s({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),P=k.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password","get","update"],session:["list","revoke","delete"]}),U=k.newRole({user:[],session:[]}),C={admin:P,user:U};r(74714),r(58675),r(2551),r(96819),r(11669),r(24403),r(36391),r(25883);let D=e=>{let t=(0,n.e)(!1),r=(0,n.e)(!1),i=(0,n.e)(!1),s={admin:u,member:c,owner:l,...e?.roles};return{id:"organization",$InferServerPlugin:{},getActions:(t,r,n)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>d({role:t.role,options:{ac:e?.ac,roles:s},permissions:t.permissions??t.permission})}}),getAtoms:e=>{let n=(0,o.u)(t,"/organization/list",e,{method:"GET"}),s=(0,o.u)([r],"/organization/get-full-organization",e,()=>({method:"GET"})),a=(0,o.u)([i],"/organization/get-active-member",e,{method:"GET"});return{$listOrg:t,$activeOrgSignal:r,$activeMemberSignal:i,activeOrganization:s,listOrganizations:n,activeMember:a}},pathMethods:{"/organization/get-full-organization":"GET"},atomListeners:[{matcher:e=>"/organization/create"===e||"/organization/delete"===e||"/organization/update"===e,signal:"$listOrg"},{matcher:e=>e.startsWith("/organization"),signal:"$activeOrgSignal"},{matcher:e=>e.startsWith("/organization/set-active"),signal:"$sessionSignal"},{matcher:e=>e.includes("/organization/update-member-role"),signal:"$activeMemberSignal"}]}},N=()=>{let e=(0,n.e)();return{id:"passkey",$InferServerPlugin:{},getActions:t=>((e,{$listPasskeys:t})=>({signIn:{passkey:async(t,r)=>{let n=await e("/passkey/generate-authenticate-options",{method:"POST",body:{email:t?.email}});if(!n.data)return n;try{let o=await I({optionsJSON:n.data,useBrowserAutofill:t?.autoFill});return await e("/passkey/verify-authentication",{body:{response:o},...t?.fetchOptions,...r,method:"POST"})}catch(e){return{data:null,error:{message:"auth cancelled",status:400,statusText:"BAD_REQUEST"}}}}},passkey:{addPasskey:async(r,n)=>{let o=await e("/passkey/generate-register-options",{method:"GET",query:{...r?.authenticatorAttachment&&{authenticatorAttachment:r.authenticatorAttachment},...r?.name&&{name:r.name}}});if(!o.data)return o;try{let i=await _({optionsJSON:o.data,useAutoRegister:r?.useAutoRegister}),s=await e("/passkey/verify-registration",{...r?.fetchOptions,...n,body:{response:i,name:r?.name},method:"POST"});if(!s.data)return s;t.set(Math.random())}catch(e){if(e instanceof E){if("ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"===e.code)return{data:null,error:{message:"previously registered",status:400,statusText:"BAD_REQUEST"}};if("ERROR_CEREMONY_ABORTED"===e.code)return{data:null,error:{message:"registration cancelled",status:400,statusText:"BAD_REQUEST"}};return{data:null,error:{message:e.message,status:400,statusText:"BAD_REQUEST"}}}return{data:null,error:{message:e instanceof Error?e.message:"unknown error",status:500,statusText:"INTERNAL_SERVER_ERROR"}}}}},$Infer:{}}))(t,{$listPasskeys:e}),getAtoms:t=>({listPasskeys:(0,o.u)(e,"/passkey/list-user-passkeys",t,{method:"GET"}),$listPasskeys:e}),pathMethods:{"/passkey/register":"POST","/passkey/authenticate":"POST"},atomListeners:[{matcher:e=>"/passkey/verify-registration"===e||"/passkey/delete-passkey"===e||"/passkey/update-passkey"===e,signal:"_listPasskeys"}]}},j=()=>({id:"magic-link",$InferServerPlugin:{}}),L=e=>({id:"additional-fields-client",$InferServerPlugin:{}}),H=e=>{let t={admin:P,user:U,...e?.roles};return{id:"admin-client",$InferServerPlugin:{},getActions:()=>({admin:{checkRolePermission:r=>(e=>{if(e.userId&&e.options?.adminUserIds?.includes(e.userId))return!0;if(!e.permissions&&!e.permission)return!1;let t=(e.role||e.options?.defaultRole||"user").split(","),r=e.options?.roles||C;for(let n of t){let t=r[n],o=t?.authorize(e.permission??e.permissions);if(o?.success)return!0}return!1})({role:r.role,options:{ac:e?.ac,roles:t},permissions:r.permissions??r.permission})}}),pathMethods:{"/admin/list-users":"GET","/admin/stop-impersonating":"POST"}}}},64148:(e,t,r)=>{"use strict";r.d(t,{Hy:()=>_,zZ:()=>T});var n=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,l=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c=(e,t)=>{for(var r in t||(t={}))a.call(t,r)&&l(e,r,t[r]);if(s)for(var r of s(t))u.call(t,r)&&l(e,r,t[r]);return e},f=(e,t)=>
2o(e,i(t)),d=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},h=async(e,t)=>{var r,n,o,i,s,a;let u=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:u,hooks:l};for(let c of(null==t?void 0:t.plugins)||[]){if(c.init){let n=await (null==(r=c.init)?void 0:r.call(c,e.toString(),t));u=n.options||u,e=n.url}l.onRequest.push(null==(n=c.hooks)?void 0:n.onRequest),l.onResponse.push(null==(o=c.hooks)?void 0:o.onResponse),l.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),l.onError.push(null==(s=c.hooks)?void 0:s.onError),l.onRetry.push(null==(a=c.hooks)?void 0:a.onRetry)}return{url:e,options:u,hooks:l}},p=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}},y=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)}},g=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=r(e.auth.username),o=r(e.auth.password);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if("Custom"===e.auth.type){let n=r(e.auth.value);if(!n)return t;t.authorization=`${r(e.auth.prefix)} ${n}`}}return t},m=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function w(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 b(e){try{return JSON.parse(e)}catch(t){return e}}function E(e){return"function"==typeof e}async function A(e){let t=new Headers(null==e?void 0:e.headers);for(let[r,n]of Object.entries(await g(e)||{}))t.set(r,n);if(!t.has("content-type")){let r=w(null==e?void 0:e.body)?"application/json":null;r&&t.set("content-type",r)}return t}var v=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function S(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new v(r.issues);return r.value}var R=["get","post","put","patch","delete"],_=e=>async function(t,r){let n,o=f(c(c({},e),r),{plugins:[...(null==e?void 0:e.plugins)||[],(n=e||{},{id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(e,t){var r,o,i,s;let a=(null==(o=null==(r=n.plugins)?void 0:r.find(t=>{var r;return null!=(r=t.schema)&&!!r.config&&(e.startsWith(t.schema.config.baseURL||"")||e.startsWith(t.schema.config.prefix||""))}))?void 0:o.schema)||n.schema;if(a){let r=e;(null==(i=a.config)?void 0:i.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==(s=a.config)?void 0:s.baseURL)&&r.startsWith(a.config.baseURL)&&(r=r.replace(a.config.baseURL,""));let n=a.schema[r];if(n){let r=f(c({},t),{method:n.method,output:n.output});return(null==t?void 0:t.disableValidation)||(r=f(c({},r),{body:n.input?await S(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await S(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await S(n.query,null==t?void 0:t.query):null==t?void 0:t.query})),{url:e,options:r}}}return{url:e,options:t}}})]});if(null==e?void 0:e.catchAllError)try{return await T(t,o)}catch(e){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:e}}}return await T(t,o)},T=async(e,t)=>{var r,n,o,i,s,a,u,l;let{hooks:g,url:v,options:_}=await h(e,t),O=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&E(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&E(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(_),I=new AbortController,x=null!=(r=_.signal)?r:I.signal,k=function(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let t=e.toString().split("@")[1].split("/")[0];R.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[s,a]=e.replace(i,"").split("?"),u=new URLSearchParams(a);for(let[e,t]of Object.entries(o||{}))null!=t&&u.set(e,String(t));if(n)if(Array.isArray(n))for(let[e,t]of s.split("/").filter(e=>e.startsWith(":")).entries()){let r=n[e];s=s.replace(t,r)}else for(let[e,t]of Object.entries(n))s=s.replace(`:${e}`,String(t));(s=s.split("/").map(encodeURIComponent).join("/")).startsWith("/")&&(s=s.slice(1));let l=u.toString();return(l=l.length>0?`?${l}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${s}${l}`,i):`${i}${s}${l}`}(v,_),P=function(e){if(!(null==e?void 0:e.body))return null;let t=new Headers(null==e?void 0:e.headers);if(w(e.body)&&!t.has("content-type")){for(let[t,r]of Object.entries(null==e?void 0:e.body))r instanceof Date&&(e.body[t]=r.toISOString());return JSON.stringify(e.body)}return e.body}(_),U=await A(_),C=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 R.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(v,_),D=f(c({},_),{url:k,headers:U,body:P,method:C,signal:x});for(let e of g.onRequest)if(e){let t=await e(D);t instanceof Object&&(D=t)}("pipeTo"in D&&"function"==typeof D.pipeTo||"function"==typeof(null==(n=null==t?void 0:t.body)?void 0:n.pi
2pe))&&!("duplex"in D)&&(D.duplex="half");let{clearTimeout:N}=function(e,t){let r;return!(null==e?void 0:e.signal)&&(null==e?void 0:e.timeout)&&(r=setTimeout(()=>null==t?void 0:t.abort(),null==e?void 0:e.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}(_,I),j=await O(D.url,D);N();let L={response:j,request:D};for(let e of g.onResponse)if(e){let r=await e(f(c({},L),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?j.clone():j}));r instanceof Response?j=r:r instanceof Object&&(j=r.response)}if(j.ok){if("HEAD"===D.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 m.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}(j),r={data:"",response:j,request:D};if("json"===e||"text"===e){let e=await j.text(),t=null!=(i=D.jsonParser)?i:b;r.data=await t(e)}else r.data=await j[e]();for(let e of((null==D?void 0:D.output)&&D.output&&!D.disableValidation&&(r.data=await S(D.output,r.data)),g.onSuccess))e&&await e(f(c({},r),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?j.clone():j}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let H=null!=(a=null==t?void 0:t.jsonParser)?a:b,M=await j.text(),$=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(M),B=$?await H(M):null,W={response:j,responseText:M,request:D,error:f(c({},B),{status:j.status,statusText:j.statusText})};for(let e of g.onError)e&&await e(f(c({},W),{response:(null==(u=null==t?void 0:t.hookOptions)?void 0:u.cloneResponse)?j.clone():j}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new p({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new p(e);case"exponential":return new y(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(l=t.retryAttempt)?l:0;if(await r.shouldAttemptRetry(n,j)){for(let e of g.onRetry)e&&await e(L);let o=r.getDelay(n);return await new Promise(e=>setTimeout(e,o)),await T(e,f(c({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new d(j.status,j.statusText,$?B:M);return{data:null,error:f(c({},B),{status:j.status,statusText:j.statusText})}}},66065:(e,t,r)=>{"use strict";r.d(t,{YOg:()=>n.array,zMY:()=>n.boolean,auy:()=>n.coerce,p6U:()=>n.date,Rpp:()=>n.email,k5n:()=>n.enum,aig:()=>n.number,Ikc:()=>n.object,lqM:()=>n.optional,bpZ:()=>n.safeParseAsync,YjP:()=>n.string,blZ:()=>n.toJSONSchema,z:()=>n});var n=r(75249)},66175:(e,t,r)=>{"use strict";function n(e){return e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}function o(e,t,r){let n="",o=0,i=0;for(let r of e)for(o=o<<8|r,i+=8;i>=6;)i-=6,n+=t[o>>i&63];if(i>0&&(n+=t[o<<6-i&63]),r){let e=(4-n.length%4)%4;n+="=".repeat(e)}return n}function i(e,t){let r=new Map;for(let e=0;e<t.length;e++)r.set(t[e],e);let n=[],o=0,i=0;for(let t of e){if("="===t)break;let e=r.get(t);if(void 0===e)throw Error(`Invalid Base64 character: ${t}`);o=o<<6|e,(i+=6)>=8&&(i-=8,n.push(o>>i&255))}return Uint8Array.from(n)}r.d(t,{K:()=>s,z:()=>a});let s={encode(e,t={}){let r=n(!1);return o("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=n(e.includes("-")||e.includes("_"));return i(e,t)}},a={encode(e,t={}){let r=n(!0);return o("string"==typeof e?new TextEncoder().encode(e):new Uint8Array(e),r,t.padding??!0)},decode(e){let t=n(e.includes("-")||e.includes("_"));return i(e,t)}}},68069:(e,t,r)=>{"use strict";r.d(t,{A:()=>o,g:()=>i});var n=r(6824);let o=e=>!!(0,n.R)(e)||e?.[Symbol.toStringTag]==="KeyObject",i=["CryptoKey"]},73227:(e,t,r)=>{"use strict";r.d(t,{B:()=>n});class n extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}}},73541:(e,t,r)=>{"use strict";r.d(t,{i:()=>a});var n=r(46023),o=r(52684),i=r(33382),s=r(8126);function a(e){let t,r;if("string"!=typeof e)throw new s.Dp("JWTs must use Compact JWS serialization, JWT must be a string");let{1:a,length:u}=e.split(".");if(5===u)throw new s.Dp("Only JWTs using Compact JWS serialization can be decoded");
2if(3!==u)throw new s.Dp("Invalid JWT");if(!a)throw new s.Dp("JWTs must contain a payload");try{t=(0,n.D)(a)}catch{throw new s.Dp("Failed to base64url decode the payload")}try{r=JSON.parse(o.D0.decode(t))}catch{throw new s.Dp("Failed to parse the decoded payload as JSON")}if(!(0,i.A)(r))throw new s.Dp("Invalid JWT Claims Set");return r}},74420:(e,t,r)=>{"use strict";r.d(t,{MB:()=>h});var n=r(64148),o=r(11669),i=r(15666),s=r(28291);let a={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*:/},u=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,l={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},c=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/,f={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&"undefined"!=typeof window&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};var d=r(73482);function h(e){var t,r;let{pluginPathMethods:h,pluginsActions:p,pluginsAtoms:y,$fetch:g,$store:m,atomListeners:w}=(e=>{let t="credentials"in Request.prototype,r=(0,o.a)(e?.baseURL,e?.basePath),d=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],h={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:p,onError:y,onRequest:g,onResponse:m,...w}=e?.fetchOptions||{},b=(0,n.Hy)({baseURL:r,...t?{credentials:"include"}:{},method:"GET",jsonParser:e=>e?function(e,t={strict:!0}){return function(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if("string"!=typeof e)return e;let s=e.trim();if('"'===s[0]&&s.endsWith('"')&&!s.slice(1,-1).includes('"'))return s.slice(1,-1);let f=s.toLowerCase();if(f.length<=9&&f in l)return l[f];if(!u.test(s)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(a).some(([e,t])=>{let r=t.test(s);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(s,(e,t)=>{if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){n&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(i&&"string"==typeof t){let e=function(e){let t=c.exec(e);if(!t)return null;let[,r,n,o,i,s,a,u,l,f,d]=t,h=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(s,10),parseInt(a,10),u?parseInt(u.padEnd(3,"0"),10):0));if(l){let e=(60*parseInt(f,10)+parseInt(d,10))*("+"===l?-1:1);h.setUTCMinutes(h.getUTCMinutes()+e)}return h instanceof Date&&!isNaN(h.getTime())?h:null}(t);if(e)return e}return o?o(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:fetch,...w,plugins:[h,...w.plugins||[],...e?.disableDefaultFetchPlugins?[]:[f],...d]}),{$sessionSignal:E,session:A}=function(e){let t=(0,i.e)(!1);return{session:(0,s.u)(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}(b),v=e?.plugins||[],S={},R={$sessionSignal:E,session:A},_={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},T=[{signal:"$sessionSignal",matcher:e=>"/sign-out"===e||"/update-user"===e||e.startsWith("/sign-in")||e.startsWith("/sign-up")||"/delete-user"===e||"/verify-email"===e}];for(let e of v)e.getAtoms&&Object.assign(R,e.getAtoms?.(b)),e.pathMethods&&Object.assign(_,e.pathMethods),e.atomListeners&&T.push(...e.atomListeners);let O={notify:e=>{R[e].set(!R[e].get())},listen:(e,t)=>{R[e].subscribe(t)},atoms:R};for(let t of v)t.getActions&&Object.assign(S,t.getActions?.(b,O,e));return{pluginsActions:S,pluginsAtoms:R,pluginPathMethods:_,atomListeners:T,$fetch:b,$store:O}})(e),b={};for(let[e,t]of Object.entries(y)){b[`use${(r=e).charAt(0).toUpperCase()+r.slice(1)}`]=()=>(function(e,t={}){let r=(0,d.useRef)(e.get()),{keys:n,deps:o=[e,n]}=t,i=(0,d.useCallback)(t=>{let o=e=>{r.current!==e&&(r.current=e,t())};if(o(e.value),n?.length){let t;return t=new Set(n).add(void 0),e.listen((e,r,n)=>{t.has(n)&&o(e,r,n)})}return e.listen(o)},o),s=()=>r.current;return(0,d.useSyncExternalStore)(i,s,s)})(t)}return t={...p,...b,$fetch:g,$store:m},function e(r=[]){return new Proxy(function(){},{get(n,o){var i;if("then"===o||"catch"===o||"finally"===o)return;let s=[...r,o],a=t;for(let e of s)if(a&&"object"==typeof a&&e in a)a=a[e];else{a=void 0;break}return"function"==typeof a?a:"object"==typeof(i=a)&&null!==i&&"get"in i&&"function"==typeof i.get&&"lc"in i&&"number"==typeof i.lc?a:e(s)},apply:async(e,t,n)=>{let o="/"+r.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join("/"),i=n[0]||{},s=n[1]||{},{query:a,fetchOptions:u,...l}=i,c={...s,...u},f=function(e,t,r){let n=t[e],{fetchOptions:o,query:i,...s}=r||{};return n||(o?.method?o.method:s&&Object.keys(s).length>0?"POST":"GET")}(o,h,i);return await g(o,{...c,body:"GET"===f?void 0:{...l,...c?.body||{}},query:a||c?.query,method:f,async onSuccess(e){await c?.onSuccess?.(e);let t=w?.find(e=>e.matcher(o));if(!t)return;let r=y[t.signal];if(!r)return;let n=r.get();setTimeout(()=>{r.set(!n)},10)}})}})}()}r(37978),r(73227)},74714:(e,t,r)=>{"use strict";r.d(t,{n:()=>i});var n=r(84411),o=r(66175);function i(e,t){return{digest:async r=>{let i=new TextEncoder,s="string"==typeof r?i.encode(r):r,a=await n.aK.digest(e,s);return"hex"===t?Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join(""):"base64"===t||"base64url"===t||"base64urlnopad"===t?t.includes("url")?o.z.encode(a,{padding:"base64urlnopad"!==t}):o.K.encode(a):a}}}},80165:e=>{!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,i=u(e),s=i[0],a=i[1],l=new o((s+a)*3/4-a),c=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;s<a;s+=16383)i.push(function(e,t,n){for(var o,i=[],s=t;s<n;s+=3)o=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),i.push(r[o>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}(e,s,s+16383>a?a:s+16383));return 1===o?i.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===o&&i.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
2+/",s=0,a=i.length;s<a;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),o=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e){var n=e,o=t;if(("string"!=typeof o||""===o)&&(o="utf8"),!a.isEncoding(o))throw TypeError("Unknown encoding: "+o);var i=0|h(n,o),u=s(i),l=u.write(n,o);return l!==i&&(u=u.slice(0,l)),u}if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,r);var p=function(e){if(a.isBuffer(e)){var t=0|d(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(p)return p;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),s(e<0?0:0|d(e))}function f(e){for(var t=e.length<0?0:0|d(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return _(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(o)return n?-1:_(e).length;t=(""+t).toLowerCase(),o=!0}}function p(e,t,r){var o,i,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=k[e[i]];return o}(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}(this,t,r);case"base64":return o=this,i=t,s=r,0===i&&s===o.length?n.fromByteArray(o):n.fromByteArray(o.slice(i,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){var i;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(o)return -1;else r=e.length-1;else if(r<0)if(!o)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(
vendor: 12,881 bytes, line 2
2o)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return m(e,[t],r,n,o)}throw TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,a/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(l(e,i)===l(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else -1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var f=!0,d=0;d<u;d++)if(l(e,i+d)!==l(t,d)){f=!1;break}if(f)return i}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(x(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(x(i,Uint8Array)&&(i=a.from(i)),!a.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},a.byteLength=h,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?w(this,0,e):p.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(x(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var i=o-n,s=r-t,u=Math.min(i,s),l=this.slice(n,o),c=e.slice(t,r),f=0;f<u;++f)if(l[f]!==c[f]){i=l[f],s=c[f];break}return i<s?-1:+(s<i)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function w(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,u,l=e[o],c=null,f=l>239?4:l>223?3:l>191?2:1;if(o+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:(192&(i=e[o+1]))==128&&(u=(31&l)<<6|63&i)>127&&(c=u);break;case 3:i=e[o+1],s=e[o+2],(192&i)==128&&(192&s)==128&&(u=(15&l)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],(192&i)==128&&(192&s)==128&&(192&a)==128&&(u=(15&l)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}var d=n,h=d.length;if(h<=4096)return String.fromCharCode.apply(String,d);for(var p="",y=0;y<h;)p+=String.fromCharCode.apply(String,d.slice(y,y+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function E(e,t,r,n,o,i){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function A(e,t,r,n,o,i){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function v(e,t,r,n,i){return t*=1,r>>>=0,i||A(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function S(e,t,r,n,i){return t*=1,r>>>=0,i||A(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,i,s,a,u,l,c,f,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var h=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a,u=parseInt(t.substr(2*s,2),16);if((a=u)!=a)break;e[r+s]=u}return s}(this,e,t,r);case"utf8":case"utf-8":return o=t,i=r,I(_(e,this.length-o),this,o,i);case"ascii":return s=t,a=r,I(T(e),this,s,a);case"latin1":case"binary":return function(e,t,r,n){return I(T(t),e,r,n)}(this,e,t,r);case"base64":return u=t,l=r,I(O(e),this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,f=r,I(function(e,t){for(var r,n,o=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o}(e,this.length-c),this,c,f);default:if(h)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),h=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),o.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),o.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),o.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),o.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;E(this,e,t,r,o,0)}var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;E(this,e,t,r,o,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var o=Math.pow(2,8*r-1);E(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var o=Math.pow(2,8*r-1);E(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||E(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return v(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return v(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=o-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var o,i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;
2if(0===u)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%u]}return this};var R=/[^+/0-9A-Za-z-_]/g;function _(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319||s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function T(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function O(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length)&&!(o>=e.length);++o)t[o+r]=e[o];return o}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var k=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},783:function(e,t){t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,f=r?o-1:0,d=r?-1:1,h=e[t+f];for(f+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;c>0;i=256*i+e[t+f],f+=d,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+e[t+f],f+=d,c-=8);if(0===i)i=1-l;else{if(i===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),i-=l}return(h?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,u,l=8*i-o-1,c=(1<<l)-1,f=c>>1,d=5960464477539062e-23*(23===o),h=n?0:i-1,p=n?1:-1,y=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+f>=1?t+=d/u:t+=d*Math.pow(2,1-f),t*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(t*u-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[r+h]=255&a,h+=p,a/=256,o-=8);for(s=s<<o|a,l+=o;l>0;e[r+h]=255&s,h+=p,s/=256,l-=8);e[r+h-p]|=128*y}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}},s=!0;try{t[e](i,i.exports,n),s=!1}finally{s&&delete r[e]}return i.exports}n.ab="//",e.exports=n(72)}()},80342:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let n=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,o=e=>{let t,r=n.exec(e);if(!r||r[4]&&r[1])throw TypeError("Invalid time period format");let o=parseFloat(r[2]);switch(r[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":t=Math.round(o);break;case"minute":case"minutes":case"min":case"mins":case"m":t=Math.round(60*o);break;case"hour":case"hours":case"hr":case"hrs":case"h":t=Math.round(3600*o);break;case"day":case"days":case"d":t=Math.round(86400*o);break;case"week":case"weeks":case"w":t=Math.round(604800*o);break;default:t=Math.round(0x1e187e0*o)}return"-"===r[1]||"ago"===r[4]?-t:t}},80701:(e,t,r)=>{"use strict";r.d(t,{Og:()=>a});var n=r(22787),o=r(97493),i=r(8126),s=r(33382);async function a(e,t){if(!(0,s.A)(e))throw TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw TypeError('missing "k" (Key Value) Parameter value');return(0,n.D4)(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new i.T0('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,o.A)({...e,alg:t});default:throw new i.T0('Unsupported "kty" (Key Type) Parameter value')}}},84411:(e,t,r)=>{"use strict";r.d(t,{UY:()=>i,aK:()=>o});let n=globalThis.crypto,o=n.subtle,i=e=>n.getRandomValues(e)},86490:(e,t,r)=>{"use strict";r.d(t,{_:()=>s});var n=r(46023),o=r(52684),i=r(33382);function s(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");try{if("string"!=typeof t||!t)throw Error();let e=JSON.parse(o.D0.decode((0,n.D)(t)));if(!(0,i.A)(e))throw Error();return e}catch{throw TypeError("Invalid Token or Protected Header formatting")}}},88564:(e,t,r)=>{"use strict";r.d(t,{V:()=>v});var n=r(22787),o=r(33351),i=r(6824),s=r(55784),a=r(5075);let u=async(e,t,r,n)=>{let u=await (0,a.A)(e,t,"verify");(0,s.A)(e,u);let l=(0,o.A)(e,u.algorithm);try{return await i.A.subtle.verify(l,u,r,n)}catch{return!1}};var l=r(8126),c=r(52684),f=r(20101),d=r(33382),h=r(8425),p=r(12651),y=r(3055),g=r(80701);async function m(e,t,r){let o,i;if(!(0,d.A)(e))throw new l.Ye("Flattened JWS must be an object");
2if(void 0===e.protected&&void 0===e.header)throw new l.Ye('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new l.Ye("JWS Protected Header incorrect type");if(void 0===e.payload)throw new l.Ye("JWS Payload missing");if("string"!=typeof e.signature)throw new l.Ye("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,d.A)(e.header))throw new l.Ye("JWS Unprotected Header incorrect type");let s={};if(e.protected)try{let t=(0,n.D4)(e.protected);s=JSON.parse(c.D0.decode(t))}catch{throw new l.Ye("JWS Protected Header is invalid")}if(!(0,f.A)(s,e.header))throw new l.Ye("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let a={...s,...e.header},m=(0,p.A)(l.Ye,new Map([["b64",!0]]),r?.crit,s,a),w=!0;if(m.has("b64")&&"boolean"!=typeof(w=s.b64))throw new l.Ye('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:b}=a;if("string"!=typeof b||!b)throw new l.Ye('JWS "alg" (Algorithm) Header Parameter missing or invalid');let E=r&&((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)})("algorithms",r.algorithms);if(E&&!E.has(b))throw new l.Rb('"alg" (Algorithm) Header Parameter value not allowed');if(w){if("string"!=typeof e.payload)throw new l.Ye("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new l.Ye("JWS Payload must be a string or an Uint8Array instance");let A=!1;"function"==typeof t?(t=await t(s,e),A=!0,(0,h.I)(b,t,"verify"),(0,y.ll)(t)&&(t=await (0,g.Og)(t,b))):(0,h.I)(b,t,"verify");let v=(0,c.xW)(c.Rd.encode(e.protected??""),c.Rd.encode("."),"string"==typeof e.payload?c.Rd.encode(e.payload):e.payload);try{o=(0,n.D4)(e.signature)}catch{throw new l.Ye("Failed to base64url decode the signature")}if(!await u(b,t,o,v))throw new l.h2;if(w)try{i=(0,n.D4)(e.payload)}catch{throw new l.Ye("Failed to base64url decode the payload")}else i="string"==typeof e.payload?c.Rd.encode(e.payload):e.payload;let S={payload:i};return(void 0!==e.protected&&(S.protectedHeader=s),void 0!==e.header&&(S.unprotectedHeader=e.header),A)?{...S,key:t}:S}async function w(e,t,r){if(e instanceof Uint8Array&&(e=c.D0.decode(e)),"string"!=typeof e)throw new l.Ye("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:s}=e.split(".");if(3!==s)throw new l.Ye("Invalid Compact JWS");let a=await m({payload:o,protected:n,signature:i},t,r),u={payload:a.payload,protectedHeader:a.protectedHeader};return"function"==typeof t?{...u,key:a.key}:u}var b=r(21537),E=r(80342);let A=e=>e.toLowerCase().replace(/^application\//,"");async function v(e,t,r){let n=await w(e,t,r);if(n.protectedHeader.crit?.includes("b64")&&!1===n.protectedHeader.b64)throw new l.Dp("JWTs MUST NOT use unencoded payload");let o={payload:((e,t,r={})=>{let n,o,i,s;try{n=JSON.parse(c.D0.decode(t))}catch{}if(!(0,d.A)(n))throw new l.Dp("JWT Claims Set must be a top-level JSON object");let{typ:a}=r;if(a&&("string"!=typeof e.typ||A(e.typ)!==A(a)))throw new l.ie('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:u=[],issuer:f,subject:h,audience:p,maxTokenAge:y}=r,g=[...u];for(let e of(void 0!==y&&g.push("iat"),void 0!==p&&g.push("aud"),void 0!==h&&g.push("sub"),void 0!==f&&g.push("iss"),new Set(g.reverse())))if(!(e in n))throw new l.ie(`missing required "${e}" claim`,n,e,"missing");if(f&&!(Array.isArray(f)?f:[f]).includes(n.iss))throw new l.ie('unexpected "iss" claim value',n,"iss","check_failed");if(h&&n.sub!==h)throw new l.ie('unexpected "sub" claim value',n,"sub","check_failed");if(p&&(i=n.aud,s="string"==typeof p?[p]:p,"string"==typeof i?!s.includes(i):!(!!Array.isArray(i)&&s.some(Set.prototype.has.bind(new Set(i))))))throw new l.ie('unexpected "aud" claim value',n,"aud","check_failed");switch(typeof r.clockTolerance){case"string":o=(0,E.A)(r.clockTolerance);break;case"number":o=r.clockTolerance;break;case"undefined":o=0;break;default:throw TypeError("Invalid clockTolerance option type")}let{currentDate:m}=r,w=(0,b.A)(m||new Date);if((void 0!==n.iat||y)&&"number"!=typeof n.iat)throw new l.ie('"iat" claim must be a number',n,"iat","invali
2d");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new l.ie('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>w+o)throw new l.ie('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new l.ie('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=w-o)throw new l.n('"exp" claim timestamp check failed',n,"exp","check_failed")}if(y){let e=w-n.iat;if(e-o>("number"==typeof y?y:(0,E.A)(y)))throw new l.n('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-o)throw new l.ie('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n})(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return"function"==typeof t?{...o,key:n.key}:o}},96819:(e,t,r)=>{"use strict";r.d(t,{g:()=>n});let n=(0,r(21071).q)("a-z","0-9","A-Z","-_")},97493:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(6824),o=r(8126);let i=async e=>{if(!e.alg)throw TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=function(e){let t,r;switch(e.kty){case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new o.T0('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new o.T0('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"EdDSA":t={name:e.crv},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new o.T0('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new o.T0('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),i=[t,e.ext??!1,e.key_ops??r],s={...e};return delete s.alg,delete s.use,n.A.subtle.importKey("jwk",s,...i)}},97922:(e,t,r)=>{"use strict";let n;r.d(t,{RD:()=>y});var o=r(8126);let i=async(e,t,r)=>{let n,i,s=!1;"function"==typeof AbortController&&(n=new AbortController,i=setTimeout(()=>{s=!0,n.abort()},t));let a=await fetch(e.href,{signal:n?n.signal:void 0,redirect:"manual",headers:r.headers}).catch(e=>{if(s)throw new o.xb;throw e});if(void 0!==i&&clearTimeout(i),200!==a.status)throw new o.i4("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await a.json()}catch{throw new o.i4("Failed to parse the JSON Web Key Set HTTP response as JSON")}};var s=r(80701),a=r(33382);function u(e){return(0,a.A)(e)}function l(e){return"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}class c{constructor(e){if(this._cached=new WeakMap,!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(u)}(e))throw new o.Dm("JSON Web Key Set malformed");this._jwks=l(e)}async getKey(e,t){let{alg:r,kid:n}={...e,...t?.header},i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new o.T0('Unsupported "alg" value for a JSON Web Key Set')}}(r),s=this._jwks.keys.filter(e=>{let t=i===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":t="Ed25519"===e.crv;break;case"EdDSA":t="Ed25519"===e.crv||"Ed448"===e.crv}return t}),{0:a,length:u}=s;if(0===u)throw new o.BT;if(1!==u){let e=new o.$4,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of s)try{yield await f(t,e,r)}catch{}},e}return f(this._cached,a,r)}}async function f(e,t,r){let n=e.get(t)||e.set(t,{}).get(t);if(void 0===n[r]){let e=await (0,s.Og)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new o.Dm("JSON Web Key Set members must be public keys");n[r]=e}return n[r]}function d(e){let t=new c(e),r=async(e,r)=>t.getKey(e,r);return Object.defineProperties(r,{jwks:{value:()=>l(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),r}"undefined"!=typeof navigator&&navigator.userAgent?.startsWith?.("Mozilla/5.0 ")||(n="jose/v5.10.0");let h=Symbol();class p{constructor(e,t){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:t?.agent,headers:t?.headers},this._timeoutDuration="number"==typeof t?.timeoutDuration?t?.timeoutDuration:5e3,this._cooldownDuration="number"==typeof t?.cooldownDuration?t?.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof t?.cacheMaxAge?t?.cacheMaxAge:6e5,t?.[h]!==void 0&&(this._cache=t?.[h],function(e,t){return!("object"!=typeof e||null===e||!("uat"in e)||"number"!=typeof e.uat||Date.now()-e.uat>=t)&&"jwks"in e&&!!(0,a.A)(e.jwks)&&!!Array.isArray(e.jwks.keys)&&
2!!Array.prototype.every.call(e.jwks.keys,a.A)}(t?.[h],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=d(this._cache.jwks)))}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){this._local&&this.fresh()||await this.reload();try{return await this._local(e,t)}catch(r){if(r instanceof o.BT&&!1===this.coolingDown())return await this.reload(),this._local(e,t);throw r}}async reload(){this._pendingFetch&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);n&&!e.has("User-Agent")&&(e.set("User-Agent",n),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||(this._pendingFetch=i(this._url,this._timeoutDuration,this._options).then(e=>{this._local=d(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e})),await this._pendingFetch}}function y(e,t){let r=new p(e,t),n=async(e,t)=>r.getKey(e,t);return Object.defineProperties(n,{coolingDown:{get:()=>r.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>r.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>r.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!r._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>r._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}}}]);

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.