import { B as BetterAuthPlugin, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, U as User, S as Session, i as Auth } from '../shared/better-auth.DijUyhfq.cjs'; export { u as Account, g as Adapter, x as AdapterInstance, w as AdapterSchemaCreation, r as AdditionalSessionFieldsInput, s as AdditionalSessionFieldsOutput, p as AdditionalUserFieldsInput, q as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, z as FilterActions, F as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, D as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, t as InferPluginTypes, k as InferSession, C as InferSessionAPI, j as InferUser, M as Models, R as RateLimit, y as SecondaryStorage, V as Verification, W as Where, v as init } from '../shared/better-auth.DijUyhfq.cjs'; import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch'; import { WritableAtom, Atom } from 'nanostores'; import { U as UnionToIntersection, H as HasRequiredKeys, b as Prettify, L as LiteralString, S as StripEmptyObjects } from '../shared/better-auth.Bi8FQwDD.cjs'; import { Endpoint, InputContext } from 'better-call'; import 'zod'; import '../shared/better-auth.WtOxsS45.cjs'; import 'jose'; import 'kysely'; import 'better-sqlite3'; type CamelCase = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase}${Uppercase}${CamelCase}` : Lowercase; type PathToObject any> = T extends `/${infer Segment}/${infer Rest}` ? { [K in CamelCase]: PathToObject<`/${Rest}`, Fn>; } : T extends `/${infer Segment}` ? { [K in CamelCase]: Fn; } : never; type InferSignUpEmailCtx = { email: string; name: string; password: string; image?: string; callbackURL?: string; fetchOptions?: FetchOptions; } & UnionToIntersection>; type InferUserUpdateCtx = { image?: string | null; name?: string; fetchOptions?: FetchOptions; } & Partial>>; type InferCtx, FetchOptions extends BetterFetchOption> = C["body"] extends Record ? C["body"] & { fetchOptions?: FetchOptions; } : C["query"] extends Record ? { query: C["query"]; fetchOptions?: FetchOptions; } : C["query"] extends Record | undefined ? { query?: C["query"]; fetchOptions?: FetchOptions; } : { fetchOptions?: FetchOptions; }; type MergeRoutes = UnionToIntersection; type InferRoute = API extends Record ? T extends Endpoint ? T["options"]["metadata"] extends { isAction: false; } | { SERVER_ONLY: true; } ? {} : PathToObject infer R ? C extends InputContext ? & Record, Partial & Record, C["params"]>>(...data: HasRequiredKeys> extends true ? [ Prettify : InferCtx>, FetchOptions? ] : [ Prettify : InferCtx>?, FetchOptions? ]) => Promise> : T["path"] extends "/get-session" ? { user: InferUserFromClient; session: InferSessionFromClient; } : NonNullable>, { code?: string; message?: string; t?: FetchOptions["throw"]; }, FetchOptions["throw"] extends true ? true : COpts["fetchOptions"] extends { throw: true; } ? true : false>> : never : never> : {} : never; type InferRoutes, ClientOpts extends ClientOptions> = MergeRoutes>; type AtomListener = { matcher: (path: string) => boolean; signal: "$sessionSignal" | Omit; }; interface Store { notify: (signal: string) => void; listen: (signal: string, listener: () => void) => void; atoms: Record>; } interface BetterAuthClientPlugin { id: LiteralString; /** * only used for type inference. don't pass the * actual plugin */ $InferServerPlugin?: BetterAuthPlugin; /** * Custom actions */ getActions?: ($fetch: BetterFetch, $store: Store) => Record; /** * State atoms that'll be resolved by each framework * auth store. */ getAtoms?: ($fetch: BetterFetch) => Record>; /** * specify path methods for server plugin inferred * endpoints to force a specific method. */ pathMethods?: Record; /** * Better fetch plugins */ fetchPlugins?: BetterFetchPlugin[]; /** * a list of recaller based on a matcher function. * The signal name needs to match a signal in this * plugin or any plugin the user might have added. */ atomListeners?: AtomListener[]; } interface ClientOptions { fetchOptions?: BetterFetchOption; plugins?: BetterAuthClientPlugin[]; baseURL?: string; basePath?: string; disableDefaultFetchPlugins?: boolean; } type InferClientAPI = InferRoutes ? Auth["api"] & (O["plugins"] extends Array ? UnionToIntersection : {}) : Auth["api"], O>; type InferActions = O["plugins"] extends Array ? UnionToIntersection infer Actions ? Actions : {} : {}> : {}; type InferErrorCodes = O["plugins"] extends Array ? UnionToIntersection : {}; /** * signals are just used to recall a computed value. * as a convention they start with "$" */ type IsSignal = T extends `$${infer _}` ? true : false; type InferPluginsFromClient = O["plugins"] extends Array ? Array : undefined; type InferSessionFromClient = StripEmptyObjects>>; type InferUserFromClient = StripEmptyObjects>>; type InferAdditionalFromClient = Options["plugins"] extends Array ? T extends BetterAuthClientPlugin ? T["$InferServerPlugin"] extends { schema: { [key in Key]: { fields: infer Field; }; }; } ? Format extends "input" ? InferFieldsInputClient : InferFieldsOutput : {} : {} : {}; export { type AtomListener, type BetterAuthClientPlugin, BetterAuthPlugin, type ClientOptions, type InferActions, type InferAdditionalFromClient, type InferClientAPI, type InferErrorCodes, type InferPluginsFromClient, type InferSessionFromClient, type InferUserFromClient, type IsSignal, Session, type Store, User };