1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,85313,e=>{"use strict";e.i(47167);var t=e.i(43476);e.i(20344);var n=e.i(71482);e.i(50711);var r=e.i(81958),l=e.i(71645);let o=Object.prototype.toString,a=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),i=[500,2e3],u=(0,l.createContext)(void 0),s=(0,l.createContext)(void 0);function c(){return(0,l.useContext)(s)}let d=(0,l.createContext)(null),h="__convexAuthOAuthVerifier",g="__convexAuthJWT",w="__convexAuthRefreshToken",f="__convexAuthServerStateFetchTime";function v({client:e,serverState:n,onChange:r,shouldHandleCode:c,storage:v,storageNamespace:m,replaceURL:y,children:b}){var x,p;let S,A,R,T,I=(0,l.useRef)(n?._state.token??null),[P,$]=(0,l.useState)(null===I.current),[M,j]=(0,l.useState)(I.current),E=e.verbose??!1,L=(0,l.useCallback)(t=>{E&&(console.debug(`${new Date().toISOString()} ${t}`),e.logger?.logVerbose(t))},[E]),{storageSet:F,storageGet:O,storageRemove:U,storageKey:N}=(x=v,p=m,S=function(){let[e,t]=(0,l.useState)({});return()=>({getItem:t=>e[t],setItem:(e,n)=>{t(t=>({...t,[e]:n}))},removeItem:e=>{t(t=>{let{[e]:n,...r}=t;return r})}})}(),A=(0,l.useMemo)(()=>x??S(),[x]),R=p.replace(/[^a-zA-Z0-9]/g,""),T=(0,l.useCallback)(e=>`${e}_${R}`,[p]),{storageSet:(0,l.useCallback)((e,t)=>A.setItem(T(e),t),[A,T]),storageGet:(0,l.useCallback)(e=>A.getItem(T(e)),[A,T]),storageRemove:(0,l.useCallback)(e=>A.removeItem(T(e)),[A,T]),storageKey:T}),[V,q]=(0,l.useState)(!1),D=(0,l.useCallback)(async e=>{let t,n=null!==I.current;if(null===e.tokens)I.current=null,e.shouldStore&&(await U(g),await U(w)),t=null;else{let{token:n}=e.tokens;if(I.current=n,e.shouldStore){let{refreshToken:t}=e.tokens;await F(g,n),await F(w,t)}t=n}n!==(null!==t)&&await r?.(),j(t),$(!1)},[F,U]);(0,l.useEffect)(()=>{let e=async e=>{if(V)return e.preventDefault(),e.returnValue=!0,"Are you sure you want to leave? Your changes may not be saved."};return C("beforeunload",e),()=>{_("beforeunload",e)}}),(0,l.useEffect)(()=>{let e=e=>{(async()=>{if(e.storageArea===v&&e.key===N(g)){let t=e.newValue;L(`synced access token, is null: ${null===t}`),await D({shouldStore:!1,tokens:null===t?null:{token:t}})}})()};return C("storage",e),()=>_("storage",e)},[D]);let W=(0,l.useCallback)(async t=>{let n,r=0;for(;r<i.length;)try{return await e.unauthenticatedCall("auth:signIn","code"in t?{params:{code:t.code},verifier:t.verifier}:t)}catch(t){if(n=t,!function(e){if(!(e&&"[object Error]"===o.call(e)&&"TypeError"===e.name&&"string"==typeof e.message))return!1;let{message:t,stack:n}=e;return"Load failed"===t?void 0===n||"__sentry_captured__"in e:!!t.startsWith("error sending request for url")||a.has(t)}(t))break;let e=i[r]+100*Math.random();r++,L(`verifyCode failed with network error, retry ${r} of ${i.length} in ${e}ms`),await new Promise(t=>setTimeout(t,e))}throw n},[e]),B=(0,l.useCallback)(async e=>{let{tokens:t}=await W(e);return L(`retrieved tokens, is null: ${null===t}`),await D({shouldStore:!0,tokens:t??null}),null!==t},[e,D]),H=(0,l.useCallback)(async(t,n)=>{let r=n instanceof FormData?Array.from(n.entries()).reduce((e,[t,n])=>(e[t]=n,e),{}):n??{},l=await O(h)??void 0;await U(h);let o=await e.authenticatedCall("auth:signIn",{provider:t,params:r,verifier:l});if(void 0!==o.redirect){let e=new URL(o.redirect);return await F(h,o.verifier),"ReactNative"!==navigator.product&&(window.location.href=e.toString()),{signingIn:!1,redirect:e}}if(void 0!==o.tokens){let{tokens:e}=o;return L(`signed in and got tokens, is null: ${null===e}`),await D({shouldStore:!0,tokens:e}),{signingIn:null!==o.tokens}}return{signingIn:!1}},[e,D,O]),K=(0,l.useCallback)(async()=>{try{await e.authenticatedCall("auth:signOut")}catch(e){}L("signed out, erasing tokens"),await D({shouldStore:!0,tokens:null})},[D,e]),z=(0,l.useCallback)(async({forceRefreshToken:e})=>{if(e){let e=I.current;return await k(w,async()=>{let t=I.current;if(t!==e)return L(`returning synced token, is null: ${null===t}`),t;let n=await O(w)??null;return null!==n?(q(!0),await B({refreshToken:n}).finally(()=>{q(!1)}),L(`returning retrieved token, is null: ${null===t}`),I.current):(q(!1),L("returning null, there is no refresh token"),null)})}return I.current},[B,K,O]),G=(0,l.useRef)(!1);(0,l.useEffect)(()=>
1{if(void 0===v)throw Error("`localStorage` is not available in this environment, set the `storage` prop on `ConvexAuthProvider`!");let e=async()=>{let e=await O(g)??null;L(`retrieved token from storage, is null: ${null===e}`),await D({shouldStore:!1,tokens:null===e?null:{token:e}})};if(void 0!==n){let t=O(f),r=t=>{if(!t||n._timeFetched>+t){let{token:e,refreshToken:t}=n._state;F(f,n._timeFetched.toString()),D({tokens:null===e||null===t?null:{token:e,refreshToken:t},shouldStore:!0})}else e()};t instanceof Promise?t.then(r):r(t);return}let t=void 0!==window?.location?.search?new URLSearchParams(window.location.search).get("code"):null;if((G.current||t)&&!G.current&&(void 0===c||("function"==typeof c?c():c))){G.current=!0;let e=new URL(window.location.href);e.searchParams.delete("code"),(async()=>{await y(e.pathname+e.search+e.hash),await H(void 0,{code:t}),G.current=!1})()}else e()},[e,O]);let J=(0,l.useMemo)(()=>({signIn:H,signOut:K}),[H,K]),Y=null!==M,Z=(0,l.useMemo)(()=>({isLoading:P,isAuthenticated:Y,fetchAccessToken:z}),[z,P,Y]);return(0,t.jsx)(s.Provider,{value:Z,children:(0,t.jsx)(u.Provider,{value:J,children:(0,t.jsx)(d.Provider,{value:M,children:b})})})}async function k(e,t){let n=window?.navigator?.locks;return void 0!==n?await n.request(e,t):await x(e,t)}function m(e){void 0===globalThis.__convexAuthMutexes&&(globalThis.__convexAuthMutexes={});let t=globalThis.__convexAuthMutexes[e];return void 0===t&&(globalThis.__convexAuthMutexes[e]={currentlyRunning:null,waiting:[]}),t=globalThis.__convexAuthMutexes[e]}function y(e,t){globalThis.__convexAuthMutexes[e]=t}async function b(e,t){let n=m(e);null===n.currentlyRunning?y(e,{currentlyRunning:t().finally(()=>{let t=m(e).waiting.shift();m(e).currentlyRunning=null,y(e,{...m(e),currentlyRunning:void 0===t?null:b(e,t)})}),waiting:[]}):y(e,{...n,waiting:[...n.waiting,t]})}async function x(e,t){return new Promise((n,r)=>{b(e,()=>t().then(e=>n(e)).catch(e=>r(e)))})}function C(e,t,n){window.addEventListener?.(e,t,n)}function _(e,t,n){window.removeEventListener?.(e,t,n)}function p(e){let{client:o,storage:a,storageNamespace:i,replaceURL:u,shouldHandleCode:s,children:d}=e,h=(0,l.useMemo)(()=>({authenticatedCall:(e,t)=>o.action(e,t),unauthenticatedCall:(e,t)=>new n.ConvexHttpClient(o.address,{logger:o.logger}).action(e,t),verbose:o.options?.verbose,logger:o.logger}),[o]);return(0,t.jsx)(v,{client:h,storage:a??("u"<typeof window?void 0:window?.localStorage),storageNamespace:i??o.address,replaceURL:u??(e=>{window.history.replaceState({},"",e)}),shouldHandleCode:s,children:(0,t.jsx)(r.ConvexProviderWithAuth,{client:o,useAuth:c,children:d})})}let S=new(e.i(82045)).ConvexReactClient("https://small-moose-612.eu-west-1.convex.cloud");function A({children:e}){return S?(0,t.jsx)(p,{client:S,children:e}):(0,t.jsx)(t.Fragment,{children:e})}e.s(["ConvexClientProvider",()=>A],85313)}]);
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.