PageSourceSearch

https://associacaoestar.org/assets/client-Df_0jXEF.js

js associacaoestar.org collected 2026-10-06 07:20:39 UTC 31,202 bytes, 3 lines download raw bytes

1import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-Cvdyeg_0.js";var r=`1.6.33`;function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}function a(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function o(e){let t=e.split(`
2    at `);return t.length<=1?e:(t.splice(1,1),t.join(`
3    at `))}function s(e,t){class n extends e{#e;constructor(...e){if(a()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=o(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var c={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};s(class extends Error{status;body;headers;statusCode;constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:c[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var l=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},u=i({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),d=()=>({id:`generic-oauth-client`,version:r,$InferServerPlugin:{},$ERROR_CODES:u}),f=Object.create(null),p=e=>({}),m=new Proxy(f,{get(e,t){return p()[t]??f[t]},has(e,t){return t in p()||t in f},set(e,t,n){let r=p(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=p(!0);return delete n[t],!0},ownKeys(){let e=p(!0);return Object.keys(e)}});m.NODE_ENV;function h(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return h(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return h(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return h(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return h(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return h(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return h(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return h(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});var g=47;function _(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===g;)t--;return t===e.length?e:e.slice(0,t)}function v(e){try{return(_(new URL(e).pathname)||`/`)!==`/`}catch{throw new l(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function y(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new l(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof l?t:new l(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function b(e,t=`/api/auth`){if(y(e),v(e))return e;let n=_(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function ee(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function te(e,t,n,r,i){if(e)return b(e,t);if(r!==!1){let e=m.BETTER_AUTH_URL||m.NEXT_PUBLIC_BETTER_AUTH_URL||m.PUBLIC_BETTER_AUTH_URL||m.NUXT_PUBLIC_BETTER_AUTH_URL||m.NUXT_PUBLIC_AUTH_URL||(m.BASE_URL===`/`?void 0:m.BASE_URL);if(e)return b(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&ee(o,`proto`)&&ee(a,`host`))try{return b(`${o}://${a}`,t)}catch{}if(n){let e=ne(n.url);if(!e)throw new l(`Could not get origin from request. Please provide a valid base URL.`);return b(e,t)}if(typeof window<`u`&&window.location)return b(window.location.origin,t)}function ne(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var re=[`javascript:`,`data:`,`vbscript:`];function ie(e){let t;try{t=new URL(e)}catch{return!0}return!re.includes(t.protocol)}
3var x=[],S=0,ae=null,C=4,oe=globalThis.nanostoresGlobal||={epoch:0},se=()=>{let e,t;for(;S<x.length;){t=S,S+=C;try{x[t](x[t+1].value,x[t+2],x[t+3])}catch(t){e=t}}if(x.length=S=0,e)throw e},w=e=>{let t=[],n={eq:Object.is,get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=S;t<x.length;)x[t]===e?x.splice(t,C):t+=C;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){oe.epoch++;let i=!x.length&&!0;for(let i of t)ae?.has(i)||(ae?.add(i),x.push(i,n,e,r));i&&se()},off(){},set(e){let t=n.value;n.eq(t,e)||(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},ce=2,le=5,T=6,E=10,ue=(e,t,n,r)=>(e.events=e.events||{},e.events[n+E]||(e.events[n+E]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);~i&&(r.splice(i,1),r.length||(e.events[n+E](),delete e.events[n+E]))}),de=(e,t)=>ue(e,t,ce,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),fe=1e3,pe=(e,t)=>ue(e,n=>{let r=t(n);r&&e.events[T].push(r)},le,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[T]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[T])t();e.events[T]=[]}},fe)},()=>{e.listen=n,e.off=r}});function me(e,t){let n=ge(t),r=e;for(let e of n){if(r==null)return;r=r[e]}return r}var he=/(.*)\[(\d+)\]/;function ge(e){return e.split(`.`).flatMap(e=>D(e))}function D(e){if(he.test(e)){let[,t,n]=e.match(he);return[...D(t),n]}return[e]}function _e(e,t,n){let r=new Set(t);return e.listen((e,i,a)=>{(a===void 0?t.some(t=>i===void 0||e[t]!==i[t]||me(e,t)!==me(i,t)):r.has(a)||r.has(a.split(/\.|\[/)[0]))&&n(e,i,a)})}function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function k(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!k(e[n],t[n]))return!1;return!0}if(O(e)&&O(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!k(e[r],t[r]))return!1;return!0}return!1}function ve(e,t){return de(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var ye={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*:/},be=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,A={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},xe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Se(e){return e instanceof Date&&!isNaN(e.getTime())}function Ce(e){let t=xe.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return Se(f)?f:null}function we(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in A)return A[s];if(!be.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(ye).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Ce(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function Te(e,t={strict:!0}){return we(e,t)}var Ee={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&ie(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},j=Symbol.for(`better-auth:broadcast-channel`),De=()=>Math.floor(Date.now()/1e3),Oe=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(typeof window<`u`)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:De()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);
3t?.event===`session`&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function M(e=`better-auth.message`){return globalThis[j]||(globalThis[j]=new Oe(e)),globalThis[j]}var N=Symbol.for(`better-auth:focus-manager`),ke=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function Ae(){return globalThis[N]||(globalThis[N]=new ke),globalThis[N]}var P=Symbol.for(`better-auth:online-manager`),je=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function F(){return globalThis[P]||(globalThis[P]=new je),globalThis[P]}var I=()=>Math.floor(Date.now()/1e3),Me=5;function Ne(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||F().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=I(),t();return}if(e?.event===`visibilitychange`){if(I()-c.lastSessionRequest<Me)return;c.lastSessionRequest=I(),t();return}t()}},d=e=>{M().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=M().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=Ae().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=F().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=M().setup(),c.cleanupFocusSetup=Ae().setup(),c.cleanupOnlineSetup=F().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Pe=()=>typeof window>`u`,Fe=fe;function Ie(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function Le(e){return!e||e.session===null&&e.user===null?null:e}function Re(e,t){return k(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function ze(e,t){let n=w(!1),r,i=0,a=0;n.listen(()=>{a++,i=0});let o=e=>u(e),s=w({data:null,error:null,isPending:!0,isRefetching:!1,refetch:o});ve(s,Re);let c=async(t,n)=>{let r=s.value;if(s.set({...r,isPending:r.data===null,isRefetching:!0,error:null,refetch:o}),t.aborted)return`aborted`;try{let r=await e(`/get-session`,{method:`GET`,query:n?.query,signal:t});if(t.aborted)return`aborted`;let{data:i,error:a}=Ie(r),c=`fresh`;if(i?.needsRefresh)try{let n=await e(`/get-session`,{method:`POST`,signal:t});if(t.aborted)return`aborted`;({data:i,error:a}=Ie(n))}catch{if(t.aborted)return`aborted`;c=`stale`}if(a){let e=s.value,t=a?.status===401;return s.set({data:t?null:e.data,error:a,isPending:!1,isRefetching:!1,refetch:o}),`failed`}let l=Le(i),u=s.value,d=u.data!=null&&l!=null&&k(u.data,l)?u.data:l;return s.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:o}),c}catch(e){if(t.aborted)return`aborted`;let n=s.value;return s.set({data:n.data,error:e,isPending:!1,isRefetching:!1,refetch:o}),`failed`}},l=()=>{let e=s.value.data?.session?.expiresAt,t=e instanceof Date?e.getTime():1/0;return Math.min(Date.now()+Fe,t)},u=e=>{i=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?`aborted`:c(t.signal,e)),revision:a};r=n;let o=e=>{r===n&&(r=void 0,e===`fresh`&&n.revision===a&&(i=l()))};return n.promise.then(o,()=>o(`failed`)),n.promise.then(()=>void 0)},d=()=>r?.revision===a?r.promise.then(()=>void 0):Date.now()<i?Promise.resolve():u(),f=()=>{};return pe(s,()=>{let e;Pe()||(e=setTimeout(()=>{d()},0));let r=Ne({fetchSession:u,shouldPollSession:()=>s.value.data!=null,sessionSignal:n,options:t});return r.init(),f=r.broadcastSessionUpdate,()=>{e&&clearTimeout(e),r.cleanup()}}),{session:s,$sessionSignal:n,broadcastSessionUpdate:e=>f(e)}}function L(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function R(e,t,n=`.`,r){if(!L(t))return R(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:L(a)&&L(i[t])?R(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function Be(e){return(...t)=>t.reduce((t,n)=>R(t,n,``,e),{})}var Ve=Be(),He=Object.defineProperty,Ue=Object.defineProperties,We=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,B=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||={})Ge.call(t,n)&&B(e,n,t[n]);if(z)for(var n of z(t))Ke.call(t,n)&&B(e,n,t[n]);return e},H=(e,t)=>
3Ue(e,We(t)),qe=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},Je=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},U=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}},Ye=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)}};function Xe(e){if(typeof e==`number`)return new U({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new U(e);case`exponential`:return new Ye(e);default:throw Error(`Invalid retry strategy`)}}var Ze=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Qe=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function $e(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Qe.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function et(e){try{return JSON.parse(e),!0}catch{return!1}}function W(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function G(e){try{return JSON.parse(e)}catch{return e}}function K(e){return typeof e==`function`}function tt(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&K(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&K(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function nt(...e){let t={};for(let n of e)if(n){if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}}return t}async function rt(e){let t=new Headers(nt(e?.headers,await Ze(e)));if(!t.has(`content-type`)){let n=it(e?.body);n&&t.set(`content-type`,n)}return t}function it(e){return W(e)?`application/json`:null}function at(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function ot(e,t){let{body:n}=e;return n?!W(n)||typeof n==`string`?n:at(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function st(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return ut.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function ct(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var lt=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function q(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new lt(n.issues);return n.value}var ut=[`get`,`post`,`put`,`patch`,`delete`],dt=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>
3e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``)),e.startsWith(`/`)&&e.charAt(1)===`@`&&(e=e.substring(1));let i=r.schema[e];if(i){let e=n?.headers;if(i.headers&&!n?.disableValidation){let t={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((e,n)=>{t[n.toLowerCase()]=e});else if(typeof n.headers==`object`)for(let[e,r]of Object.entries(n.headers))r!=null&&(t[e.toLowerCase()]=r)}let r=await q(i.headers,t),a={};for(let[e,t]of Object.entries(r))a[e.toLowerCase()]=t;e=a}let r=H(V({},n),{method:i.method,output:i.output,headers:e});return n?.disableValidation||(r=H(V({},r),{body:i.input?await q(i.input,n?.body):n?.body,params:i.params?await q(i.params,n?.params):n?.params,query:i.query?await q(i.query,n?.query):n?.query})),{url:t,options:r}}}return{url:t,options:n}}}),ft=e=>{async function t(t,n){let r=H(V(V({},e),n),{headers:nt(e?.headers,n?.headers),plugins:[...e?.plugins||[],dt(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await J(t,r)}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 J(t,r)}return t},pt=e=>e===`.`||e===`..`;function mt(e,t){let n=e;for(let[e,r]of t)n=n.replace(e,r);if(pt(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function ht(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];ut.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}let l=new Map;if(r){if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];l.set(n,String(e))}}else for(let[e,t]of Object.entries(r))l.set(`:${e}`,String(t))}o=o.split(`/`).map(e=>mt(e,l)).join(`/`),o=o.replace(/^\/+/,``);let u=c.toString();return u=u.length>0?`?${u}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${u}`,a):`${a}${o}${u}`}var J=async(e,t)=>{let{hooks:n,url:r,options:i}=await Je(e,t),a=tt(i),o=new AbortController,s=i.signal??o.signal,c=ht(r,i),l=await rt(i),u=ot(i,l),d=st(r,i),f=H(V({},i),{url:c,headers:l,body:u,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&Object.assign(f,t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=ct(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(H(V({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=$e(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??G)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await q(f.output,r.data));for(let e of n.onSuccess)e&&await e(H(V({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??G,_=await m.text(),v=et(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:H(V({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(H(V({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=Xe(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await J(e,H(V({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new qe(m.status,m.statusText,v?y:_);return{data:null,error:H(V({},y),{status:m.status,statusText:m.statusText})}},gt=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},_t=(e,t)=>{let n=`credentials`in Request.prototype,r=te(e?.baseURL,e?.basePath,void 0,t)??gt(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=ft({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?Te(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Ee],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=ze(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p}
3,v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ve(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function vt(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function yt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var bt=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,xt=/['\u2019]/g;function St(e){return e.replace(xt,``).match(bt)??[]}function Ct(e){return St(e).map(e=>e.toLowerCase()).join(`-`)}function wt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function Tt(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||vt(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(Ct).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=wt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}var Y=t(n(),1);function Et(e,t={}){let n=(0,Y.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,Y.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?_e(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,Y.useSyncExternalStore)(a,o,o)}function Dt(e){return`use${yt(e)}`}function Ot(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=_t(e),s={};for(let[e,t]of Object.entries(r))s[Dt(e)]=()=>Et(t);return Tt({...n,...s,$fetch:i,$store:a},i,t,r,o)}var kt=1500,At=1e4;function X(e){return e?kt:At}function jt(e,t){return new Promise(n=>{let r=setTimeout(()=>n(`timeout`),t),i=e=>{clearTimeout(r),n(e)};try{Promise.resolve(e()).then(()=>i(`ok`),()=>i(`failed`))}catch{i(`failed`)}})}async function Mt({livePreview:e,hasBearer:t,requestSignOut:n,clearToken:r,redirect:i,timeoutMs:a}){if(e){t&&await jt(n,a??X(e)),r(),i();return}let o=await jt(n,a??X(e));if(o!==`ok`)throw Error(o===`timeout`?`Sign-out timed out — you are still signed in. Please try again.`:`Sign-out failed — you are still signed in. Please try again.`);r(),i()}var Nt=e({authClient:()=>Z,authEnabled:()=>!0,getBearerToken:()=>$,signOut:()=>It}),Z=Ot({plugins:[d()],fetchOptions:{onRequest(e){let t=$();return t&&e.headers.set(`Authorization`,`Bearer ${t}`),e}}}),Q=`grok-auth.bearer-token`;function $(){if(typeof window>`u`)return null;try{return window.sessionStorage.getItem(Q)}catch{return null}}function Pt(e){if(typeof window<`u`)try{e?window.sessionStorage.setItem(Q,e):window.sessionStorage.removeItem(Q)}catch{}}function Ft(){return typeof window<`u`&&window.location.hostname.endsWith(`.grok-sandbox.com`)}async function It(e=`/`){await Mt({livePreview:Ft(),hasBearer:!!$(),requestSignOut:async()=>{let{error:e}=await Z.signOut();if(e)throw Error(e.message??`Sign-out failed`)},clearToken:()=>Pt(null),redirect:()=>{window.location.href=e}})}export{Nt as n,It as r,Z as t};

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.