{"version":3,"file":"shared-JtnEvJvB.mjs","names":["hooks: CreateReactQueryHooks","contextProps: (keyof TRPCContextPropsBase)[]","React","utilName: keyof AnyDecoratedProcedure","context: TRPCQueryUtils","contextMap: Record unknown>","context: TRPCContextState","client: TRPCUntypedClient | TRPCClient","untypedClient: TRPCUntypedClient","options: QueryOptions","queryKey: TRPCQueryKey","opts: TOptions","infiniteParams?: {\n pageParam: any;\n direction: 'forward' | 'backward';\n }","_asyncIterator","r","AsyncFromSyncIterator","value: {\n path: readonly string[];\n}","asyncIterable: AsyncIterable","queryClient: QueryClient","queryKey: TRPCQueryKey","aggregate: unknown[]","opts: CreateQueryUtilsOptions","opts","queryFnContext: QueryFunctionContext","queryFnContext: QueryFunctionContext","input: unknown","result: T","onTrackResult: (key: keyof T) => void","config?: CreateTRPCReactOptions","mutationSuccessOverride: UseMutationOverride['onSuccess']","TRPCProvider: TRPCProvider","client: TRPCUntypedClient","queryKey: TRPCQueryKey","opts: TOptions","useQuery","path: readonly string[]","input: unknown","opts?: UseTRPCQueryOptions","usePrefetchQuery","path: string[]","opts?: UseTRPCPrefetchQueryOptions","useSuspenseQuery","opts?: UseTRPCSuspenseQueryOptions","useMutation","opts?: UseTRPCMutationOptions","initialStateIdle: Omit, 'reset'>","initialStateConnecting: Omit<\n TRPCSubscriptionConnectingResult,\n 'reset'\n >","opts: UseTRPCSubscriptionOptions","key: keyof $Result","callback: (prevState: $Result) => $Result","useInfiniteQuery","opts: UseTRPCInfiniteQueryOptions","usePrefetchInfiniteQuery","opts: UseTRPCPrefetchInfiniteQueryOptions","useSuspenseInfiniteQuery","opts: UseTRPCSuspenseInfiniteQueryOptions","useQueries: TRPCUseQueries","useSuspenseQueries: TRPCUseSuspenseQueries","config: CreateTRPCReactQueryClientConfig"],"sources":["../src/shared/proxy/decorationProxy.ts","../src/internals/context.tsx","../src/shared/proxy/utilsProxy.ts","../src/shared/proxy/useQueriesProxy.ts","../src/internals/getClientArgs.ts","../../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js","../src/internals/trpcResult.ts","../src/utils/createUtilityFunctions.ts","../src/shared/hooks/createHooksInternal.tsx","../src/shared/queryClient.ts"],"sourcesContent":["import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport type { CreateReactQueryHooks } from '../hooks/createHooksInternal';\n\n/**\n * Create proxy for decorating procedures\n * @internal\n */\nexport function createReactDecoration<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(hooks: CreateReactQueryHooks) {\n return createRecursiveProxy(({ path, args }) => {\n const pathCopy = [...path];\n\n // The last arg is for instance `.useMutation` or `.useQuery()`\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const lastArg = pathCopy.pop()!;\n\n if (lastArg === 'useMutation') {\n return (hooks as any)[lastArg](pathCopy, ...args);\n }\n\n if (lastArg === '_def') {\n return {\n path: pathCopy,\n };\n }\n\n const [input, ...rest] = args;\n const opts = rest[0] ?? {};\n\n return (hooks as any)[lastArg](pathCopy, input, opts);\n });\n}\n","import type {\n CancelOptions,\n FetchInfiniteQueryOptions,\n FetchQueryOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n MutationOptions,\n QueryClient,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n Updater,\n} from '@tanstack/react-query';\nimport type {\n TRPCClient,\n TRPCClientError,\n TRPCRequestOptions,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type {\n AnyClientTypes,\n AnyRouter,\n DistributiveOmit,\n} from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n ExtractCursorType,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n} from '../shared';\nimport type { TRPCMutationKey, TRPCQueryKey } from './getQueryKey';\n\ninterface TRPCUseUtilsOptions {\n /**\n * tRPC-related options\n */\n trpc?: TRPCRequestOptions;\n}\nexport interface TRPCFetchQueryOptions\n extends DistributiveOmit, 'queryKey'>,\n TRPCUseUtilsOptions {\n //\n}\n\nexport type TRPCFetchInfiniteQueryOptions =\n DistributiveOmit<\n FetchInfiniteQueryOptions<\n TOutput,\n TError,\n TOutput,\n TRPCQueryKey,\n ExtractCursorType\n >,\n 'queryKey' | 'initialPageParam'\n > &\n TRPCUseUtilsOptions & {\n initialCursor?: ExtractCursorType;\n };\n\n/** @internal */\nexport type SSRState = 'mounted' | 'mounting' | 'prepass' | false;\n\nexport interface TRPCContextPropsBase {\n /**\n * The `TRPCClient`\n */\n client: TRPCUntypedClient;\n /**\n * The SSR context when server-side rendering\n * @default null\n */\n ssrContext?: TSSRContext | null;\n /**\n * State of SSR hydration.\n * - `false` if not using SSR.\n * - `prepass` when doing a prepass to fetch queries' data\n * - `mounting` before TRPCProvider has been rendered on the client\n * - `mounted` when the TRPCProvider has been rendered on the client\n * @default false\n */\n ssrState?: SSRState;\n /**\n * @deprecated pass abortOnUnmount to `createTRPCReact` instead\n * Abort loading query calls when unmounting a component - usually when navigating to a new page\n * @default false\n */\n abortOnUnmount?: boolean;\n}\n\n/**\n * @internal\n */\nexport type DecoratedTRPCContextProps<\n TRouter extends AnyRouter,\n TSSRContext,\n> = TRPCContextPropsBase & {\n client: TRPCClient;\n};\n\nexport interface TRPCContextProps\n extends TRPCContextPropsBase {\n /**\n * The react-query `QueryClient`\n */\n queryClient: QueryClient;\n}\n\nexport const contextProps: (keyof TRPCContextPropsBase)[] = [\n 'client',\n 'ssrContext',\n 'ssrState',\n 'abortOnUnmount',\n];\n\n/**\n * @internal\n */\nexport interface TRPCContextState<\n TRouter extends AnyRouter,\n TSSRContext = undefined,\n> extends Required>,\n TRPCQueryUtils {}\n\n/**\n * @internal\n */\nexport interface TRPCQueryUtils {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts?: UndefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError\n >,\n ): UndefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError\n >;\n queryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCQueryOptionsIn<\n unknown,\n unknown,\n TRPCClientError\n >,\n ): DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError\n >;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: UndefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError\n >;\n infiniteQueryOptions(\n path: readonly string[], // <-- look into if needed\n queryKey: TRPCQueryKey,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n unknown,\n unknown,\n unknown,\n TRPCClientError\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n unknown,\n unknown,\n unknown,\n TRPCClientError\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions>,\n ) => Promise;\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError\n >,\n ) => Promise>;\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/prefetching\n */\n prefetchQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions>,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfiniteQuery: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchInfiniteQueryOptions<\n unknown,\n unknown,\n TRPCClientError\n >,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureQueryData: (\n queryKey: TRPCQueryKey,\n opts?: TRPCFetchQueryOptions>,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidateQueries: (\n queryKey: TRPCQueryKey,\n filters?: InvalidateQueryFilters,\n options?: InvalidateOptions,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n resetQueries: (\n queryKey: TRPCQueryKey,\n filters?: QueryFilters,\n options?: ResetOptions,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetchQueries: (\n queryKey: TRPCQueryKey,\n filters?: RefetchQueryFilters,\n options?: RefetchOptions,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-cancellation\n */\n cancelQuery: (\n queryKey: TRPCQueryKey,\n options?: CancelOptions,\n ) => Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetqueriesdata\n */\n setQueriesData: (\n queryKey: TRPCQueryKey,\n filters: QueryFilters,\n updater: Updater,\n options?: SetDataOptions,\n ) => [QueryKey, unknown][];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getQueryData: (queryKey: TRPCQueryKey) => unknown;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n updater: Updater<\n InfiniteData | undefined,\n InfiniteData | undefined\n >,\n options?: SetDataOptions,\n ) => void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteQueryData: (\n queryKey: TRPCQueryKey,\n ) => InfiniteData | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient/#queryclientsetmutationdefaults\n */\n setMutationDefaults: (\n mutationKey: TRPCMutationKey,\n options:\n | MutationOptions\n | ((args: {\n canonicalMutationFn: (input: unknown) => Promise;\n }) => MutationOptions),\n ) => void;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientgetmutationdefaults\n */\n getMutationDefaults: (\n mutationKey: TRPCMutationKey,\n ) => MutationOptions | undefined;\n\n /**\n * @see https://tanstack.com/query/latest/docs/reference/QueryClient#queryclientismutating\n */\n isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;\n}\nexport const TRPCContext = React.createContext?.(null as any);\n","import type {\n CancelOptions,\n InfiniteData,\n InvalidateOptions,\n InvalidateQueryFilters,\n Query,\n QueryFilters,\n QueryKey,\n RefetchOptions,\n RefetchQueryFilters,\n ResetOptions,\n SetDataOptions,\n SkipToken,\n Updater,\n} from '@tanstack/react-query';\nimport type { TRPCClientError } from '@trpc/client';\nimport { createTRPCClientProxy } from '@trpc/client';\nimport type {\n AnyMutationProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n DeepPartial,\n inferProcedureInput,\n inferProcedureOutput,\n inferTransformedProcedureOutput,\n ProtectedIntersection,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport {\n createFlatProxy,\n createRecursiveProxy,\n} from '@trpc/server/unstable-core-do-not-import';\nimport type {\n DecoratedTRPCContextProps,\n TRPCContextState,\n TRPCFetchInfiniteQueryOptions,\n TRPCFetchQueryOptions,\n TRPCQueryUtils,\n} from '../../internals/context';\nimport { contextProps } from '../../internals/context';\nimport type { QueryKeyKnown, QueryType } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport type { InferMutationOptions } from '../../utils/inferReactQueryProcedure';\nimport type { ExtractCursorType } from '../hooks/types';\nimport type {\n DefinedTRPCInfiniteQueryOptionsIn,\n DefinedTRPCInfiniteQueryOptionsOut,\n DefinedTRPCQueryOptionsIn,\n DefinedTRPCQueryOptionsOut,\n UndefinedTRPCInfiniteQueryOptionsIn,\n UndefinedTRPCInfiniteQueryOptionsOut,\n UndefinedTRPCQueryOptionsIn,\n UndefinedTRPCQueryOptionsOut,\n UnusedSkipTokenTRPCInfiniteQueryOptionsIn,\n UnusedSkipTokenTRPCInfiniteQueryOptionsOut,\n UnusedSkipTokenTRPCQueryOptionsIn,\n UnusedSkipTokenTRPCQueryOptionsOut,\n} from '../types';\n\nexport type DecorateQueryProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = {\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput | SkipToken,\n opts: DefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): DefinedTRPCQueryOptionsOut>;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput | SkipToken,\n opts?: UnusedSkipTokenTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): UnusedSkipTokenTRPCQueryOptionsOut<\n TQueryFnData,\n TData,\n TRPCClientError\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/queryOptions#queryoptions\n */\n queryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput | SkipToken,\n opts?: UndefinedTRPCQueryOptionsIn<\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): UndefinedTRPCQueryOptionsOut>;\n\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput | SkipToken,\n opts: DefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): DefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput,\n opts: UnusedSkipTokenTRPCInfiniteQueryOptionsIn<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): UnusedSkipTokenTRPCInfiniteQueryOptionsOut<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >;\n /**\n * @see https://tanstack.com/query/latest/docs/framework/react/reference/infiniteQueryOptions#infinitequeryoptions\n */\n infiniteQueryOptions<\n TQueryFnData extends inferTransformedProcedureOutput,\n TData = TQueryFnData,\n >(\n input: inferProcedureInput | SkipToken,\n opts?: UndefinedTRPCInfiniteQueryOptionsIn<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >,\n ): UndefinedTRPCInfiniteQueryOptionsOut<\n inferProcedureInput,\n TQueryFnData,\n TData,\n TRPCClientError\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchquery\n */\n fetch(\n input: inferProcedureInput,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput,\n TRPCClientError\n >,\n ): Promise>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchinfinitequery\n */\n fetchInfinite(\n input: inferProcedureInput,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput,\n inferTransformedProcedureOutput,\n TRPCClientError\n >,\n ): Promise<\n InfiniteData<\n inferTransformedProcedureOutput,\n NonNullable>> | null\n >\n >;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchquery\n */\n prefetch(\n input: inferProcedureInput,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput,\n TRPCClientError\n >,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientprefetchinfinitequery\n */\n prefetchInfinite(\n input: inferProcedureInput,\n opts?: TRPCFetchInfiniteQueryOptions<\n inferProcedureInput,\n inferTransformedProcedureOutput,\n TRPCClientError\n >,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientensurequerydata\n */\n ensureData(\n input: inferProcedureInput,\n opts?: TRPCFetchQueryOptions<\n inferTransformedProcedureOutput,\n TRPCClientError\n >,\n ): Promise>;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientinvalidatequeries\n */\n invalidate(\n input?: DeepPartial>,\n filters?: Omit & {\n predicate?: (\n query: Query<\n inferProcedureOutput,\n TRPCClientError,\n inferTransformedProcedureOutput,\n QueryKeyKnown<\n inferProcedureInput,\n inferProcedureInput extends { cursor?: any } | void\n ? 'infinite'\n : 'query'\n >\n >,\n ) => boolean;\n },\n options?: InvalidateOptions,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientrefetchqueries\n */\n refetch(\n input?: inferProcedureInput,\n filters?: RefetchQueryFilters,\n options?: RefetchOptions,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientcancelqueries\n */\n cancel(\n input?: inferProcedureInput,\n options?: CancelOptions,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientresetqueries\n */\n reset(\n input?: inferProcedureInput,\n options?: ResetOptions,\n ): Promise;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput,\n updater: Updater<\n inferTransformedProcedureOutput | undefined,\n inferTransformedProcedureOutput | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setQueriesData(\n /**\n * The input of the procedure\n */\n input: inferProcedureInput,\n filters: QueryFilters,\n updater: Updater<\n inferTransformedProcedureOutput | undefined,\n inferTransformedProcedureOutput | undefined\n >,\n options?: SetDataOptions,\n ): [QueryKey, inferTransformedProcedureOutput];\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientsetquerydata\n */\n setInfiniteData(\n input: inferProcedureInput,\n updater: Updater<\n | InfiniteData<\n inferTransformedProcedureOutput,\n NonNullable>> | null\n >\n | undefined,\n | InfiniteData<\n inferTransformedProcedureOutput,\n NonNullable>> | null\n >\n | undefined\n >,\n options?: SetDataOptions,\n ): void;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getData(\n input?: inferProcedureInput,\n ): inferTransformedProcedureOutput | undefined;\n\n /**\n * @see https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientgetquerydata\n */\n getInfiniteData(\n input?: inferProcedureInput,\n ):\n | InfiniteData<\n inferTransformedProcedureOutput,\n NonNullable>> | null\n >\n | undefined;\n};\n\ntype DecorateMutationProcedure<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyMutationProcedure,\n> = {\n setMutationDefaults(\n options:\n | InferMutationOptions\n | ((args: {\n canonicalMutationFn: NonNullable<\n InferMutationOptions['mutationFn']\n >;\n }) => InferMutationOptions),\n ): void;\n\n getMutationDefaults(): InferMutationOptions | undefined;\n\n isMutating(): number;\n};\n\n/**\n * this is the type that is used to add in procedures that can be used on\n * an entire router\n */\ntype DecorateRouter = {\n /**\n * Invalidate the full router\n * @see https://trpc.io/docs/v10/useContext#query-invalidation\n * @see https://tanstack.com/query/v5/docs/framework/react/guides/query-invalidation\n */\n invalidate(\n input?: undefined,\n filters?: InvalidateQueryFilters,\n options?: InvalidateOptions,\n ): Promise;\n};\n\n/**\n * @internal\n */\nexport type DecoratedProcedureUtilsRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = DecorateRouter & {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? DecorateQueryProcedure\n : $Value extends AnyMutationProcedure\n ? DecorateMutationProcedure\n : $Value extends RouterRecord\n ? DecoratedProcedureUtilsRecord & DecorateRouter\n : never\n : never;\n}; // Add functions that should be available at utils root\n\ntype AnyDecoratedProcedure = DecorateQueryProcedure &\n DecorateMutationProcedure;\n\nexport type CreateReactUtils<\n TRouter extends AnyRouter,\n TSSRContext,\n> = ProtectedIntersection<\n DecoratedTRPCContextProps,\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n>;\n\nexport type CreateQueryUtils =\n DecoratedProcedureUtilsRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >;\n\nexport const getQueryType = (\n utilName: keyof AnyDecoratedProcedure,\n): QueryType => {\n switch (utilName) {\n case 'queryOptions':\n case 'fetch':\n case 'ensureData':\n case 'prefetch':\n case 'getData':\n case 'setData':\n case 'setQueriesData':\n return 'query';\n\n case 'infiniteQueryOptions':\n case 'fetchInfinite':\n case 'prefetchInfinite':\n case 'getInfiniteData':\n case 'setInfiniteData':\n return 'infinite';\n\n case 'setMutationDefaults':\n case 'getMutationDefaults':\n case 'isMutating':\n case 'cancel':\n case 'invalidate':\n case 'refetch':\n case 'reset':\n return 'any';\n }\n};\n\n/**\n * @internal\n */\nfunction createRecursiveUtilsProxy(\n context: TRPCQueryUtils,\n) {\n return createRecursiveProxy>((opts) => {\n const path = [...opts.path];\n const utilName = path.pop() as keyof AnyDecoratedProcedure;\n const args = [...opts.args] as Parameters<\n AnyDecoratedProcedure[typeof utilName]\n >;\n const input = args.shift(); // args can now be spread when input removed\n const queryType = getQueryType(utilName);\n const queryKey = getQueryKeyInternal(path, input, queryType);\n\n const contextMap: Record unknown> = {\n infiniteQueryOptions: () =>\n context.infiniteQueryOptions(path, queryKey, args[0]),\n queryOptions: () => context.queryOptions(path, queryKey, ...args),\n /**\n * DecorateQueryProcedure\n */\n fetch: () => context.fetchQuery(queryKey, ...args),\n fetchInfinite: () => context.fetchInfiniteQuery(queryKey, args[0]),\n prefetch: () => context.prefetchQuery(queryKey, ...args),\n prefetchInfinite: () => context.prefetchInfiniteQuery(queryKey, args[0]),\n ensureData: () => context.ensureQueryData(queryKey, ...args),\n invalidate: () => context.invalidateQueries(queryKey, ...args),\n reset: () => context.resetQueries(queryKey, ...args),\n refetch: () => context.refetchQueries(queryKey, ...args),\n cancel: () => context.cancelQuery(queryKey, ...args),\n setData: () => {\n context.setQueryData(queryKey, args[0], args[1]);\n },\n setQueriesData: () =>\n context.setQueriesData(queryKey, args[0], args[1], args[2]),\n setInfiniteData: () => {\n context.setInfiniteQueryData(queryKey, args[0], args[1]);\n },\n getData: () => context.getQueryData(queryKey),\n getInfiniteData: () => context.getInfiniteQueryData(queryKey),\n /**\n * DecorateMutationProcedure\n */\n setMutationDefaults: () =>\n context.setMutationDefaults(getMutationKeyInternal(path), input),\n getMutationDefaults: () =>\n context.getMutationDefaults(getMutationKeyInternal(path)),\n isMutating: () =>\n context.isMutating({ mutationKey: getMutationKeyInternal(path) }),\n };\n\n return contextMap[utilName]();\n });\n}\n\n/**\n * @internal\n */\nexport function createReactQueryUtils(\n context: TRPCContextState,\n) {\n type CreateReactUtilsReturnType = CreateReactUtils;\n\n const clientProxy = createTRPCClientProxy(context.client);\n\n const proxy = createRecursiveUtilsProxy(\n context,\n ) as CreateReactUtilsReturnType;\n\n return createFlatProxy((key) => {\n const contextName = key as (typeof contextProps)[number];\n if (contextName === 'client') {\n return clientProxy;\n }\n if (contextProps.includes(contextName)) {\n return context[contextName];\n }\n\n return proxy[key];\n });\n}\n\n/**\n * @internal\n */\nexport function createQueryUtilsProxy(\n context: TRPCQueryUtils,\n): CreateQueryUtils {\n return createRecursiveUtilsProxy(context);\n}\n","import type { QueryOptions } from '@tanstack/react-query';\nimport type { TRPCClient } from '@trpc/client';\nimport {\n getUntypedClient,\n TRPCUntypedClient,\n type TRPCClientError,\n} from '@trpc/client';\nimport type {\n AnyProcedure,\n AnyQueryProcedure,\n AnyRootTypes,\n AnyRouter,\n inferProcedureInput,\n inferTransformedProcedureOutput,\n RouterRecord,\n} from '@trpc/server/unstable-core-do-not-import';\nimport { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';\nimport { getQueryKeyInternal } from '../../internals/getQueryKey';\nimport type {\n TrpcQueryOptionsForUseQueries,\n TrpcQueryOptionsForUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport type { TRPCUseQueryBaseOptions } from '../hooks/types';\n\ntype GetQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyProcedure,\n> = >(\n input: inferProcedureInput,\n opts?: TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput,\n TData,\n TRPCClientError\n >,\n) => TrpcQueryOptionsForUseQueries<\n inferTransformedProcedureOutput,\n TData,\n TRPCClientError\n>;\n\n/**\n * @internal\n */\nexport type UseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetQueryOptions\n : $Value extends RouterRecord\n ? UseQueriesProcedureRecord\n : never\n : never;\n};\n\ntype GetSuspenseQueryOptions<\n TRoot extends AnyRootTypes,\n TProcedure extends AnyQueryProcedure,\n> = >(\n input: inferProcedureInput,\n opts?: TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput,\n TData,\n TRPCClientError\n >,\n) => TrpcQueryOptionsForUseSuspenseQueries<\n inferTransformedProcedureOutput,\n TData,\n TRPCClientError\n>;\n\n/**\n * @internal\n */\nexport type UseSuspenseQueriesProcedureRecord<\n TRoot extends AnyRootTypes,\n TRecord extends RouterRecord,\n> = {\n [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value\n ? $Value extends AnyQueryProcedure\n ? GetSuspenseQueryOptions\n : $Value extends RouterRecord\n ? UseSuspenseQueriesProcedureRecord\n : never\n : never;\n};\n\n/**\n * Create proxy for `useQueries` options\n * @internal\n */\nexport function createUseQueries(\n client: TRPCUntypedClient | TRPCClient,\n) {\n const untypedClient: TRPCUntypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return createRecursiveProxy<\n UseQueriesProcedureRecord<\n TRouter['_def']['_config']['$types'],\n TRouter['_def']['record']\n >\n >((opts) => {\n const arrayPath = opts.path;\n const dotPath = arrayPath.join('.');\n const [input, _opts] = opts.args as [\n unknown,\n Partial & TRPCUseQueryBaseOptions,\n ];\n\n const options: QueryOptions = {\n queryKey: getQueryKeyInternal(arrayPath, input, 'query'),\n queryFn: () => {\n return untypedClient.query(dotPath, input, _opts?.trpc);\n },\n ..._opts,\n };\n\n return options;\n });\n}\n","import type { TRPCQueryKey } from './getQueryKey';\n\n/**\n * @internal\n */\nexport function getClientArgs(\n queryKey: TRPCQueryKey,\n opts: TOptions,\n infiniteParams?: {\n pageParam: any;\n direction: 'forward' | 'backward';\n },\n) {\n const path = queryKey[0];\n let input = queryKey[1]?.input;\n if (infiniteParams) {\n input = {\n ...(input ?? {}),\n ...(infiniteParams.pageParam ? { cursor: infiniteParams.pageParam } : {}),\n direction: infiniteParams.direction,\n };\n }\n return [path.join('.'), input, (opts as any)?.trpc] as const;\n}\n","function _asyncIterator(r) {\n var n,\n t,\n o,\n e = 2;\n for (\"undefined\" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {\n if (t && null != (n = r[t])) return n.call(r);\n if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));\n t = \"@@asyncIterator\", o = \"@@iterator\";\n }\n throw new TypeError(\"Object is not async iterable\");\n}\nfunction AsyncFromSyncIterator(r) {\n function AsyncFromSyncIteratorContinuation(r) {\n if (Object(r) !== r) return Promise.reject(new TypeError(r + \" is not an object.\"));\n var n = r.done;\n return Promise.resolve(r.value).then(function (r) {\n return {\n value: r,\n done: n\n };\n });\n }\n return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) {\n this.s = r, this.n = r.next;\n }, AsyncFromSyncIterator.prototype = {\n s: null,\n n: null,\n next: function next() {\n return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));\n },\n \"return\": function _return(r) {\n var n = this.s[\"return\"];\n return void 0 === n ? Promise.resolve({\n value: r,\n done: !0\n }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));\n },\n \"throw\": function _throw(r) {\n var n = this.s[\"return\"];\n return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));\n }\n }, new AsyncFromSyncIterator(r);\n}\nmodule.exports = _asyncIterator, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","import type { QueryClient } from '@tanstack/react-query';\nimport * as React from 'react';\nimport type { TRPCQueryOptionsResult } from '../shared';\nimport type { TRPCHookResult } from '../shared/hooks/types';\nimport type { TRPCQueryKey } from './getQueryKey';\n\nexport function createTRPCOptionsResult(value: {\n path: readonly string[];\n}): TRPCQueryOptionsResult['trpc'] {\n const path = value.path.join('.');\n\n return {\n path,\n };\n}\n\n/**\n * Makes a stable reference of the `trpc` prop\n */\nexport function useHookResult(value: {\n path: readonly string[];\n}): TRPCHookResult['trpc'] {\n const result = createTRPCOptionsResult(value);\n return React.useMemo(() => result, [result]);\n}\n\n/**\n * @internal\n */\nexport async function buildQueryFromAsyncIterable(\n asyncIterable: AsyncIterable,\n queryClient: QueryClient,\n queryKey: TRPCQueryKey,\n) {\n const queryCache = queryClient.getQueryCache();\n\n const query = queryCache.build(queryClient, {\n queryKey,\n });\n\n query.setState({\n data: [],\n status: 'success',\n });\n\n const aggregate: unknown[] = [];\n for await (const value of asyncIterable) {\n aggregate.push(value);\n\n query.setState({\n data: [...aggregate],\n });\n }\n return aggregate;\n}\n","import type { QueryFunctionContext } from '@tanstack/react-query';\nimport {\n infiniteQueryOptions,\n queryOptions,\n skipToken,\n type QueryClient,\n} from '@tanstack/react-query';\nimport type { TRPCClient, TRPCClientError } from '@trpc/client';\nimport { getUntypedClient, TRPCUntypedClient } from '@trpc/client';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport type { AnyClientTypes } from '@trpc/server/unstable-core-do-not-import/clientish/inferrable';\nimport { getClientArgs } from '../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n createTRPCOptionsResult,\n} from '../internals/trpcResult';\nimport type { DefinedTRPCQueryOptionsOut } from '../shared';\nimport { type TRPCQueryUtils } from '../shared';\n\nexport interface CreateQueryUtilsOptions {\n /**\n * The `TRPCClient`\n */\n client: TRPCClient | TRPCUntypedClient;\n /**\n * The `QueryClient` from `react-query`\n */\n queryClient: QueryClient;\n}\n\n/**\n * Creates a set of utility functions that can be used to interact with `react-query`\n * @param opts the `TRPCClient` and `QueryClient` to use\n * @returns a set of utility functions that can be used to interact with `react-query`\n * @internal\n */\nexport function createUtilityFunctions(\n opts: CreateQueryUtilsOptions,\n): TRPCQueryUtils {\n const { client, queryClient } = opts;\n const untypedClient =\n client instanceof TRPCUntypedClient ? client : getUntypedClient(client);\n\n return {\n infiniteQueryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext,\n ): Promise => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts, {\n direction: queryFnContext.direction,\n pageParam: queryFnContext.pageParam,\n }),\n );\n\n return result;\n };\n\n return Object.assign(\n infiniteQueryOptions({\n ...opts,\n initialData: opts?.initialData as any,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n initialPageParam: (opts?.initialCursor as any) ?? null,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n );\n },\n\n queryOptions: (path, queryKey, opts) => {\n const inputIsSkipToken = queryKey[1]?.input === skipToken;\n\n const queryFn = async (\n queryFnContext: QueryFunctionContext,\n ): Promise => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(opts?.trpc?.abortOnUnmount\n ? { signal: queryFnContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await untypedClient.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(result, queryClient, queryKey);\n }\n\n return result;\n };\n\n return Object.assign(\n queryOptions({\n ...opts,\n initialData: opts?.initialData,\n queryKey,\n queryFn: inputIsSkipToken ? skipToken : queryFn,\n }),\n { trpc: createTRPCOptionsResult({ path }) },\n ) as DefinedTRPCQueryOptionsOut<\n unknown,\n unknown,\n TRPCClientError\n >;\n },\n\n fetchQuery: (queryKey, opts) => {\n return queryClient.fetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n fetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.fetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, { pageParam, direction }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n prefetchQuery: (queryKey, opts) => {\n return queryClient.prefetchQuery({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n prefetchInfiniteQuery: (queryKey, opts) => {\n return queryClient.prefetchInfiniteQuery({\n ...opts,\n queryKey,\n queryFn: ({ pageParam, direction }) => {\n return untypedClient.query(\n ...getClientArgs(queryKey, opts, { pageParam, direction }),\n );\n },\n initialPageParam: opts?.initialCursor ?? null,\n });\n },\n\n ensureQueryData: (queryKey, opts) => {\n return queryClient.ensureQueryData({\n ...opts,\n queryKey,\n queryFn: () => untypedClient.query(...getClientArgs(queryKey, opts)),\n });\n },\n\n invalidateQueries: (queryKey, filters, options) => {\n return queryClient.invalidateQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n resetQueries: (queryKey, filters, options) => {\n return queryClient.resetQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n refetchQueries: (queryKey, filters, options) => {\n return queryClient.refetchQueries(\n {\n ...filters,\n queryKey,\n },\n options,\n );\n },\n\n cancelQuery: (queryKey, options) => {\n return queryClient.cancelQueries(\n {\n queryKey,\n },\n options,\n );\n },\n\n setQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater as any, options);\n },\n\n // eslint-disable-next-line max-params\n setQueriesData: (queryKey, filters, updater, options) => {\n return queryClient.setQueriesData(\n {\n ...filters,\n queryKey,\n },\n updater,\n options,\n );\n },\n\n getQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setInfiniteQueryData: (queryKey, updater, options) => {\n return queryClient.setQueryData(queryKey, updater as any, options);\n },\n\n getInfiniteQueryData: (queryKey) => {\n return queryClient.getQueryData(queryKey);\n },\n\n setMutationDefaults: (mutationKey, options) => {\n const path = mutationKey[0];\n const canonicalMutationFn = (input: unknown) => {\n return untypedClient.mutation(\n ...getClientArgs([path, { input }], opts),\n );\n };\n return queryClient.setMutationDefaults(\n mutationKey,\n typeof options === 'function'\n ? options({ canonicalMutationFn })\n : options,\n );\n },\n\n getMutationDefaults: (mutationKey) => {\n return queryClient.getMutationDefaults(mutationKey);\n },\n\n isMutating: (filters) => {\n return queryClient.isMutating({\n ...filters,\n exact: true,\n });\n },\n };\n}\n","// TODO: Look into fixing react-compiler support\n/* eslint-disable react-hooks/react-compiler */\nimport {\n useInfiniteQuery as __useInfiniteQuery,\n useMutation as __useMutation,\n usePrefetchInfiniteQuery as __usePrefetchInfiniteQuery,\n useQueries as __useQueries,\n useQuery as __useQuery,\n useSuspenseInfiniteQuery as __useSuspenseInfiniteQuery,\n useSuspenseQueries as __useSuspenseQueries,\n useSuspenseQuery as __useSuspenseQuery,\n usePrefetchQuery as _usePrefetchQuery,\n hashKey,\n skipToken,\n} from '@tanstack/react-query';\nimport type { TRPCClientErrorLike } from '@trpc/client';\nimport {\n createTRPCClient,\n getUntypedClient,\n TRPCUntypedClient,\n} from '@trpc/client';\nimport type { Unsubscribable } from '@trpc/server/observable';\nimport type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';\nimport { isAsyncIterable } from '@trpc/server/unstable-core-do-not-import';\nimport * as React from 'react';\nimport type { SSRState, TRPCContextState } from '../../internals/context';\nimport { TRPCContext } from '../../internals/context';\nimport { getClientArgs } from '../../internals/getClientArgs';\nimport type { TRPCQueryKey } from '../../internals/getQueryKey';\nimport {\n getMutationKeyInternal,\n getQueryKeyInternal,\n} from '../../internals/getQueryKey';\nimport {\n buildQueryFromAsyncIterable,\n useHookResult,\n} from '../../internals/trpcResult';\nimport type {\n TRPCUseQueries,\n TRPCUseSuspenseQueries,\n} from '../../internals/useQueries';\nimport { createUtilityFunctions } from '../../utils/createUtilityFunctions';\nimport { createUseQueries } from '../proxy/useQueriesProxy';\nimport type { CreateTRPCReactOptions, UseMutationOverride } from '../types';\nimport type {\n TRPCProvider,\n TRPCQueryOptions,\n TRPCSubscriptionConnectingResult,\n TRPCSubscriptionIdleResult,\n TRPCSubscriptionResult,\n UseTRPCInfiniteQueryOptions,\n UseTRPCInfiniteQueryResult,\n UseTRPCMutationOptions,\n UseTRPCMutationResult,\n UseTRPCPrefetchInfiniteQueryOptions,\n UseTRPCPrefetchQueryOptions,\n UseTRPCQueryOptions,\n UseTRPCQueryResult,\n UseTRPCSubscriptionOptions,\n UseTRPCSuspenseInfiniteQueryOptions,\n UseTRPCSuspenseInfiniteQueryResult,\n UseTRPCSuspenseQueryOptions,\n UseTRPCSuspenseQueryResult,\n} from './types';\n\nconst trackResult = (\n result: T,\n onTrackResult: (key: keyof T) => void,\n): T => {\n const trackedResult = new Proxy(result, {\n get(target, prop) {\n onTrackResult(prop as keyof T);\n return target[prop as keyof T];\n },\n });\n\n return trackedResult;\n};\n\n/**\n * @internal\n */\nexport function createRootHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n>(config?: CreateTRPCReactOptions) {\n const mutationSuccessOverride: UseMutationOverride['onSuccess'] =\n config?.overrides?.useMutation?.onSuccess ??\n ((options) => options.originalFn());\n\n type TError = TRPCClientErrorLike;\n\n type ProviderContext = TRPCContextState;\n\n const Context = (config?.context ??\n TRPCContext) as React.Context;\n\n const createClient = createTRPCClient;\n\n const TRPCProvider: TRPCProvider = (props) => {\n const { abortOnUnmount = false, queryClient, ssrContext } = props;\n const [ssrState, setSSRState] = React.useState(\n props.ssrState ?? false,\n );\n\n const client: TRPCUntypedClient =\n props.client instanceof TRPCUntypedClient\n ? props.client\n : getUntypedClient(props.client);\n\n const fns = React.useMemo(\n () =>\n createUtilityFunctions({\n client,\n queryClient,\n }),\n [client, queryClient],\n );\n\n const contextValue = React.useMemo(\n () => ({\n abortOnUnmount,\n queryClient,\n client,\n ssrContext: ssrContext ?? null,\n ssrState,\n ...fns,\n }),\n [abortOnUnmount, client, fns, queryClient, ssrContext, ssrState],\n );\n\n React.useEffect(() => {\n // Only updating state to `mounted` if we are using SSR.\n // This makes it so we don't have an unnecessary re-render when opting out of SSR.\n setSSRState((state) => (state ? 'mounted' : false));\n }, []);\n return (\n {props.children}\n );\n };\n\n function useContext() {\n const context = React.useContext(Context);\n\n if (!context) {\n throw new Error(\n 'Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?',\n );\n }\n return context;\n }\n\n /**\n * Hack to make sure errors return `status`='error` when doing SSR\n * @see https://github.com/trpc/trpc/pull/1645\n */\n function useSSRQueryOptionsIfNeeded<\n TOptions extends { retryOnMount?: boolean } | undefined,\n >(queryKey: TRPCQueryKey, opts: TOptions): TOptions {\n const { queryClient, ssrState } = useContext();\n return ssrState &&\n ssrState !== 'mounted' &&\n queryClient.getQueryCache().find({ queryKey })?.state.status === 'error'\n ? {\n retryOnMount: false,\n ...opts,\n }\n : opts;\n }\n\n function useQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCQueryOptions,\n ): UseTRPCQueryResult {\n const context = useContext();\n const { abortOnUnmount, client, ssrState, queryClient, prefetchQuery } =\n context;\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchQuery(queryKey, opts as any);\n }\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? config?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useQuery(\n {\n ...ssrOpts,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : async (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n const result = await client.query(\n ...getClientArgs(queryKey, actualOpts),\n );\n\n if (isAsyncIterable(result)) {\n return buildQueryFromAsyncIterable(\n result,\n queryClient,\n queryKey,\n );\n }\n return result;\n },\n },\n queryClient,\n ) as UseTRPCQueryResult;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n\n function usePrefetchQuery(\n path: string[],\n input: unknown,\n opts?: UseTRPCPrefetchQueryOptions,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const isInputSkipToken = input === skipToken;\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n _usePrefetchQuery({\n ...opts,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : (queryFunctionContext) => {\n const actualOpts = {\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n });\n }\n\n function useSuspenseQuery(\n path: readonly string[],\n input: unknown,\n opts?: UseTRPCSuspenseQueryOptions,\n ): UseTRPCSuspenseQueryResult {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'query');\n\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ??\n config?.abortOnUnmount ??\n context.abortOnUnmount;\n\n const hook = __useSuspenseQuery(\n {\n ...opts,\n queryKey: queryKey as any,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...opts,\n trpc: {\n ...opts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return context.client.query(...getClientArgs(queryKey, actualOpts));\n },\n },\n context.queryClient,\n ) as UseTRPCQueryResult;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return [hook.data, hook as any];\n }\n\n function useMutation(\n path: readonly string[],\n opts?: UseTRPCMutationOptions,\n ): UseTRPCMutationResult {\n const { client, queryClient } = useContext();\n\n const mutationKey = getMutationKeyInternal(path);\n\n const defaultOpts = queryClient.defaultMutationOptions(\n queryClient.getMutationDefaults(mutationKey),\n );\n\n const hook = __useMutation(\n {\n ...opts,\n mutationKey: mutationKey,\n mutationFn: (input) => {\n return client.mutation(...getClientArgs([path, { input }], opts));\n },\n onSuccess(...args) {\n const originalFn = () =>\n opts?.onSuccess?.(...args) ?? defaultOpts?.onSuccess?.(...args);\n\n return mutationSuccessOverride({\n originalFn,\n queryClient,\n meta: opts?.meta ?? defaultOpts?.meta ?? {},\n });\n },\n },\n queryClient,\n ) as UseTRPCMutationResult;\n\n hook.trpc = useHookResult({\n path,\n });\n\n return hook;\n }\n const initialStateIdle: Omit, 'reset'> = {\n data: undefined,\n error: null,\n status: 'idle',\n };\n\n const initialStateConnecting: Omit<\n TRPCSubscriptionConnectingResult,\n 'reset'\n > = {\n data: undefined,\n error: null,\n status: 'connecting',\n };\n\n /* istanbul ignore next -- @preserve */\n function useSubscription(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSubscriptionOptions,\n ) {\n const enabled = opts?.enabled ?? input !== skipToken;\n const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));\n const { client } = useContext();\n\n const optsRef = React.useRef(opts);\n React.useEffect(() => {\n optsRef.current = opts;\n });\n\n type $Result = TRPCSubscriptionResult;\n\n const [trackedProps] = React.useState(new Set([]));\n\n const addTrackedProp = React.useCallback(\n (key: keyof $Result) => {\n trackedProps.add(key);\n },\n [trackedProps],\n );\n\n const currentSubscriptionRef = React.useRef(null);\n\n const updateState = React.useCallback(\n (callback: (prevState: $Result) => $Result) => {\n const prev = resultRef.current;\n const next = (resultRef.current = callback(prev));\n\n let shouldUpdate = false;\n for (const key of trackedProps) {\n if (prev[key] !== next[key]) {\n shouldUpdate = true;\n break;\n }\n }\n if (shouldUpdate) {\n setState(trackResult(next, addTrackedProp));\n }\n },\n [addTrackedProp, trackedProps],\n );\n\n const reset = React.useCallback((): void => {\n // unsubscribe from the previous subscription\n currentSubscriptionRef.current?.unsubscribe();\n\n if (!enabled) {\n updateState(() => ({ ...initialStateIdle, reset }));\n return;\n }\n updateState(() => ({ ...initialStateConnecting, reset }));\n const subscription = client.subscription(\n path.join('.'),\n input ?? undefined,\n {\n onStarted: () => {\n optsRef.current.onStarted?.();\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n error: null,\n }));\n },\n onData: (data) => {\n optsRef.current.onData?.(data);\n updateState((prev) => ({\n ...prev,\n status: 'pending',\n data,\n error: null,\n }));\n },\n onError: (error) => {\n optsRef.current.onError?.(error);\n updateState((prev) => ({\n ...prev,\n status: 'error',\n error,\n }));\n },\n onConnectionStateChange: (result) => {\n updateState((prev) => {\n switch (result.state) {\n case 'idle':\n return {\n ...prev,\n status: result.state,\n error: null,\n data: undefined,\n };\n case 'connecting':\n return {\n ...prev,\n error: result.error,\n status: result.state,\n };\n\n case 'pending':\n // handled when data is / onStarted\n return prev;\n }\n });\n },\n onComplete: () => {\n optsRef.current.onComplete?.();\n\n // In the case of WebSockets, the connection might not be idle so `onConnectionStateChange` will not be called until the connection is closed.\n // In this case, we need to set the state to idle manually.\n updateState((prev) => ({\n ...prev,\n status: 'idle',\n error: null,\n data: undefined,\n }));\n\n // (We might want to add a `connectionState` to the state to track the connection state separately)\n },\n },\n );\n\n currentSubscriptionRef.current = subscription;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client, queryKey, enabled, updateState]);\n React.useEffect(() => {\n reset();\n\n return () => {\n currentSubscriptionRef.current?.unsubscribe();\n };\n }, [reset]);\n\n const resultRef = React.useRef<$Result>(\n enabled\n ? { ...initialStateConnecting, reset }\n : { ...initialStateIdle, reset },\n );\n\n const [state, setState] = React.useState<$Result>(\n trackResult(resultRef.current, addTrackedProp),\n );\n\n return state;\n }\n\n function useInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCInfiniteQueryOptions,\n ): UseTRPCInfiniteQueryResult {\n const {\n client,\n ssrState,\n prefetchInfiniteQuery,\n queryClient,\n abortOnUnmount,\n } = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n if (\n typeof window === 'undefined' &&\n ssrState === 'prepass' &&\n opts?.trpc?.ssr !== false &&\n (opts?.enabled ?? defaultOpts?.enabled) !== false &&\n !isInputSkipToken &&\n !queryClient.getQueryCache().find({ queryKey })\n ) {\n void prefetchInfiniteQuery(queryKey, { ...defaultOpts, ...opts } as any);\n }\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount = opts?.trpc?.abortOnUnmount ?? abortOnUnmount;\n\n const hook = __useInfiniteQuery(\n {\n ...ssrOpts,\n initialPageParam: opts.initialCursor ?? null,\n persister: opts.persister,\n queryKey: queryKey as any,\n queryFn: isInputSkipToken\n ? input\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : { signal: null }),\n },\n };\n\n return client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam:\n queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n queryClient,\n ) as UseTRPCInfiniteQueryResult;\n\n hook.trpc = useHookResult({\n path,\n });\n return hook;\n }\n\n function usePrefetchInfiniteQuery(\n path: string[],\n input: unknown,\n opts: UseTRPCPrefetchInfiniteQueryOptions,\n ): void {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const isInputSkipToken = input === skipToken;\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n __usePrefetchInfiniteQuery({\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: isInputSkipToken\n ? input\n : (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n });\n }\n\n function useSuspenseInfiniteQuery(\n path: readonly string[],\n input: unknown,\n opts: UseTRPCSuspenseInfiniteQueryOptions,\n ): UseTRPCSuspenseInfiniteQueryResult {\n const context = useContext();\n const queryKey = getQueryKeyInternal(path, input, 'infinite');\n\n const defaultOpts = context.queryClient.getQueryDefaults(queryKey);\n\n const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {\n ...defaultOpts,\n ...opts,\n });\n\n // request option should take priority over global\n const shouldAbortOnUnmount =\n opts?.trpc?.abortOnUnmount ?? context.abortOnUnmount;\n\n const hook = __useSuspenseInfiniteQuery(\n {\n ...opts,\n initialPageParam: opts.initialCursor ?? null,\n queryKey,\n queryFn: (queryFunctionContext) => {\n const actualOpts = {\n ...ssrOpts,\n trpc: {\n ...ssrOpts?.trpc,\n ...(shouldAbortOnUnmount\n ? { signal: queryFunctionContext.signal }\n : {}),\n },\n };\n\n return context.client.query(\n ...getClientArgs(queryKey, actualOpts, {\n pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,\n direction: queryFunctionContext.direction,\n }),\n );\n },\n },\n context.queryClient,\n ) as UseTRPCInfiniteQueryResult;\n\n hook.trpc = useHookResult({\n path,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return [hook.data!, hook as any];\n }\n\n const useQueries: TRPCUseQueries = (queriesCallback, options) => {\n const { ssrState, queryClient, prefetchQuery, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n if (typeof window === 'undefined' && ssrState === 'prepass') {\n for (const query of queries) {\n const queryOption = query as TRPCQueryOptions;\n if (\n queryOption.trpc?.ssr !== false &&\n !queryClient.getQueryCache().find({ queryKey: queryOption.queryKey })\n ) {\n void prefetchQuery(queryOption.queryKey, queryOption as any);\n }\n }\n }\n\n return __useQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryKey: (query as TRPCQueryOptions).queryKey,\n })),\n combine: options?.combine as any,\n },\n queryClient,\n );\n };\n\n const useSuspenseQueries: TRPCUseSuspenseQueries = (\n queriesCallback,\n ) => {\n const { queryClient, client } = useContext();\n\n const proxy = createUseQueries(client);\n\n const queries = queriesCallback(proxy);\n\n const hook = __useSuspenseQueries(\n {\n queries: queries.map((query) => ({\n ...query,\n queryFn: query.queryFn,\n queryKey: (query as TRPCQueryOptions).queryKey,\n })),\n },\n queryClient,\n );\n\n return [hook.map((h) => h.data), hook] as any;\n };\n\n return {\n Provider: TRPCProvider,\n createClient,\n useContext,\n useUtils: useContext,\n useQuery,\n usePrefetchQuery,\n useSuspenseQuery,\n useQueries,\n useSuspenseQueries,\n useMutation,\n useSubscription,\n useInfiniteQuery,\n usePrefetchInfiniteQuery,\n useSuspenseInfiniteQuery,\n };\n}\n\n/**\n * Infer the type of a `createReactQueryHooks` function\n * @internal\n */\nexport type CreateReactQueryHooks<\n TRouter extends AnyRouter,\n TSSRContext = unknown,\n> = ReturnType>;\n","import type { QueryClientConfig } from '@tanstack/react-query';\nimport { QueryClient } from '@tanstack/react-query';\n\n/**\n * @internal\n */\nexport type CreateTRPCReactQueryClientConfig =\n | {\n queryClient?: QueryClient;\n queryClientConfig?: never;\n }\n | {\n queryClientConfig?: QueryClientConfig;\n queryClient?: never;\n };\n\n/**\n * @internal\n */\nexport const getQueryClient = (config: CreateTRPCReactQueryClientConfig) =>\n config.queryClient ?? new QueryClient(config.queryClientConfig);\n"],"x_google_ignoreList":[5],"mappings":";;;;;;;;;;;;;;AAQA,SAAgB,sBAGdA,OAAoD;AACpD,QAAO,qBAAqB,CAAC,EAAE,MAAM,MAAM,KAAK;;EAC9C,MAAM,WAAW,CAAC,GAAG,IAAK;EAI1B,MAAM,UAAU,SAAS,KAAK;AAE9B,MAAI,YAAY,cACd,QAAO,AAAC,MAAc,SAAS,UAAU,GAAG,KAAK;AAGnD,MAAI,YAAY,OACd,QAAO,EACL,MAAM,SACP;EAGH,MAAM,CAAC,OAAO,GAAG,KAAK,GAAG;EACzB,MAAM,iBAAO,KAAK,6CAAM,CAAE;AAE1B,SAAO,AAAC,MAAc,SAAS,UAAU,OAAO,KAAK;CACtD,EAAC;AACH;;;;;ACmFD,MAAaC,eAAyD;CACpE;CACA;CACA;CACA;AACD;AAmOD,MAAa,sCAAcC,QAAM,sEAAN,mCAAsB,KAAY;;;;ACiF7D,MAAa,eAAe,CAC1BC,aACc;AACd,SAAQ,UAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,iBACH,QAAO;EAET,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,kBACH,QAAO;EAET,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,QACH,QAAO;CACV;AACF;;;;AAKD,SAAS,0BACPC,SACA;AACA,QAAO,qBAAgD,CAAC,SAAS;EAC/D,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAC3B,MAAM,WAAW,KAAK,KAAK;EAC3B,MAAM,OAAO,CAAC,GAAG,KAAK,IAAK;EAG3B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