1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8009],{18444:(e,t,r)=>{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}},21390:(e,t,r)=>{r.d(t,{px:()=>$,Zn:()=>x,tT:()=>D,VY:()=>C,KM:()=>k,NA:()=>_});var n=r(18444);r(83390),r(46360);var o=r(39757),i=r(36967);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");if(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"]}),l=a.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"]}),u=a.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"]}),c=a.newRole({organization:[],member:[],invitation:[],team:[]}),d={admin:l,owner:u,member:c};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 f(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 h(){return g.stubThis(globalThis?.PublicKeyCredential!==void 0&&"function"==typeof globalThis.PublicKeyCredential)}let g={stubThis:e=>e};function m(e){let{id:t}=e;return{...e,id:f(t),transports:e.transports}}function y(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}class w 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 R{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 b=new R,v=["cross-platform","platform"];function E(e){if(e&&!(0>v.indexOf(e)))return e}async function T(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(!h())throw Error("WebAuthn is not supported in this browser");let l={...s,challenge:f(s.challenge),user:{...s.user,id:f(s.user.id)},excludeCredentials:s.excludeCredentials?.map(m)},u={};a&&(u.mediation="conditional"),u.publicKey=l,u.signal=b.createNewAbortSignal();try{t=await navigator.credentials.create(u)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new w({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 w({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 w({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 w({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 w({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new w({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new w(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(!y(t))return new w({message:`${globalThis.location.hostname}
1 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rp.id!==t)return new w({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 w({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 w({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:u})}if(!t)throw Error("Registration was not completed");let{id:c,rawId:d,response:g,type:R}=t;if("function"==typeof g.getTransports&&(n=g.getTransports()),"function"==typeof g.getPublicKeyAlgorithm)try{o=g.getPublicKeyAlgorithm()}catch(e){A("getPublicKeyAlgorithm()",e)}if("function"==typeof g.getPublicKey)try{let e=g.getPublicKey();null!==e&&(i=p(e))}catch(e){A("getPublicKey()",e)}if("function"==typeof g.getAuthenticatorData)try{r=p(g.getAuthenticatorData())}catch(e){A("getAuthenticatorData()",e)}return{id:c,rawId:p(d),response:{attestationObject:p(g.attestationObject),clientDataJSON:p(g.clientDataJSON),transports:n,publicKeyAlgorithm:o,publicKey:i,authenticatorData:r},type:R,clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:E(t.authenticatorAttachment)}}function A(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 S(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(!h())throw Error("WebAuthn is not supported in this browser");o.allowCredentials?.length!==0&&(t=o.allowCredentials?.map(m));let a={...o,challenge:f(o.challenge),allowCredentials:t},l={};if(i){if(!await function(){if(!h())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');l.mediation="conditional",a.allowCredentials=[]}l.publicKey=a,l.signal=b.createNewAbortSignal();try{r=await navigator.credentials.get(l)}catch(e){throw function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new w({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new w({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=globalThis.location.hostname;if(!y(t))return new w({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new w({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 w({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return e}({error:e,options:l})}if(!r)throw Error("Authentication was not completed");let{id:u,rawId:c,response:d,type:g}=r;return d.userHandle&&(n=p(d.userHandle)),{id:u,rawId:p(c),response:{authenticatorData:p(d.authenticatorData),clientDataJSON:p(d.clientDataJSON),signature:p(d.signature),userHandle:n},type:g,clientExtensionResults:r.getClientExtensionResults(),authenticatorAttachment:E(r.authenticatorAttachment)}}let _=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()}}}]}),P=s({user:["create","list","set-role","ban","impersonate","delete","set-password"],session:["list","revoke","delete"]}),I=P.newRole({user:["create","list","set-role","ban","impersonate","delete","set-password"],session:["list","revoke","delete"]}),U=P.newRole({user:[],session:[]}),N={admin:I,user:U},C=e=>{let t=(0,n.e)(!1),r=(0,n.e)(!1),i=(0,n.e)(!1),s={admin:l,member:c,owner:u,...e?.roles};return{id:"organization",$InferServerPlugin:{},getActions:t=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>(e=>{if(!e.permissions&&!e.permission)return!1;let t=e.role.split(","),r=e.options.roles||d;for(let n of t){let t=r[n],o=t?.authorize(e.permissions??e.permission);if(o?.success)return!0}return!1})({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"}]}},k=()=>{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 S({optionsJSON:n.data,useBrowserAutofill:t?.autoFill}),i=await e("/passkey/verify-authentication",{body:{response:o},...t?.fetchOptions,...r,method:"POST"});if(!i.data)return i}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}}});if(!o.data)return o;try{let i=await T({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 w){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"}]}},D=()=>({id:"magic-link",$InferServerPlugin:{}}),x=e=>({id:"additional-fields-client",$InferServerPlugin:{}}),$=e=>{let t={admin:I,user:U,...e?.roles};return{id:"admin-client",$InferServerPlugin:{},getActions:r=>({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||N;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"}}}},26710:(e,t,r)=>{r.d(t,{MB:()=>g});var n=r(83390),o=r(46360),i=r(36967);function s(e,t="/api/auth"){return!function(e){try{let t=new URL(e);return"/"!==t.pathname}catch(t){throw new i.B(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}(e)?(t=t.startsWith("/")?t:`/${t}`,`${e.replace(/\/+$/,"")}${t}`):e}var a=r(18444),l=r(39757);let u={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*:/},c=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,d={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},p=/^(\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 h=r(27523);function g(e){var t,r;let{pluginPathMethods:g,pluginsActions:m,pluginsAtoms:y,$fetch:w,$store:R,atomListeners:b}=(e=>{let t="credentials"in Request.prototype,r=function(e,t,r){if(e)return s(e,t);let n=o.e.BETTER_AUTH_URL||o.e.NEXT_PUBLIC_BETTER_AUTH_URL||o.e.PUBLIC_BETTER_AUTH_URL||o.e.NUXT_PUBLIC_BETTER_AUTH_URL||o.e.NUXT_PUBLIC_AUTH_URL||("/"!==o.e.BASE_URL?o.e.BASE_URL:void 0);if(n)return s(n,t);let a=void 0,l=void 0;if(a&&l)return s(`${l}://${a}`,t);if(r){let e=function(e){try{return new URL(e).origin}catch(e){return null}}(r.url);if(!e)throw new i.B("Could not get origin from request. Please provide a valid base URL.");return s(e,t)}if("undefined"!=typeof window&&window.location)return s(window.location.origin,t)}(e?.baseURL,e?.basePath),h=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>void 0!==e)||[],g=(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 a=s.toLowerCase();if(a.length<=9&&a in d)return d[a];
2if(!c.test(s)){if(r)throw SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(u).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=p.exec(e);if(!t)return null;let[,r,n,o,i,s,a,l,u,c,d]=t,f=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(s,10),parseInt(a,10),l?parseInt(l.padEnd(3,"0"),10):0));if(u){let e=(60*parseInt(c,10)+parseInt(d,10))*("+"===u?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return f instanceof Date&&!isNaN(f.getTime())?f:null}(t);if(e)return e}return o?o(e,t):t})}catch(t){if(r)throw t;return e}}(e,t)}(e,{strict:!1}):null,customFetchImpl:async(e,t)=>{try{return await fetch(e,t)}catch(e){return Response.error()}},...e?.fetchOptions,plugins:e?.disableDefaultFetchPlugins?[...e?.fetchOptions?.plugins||[],...h]:[f,...e?.fetchOptions?.plugins||[],...h]}),{$sessionSignal:m,session:y}=function(e){let t=(0,a.e)(!1);return{session:(0,l.u)(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}(g),w=e?.plugins||[],R={},b={$sessionSignal:m,session:y},v={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},E=[{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 w)e.getAtoms&&Object.assign(b,e.getAtoms?.(g)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&E.push(...e.atomListeners);let T={notify:e=>{b[e].set(!b[e].get())},listen:(e,t)=>{b[e].subscribe(t)},atoms:b};for(let t of w)t.getActions&&Object.assign(R,t.getActions?.(g,T,e));return{pluginsActions:R,pluginsAtoms:b,pluginPathMethods:v,atomListeners:E,$fetch:g,$store:T}})(e),v={};for(let[e,t]of Object.entries(y)){v[`use${(r=e).charAt(0).toUpperCase()+r.slice(1)}`]=()=>(function(e,t={}){let r=(0,h.useRef)(e.get()),{keys:n,deps:o=[e,n]}=t,i=(0,h.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,h.useSyncExternalStore)(i,s,s)})(t)}return t={...m,...v,$fetch:w,$store:R},function e(r=[]){return new Proxy(function(){},{get(n,o){let i=[...r,o],s=t;for(let e of i)if(s&&"object"==typeof s&&e in s)s=s[e];else{s=void 0;break}return"function"==typeof s?s:e(i)},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:l,...u}=i,c={...s,...l},d=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,g,i);return await w(o,{...c,body:"GET"===d?void 0:{...u,...c?.body||{}},query:a||c?.query,method:d,async onSuccess(e){await c?.onSuccess?.(e);let t=b?.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)}})}})}()}},36967:(e,t,r)=>{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=""}}},39757:(e,t,r)=>{r.d(t,{u:()=>s});var n=r(18444);let o=(e,t)=>((e,t,r,n)=>(e.events=e.events||{},e.events[15]||(e.events[15]=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:()=>l()}),l=()=>{let e="function"==typeof s?s({data:a.get().data,error:a.get().error,
2isPending:a.get().isPending}):s;return r(t,{...e,async onSuccess(t){a.set({data:t.data,error:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await e?.onSuccess?.(t)},async onError(t){let{request:r}=t,n="number"==typeof r.retry?r.retry:r.retry?.attempts,o=r.retryAttempt||0;n&&o<n||(a.set({error:t.error,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await e?.onError?.(t))},async onRequest(t){let r=a.get();a.set({isPending:null===r.data,data:r.data,error:null,isRefetching:!0,refetch:a.value.refetch}),await e?.onRequest?.(t)}})};e=Array.isArray(e)?e:[e];let u=!1;for(let t of e)t.subscribe(()=>{i||(u?l():o(a,()=>(setTimeout(()=>{l()},0),u=!0,()=>{a.off(),t.off()})))});return a}},46360:(e,t,r)=>{r.d(t,{e:()=>a});var n,o=r(93164);let i=Object.create(null),s=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?i:globalThis),a=new Proxy(i,{get:(e,t)=>s()[t]??i[t],has:(e,t)=>t in s()||t in i,set:(e,t,r)=>(s(!0)[t]=r,!0),deleteProperty(e,t){if(!t)return!1;let r=s(!0);return delete r[t],!0},ownKeys:()=>Object.keys(s(!0))});"test"===(void 0!==o&&o.env&&"production"||"")||(n=a.TEST)},83390:(e,t,r)=>{r.d(t,{Hy:()=>O});var n=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,u=(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)&&u(e,r,t[r]);if(s)for(var r of s(t))l.call(t,r)&&u(e,r,t[r]);return e},d=(e,t)=>o(e,i(t)),p=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r}},f=async(e,t)=>{var r,n,o,i,s,a;let l=t||{},u={onRequest:[null==t?void 0:t.onRequest],onResponse:[null==t?void 0:t.onResponse],onSuccess:[null==t?void 0:t.onSuccess],onError:[null==t?void 0:t.onError],onRetry:[null==t?void 0:t.onRetry]};if(!t||!(null==t?void 0:t.plugins))return{url:e,options:l,hooks:u};for(let c of(null==t?void 0:t.plugins)||[]){if(c.init){let n=await (null==(r=c.init)?void 0:r.call(c,e.toString(),t));l=n.options||l,e=n.url}u.onRequest.push(null==(n=c.hooks)?void 0:n.onRequest),u.onResponse.push(null==(o=c.hooks)?void 0:o.onResponse),u.onSuccess.push(null==(i=c.hooks)?void 0:i.onSuccess),u.onError.push(null==(s=c.hooks)?void 0:s.onError),u.onRetry.push(null==(a=c.hooks)?void 0:a.onRetry)}return{url:e,options:l,hooks:u}},h=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}},g=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)}},m=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},y=/^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 R(e){try{return JSON.parse(e)}catch(t){return e}}function b(e){return"function"==typeof e}async function v(e){let t=new Headers(null==e?void 0:e.headers);for(let[r,n]of Object.entries(await m(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 E=class e extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function T(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new E(r.issues);return r.value}var A=["get","post","put","patch","delete"],O=e=>async function(t,r){let n,o=d(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=d(c({},t),{method:n.method,output:n.output});return(null==t?void 0:t.disableValidation)||(r=d(c({},r),{body:n.input?await T(n.input,null==t?void 0:t.body):null==t?void 0:t.body,params:n.params?await T(n.params,null==t?void 0:t.params):null==t?void 0:t.params,query:n.query?await T(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 S(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 S(t,o)},S=async(e,t)=>{var r,n,o,i,s,a,l,u;let{hooks:m,url:E,options:O}=await f(e,t),_=function(e){if(null==e?void 0:e.customFetchImpl)return e.customFetchImpl;if("undefined"!=typeof globalThis&&b(globalThis.fetch))return globalThis.fetch;if("undefined"!=typeof window&&b(window.fetch))return window.fetch;throw Error("No fetch implementation found")}(O),P=new AbortController,I=null!=(r=O.signal)?r:P.signal,U=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];A.includes(t)&&(e=e.replace(`@${t}/`,"/"))}i.endsWith("/")||(i+="/");let[s,a]=e.replace(i,"").split("?"),l=new URLSearchParams(a);for(let[e,t]of Object.entries(o||{}))null!=t&&l.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 u=l.toString();return(u=u.length>0?`?${u}`.replace(/\+/g,"%20"):"",i.startsWith("http"))?new URL(`${s}${u}`,i):`${i}${s}${u}`}(E,O),N=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}(O),C=await v(O),k=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 A.includes(n)?n.toUpperCase():(null==t?void 0:t.body)?"POST":"GET"}return(null==t?void 0:t.body)?"POST":"GET"}(E,O),D=d(c({},O),{url:U,headers:C,body:N,method:k,signal:I});for(let e of m.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:x}=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)}}}(O,P),$=await _(D.url,D);x();let L={response:$,request:D};for(let e of m.onResponse)if(e){let r=await e(d(c({},L),{response:(null==(o=null==t?void 0:t.hookOptions)?void 0:o.cloneResponse)?$.clone():$}));r instanceof Response?$=r:r instanceof Object&&($=r.response)}if($.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 y.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}($),r={data:"",response:$,request:D};if("json"===e||"text"===e){let e=await $.text(),t=null!=(i=D.jsonParser)?i:R;r.data=await t(e)}else r.data=await $[e]();for(let e of((null==D?void 0:D.output)&&D.output&&!D.disableValidation&&(r.data=await T(D.output,r.data)),m.onSuccess))e&&await e(d(c({},r),{response:(null==(s=null==t?void 0:t.hookOptions)?void 0:s.cloneResponse)?$.clone():$}));return(null==t?void 0:t.throw)?r.data:{data:r.data,error:null}}let j=null!=(a=null==t?void 0:t.jsonParser)?a:R,B=await $.text(),q=function(e){try{return JSON.parse(e),!0}catch(e){return!1}}(B),z=q?await j(B):null,M={response:$,responseText:B,request:D,error:d(c({},z),{status:$.status,statusText:$.statusText})};for(let e of m.onError)e&&await e(d(c({},M),{response:(null==(l=null==t?void 0:t.hookOptions)?void 0:l.cloneResponse)?$.clone():$}));if(null==t?void 0:t.retry){let r=function(e){if("number"==typeof e)return new h({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new h(e);case"exponential":return new g(e);default:throw Error("Invalid retry strategy")}}(t.retry),n=null!=(u=t.retryAttempt)?u:0;if(await r.shouldAttemptRetry(n,$)){for(let e of m.onRetry)e&&await e(L);let o=r.getDelay(n);return await new Promise(e=>setTimeout(e,o)),await S(e,d(c({},t),{retryAttempt:n+1}))}}if(null==t?void 0:t.throw)throw new p($.status,$.statusText,q?z:B);return{data:null,error:d(c({},z),{status:$.status,statusText:$.statusText})}}}}]);
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.